sending zero length skb's

Roman Kagan rkagan at mail.ru
Tue May 3 11:08:11 EDT 2005


On Tue, May 03, 2005 at 05:01:13PM +0200, Duncan Sands wrote:
> > > Are you sure that the skb is simply not sent?  If so, that's fine by me.
> > > I got the impression that things got into a bit of a mess in that case.
> > > Did you test it?
> > 
> > I didn't test it, but I think I can prove it: usbatm_write_cells(), when
> > given a zero length skb, immediately returns zero due to the condition
> > in the loop; usbatm_tx_process() then advances to the next skb.
> 
> Because of the test on ctrl->len?
> 
>         for (num_written = 0; num_written < avail_space && ctrl->len;
> 
> I missed that, sorry.  However, if this is this only skb then we will
> then submit an urb with zero length.  I guess that's OK.

Indeed.  But it's easy to fix:

Index: usbatm.c
===================================================================
RCS file: /home/cvs/usbatm/usbatm.c,v
retrieving revision 1.33
diff -u -p -r1.33 usbatm.c
--- usbatm.c	3 May 2005 14:06:20 -0000	1.33
+++ usbatm.c	3 May 2005 15:05:33 -0000
@@ -551,7 +551,7 @@ static void usbatm_tx_process(unsigned l
 			skb = skb_dequeue(&instance->sndqueue);
 		}
 
-		if (num_written == buf_size || !skb) {
+		if (num_written == buf_size || (!skb && num_written)) {
 			tx->urb->transfer_buffer_length = num_written;
 
 			if (usbatm_submit_transceiver(tx))

Cheers,
  Roman.



More information about the Usbatm mailing list