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

Roman Kagan rkagan at mail.ru
Thu Mar 31 03:18:14 EST 2005


On Tue, Mar 29, 2005 at 04:04:45PM +0400, Roman Kagan wrote:
> 4) usbatm_{extract,write}_cells and usbatm_{r,t}x_process are reworked
>    to manipulate data sizes in bytes rather then cells: it removes a lot
>    of unneeded multiplications and divisions; for safety I've added a
>    couple of assertions to make sure the data sizes are aligned on
>    transfer block size (cell size + padding).

I just realized that such an assertion on the rx path is wrong: the
modem and/or hcd may do only a partial transfer which may well happen to
not be a multiple of the transfer stride, and it's not a good enough
reason to crash the system.

Hence, instead of the assertion, I just trim the unusable tail of the
available data.  Please apply on top of the other patches.

Cheers,
  Roman.


--- usbatm.c	2005-03-29 06:12:17.000000000 +0400
+++ usbatm.c	2005-03-31 12:08:06.000000000 +0400
@@ -375,8 +375,7 @@ static void usbatm_extract_cells(struct 
 	u32 vci, cached_vci = 0;
 	u16 vpi, cached_vpi = 0;
 
-	/* UDSL_ASSERT(!(avail_data % instance->rx_channel.stride)); */
-	BUG_ON(avail_data % instance->rx_channel.stride);
+	avail_data -= avail_data % instance->rx_channel.stride;		/* ensure alignment */
 
 	for (; avail_data;
 	     avail_data -= instance->rx_channel.stride, source += instance->rx_channel.stride) {



More information about the Usbatm mailing list