Skip to content

Commit

Permalink
DM9000: fix interface hang under load
Browse files Browse the repository at this point in the history
When transferring data at full speed, the DM9000 network interface
sometimes stops sending/receiving data. Worse, ksoftirqd consumes
100% cpu and the net tx watchdog never triggers.
Fix by spin_lock_irqsave() in dm9000_start_xmit() to prevent the
interrupt handler from interfering.

Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
  • Loading branch information
Florian Westphal authored and Jeff Garzik committed Aug 25, 2007
1 parent bc1e0a0 commit c46ac94
Showing 1 changed file with 7 additions and 18 deletions.
25 changes: 7 additions & 18 deletions drivers/net/dm9000.c
Original file line number Diff line number Diff line change
Expand Up @@ -700,30 +700,25 @@ dm9000_init_dm9000(struct net_device *dev)
static int
dm9000_start_xmit(struct sk_buff *skb, struct net_device *dev)
{
unsigned long flags;
board_info_t *db = (board_info_t *) dev->priv;

PRINTK3("dm9000_start_xmit\n");

if (db->tx_pkt_cnt > 1)
return 1;

netif_stop_queue(dev);

/* Disable all interrupts */
iow(db, DM9000_IMR, IMR_PAR);
spin_lock_irqsave(&db->lock, flags);

/* Move data to DM9000 TX RAM */
writeb(DM9000_MWCMD, db->io_addr);

(db->outblk)(db->io_data, skb->data, skb->len);
db->stats.tx_bytes += skb->len;

db->tx_pkt_cnt++;
/* TX control: First packet immediately send, second packet queue */
if (db->tx_pkt_cnt == 0) {

/* First Packet */
db->tx_pkt_cnt++;

if (db->tx_pkt_cnt == 1) {
/* Set TX length to DM9000 */
iow(db, DM9000_TXPLL, skb->len & 0xff);
iow(db, DM9000_TXPLH, (skb->len >> 8) & 0xff);
Expand All @@ -732,23 +727,17 @@ dm9000_start_xmit(struct sk_buff *skb, struct net_device *dev)
iow(db, DM9000_TCR, TCR_TXREQ); /* Cleared after TX complete */

dev->trans_start = jiffies; /* save the time stamp */

} else {
/* Second packet */
db->tx_pkt_cnt++;
db->queue_pkt_len = skb->len;
netif_stop_queue(dev);
}

spin_unlock_irqrestore(&db->lock, flags);

/* free this SKB */
dev_kfree_skb(skb);

/* Re-enable resource check */
if (db->tx_pkt_cnt == 1)
netif_wake_queue(dev);

/* Re-enable interrupt */
iow(db, DM9000_IMR, IMR_PAR | IMR_PTM | IMR_PRM);

return 0;
}

Expand Down

0 comments on commit c46ac94

Please sign in to comment.