View | Details | Raw Unified | Return to bug 252165 | Differences between
and this patch

Collapse All | Expand All

(-)b/sys/dev/usb/net/usb_ethernet.c (+14 lines)
Lines 176-181 uether_ifattach(struct usb_ether *ue) Link Here
176
		goto error;
176
		goto error;
177
	}
177
	}
178
178
179
	cv_init(&ue->ioctl_cv, "uether_ioctl_cv");
180
179
	/* fork rest of the attach code */
181
	/* fork rest of the attach code */
180
	UE_LOCK(ue);
182
	UE_LOCK(ue);
181
	ue_queue_command(ue, ue_attach_post_task,
183
	ue_queue_command(ue, ue_attach_post_task,
Lines 314-319 uether_ifdetach(struct usb_ether *ue) Link Here
314
		/* drain any callouts */
316
		/* drain any callouts */
315
		usb_callout_drain(&ue->ue_watchdog);
317
		usb_callout_drain(&ue->ue_watchdog);
316
318
319
		cv_destroy(&ue->ioctl_cv);
320
317
		/*
321
		/*
318
		 * Detach ethernet first to stop miibus calls from
322
		 * Detach ethernet first to stop miibus calls from
319
		 * user-space:
323
		 * user-space:
Lines 499-508 ue_tick_task(struct usb_proc_msg *_task) Link Here
499
	struct usb_ether *ue = task->ue;
503
	struct usb_ether *ue = task->ue;
500
	if_t ifp = ue->ue_ifp;
504
	if_t ifp = ue->ue_ifp;
501
505
506
502
	if ((if_getdrvflags(ifp) & IFF_DRV_RUNNING) == 0)
507
	if ((if_getdrvflags(ifp) & IFF_DRV_RUNNING) == 0)
503
		return;
508
		return;
504
509
510
	ue->ticking = 1;
505
	ue->ue_methods->ue_tick(ue);
511
	ue->ue_methods->ue_tick(ue);
512
	cv_signal(&ue->ioctl_cv);
513
	ue->ticking = 0;
506
}
514
}
507
515
508
int
516
int
Lines 543-548 uether_ioctl(if_t ifp, u_long command, caddr_t data) Link Here
543
	case SIOCGIFMEDIA:
551
	case SIOCGIFMEDIA:
544
	case SIOCSIFMEDIA:
552
	case SIOCSIFMEDIA:
545
		if (ue->ue_miibus != NULL) {
553
		if (ue->ue_miibus != NULL) {
554
			/* Wait until tick code yields */
555
			if ((if_getdrvflags(ifp) & IFF_DRV_RUNNING) && ue->ticking) {
556
				UE_LOCK(ue);
557
				cv_wait(&ue->ioctl_cv, ue->ue_mtx);
558
				UE_UNLOCK(ue);
559
			}
546
			mii = device_get_softc(ue->ue_miibus);
560
			mii = device_get_softc(ue->ue_miibus);
547
			error = ifmedia_ioctl(ifp, ifr, &mii->mii_media, command);
561
			error = ifmedia_ioctl(ifp, ifr, &mii->mii_media, command);
548
		} else
562
		} else
(-)b/sys/dev/usb/net/usb_ethernet.h (-1 / +5 lines)
Lines 75-80 struct usb_ether { Link Here
75
	/* NOTE: the "ue_ifp" pointer must be first --hps */
75
	/* NOTE: the "ue_ifp" pointer must be first --hps */
76
	if_t			ue_ifp;
76
	if_t			ue_ifp;
77
	struct mtx		*ue_mtx;
77
	struct mtx		*ue_mtx;
78
79
	/* Avoid race between ioctl and tick media status */
80
	struct cv		ioctl_cv;
81
	int			ticking;
82
78
	const struct usb_ether_methods *ue_methods;
83
	const struct usb_ether_methods *ue_methods;
79
	struct sysctl_oid	*ue_sysctl_oid;
84
	struct sysctl_oid	*ue_sysctl_oid;
80
	void			*ue_sc;
85
	void			*ue_sc;
81
- 

Return to bug 252165