Skip to content

Commit

Permalink
forcedeth: tx locking
Browse files Browse the repository at this point in the history
This patch reduces the amount of code within the lock to only the
critical sections.

Signed-Off-By: Ayaz Abdulla <aabdulla@nvidia.com>

Signed-off-by: Jeff Garzik <jeff@garzik.org>
  • Loading branch information
Ayaz Abdulla authored and Jeff Garzik committed Feb 5, 2007
1 parent 761fcd9 commit 164a86e
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions drivers/net/forcedeth.c
Original file line number Diff line number Diff line change
Expand Up @@ -1569,12 +1569,11 @@ static int nv_start_xmit(struct sk_buff *skb, struct net_device *dev)
((skb_shinfo(skb)->frags[i].size & (NV_TX2_TSO_MAX_SIZE-1)) ? 1 : 0);
}

spin_lock_irq(&np->lock);

empty_slots = nv_get_empty_tx_slots(np);
if ((empty_slots - np->tx_limit_stop) <= entries) {
spin_unlock_irq(&np->lock);
spin_lock_irq(&np->lock);
netif_stop_queue(dev);
spin_unlock_irq(&np->lock);
return NETDEV_TX_BUSY;
}

Expand Down Expand Up @@ -1669,6 +1668,8 @@ static int nv_start_xmit(struct sk_buff *skb, struct net_device *dev)
tx_flags_vlan = NV_TX3_VLAN_TAG_PRESENT | vlan_tx_tag_get(skb);
}

spin_lock_irq(&np->lock);

/* set tx flags */
if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) {
start_tx.orig->flaglen |= cpu_to_le32(tx_flags | tx_flags_extra);
Expand All @@ -1679,6 +1680,7 @@ static int nv_start_xmit(struct sk_buff *skb, struct net_device *dev)
np->put_tx.ex = put_tx.ex;
}

spin_unlock_irq(&np->lock);

dprintk(KERN_DEBUG "%s: nv_start_xmit: entries %d queued for transmission. tx_flags_extra: %x\n",
dev->name, entries, tx_flags_extra);
Expand All @@ -1693,7 +1695,6 @@ static int nv_start_xmit(struct sk_buff *skb, struct net_device *dev)
}

dev->trans_start = jiffies;
spin_unlock_irq(&np->lock);
writel(NVREG_TXRXCTL_KICK|np->txrxctl_bits, get_hwbase(dev) + NvRegTxRxControl);
pci_push(get_hwbase(dev));
return NETDEV_TX_OK;
Expand Down

0 comments on commit 164a86e

Please sign in to comment.