Re: USBIP protocol

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Matthew Wilcox
Date: Tuesday, September 2, 2008 - 9:25 pm

On Fri, Aug 29, 2008 at 07:54:07AM -0700, Greg KH wrote:

Here's a document for discussion.  No code yet, though I'm quite willing
to modify the current usbip code to follow this new protocol.  Just a
matter of time.

http://www.kernel.org/pub/linux/kernel/people/willy/usbip/usbip-protocol-draft-1

To save some time for reviewers, here's a list of decisions I took while
working on the document.  I appreciate that some of the decisions I made
were not necessarily those another designer might have made, so I ask
that any comments along the lines of "I would have done it differently"
include a really good reason.

----

I've merged the two protocols.  It is no longer the case that the protocol
completely changes when userspace drops the connection into the kernel.
It's still possible to do a hybrid implementation where userspace
implements version, list and claim and kernelspace handles release,
submit and unlink.

During development of my own implementation, I noticed the client and
server get confused about where the packets were in the TCP stream.
No more; if using a stream protocol, we wrap each packet in a 'RM'.

I considered using the whole of sunrpc.  The encoding is quite
heavyweight and I felt I could do better by specialising the protocol to
USB's purposes.

'get version' is now a call rather than including a version field in
every request.

Devices are now referred to as an ascii string rather than an encoded
4-byte quantity.  This helps userspace configure the device and lets us
interoperate with other OSes that might want to implement this protocol.

Instead of transmitting the device number in every command, we now bind
each socket to a particular device.  This was already what happened,
so it was just overhead.

I've split 'cmd_submit' into four commands (control, data, isoc, irq).
That gives us the ability to make 'data' very small.

There's no need to respond with the call number to each call -- the
caller should be using the call identifier to find out what type of
call it was.  Often the implementation will issue a command and then
wait for the response, so even that is unnecessary.

Replying with the status is vital.

I decided to make the 'call' value 32-bit (instead of 8-bit) to make
everything align nicely.  Then I wanted to slim down the data command
call, so I tucked the endpoint and direction in there too.

I have no experience with isosynchronous transactions, nor interrupt
transactions, so I decline to define them at this moment.

I've given up on the big/little endian thing.  Network protocols are
traditionally BE, USB is LE and it can encapsulate SCSI which is BE again.

-- 
Matthew Wilcox				Intel Open Source Technology Centre
"Bill, look, we understand that you're interested in selling us this
operating system, but compare it to ours.  We can't possibly take such
a retrograde step."
--
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)