Subject: Re: ugen change for review (try 2)
To: Joanne M Mikkelson <jmmikkel@bbn.com>
From: Hans Petter Selasky <hselasky@c2i.net>
List: tech-kern
Date: 07/21/2006 09:45:04
On Thursday 20 July 2006 19:45, Joanne M Mikkelson wrote:
> Sorry about forgetting to do a unified diff! Oops.
I have a question:
Does your USB device send short packets, so that you get short transfers?
What buffer size do you use?
Some comments:
I would suggest enabling your change by default, and no IOCTL's to enable it,
but I would rather use a block buffer, than a ring buffer. That way it is
possible to pass short packets to the user application. With a ring buffer,
short packets get lost, which sometimes are important for synchronization.
I am planning a change similiar to yours on FreeBSD, but I have not had time
to do it. What I have done so far is to implement a block buffer system:
struct usbd_mbuf {
u_int8_t *cur_data_ptr;
u_int8_t *min_data_ptr;
struct usbd_mbuf *usbd_nextpkt;
struct usbd_mbuf *usbd_next;
u_int32_t cur_data_len;
u_int32_t max_data_len;
};
struct usbd_ifqueue {
struct usbd_mbuf *ifq_head;
struct usbd_mbuf *ifq_tail;
int32_t ifq_len;
int32_t ifq_maxlen;
};
And a couple of macros to operate on these, see:
http://www.turbocat.net/~hselasky/isdn4bsd/sources/src/sys/dev/usb2/usb_subr.h
And there is a function "usbd_alloc_mbufs()", see:
http://www.turbocat.net/~hselasky/isdn4bsd/sources/src/sys/dev/usb2/_usb_subr.c
When it comes to the IOCTL name, I would prefer something like:
USB_SET_BULK_READ_BSIZE and USB_SET_BULK_WRITE_BSIZE .
--HPS