Lines Matching full:ue

59 static SYSCTL_NODE(_net, OID_AUTO, ue, CTLFLAG_RD | CTLFLAG_MPSAFE, 0,
90 uether_pause(struct usb_ether *ue, unsigned _ticks) in uether_pause() argument
92 if (usb_proc_is_gone(&ue->ue_tq)) { in uether_pause()
96 usb_pause_mtx(ue->ue_mtx, _ticks); in uether_pause()
101 ue_queue_command(struct usb_ether *ue, in ue_queue_command() argument
107 UE_LOCK_ASSERT(ue, MA_OWNED); in ue_queue_command()
109 if (usb_proc_is_gone(&ue->ue_tq)) { in ue_queue_command()
118 usb_proc_msignal(&ue->ue_tq, t0, t1); in ue_queue_command()
122 task->ue = ue; in ue_queue_command()
128 usb_proc_mwait(&ue->ue_tq, t0, t1); in ue_queue_command()
132 uether_getifp(struct usb_ether *ue) in uether_getifp() argument
134 return (ue->ue_ifp); in uether_getifp()
138 uether_getmii(struct usb_ether *ue) in uether_getmii() argument
140 return (device_get_softc(ue->ue_miibus)); in uether_getmii()
144 uether_getsc(struct usb_ether *ue) in uether_getsc() argument
146 return (ue->ue_sc); in uether_getsc()
152 struct usb_ether *ue = arg1; in ue_sysctl_parent() local
155 name = device_get_nameunit(ue->ue_dev); in ue_sysctl_parent()
160 uether_ifattach(struct usb_ether *ue) in uether_ifattach() argument
165 if ((ue->ue_dev == NULL) || in uether_ifattach()
166 (ue->ue_udev == NULL) || in uether_ifattach()
167 (ue->ue_mtx == NULL) || in uether_ifattach()
168 (ue->ue_methods == NULL)) in uether_ifattach()
171 error = usb_proc_create(&ue->ue_tq, ue->ue_mtx, in uether_ifattach()
172 device_get_nameunit(ue->ue_dev), USB_PRI_MED); in uether_ifattach()
174 device_printf(ue->ue_dev, "could not setup taskqueue\n"); in uether_ifattach()
179 UE_LOCK(ue); in uether_ifattach()
180 ue_queue_command(ue, ue_attach_post_task, in uether_ifattach()
181 &ue->ue_sync_task[0].hdr, in uether_ifattach()
182 &ue->ue_sync_task[1].hdr); in uether_ifattach()
183 UE_UNLOCK(ue); in uether_ifattach()
190 uether_ifattach_wait(struct usb_ether *ue) in uether_ifattach_wait() argument
193 UE_LOCK(ue); in uether_ifattach_wait()
194 usb_proc_mwait(&ue->ue_tq, in uether_ifattach_wait()
195 &ue->ue_sync_task[0].hdr, in uether_ifattach_wait()
196 &ue->ue_sync_task[1].hdr); in uether_ifattach_wait()
197 UE_UNLOCK(ue); in uether_ifattach_wait()
205 struct usb_ether *ue = task->ue; in ue_attach_post_task() local
211 ue->ue_methods->ue_attach_post(ue); in ue_attach_post_task()
213 UE_UNLOCK(ue); in ue_attach_post_task()
215 ue->ue_unit = alloc_unr(ueunit); in ue_attach_post_task()
216 usb_callout_init_mtx(&ue->ue_watchdog, ue->ue_mtx, 0); in ue_attach_post_task()
217 sysctl_ctx_init(&ue->ue_sysctl_ctx); in ue_attach_post_task()
218 mbufq_init(&ue->ue_rxq, 0 /* unlimited length */); in ue_attach_post_task()
223 if_setsoftc(ifp, ue); in ue_attach_post_task()
224 if_initname(ifp, "ue", ue->ue_unit); in ue_attach_post_task()
225 if (ue->ue_methods->ue_attach_post_sub != NULL) { in ue_attach_post_task()
226 ue->ue_ifp = ifp; in ue_attach_post_task()
227 error = ue->ue_methods->ue_attach_post_sub(ue); in ue_attach_post_task()
230 if (ue->ue_methods->ue_ioctl != NULL) in ue_attach_post_task()
231 if_setioctlfn(ifp, ue->ue_methods->ue_ioctl); in ue_attach_post_task()
238 ue->ue_ifp = ifp; in ue_attach_post_task()
240 if (ue->ue_methods->ue_mii_upd != NULL && in ue_attach_post_task()
241 ue->ue_methods->ue_mii_sts != NULL) { in ue_attach_post_task()
243 error = mii_attach(ue->ue_dev, &ue->ue_miibus, ifp, in ue_attach_post_task()
244 ue_ifmedia_upd, ue->ue_methods->ue_mii_sts, in ue_attach_post_task()
251 device_printf(ue->ue_dev, "attaching PHYs failed\n"); in ue_attach_post_task()
255 if_printf(ifp, "<USB Ethernet> on %s\n", device_get_nameunit(ue->ue_dev)); in ue_attach_post_task()
256 ether_ifattach(ifp, ue->ue_eaddr); in ue_attach_post_task()
263 snprintf(num, sizeof(num), "%u", ue->ue_unit); in ue_attach_post_task()
264 ue->ue_sysctl_oid = SYSCTL_ADD_NODE(&ue->ue_sysctl_ctx, in ue_attach_post_task()
265 &SYSCTL_NODE_CHILDREN(_net, ue), in ue_attach_post_task()
267 SYSCTL_ADD_PROC(&ue->ue_sysctl_ctx, in ue_attach_post_task()
268 SYSCTL_CHILDREN(ue->ue_sysctl_oid), OID_AUTO, "%parent", in ue_attach_post_task()
269 CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, ue, 0, in ue_attach_post_task()
272 UE_LOCK(ue); in ue_attach_post_task()
279 mbufq_drain(&ue->ue_rxq); in ue_attach_post_task()
282 free_unr(ueunit, ue->ue_unit); in ue_attach_post_task()
283 if (ue->ue_ifp != NULL) { in ue_attach_post_task()
284 if_free(ue->ue_ifp); in ue_attach_post_task()
285 ue->ue_ifp = NULL; in ue_attach_post_task()
287 UE_LOCK(ue); in ue_attach_post_task()
292 uether_ifdetach(struct usb_ether *ue) in uether_ifdetach() argument
297 usb_proc_drain(&ue->ue_tq); in uether_ifdetach()
300 ifp = ue->ue_ifp; in uether_ifdetach()
304 UE_LOCK(ue); in uether_ifdetach()
306 UE_UNLOCK(ue); in uether_ifdetach()
309 usb_callout_drain(&ue->ue_watchdog); in uether_ifdetach()
319 bus_generic_detach(ue->ue_dev); in uether_ifdetach()
326 sysctl_ctx_free(&ue->ue_sysctl_ctx); in uether_ifdetach()
329 mbufq_drain(&ue->ue_rxq); in uether_ifdetach()
332 free_unr(ueunit, ue->ue_unit); in uether_ifdetach()
336 usb_proc_free(&ue->ue_tq); in uether_ifdetach()
340 uether_is_gone(struct usb_ether *ue) in uether_is_gone() argument
342 return (usb_proc_is_gone(&ue->ue_tq)); in uether_is_gone()
355 struct usb_ether *ue = arg; in ue_init() local
357 UE_LOCK(ue); in ue_init()
358 ue_queue_command(ue, ue_start_task, in ue_init()
359 &ue->ue_sync_task[0].hdr, in ue_init()
360 &ue->ue_sync_task[1].hdr); in ue_init()
361 UE_UNLOCK(ue); in ue_init()
369 struct usb_ether *ue = task->ue; in ue_start_task() local
370 if_t ifp = ue->ue_ifp; in ue_start_task()
372 UE_LOCK_ASSERT(ue, MA_OWNED); in ue_start_task()
374 ue->ue_methods->ue_init(ue); in ue_start_task()
379 if (ue->ue_methods->ue_tick != NULL) in ue_start_task()
380 usb_callout_reset(&ue->ue_watchdog, hz, ue_watchdog, ue); in ue_start_task()
388 struct usb_ether *ue = task->ue; in ue_stop_task() local
390 UE_LOCK_ASSERT(ue, MA_OWNED); in ue_stop_task()
392 usb_callout_stop(&ue->ue_watchdog); in ue_stop_task()
394 ue->ue_methods->ue_stop(ue); in ue_stop_task()
407 struct usb_ether *ue = if_getsoftc(ifp); in ue_start() local
412 UE_LOCK(ue); in ue_start()
413 ue->ue_methods->ue_start(ue); in ue_start()
414 UE_UNLOCK(ue); in ue_start()
422 struct usb_ether *ue = task->ue; in ue_promisc_task() local
424 ue->ue_methods->ue_setpromisc(ue); in ue_promisc_task()
432 struct usb_ether *ue = task->ue; in ue_setmulti_task() local
434 ue->ue_methods->ue_setmulti(ue); in ue_setmulti_task()
447 struct usb_ether *ue = if_getsoftc(ifp); in ue_ifmedia_upd() local
450 UE_LOCK(ue); in ue_ifmedia_upd()
451 ue_queue_command(ue, ue_ifmedia_task, in ue_ifmedia_upd()
452 &ue->ue_media_task[0].hdr, in ue_ifmedia_upd()
453 &ue->ue_media_task[1].hdr); in ue_ifmedia_upd()
454 UE_UNLOCK(ue); in ue_ifmedia_upd()
464 struct usb_ether *ue = task->ue; in ue_ifmedia_task() local
465 if_t ifp = ue->ue_ifp; in ue_ifmedia_task()
467 ue->ue_methods->ue_mii_upd(ifp); in ue_ifmedia_task()
473 struct usb_ether *ue = arg; in ue_watchdog() local
474 if_t ifp = ue->ue_ifp; in ue_watchdog()
479 ue_queue_command(ue, ue_tick_task, in ue_watchdog()
480 &ue->ue_tick_task[0].hdr, in ue_watchdog()
481 &ue->ue_tick_task[1].hdr); in ue_watchdog()
483 usb_callout_reset(&ue->ue_watchdog, hz, ue_watchdog, ue); in ue_watchdog()
491 struct usb_ether *ue = task->ue; in ue_tick_task() local
492 if_t ifp = ue->ue_ifp; in ue_tick_task()
497 ue->ue_methods->ue_tick(ue); in ue_tick_task()
503 struct usb_ether *ue = if_getsoftc(ifp); in uether_ioctl() local
510 UE_LOCK(ue); in uether_ioctl()
513 ue_queue_command(ue, ue_promisc_task, in uether_ioctl()
514 &ue->ue_promisc_task[0].hdr, in uether_ioctl()
515 &ue->ue_promisc_task[1].hdr); in uether_ioctl()
517 ue_queue_command(ue, ue_start_task, in uether_ioctl()
518 &ue->ue_sync_task[0].hdr, in uether_ioctl()
519 &ue->ue_sync_task[1].hdr); in uether_ioctl()
521 ue_queue_command(ue, ue_stop_task, in uether_ioctl()
522 &ue->ue_sync_task[0].hdr, in uether_ioctl()
523 &ue->ue_sync_task[1].hdr); in uether_ioctl()
525 UE_UNLOCK(ue); in uether_ioctl()
529 UE_LOCK(ue); in uether_ioctl()
530 ue_queue_command(ue, ue_setmulti_task, in uether_ioctl()
531 &ue->ue_multi_task[0].hdr, in uether_ioctl()
532 &ue->ue_multi_task[1].hdr); in uether_ioctl()
533 UE_UNLOCK(ue); in uether_ioctl()
537 if (ue->ue_miibus != NULL) { in uether_ioctl()
538 mii = device_get_softc(ue->ue_miibus); in uether_ioctl()
586 uether_rxmbuf(struct usb_ether *ue, struct mbuf *m, in uether_rxmbuf() argument
589 if_t ifp = ue->ue_ifp; in uether_rxmbuf()
591 UE_LOCK_ASSERT(ue, MA_OWNED); in uether_rxmbuf()
606 (void)mbufq_enqueue(&ue->ue_rxq, m); in uether_rxmbuf()
611 uether_rxbuf(struct usb_ether *ue, struct usb_page_cache *pc, in uether_rxbuf() argument
614 if_t ifp = ue->ue_ifp; in uether_rxbuf()
617 UE_LOCK_ASSERT(ue, MA_OWNED); in uether_rxbuf()
636 (void)mbufq_enqueue(&ue->ue_rxq, m); in uether_rxbuf()
641 uether_rxflush(struct usb_ether *ue) in uether_rxflush() argument
643 if_t ifp = ue->ue_ifp; in uether_rxflush()
647 UE_LOCK_ASSERT(ue, MA_OWNED); in uether_rxflush()
649 n = mbufq_flush(&ue->ue_rxq); in uether_rxflush()
650 UE_UNLOCK(ue); in uether_rxflush()
658 UE_LOCK(ue); in uether_rxflush()