speedtch usbatm.c,1.26,1.27

Roman Kagan rkagan at mail.ru
Wed May 4 01:28:18 EDT 2005


On Tue, May 03, 2005 at 08:54:35PM +0200, Duncan Sands wrote:
> > The point is that for tx path, when the submission fails, you've already
> > filled the transceiver with data, so you want to return it to the head
> > of the queue and attempt to resubmit on the next iteration, otherwise
> > the data may go out of sequence.
> 
> Hi Roman, but as far as I can see, if the submission fails then the
> transceiver will be popped the next time round, and the contents
> overwritten...  What am I missing?

Maybe the attached patch? :)  I had been thinkig of making the next
iteration append the data to the urb if there's room for it, rather than
overwrite, but apparently had mixed this up at some point...

Cheers,
  Roman.


Index: usbatm.c
===================================================================
RCS file: /home/cvs/usbatm/usbatm.c,v
retrieving revision 1.34
diff -u -p -r1.34 usbatm.c
--- usbatm.c	3 May 2005 14:34:07 -0000	1.34
+++ usbatm.c	4 May 2005 05:18:48 -0000
@@ -237,9 +237,8 @@ static inline int usbatm_submit_transcei
 		atm_dbg(channel->usbatm, "%s: trx 0x%p urb 0x%p submission failed (%d)!\n",
 			__func__, trx, trx->urb, ret);
 
-		trx->urb->status = ret;
-
 		/* consider all errors transient and return the buffer back to the queue */
+		trx->urb->status = -EAGAIN;
 		spin_lock_irq(&channel->lock);
 
 		/* must add to the front when sending; doesn't matter when receiving */
@@ -532,7 +531,8 @@ static void usbatm_tx_process(unsigned l
 			if (!tx)
 				break;		/* no more senders */
 			buffer = tx->urb->transfer_buffer;
-			num_written = 0;
+			num_written = (tx->urb->status == -EAGAIN) ?
+				tx->urb->transfer_buffer_length : 0;
 		}
 
 		num_written += usbatm_write_cells(instance, skb,
@@ -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))



More information about the Usbatm mailing list