diff options
author | Linus Torvalds <torvalds@g5.osdl.org> | 2006-06-19 21:55:56 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-06-19 21:55:56 -0400 |
commit | d0b952a9837f81cd89e756b1b34293fa6e1cb59d (patch) | |
tree | fbe488bc5f407afa0e91cefb262d9e9ee69062ac /drivers/net/tg3.c | |
parent | d90125bfe958ed0451c6b98f831c86aba08b43d5 (diff) | |
parent | 47552c4e555eefe381f3d45140b59a2ea4b16486 (diff) |
Merge master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
* master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6: (109 commits)
[ETHTOOL]: Fix UFO typo
[SCTP]: Fix persistent slowdown in sctp when a gap ack consumes rx buffer.
[SCTP]: Send only 1 window update SACK per message.
[SCTP]: Don't do CRC32C checksum over loopback.
[SCTP] Reset rtt_in_progress for the chunk when processing its sack.
[SCTP]: Reject sctp packets with broadcast addresses.
[SCTP]: Limit association max_retrans setting in setsockopt.
[PFKEYV2]: Fix inconsistent typing in struct sadb_x_kmprivate.
[IPV6]: Sum real space for RTAs.
[IRDA]: Use put_unaligned() in irlmp_do_discovery().
[BRIDGE]: Add support for NETIF_F_HW_CSUM devices
[NET]: Add NETIF_F_GEN_CSUM and NETIF_F_ALL_CSUM
[TG3]: Convert to non-LLTX
[TG3]: Remove unnecessary tx_lock
[TCP]: Add tcp_slow_start_after_idle sysctl.
[BNX2]: Update version and reldate
[BNX2]: Use CPU native page size
[BNX2]: Use compressed firmware
[BNX2]: Add firmware decompression
[BNX2]: Allow WoL settings on new 5708 chips
...
Manual fixup for conflict in drivers/net/tulip/winbond-840.c
Diffstat (limited to 'drivers/net/tg3.c')
-rw-r--r-- | drivers/net/tg3.c | 86 |
1 files changed, 60 insertions, 26 deletions
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c index 862c226dbbe2..b2ddd4522a87 100644 --- a/drivers/net/tg3.c +++ b/drivers/net/tg3.c | |||
@@ -69,8 +69,8 @@ | |||
69 | 69 | ||
70 | #define DRV_MODULE_NAME "tg3" | 70 | #define DRV_MODULE_NAME "tg3" |
71 | #define PFX DRV_MODULE_NAME ": " | 71 | #define PFX DRV_MODULE_NAME ": " |
72 | #define DRV_MODULE_VERSION "3.59" | 72 | #define DRV_MODULE_VERSION "3.60" |
73 | #define DRV_MODULE_RELDATE "June 8, 2006" | 73 | #define DRV_MODULE_RELDATE "June 17, 2006" |
74 | 74 | ||
75 | #define TG3_DEF_MAC_MODE 0 | 75 | #define TG3_DEF_MAC_MODE 0 |
76 | #define TG3_DEF_RX_MODE 0 | 76 | #define TG3_DEF_RX_MODE 0 |
@@ -229,6 +229,8 @@ static struct pci_device_id tg3_pci_tbl[] = { | |||
229 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL }, | 229 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL }, |
230 | { PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5755M, | 230 | { PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5755M, |
231 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL }, | 231 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL }, |
232 | { PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5786, | ||
233 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL }, | ||
232 | { PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5787, | 234 | { PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5787, |
233 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL }, | 235 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL }, |
234 | { PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5787M, | 236 | { PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5787M, |
@@ -2965,6 +2967,27 @@ static int tg3_setup_phy(struct tg3 *tp, int force_reset) | |||
2965 | return err; | 2967 | return err; |
2966 | } | 2968 | } |
2967 | 2969 | ||
2970 | /* This is called whenever we suspect that the system chipset is re- | ||
2971 | * ordering the sequence of MMIO to the tx send mailbox. The symptom | ||
2972 | * is bogus tx completions. We try to recover by setting the | ||
2973 | * TG3_FLAG_MBOX_WRITE_REORDER flag and resetting the chip later | ||
2974 | * in the workqueue. | ||
2975 | */ | ||
2976 | static void tg3_tx_recover(struct tg3 *tp) | ||
2977 | { | ||
2978 | BUG_ON((tp->tg3_flags & TG3_FLAG_MBOX_WRITE_REORDER) || | ||
2979 | tp->write32_tx_mbox == tg3_write_indirect_mbox); | ||
2980 | |||
2981 | printk(KERN_WARNING PFX "%s: The system may be re-ordering memory-" | ||
2982 | "mapped I/O cycles to the network device, attempting to " | ||
2983 | "recover. Please report the problem to the driver maintainer " | ||
2984 | "and include system chipset information.\n", tp->dev->name); | ||
2985 | |||
2986 | spin_lock(&tp->lock); | ||
2987 | tp->tg3_flags |= TG3_FLAG_TX_RECOVERY_PENDING; | ||
2988 | spin_unlock(&tp->lock); | ||
2989 | } | ||
2990 | |||
2968 | /* Tigon3 never reports partial packet sends. So we do not | 2991 | /* Tigon3 never reports partial packet sends. So we do not |
2969 | * need special logic to handle SKBs that have not had all | 2992 | * need special logic to handle SKBs that have not had all |
2970 | * of their frags sent yet, like SunGEM does. | 2993 | * of their frags sent yet, like SunGEM does. |
@@ -2977,9 +3000,13 @@ static void tg3_tx(struct tg3 *tp) | |||
2977 | while (sw_idx != hw_idx) { | 3000 | while (sw_idx != hw_idx) { |
2978 | struct tx_ring_info *ri = &tp->tx_buffers[sw_idx]; | 3001 | struct tx_ring_info *ri = &tp->tx_buffers[sw_idx]; |
2979 | struct sk_buff *skb = ri->skb; | 3002 | struct sk_buff *skb = ri->skb; |
2980 | int i; | 3003 | int i, tx_bug = 0; |
3004 | |||
3005 | if (unlikely(skb == NULL)) { | ||
3006 | tg3_tx_recover(tp); | ||
3007 | return; | ||
3008 | } | ||
2981 | 3009 | ||
2982 | BUG_ON(skb == NULL); | ||
2983 | pci_unmap_single(tp->pdev, | 3010 | pci_unmap_single(tp->pdev, |
2984 | pci_unmap_addr(ri, mapping), | 3011 | pci_unmap_addr(ri, mapping), |
2985 | skb_headlen(skb), | 3012 | skb_headlen(skb), |
@@ -2990,10 +3017,9 @@ static void tg3_tx(struct tg3 *tp) | |||
2990 | sw_idx = NEXT_TX(sw_idx); | 3017 | sw_idx = NEXT_TX(sw_idx); |
2991 | 3018 | ||
2992 | for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) { | 3019 | for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) { |
2993 | BUG_ON(sw_idx == hw_idx); | ||
2994 | |||
2995 | ri = &tp->tx_buffers[sw_idx]; | 3020 | ri = &tp->tx_buffers[sw_idx]; |
2996 | BUG_ON(ri->skb != NULL); | 3021 | if (unlikely(ri->skb != NULL || sw_idx == hw_idx)) |
3022 | tx_bug = 1; | ||
2997 | 3023 | ||
2998 | pci_unmap_page(tp->pdev, | 3024 | pci_unmap_page(tp->pdev, |
2999 | pci_unmap_addr(ri, mapping), | 3025 | pci_unmap_addr(ri, mapping), |
@@ -3004,6 +3030,11 @@ static void tg3_tx(struct tg3 *tp) | |||
3004 | } | 3030 | } |
3005 | 3031 | ||
3006 | dev_kfree_skb(skb); | 3032 | dev_kfree_skb(skb); |
3033 | |||
3034 | if (unlikely(tx_bug)) { | ||
3035 | tg3_tx_recover(tp); | ||
3036 | return; | ||
3037 | } | ||
3007 | } | 3038 | } |
3008 | 3039 | ||
3009 | tp->tx_cons = sw_idx; | 3040 | tp->tx_cons = sw_idx; |
@@ -3331,6 +3362,11 @@ static int tg3_poll(struct net_device *netdev, int *budget) | |||
3331 | /* run TX completion thread */ | 3362 | /* run TX completion thread */ |
3332 | if (sblk->idx[0].tx_consumer != tp->tx_cons) { | 3363 | if (sblk->idx[0].tx_consumer != tp->tx_cons) { |
3333 | tg3_tx(tp); | 3364 | tg3_tx(tp); |
3365 | if (unlikely(tp->tg3_flags & TG3_FLAG_TX_RECOVERY_PENDING)) { | ||
3366 | netif_rx_complete(netdev); | ||
3367 | schedule_work(&tp->reset_task); | ||
3368 | return 0; | ||
3369 | } | ||
3334 | } | 3370 | } |
3335 | 3371 | ||
3336 | /* run RX thread, within the bounds set by NAPI. | 3372 | /* run RX thread, within the bounds set by NAPI. |
@@ -3391,12 +3427,10 @@ static inline void tg3_full_lock(struct tg3 *tp, int irq_sync) | |||
3391 | if (irq_sync) | 3427 | if (irq_sync) |
3392 | tg3_irq_quiesce(tp); | 3428 | tg3_irq_quiesce(tp); |
3393 | spin_lock_bh(&tp->lock); | 3429 | spin_lock_bh(&tp->lock); |
3394 | spin_lock(&tp->tx_lock); | ||
3395 | } | 3430 | } |
3396 | 3431 | ||
3397 | static inline void tg3_full_unlock(struct tg3 *tp) | 3432 | static inline void tg3_full_unlock(struct tg3 *tp) |
3398 | { | 3433 | { |
3399 | spin_unlock(&tp->tx_lock); | ||
3400 | spin_unlock_bh(&tp->lock); | 3434 | spin_unlock_bh(&tp->lock); |
3401 | } | 3435 | } |
3402 | 3436 | ||
@@ -3579,6 +3613,13 @@ static void tg3_reset_task(void *_data) | |||
3579 | restart_timer = tp->tg3_flags2 & TG3_FLG2_RESTART_TIMER; | 3613 | restart_timer = tp->tg3_flags2 & TG3_FLG2_RESTART_TIMER; |
3580 | tp->tg3_flags2 &= ~TG3_FLG2_RESTART_TIMER; | 3614 | tp->tg3_flags2 &= ~TG3_FLG2_RESTART_TIMER; |
3581 | 3615 | ||
3616 | if (tp->tg3_flags & TG3_FLAG_TX_RECOVERY_PENDING) { | ||
3617 | tp->write32_tx_mbox = tg3_write32_tx_mbox; | ||
3618 | tp->write32_rx_mbox = tg3_write_flush_reg32; | ||
3619 | tp->tg3_flags |= TG3_FLAG_MBOX_WRITE_REORDER; | ||
3620 | tp->tg3_flags &= ~TG3_FLAG_TX_RECOVERY_PENDING; | ||
3621 | } | ||
3622 | |||
3582 | tg3_halt(tp, RESET_KIND_SHUTDOWN, 0); | 3623 | tg3_halt(tp, RESET_KIND_SHUTDOWN, 0); |
3583 | tg3_init_hw(tp, 1); | 3624 | tg3_init_hw(tp, 1); |
3584 | 3625 | ||
@@ -3718,14 +3759,11 @@ static int tg3_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
3718 | 3759 | ||
3719 | len = skb_headlen(skb); | 3760 | len = skb_headlen(skb); |
3720 | 3761 | ||
3721 | /* No BH disabling for tx_lock here. We are running in BH disabled | 3762 | /* We are running in BH disabled context with netif_tx_lock |
3722 | * context and TX reclaim runs via tp->poll inside of a software | 3763 | * and TX reclaim runs via tp->poll inside of a software |
3723 | * interrupt. Furthermore, IRQ processing runs lockless so we have | 3764 | * interrupt. Furthermore, IRQ processing runs lockless so we have |
3724 | * no IRQ context deadlocks to worry about either. Rejoice! | 3765 | * no IRQ context deadlocks to worry about either. Rejoice! |
3725 | */ | 3766 | */ |
3726 | if (!spin_trylock(&tp->tx_lock)) | ||
3727 | return NETDEV_TX_LOCKED; | ||
3728 | |||
3729 | if (unlikely(TX_BUFFS_AVAIL(tp) <= (skb_shinfo(skb)->nr_frags + 1))) { | 3767 | if (unlikely(TX_BUFFS_AVAIL(tp) <= (skb_shinfo(skb)->nr_frags + 1))) { |
3730 | if (!netif_queue_stopped(dev)) { | 3768 | if (!netif_queue_stopped(dev)) { |
3731 | netif_stop_queue(dev); | 3769 | netif_stop_queue(dev); |
@@ -3734,7 +3772,6 @@ static int tg3_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
3734 | printk(KERN_ERR PFX "%s: BUG! Tx Ring full when " | 3772 | printk(KERN_ERR PFX "%s: BUG! Tx Ring full when " |
3735 | "queue awake!\n", dev->name); | 3773 | "queue awake!\n", dev->name); |
3736 | } | 3774 | } |
3737 | spin_unlock(&tp->tx_lock); | ||
3738 | return NETDEV_TX_BUSY; | 3775 | return NETDEV_TX_BUSY; |
3739 | } | 3776 | } |
3740 | 3777 | ||
@@ -3817,15 +3854,16 @@ static int tg3_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
3817 | tw32_tx_mbox((MAILBOX_SNDHOST_PROD_IDX_0 + TG3_64BIT_REG_LOW), entry); | 3854 | tw32_tx_mbox((MAILBOX_SNDHOST_PROD_IDX_0 + TG3_64BIT_REG_LOW), entry); |
3818 | 3855 | ||
3819 | tp->tx_prod = entry; | 3856 | tp->tx_prod = entry; |
3820 | if (TX_BUFFS_AVAIL(tp) <= (MAX_SKB_FRAGS + 1)) { | 3857 | if (unlikely(TX_BUFFS_AVAIL(tp) <= (MAX_SKB_FRAGS + 1))) { |
3858 | spin_lock(&tp->tx_lock); | ||
3821 | netif_stop_queue(dev); | 3859 | netif_stop_queue(dev); |
3822 | if (TX_BUFFS_AVAIL(tp) > TG3_TX_WAKEUP_THRESH) | 3860 | if (TX_BUFFS_AVAIL(tp) > TG3_TX_WAKEUP_THRESH) |
3823 | netif_wake_queue(tp->dev); | 3861 | netif_wake_queue(tp->dev); |
3862 | spin_unlock(&tp->tx_lock); | ||
3824 | } | 3863 | } |
3825 | 3864 | ||
3826 | out_unlock: | 3865 | out_unlock: |
3827 | mmiowb(); | 3866 | mmiowb(); |
3828 | spin_unlock(&tp->tx_lock); | ||
3829 | 3867 | ||
3830 | dev->trans_start = jiffies; | 3868 | dev->trans_start = jiffies; |
3831 | 3869 | ||
@@ -3844,14 +3882,11 @@ static int tg3_start_xmit_dma_bug(struct sk_buff *skb, struct net_device *dev) | |||
3844 | 3882 | ||
3845 | len = skb_headlen(skb); | 3883 | len = skb_headlen(skb); |
3846 | 3884 | ||
3847 | /* No BH disabling for tx_lock here. We are running in BH disabled | 3885 | /* We are running in BH disabled context with netif_tx_lock |
3848 | * context and TX reclaim runs via tp->poll inside of a software | 3886 | * and TX reclaim runs via tp->poll inside of a software |
3849 | * interrupt. Furthermore, IRQ processing runs lockless so we have | 3887 | * interrupt. Furthermore, IRQ processing runs lockless so we have |
3850 | * no IRQ context deadlocks to worry about either. Rejoice! | 3888 | * no IRQ context deadlocks to worry about either. Rejoice! |
3851 | */ | 3889 | */ |
3852 | if (!spin_trylock(&tp->tx_lock)) | ||
3853 | return NETDEV_TX_LOCKED; | ||
3854 | |||
3855 | if (unlikely(TX_BUFFS_AVAIL(tp) <= (skb_shinfo(skb)->nr_frags + 1))) { | 3890 | if (unlikely(TX_BUFFS_AVAIL(tp) <= (skb_shinfo(skb)->nr_frags + 1))) { |
3856 | if (!netif_queue_stopped(dev)) { | 3891 | if (!netif_queue_stopped(dev)) { |
3857 | netif_stop_queue(dev); | 3892 | netif_stop_queue(dev); |
@@ -3860,7 +3895,6 @@ static int tg3_start_xmit_dma_bug(struct sk_buff *skb, struct net_device *dev) | |||
3860 | printk(KERN_ERR PFX "%s: BUG! Tx Ring full when " | 3895 | printk(KERN_ERR PFX "%s: BUG! Tx Ring full when " |
3861 | "queue awake!\n", dev->name); | 3896 | "queue awake!\n", dev->name); |
3862 | } | 3897 | } |
3863 | spin_unlock(&tp->tx_lock); | ||
3864 | return NETDEV_TX_BUSY; | 3898 | return NETDEV_TX_BUSY; |
3865 | } | 3899 | } |
3866 | 3900 | ||
@@ -3998,15 +4032,16 @@ static int tg3_start_xmit_dma_bug(struct sk_buff *skb, struct net_device *dev) | |||
3998 | tw32_tx_mbox((MAILBOX_SNDHOST_PROD_IDX_0 + TG3_64BIT_REG_LOW), entry); | 4032 | tw32_tx_mbox((MAILBOX_SNDHOST_PROD_IDX_0 + TG3_64BIT_REG_LOW), entry); |
3999 | 4033 | ||
4000 | tp->tx_prod = entry; | 4034 | tp->tx_prod = entry; |
4001 | if (TX_BUFFS_AVAIL(tp) <= (MAX_SKB_FRAGS + 1)) { | 4035 | if (unlikely(TX_BUFFS_AVAIL(tp) <= (MAX_SKB_FRAGS + 1))) { |
4036 | spin_lock(&tp->tx_lock); | ||
4002 | netif_stop_queue(dev); | 4037 | netif_stop_queue(dev); |
4003 | if (TX_BUFFS_AVAIL(tp) > TG3_TX_WAKEUP_THRESH) | 4038 | if (TX_BUFFS_AVAIL(tp) > TG3_TX_WAKEUP_THRESH) |
4004 | netif_wake_queue(tp->dev); | 4039 | netif_wake_queue(tp->dev); |
4040 | spin_unlock(&tp->tx_lock); | ||
4005 | } | 4041 | } |
4006 | 4042 | ||
4007 | out_unlock: | 4043 | out_unlock: |
4008 | mmiowb(); | 4044 | mmiowb(); |
4009 | spin_unlock(&tp->tx_lock); | ||
4010 | 4045 | ||
4011 | dev->trans_start = jiffies; | 4046 | dev->trans_start = jiffies; |
4012 | 4047 | ||
@@ -11243,7 +11278,6 @@ static int __devinit tg3_init_one(struct pci_dev *pdev, | |||
11243 | SET_MODULE_OWNER(dev); | 11278 | SET_MODULE_OWNER(dev); |
11244 | SET_NETDEV_DEV(dev, &pdev->dev); | 11279 | SET_NETDEV_DEV(dev, &pdev->dev); |
11245 | 11280 | ||
11246 | dev->features |= NETIF_F_LLTX; | ||
11247 | #if TG3_VLAN_TAG_USED | 11281 | #if TG3_VLAN_TAG_USED |
11248 | dev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX; | 11282 | dev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX; |
11249 | dev->vlan_rx_register = tg3_vlan_rx_register; | 11283 | dev->vlan_rx_register = tg3_vlan_rx_register; |