The USB ethernet driver in linux-2.5.8-pre1/drivers/usb/rtl8150.c
unnecessarily copies all transmitted and received packets. The following
patch eliminates copying of transmitted packets. I am running the
resulting driver now and it seems to be fine.
I am looking at eliminating the copy of received packets, but
I thought I out to submit just the transmit fix first for clarity, and
because it might take me a little while to get the receive fix right.
--
Adam J. Richter __ ______________ 4880 Stevens Creek Blvd, Suite 104
[EMAIL PROTECTED] \ / San Jose, California 95129-1034
+1 408 261-6630 | g g d r a s i l United States of America
fax +1 408 261-6631 "Free Software For The Rest Of Us."
--- linux-2.5.8-pre1/drivers/usb/rtl8150.c Wed Apr 3 23:38:31 2002
+++ linux/drivers/usb/rtl8150.c Fri Apr 5 01:53:38 2002
@@ -90,11 +90,11 @@
struct net_device_stats stats;
struct net_device *netdev;
struct urb *rx_urb, *tx_urb, *intr_urb, *ctrl_urb;
+ struct sk_buff *tx_skbuff;
struct usb_ctrlrequest dr;
int intr_interval;
u16 rx_creg;
u8 rx_buff[RTL8150_MAX_MTU];
- u8 tx_buff[RTL8150_MAX_MTU];
u8 intr_buff[8];
u8 phy;
};
@@ -363,6 +363,7 @@
dev = urb->context;
if (!dev)
return;
+ dev_kfree_skb(dev->tx_skbuff);
if (!netif_device_present(dev->netdev))
return;
if (urb->status)
@@ -479,9 +480,9 @@
dev = netdev->priv;
count = (skb->len < 60) ? 60 : skb->len;
count = (count & 0x3f) ? count : count + 1;
- memcpy(dev->tx_buff, skb->data, skb->len);
+ dev->tx_skbuff = skb;
FILL_BULK_URB(dev->tx_urb, dev->udev, usb_sndbulkpipe(dev->udev,2),
- dev->tx_buff, RTL8150_MAX_MTU, write_bulk_callback, dev);
+ skb->data, RTL8150_MAX_MTU, write_bulk_callback, dev);
dev->tx_urb->transfer_buffer_length = count;
if ((res = usb_submit_urb(dev->tx_urb, GFP_KERNEL))) {
@@ -493,7 +494,6 @@
dev->stats.tx_bytes += skb->len;
netdev->trans_start = jiffies;
}
- dev_kfree_skb(skb);
return 0;
}