aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/bnx2.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/bnx2.c')
-rw-r--r--drivers/net/bnx2.c56
1 files changed, 24 insertions, 32 deletions
diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c
index da903b3ebfb0..418190b79f6c 100644
--- a/drivers/net/bnx2.c
+++ b/drivers/net/bnx2.c
@@ -1350,15 +1350,13 @@ bnx2_tx_int(struct bnx2 *bp)
1350 bp->tx_cons = sw_cons; 1350 bp->tx_cons = sw_cons;
1351 1351
1352 if (unlikely(netif_queue_stopped(bp->dev))) { 1352 if (unlikely(netif_queue_stopped(bp->dev))) {
1353 unsigned long flags; 1353 spin_lock(&bp->tx_lock);
1354
1355 spin_lock_irqsave(&bp->tx_lock, flags);
1356 if ((netif_queue_stopped(bp->dev)) && 1354 if ((netif_queue_stopped(bp->dev)) &&
1357 (bnx2_tx_avail(bp) > MAX_SKB_FRAGS)) { 1355 (bnx2_tx_avail(bp) > MAX_SKB_FRAGS)) {
1358 1356
1359 netif_wake_queue(bp->dev); 1357 netif_wake_queue(bp->dev);
1360 } 1358 }
1361 spin_unlock_irqrestore(&bp->tx_lock, flags); 1359 spin_unlock(&bp->tx_lock);
1362 } 1360 }
1363} 1361}
1364 1362
@@ -1598,11 +1596,9 @@ bnx2_poll(struct net_device *dev, int *budget)
1598 (bp->status_blk->status_attn_bits_ack & 1596 (bp->status_blk->status_attn_bits_ack &
1599 STATUS_ATTN_BITS_LINK_STATE)) { 1597 STATUS_ATTN_BITS_LINK_STATE)) {
1600 1598
1601 unsigned long flags; 1599 spin_lock(&bp->phy_lock);
1602
1603 spin_lock_irqsave(&bp->phy_lock, flags);
1604 bnx2_phy_int(bp); 1600 bnx2_phy_int(bp);
1605 spin_unlock_irqrestore(&bp->phy_lock, flags); 1601 spin_unlock(&bp->phy_lock);
1606 } 1602 }
1607 1603
1608 if (bp->status_blk->status_tx_quick_consumer_index0 != bp->tx_cons) { 1604 if (bp->status_blk->status_tx_quick_consumer_index0 != bp->tx_cons) {
@@ -1645,9 +1641,8 @@ bnx2_set_rx_mode(struct net_device *dev)
1645 struct bnx2 *bp = dev->priv; 1641 struct bnx2 *bp = dev->priv;
1646 u32 rx_mode, sort_mode; 1642 u32 rx_mode, sort_mode;
1647 int i; 1643 int i;
1648 unsigned long flags;
1649 1644
1650 spin_lock_irqsave(&bp->phy_lock, flags); 1645 spin_lock_bh(&bp->phy_lock);
1651 1646
1652 rx_mode = bp->rx_mode & ~(BNX2_EMAC_RX_MODE_PROMISCUOUS | 1647 rx_mode = bp->rx_mode & ~(BNX2_EMAC_RX_MODE_PROMISCUOUS |
1653 BNX2_EMAC_RX_MODE_KEEP_VLAN_TAG); 1648 BNX2_EMAC_RX_MODE_KEEP_VLAN_TAG);
@@ -1708,7 +1703,7 @@ bnx2_set_rx_mode(struct net_device *dev)
1708 REG_WR(bp, BNX2_RPM_SORT_USER0, sort_mode); 1703 REG_WR(bp, BNX2_RPM_SORT_USER0, sort_mode);
1709 REG_WR(bp, BNX2_RPM_SORT_USER0, sort_mode | BNX2_RPM_SORT_USER0_ENA); 1704 REG_WR(bp, BNX2_RPM_SORT_USER0, sort_mode | BNX2_RPM_SORT_USER0_ENA);
1710 1705
1711 spin_unlock_irqrestore(&bp->phy_lock, flags); 1706 spin_unlock_bh(&bp->phy_lock);
1712} 1707}
1713 1708
1714static void 1709static void
@@ -3768,10 +3763,10 @@ bnx2_test_link(struct bnx2 *bp)
3768{ 3763{
3769 u32 bmsr; 3764 u32 bmsr;
3770 3765
3771 spin_lock_irq(&bp->phy_lock); 3766 spin_lock_bh(&bp->phy_lock);
3772 bnx2_read_phy(bp, MII_BMSR, &bmsr); 3767 bnx2_read_phy(bp, MII_BMSR, &bmsr);
3773 bnx2_read_phy(bp, MII_BMSR, &bmsr); 3768 bnx2_read_phy(bp, MII_BMSR, &bmsr);
3774 spin_unlock_irq(&bp->phy_lock); 3769 spin_unlock_bh(&bp->phy_lock);
3775 3770
3776 if (bmsr & BMSR_LSTATUS) { 3771 if (bmsr & BMSR_LSTATUS) {
3777 return 0; 3772 return 0;
@@ -3828,9 +3823,8 @@ bnx2_timer(unsigned long data)
3828 3823
3829 if ((bp->phy_flags & PHY_SERDES_FLAG) && 3824 if ((bp->phy_flags & PHY_SERDES_FLAG) &&
3830 (CHIP_NUM(bp) == CHIP_NUM_5706)) { 3825 (CHIP_NUM(bp) == CHIP_NUM_5706)) {
3831 unsigned long flags;
3832 3826
3833 spin_lock_irqsave(&bp->phy_lock, flags); 3827 spin_lock(&bp->phy_lock);
3834 if (bp->serdes_an_pending) { 3828 if (bp->serdes_an_pending) {
3835 bp->serdes_an_pending--; 3829 bp->serdes_an_pending--;
3836 } 3830 }
@@ -3884,7 +3878,7 @@ bnx2_timer(unsigned long data)
3884 else 3878 else
3885 bp->current_interval = bp->timer_interval; 3879 bp->current_interval = bp->timer_interval;
3886 3880
3887 spin_unlock_irqrestore(&bp->phy_lock, flags); 3881 spin_unlock(&bp->phy_lock);
3888 } 3882 }
3889 3883
3890bnx2_restart_timer: 3884bnx2_restart_timer:
@@ -4168,14 +4162,12 @@ bnx2_start_xmit(struct sk_buff *skb, struct net_device *dev)
4168 dev->trans_start = jiffies; 4162 dev->trans_start = jiffies;
4169 4163
4170 if (unlikely(bnx2_tx_avail(bp) <= MAX_SKB_FRAGS)) { 4164 if (unlikely(bnx2_tx_avail(bp) <= MAX_SKB_FRAGS)) {
4171 unsigned long flags; 4165 spin_lock(&bp->tx_lock);
4172
4173 spin_lock_irqsave(&bp->tx_lock, flags);
4174 netif_stop_queue(dev); 4166 netif_stop_queue(dev);
4175 4167
4176 if (bnx2_tx_avail(bp) > MAX_SKB_FRAGS) 4168 if (bnx2_tx_avail(bp) > MAX_SKB_FRAGS)
4177 netif_wake_queue(dev); 4169 netif_wake_queue(dev);
4178 spin_unlock_irqrestore(&bp->tx_lock, flags); 4170 spin_unlock(&bp->tx_lock);
4179 } 4171 }
4180 4172
4181 return NETDEV_TX_OK; 4173 return NETDEV_TX_OK;
@@ -4411,11 +4403,11 @@ bnx2_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
4411 bp->req_line_speed = req_line_speed; 4403 bp->req_line_speed = req_line_speed;
4412 bp->req_duplex = req_duplex; 4404 bp->req_duplex = req_duplex;
4413 4405
4414 spin_lock_irq(&bp->phy_lock); 4406 spin_lock_bh(&bp->phy_lock);
4415 4407
4416 bnx2_setup_phy(bp); 4408 bnx2_setup_phy(bp);
4417 4409
4418 spin_unlock_irq(&bp->phy_lock); 4410 spin_unlock_bh(&bp->phy_lock);
4419 4411
4420 return 0; 4412 return 0;
4421} 4413}
@@ -4485,16 +4477,16 @@ bnx2_nway_reset(struct net_device *dev)
4485 return -EINVAL; 4477 return -EINVAL;
4486 } 4478 }
4487 4479
4488 spin_lock_irq(&bp->phy_lock); 4480 spin_lock_bh(&bp->phy_lock);
4489 4481
4490 /* Force a link down visible on the other side */ 4482 /* Force a link down visible on the other side */
4491 if (bp->phy_flags & PHY_SERDES_FLAG) { 4483 if (bp->phy_flags & PHY_SERDES_FLAG) {
4492 bnx2_write_phy(bp, MII_BMCR, BMCR_LOOPBACK); 4484 bnx2_write_phy(bp, MII_BMCR, BMCR_LOOPBACK);
4493 spin_unlock_irq(&bp->phy_lock); 4485 spin_unlock_bh(&bp->phy_lock);
4494 4486
4495 msleep(20); 4487 msleep(20);
4496 4488
4497 spin_lock_irq(&bp->phy_lock); 4489 spin_lock_bh(&bp->phy_lock);
4498 if (CHIP_NUM(bp) == CHIP_NUM_5706) { 4490 if (CHIP_NUM(bp) == CHIP_NUM_5706) {
4499 bp->current_interval = SERDES_AN_TIMEOUT; 4491 bp->current_interval = SERDES_AN_TIMEOUT;
4500 bp->serdes_an_pending = 1; 4492 bp->serdes_an_pending = 1;
@@ -4506,7 +4498,7 @@ bnx2_nway_reset(struct net_device *dev)
4506 bmcr &= ~BMCR_LOOPBACK; 4498 bmcr &= ~BMCR_LOOPBACK;
4507 bnx2_write_phy(bp, MII_BMCR, bmcr | BMCR_ANRESTART | BMCR_ANENABLE); 4499 bnx2_write_phy(bp, MII_BMCR, bmcr | BMCR_ANRESTART | BMCR_ANENABLE);
4508 4500
4509 spin_unlock_irq(&bp->phy_lock); 4501 spin_unlock_bh(&bp->phy_lock);
4510 4502
4511 return 0; 4503 return 0;
4512} 4504}
@@ -4692,11 +4684,11 @@ bnx2_set_pauseparam(struct net_device *dev, struct ethtool_pauseparam *epause)
4692 bp->autoneg &= ~AUTONEG_FLOW_CTRL; 4684 bp->autoneg &= ~AUTONEG_FLOW_CTRL;
4693 } 4685 }
4694 4686
4695 spin_lock_irq(&bp->phy_lock); 4687 spin_lock_bh(&bp->phy_lock);
4696 4688
4697 bnx2_setup_phy(bp); 4689 bnx2_setup_phy(bp);
4698 4690
4699 spin_unlock_irq(&bp->phy_lock); 4691 spin_unlock_bh(&bp->phy_lock);
4700 4692
4701 return 0; 4693 return 0;
4702} 4694}
@@ -5046,9 +5038,9 @@ bnx2_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
5046 case SIOCGMIIREG: { 5038 case SIOCGMIIREG: {
5047 u32 mii_regval; 5039 u32 mii_regval;
5048 5040
5049 spin_lock_irq(&bp->phy_lock); 5041 spin_lock_bh(&bp->phy_lock);
5050 err = bnx2_read_phy(bp, data->reg_num & 0x1f, &mii_regval); 5042 err = bnx2_read_phy(bp, data->reg_num & 0x1f, &mii_regval);
5051 spin_unlock_irq(&bp->phy_lock); 5043 spin_unlock_bh(&bp->phy_lock);
5052 5044
5053 data->val_out = mii_regval; 5045 data->val_out = mii_regval;
5054 5046
@@ -5059,9 +5051,9 @@ bnx2_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
5059 if (!capable(CAP_NET_ADMIN)) 5051 if (!capable(CAP_NET_ADMIN))
5060 return -EPERM; 5052 return -EPERM;
5061 5053
5062 spin_lock_irq(&bp->phy_lock); 5054 spin_lock_bh(&bp->phy_lock);
5063 err = bnx2_write_phy(bp, data->reg_num & 0x1f, data->val_in); 5055 err = bnx2_write_phy(bp, data->reg_num & 0x1f, data->val_in);
5064 spin_unlock_irq(&bp->phy_lock); 5056 spin_unlock_bh(&bp->phy_lock);
5065 5057
5066 return err; 5058 return err;
5067 5059