[RFC] [PATCH] usbatm.[ch]: multiple changes

matthieu castet castet.matthieu at free.fr
Wed Mar 30 12:26:37 EST 2005


Hi Roman,

Roman Kagan wrote:
> On Tue, Mar 29, 2005 at 04:04:45PM +0400, Roman Kagan wrote:
> for (i = 0; i < num_rcv_urbs + num_snd_urbs; i++) {
>  		struct usbatm_transceiver *trx = instance->transceivers + i;
>  		u8 *buffer;
> +		unsigned int iso_packets = 0, iso_size = 0;
>  		trx->channel = i < num_rcv_urbs ? &instance->rx_channel : &instance->tx_channel;
>  
>  		buffer = kmalloc(trx->channel->buf_size, GFP_KERNEL);
> @@ -1112,7 +1124,15 @@
>  		}
>  		memset(buffer, 0, trx->channel->buf_size);
>  
> -		trx->urb = usb_alloc_urb(0, GFP_KERNEL);
> +		if (usb_pipeisoc(trx->urb->pipe)) {
                                   ******
using trx->urb before it is allocated won't work...
> +			/* don't expect iso out endpoints */
But you could add interrupt out endpoint ;)
> +			iso_size = usb_maxpacket(instance->usb_dev, trx->channel->endpoint, 0);
> +			iso_size -= iso_size % trx->channel->stride;	/* alignment */
> +			BUG_ON(!iso_size);
> +			iso_packets = (trx->channel->buf_size - 1) / iso_size + 1;
using default buf_size is quite low : for iso_size 1000, we have only 3 
or 4 iso_packets per urb instead of 16.
> +		}
> +
> +		trx->urb = usb_alloc_urb(iso_packets, GFP_KERNEL);
                  **********************


>  		if (!trx->urb) {
>  			dev_dbg(&intf->dev, "no memory for urb %d!\n", i);
>  			goto fail_unbind;
> @@ -1120,6 +1140,17 @@
>  
>  		usb_fill_bulk_urb(trx->urb, instance->usb_dev, trx->channel->endpoint,
>  				  buffer, trx->channel->buf_size, usbatm_complete, trx);
does it work for iso packets ?

I am not sure of that but in lot's of driver, the status and 
actual_length are cleared for each paquets before resubmitting.

Matthieu




More information about the Usbatm mailing list