Lines 176-181
uether_ifattach(struct usb_ether *ue)
Link Here
|
176 |
goto error; |
176 |
goto error; |
177 |
} |
177 |
} |
178 |
|
178 |
|
|
|
179 |
ue->ioctl_cnt = 0; |
180 |
ue->ticking = 0; |
181 |
cv_init(&ue->tick_cv, "uether_tick_cv"); |
182 |
cv_init(&ue->ioctl_cv, "uether_ioctl_cv"); |
183 |
|
179 |
/* fork rest of the attach code */ |
184 |
/* fork rest of the attach code */ |
180 |
UE_LOCK(ue); |
185 |
UE_LOCK(ue); |
181 |
ue_queue_command(ue, ue_attach_post_task, |
186 |
ue_queue_command(ue, ue_attach_post_task, |
Lines 327-332
uether_ifdetach(struct usb_ether *ue)
Link Here
|
327 |
bus_topo_unlock(); |
332 |
bus_topo_unlock(); |
328 |
} |
333 |
} |
329 |
|
334 |
|
|
|
335 |
cv_destroy(&ue->ioctl_cv); |
336 |
cv_destroy(&ue->tick_cv); |
337 |
|
330 |
/* free interface instance */ |
338 |
/* free interface instance */ |
331 |
if_free(ifp); |
339 |
if_free(ifp); |
332 |
|
340 |
|
Lines 499-508
ue_tick_task(struct usb_proc_msg *_task)
Link Here
|
499 |
struct usb_ether *ue = task->ue; |
507 |
struct usb_ether *ue = task->ue; |
500 |
if_t ifp = ue->ue_ifp; |
508 |
if_t ifp = ue->ue_ifp; |
501 |
|
509 |
|
|
|
510 |
|
502 |
if ((if_getdrvflags(ifp) & IFF_DRV_RUNNING) == 0) |
511 |
if ((if_getdrvflags(ifp) & IFF_DRV_RUNNING) == 0) |
503 |
return; |
512 |
return; |
504 |
|
513 |
ue->ticking = 1; |
505 |
ue->ue_methods->ue_tick(ue); |
514 |
ue->ue_methods->ue_tick(ue); |
|
|
515 |
cv_signal(&ue->tick_cv); |
516 |
ue->ticking = 0; |
506 |
} |
517 |
} |
507 |
|
518 |
|
508 |
int |
519 |
int |
Lines 543-550
uether_ioctl(if_t ifp, u_long command, caddr_t data)
Link Here
|
543 |
case SIOCGIFMEDIA: |
554 |
case SIOCGIFMEDIA: |
544 |
case SIOCSIFMEDIA: |
555 |
case SIOCSIFMEDIA: |
545 |
if (ue->ue_miibus != NULL) { |
556 |
if (ue->ue_miibus != NULL) { |
|
|
557 |
UE_LOCK(ue); |
558 |
while(ue->ticking) |
559 |
cv_wait(&ue->tick_cv, ue->ue_mtx); |
560 |
while(ue->ioctl_cnt) |
561 |
cv_wait(&ue->ioctl_cv, ue->ue_mtx); |
562 |
UE_UNLOCK(ue); |
546 |
mii = device_get_softc(ue->ue_miibus); |
563 |
mii = device_get_softc(ue->ue_miibus); |
|
|
564 |
ue->ioctl_cnt = 1; |
547 |
error = ifmedia_ioctl(ifp, ifr, &mii->mii_media, command); |
565 |
error = ifmedia_ioctl(ifp, ifr, &mii->mii_media, command); |
|
|
566 |
ue->ioctl_cnt = 0; |
567 |
cv_signal(&ue->ioctl_cv); |
548 |
} else |
568 |
} else |
549 |
error = ether_ioctl(ifp, command, data); |
569 |
error = ether_ioctl(ifp, command, data); |
550 |
break; |
570 |
break; |