Re: USBIP protocol

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Alan Stern
Date: Tuesday, September 9, 2008 - 8:21 am

On Mon, 8 Sep 2008, Matthew Wilcox wrote:


That's okay; I'm not on a deadline.  :-)


It is unfortunate that these two words have been used in multiple ways, 
with meanings that are sometimes only subtly different and sometimes 
grossly conflicting.

Isn't it standard in networking circles for "server" to mean the system
running a daemon that waits for incoming connections and "client" to
mean the system running an on-demand program that initiates a
connection?


Okay, "controller" and "target".  I'm not sure that "controller" is the
best word either, since it might be confused with "USB host
controller".


Hmmm.  Above you said that the controller system runs a program named 
"usbip" and the target system loads a module named "usbip".  Since the 
stub driver is the usbip _module_, it must run on the target (AKA 
server).  Right?


Yes; it is referred to as a "virtual root hub", or just "root hub" for 
short.  We didn't make this up; section 10.2.8 of the USB spec is 
entitled "Root Hub".

FYI, the *hci-hcd modules are collectively known as "host controller
drivers", or HCDs for short.  We USB guys sling that term around a lot
-- if you start using it too you'll impress other programmers.  :-)



Right.


"Detaches" isn't a USB term.  Do you mean it in the sense of a SCSI 
initiator detaching from its target?

In any event, the answer is that each endpoint has several properties
associated with it (direction, type, maximum packet size, and so on),
and these properties have to be known by both the target's USB stack
and the target's USB host controller hardware.  The hardware uses DMA
to access various in-memory data structures describing the I/O
operations it should perform, and the format and contents of these data
structures depends on the endpoints' properties.  (To make matters
worse, the hardware will sometimes maintain an internal cache for parts
of the data structures and some of the properties; when the properties 
change the cache must be flushed.)

With new configurations or altsettings you end up with a new set of
endpoints, or the same old endpoints with a new set of properties.  
Thus the target really needs to know when these things change.


I suppose the controller system, as part of its normal initialization 
procedure for new devices, would issue such a reset.  This area is 
still a little cloudy -- we know that the controller system shouldn't 
treat a new USBIP device exactly the same as a new normal USB device, 
but exactly what the difference should be has yet to be fleshed out.

We may even want to have some sort of method table with entries for 
initialization, reset, suspend, resume, and clear-halt.


It happens in the HCD, not in the device.


There's more to it.  The USB stack behaves qualitatively and 
quantitatively differently in these two cases:

	An URB completes, the completion handler returns, and then
	a new URB is submitted.

	A new URB is submitted either before the old one completes
	or while the old URB's completion handler is running.

With USBIP it's not feasible for an URB queued on the controller
machine to be submitted as part of the target's completion handler
processing.  If the URB was queued in the target's usbipd driver then 
this would be feasible.  And of course, if the URB was queued in the 
target's HCD then no special treatment would be needed.

For relevant background information, read the kerneldoc for 
usb_submit_urb() and usb_unlink_urb() in drivers/usb/core/urb.c.

Alan Stern

--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
USBIP protocol, Matthew Wilcox, (Fri Aug 29, 7:02 am)
Re: USBIP protocol, Andi Kleen, (Fri Aug 29, 7:06 am)
Re: USBIP protocol, Greg KH, (Fri Aug 29, 7:30 am)
Re: USBIP protocol, Matthew Wilcox, (Fri Aug 29, 7:43 am)
Re: USBIP protocol, Greg KH, (Fri Aug 29, 7:54 am)
Re: USBIP protocol, Matthew Wilcox, (Fri Aug 29, 8:36 am)
RE: USBIP protocol, Dave Higton, (Fri Aug 29, 8:53 am)
Re: USBIP protocol, Matthew Wilcox, (Fri Aug 29, 1:46 pm)
Re: USBIP protocol, Willy Tarreau, (Fri Aug 29, 1:51 pm)
Re: USBIP protocol, Marcel Holtmann, (Fri Aug 29, 3:31 pm)
Re: USBIP protocol, Matthew Wilcox, (Tue Sep 2, 9:25 pm)
Re: USBIP protocol, Alan Stern, (Wed Sep 3, 8:40 am)
Re: USBIP protocol, Greg KH, (Wed Sep 3, 8:57 am)
Re: USBIP protocol, Matthew Wilcox, (Wed Sep 3, 12:10 pm)
Re: USBIP protocol, Matthew Wilcox, (Wed Sep 3, 12:43 pm)
Re: USBIP protocol, Alan Stern, (Wed Sep 3, 1:15 pm)
Re: USBIP protocol, Greg KH, (Wed Sep 3, 7:41 pm)
Re: USBIP protocol, Matthew Wilcox, (Thu Sep 4, 2:48 pm)
Re: USBIP protocol, Greg KH, (Thu Sep 4, 3:15 pm)
Re: USBIP protocol, Pete Zaitcev, (Thu Sep 4, 8:26 pm)
Re: USBIP protocol, Tilman Schmidt, (Fri Sep 5, 4:37 am)
Re: USBIP protocol, Alan Stern, (Fri Sep 5, 8:05 am)
Re: USBIP protocol, Matthew Wilcox, (Mon Sep 8, 5:53 pm)
Re: USBIP protocol, Steve Calfee, (Tue Sep 9, 12:12 am)
Re: USBIP protocol, Greg KH, (Tue Sep 9, 12:33 am)
Re: USBIP protocol, Greg KH, (Tue Sep 9, 1:04 am)
Re: USBIP protocol, Alan Stern, (Tue Sep 9, 8:21 am)