diff options
author | Ayaz Abdulla <aabdulla@nvidia.com> | 2007-01-09 13:30:10 -0500 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2007-02-05 16:58:46 -0500 |
commit | 164a86e40e6c74ec5a91c364ccf7b1a2295b0a52 (patch) | |
tree | 1704d1820c1dc0ad72e2409bd49e16c3df74e08d | |
parent | 761fcd9e3e0aa2a02231d1631f31409be5e890d2 (diff) |
forcedeth: tx locking
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>
-rw-r--r-- | drivers/net/forcedeth.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/net/forcedeth.c b/drivers/net/forcedeth.c index bea826bd3168..75dbd67323ad 100644 --- a/drivers/net/forcedeth.c +++ b/drivers/net/forcedeth.c | |||
@@ -1569,12 +1569,11 @@ static int nv_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1569 | ((skb_shinfo(skb)->frags[i].size & (NV_TX2_TSO_MAX_SIZE-1)) ? 1 : 0); | 1569 | ((skb_shinfo(skb)->frags[i].size & (NV_TX2_TSO_MAX_SIZE-1)) ? 1 : 0); |
1570 | } | 1570 | } |
1571 | 1571 | ||
1572 | spin_lock_irq(&np->lock); | ||
1573 | |||
1574 | empty_slots = nv_get_empty_tx_slots(np); | 1572 | empty_slots = nv_get_empty_tx_slots(np); |
1575 | if ((empty_slots - np->tx_limit_stop) <= entries) { | 1573 | if ((empty_slots - np->tx_limit_stop) <= entries) { |
1576 | spin_unlock_irq(&np->lock); | 1574 | spin_lock_irq(&np->lock); |
1577 | netif_stop_queue(dev); | 1575 | netif_stop_queue(dev); |
1576 | spin_unlock_irq(&np->lock); | ||
1578 | return NETDEV_TX_BUSY; | 1577 | return NETDEV_TX_BUSY; |
1579 | } | 1578 | } |
1580 | 1579 | ||
@@ -1669,6 +1668,8 @@ static int nv_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1669 | tx_flags_vlan = NV_TX3_VLAN_TAG_PRESENT | vlan_tx_tag_get(skb); | 1668 | tx_flags_vlan = NV_TX3_VLAN_TAG_PRESENT | vlan_tx_tag_get(skb); |
1670 | } | 1669 | } |
1671 | 1670 | ||
1671 | spin_lock_irq(&np->lock); | ||
1672 | |||
1672 | /* set tx flags */ | 1673 | /* set tx flags */ |
1673 | if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) { | 1674 | if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) { |
1674 | start_tx.orig->flaglen |= cpu_to_le32(tx_flags | tx_flags_extra); | 1675 | start_tx.orig->flaglen |= cpu_to_le32(tx_flags | tx_flags_extra); |
@@ -1679,6 +1680,7 @@ static int nv_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1679 | np->put_tx.ex = put_tx.ex; | 1680 | np->put_tx.ex = put_tx.ex; |
1680 | } | 1681 | } |
1681 | 1682 | ||
1683 | spin_unlock_irq(&np->lock); | ||
1682 | 1684 | ||
1683 | dprintk(KERN_DEBUG "%s: nv_start_xmit: entries %d queued for transmission. tx_flags_extra: %x\n", | 1685 | dprintk(KERN_DEBUG "%s: nv_start_xmit: entries %d queued for transmission. tx_flags_extra: %x\n", |
1684 | dev->name, entries, tx_flags_extra); | 1686 | dev->name, entries, tx_flags_extra); |
@@ -1693,7 +1695,6 @@ static int nv_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1693 | } | 1695 | } |
1694 | 1696 | ||
1695 | dev->trans_start = jiffies; | 1697 | dev->trans_start = jiffies; |
1696 | spin_unlock_irq(&np->lock); | ||
1697 | writel(NVREG_TXRXCTL_KICK|np->txrxctl_bits, get_hwbase(dev) + NvRegTxRxControl); | 1698 | writel(NVREG_TXRXCTL_KICK|np->txrxctl_bits, get_hwbase(dev) + NvRegTxRxControl); |
1698 | pci_push(get_hwbase(dev)); | 1699 | pci_push(get_hwbase(dev)); |
1699 | return NETDEV_TX_OK; | 1700 | return NETDEV_TX_OK; |