diff options
author | Jeff Garzik <jgarzik@pobox.com> | 2005-08-30 13:32:29 -0400 |
---|---|---|
committer | Jeff Garzik <jgarzik@pobox.com> | 2005-08-30 13:32:29 -0400 |
commit | ed735ccbefaf7e5e3ef61418f7e209b8c59308a7 (patch) | |
tree | b8cc69814d2368b08d0a84c8da0c12028bd04867 /drivers/net | |
parent | 39fbe47377062200acc26ea0ccef223b4399a82c (diff) | |
parent | d8971fcb702e24d1e22c77fd1772f182ffee87e3 (diff) |
Merge HEAD from /spare/repo/linux-2.6/.git
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/bnx2.c | 229 | ||||
-rw-r--r-- | drivers/net/bnx2.h | 10 | ||||
-rw-r--r-- | drivers/net/bonding/bond_3ad.c | 11 | ||||
-rw-r--r-- | drivers/net/bonding/bond_3ad.h | 2 | ||||
-rw-r--r-- | drivers/net/bonding/bond_alb.c | 5 | ||||
-rw-r--r-- | drivers/net/hamradio/bpqether.c | 4 | ||||
-rw-r--r-- | drivers/net/ibmveth.c | 2 | ||||
-rw-r--r-- | drivers/net/iseries_veth.c | 2 | ||||
-rw-r--r-- | drivers/net/ppp_generic.c | 1 | ||||
-rw-r--r-- | drivers/net/pppoe.c | 6 | ||||
-rw-r--r-- | drivers/net/rrunner.c | 3 | ||||
-rw-r--r-- | drivers/net/s2io.h | 4 | ||||
-rw-r--r-- | drivers/net/shaper.c | 50 | ||||
-rw-r--r-- | drivers/net/tg3.c | 325 | ||||
-rw-r--r-- | drivers/net/tg3.h | 10 | ||||
-rw-r--r-- | drivers/net/wan/hdlc_generic.c | 2 | ||||
-rw-r--r-- | drivers/net/wan/lapbether.c | 2 | ||||
-rw-r--r-- | drivers/net/wan/sdla_fr.c | 22 | ||||
-rw-r--r-- | drivers/net/wan/syncppp.c | 2 |
19 files changed, 413 insertions, 279 deletions
diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c index 8acc655ec1e8..7babf6af4e28 100644 --- a/drivers/net/bnx2.c +++ b/drivers/net/bnx2.c | |||
@@ -14,8 +14,8 @@ | |||
14 | 14 | ||
15 | #define DRV_MODULE_NAME "bnx2" | 15 | #define DRV_MODULE_NAME "bnx2" |
16 | #define PFX DRV_MODULE_NAME ": " | 16 | #define PFX DRV_MODULE_NAME ": " |
17 | #define DRV_MODULE_VERSION "1.2.19" | 17 | #define DRV_MODULE_VERSION "1.2.20" |
18 | #define DRV_MODULE_RELDATE "May 23, 2005" | 18 | #define DRV_MODULE_RELDATE "August 22, 2005" |
19 | 19 | ||
20 | #define RUN_AT(x) (jiffies + (x)) | 20 | #define RUN_AT(x) (jiffies + (x)) |
21 | 21 | ||
@@ -52,7 +52,6 @@ static struct { | |||
52 | { "HP NC370i Multifunction Gigabit Server Adapter" }, | 52 | { "HP NC370i Multifunction Gigabit Server Adapter" }, |
53 | { "Broadcom NetXtreme II BCM5706 1000Base-SX" }, | 53 | { "Broadcom NetXtreme II BCM5706 1000Base-SX" }, |
54 | { "HP NC370F Multifunction Gigabit Server Adapter" }, | 54 | { "HP NC370F Multifunction Gigabit Server Adapter" }, |
55 | { 0 }, | ||
56 | }; | 55 | }; |
57 | 56 | ||
58 | static struct pci_device_id bnx2_pci_tbl[] = { | 57 | static struct pci_device_id bnx2_pci_tbl[] = { |
@@ -108,6 +107,15 @@ static struct flash_spec flash_table[] = | |||
108 | 107 | ||
109 | MODULE_DEVICE_TABLE(pci, bnx2_pci_tbl); | 108 | MODULE_DEVICE_TABLE(pci, bnx2_pci_tbl); |
110 | 109 | ||
110 | static inline u32 bnx2_tx_avail(struct bnx2 *bp) | ||
111 | { | ||
112 | u32 diff = TX_RING_IDX(bp->tx_prod) - TX_RING_IDX(bp->tx_cons); | ||
113 | |||
114 | if (diff > MAX_TX_DESC_CNT) | ||
115 | diff = (diff & MAX_TX_DESC_CNT) - 1; | ||
116 | return (bp->tx_ring_size - diff); | ||
117 | } | ||
118 | |||
111 | static u32 | 119 | static u32 |
112 | bnx2_reg_rd_ind(struct bnx2 *bp, u32 offset) | 120 | bnx2_reg_rd_ind(struct bnx2 *bp, u32 offset) |
113 | { | 121 | { |
@@ -807,7 +815,19 @@ bnx2_setup_serdes_phy(struct bnx2 *bp) | |||
807 | bnx2_write_phy(bp, MII_ADVERTISE, new_adv); | 815 | bnx2_write_phy(bp, MII_ADVERTISE, new_adv); |
808 | bnx2_write_phy(bp, MII_BMCR, bmcr | BMCR_ANRESTART | | 816 | bnx2_write_phy(bp, MII_BMCR, bmcr | BMCR_ANRESTART | |
809 | BMCR_ANENABLE); | 817 | BMCR_ANENABLE); |
810 | bp->serdes_an_pending = SERDES_AN_TIMEOUT / bp->timer_interval; | 818 | if (CHIP_NUM(bp) == CHIP_NUM_5706) { |
819 | /* Speed up link-up time when the link partner | ||
820 | * does not autonegotiate which is very common | ||
821 | * in blade servers. Some blade servers use | ||
822 | * IPMI for kerboard input and it's important | ||
823 | * to minimize link disruptions. Autoneg. involves | ||
824 | * exchanging base pages plus 3 next pages and | ||
825 | * normally completes in about 120 msec. | ||
826 | */ | ||
827 | bp->current_interval = SERDES_AN_TIMEOUT; | ||
828 | bp->serdes_an_pending = 1; | ||
829 | mod_timer(&bp->timer, jiffies + bp->current_interval); | ||
830 | } | ||
811 | } | 831 | } |
812 | 832 | ||
813 | return 0; | 833 | return 0; |
@@ -1327,22 +1347,17 @@ bnx2_tx_int(struct bnx2 *bp) | |||
1327 | } | 1347 | } |
1328 | } | 1348 | } |
1329 | 1349 | ||
1330 | atomic_add(tx_free_bd, &bp->tx_avail_bd); | 1350 | bp->tx_cons = sw_cons; |
1331 | 1351 | ||
1332 | if (unlikely(netif_queue_stopped(bp->dev))) { | 1352 | if (unlikely(netif_queue_stopped(bp->dev))) { |
1333 | unsigned long flags; | 1353 | spin_lock(&bp->tx_lock); |
1334 | |||
1335 | spin_lock_irqsave(&bp->tx_lock, flags); | ||
1336 | if ((netif_queue_stopped(bp->dev)) && | 1354 | if ((netif_queue_stopped(bp->dev)) && |
1337 | (atomic_read(&bp->tx_avail_bd) > MAX_SKB_FRAGS)) { | 1355 | (bnx2_tx_avail(bp) > MAX_SKB_FRAGS)) { |
1338 | 1356 | ||
1339 | netif_wake_queue(bp->dev); | 1357 | netif_wake_queue(bp->dev); |
1340 | } | 1358 | } |
1341 | spin_unlock_irqrestore(&bp->tx_lock, flags); | 1359 | spin_unlock(&bp->tx_lock); |
1342 | } | 1360 | } |
1343 | |||
1344 | bp->tx_cons = sw_cons; | ||
1345 | |||
1346 | } | 1361 | } |
1347 | 1362 | ||
1348 | static inline void | 1363 | static inline void |
@@ -1523,15 +1538,12 @@ bnx2_msi(int irq, void *dev_instance, struct pt_regs *regs) | |||
1523 | BNX2_PCICFG_INT_ACK_CMD_MASK_INT); | 1538 | BNX2_PCICFG_INT_ACK_CMD_MASK_INT); |
1524 | 1539 | ||
1525 | /* Return here if interrupt is disabled. */ | 1540 | /* Return here if interrupt is disabled. */ |
1526 | if (unlikely(atomic_read(&bp->intr_sem) != 0)) { | 1541 | if (unlikely(atomic_read(&bp->intr_sem) != 0)) |
1527 | return IRQ_RETVAL(1); | 1542 | return IRQ_HANDLED; |
1528 | } | ||
1529 | 1543 | ||
1530 | if (netif_rx_schedule_prep(dev)) { | 1544 | netif_rx_schedule(dev); |
1531 | __netif_rx_schedule(dev); | ||
1532 | } | ||
1533 | 1545 | ||
1534 | return IRQ_RETVAL(1); | 1546 | return IRQ_HANDLED; |
1535 | } | 1547 | } |
1536 | 1548 | ||
1537 | static irqreturn_t | 1549 | static irqreturn_t |
@@ -1549,22 +1561,19 @@ bnx2_interrupt(int irq, void *dev_instance, struct pt_regs *regs) | |||
1549 | if ((bp->status_blk->status_idx == bp->last_status_idx) || | 1561 | if ((bp->status_blk->status_idx == bp->last_status_idx) || |
1550 | (REG_RD(bp, BNX2_PCICFG_MISC_STATUS) & | 1562 | (REG_RD(bp, BNX2_PCICFG_MISC_STATUS) & |
1551 | BNX2_PCICFG_MISC_STATUS_INTA_VALUE)) | 1563 | BNX2_PCICFG_MISC_STATUS_INTA_VALUE)) |
1552 | return IRQ_RETVAL(0); | 1564 | return IRQ_NONE; |
1553 | 1565 | ||
1554 | REG_WR(bp, BNX2_PCICFG_INT_ACK_CMD, | 1566 | REG_WR(bp, BNX2_PCICFG_INT_ACK_CMD, |
1555 | BNX2_PCICFG_INT_ACK_CMD_USE_INT_HC_PARAM | | 1567 | BNX2_PCICFG_INT_ACK_CMD_USE_INT_HC_PARAM | |
1556 | BNX2_PCICFG_INT_ACK_CMD_MASK_INT); | 1568 | BNX2_PCICFG_INT_ACK_CMD_MASK_INT); |
1557 | 1569 | ||
1558 | /* Return here if interrupt is shared and is disabled. */ | 1570 | /* Return here if interrupt is shared and is disabled. */ |
1559 | if (unlikely(atomic_read(&bp->intr_sem) != 0)) { | 1571 | if (unlikely(atomic_read(&bp->intr_sem) != 0)) |
1560 | return IRQ_RETVAL(1); | 1572 | return IRQ_HANDLED; |
1561 | } | ||
1562 | 1573 | ||
1563 | if (netif_rx_schedule_prep(dev)) { | 1574 | netif_rx_schedule(dev); |
1564 | __netif_rx_schedule(dev); | ||
1565 | } | ||
1566 | 1575 | ||
1567 | return IRQ_RETVAL(1); | 1576 | return IRQ_HANDLED; |
1568 | } | 1577 | } |
1569 | 1578 | ||
1570 | static int | 1579 | static int |
@@ -1581,11 +1590,9 @@ bnx2_poll(struct net_device *dev, int *budget) | |||
1581 | (bp->status_blk->status_attn_bits_ack & | 1590 | (bp->status_blk->status_attn_bits_ack & |
1582 | STATUS_ATTN_BITS_LINK_STATE)) { | 1591 | STATUS_ATTN_BITS_LINK_STATE)) { |
1583 | 1592 | ||
1584 | unsigned long flags; | 1593 | spin_lock(&bp->phy_lock); |
1585 | |||
1586 | spin_lock_irqsave(&bp->phy_lock, flags); | ||
1587 | bnx2_phy_int(bp); | 1594 | bnx2_phy_int(bp); |
1588 | spin_unlock_irqrestore(&bp->phy_lock, flags); | 1595 | spin_unlock(&bp->phy_lock); |
1589 | } | 1596 | } |
1590 | 1597 | ||
1591 | if (bp->status_blk->status_tx_quick_consumer_index0 != bp->tx_cons) { | 1598 | if (bp->status_blk->status_tx_quick_consumer_index0 != bp->tx_cons) { |
@@ -1628,9 +1635,8 @@ bnx2_set_rx_mode(struct net_device *dev) | |||
1628 | struct bnx2 *bp = dev->priv; | 1635 | struct bnx2 *bp = dev->priv; |
1629 | u32 rx_mode, sort_mode; | 1636 | u32 rx_mode, sort_mode; |
1630 | int i; | 1637 | int i; |
1631 | unsigned long flags; | ||
1632 | 1638 | ||
1633 | spin_lock_irqsave(&bp->phy_lock, flags); | 1639 | spin_lock_bh(&bp->phy_lock); |
1634 | 1640 | ||
1635 | rx_mode = bp->rx_mode & ~(BNX2_EMAC_RX_MODE_PROMISCUOUS | | 1641 | rx_mode = bp->rx_mode & ~(BNX2_EMAC_RX_MODE_PROMISCUOUS | |
1636 | BNX2_EMAC_RX_MODE_KEEP_VLAN_TAG); | 1642 | BNX2_EMAC_RX_MODE_KEEP_VLAN_TAG); |
@@ -1691,7 +1697,7 @@ bnx2_set_rx_mode(struct net_device *dev) | |||
1691 | REG_WR(bp, BNX2_RPM_SORT_USER0, sort_mode); | 1697 | REG_WR(bp, BNX2_RPM_SORT_USER0, sort_mode); |
1692 | REG_WR(bp, BNX2_RPM_SORT_USER0, sort_mode | BNX2_RPM_SORT_USER0_ENA); | 1698 | REG_WR(bp, BNX2_RPM_SORT_USER0, sort_mode | BNX2_RPM_SORT_USER0_ENA); |
1693 | 1699 | ||
1694 | spin_unlock_irqrestore(&bp->phy_lock, flags); | 1700 | spin_unlock_bh(&bp->phy_lock); |
1695 | } | 1701 | } |
1696 | 1702 | ||
1697 | static void | 1703 | static void |
@@ -2960,7 +2966,6 @@ bnx2_init_tx_ring(struct bnx2 *bp) | |||
2960 | bp->tx_prod = 0; | 2966 | bp->tx_prod = 0; |
2961 | bp->tx_cons = 0; | 2967 | bp->tx_cons = 0; |
2962 | bp->tx_prod_bseq = 0; | 2968 | bp->tx_prod_bseq = 0; |
2963 | atomic_set(&bp->tx_avail_bd, bp->tx_ring_size); | ||
2964 | 2969 | ||
2965 | val = BNX2_L2CTX_TYPE_TYPE_L2; | 2970 | val = BNX2_L2CTX_TYPE_TYPE_L2; |
2966 | val |= BNX2_L2CTX_TYPE_SIZE_L2; | 2971 | val |= BNX2_L2CTX_TYPE_SIZE_L2; |
@@ -3507,11 +3512,11 @@ bnx2_test_registers(struct bnx2 *bp) | |||
3507 | rw_mask = reg_tbl[i].rw_mask; | 3512 | rw_mask = reg_tbl[i].rw_mask; |
3508 | ro_mask = reg_tbl[i].ro_mask; | 3513 | ro_mask = reg_tbl[i].ro_mask; |
3509 | 3514 | ||
3510 | save_val = readl((u8 *) bp->regview + offset); | 3515 | save_val = readl(bp->regview + offset); |
3511 | 3516 | ||
3512 | writel(0, (u8 *) bp->regview + offset); | 3517 | writel(0, bp->regview + offset); |
3513 | 3518 | ||
3514 | val = readl((u8 *) bp->regview + offset); | 3519 | val = readl(bp->regview + offset); |
3515 | if ((val & rw_mask) != 0) { | 3520 | if ((val & rw_mask) != 0) { |
3516 | goto reg_test_err; | 3521 | goto reg_test_err; |
3517 | } | 3522 | } |
@@ -3520,9 +3525,9 @@ bnx2_test_registers(struct bnx2 *bp) | |||
3520 | goto reg_test_err; | 3525 | goto reg_test_err; |
3521 | } | 3526 | } |
3522 | 3527 | ||
3523 | writel(0xffffffff, (u8 *) bp->regview + offset); | 3528 | writel(0xffffffff, bp->regview + offset); |
3524 | 3529 | ||
3525 | val = readl((u8 *) bp->regview + offset); | 3530 | val = readl(bp->regview + offset); |
3526 | if ((val & rw_mask) != rw_mask) { | 3531 | if ((val & rw_mask) != rw_mask) { |
3527 | goto reg_test_err; | 3532 | goto reg_test_err; |
3528 | } | 3533 | } |
@@ -3531,11 +3536,11 @@ bnx2_test_registers(struct bnx2 *bp) | |||
3531 | goto reg_test_err; | 3536 | goto reg_test_err; |
3532 | } | 3537 | } |
3533 | 3538 | ||
3534 | writel(save_val, (u8 *) bp->regview + offset); | 3539 | writel(save_val, bp->regview + offset); |
3535 | continue; | 3540 | continue; |
3536 | 3541 | ||
3537 | reg_test_err: | 3542 | reg_test_err: |
3538 | writel(save_val, (u8 *) bp->regview + offset); | 3543 | writel(save_val, bp->regview + offset); |
3539 | ret = -ENODEV; | 3544 | ret = -ENODEV; |
3540 | break; | 3545 | break; |
3541 | } | 3546 | } |
@@ -3752,10 +3757,10 @@ bnx2_test_link(struct bnx2 *bp) | |||
3752 | { | 3757 | { |
3753 | u32 bmsr; | 3758 | u32 bmsr; |
3754 | 3759 | ||
3755 | spin_lock_irq(&bp->phy_lock); | 3760 | spin_lock_bh(&bp->phy_lock); |
3756 | bnx2_read_phy(bp, MII_BMSR, &bmsr); | 3761 | bnx2_read_phy(bp, MII_BMSR, &bmsr); |
3757 | bnx2_read_phy(bp, MII_BMSR, &bmsr); | 3762 | bnx2_read_phy(bp, MII_BMSR, &bmsr); |
3758 | spin_unlock_irq(&bp->phy_lock); | 3763 | spin_unlock_bh(&bp->phy_lock); |
3759 | 3764 | ||
3760 | if (bmsr & BMSR_LSTATUS) { | 3765 | if (bmsr & BMSR_LSTATUS) { |
3761 | return 0; | 3766 | return 0; |
@@ -3801,6 +3806,9 @@ bnx2_timer(unsigned long data) | |||
3801 | struct bnx2 *bp = (struct bnx2 *) data; | 3806 | struct bnx2 *bp = (struct bnx2 *) data; |
3802 | u32 msg; | 3807 | u32 msg; |
3803 | 3808 | ||
3809 | if (!netif_running(bp->dev)) | ||
3810 | return; | ||
3811 | |||
3804 | if (atomic_read(&bp->intr_sem) != 0) | 3812 | if (atomic_read(&bp->intr_sem) != 0) |
3805 | goto bnx2_restart_timer; | 3813 | goto bnx2_restart_timer; |
3806 | 3814 | ||
@@ -3809,15 +3817,16 @@ bnx2_timer(unsigned long data) | |||
3809 | 3817 | ||
3810 | if ((bp->phy_flags & PHY_SERDES_FLAG) && | 3818 | if ((bp->phy_flags & PHY_SERDES_FLAG) && |
3811 | (CHIP_NUM(bp) == CHIP_NUM_5706)) { | 3819 | (CHIP_NUM(bp) == CHIP_NUM_5706)) { |
3812 | unsigned long flags; | ||
3813 | 3820 | ||
3814 | spin_lock_irqsave(&bp->phy_lock, flags); | 3821 | spin_lock(&bp->phy_lock); |
3815 | if (bp->serdes_an_pending) { | 3822 | if (bp->serdes_an_pending) { |
3816 | bp->serdes_an_pending--; | 3823 | bp->serdes_an_pending--; |
3817 | } | 3824 | } |
3818 | else if ((bp->link_up == 0) && (bp->autoneg & AUTONEG_SPEED)) { | 3825 | else if ((bp->link_up == 0) && (bp->autoneg & AUTONEG_SPEED)) { |
3819 | u32 bmcr; | 3826 | u32 bmcr; |
3820 | 3827 | ||
3828 | bp->current_interval = bp->timer_interval; | ||
3829 | |||
3821 | bnx2_read_phy(bp, MII_BMCR, &bmcr); | 3830 | bnx2_read_phy(bp, MII_BMCR, &bmcr); |
3822 | 3831 | ||
3823 | if (bmcr & BMCR_ANENABLE) { | 3832 | if (bmcr & BMCR_ANENABLE) { |
@@ -3860,14 +3869,14 @@ bnx2_timer(unsigned long data) | |||
3860 | 3869 | ||
3861 | } | 3870 | } |
3862 | } | 3871 | } |
3872 | else | ||
3873 | bp->current_interval = bp->timer_interval; | ||
3863 | 3874 | ||
3864 | spin_unlock_irqrestore(&bp->phy_lock, flags); | 3875 | spin_unlock(&bp->phy_lock); |
3865 | } | 3876 | } |
3866 | 3877 | ||
3867 | bnx2_restart_timer: | 3878 | bnx2_restart_timer: |
3868 | bp->timer.expires = RUN_AT(bp->timer_interval); | 3879 | mod_timer(&bp->timer, jiffies + bp->current_interval); |
3869 | |||
3870 | add_timer(&bp->timer); | ||
3871 | } | 3880 | } |
3872 | 3881 | ||
3873 | /* Called with rtnl_lock */ | 3882 | /* Called with rtnl_lock */ |
@@ -3920,12 +3929,7 @@ bnx2_open(struct net_device *dev) | |||
3920 | return rc; | 3929 | return rc; |
3921 | } | 3930 | } |
3922 | 3931 | ||
3923 | init_timer(&bp->timer); | 3932 | mod_timer(&bp->timer, jiffies + bp->current_interval); |
3924 | |||
3925 | bp->timer.expires = RUN_AT(bp->timer_interval); | ||
3926 | bp->timer.data = (unsigned long) bp; | ||
3927 | bp->timer.function = bnx2_timer; | ||
3928 | add_timer(&bp->timer); | ||
3929 | 3933 | ||
3930 | atomic_set(&bp->intr_sem, 0); | 3934 | atomic_set(&bp->intr_sem, 0); |
3931 | 3935 | ||
@@ -3976,12 +3980,17 @@ bnx2_reset_task(void *data) | |||
3976 | { | 3980 | { |
3977 | struct bnx2 *bp = data; | 3981 | struct bnx2 *bp = data; |
3978 | 3982 | ||
3983 | if (!netif_running(bp->dev)) | ||
3984 | return; | ||
3985 | |||
3986 | bp->in_reset_task = 1; | ||
3979 | bnx2_netif_stop(bp); | 3987 | bnx2_netif_stop(bp); |
3980 | 3988 | ||
3981 | bnx2_init_nic(bp); | 3989 | bnx2_init_nic(bp); |
3982 | 3990 | ||
3983 | atomic_set(&bp->intr_sem, 1); | 3991 | atomic_set(&bp->intr_sem, 1); |
3984 | bnx2_netif_start(bp); | 3992 | bnx2_netif_start(bp); |
3993 | bp->in_reset_task = 0; | ||
3985 | } | 3994 | } |
3986 | 3995 | ||
3987 | static void | 3996 | static void |
@@ -4041,9 +4050,7 @@ bnx2_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
4041 | u16 prod, ring_prod; | 4050 | u16 prod, ring_prod; |
4042 | int i; | 4051 | int i; |
4043 | 4052 | ||
4044 | if (unlikely(atomic_read(&bp->tx_avail_bd) < | 4053 | if (unlikely(bnx2_tx_avail(bp) < (skb_shinfo(skb)->nr_frags + 1))) { |
4045 | (skb_shinfo(skb)->nr_frags + 1))) { | ||
4046 | |||
4047 | netif_stop_queue(dev); | 4054 | netif_stop_queue(dev); |
4048 | printk(KERN_ERR PFX "%s: BUG! Tx ring full when queue awake!\n", | 4055 | printk(KERN_ERR PFX "%s: BUG! Tx ring full when queue awake!\n", |
4049 | dev->name); | 4056 | dev->name); |
@@ -4140,8 +4147,6 @@ bnx2_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
4140 | prod = NEXT_TX_BD(prod); | 4147 | prod = NEXT_TX_BD(prod); |
4141 | bp->tx_prod_bseq += skb->len; | 4148 | bp->tx_prod_bseq += skb->len; |
4142 | 4149 | ||
4143 | atomic_sub(last_frag + 1, &bp->tx_avail_bd); | ||
4144 | |||
4145 | REG_WR16(bp, MB_TX_CID_ADDR + BNX2_L2CTX_TX_HOST_BIDX, prod); | 4150 | REG_WR16(bp, MB_TX_CID_ADDR + BNX2_L2CTX_TX_HOST_BIDX, prod); |
4146 | REG_WR(bp, MB_TX_CID_ADDR + BNX2_L2CTX_TX_HOST_BSEQ, bp->tx_prod_bseq); | 4151 | REG_WR(bp, MB_TX_CID_ADDR + BNX2_L2CTX_TX_HOST_BSEQ, bp->tx_prod_bseq); |
4147 | 4152 | ||
@@ -4150,17 +4155,13 @@ bnx2_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
4150 | bp->tx_prod = prod; | 4155 | bp->tx_prod = prod; |
4151 | dev->trans_start = jiffies; | 4156 | dev->trans_start = jiffies; |
4152 | 4157 | ||
4153 | if (unlikely(atomic_read(&bp->tx_avail_bd) <= MAX_SKB_FRAGS)) { | 4158 | if (unlikely(bnx2_tx_avail(bp) <= MAX_SKB_FRAGS)) { |
4154 | unsigned long flags; | 4159 | spin_lock(&bp->tx_lock); |
4155 | 4160 | netif_stop_queue(dev); | |
4156 | spin_lock_irqsave(&bp->tx_lock, flags); | 4161 | |
4157 | if (atomic_read(&bp->tx_avail_bd) <= MAX_SKB_FRAGS) { | 4162 | if (bnx2_tx_avail(bp) > MAX_SKB_FRAGS) |
4158 | netif_stop_queue(dev); | 4163 | netif_wake_queue(dev); |
4159 | 4164 | spin_unlock(&bp->tx_lock); | |
4160 | if (atomic_read(&bp->tx_avail_bd) > MAX_SKB_FRAGS) | ||
4161 | netif_wake_queue(dev); | ||
4162 | } | ||
4163 | spin_unlock_irqrestore(&bp->tx_lock, flags); | ||
4164 | } | 4165 | } |
4165 | 4166 | ||
4166 | return NETDEV_TX_OK; | 4167 | return NETDEV_TX_OK; |
@@ -4173,7 +4174,13 @@ bnx2_close(struct net_device *dev) | |||
4173 | struct bnx2 *bp = dev->priv; | 4174 | struct bnx2 *bp = dev->priv; |
4174 | u32 reset_code; | 4175 | u32 reset_code; |
4175 | 4176 | ||
4176 | flush_scheduled_work(); | 4177 | /* Calling flush_scheduled_work() may deadlock because |
4178 | * linkwatch_event() may be on the workqueue and it will try to get | ||
4179 | * the rtnl_lock which we are holding. | ||
4180 | */ | ||
4181 | while (bp->in_reset_task) | ||
4182 | msleep(1); | ||
4183 | |||
4177 | bnx2_netif_stop(bp); | 4184 | bnx2_netif_stop(bp); |
4178 | del_timer_sync(&bp->timer); | 4185 | del_timer_sync(&bp->timer); |
4179 | if (bp->wol) | 4186 | if (bp->wol) |
@@ -4390,11 +4397,11 @@ bnx2_set_settings(struct net_device *dev, struct ethtool_cmd *cmd) | |||
4390 | bp->req_line_speed = req_line_speed; | 4397 | bp->req_line_speed = req_line_speed; |
4391 | bp->req_duplex = req_duplex; | 4398 | bp->req_duplex = req_duplex; |
4392 | 4399 | ||
4393 | spin_lock_irq(&bp->phy_lock); | 4400 | spin_lock_bh(&bp->phy_lock); |
4394 | 4401 | ||
4395 | bnx2_setup_phy(bp); | 4402 | bnx2_setup_phy(bp); |
4396 | 4403 | ||
4397 | spin_unlock_irq(&bp->phy_lock); | 4404 | spin_unlock_bh(&bp->phy_lock); |
4398 | 4405 | ||
4399 | return 0; | 4406 | return 0; |
4400 | } | 4407 | } |
@@ -4464,19 +4471,20 @@ bnx2_nway_reset(struct net_device *dev) | |||
4464 | return -EINVAL; | 4471 | return -EINVAL; |
4465 | } | 4472 | } |
4466 | 4473 | ||
4467 | spin_lock_irq(&bp->phy_lock); | 4474 | spin_lock_bh(&bp->phy_lock); |
4468 | 4475 | ||
4469 | /* Force a link down visible on the other side */ | 4476 | /* Force a link down visible on the other side */ |
4470 | if (bp->phy_flags & PHY_SERDES_FLAG) { | 4477 | if (bp->phy_flags & PHY_SERDES_FLAG) { |
4471 | bnx2_write_phy(bp, MII_BMCR, BMCR_LOOPBACK); | 4478 | bnx2_write_phy(bp, MII_BMCR, BMCR_LOOPBACK); |
4472 | spin_unlock_irq(&bp->phy_lock); | 4479 | spin_unlock_bh(&bp->phy_lock); |
4473 | 4480 | ||
4474 | msleep(20); | 4481 | msleep(20); |
4475 | 4482 | ||
4476 | spin_lock_irq(&bp->phy_lock); | 4483 | spin_lock_bh(&bp->phy_lock); |
4477 | if (CHIP_NUM(bp) == CHIP_NUM_5706) { | 4484 | if (CHIP_NUM(bp) == CHIP_NUM_5706) { |
4478 | bp->serdes_an_pending = SERDES_AN_TIMEOUT / | 4485 | bp->current_interval = SERDES_AN_TIMEOUT; |
4479 | bp->timer_interval; | 4486 | bp->serdes_an_pending = 1; |
4487 | mod_timer(&bp->timer, jiffies + bp->current_interval); | ||
4480 | } | 4488 | } |
4481 | } | 4489 | } |
4482 | 4490 | ||
@@ -4484,7 +4492,7 @@ bnx2_nway_reset(struct net_device *dev) | |||
4484 | bmcr &= ~BMCR_LOOPBACK; | 4492 | bmcr &= ~BMCR_LOOPBACK; |
4485 | bnx2_write_phy(bp, MII_BMCR, bmcr | BMCR_ANRESTART | BMCR_ANENABLE); | 4493 | bnx2_write_phy(bp, MII_BMCR, bmcr | BMCR_ANRESTART | BMCR_ANENABLE); |
4486 | 4494 | ||
4487 | spin_unlock_irq(&bp->phy_lock); | 4495 | spin_unlock_bh(&bp->phy_lock); |
4488 | 4496 | ||
4489 | return 0; | 4497 | return 0; |
4490 | } | 4498 | } |
@@ -4670,11 +4678,11 @@ bnx2_set_pauseparam(struct net_device *dev, struct ethtool_pauseparam *epause) | |||
4670 | bp->autoneg &= ~AUTONEG_FLOW_CTRL; | 4678 | bp->autoneg &= ~AUTONEG_FLOW_CTRL; |
4671 | } | 4679 | } |
4672 | 4680 | ||
4673 | spin_lock_irq(&bp->phy_lock); | 4681 | spin_lock_bh(&bp->phy_lock); |
4674 | 4682 | ||
4675 | bnx2_setup_phy(bp); | 4683 | bnx2_setup_phy(bp); |
4676 | 4684 | ||
4677 | spin_unlock_irq(&bp->phy_lock); | 4685 | spin_unlock_bh(&bp->phy_lock); |
4678 | 4686 | ||
4679 | return 0; | 4687 | return 0; |
4680 | } | 4688 | } |
@@ -4698,7 +4706,7 @@ bnx2_set_rx_csum(struct net_device *dev, u32 data) | |||
4698 | 4706 | ||
4699 | #define BNX2_NUM_STATS 45 | 4707 | #define BNX2_NUM_STATS 45 |
4700 | 4708 | ||
4701 | struct { | 4709 | static struct { |
4702 | char string[ETH_GSTRING_LEN]; | 4710 | char string[ETH_GSTRING_LEN]; |
4703 | } bnx2_stats_str_arr[BNX2_NUM_STATS] = { | 4711 | } bnx2_stats_str_arr[BNX2_NUM_STATS] = { |
4704 | { "rx_bytes" }, | 4712 | { "rx_bytes" }, |
@@ -4750,7 +4758,7 @@ struct { | |||
4750 | 4758 | ||
4751 | #define STATS_OFFSET32(offset_name) (offsetof(struct statistics_block, offset_name) / 4) | 4759 | #define STATS_OFFSET32(offset_name) (offsetof(struct statistics_block, offset_name) / 4) |
4752 | 4760 | ||
4753 | unsigned long bnx2_stats_offset_arr[BNX2_NUM_STATS] = { | 4761 | static unsigned long bnx2_stats_offset_arr[BNX2_NUM_STATS] = { |
4754 | STATS_OFFSET32(stat_IfHCInOctets_hi), | 4762 | STATS_OFFSET32(stat_IfHCInOctets_hi), |
4755 | STATS_OFFSET32(stat_IfHCInBadOctets_hi), | 4763 | STATS_OFFSET32(stat_IfHCInBadOctets_hi), |
4756 | STATS_OFFSET32(stat_IfHCOutOctets_hi), | 4764 | STATS_OFFSET32(stat_IfHCOutOctets_hi), |
@@ -4801,7 +4809,7 @@ unsigned long bnx2_stats_offset_arr[BNX2_NUM_STATS] = { | |||
4801 | /* stat_IfHCInBadOctets and stat_Dot3StatsCarrierSenseErrors are | 4809 | /* stat_IfHCInBadOctets and stat_Dot3StatsCarrierSenseErrors are |
4802 | * skipped because of errata. | 4810 | * skipped because of errata. |
4803 | */ | 4811 | */ |
4804 | u8 bnx2_5706_stats_len_arr[BNX2_NUM_STATS] = { | 4812 | static u8 bnx2_5706_stats_len_arr[BNX2_NUM_STATS] = { |
4805 | 8,0,8,8,8,8,8,8,8,8, | 4813 | 8,0,8,8,8,8,8,8,8,8, |
4806 | 4,0,4,4,4,4,4,4,4,4, | 4814 | 4,0,4,4,4,4,4,4,4,4, |
4807 | 4,4,4,4,4,4,4,4,4,4, | 4815 | 4,4,4,4,4,4,4,4,4,4, |
@@ -4811,7 +4819,7 @@ u8 bnx2_5706_stats_len_arr[BNX2_NUM_STATS] = { | |||
4811 | 4819 | ||
4812 | #define BNX2_NUM_TESTS 6 | 4820 | #define BNX2_NUM_TESTS 6 |
4813 | 4821 | ||
4814 | struct { | 4822 | static struct { |
4815 | char string[ETH_GSTRING_LEN]; | 4823 | char string[ETH_GSTRING_LEN]; |
4816 | } bnx2_tests_str_arr[BNX2_NUM_TESTS] = { | 4824 | } bnx2_tests_str_arr[BNX2_NUM_TESTS] = { |
4817 | { "register_test (offline)" }, | 4825 | { "register_test (offline)" }, |
@@ -4910,7 +4918,7 @@ bnx2_get_ethtool_stats(struct net_device *dev, | |||
4910 | struct bnx2 *bp = dev->priv; | 4918 | struct bnx2 *bp = dev->priv; |
4911 | int i; | 4919 | int i; |
4912 | u32 *hw_stats = (u32 *) bp->stats_blk; | 4920 | u32 *hw_stats = (u32 *) bp->stats_blk; |
4913 | u8 *stats_len_arr = 0; | 4921 | u8 *stats_len_arr = NULL; |
4914 | 4922 | ||
4915 | if (hw_stats == NULL) { | 4923 | if (hw_stats == NULL) { |
4916 | memset(buf, 0, sizeof(u64) * BNX2_NUM_STATS); | 4924 | memset(buf, 0, sizeof(u64) * BNX2_NUM_STATS); |
@@ -5012,7 +5020,7 @@ static struct ethtool_ops bnx2_ethtool_ops = { | |||
5012 | static int | 5020 | static int |
5013 | bnx2_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) | 5021 | bnx2_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) |
5014 | { | 5022 | { |
5015 | struct mii_ioctl_data *data = (struct mii_ioctl_data *)&ifr->ifr_data; | 5023 | struct mii_ioctl_data *data = if_mii(ifr); |
5016 | struct bnx2 *bp = dev->priv; | 5024 | struct bnx2 *bp = dev->priv; |
5017 | int err; | 5025 | int err; |
5018 | 5026 | ||
@@ -5024,9 +5032,9 @@ bnx2_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) | |||
5024 | case SIOCGMIIREG: { | 5032 | case SIOCGMIIREG: { |
5025 | u32 mii_regval; | 5033 | u32 mii_regval; |
5026 | 5034 | ||
5027 | spin_lock_irq(&bp->phy_lock); | 5035 | spin_lock_bh(&bp->phy_lock); |
5028 | err = bnx2_read_phy(bp, data->reg_num & 0x1f, &mii_regval); | 5036 | err = bnx2_read_phy(bp, data->reg_num & 0x1f, &mii_regval); |
5029 | spin_unlock_irq(&bp->phy_lock); | 5037 | spin_unlock_bh(&bp->phy_lock); |
5030 | 5038 | ||
5031 | data->val_out = mii_regval; | 5039 | data->val_out = mii_regval; |
5032 | 5040 | ||
@@ -5037,9 +5045,9 @@ bnx2_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) | |||
5037 | if (!capable(CAP_NET_ADMIN)) | 5045 | if (!capable(CAP_NET_ADMIN)) |
5038 | return -EPERM; | 5046 | return -EPERM; |
5039 | 5047 | ||
5040 | spin_lock_irq(&bp->phy_lock); | 5048 | spin_lock_bh(&bp->phy_lock); |
5041 | err = bnx2_write_phy(bp, data->reg_num & 0x1f, data->val_in); | 5049 | err = bnx2_write_phy(bp, data->reg_num & 0x1f, data->val_in); |
5042 | spin_unlock_irq(&bp->phy_lock); | 5050 | spin_unlock_bh(&bp->phy_lock); |
5043 | 5051 | ||
5044 | return err; | 5052 | return err; |
5045 | 5053 | ||
@@ -5057,6 +5065,9 @@ bnx2_change_mac_addr(struct net_device *dev, void *p) | |||
5057 | struct sockaddr *addr = p; | 5065 | struct sockaddr *addr = p; |
5058 | struct bnx2 *bp = dev->priv; | 5066 | struct bnx2 *bp = dev->priv; |
5059 | 5067 | ||
5068 | if (!is_valid_ether_addr(addr->sa_data)) | ||
5069 | return -EINVAL; | ||
5070 | |||
5060 | memcpy(dev->dev_addr, addr->sa_data, dev->addr_len); | 5071 | memcpy(dev->dev_addr, addr->sa_data, dev->addr_len); |
5061 | if (netif_running(dev)) | 5072 | if (netif_running(dev)) |
5062 | bnx2_set_mac_addr(bp); | 5073 | bnx2_set_mac_addr(bp); |
@@ -5305,6 +5316,7 @@ bnx2_init_board(struct pci_dev *pdev, struct net_device *dev) | |||
5305 | bp->stats_ticks = 1000000 & 0xffff00; | 5316 | bp->stats_ticks = 1000000 & 0xffff00; |
5306 | 5317 | ||
5307 | bp->timer_interval = HZ; | 5318 | bp->timer_interval = HZ; |
5319 | bp->current_interval = HZ; | ||
5308 | 5320 | ||
5309 | /* Disable WOL support if we are running on a SERDES chip. */ | 5321 | /* Disable WOL support if we are running on a SERDES chip. */ |
5310 | if (CHIP_BOND_ID(bp) & CHIP_BOND_ID_SERDES_BIT) { | 5322 | if (CHIP_BOND_ID(bp) & CHIP_BOND_ID_SERDES_BIT) { |
@@ -5328,6 +5340,15 @@ bnx2_init_board(struct pci_dev *pdev, struct net_device *dev) | |||
5328 | bp->req_line_speed = 0; | 5340 | bp->req_line_speed = 0; |
5329 | if (bp->phy_flags & PHY_SERDES_FLAG) { | 5341 | if (bp->phy_flags & PHY_SERDES_FLAG) { |
5330 | bp->advertising = ETHTOOL_ALL_FIBRE_SPEED | ADVERTISED_Autoneg; | 5342 | bp->advertising = ETHTOOL_ALL_FIBRE_SPEED | ADVERTISED_Autoneg; |
5343 | |||
5344 | reg = REG_RD_IND(bp, HOST_VIEW_SHMEM_BASE + | ||
5345 | BNX2_PORT_HW_CFG_CONFIG); | ||
5346 | reg &= BNX2_PORT_HW_CFG_CFG_DFLT_LINK_MASK; | ||
5347 | if (reg == BNX2_PORT_HW_CFG_CFG_DFLT_LINK_1G) { | ||
5348 | bp->autoneg = 0; | ||
5349 | bp->req_line_speed = bp->line_speed = SPEED_1000; | ||
5350 | bp->req_duplex = DUPLEX_FULL; | ||
5351 | } | ||
5331 | } | 5352 | } |
5332 | else { | 5353 | else { |
5333 | bp->advertising = ETHTOOL_ALL_COPPER_SPEED | ADVERTISED_Autoneg; | 5354 | bp->advertising = ETHTOOL_ALL_COPPER_SPEED | ADVERTISED_Autoneg; |
@@ -5335,11 +5356,17 @@ bnx2_init_board(struct pci_dev *pdev, struct net_device *dev) | |||
5335 | 5356 | ||
5336 | bp->req_flow_ctrl = FLOW_CTRL_RX | FLOW_CTRL_TX; | 5357 | bp->req_flow_ctrl = FLOW_CTRL_RX | FLOW_CTRL_TX; |
5337 | 5358 | ||
5359 | init_timer(&bp->timer); | ||
5360 | bp->timer.expires = RUN_AT(bp->timer_interval); | ||
5361 | bp->timer.data = (unsigned long) bp; | ||
5362 | bp->timer.function = bnx2_timer; | ||
5363 | |||
5338 | return 0; | 5364 | return 0; |
5339 | 5365 | ||
5340 | err_out_unmap: | 5366 | err_out_unmap: |
5341 | if (bp->regview) { | 5367 | if (bp->regview) { |
5342 | iounmap(bp->regview); | 5368 | iounmap(bp->regview); |
5369 | bp->regview = NULL; | ||
5343 | } | 5370 | } |
5344 | 5371 | ||
5345 | err_out_release: | 5372 | err_out_release: |
@@ -5454,6 +5481,8 @@ bnx2_remove_one(struct pci_dev *pdev) | |||
5454 | struct net_device *dev = pci_get_drvdata(pdev); | 5481 | struct net_device *dev = pci_get_drvdata(pdev); |
5455 | struct bnx2 *bp = dev->priv; | 5482 | struct bnx2 *bp = dev->priv; |
5456 | 5483 | ||
5484 | flush_scheduled_work(); | ||
5485 | |||
5457 | unregister_netdev(dev); | 5486 | unregister_netdev(dev); |
5458 | 5487 | ||
5459 | if (bp->regview) | 5488 | if (bp->regview) |
@@ -5505,12 +5534,12 @@ bnx2_resume(struct pci_dev *pdev) | |||
5505 | } | 5534 | } |
5506 | 5535 | ||
5507 | static struct pci_driver bnx2_pci_driver = { | 5536 | static struct pci_driver bnx2_pci_driver = { |
5508 | name: DRV_MODULE_NAME, | 5537 | .name = DRV_MODULE_NAME, |
5509 | id_table: bnx2_pci_tbl, | 5538 | .id_table = bnx2_pci_tbl, |
5510 | probe: bnx2_init_one, | 5539 | .probe = bnx2_init_one, |
5511 | remove: __devexit_p(bnx2_remove_one), | 5540 | .remove = __devexit_p(bnx2_remove_one), |
5512 | suspend: bnx2_suspend, | 5541 | .suspend = bnx2_suspend, |
5513 | resume: bnx2_resume, | 5542 | .resume = bnx2_resume, |
5514 | }; | 5543 | }; |
5515 | 5544 | ||
5516 | static int __init bnx2_init(void) | 5545 | static int __init bnx2_init(void) |
diff --git a/drivers/net/bnx2.h b/drivers/net/bnx2.h index 8214a2853d0d..9ad3f5740cd8 100644 --- a/drivers/net/bnx2.h +++ b/drivers/net/bnx2.h | |||
@@ -3841,12 +3841,12 @@ struct bnx2 { | |||
3841 | struct status_block *status_blk; | 3841 | struct status_block *status_blk; |
3842 | u32 last_status_idx; | 3842 | u32 last_status_idx; |
3843 | 3843 | ||
3844 | atomic_t tx_avail_bd; | ||
3845 | struct tx_bd *tx_desc_ring; | 3844 | struct tx_bd *tx_desc_ring; |
3846 | struct sw_bd *tx_buf_ring; | 3845 | struct sw_bd *tx_buf_ring; |
3847 | u32 tx_prod_bseq; | 3846 | u32 tx_prod_bseq; |
3848 | u16 tx_prod; | 3847 | u16 tx_prod; |
3849 | u16 tx_cons; | 3848 | u16 tx_cons; |
3849 | int tx_ring_size; | ||
3850 | 3850 | ||
3851 | #ifdef BCM_VLAN | 3851 | #ifdef BCM_VLAN |
3852 | struct vlan_group *vlgrp; | 3852 | struct vlan_group *vlgrp; |
@@ -3872,8 +3872,10 @@ struct bnx2 { | |||
3872 | char *name; | 3872 | char *name; |
3873 | 3873 | ||
3874 | int timer_interval; | 3874 | int timer_interval; |
3875 | int current_interval; | ||
3875 | struct timer_list timer; | 3876 | struct timer_list timer; |
3876 | struct work_struct reset_task; | 3877 | struct work_struct reset_task; |
3878 | int in_reset_task; | ||
3877 | 3879 | ||
3878 | /* Used to synchronize phy accesses. */ | 3880 | /* Used to synchronize phy accesses. */ |
3879 | spinlock_t phy_lock; | 3881 | spinlock_t phy_lock; |
@@ -3927,7 +3929,6 @@ struct bnx2 { | |||
3927 | u16 fw_wr_seq; | 3929 | u16 fw_wr_seq; |
3928 | u16 fw_drv_pulse_wr_seq; | 3930 | u16 fw_drv_pulse_wr_seq; |
3929 | 3931 | ||
3930 | int tx_ring_size; | ||
3931 | dma_addr_t tx_desc_mapping; | 3932 | dma_addr_t tx_desc_mapping; |
3932 | 3933 | ||
3933 | 3934 | ||
@@ -3985,7 +3986,7 @@ struct bnx2 { | |||
3985 | #define PHY_LOOPBACK 2 | 3986 | #define PHY_LOOPBACK 2 |
3986 | 3987 | ||
3987 | u8 serdes_an_pending; | 3988 | u8 serdes_an_pending; |
3988 | #define SERDES_AN_TIMEOUT (2 * HZ) | 3989 | #define SERDES_AN_TIMEOUT (HZ / 3) |
3989 | 3990 | ||
3990 | u8 mac_addr[8]; | 3991 | u8 mac_addr[8]; |
3991 | 3992 | ||
@@ -4171,6 +4172,9 @@ struct fw_info { | |||
4171 | 4172 | ||
4172 | #define BNX2_PORT_HW_CFG_MAC_LOWER 0x00000054 | 4173 | #define BNX2_PORT_HW_CFG_MAC_LOWER 0x00000054 |
4173 | #define BNX2_PORT_HW_CFG_CONFIG 0x00000058 | 4174 | #define BNX2_PORT_HW_CFG_CONFIG 0x00000058 |
4175 | #define BNX2_PORT_HW_CFG_CFG_DFLT_LINK_MASK 0x001f0000 | ||
4176 | #define BNX2_PORT_HW_CFG_CFG_DFLT_LINK_AN 0x00000000 | ||
4177 | #define BNX2_PORT_HW_CFG_CFG_DFLT_LINK_1G 0x00030000 | ||
4174 | 4178 | ||
4175 | #define BNX2_PORT_HW_CFG_IMD_MAC_A_UPPER 0x00000068 | 4179 | #define BNX2_PORT_HW_CFG_IMD_MAC_A_UPPER 0x00000068 |
4176 | #define BNX2_PORT_HW_CFG_IMD_MAC_A_LOWER 0x0000006c | 4180 | #define BNX2_PORT_HW_CFG_IMD_MAC_A_LOWER 0x0000006c |
diff --git a/drivers/net/bonding/bond_3ad.c b/drivers/net/bonding/bond_3ad.c index a2e8dda5afac..d2f34d5a8083 100644 --- a/drivers/net/bonding/bond_3ad.c +++ b/drivers/net/bonding/bond_3ad.c | |||
@@ -2419,22 +2419,19 @@ out: | |||
2419 | return 0; | 2419 | return 0; |
2420 | } | 2420 | } |
2421 | 2421 | ||
2422 | int bond_3ad_lacpdu_recv(struct sk_buff *skb, struct net_device *dev, struct packet_type* ptype) | 2422 | int bond_3ad_lacpdu_recv(struct sk_buff *skb, struct net_device *dev, struct packet_type* ptype, struct net_device *orig_dev) |
2423 | { | 2423 | { |
2424 | struct bonding *bond = dev->priv; | 2424 | struct bonding *bond = dev->priv; |
2425 | struct slave *slave = NULL; | 2425 | struct slave *slave = NULL; |
2426 | int ret = NET_RX_DROP; | 2426 | int ret = NET_RX_DROP; |
2427 | 2427 | ||
2428 | if (!(dev->flags & IFF_MASTER)) { | 2428 | if (!(dev->flags & IFF_MASTER)) |
2429 | goto out; | 2429 | goto out; |
2430 | } | ||
2431 | 2430 | ||
2432 | read_lock(&bond->lock); | 2431 | read_lock(&bond->lock); |
2433 | slave = bond_get_slave_by_dev((struct bonding *)dev->priv, | 2432 | slave = bond_get_slave_by_dev((struct bonding *)dev->priv, orig_dev); |
2434 | skb->real_dev); | 2433 | if (!slave) |
2435 | if (slave == NULL) { | ||
2436 | goto out_unlock; | 2434 | goto out_unlock; |
2437 | } | ||
2438 | 2435 | ||
2439 | bond_3ad_rx_indication((struct lacpdu *) skb->data, slave, skb->len); | 2436 | bond_3ad_rx_indication((struct lacpdu *) skb->data, slave, skb->len); |
2440 | 2437 | ||
diff --git a/drivers/net/bonding/bond_3ad.h b/drivers/net/bonding/bond_3ad.h index f46823894187..673a30af5660 100644 --- a/drivers/net/bonding/bond_3ad.h +++ b/drivers/net/bonding/bond_3ad.h | |||
@@ -295,6 +295,6 @@ void bond_3ad_adapter_duplex_changed(struct slave *slave); | |||
295 | void bond_3ad_handle_link_change(struct slave *slave, char link); | 295 | void bond_3ad_handle_link_change(struct slave *slave, char link); |
296 | int bond_3ad_get_active_agg_info(struct bonding *bond, struct ad_info *ad_info); | 296 | int bond_3ad_get_active_agg_info(struct bonding *bond, struct ad_info *ad_info); |
297 | int bond_3ad_xmit_xor(struct sk_buff *skb, struct net_device *dev); | 297 | int bond_3ad_xmit_xor(struct sk_buff *skb, struct net_device *dev); |
298 | int bond_3ad_lacpdu_recv(struct sk_buff *skb, struct net_device *dev, struct packet_type* ptype); | 298 | int bond_3ad_lacpdu_recv(struct sk_buff *skb, struct net_device *dev, struct packet_type* ptype, struct net_device *orig_dev); |
299 | #endif //__BOND_3AD_H__ | 299 | #endif //__BOND_3AD_H__ |
300 | 300 | ||
diff --git a/drivers/net/bonding/bond_alb.c b/drivers/net/bonding/bond_alb.c index 19e829b567d0..f8fce3961197 100644 --- a/drivers/net/bonding/bond_alb.c +++ b/drivers/net/bonding/bond_alb.c | |||
@@ -354,15 +354,14 @@ static void rlb_update_entry_from_arp(struct bonding *bond, struct arp_pkt *arp) | |||
354 | _unlock_rx_hashtbl(bond); | 354 | _unlock_rx_hashtbl(bond); |
355 | } | 355 | } |
356 | 356 | ||
357 | static int rlb_arp_recv(struct sk_buff *skb, struct net_device *bond_dev, struct packet_type *ptype) | 357 | static int rlb_arp_recv(struct sk_buff *skb, struct net_device *bond_dev, struct packet_type *ptype, struct net_device *orig_dev) |
358 | { | 358 | { |
359 | struct bonding *bond = bond_dev->priv; | 359 | struct bonding *bond = bond_dev->priv; |
360 | struct arp_pkt *arp = (struct arp_pkt *)skb->data; | 360 | struct arp_pkt *arp = (struct arp_pkt *)skb->data; |
361 | int res = NET_RX_DROP; | 361 | int res = NET_RX_DROP; |
362 | 362 | ||
363 | if (!(bond_dev->flags & IFF_MASTER)) { | 363 | if (!(bond_dev->flags & IFF_MASTER)) |
364 | goto out; | 364 | goto out; |
365 | } | ||
366 | 365 | ||
367 | if (!arp) { | 366 | if (!arp) { |
368 | dprintk("Packet has no ARP data\n"); | 367 | dprintk("Packet has no ARP data\n"); |
diff --git a/drivers/net/hamradio/bpqether.c b/drivers/net/hamradio/bpqether.c index ba9f0580e1f9..2946e037a9b1 100644 --- a/drivers/net/hamradio/bpqether.c +++ b/drivers/net/hamradio/bpqether.c | |||
@@ -98,7 +98,7 @@ static char bcast_addr[6]={0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}; | |||
98 | 98 | ||
99 | static char bpq_eth_addr[6]; | 99 | static char bpq_eth_addr[6]; |
100 | 100 | ||
101 | static int bpq_rcv(struct sk_buff *, struct net_device *, struct packet_type *); | 101 | static int bpq_rcv(struct sk_buff *, struct net_device *, struct packet_type *, struct net_device *); |
102 | static int bpq_device_event(struct notifier_block *, unsigned long, void *); | 102 | static int bpq_device_event(struct notifier_block *, unsigned long, void *); |
103 | static const char *bpq_print_ethaddr(const unsigned char *); | 103 | static const char *bpq_print_ethaddr(const unsigned char *); |
104 | 104 | ||
@@ -165,7 +165,7 @@ static inline int dev_is_ethdev(struct net_device *dev) | |||
165 | /* | 165 | /* |
166 | * Receive an AX.25 frame via an ethernet interface. | 166 | * Receive an AX.25 frame via an ethernet interface. |
167 | */ | 167 | */ |
168 | static int bpq_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *ptype) | 168 | static int bpq_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *ptype, struct net_device *orig_dev) |
169 | { | 169 | { |
170 | int len; | 170 | int len; |
171 | char * ptr; | 171 | char * ptr; |
diff --git a/drivers/net/ibmveth.c b/drivers/net/ibmveth.c index c39b0609742a..32d5fabd4b10 100644 --- a/drivers/net/ibmveth.c +++ b/drivers/net/ibmveth.c | |||
@@ -1144,7 +1144,7 @@ static void ibmveth_proc_unregister_driver(void) | |||
1144 | 1144 | ||
1145 | static struct vio_device_id ibmveth_device_table[] __devinitdata= { | 1145 | static struct vio_device_id ibmveth_device_table[] __devinitdata= { |
1146 | { "network", "IBM,l-lan"}, | 1146 | { "network", "IBM,l-lan"}, |
1147 | { 0,} | 1147 | { "", "" } |
1148 | }; | 1148 | }; |
1149 | 1149 | ||
1150 | MODULE_DEVICE_TABLE(vio, ibmveth_device_table); | 1150 | MODULE_DEVICE_TABLE(vio, ibmveth_device_table); |
diff --git a/drivers/net/iseries_veth.c b/drivers/net/iseries_veth.c index 55af32e9bf08..183ba97785b0 100644 --- a/drivers/net/iseries_veth.c +++ b/drivers/net/iseries_veth.c | |||
@@ -1370,7 +1370,7 @@ static int veth_probe(struct vio_dev *vdev, const struct vio_device_id *id) | |||
1370 | */ | 1370 | */ |
1371 | static struct vio_device_id veth_device_table[] __devinitdata = { | 1371 | static struct vio_device_id veth_device_table[] __devinitdata = { |
1372 | { "vlan", "" }, | 1372 | { "vlan", "" }, |
1373 | { NULL, NULL } | 1373 | { "", "" } |
1374 | }; | 1374 | }; |
1375 | MODULE_DEVICE_TABLE(vio, veth_device_table); | 1375 | MODULE_DEVICE_TABLE(vio, veth_device_table); |
1376 | 1376 | ||
diff --git a/drivers/net/ppp_generic.c b/drivers/net/ppp_generic.c index a32668e88e09..bb71638a7c44 100644 --- a/drivers/net/ppp_generic.c +++ b/drivers/net/ppp_generic.c | |||
@@ -1657,7 +1657,6 @@ ppp_receive_nonmp_frame(struct ppp *ppp, struct sk_buff *skb) | |||
1657 | skb->dev = ppp->dev; | 1657 | skb->dev = ppp->dev; |
1658 | skb->protocol = htons(npindex_to_ethertype[npi]); | 1658 | skb->protocol = htons(npindex_to_ethertype[npi]); |
1659 | skb->mac.raw = skb->data; | 1659 | skb->mac.raw = skb->data; |
1660 | skb->input_dev = ppp->dev; | ||
1661 | netif_rx(skb); | 1660 | netif_rx(skb); |
1662 | ppp->dev->last_rx = jiffies; | 1661 | ppp->dev->last_rx = jiffies; |
1663 | } | 1662 | } |
diff --git a/drivers/net/pppoe.c b/drivers/net/pppoe.c index ce1a9bf7b9a7..82f236cc3b9b 100644 --- a/drivers/net/pppoe.c +++ b/drivers/net/pppoe.c | |||
@@ -377,7 +377,8 @@ abort_kfree: | |||
377 | ***********************************************************************/ | 377 | ***********************************************************************/ |
378 | static int pppoe_rcv(struct sk_buff *skb, | 378 | static int pppoe_rcv(struct sk_buff *skb, |
379 | struct net_device *dev, | 379 | struct net_device *dev, |
380 | struct packet_type *pt) | 380 | struct packet_type *pt, |
381 | struct net_device *orig_dev) | ||
381 | 382 | ||
382 | { | 383 | { |
383 | struct pppoe_hdr *ph; | 384 | struct pppoe_hdr *ph; |
@@ -426,7 +427,8 @@ out: | |||
426 | ***********************************************************************/ | 427 | ***********************************************************************/ |
427 | static int pppoe_disc_rcv(struct sk_buff *skb, | 428 | static int pppoe_disc_rcv(struct sk_buff *skb, |
428 | struct net_device *dev, | 429 | struct net_device *dev, |
429 | struct packet_type *pt) | 430 | struct packet_type *pt, |
431 | struct net_device *orig_dev) | ||
430 | 432 | ||
431 | { | 433 | { |
432 | struct pppoe_hdr *ph; | 434 | struct pppoe_hdr *ph; |
diff --git a/drivers/net/rrunner.c b/drivers/net/rrunner.c index 12a86f96d973..ec1a18d189a1 100644 --- a/drivers/net/rrunner.c +++ b/drivers/net/rrunner.c | |||
@@ -1429,6 +1429,7 @@ static int rr_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1429 | { | 1429 | { |
1430 | struct rr_private *rrpriv = netdev_priv(dev); | 1430 | struct rr_private *rrpriv = netdev_priv(dev); |
1431 | struct rr_regs __iomem *regs = rrpriv->regs; | 1431 | struct rr_regs __iomem *regs = rrpriv->regs; |
1432 | struct hippi_cb *hcb = (struct hippi_cb *) skb->cb; | ||
1432 | struct ring_ctrl *txctrl; | 1433 | struct ring_ctrl *txctrl; |
1433 | unsigned long flags; | 1434 | unsigned long flags; |
1434 | u32 index, len = skb->len; | 1435 | u32 index, len = skb->len; |
@@ -1460,7 +1461,7 @@ static int rr_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1460 | ifield = (u32 *)skb_push(skb, 8); | 1461 | ifield = (u32 *)skb_push(skb, 8); |
1461 | 1462 | ||
1462 | ifield[0] = 0; | 1463 | ifield[0] = 0; |
1463 | ifield[1] = skb->private.ifield; | 1464 | ifield[1] = hcb->ifield; |
1464 | 1465 | ||
1465 | /* | 1466 | /* |
1466 | * We don't need the lock before we are actually going to start | 1467 | * We don't need the lock before we are actually going to start |
diff --git a/drivers/net/s2io.h b/drivers/net/s2io.h index 5d9270730ca2..bc64d967f080 100644 --- a/drivers/net/s2io.h +++ b/drivers/net/s2io.h | |||
@@ -762,8 +762,8 @@ static inline u64 readq(void __iomem *addr) | |||
762 | { | 762 | { |
763 | u64 ret = 0; | 763 | u64 ret = 0; |
764 | ret = readl(addr + 4); | 764 | ret = readl(addr + 4); |
765 | (u64) ret <<= 32; | 765 | ret <<= 32; |
766 | (u64) ret |= readl(addr); | 766 | ret |= readl(addr); |
767 | 767 | ||
768 | return ret; | 768 | return ret; |
769 | } | 769 | } |
diff --git a/drivers/net/shaper.c b/drivers/net/shaper.c index 3ad0b6751f6f..221354eea21f 100644 --- a/drivers/net/shaper.c +++ b/drivers/net/shaper.c | |||
@@ -156,52 +156,6 @@ static int shaper_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
156 | 156 | ||
157 | SHAPERCB(skb)->shapelen= shaper_clocks(shaper,skb); | 157 | SHAPERCB(skb)->shapelen= shaper_clocks(shaper,skb); |
158 | 158 | ||
159 | #ifdef SHAPER_COMPLEX /* and broken.. */ | ||
160 | |||
161 | while(ptr && ptr!=(struct sk_buff *)&shaper->sendq) | ||
162 | { | ||
163 | if(ptr->pri<skb->pri | ||
164 | && jiffies - SHAPERCB(ptr)->shapeclock < SHAPER_MAXSLIP) | ||
165 | { | ||
166 | struct sk_buff *tmp=ptr->prev; | ||
167 | |||
168 | /* | ||
169 | * It goes before us therefore we slip the length | ||
170 | * of the new frame. | ||
171 | */ | ||
172 | |||
173 | SHAPERCB(ptr)->shapeclock+=SHAPERCB(skb)->shapelen; | ||
174 | SHAPERCB(ptr)->shapelatency+=SHAPERCB(skb)->shapelen; | ||
175 | |||
176 | /* | ||
177 | * The packet may have slipped so far back it | ||
178 | * fell off. | ||
179 | */ | ||
180 | if(SHAPERCB(ptr)->shapelatency > SHAPER_LATENCY) | ||
181 | { | ||
182 | skb_unlink(ptr); | ||
183 | dev_kfree_skb(ptr); | ||
184 | } | ||
185 | ptr=tmp; | ||
186 | } | ||
187 | else | ||
188 | break; | ||
189 | } | ||
190 | if(ptr==NULL || ptr==(struct sk_buff *)&shaper->sendq) | ||
191 | skb_queue_head(&shaper->sendq,skb); | ||
192 | else | ||
193 | { | ||
194 | struct sk_buff *tmp; | ||
195 | /* | ||
196 | * Set the packet clock out time according to the | ||
197 | * frames ahead. Im sure a bit of thought could drop | ||
198 | * this loop. | ||
199 | */ | ||
200 | for(tmp=skb_peek(&shaper->sendq); tmp!=NULL && tmp!=ptr; tmp=tmp->next) | ||
201 | SHAPERCB(skb)->shapeclock+=tmp->shapelen; | ||
202 | skb_append(ptr,skb); | ||
203 | } | ||
204 | #else | ||
205 | { | 159 | { |
206 | struct sk_buff *tmp; | 160 | struct sk_buff *tmp; |
207 | /* | 161 | /* |
@@ -220,7 +174,7 @@ static int shaper_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
220 | } else | 174 | } else |
221 | skb_queue_tail(&shaper->sendq, skb); | 175 | skb_queue_tail(&shaper->sendq, skb); |
222 | } | 176 | } |
223 | #endif | 177 | |
224 | if(sh_debug) | 178 | if(sh_debug) |
225 | printk("Frame queued.\n"); | 179 | printk("Frame queued.\n"); |
226 | if(skb_queue_len(&shaper->sendq)>SHAPER_QLEN) | 180 | if(skb_queue_len(&shaper->sendq)>SHAPER_QLEN) |
@@ -302,7 +256,7 @@ static void shaper_kick(struct shaper *shaper) | |||
302 | * Pull the frame and get interrupts back on. | 256 | * Pull the frame and get interrupts back on. |
303 | */ | 257 | */ |
304 | 258 | ||
305 | skb_unlink(skb); | 259 | skb_unlink(skb, &shaper->sendq); |
306 | if (shaper->recovery < | 260 | if (shaper->recovery < |
307 | SHAPERCB(skb)->shapeclock + SHAPERCB(skb)->shapelen) | 261 | SHAPERCB(skb)->shapeclock + SHAPERCB(skb)->shapelen) |
308 | shaper->recovery = SHAPERCB(skb)->shapeclock + SHAPERCB(skb)->shapelen; | 262 | shaper->recovery = SHAPERCB(skb)->shapeclock + SHAPERCB(skb)->shapelen; |
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c index 6d4ab1e333b5..af8263a1580e 100644 --- a/drivers/net/tg3.c +++ b/drivers/net/tg3.c | |||
@@ -340,41 +340,92 @@ static struct { | |||
340 | 340 | ||
341 | static void tg3_write_indirect_reg32(struct tg3 *tp, u32 off, u32 val) | 341 | static void tg3_write_indirect_reg32(struct tg3 *tp, u32 off, u32 val) |
342 | { | 342 | { |
343 | if ((tp->tg3_flags & TG3_FLAG_PCIX_TARGET_HWBUG) != 0) { | 343 | unsigned long flags; |
344 | spin_lock_bh(&tp->indirect_lock); | 344 | |
345 | pci_write_config_dword(tp->pdev, TG3PCI_REG_BASE_ADDR, off); | 345 | spin_lock_irqsave(&tp->indirect_lock, flags); |
346 | pci_write_config_dword(tp->pdev, TG3PCI_REG_DATA, val); | 346 | pci_write_config_dword(tp->pdev, TG3PCI_REG_BASE_ADDR, off); |
347 | spin_unlock_bh(&tp->indirect_lock); | 347 | pci_write_config_dword(tp->pdev, TG3PCI_REG_DATA, val); |
348 | } else { | 348 | spin_unlock_irqrestore(&tp->indirect_lock, flags); |
349 | writel(val, tp->regs + off); | 349 | } |
350 | if ((tp->tg3_flags & TG3_FLAG_5701_REG_WRITE_BUG) != 0) | 350 | |
351 | readl(tp->regs + off); | 351 | static void tg3_write_flush_reg32(struct tg3 *tp, u32 off, u32 val) |
352 | { | ||
353 | writel(val, tp->regs + off); | ||
354 | readl(tp->regs + off); | ||
355 | } | ||
356 | |||
357 | static u32 tg3_read_indirect_reg32(struct tg3 *tp, u32 off) | ||
358 | { | ||
359 | unsigned long flags; | ||
360 | u32 val; | ||
361 | |||
362 | spin_lock_irqsave(&tp->indirect_lock, flags); | ||
363 | pci_write_config_dword(tp->pdev, TG3PCI_REG_BASE_ADDR, off); | ||
364 | pci_read_config_dword(tp->pdev, TG3PCI_REG_DATA, &val); | ||
365 | spin_unlock_irqrestore(&tp->indirect_lock, flags); | ||
366 | return val; | ||
367 | } | ||
368 | |||
369 | static void tg3_write_indirect_mbox(struct tg3 *tp, u32 off, u32 val) | ||
370 | { | ||
371 | unsigned long flags; | ||
372 | |||
373 | if (off == (MAILBOX_RCVRET_CON_IDX_0 + TG3_64BIT_REG_LOW)) { | ||
374 | pci_write_config_dword(tp->pdev, TG3PCI_RCV_RET_RING_CON_IDX + | ||
375 | TG3_64BIT_REG_LOW, val); | ||
376 | return; | ||
377 | } | ||
378 | if (off == (MAILBOX_RCV_STD_PROD_IDX + TG3_64BIT_REG_LOW)) { | ||
379 | pci_write_config_dword(tp->pdev, TG3PCI_STD_RING_PROD_IDX + | ||
380 | TG3_64BIT_REG_LOW, val); | ||
381 | return; | ||
382 | } | ||
383 | |||
384 | spin_lock_irqsave(&tp->indirect_lock, flags); | ||
385 | pci_write_config_dword(tp->pdev, TG3PCI_REG_BASE_ADDR, off + 0x5600); | ||
386 | pci_write_config_dword(tp->pdev, TG3PCI_REG_DATA, val); | ||
387 | spin_unlock_irqrestore(&tp->indirect_lock, flags); | ||
388 | |||
389 | /* In indirect mode when disabling interrupts, we also need | ||
390 | * to clear the interrupt bit in the GRC local ctrl register. | ||
391 | */ | ||
392 | if ((off == (MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW)) && | ||
393 | (val == 0x1)) { | ||
394 | pci_write_config_dword(tp->pdev, TG3PCI_MISC_LOCAL_CTRL, | ||
395 | tp->grc_local_ctrl|GRC_LCLCTRL_CLEARINT); | ||
352 | } | 396 | } |
353 | } | 397 | } |
354 | 398 | ||
399 | static u32 tg3_read_indirect_mbox(struct tg3 *tp, u32 off) | ||
400 | { | ||
401 | unsigned long flags; | ||
402 | u32 val; | ||
403 | |||
404 | spin_lock_irqsave(&tp->indirect_lock, flags); | ||
405 | pci_write_config_dword(tp->pdev, TG3PCI_REG_BASE_ADDR, off + 0x5600); | ||
406 | pci_read_config_dword(tp->pdev, TG3PCI_REG_DATA, &val); | ||
407 | spin_unlock_irqrestore(&tp->indirect_lock, flags); | ||
408 | return val; | ||
409 | } | ||
410 | |||
355 | static void _tw32_flush(struct tg3 *tp, u32 off, u32 val) | 411 | static void _tw32_flush(struct tg3 *tp, u32 off, u32 val) |
356 | { | 412 | { |
357 | if ((tp->tg3_flags & TG3_FLAG_PCIX_TARGET_HWBUG) != 0) { | 413 | tp->write32(tp, off, val); |
358 | spin_lock_bh(&tp->indirect_lock); | 414 | if (!(tp->tg3_flags & TG3_FLAG_PCIX_TARGET_HWBUG) && |
359 | pci_write_config_dword(tp->pdev, TG3PCI_REG_BASE_ADDR, off); | 415 | !(tp->tg3_flags & TG3_FLAG_5701_REG_WRITE_BUG) && |
360 | pci_write_config_dword(tp->pdev, TG3PCI_REG_DATA, val); | 416 | !(tp->tg3_flags2 & TG3_FLG2_ICH_WORKAROUND)) |
361 | spin_unlock_bh(&tp->indirect_lock); | 417 | tp->read32(tp, off); /* flush */ |
362 | } else { | ||
363 | void __iomem *dest = tp->regs + off; | ||
364 | writel(val, dest); | ||
365 | readl(dest); /* always flush PCI write */ | ||
366 | } | ||
367 | } | 418 | } |
368 | 419 | ||
369 | static inline void _tw32_rx_mbox(struct tg3 *tp, u32 off, u32 val) | 420 | static inline void tw32_mailbox_flush(struct tg3 *tp, u32 off, u32 val) |
370 | { | 421 | { |
371 | void __iomem *mbox = tp->regs + off; | 422 | tp->write32_mbox(tp, off, val); |
372 | writel(val, mbox); | 423 | if (!(tp->tg3_flags & TG3_FLAG_MBOX_WRITE_REORDER) && |
373 | if (tp->tg3_flags & TG3_FLAG_MBOX_WRITE_REORDER) | 424 | !(tp->tg3_flags2 & TG3_FLG2_ICH_WORKAROUND)) |
374 | readl(mbox); | 425 | tp->read32_mbox(tp, off); |
375 | } | 426 | } |
376 | 427 | ||
377 | static inline void _tw32_tx_mbox(struct tg3 *tp, u32 off, u32 val) | 428 | static void tg3_write32_tx_mbox(struct tg3 *tp, u32 off, u32 val) |
378 | { | 429 | { |
379 | void __iomem *mbox = tp->regs + off; | 430 | void __iomem *mbox = tp->regs + off; |
380 | writel(val, mbox); | 431 | writel(val, mbox); |
@@ -384,46 +435,57 @@ static inline void _tw32_tx_mbox(struct tg3 *tp, u32 off, u32 val) | |||
384 | readl(mbox); | 435 | readl(mbox); |
385 | } | 436 | } |
386 | 437 | ||
387 | #define tw32_mailbox(reg, val) writel(((val) & 0xffffffff), tp->regs + (reg)) | 438 | static void tg3_write32(struct tg3 *tp, u32 off, u32 val) |
388 | #define tw32_rx_mbox(reg, val) _tw32_rx_mbox(tp, reg, val) | 439 | { |
389 | #define tw32_tx_mbox(reg, val) _tw32_tx_mbox(tp, reg, val) | 440 | writel(val, tp->regs + off); |
441 | } | ||
442 | |||
443 | static u32 tg3_read32(struct tg3 *tp, u32 off) | ||
444 | { | ||
445 | return (readl(tp->regs + off)); | ||
446 | } | ||
447 | |||
448 | #define tw32_mailbox(reg, val) tp->write32_mbox(tp, reg, val) | ||
449 | #define tw32_mailbox_f(reg, val) tw32_mailbox_flush(tp, (reg), (val)) | ||
450 | #define tw32_rx_mbox(reg, val) tp->write32_rx_mbox(tp, reg, val) | ||
451 | #define tw32_tx_mbox(reg, val) tp->write32_tx_mbox(tp, reg, val) | ||
452 | #define tr32_mailbox(reg) tp->read32_mbox(tp, reg) | ||
390 | 453 | ||
391 | #define tw32(reg,val) tg3_write_indirect_reg32(tp,(reg),(val)) | 454 | #define tw32(reg,val) tp->write32(tp, reg, val) |
392 | #define tw32_f(reg,val) _tw32_flush(tp,(reg),(val)) | 455 | #define tw32_f(reg,val) _tw32_flush(tp,(reg),(val)) |
393 | #define tw16(reg,val) writew(((val) & 0xffff), tp->regs + (reg)) | 456 | #define tr32(reg) tp->read32(tp, reg) |
394 | #define tw8(reg,val) writeb(((val) & 0xff), tp->regs + (reg)) | ||
395 | #define tr32(reg) readl(tp->regs + (reg)) | ||
396 | #define tr16(reg) readw(tp->regs + (reg)) | ||
397 | #define tr8(reg) readb(tp->regs + (reg)) | ||
398 | 457 | ||
399 | static void tg3_write_mem(struct tg3 *tp, u32 off, u32 val) | 458 | static void tg3_write_mem(struct tg3 *tp, u32 off, u32 val) |
400 | { | 459 | { |
401 | spin_lock_bh(&tp->indirect_lock); | 460 | unsigned long flags; |
461 | |||
462 | spin_lock_irqsave(&tp->indirect_lock, flags); | ||
402 | pci_write_config_dword(tp->pdev, TG3PCI_MEM_WIN_BASE_ADDR, off); | 463 | pci_write_config_dword(tp->pdev, TG3PCI_MEM_WIN_BASE_ADDR, off); |
403 | pci_write_config_dword(tp->pdev, TG3PCI_MEM_WIN_DATA, val); | 464 | pci_write_config_dword(tp->pdev, TG3PCI_MEM_WIN_DATA, val); |
404 | 465 | ||
405 | /* Always leave this as zero. */ | 466 | /* Always leave this as zero. */ |
406 | pci_write_config_dword(tp->pdev, TG3PCI_MEM_WIN_BASE_ADDR, 0); | 467 | pci_write_config_dword(tp->pdev, TG3PCI_MEM_WIN_BASE_ADDR, 0); |
407 | spin_unlock_bh(&tp->indirect_lock); | 468 | spin_unlock_irqrestore(&tp->indirect_lock, flags); |
408 | } | 469 | } |
409 | 470 | ||
410 | static void tg3_read_mem(struct tg3 *tp, u32 off, u32 *val) | 471 | static void tg3_read_mem(struct tg3 *tp, u32 off, u32 *val) |
411 | { | 472 | { |
412 | spin_lock_bh(&tp->indirect_lock); | 473 | unsigned long flags; |
474 | |||
475 | spin_lock_irqsave(&tp->indirect_lock, flags); | ||
413 | pci_write_config_dword(tp->pdev, TG3PCI_MEM_WIN_BASE_ADDR, off); | 476 | pci_write_config_dword(tp->pdev, TG3PCI_MEM_WIN_BASE_ADDR, off); |
414 | pci_read_config_dword(tp->pdev, TG3PCI_MEM_WIN_DATA, val); | 477 | pci_read_config_dword(tp->pdev, TG3PCI_MEM_WIN_DATA, val); |
415 | 478 | ||
416 | /* Always leave this as zero. */ | 479 | /* Always leave this as zero. */ |
417 | pci_write_config_dword(tp->pdev, TG3PCI_MEM_WIN_BASE_ADDR, 0); | 480 | pci_write_config_dword(tp->pdev, TG3PCI_MEM_WIN_BASE_ADDR, 0); |
418 | spin_unlock_bh(&tp->indirect_lock); | 481 | spin_unlock_irqrestore(&tp->indirect_lock, flags); |
419 | } | 482 | } |
420 | 483 | ||
421 | static void tg3_disable_ints(struct tg3 *tp) | 484 | static void tg3_disable_ints(struct tg3 *tp) |
422 | { | 485 | { |
423 | tw32(TG3PCI_MISC_HOST_CTRL, | 486 | tw32(TG3PCI_MISC_HOST_CTRL, |
424 | (tp->misc_host_ctrl | MISC_HOST_CTRL_MASK_PCI_INT)); | 487 | (tp->misc_host_ctrl | MISC_HOST_CTRL_MASK_PCI_INT)); |
425 | tw32_mailbox(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW, 0x00000001); | 488 | tw32_mailbox_f(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW, 0x00000001); |
426 | tr32(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW); | ||
427 | } | 489 | } |
428 | 490 | ||
429 | static inline void tg3_cond_int(struct tg3 *tp) | 491 | static inline void tg3_cond_int(struct tg3 *tp) |
@@ -439,9 +501,8 @@ static void tg3_enable_ints(struct tg3 *tp) | |||
439 | 501 | ||
440 | tw32(TG3PCI_MISC_HOST_CTRL, | 502 | tw32(TG3PCI_MISC_HOST_CTRL, |
441 | (tp->misc_host_ctrl & ~MISC_HOST_CTRL_MASK_PCI_INT)); | 503 | (tp->misc_host_ctrl & ~MISC_HOST_CTRL_MASK_PCI_INT)); |
442 | tw32_mailbox(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW, | 504 | tw32_mailbox_f(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW, |
443 | (tp->last_tag << 24)); | 505 | (tp->last_tag << 24)); |
444 | tr32(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW); | ||
445 | tg3_cond_int(tp); | 506 | tg3_cond_int(tp); |
446 | } | 507 | } |
447 | 508 | ||
@@ -472,8 +533,6 @@ static inline unsigned int tg3_has_work(struct tg3 *tp) | |||
472 | */ | 533 | */ |
473 | static void tg3_restart_ints(struct tg3 *tp) | 534 | static void tg3_restart_ints(struct tg3 *tp) |
474 | { | 535 | { |
475 | tw32(TG3PCI_MISC_HOST_CTRL, | ||
476 | (tp->misc_host_ctrl & ~MISC_HOST_CTRL_MASK_PCI_INT)); | ||
477 | tw32_mailbox(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW, | 536 | tw32_mailbox(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW, |
478 | tp->last_tag << 24); | 537 | tp->last_tag << 24); |
479 | mmiowb(); | 538 | mmiowb(); |
@@ -3278,9 +3337,8 @@ static irqreturn_t tg3_interrupt(int irq, void *dev_id, struct pt_regs *regs) | |||
3278 | /* No work, shared interrupt perhaps? re-enable | 3337 | /* No work, shared interrupt perhaps? re-enable |
3279 | * interrupts, and flush that PCI write | 3338 | * interrupts, and flush that PCI write |
3280 | */ | 3339 | */ |
3281 | tw32_mailbox(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW, | 3340 | tw32_mailbox_f(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW, |
3282 | 0x00000000); | 3341 | 0x00000000); |
3283 | tr32(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW); | ||
3284 | } | 3342 | } |
3285 | } else { /* shared interrupt */ | 3343 | } else { /* shared interrupt */ |
3286 | handled = 0; | 3344 | handled = 0; |
@@ -3323,9 +3381,8 @@ static irqreturn_t tg3_interrupt_tagged(int irq, void *dev_id, struct pt_regs *r | |||
3323 | /* no work, shared interrupt perhaps? re-enable | 3381 | /* no work, shared interrupt perhaps? re-enable |
3324 | * interrupts, and flush that PCI write | 3382 | * interrupts, and flush that PCI write |
3325 | */ | 3383 | */ |
3326 | tw32_mailbox(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW, | 3384 | tw32_mailbox_f(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW, |
3327 | tp->last_tag << 24); | 3385 | tp->last_tag << 24); |
3328 | tr32(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW); | ||
3329 | } | 3386 | } |
3330 | } else { /* shared interrupt */ | 3387 | } else { /* shared interrupt */ |
3331 | handled = 0; | 3388 | handled = 0; |
@@ -4216,7 +4273,7 @@ static void tg3_stop_fw(struct tg3 *); | |||
4216 | static int tg3_chip_reset(struct tg3 *tp) | 4273 | static int tg3_chip_reset(struct tg3 *tp) |
4217 | { | 4274 | { |
4218 | u32 val; | 4275 | u32 val; |
4219 | u32 flags_save; | 4276 | void (*write_op)(struct tg3 *, u32, u32); |
4220 | int i; | 4277 | int i; |
4221 | 4278 | ||
4222 | if (!(tp->tg3_flags2 & TG3_FLG2_SUN_570X)) | 4279 | if (!(tp->tg3_flags2 & TG3_FLG2_SUN_570X)) |
@@ -4228,8 +4285,9 @@ static int tg3_chip_reset(struct tg3 *tp) | |||
4228 | * fun things. So, temporarily disable the 5701 | 4285 | * fun things. So, temporarily disable the 5701 |
4229 | * hardware workaround, while we do the reset. | 4286 | * hardware workaround, while we do the reset. |
4230 | */ | 4287 | */ |
4231 | flags_save = tp->tg3_flags; | 4288 | write_op = tp->write32; |
4232 | tp->tg3_flags &= ~TG3_FLAG_5701_REG_WRITE_BUG; | 4289 | if (write_op == tg3_write_flush_reg32) |
4290 | tp->write32 = tg3_write32; | ||
4233 | 4291 | ||
4234 | /* do the reset */ | 4292 | /* do the reset */ |
4235 | val = GRC_MISC_CFG_CORECLK_RESET; | 4293 | val = GRC_MISC_CFG_CORECLK_RESET; |
@@ -4248,8 +4306,8 @@ static int tg3_chip_reset(struct tg3 *tp) | |||
4248 | val |= GRC_MISC_CFG_KEEP_GPHY_POWER; | 4306 | val |= GRC_MISC_CFG_KEEP_GPHY_POWER; |
4249 | tw32(GRC_MISC_CFG, val); | 4307 | tw32(GRC_MISC_CFG, val); |
4250 | 4308 | ||
4251 | /* restore 5701 hardware bug workaround flag */ | 4309 | /* restore 5701 hardware bug workaround write method */ |
4252 | tp->tg3_flags = flags_save; | 4310 | tp->write32 = write_op; |
4253 | 4311 | ||
4254 | /* Unfortunately, we have to delay before the PCI read back. | 4312 | /* Unfortunately, we have to delay before the PCI read back. |
4255 | * Some 575X chips even will not respond to a PCI cfg access | 4313 | * Some 575X chips even will not respond to a PCI cfg access |
@@ -4635,7 +4693,6 @@ static int tg3_load_firmware_cpu(struct tg3 *tp, u32 cpu_base, u32 cpu_scratch_b | |||
4635 | int cpu_scratch_size, struct fw_info *info) | 4693 | int cpu_scratch_size, struct fw_info *info) |
4636 | { | 4694 | { |
4637 | int err, i; | 4695 | int err, i; |
4638 | u32 orig_tg3_flags = tp->tg3_flags; | ||
4639 | void (*write_op)(struct tg3 *, u32, u32); | 4696 | void (*write_op)(struct tg3 *, u32, u32); |
4640 | 4697 | ||
4641 | if (cpu_base == TX_CPU_BASE && | 4698 | if (cpu_base == TX_CPU_BASE && |
@@ -4651,11 +4708,6 @@ static int tg3_load_firmware_cpu(struct tg3 *tp, u32 cpu_base, u32 cpu_scratch_b | |||
4651 | else | 4708 | else |
4652 | write_op = tg3_write_indirect_reg32; | 4709 | write_op = tg3_write_indirect_reg32; |
4653 | 4710 | ||
4654 | /* Force use of PCI config space for indirect register | ||
4655 | * write calls. | ||
4656 | */ | ||
4657 | tp->tg3_flags |= TG3_FLAG_PCIX_TARGET_HWBUG; | ||
4658 | |||
4659 | /* It is possible that bootcode is still loading at this point. | 4711 | /* It is possible that bootcode is still loading at this point. |
4660 | * Get the nvram lock first before halting the cpu. | 4712 | * Get the nvram lock first before halting the cpu. |
4661 | */ | 4713 | */ |
@@ -4691,7 +4743,6 @@ static int tg3_load_firmware_cpu(struct tg3 *tp, u32 cpu_base, u32 cpu_scratch_b | |||
4691 | err = 0; | 4743 | err = 0; |
4692 | 4744 | ||
4693 | out: | 4745 | out: |
4694 | tp->tg3_flags = orig_tg3_flags; | ||
4695 | return err; | 4746 | return err; |
4696 | } | 4747 | } |
4697 | 4748 | ||
@@ -5808,8 +5859,7 @@ static int tg3_reset_hw(struct tg3 *tp) | |||
5808 | tw32_f(GRC_LOCAL_CTRL, tp->grc_local_ctrl); | 5859 | tw32_f(GRC_LOCAL_CTRL, tp->grc_local_ctrl); |
5809 | udelay(100); | 5860 | udelay(100); |
5810 | 5861 | ||
5811 | tw32_mailbox(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW, 0); | 5862 | tw32_mailbox_f(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW, 0); |
5812 | tr32(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW); | ||
5813 | tp->last_tag = 0; | 5863 | tp->last_tag = 0; |
5814 | 5864 | ||
5815 | if (!(tp->tg3_flags2 & TG3_FLG2_5705_PLUS)) { | 5865 | if (!(tp->tg3_flags2 & TG3_FLG2_5705_PLUS)) { |
@@ -6198,7 +6248,8 @@ static int tg3_test_interrupt(struct tg3 *tp) | |||
6198 | HOSTCC_MODE_NOW); | 6248 | HOSTCC_MODE_NOW); |
6199 | 6249 | ||
6200 | for (i = 0; i < 5; i++) { | 6250 | for (i = 0; i < 5; i++) { |
6201 | int_mbox = tr32(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW); | 6251 | int_mbox = tr32_mailbox(MAILBOX_INTERRUPT_0 + |
6252 | TG3_64BIT_REG_LOW); | ||
6202 | if (int_mbox != 0) | 6253 | if (int_mbox != 0) |
6203 | break; | 6254 | break; |
6204 | msleep(10); | 6255 | msleep(10); |
@@ -6598,10 +6649,10 @@ static int tg3_open(struct net_device *dev) | |||
6598 | 6649 | ||
6599 | /* Mailboxes */ | 6650 | /* Mailboxes */ |
6600 | printk("DEBUG: SNDHOST_PROD[%08x%08x] SNDNIC_PROD[%08x%08x]\n", | 6651 | printk("DEBUG: SNDHOST_PROD[%08x%08x] SNDNIC_PROD[%08x%08x]\n", |
6601 | tr32(MAILBOX_SNDHOST_PROD_IDX_0 + 0x0), | 6652 | tr32_mailbox(MAILBOX_SNDHOST_PROD_IDX_0 + 0x0), |
6602 | tr32(MAILBOX_SNDHOST_PROD_IDX_0 + 0x4), | 6653 | tr32_mailbox(MAILBOX_SNDHOST_PROD_IDX_0 + 0x4), |
6603 | tr32(MAILBOX_SNDNIC_PROD_IDX_0 + 0x0), | 6654 | tr32_mailbox(MAILBOX_SNDNIC_PROD_IDX_0 + 0x0), |
6604 | tr32(MAILBOX_SNDNIC_PROD_IDX_0 + 0x4)); | 6655 | tr32_mailbox(MAILBOX_SNDNIC_PROD_IDX_0 + 0x4)); |
6605 | 6656 | ||
6606 | /* NIC side send descriptors. */ | 6657 | /* NIC side send descriptors. */ |
6607 | for (i = 0; i < 6; i++) { | 6658 | for (i = 0; i < 6; i++) { |
@@ -7901,7 +7952,7 @@ static int tg3_test_loopback(struct tg3 *tp) | |||
7901 | num_pkts++; | 7952 | num_pkts++; |
7902 | 7953 | ||
7903 | tw32_tx_mbox(MAILBOX_SNDHOST_PROD_IDX_0 + TG3_64BIT_REG_LOW, send_idx); | 7954 | tw32_tx_mbox(MAILBOX_SNDHOST_PROD_IDX_0 + TG3_64BIT_REG_LOW, send_idx); |
7904 | tr32(MAILBOX_SNDHOST_PROD_IDX_0 + TG3_64BIT_REG_LOW); | 7955 | tr32_mailbox(MAILBOX_SNDHOST_PROD_IDX_0 + TG3_64BIT_REG_LOW); |
7905 | 7956 | ||
7906 | udelay(10); | 7957 | udelay(10); |
7907 | 7958 | ||
@@ -9153,14 +9204,6 @@ static int __devinit tg3_is_sun_570X(struct tg3 *tp) | |||
9153 | static int __devinit tg3_get_invariants(struct tg3 *tp) | 9204 | static int __devinit tg3_get_invariants(struct tg3 *tp) |
9154 | { | 9205 | { |
9155 | static struct pci_device_id write_reorder_chipsets[] = { | 9206 | static struct pci_device_id write_reorder_chipsets[] = { |
9156 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, | ||
9157 | PCI_DEVICE_ID_INTEL_82801AA_8) }, | ||
9158 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, | ||
9159 | PCI_DEVICE_ID_INTEL_82801AB_8) }, | ||
9160 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, | ||
9161 | PCI_DEVICE_ID_INTEL_82801BA_11) }, | ||
9162 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, | ||
9163 | PCI_DEVICE_ID_INTEL_82801BA_6) }, | ||
9164 | { PCI_DEVICE(PCI_VENDOR_ID_AMD, | 9207 | { PCI_DEVICE(PCI_VENDOR_ID_AMD, |
9165 | PCI_DEVICE_ID_AMD_FE_GATE_700C) }, | 9208 | PCI_DEVICE_ID_AMD_FE_GATE_700C) }, |
9166 | { }, | 9209 | { }, |
@@ -9177,7 +9220,7 @@ static int __devinit tg3_get_invariants(struct tg3 *tp) | |||
9177 | tp->tg3_flags2 |= TG3_FLG2_SUN_570X; | 9220 | tp->tg3_flags2 |= TG3_FLG2_SUN_570X; |
9178 | #endif | 9221 | #endif |
9179 | 9222 | ||
9180 | /* If we have an AMD 762 or Intel ICH/ICH0/ICH2 chipset, write | 9223 | /* If we have an AMD 762 chipset, write |
9181 | * reordering to the mailbox registers done by the host | 9224 | * reordering to the mailbox registers done by the host |
9182 | * controller can cause major troubles. We read back from | 9225 | * controller can cause major troubles. We read back from |
9183 | * every mailbox register write to force the writes to be | 9226 | * every mailbox register write to force the writes to be |
@@ -9215,6 +9258,69 @@ static int __devinit tg3_get_invariants(struct tg3 *tp) | |||
9215 | if (tp->pci_chip_rev_id == CHIPREV_ID_5752_A0_HW) | 9258 | if (tp->pci_chip_rev_id == CHIPREV_ID_5752_A0_HW) |
9216 | tp->pci_chip_rev_id = CHIPREV_ID_5752_A0; | 9259 | tp->pci_chip_rev_id = CHIPREV_ID_5752_A0; |
9217 | 9260 | ||
9261 | /* If we have 5702/03 A1 or A2 on certain ICH chipsets, | ||
9262 | * we need to disable memory and use config. cycles | ||
9263 | * only to access all registers. The 5702/03 chips | ||
9264 | * can mistakenly decode the special cycles from the | ||
9265 | * ICH chipsets as memory write cycles, causing corruption | ||
9266 | * of register and memory space. Only certain ICH bridges | ||
9267 | * will drive special cycles with non-zero data during the | ||
9268 | * address phase which can fall within the 5703's address | ||
9269 | * range. This is not an ICH bug as the PCI spec allows | ||
9270 | * non-zero address during special cycles. However, only | ||
9271 | * these ICH bridges are known to drive non-zero addresses | ||
9272 | * during special cycles. | ||
9273 | * | ||
9274 | * Since special cycles do not cross PCI bridges, we only | ||
9275 | * enable this workaround if the 5703 is on the secondary | ||
9276 | * bus of these ICH bridges. | ||
9277 | */ | ||
9278 | if ((tp->pci_chip_rev_id == CHIPREV_ID_5703_A1) || | ||
9279 | (tp->pci_chip_rev_id == CHIPREV_ID_5703_A2)) { | ||
9280 | static struct tg3_dev_id { | ||
9281 | u32 vendor; | ||
9282 | u32 device; | ||
9283 | u32 rev; | ||
9284 | } ich_chipsets[] = { | ||
9285 | { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801AA_8, | ||
9286 | PCI_ANY_ID }, | ||
9287 | { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801AB_8, | ||
9288 | PCI_ANY_ID }, | ||
9289 | { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801BA_11, | ||
9290 | 0xa }, | ||
9291 | { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801BA_6, | ||
9292 | PCI_ANY_ID }, | ||
9293 | { }, | ||
9294 | }; | ||
9295 | struct tg3_dev_id *pci_id = &ich_chipsets[0]; | ||
9296 | struct pci_dev *bridge = NULL; | ||
9297 | |||
9298 | while (pci_id->vendor != 0) { | ||
9299 | bridge = pci_get_device(pci_id->vendor, pci_id->device, | ||
9300 | bridge); | ||
9301 | if (!bridge) { | ||
9302 | pci_id++; | ||
9303 | continue; | ||
9304 | } | ||
9305 | if (pci_id->rev != PCI_ANY_ID) { | ||
9306 | u8 rev; | ||
9307 | |||
9308 | pci_read_config_byte(bridge, PCI_REVISION_ID, | ||
9309 | &rev); | ||
9310 | if (rev > pci_id->rev) | ||
9311 | continue; | ||
9312 | } | ||
9313 | if (bridge->subordinate && | ||
9314 | (bridge->subordinate->number == | ||
9315 | tp->pdev->bus->number)) { | ||
9316 | |||
9317 | tp->tg3_flags2 |= TG3_FLG2_ICH_WORKAROUND; | ||
9318 | pci_dev_put(bridge); | ||
9319 | break; | ||
9320 | } | ||
9321 | } | ||
9322 | } | ||
9323 | |||
9218 | /* Find msi capability. */ | 9324 | /* Find msi capability. */ |
9219 | if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5780) | 9325 | if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5780) |
9220 | tp->msi_cap = pci_find_capability(tp->pdev, PCI_CAP_ID_MSI); | 9326 | tp->msi_cap = pci_find_capability(tp->pdev, PCI_CAP_ID_MSI); |
@@ -9302,6 +9408,12 @@ static int __devinit tg3_get_invariants(struct tg3 *tp) | |||
9302 | } | 9408 | } |
9303 | } | 9409 | } |
9304 | 9410 | ||
9411 | /* 5700 BX chips need to have their TX producer index mailboxes | ||
9412 | * written twice to workaround a bug. | ||
9413 | */ | ||
9414 | if (GET_CHIP_REV(tp->pci_chip_rev_id) == CHIPREV_5700_BX) | ||
9415 | tp->tg3_flags |= TG3_FLAG_TXD_MBOX_HWBUG; | ||
9416 | |||
9305 | /* Back to back register writes can cause problems on this chip, | 9417 | /* Back to back register writes can cause problems on this chip, |
9306 | * the workaround is to read back all reg writes except those to | 9418 | * the workaround is to read back all reg writes except those to |
9307 | * mailbox regs. See tg3_write_indirect_reg32(). | 9419 | * mailbox regs. See tg3_write_indirect_reg32(). |
@@ -9325,6 +9437,43 @@ static int __devinit tg3_get_invariants(struct tg3 *tp) | |||
9325 | pci_write_config_dword(tp->pdev, TG3PCI_PCISTATE, pci_state_reg); | 9437 | pci_write_config_dword(tp->pdev, TG3PCI_PCISTATE, pci_state_reg); |
9326 | } | 9438 | } |
9327 | 9439 | ||
9440 | /* Default fast path register access methods */ | ||
9441 | tp->read32 = tg3_read32; | ||
9442 | tp->write32 = tg3_write32; | ||
9443 | tp->read32_mbox = tg3_read32; | ||
9444 | tp->write32_mbox = tg3_write32; | ||
9445 | tp->write32_tx_mbox = tg3_write32; | ||
9446 | tp->write32_rx_mbox = tg3_write32; | ||
9447 | |||
9448 | /* Various workaround register access methods */ | ||
9449 | if (tp->tg3_flags & TG3_FLAG_PCIX_TARGET_HWBUG) | ||
9450 | tp->write32 = tg3_write_indirect_reg32; | ||
9451 | else if (tp->tg3_flags & TG3_FLAG_5701_REG_WRITE_BUG) | ||
9452 | tp->write32 = tg3_write_flush_reg32; | ||
9453 | |||
9454 | if ((tp->tg3_flags & TG3_FLAG_TXD_MBOX_HWBUG) || | ||
9455 | (tp->tg3_flags & TG3_FLAG_MBOX_WRITE_REORDER)) { | ||
9456 | tp->write32_tx_mbox = tg3_write32_tx_mbox; | ||
9457 | if (tp->tg3_flags & TG3_FLAG_MBOX_WRITE_REORDER) | ||
9458 | tp->write32_rx_mbox = tg3_write_flush_reg32; | ||
9459 | } | ||
9460 | |||
9461 | if (tp->tg3_flags2 & TG3_FLG2_ICH_WORKAROUND) { | ||
9462 | tp->read32 = tg3_read_indirect_reg32; | ||
9463 | tp->write32 = tg3_write_indirect_reg32; | ||
9464 | tp->read32_mbox = tg3_read_indirect_mbox; | ||
9465 | tp->write32_mbox = tg3_write_indirect_mbox; | ||
9466 | tp->write32_tx_mbox = tg3_write_indirect_mbox; | ||
9467 | tp->write32_rx_mbox = tg3_write_indirect_mbox; | ||
9468 | |||
9469 | iounmap(tp->regs); | ||
9470 | tp->regs = 0; | ||
9471 | |||
9472 | pci_read_config_word(tp->pdev, PCI_COMMAND, &pci_cmd); | ||
9473 | pci_cmd &= ~PCI_COMMAND_MEMORY; | ||
9474 | pci_write_config_word(tp->pdev, PCI_COMMAND, pci_cmd); | ||
9475 | } | ||
9476 | |||
9328 | /* Get eeprom hw config before calling tg3_set_power_state(). | 9477 | /* Get eeprom hw config before calling tg3_set_power_state(). |
9329 | * In particular, the TG3_FLAG_EEPROM_WRITE_PROT flag must be | 9478 | * In particular, the TG3_FLAG_EEPROM_WRITE_PROT flag must be |
9330 | * determined before calling tg3_set_power_state() so that | 9479 | * determined before calling tg3_set_power_state() so that |
@@ -9539,14 +9688,6 @@ static int __devinit tg3_get_invariants(struct tg3 *tp) | |||
9539 | else | 9688 | else |
9540 | tp->tg3_flags &= ~TG3_FLAG_POLL_SERDES; | 9689 | tp->tg3_flags &= ~TG3_FLAG_POLL_SERDES; |
9541 | 9690 | ||
9542 | /* 5700 BX chips need to have their TX producer index mailboxes | ||
9543 | * written twice to workaround a bug. | ||
9544 | */ | ||
9545 | if (GET_CHIP_REV(tp->pci_chip_rev_id) == CHIPREV_5700_BX) | ||
9546 | tp->tg3_flags |= TG3_FLAG_TXD_MBOX_HWBUG; | ||
9547 | else | ||
9548 | tp->tg3_flags &= ~TG3_FLAG_TXD_MBOX_HWBUG; | ||
9549 | |||
9550 | /* It seems all chips can get confused if TX buffers | 9691 | /* It seems all chips can get confused if TX buffers |
9551 | * straddle the 4GB address boundary in some cases. | 9692 | * straddle the 4GB address boundary in some cases. |
9552 | */ | 9693 | */ |
@@ -10469,7 +10610,10 @@ static int __devinit tg3_init_one(struct pci_dev *pdev, | |||
10469 | return 0; | 10610 | return 0; |
10470 | 10611 | ||
10471 | err_out_iounmap: | 10612 | err_out_iounmap: |
10472 | iounmap(tp->regs); | 10613 | if (tp->regs) { |
10614 | iounmap(tp->regs); | ||
10615 | tp->regs = 0; | ||
10616 | } | ||
10473 | 10617 | ||
10474 | err_out_free_dev: | 10618 | err_out_free_dev: |
10475 | free_netdev(dev); | 10619 | free_netdev(dev); |
@@ -10491,7 +10635,10 @@ static void __devexit tg3_remove_one(struct pci_dev *pdev) | |||
10491 | struct tg3 *tp = netdev_priv(dev); | 10635 | struct tg3 *tp = netdev_priv(dev); |
10492 | 10636 | ||
10493 | unregister_netdev(dev); | 10637 | unregister_netdev(dev); |
10494 | iounmap(tp->regs); | 10638 | if (tp->regs) { |
10639 | iounmap(tp->regs); | ||
10640 | tp->regs = 0; | ||
10641 | } | ||
10495 | free_netdev(dev); | 10642 | free_netdev(dev); |
10496 | pci_release_regions(pdev); | 10643 | pci_release_regions(pdev); |
10497 | pci_disable_device(pdev); | 10644 | pci_disable_device(pdev); |
diff --git a/drivers/net/tg3.h b/drivers/net/tg3.h index 5c4433c147fa..c184b773e585 100644 --- a/drivers/net/tg3.h +++ b/drivers/net/tg3.h | |||
@@ -2049,6 +2049,11 @@ struct tg3 { | |||
2049 | spinlock_t lock; | 2049 | spinlock_t lock; |
2050 | spinlock_t indirect_lock; | 2050 | spinlock_t indirect_lock; |
2051 | 2051 | ||
2052 | u32 (*read32) (struct tg3 *, u32); | ||
2053 | void (*write32) (struct tg3 *, u32, u32); | ||
2054 | u32 (*read32_mbox) (struct tg3 *, u32); | ||
2055 | void (*write32_mbox) (struct tg3 *, u32, | ||
2056 | u32); | ||
2052 | void __iomem *regs; | 2057 | void __iomem *regs; |
2053 | struct net_device *dev; | 2058 | struct net_device *dev; |
2054 | struct pci_dev *pdev; | 2059 | struct pci_dev *pdev; |
@@ -2060,6 +2065,8 @@ struct tg3 { | |||
2060 | u32 msg_enable; | 2065 | u32 msg_enable; |
2061 | 2066 | ||
2062 | /* begin "tx thread" cacheline section */ | 2067 | /* begin "tx thread" cacheline section */ |
2068 | void (*write32_tx_mbox) (struct tg3 *, u32, | ||
2069 | u32); | ||
2063 | u32 tx_prod; | 2070 | u32 tx_prod; |
2064 | u32 tx_cons; | 2071 | u32 tx_cons; |
2065 | u32 tx_pending; | 2072 | u32 tx_pending; |
@@ -2071,6 +2078,8 @@ struct tg3 { | |||
2071 | dma_addr_t tx_desc_mapping; | 2078 | dma_addr_t tx_desc_mapping; |
2072 | 2079 | ||
2073 | /* begin "rx thread" cacheline section */ | 2080 | /* begin "rx thread" cacheline section */ |
2081 | void (*write32_rx_mbox) (struct tg3 *, u32, | ||
2082 | u32); | ||
2074 | u32 rx_rcb_ptr; | 2083 | u32 rx_rcb_ptr; |
2075 | u32 rx_std_ptr; | 2084 | u32 rx_std_ptr; |
2076 | u32 rx_jumbo_ptr; | 2085 | u32 rx_jumbo_ptr; |
@@ -2165,6 +2174,7 @@ struct tg3 { | |||
2165 | #define TG3_FLG2_ANY_SERDES (TG3_FLG2_PHY_SERDES | \ | 2174 | #define TG3_FLG2_ANY_SERDES (TG3_FLG2_PHY_SERDES | \ |
2166 | TG3_FLG2_MII_SERDES) | 2175 | TG3_FLG2_MII_SERDES) |
2167 | #define TG3_FLG2_PARALLEL_DETECT 0x01000000 | 2176 | #define TG3_FLG2_PARALLEL_DETECT 0x01000000 |
2177 | #define TG3_FLG2_ICH_WORKAROUND 0x02000000 | ||
2168 | 2178 | ||
2169 | u32 split_mode_max_reqs; | 2179 | u32 split_mode_max_reqs; |
2170 | #define SPLIT_MODE_5704_MAX_REQ 3 | 2180 | #define SPLIT_MODE_5704_MAX_REQ 3 |
diff --git a/drivers/net/wan/hdlc_generic.c b/drivers/net/wan/hdlc_generic.c index a63f6a2cc4f7..cdd4c09c2d90 100644 --- a/drivers/net/wan/hdlc_generic.c +++ b/drivers/net/wan/hdlc_generic.c | |||
@@ -61,7 +61,7 @@ static struct net_device_stats *hdlc_get_stats(struct net_device *dev) | |||
61 | 61 | ||
62 | 62 | ||
63 | static int hdlc_rcv(struct sk_buff *skb, struct net_device *dev, | 63 | static int hdlc_rcv(struct sk_buff *skb, struct net_device *dev, |
64 | struct packet_type *p) | 64 | struct packet_type *p, struct net_device *orig_dev) |
65 | { | 65 | { |
66 | hdlc_device *hdlc = dev_to_hdlc(dev); | 66 | hdlc_device *hdlc = dev_to_hdlc(dev); |
67 | if (hdlc->proto.netif_rx) | 67 | if (hdlc->proto.netif_rx) |
diff --git a/drivers/net/wan/lapbether.c b/drivers/net/wan/lapbether.c index 7f2e3653c5e5..6c302e9dbca2 100644 --- a/drivers/net/wan/lapbether.c +++ b/drivers/net/wan/lapbether.c | |||
@@ -86,7 +86,7 @@ static __inline__ int dev_is_ethdev(struct net_device *dev) | |||
86 | /* | 86 | /* |
87 | * Receive a LAPB frame via an ethernet interface. | 87 | * Receive a LAPB frame via an ethernet interface. |
88 | */ | 88 | */ |
89 | static int lapbeth_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *ptype) | 89 | static int lapbeth_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *ptype, struct net_device *orig_dev) |
90 | { | 90 | { |
91 | int len, err; | 91 | int len, err; |
92 | struct lapbethdev *lapbeth; | 92 | struct lapbethdev *lapbeth; |
diff --git a/drivers/net/wan/sdla_fr.c b/drivers/net/wan/sdla_fr.c index c5f5e62aab8b..0497dbdb8631 100644 --- a/drivers/net/wan/sdla_fr.c +++ b/drivers/net/wan/sdla_fr.c | |||
@@ -445,7 +445,7 @@ void s508_s514_unlock(sdla_t *card, unsigned long *smp_flags); | |||
445 | void s508_s514_lock(sdla_t *card, unsigned long *smp_flags); | 445 | void s508_s514_lock(sdla_t *card, unsigned long *smp_flags); |
446 | 446 | ||
447 | unsigned short calc_checksum (char *, int); | 447 | unsigned short calc_checksum (char *, int); |
448 | static int setup_fr_header(struct sk_buff** skb, | 448 | static int setup_fr_header(struct sk_buff *skb, |
449 | struct net_device* dev, char op_mode); | 449 | struct net_device* dev, char op_mode); |
450 | 450 | ||
451 | 451 | ||
@@ -1372,7 +1372,7 @@ static int if_send(struct sk_buff* skb, struct net_device* dev) | |||
1372 | /* Move the if_header() code to here. By inserting frame | 1372 | /* Move the if_header() code to here. By inserting frame |
1373 | * relay header in if_header() we would break the | 1373 | * relay header in if_header() we would break the |
1374 | * tcpdump and other packet sniffers */ | 1374 | * tcpdump and other packet sniffers */ |
1375 | chan->fr_header_len = setup_fr_header(&skb,dev,chan->common.usedby); | 1375 | chan->fr_header_len = setup_fr_header(skb,dev,chan->common.usedby); |
1376 | if (chan->fr_header_len < 0 ){ | 1376 | if (chan->fr_header_len < 0 ){ |
1377 | ++chan->ifstats.tx_dropped; | 1377 | ++chan->ifstats.tx_dropped; |
1378 | ++card->wandev.stats.tx_dropped; | 1378 | ++card->wandev.stats.tx_dropped; |
@@ -1597,8 +1597,6 @@ static int setup_for_delayed_transmit(struct net_device* dev, | |||
1597 | return 1; | 1597 | return 1; |
1598 | } | 1598 | } |
1599 | 1599 | ||
1600 | skb_unlink(skb); | ||
1601 | |||
1602 | chan->transmit_length = len; | 1600 | chan->transmit_length = len; |
1603 | chan->delay_skb = skb; | 1601 | chan->delay_skb = skb; |
1604 | 1602 | ||
@@ -4871,18 +4869,15 @@ static void unconfig_fr (sdla_t *card) | |||
4871 | } | 4869 | } |
4872 | } | 4870 | } |
4873 | 4871 | ||
4874 | static int setup_fr_header(struct sk_buff **skb_orig, struct net_device* dev, | 4872 | static int setup_fr_header(struct sk_buff *skb, struct net_device* dev, |
4875 | char op_mode) | 4873 | char op_mode) |
4876 | { | 4874 | { |
4877 | struct sk_buff *skb = *skb_orig; | ||
4878 | fr_channel_t *chan=dev->priv; | 4875 | fr_channel_t *chan=dev->priv; |
4879 | 4876 | ||
4880 | if (op_mode == WANPIPE){ | 4877 | if (op_mode == WANPIPE) { |
4881 | |||
4882 | chan->fr_header[0]=Q922_UI; | 4878 | chan->fr_header[0]=Q922_UI; |
4883 | 4879 | ||
4884 | switch (htons(skb->protocol)){ | 4880 | switch (htons(skb->protocol)){ |
4885 | |||
4886 | case ETH_P_IP: | 4881 | case ETH_P_IP: |
4887 | chan->fr_header[1]=NLPID_IP; | 4882 | chan->fr_header[1]=NLPID_IP; |
4888 | break; | 4883 | break; |
@@ -4894,16 +4889,14 @@ static int setup_fr_header(struct sk_buff **skb_orig, struct net_device* dev, | |||
4894 | } | 4889 | } |
4895 | 4890 | ||
4896 | /* If we are in bridging mode, we must apply | 4891 | /* If we are in bridging mode, we must apply |
4897 | * an Ethernet header */ | 4892 | * an Ethernet header |
4898 | if (op_mode == BRIDGE || op_mode == BRIDGE_NODE){ | 4893 | */ |
4899 | 4894 | if (op_mode == BRIDGE || op_mode == BRIDGE_NODE) { | |
4900 | |||
4901 | /* Encapsulate the packet as a bridged Ethernet frame. */ | 4895 | /* Encapsulate the packet as a bridged Ethernet frame. */ |
4902 | #ifdef DEBUG | 4896 | #ifdef DEBUG |
4903 | printk(KERN_INFO "%s: encapsulating skb for frame relay\n", | 4897 | printk(KERN_INFO "%s: encapsulating skb for frame relay\n", |
4904 | dev->name); | 4898 | dev->name); |
4905 | #endif | 4899 | #endif |
4906 | |||
4907 | chan->fr_header[0] = 0x03; | 4900 | chan->fr_header[0] = 0x03; |
4908 | chan->fr_header[1] = 0x00; | 4901 | chan->fr_header[1] = 0x00; |
4909 | chan->fr_header[2] = 0x80; | 4902 | chan->fr_header[2] = 0x80; |
@@ -4916,7 +4909,6 @@ static int setup_fr_header(struct sk_buff **skb_orig, struct net_device* dev, | |||
4916 | /* Yuck. */ | 4909 | /* Yuck. */ |
4917 | skb->protocol = ETH_P_802_3; | 4910 | skb->protocol = ETH_P_802_3; |
4918 | return 8; | 4911 | return 8; |
4919 | |||
4920 | } | 4912 | } |
4921 | 4913 | ||
4922 | return 0; | 4914 | return 0; |
diff --git a/drivers/net/wan/syncppp.c b/drivers/net/wan/syncppp.c index 84b65c60c799..f58c794a963a 100644 --- a/drivers/net/wan/syncppp.c +++ b/drivers/net/wan/syncppp.c | |||
@@ -1447,7 +1447,7 @@ static void sppp_print_bytes (u_char *p, u16 len) | |||
1447 | * after interrupt servicing to process frames queued via netif_rx. | 1447 | * after interrupt servicing to process frames queued via netif_rx. |
1448 | */ | 1448 | */ |
1449 | 1449 | ||
1450 | static int sppp_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *p) | 1450 | static int sppp_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *p, struct net_device *orig_dev) |
1451 | { | 1451 | { |
1452 | if ((skb = skb_share_check(skb, GFP_ATOMIC)) == NULL) | 1452 | if ((skb = skb_share_check(skb, GFP_ATOMIC)) == NULL) |
1453 | return NET_RX_DROP; | 1453 | return NET_RX_DROP; |