Commit 62402ec8 authored by Jeff Garzik's avatar Jeff Garzik

Merge 8139too net driver oops fix from 2.4.x.

Fix originally by Andreas Dilger IIRC, merged by Dave Jones.
parent 72e744c9
...@@ -1646,23 +1646,24 @@ static int rtl8139_start_xmit (struct sk_buff *skb, struct net_device *dev) ...@@ -1646,23 +1646,24 @@ static int rtl8139_start_xmit (struct sk_buff *skb, struct net_device *dev)
struct rtl8139_private *tp = dev->priv; struct rtl8139_private *tp = dev->priv;
void *ioaddr = tp->mmio_addr; void *ioaddr = tp->mmio_addr;
unsigned int entry; unsigned int entry;
unsigned int len = skb->len;
/* Calculate the next Tx descriptor entry. */ /* Calculate the next Tx descriptor entry. */
entry = tp->cur_tx % NUM_TX_DESC; entry = tp->cur_tx % NUM_TX_DESC;
if (likely(skb->len < TX_BUF_SIZE)) { if (likely(len < TX_BUF_SIZE)) {
skb_copy_and_csum_dev(skb, tp->tx_buf[entry]); skb_copy_and_csum_dev(skb, tp->tx_buf[entry]);
dev_kfree_skb(skb); dev_kfree_skb(skb);
} else { } else {
dev_kfree_skb(skb); dev_kfree_skb(skb);
tp->stats.tx_dropped++; tp->stats.tx_dropped++;
return 0; return 0;
} }
/* Note: the chip doesn't have auto-pad! */ /* Note: the chip doesn't have auto-pad! */
spin_lock_irq(&tp->lock); spin_lock_irq(&tp->lock);
RTL_W32_F (TxStatus0 + (entry * sizeof (u32)), RTL_W32_F (TxStatus0 + (entry * sizeof (u32)),
tp->tx_flag | (skb->len >= ETH_ZLEN ? skb->len : ETH_ZLEN)); tp->tx_flag | max(len, (unsigned int)ETH_ZLEN));
dev->trans_start = jiffies; dev->trans_start = jiffies;
...@@ -1673,8 +1674,8 @@ static int rtl8139_start_xmit (struct sk_buff *skb, struct net_device *dev) ...@@ -1673,8 +1674,8 @@ static int rtl8139_start_xmit (struct sk_buff *skb, struct net_device *dev)
netif_stop_queue (dev); netif_stop_queue (dev);
spin_unlock_irq(&tp->lock); spin_unlock_irq(&tp->lock);
DPRINTK ("%s: Queued Tx packet at %p size %u to slot %d.\n", DPRINTK ("%s: Queued Tx packet size %u to slot %d.\n",
dev->name, skb->data, skb->len, entry); dev->name, len, entry);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment