From 0c89167c7608e22c8e933d230aa5035f7e3dcc88 Mon Sep 17 00:00:00 2001 From: Hans Petter Selasky Date: Thu, 24 May 2018 15:24:42 +0000 Subject: [PATCH] Add function to wait for USB ethernet attach to complete. MFC after: 1 week Sponsored by: Mellanox Technologies --- sys/dev/usb/net/usb_ethernet.c | 11 +++++++++++ sys/dev/usb/net/usb_ethernet.h | 1 + 2 files changed, 12 insertions(+) diff --git a/sys/dev/usb/net/usb_ethernet.c b/sys/dev/usb/net/usb_ethernet.c index 53c40302d491..3dda564d523b 100644 --- a/sys/dev/usb/net/usb_ethernet.c +++ b/sys/dev/usb/net/usb_ethernet.c @@ -190,6 +190,17 @@ uether_ifattach(struct usb_ether *ue) return (error); } +void +uether_ifattach_wait(struct usb_ether *ue) +{ + + UE_LOCK(ue); + usb_proc_mwait(&ue->ue_tq, + &ue->ue_sync_task[0].hdr, + &ue->ue_sync_task[1].hdr); + UE_UNLOCK(ue); +} + static void ue_attach_post_task(struct usb_proc_msg *_task) { diff --git a/sys/dev/usb/net/usb_ethernet.h b/sys/dev/usb/net/usb_ethernet.h index 59c41a9171b0..b288e7ae606b 100644 --- a/sys/dev/usb/net/usb_ethernet.h +++ b/sys/dev/usb/net/usb_ethernet.h @@ -113,6 +113,7 @@ struct ifnet *uether_getifp(struct usb_ether *); struct mii_data *uether_getmii(struct usb_ether *); void *uether_getsc(struct usb_ether *); int uether_ifattach(struct usb_ether *); +void uether_ifattach_wait(struct usb_ether *); void uether_ifdetach(struct usb_ether *); int uether_ifmedia_upd(struct ifnet *); void uether_init(void *);