Hi,

        While looking deep in irda-usb, I realised that the transmit
skb was always copied, while this is useless. The attached patch fixes
this. It won't be faster, but should reduce system overhead...

        Happy hacking...

        Jean
diff -u -p linux/drivers/net/irda/irda-usb.d4.c linux/drivers/net/irda/irda-usb.c
--- linux/drivers/net/irda/irda-usb.d4.c        Tue Jan 15 12:23:08 2002
+++ linux/drivers/net/irda/irda-usb.c   Tue Jan 15 12:37:23 2002
@@ -378,10 +378,17 @@ static int irda_usb_hard_xmit(struct sk_
                return 0;
        }
 
-       /* Make room for IrDA-USB header (note skb->len += USB_IRDA_HEADER) */
-       if (skb_cow(skb, USB_IRDA_HEADER)) {
-               dev_kfree_skb(skb);
-               return 0;
+       /* Make sure there is room for IrDA-USB header. The actual
+        * allocation will be done lower in skb_push().
+        * Also, we don't use directly skb_cow(), because it require
+        * headroom >= 16, which force unnecessary copies - Jean II */
+       if (skb_headroom(skb) < USB_IRDA_HEADER) {
+               IRDA_DEBUG(0, __FUNCTION__ "(), Insuficient skb headroom.\n");
+               if (skb_cow(skb, USB_IRDA_HEADER)) {
+                       WARNING(__FUNCTION__ "(), failed skb_cow() !!!\n");
+                       dev_kfree_skb(skb);
+                       return 0;
+               }
        }
 
        spin_lock_irqsave(&self->lock, flags);

Reply via email to