Lines Matching full:mbus
74 struct mctp_i3c_bus *mbus; member
103 struct net_device_stats *stats = &mi->mbus->ndev->stats; in mctp_i3c_read()
110 skb = netdev_alloc_skb(mi->mbus->ndev, in mctp_i3c_read()
123 put_unaligned_be48(mi->mbus->pid, ihdr->dest); in mctp_i3c_read()
251 static int mctp_i3c_add_device(struct mctp_i3c_bus *mbus, in mctp_i3c_add_device() argument
263 mi->mbus = mbus; in mctp_i3c_add_device()
266 list_add(&mi->list, &mbus->devs); in mctp_i3c_add_device()
286 struct mctp_i3c_bus *b = NULL, *mbus = NULL; in mctp_i3c_probe() local
292 mbus = b; in mctp_i3c_probe()
297 if (!mbus) { in mctp_i3c_probe()
302 return mctp_i3c_add_device(mbus, i3c); in mctp_i3c_probe()
341 mctp_i3c_lookup(struct mctp_i3c_bus *mbus, u64 pid) in mctp_i3c_lookup() argument
346 list_for_each_entry(mi, &mbus->devs, list) in mctp_i3c_lookup()
356 static void mctp_i3c_xmit(struct mctp_i3c_bus *mbus, struct sk_buff *skb) in mctp_i3c_xmit() argument
358 struct net_device_stats *stats = &mbus->ndev->stats; in mctp_i3c_xmit()
374 mi = mctp_i3c_lookup(mbus, pid); in mctp_i3c_xmit()
397 skb_copy_bits(skb, 0, mbus->tx_scratch, skb->len); in mctp_i3c_xmit()
398 data = mbus->tx_scratch; in mctp_i3c_xmit()
423 struct mctp_i3c_bus *mbus = data; in mctp_i3c_tx_thread() local
430 spin_lock_bh(&mbus->tx_lock); in mctp_i3c_tx_thread()
431 skb = mbus->tx_skb; in mctp_i3c_tx_thread()
432 mbus->tx_skb = NULL; in mctp_i3c_tx_thread()
433 spin_unlock_bh(&mbus->tx_lock); in mctp_i3c_tx_thread()
435 if (netif_queue_stopped(mbus->ndev)) in mctp_i3c_tx_thread()
436 netif_wake_queue(mbus->ndev); in mctp_i3c_tx_thread()
439 mctp_i3c_xmit(mbus, skb); in mctp_i3c_tx_thread()
442 wait_event_idle(mbus->tx_wq, in mctp_i3c_tx_thread()
443 mbus->tx_skb || kthread_should_stop()); in mctp_i3c_tx_thread()
453 struct mctp_i3c_bus *mbus = netdev_priv(ndev); in mctp_i3c_start_xmit() local
456 spin_lock(&mbus->tx_lock); in mctp_i3c_start_xmit()
458 if (mbus->tx_skb) { in mctp_i3c_start_xmit()
462 mbus->tx_skb = skb; in mctp_i3c_start_xmit()
465 spin_unlock(&mbus->tx_lock); in mctp_i3c_start_xmit()
468 wake_up(&mbus->tx_wq); in mctp_i3c_start_xmit()
473 static void mctp_i3c_bus_free(struct mctp_i3c_bus *mbus) in mctp_i3c_bus_free() argument
478 if (mbus->tx_thread) { in mctp_i3c_bus_free()
479 kthread_stop(mbus->tx_thread); in mctp_i3c_bus_free()
480 mbus->tx_thread = NULL; in mctp_i3c_bus_free()
484 list_for_each_entry_safe(mi, tmp, &mbus->devs, list) { in mctp_i3c_bus_free()
488 kfree_skb(mbus->tx_skb); in mctp_i3c_bus_free()
489 list_del(&mbus->list); in mctp_i3c_bus_free()
494 struct mctp_i3c_bus *mbus = netdev_priv(ndev); in mctp_i3c_ndo_uninit() local
497 mctp_i3c_bus_free(mbus); in mctp_i3c_ndo_uninit()
567 struct mctp_i3c_bus *mbus = NULL; in mctp_i3c_bus_add() local
577 ndev = alloc_netdev(sizeof(*mbus), namebuf, NET_NAME_ENUM, in mctp_i3c_bus_add()
584 mbus = netdev_priv(ndev); in mctp_i3c_bus_add()
585 mbus->ndev = ndev; in mctp_i3c_bus_add()
586 mbus->bus = bus; in mctp_i3c_bus_add()
587 INIT_LIST_HEAD(&mbus->devs); in mctp_i3c_bus_add()
588 list_add(&mbus->list, &busdevs); in mctp_i3c_bus_add()
590 rc = mctp_i3c_bus_local_pid(bus, &mbus->pid); in mctp_i3c_bus_add()
595 put_unaligned_be48(mbus->pid, addr); in mctp_i3c_bus_add()
598 init_waitqueue_head(&mbus->tx_wq); in mctp_i3c_bus_add()
599 spin_lock_init(&mbus->tx_lock); in mctp_i3c_bus_add()
600 mbus->tx_thread = kthread_run(mctp_i3c_tx_thread, mbus, in mctp_i3c_bus_add()
602 if (IS_ERR(mbus->tx_thread)) { in mctp_i3c_bus_add()
604 mbus->tx_thread); in mctp_i3c_bus_add()
605 rc = PTR_ERR(mbus->tx_thread); in mctp_i3c_bus_add()
606 mbus->tx_thread = NULL; in mctp_i3c_bus_add()
615 return mbus; in mctp_i3c_bus_add()
619 * so we perform the same mbus cleanup manually. in mctp_i3c_bus_add()
621 mctp_i3c_bus_free(mbus); in mctp_i3c_bus_add()
630 static void mctp_i3c_bus_remove(struct mctp_i3c_bus *mbus) in mctp_i3c_bus_remove() argument
634 mctp_unregister_netdev(mbus->ndev); in mctp_i3c_bus_remove()
636 free_netdev(mbus->ndev); in mctp_i3c_bus_remove()
637 /* mbus is deallocated */ in mctp_i3c_bus_remove()
643 struct mctp_i3c_bus *mbus = NULL, *tmp = NULL; in mctp_i3c_bus_remove_all() local
646 list_for_each_entry_safe(mbus, tmp, &busdevs, list) { in mctp_i3c_bus_remove_all()
647 mctp_i3c_bus_remove(mbus); in mctp_i3c_bus_remove_all()
657 struct mctp_i3c_bus *mbus = NULL, *tmp = NULL; in mctp_i3c_bus_add_new() local
661 list_for_each_entry_safe(mbus, tmp, &busdevs, list) in mctp_i3c_bus_add_new()
662 if (mbus->bus == bus) in mctp_i3c_bus_add_new()
676 struct mctp_i3c_bus *mbus = NULL, *tmp; in mctp_i3c_notify_bus_remove() local
679 list_for_each_entry_safe(mbus, tmp, &busdevs, list) in mctp_i3c_notify_bus_remove()
680 if (mbus->bus == bus) in mctp_i3c_notify_bus_remove()
681 mctp_i3c_bus_remove(mbus); in mctp_i3c_notify_bus_remove()