diff options
author | Anton Altaparmakov <aia21@cantab.net> | 2005-05-21 17:00:02 -0400 |
---|---|---|
committer | Anton Altaparmakov <aia21@cantab.net> | 2005-05-21 17:00:02 -0400 |
commit | 67394f8f069c2fdf90f3b6d851824c07815442af (patch) | |
tree | 0c33e62d34dbaecea434ae9ece3cc0c56db8b1f7 /drivers/net | |
parent | 450cbfbbbd88876e3ccec1d277f613221ca82bb7 (diff) | |
parent | 9636273dae265b9354b861b373cd43cd76a6d0fe (diff) |
Merge with /usr/src/ntfs-2.6.git
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/3c59x.c | 9 | ||||
-rw-r--r-- | drivers/net/Makefile | 2 | ||||
-rw-r--r-- | drivers/net/Space.c | 2 | ||||
-rw-r--r-- | drivers/net/appletalk/cops.c | 4 | ||||
-rw-r--r-- | drivers/net/appletalk/cops_ffdrv.h | 2 | ||||
-rw-r--r-- | drivers/net/appletalk/cops_ltdrv.h | 2 | ||||
-rw-r--r-- | drivers/net/appletalk/ltpc.c | 2 | ||||
-rw-r--r-- | drivers/net/arcnet/capmode.c | 2 | ||||
-rw-r--r-- | drivers/net/ibm_emac/ibm_emac_core.c | 2 | ||||
-rw-r--r-- | drivers/net/loopback.c | 2 | ||||
-rw-r--r-- | drivers/net/tg3.c | 565 | ||||
-rw-r--r-- | drivers/net/tg3.h | 8 | ||||
-rw-r--r-- | drivers/net/tulip/tulip_core.c | 2 | ||||
-rw-r--r-- | drivers/net/wireless/Kconfig | 2 |
14 files changed, 428 insertions, 178 deletions
diff --git a/drivers/net/3c59x.c b/drivers/net/3c59x.c index 43e2ac532f82..b5e076043431 100644 --- a/drivers/net/3c59x.c +++ b/drivers/net/3c59x.c | |||
@@ -1581,7 +1581,8 @@ vortex_up(struct net_device *dev) | |||
1581 | 1581 | ||
1582 | if (VORTEX_PCI(vp)) { | 1582 | if (VORTEX_PCI(vp)) { |
1583 | pci_set_power_state(VORTEX_PCI(vp), PCI_D0); /* Go active */ | 1583 | pci_set_power_state(VORTEX_PCI(vp), PCI_D0); /* Go active */ |
1584 | pci_restore_state(VORTEX_PCI(vp)); | 1584 | if (vp->pm_state_valid) |
1585 | pci_restore_state(VORTEX_PCI(vp)); | ||
1585 | pci_enable_device(VORTEX_PCI(vp)); | 1586 | pci_enable_device(VORTEX_PCI(vp)); |
1586 | } | 1587 | } |
1587 | 1588 | ||
@@ -2741,6 +2742,7 @@ vortex_down(struct net_device *dev, int final_down) | |||
2741 | outl(0, ioaddr + DownListPtr); | 2742 | outl(0, ioaddr + DownListPtr); |
2742 | 2743 | ||
2743 | if (final_down && VORTEX_PCI(vp)) { | 2744 | if (final_down && VORTEX_PCI(vp)) { |
2745 | vp->pm_state_valid = 1; | ||
2744 | pci_save_state(VORTEX_PCI(vp)); | 2746 | pci_save_state(VORTEX_PCI(vp)); |
2745 | acpi_set_WOL(dev); | 2747 | acpi_set_WOL(dev); |
2746 | } | 2748 | } |
@@ -3243,9 +3245,10 @@ static void acpi_set_WOL(struct net_device *dev) | |||
3243 | outw(RxEnable, ioaddr + EL3_CMD); | 3245 | outw(RxEnable, ioaddr + EL3_CMD); |
3244 | 3246 | ||
3245 | pci_enable_wake(VORTEX_PCI(vp), 0, 1); | 3247 | pci_enable_wake(VORTEX_PCI(vp), 0, 1); |
3248 | |||
3249 | /* Change the power state to D3; RxEnable doesn't take effect. */ | ||
3250 | pci_set_power_state(VORTEX_PCI(vp), PCI_D3hot); | ||
3246 | } | 3251 | } |
3247 | /* Change the power state to D3; RxEnable doesn't take effect. */ | ||
3248 | pci_set_power_state(VORTEX_PCI(vp), PCI_D3hot); | ||
3249 | } | 3252 | } |
3250 | 3253 | ||
3251 | 3254 | ||
diff --git a/drivers/net/Makefile b/drivers/net/Makefile index 6202b10dbb4d..e038d55e4f6f 100644 --- a/drivers/net/Makefile +++ b/drivers/net/Makefile | |||
@@ -187,7 +187,7 @@ obj-$(CONFIG_TR) += tokenring/ | |||
187 | obj-$(CONFIG_WAN) += wan/ | 187 | obj-$(CONFIG_WAN) += wan/ |
188 | obj-$(CONFIG_ARCNET) += arcnet/ | 188 | obj-$(CONFIG_ARCNET) += arcnet/ |
189 | obj-$(CONFIG_NET_PCMCIA) += pcmcia/ | 189 | obj-$(CONFIG_NET_PCMCIA) += pcmcia/ |
190 | obj-$(CONFIG_NET_WIRELESS) += wireless/ | 190 | obj-$(CONFIG_NET_RADIO) += wireless/ |
191 | obj-$(CONFIG_NET_TULIP) += tulip/ | 191 | obj-$(CONFIG_NET_TULIP) += tulip/ |
192 | obj-$(CONFIG_HAMRADIO) += hamradio/ | 192 | obj-$(CONFIG_HAMRADIO) += hamradio/ |
193 | obj-$(CONFIG_IRDA) += irda/ | 193 | obj-$(CONFIG_IRDA) += irda/ |
diff --git a/drivers/net/Space.c b/drivers/net/Space.c index fc519377b5aa..fb433325aa27 100644 --- a/drivers/net/Space.c +++ b/drivers/net/Space.c | |||
@@ -7,7 +7,7 @@ | |||
7 | * | 7 | * |
8 | * Version: @(#)Space.c 1.0.7 08/12/93 | 8 | * Version: @(#)Space.c 1.0.7 08/12/93 |
9 | * | 9 | * |
10 | * Authors: Ross Biro, <bir7@leland.Stanford.Edu> | 10 | * Authors: Ross Biro |
11 | * Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG> | 11 | * Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG> |
12 | * Donald J. Becker, <becker@scyld.com> | 12 | * Donald J. Becker, <becker@scyld.com> |
13 | * | 13 | * |
diff --git a/drivers/net/appletalk/cops.c b/drivers/net/appletalk/cops.c index 2161c2d585f0..9edaa183227a 100644 --- a/drivers/net/appletalk/cops.c +++ b/drivers/net/appletalk/cops.c | |||
@@ -65,7 +65,7 @@ static const char *version = | |||
65 | #include <linux/etherdevice.h> | 65 | #include <linux/etherdevice.h> |
66 | #include <linux/skbuff.h> | 66 | #include <linux/skbuff.h> |
67 | #include <linux/if_arp.h> | 67 | #include <linux/if_arp.h> |
68 | #include <linux/if_ltalk.h> /* For ltalk_setup() */ | 68 | #include <linux/if_ltalk.h> |
69 | #include <linux/delay.h> /* For udelay() */ | 69 | #include <linux/delay.h> /* For udelay() */ |
70 | #include <linux/atalk.h> | 70 | #include <linux/atalk.h> |
71 | #include <linux/spinlock.h> | 71 | #include <linux/spinlock.h> |
@@ -223,7 +223,7 @@ struct net_device * __init cops_probe(int unit) | |||
223 | int base_addr; | 223 | int base_addr; |
224 | int err = 0; | 224 | int err = 0; |
225 | 225 | ||
226 | dev = alloc_netdev(sizeof(struct cops_local), "lt%d", ltalk_setup); | 226 | dev = alloc_ltalkdev(sizeof(struct cops_local)); |
227 | if (!dev) | 227 | if (!dev) |
228 | return ERR_PTR(-ENOMEM); | 228 | return ERR_PTR(-ENOMEM); |
229 | 229 | ||
diff --git a/drivers/net/appletalk/cops_ffdrv.h b/drivers/net/appletalk/cops_ffdrv.h index 4131b4a7a65b..31cf8c9c947f 100644 --- a/drivers/net/appletalk/cops_ffdrv.h +++ b/drivers/net/appletalk/cops_ffdrv.h | |||
@@ -28,7 +28,7 @@ | |||
28 | 28 | ||
29 | #ifdef CONFIG_COPS_DAYNA | 29 | #ifdef CONFIG_COPS_DAYNA |
30 | 30 | ||
31 | unsigned char ffdrv_code[] = { | 31 | static const unsigned char ffdrv_code[] = { |
32 | 58,3,0,50,228,149,33,255,255,34,226,149, | 32 | 58,3,0,50,228,149,33,255,255,34,226,149, |
33 | 249,17,40,152,33,202,154,183,237,82,77,68, | 33 | 249,17,40,152,33,202,154,183,237,82,77,68, |
34 | 11,107,98,19,54,0,237,176,175,50,80,0, | 34 | 11,107,98,19,54,0,237,176,175,50,80,0, |
diff --git a/drivers/net/appletalk/cops_ltdrv.h b/drivers/net/appletalk/cops_ltdrv.h index 05de66dd9206..4afb8e18ba65 100644 --- a/drivers/net/appletalk/cops_ltdrv.h +++ b/drivers/net/appletalk/cops_ltdrv.h | |||
@@ -27,7 +27,7 @@ | |||
27 | 27 | ||
28 | #ifdef CONFIG_COPS_TANGENT | 28 | #ifdef CONFIG_COPS_TANGENT |
29 | 29 | ||
30 | unsigned char ltdrv_code[] = { | 30 | static const unsigned char ltdrv_code[] = { |
31 | 58,3,0,50,148,10,33,143,15,62,85,119, | 31 | 58,3,0,50,148,10,33,143,15,62,85,119, |
32 | 190,32,9,62,170,119,190,32,3,35,24,241, | 32 | 190,32,9,62,170,119,190,32,3,35,24,241, |
33 | 34,146,10,249,17,150,10,33,143,15,183,237, | 33 | 34,146,10,249,17,150,10,33,143,15,183,237, |
diff --git a/drivers/net/appletalk/ltpc.c b/drivers/net/appletalk/ltpc.c index ad8e943231a1..db4f369637b6 100644 --- a/drivers/net/appletalk/ltpc.c +++ b/drivers/net/appletalk/ltpc.c | |||
@@ -1039,7 +1039,7 @@ struct net_device * __init ltpc_probe(void) | |||
1039 | unsigned long f; | 1039 | unsigned long f; |
1040 | unsigned long timeout; | 1040 | unsigned long timeout; |
1041 | 1041 | ||
1042 | dev = alloc_netdev(sizeof(struct ltpc_private), "lt%d", ltalk_setup); | 1042 | dev = alloc_ltalkdev(sizeof(struct ltpc_private)); |
1043 | if (!dev) | 1043 | if (!dev) |
1044 | goto out; | 1044 | goto out; |
1045 | 1045 | ||
diff --git a/drivers/net/arcnet/capmode.c b/drivers/net/arcnet/capmode.c index 16e155b04129..66485585ab39 100644 --- a/drivers/net/arcnet/capmode.c +++ b/drivers/net/arcnet/capmode.c | |||
@@ -48,7 +48,7 @@ static int prepare_tx(struct net_device *dev, struct archdr *pkt, int length, | |||
48 | static int ack_tx(struct net_device *dev, int acked); | 48 | static int ack_tx(struct net_device *dev, int acked); |
49 | 49 | ||
50 | 50 | ||
51 | struct ArcProto capmode_proto = | 51 | static struct ArcProto capmode_proto = |
52 | { | 52 | { |
53 | 'r', | 53 | 'r', |
54 | XMTU, | 54 | XMTU, |
diff --git a/drivers/net/ibm_emac/ibm_emac_core.c b/drivers/net/ibm_emac/ibm_emac_core.c index ab44358ddbfc..6482d994d489 100644 --- a/drivers/net/ibm_emac/ibm_emac_core.c +++ b/drivers/net/ibm_emac/ibm_emac_core.c | |||
@@ -1595,7 +1595,7 @@ static struct ethtool_ops emac_ethtool_ops = { | |||
1595 | static int emac_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) | 1595 | static int emac_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) |
1596 | { | 1596 | { |
1597 | struct ocp_enet_private *fep = dev->priv; | 1597 | struct ocp_enet_private *fep = dev->priv; |
1598 | uint *data = (uint *) & rq->ifr_ifru; | 1598 | uint16_t *data = (uint16_t *) & rq->ifr_ifru; |
1599 | 1599 | ||
1600 | switch (cmd) { | 1600 | switch (cmd) { |
1601 | case SIOCGMIIPHY: | 1601 | case SIOCGMIIPHY: |
diff --git a/drivers/net/loopback.c b/drivers/net/loopback.c index 2ffc31708d5f..b33111e21313 100644 --- a/drivers/net/loopback.c +++ b/drivers/net/loopback.c | |||
@@ -7,7 +7,7 @@ | |||
7 | * | 7 | * |
8 | * Version: @(#)loopback.c 1.0.4b 08/16/93 | 8 | * Version: @(#)loopback.c 1.0.4b 08/16/93 |
9 | * | 9 | * |
10 | * Authors: Ross Biro, <bir7@leland.Stanford.Edu> | 10 | * Authors: Ross Biro |
11 | * Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG> | 11 | * Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG> |
12 | * Donald Becker, <becker@scyld.com> | 12 | * Donald Becker, <becker@scyld.com> |
13 | * | 13 | * |
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c index 058c70c6f1ac..4d2bdbdd34e8 100644 --- a/drivers/net/tg3.c +++ b/drivers/net/tg3.c | |||
@@ -61,8 +61,8 @@ | |||
61 | 61 | ||
62 | #define DRV_MODULE_NAME "tg3" | 62 | #define DRV_MODULE_NAME "tg3" |
63 | #define PFX DRV_MODULE_NAME ": " | 63 | #define PFX DRV_MODULE_NAME ": " |
64 | #define DRV_MODULE_VERSION "3.26" | 64 | #define DRV_MODULE_VERSION "3.27" |
65 | #define DRV_MODULE_RELDATE "April 24, 2005" | 65 | #define DRV_MODULE_RELDATE "May 5, 2005" |
66 | 66 | ||
67 | #define TG3_DEF_MAC_MODE 0 | 67 | #define TG3_DEF_MAC_MODE 0 |
68 | #define TG3_DEF_RX_MODE 0 | 68 | #define TG3_DEF_RX_MODE 0 |
@@ -420,7 +420,8 @@ static void tg3_enable_ints(struct tg3 *tp) | |||
420 | { | 420 | { |
421 | tw32(TG3PCI_MISC_HOST_CTRL, | 421 | tw32(TG3PCI_MISC_HOST_CTRL, |
422 | (tp->misc_host_ctrl & ~MISC_HOST_CTRL_MASK_PCI_INT)); | 422 | (tp->misc_host_ctrl & ~MISC_HOST_CTRL_MASK_PCI_INT)); |
423 | tw32_mailbox(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW, 0x00000000); | 423 | tw32_mailbox(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW, |
424 | (tp->last_tag << 24)); | ||
424 | tr32(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW); | 425 | tr32(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW); |
425 | 426 | ||
426 | tg3_cond_int(tp); | 427 | tg3_cond_int(tp); |
@@ -455,10 +456,16 @@ static void tg3_restart_ints(struct tg3 *tp) | |||
455 | { | 456 | { |
456 | tw32(TG3PCI_MISC_HOST_CTRL, | 457 | tw32(TG3PCI_MISC_HOST_CTRL, |
457 | (tp->misc_host_ctrl & ~MISC_HOST_CTRL_MASK_PCI_INT)); | 458 | (tp->misc_host_ctrl & ~MISC_HOST_CTRL_MASK_PCI_INT)); |
458 | tw32_mailbox(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW, 0x00000000); | 459 | tw32_mailbox(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW, |
460 | tp->last_tag << 24); | ||
459 | mmiowb(); | 461 | mmiowb(); |
460 | 462 | ||
461 | if (tg3_has_work(tp)) | 463 | /* When doing tagged status, this work check is unnecessary. |
464 | * The last_tag we write above tells the chip which piece of | ||
465 | * work we've completed. | ||
466 | */ | ||
467 | if (!(tp->tg3_flags & TG3_FLAG_TAGGED_STATUS) && | ||
468 | tg3_has_work(tp)) | ||
462 | tw32(HOSTCC_MODE, tp->coalesce_mode | | 469 | tw32(HOSTCC_MODE, tp->coalesce_mode | |
463 | (HOSTCC_MODE_ENABLE | HOSTCC_MODE_NOW)); | 470 | (HOSTCC_MODE_ENABLE | HOSTCC_MODE_NOW)); |
464 | } | 471 | } |
@@ -2500,7 +2507,7 @@ static int tg3_setup_phy(struct tg3 *tp, int force_reset) | |||
2500 | if (!(tp->tg3_flags2 & TG3_FLG2_5705_PLUS)) { | 2507 | if (!(tp->tg3_flags2 & TG3_FLG2_5705_PLUS)) { |
2501 | if (netif_carrier_ok(tp->dev)) { | 2508 | if (netif_carrier_ok(tp->dev)) { |
2502 | tw32(HOSTCC_STAT_COAL_TICKS, | 2509 | tw32(HOSTCC_STAT_COAL_TICKS, |
2503 | DEFAULT_STAT_COAL_TICKS); | 2510 | tp->coal.stats_block_coalesce_usecs); |
2504 | } else { | 2511 | } else { |
2505 | tw32(HOSTCC_STAT_COAL_TICKS, 0); | 2512 | tw32(HOSTCC_STAT_COAL_TICKS, 0); |
2506 | } | 2513 | } |
@@ -2886,7 +2893,6 @@ static int tg3_poll(struct net_device *netdev, int *budget) | |||
2886 | * All RX "locking" is done by ensuring outside | 2893 | * All RX "locking" is done by ensuring outside |
2887 | * code synchronizes with dev->poll() | 2894 | * code synchronizes with dev->poll() |
2888 | */ | 2895 | */ |
2889 | done = 1; | ||
2890 | if (sblk->idx[0].rx_producer != tp->rx_rcb_ptr) { | 2896 | if (sblk->idx[0].rx_producer != tp->rx_rcb_ptr) { |
2891 | int orig_budget = *budget; | 2897 | int orig_budget = *budget; |
2892 | int work_done; | 2898 | int work_done; |
@@ -2898,12 +2904,14 @@ static int tg3_poll(struct net_device *netdev, int *budget) | |||
2898 | 2904 | ||
2899 | *budget -= work_done; | 2905 | *budget -= work_done; |
2900 | netdev->quota -= work_done; | 2906 | netdev->quota -= work_done; |
2901 | |||
2902 | if (work_done >= orig_budget) | ||
2903 | done = 0; | ||
2904 | } | 2907 | } |
2905 | 2908 | ||
2909 | if (tp->tg3_flags & TG3_FLAG_TAGGED_STATUS) | ||
2910 | tp->last_tag = sblk->status_tag; | ||
2911 | rmb(); | ||
2912 | |||
2906 | /* if no more work, tell net stack and NIC we're done */ | 2913 | /* if no more work, tell net stack and NIC we're done */ |
2914 | done = !tg3_has_work(tp); | ||
2907 | if (done) { | 2915 | if (done) { |
2908 | spin_lock_irqsave(&tp->lock, flags); | 2916 | spin_lock_irqsave(&tp->lock, flags); |
2909 | __netif_rx_complete(netdev); | 2917 | __netif_rx_complete(netdev); |
@@ -2928,22 +2936,21 @@ static irqreturn_t tg3_msi(int irq, void *dev_id, struct pt_regs *regs) | |||
2928 | spin_lock_irqsave(&tp->lock, flags); | 2936 | spin_lock_irqsave(&tp->lock, flags); |
2929 | 2937 | ||
2930 | /* | 2938 | /* |
2931 | * writing any value to intr-mbox-0 clears PCI INTA# and | 2939 | * Writing any value to intr-mbox-0 clears PCI INTA# and |
2932 | * chip-internal interrupt pending events. | 2940 | * chip-internal interrupt pending events. |
2933 | * writing non-zero to intr-mbox-0 additional tells the | 2941 | * Writing non-zero to intr-mbox-0 additional tells the |
2934 | * NIC to stop sending us irqs, engaging "in-intr-handler" | 2942 | * NIC to stop sending us irqs, engaging "in-intr-handler" |
2935 | * event coalescing. | 2943 | * event coalescing. |
2936 | */ | 2944 | */ |
2937 | tw32_mailbox(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW, 0x00000001); | 2945 | tw32_mailbox(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW, 0x00000001); |
2946 | tp->last_tag = sblk->status_tag; | ||
2938 | sblk->status &= ~SD_STATUS_UPDATED; | 2947 | sblk->status &= ~SD_STATUS_UPDATED; |
2939 | |||
2940 | if (likely(tg3_has_work(tp))) | 2948 | if (likely(tg3_has_work(tp))) |
2941 | netif_rx_schedule(dev); /* schedule NAPI poll */ | 2949 | netif_rx_schedule(dev); /* schedule NAPI poll */ |
2942 | else { | 2950 | else { |
2943 | /* no work, re-enable interrupts | 2951 | /* No work, re-enable interrupts. */ |
2944 | */ | ||
2945 | tw32_mailbox(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW, | 2952 | tw32_mailbox(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW, |
2946 | 0x00000000); | 2953 | tp->last_tag << 24); |
2947 | } | 2954 | } |
2948 | 2955 | ||
2949 | spin_unlock_irqrestore(&tp->lock, flags); | 2956 | spin_unlock_irqrestore(&tp->lock, flags); |
@@ -2969,21 +2976,62 @@ static irqreturn_t tg3_interrupt(int irq, void *dev_id, struct pt_regs *regs) | |||
2969 | if ((sblk->status & SD_STATUS_UPDATED) || | 2976 | if ((sblk->status & SD_STATUS_UPDATED) || |
2970 | !(tr32(TG3PCI_PCISTATE) & PCISTATE_INT_NOT_ACTIVE)) { | 2977 | !(tr32(TG3PCI_PCISTATE) & PCISTATE_INT_NOT_ACTIVE)) { |
2971 | /* | 2978 | /* |
2972 | * writing any value to intr-mbox-0 clears PCI INTA# and | 2979 | * Writing any value to intr-mbox-0 clears PCI INTA# and |
2973 | * chip-internal interrupt pending events. | 2980 | * chip-internal interrupt pending events. |
2974 | * writing non-zero to intr-mbox-0 additional tells the | 2981 | * Writing non-zero to intr-mbox-0 additional tells the |
2975 | * NIC to stop sending us irqs, engaging "in-intr-handler" | 2982 | * NIC to stop sending us irqs, engaging "in-intr-handler" |
2976 | * event coalescing. | 2983 | * event coalescing. |
2977 | */ | 2984 | */ |
2978 | tw32_mailbox(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW, | 2985 | tw32_mailbox(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW, |
2979 | 0x00000001); | 2986 | 0x00000001); |
2987 | sblk->status &= ~SD_STATUS_UPDATED; | ||
2988 | if (likely(tg3_has_work(tp))) | ||
2989 | netif_rx_schedule(dev); /* schedule NAPI poll */ | ||
2990 | else { | ||
2991 | /* No work, shared interrupt perhaps? re-enable | ||
2992 | * interrupts, and flush that PCI write | ||
2993 | */ | ||
2994 | tw32_mailbox(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW, | ||
2995 | 0x00000000); | ||
2996 | tr32(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW); | ||
2997 | } | ||
2998 | } else { /* shared interrupt */ | ||
2999 | handled = 0; | ||
3000 | } | ||
3001 | |||
3002 | spin_unlock_irqrestore(&tp->lock, flags); | ||
3003 | |||
3004 | return IRQ_RETVAL(handled); | ||
3005 | } | ||
3006 | |||
3007 | static irqreturn_t tg3_interrupt_tagged(int irq, void *dev_id, struct pt_regs *regs) | ||
3008 | { | ||
3009 | struct net_device *dev = dev_id; | ||
3010 | struct tg3 *tp = netdev_priv(dev); | ||
3011 | struct tg3_hw_status *sblk = tp->hw_status; | ||
3012 | unsigned long flags; | ||
3013 | unsigned int handled = 1; | ||
3014 | |||
3015 | spin_lock_irqsave(&tp->lock, flags); | ||
3016 | |||
3017 | /* In INTx mode, it is possible for the interrupt to arrive at | ||
3018 | * the CPU before the status block posted prior to the interrupt. | ||
3019 | * Reading the PCI State register will confirm whether the | ||
3020 | * interrupt is ours and will flush the status block. | ||
3021 | */ | ||
3022 | if ((sblk->status & SD_STATUS_UPDATED) || | ||
3023 | !(tr32(TG3PCI_PCISTATE) & PCISTATE_INT_NOT_ACTIVE)) { | ||
2980 | /* | 3024 | /* |
2981 | * Flush PCI write. This also guarantees that our | 3025 | * writing any value to intr-mbox-0 clears PCI INTA# and |
2982 | * status block has been flushed to host memory. | 3026 | * chip-internal interrupt pending events. |
3027 | * writing non-zero to intr-mbox-0 additional tells the | ||
3028 | * NIC to stop sending us irqs, engaging "in-intr-handler" | ||
3029 | * event coalescing. | ||
2983 | */ | 3030 | */ |
2984 | tr32(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW); | 3031 | tw32_mailbox(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW, |
3032 | 0x00000001); | ||
3033 | tp->last_tag = sblk->status_tag; | ||
2985 | sblk->status &= ~SD_STATUS_UPDATED; | 3034 | sblk->status &= ~SD_STATUS_UPDATED; |
2986 | |||
2987 | if (likely(tg3_has_work(tp))) | 3035 | if (likely(tg3_has_work(tp))) |
2988 | netif_rx_schedule(dev); /* schedule NAPI poll */ | 3036 | netif_rx_schedule(dev); /* schedule NAPI poll */ |
2989 | else { | 3037 | else { |
@@ -2991,7 +3039,7 @@ static irqreturn_t tg3_interrupt(int irq, void *dev_id, struct pt_regs *regs) | |||
2991 | * interrupts, and flush that PCI write | 3039 | * interrupts, and flush that PCI write |
2992 | */ | 3040 | */ |
2993 | tw32_mailbox(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW, | 3041 | tw32_mailbox(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW, |
2994 | 0x00000000); | 3042 | tp->last_tag << 24); |
2995 | tr32(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW); | 3043 | tr32(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW); |
2996 | } | 3044 | } |
2997 | } else { /* shared interrupt */ | 3045 | } else { /* shared interrupt */ |
@@ -3020,7 +3068,7 @@ static irqreturn_t tg3_test_isr(int irq, void *dev_id, | |||
3020 | } | 3068 | } |
3021 | 3069 | ||
3022 | static int tg3_init_hw(struct tg3 *); | 3070 | static int tg3_init_hw(struct tg3 *); |
3023 | static int tg3_halt(struct tg3 *); | 3071 | static int tg3_halt(struct tg3 *, int); |
3024 | 3072 | ||
3025 | #ifdef CONFIG_NET_POLL_CONTROLLER | 3073 | #ifdef CONFIG_NET_POLL_CONTROLLER |
3026 | static void tg3_poll_controller(struct net_device *dev) | 3074 | static void tg3_poll_controller(struct net_device *dev) |
@@ -3044,7 +3092,7 @@ static void tg3_reset_task(void *_data) | |||
3044 | restart_timer = tp->tg3_flags2 & TG3_FLG2_RESTART_TIMER; | 3092 | restart_timer = tp->tg3_flags2 & TG3_FLG2_RESTART_TIMER; |
3045 | tp->tg3_flags2 &= ~TG3_FLG2_RESTART_TIMER; | 3093 | tp->tg3_flags2 &= ~TG3_FLG2_RESTART_TIMER; |
3046 | 3094 | ||
3047 | tg3_halt(tp); | 3095 | tg3_halt(tp, 0); |
3048 | tg3_init_hw(tp); | 3096 | tg3_init_hw(tp); |
3049 | 3097 | ||
3050 | tg3_netif_start(tp); | 3098 | tg3_netif_start(tp); |
@@ -3390,7 +3438,7 @@ static int tg3_change_mtu(struct net_device *dev, int new_mtu) | |||
3390 | spin_lock_irq(&tp->lock); | 3438 | spin_lock_irq(&tp->lock); |
3391 | spin_lock(&tp->tx_lock); | 3439 | spin_lock(&tp->tx_lock); |
3392 | 3440 | ||
3393 | tg3_halt(tp); | 3441 | tg3_halt(tp, 1); |
3394 | 3442 | ||
3395 | tg3_set_mtu(dev, tp, new_mtu); | 3443 | tg3_set_mtu(dev, tp, new_mtu); |
3396 | 3444 | ||
@@ -3657,7 +3705,7 @@ err_out: | |||
3657 | /* To stop a block, clear the enable bit and poll till it | 3705 | /* To stop a block, clear the enable bit and poll till it |
3658 | * clears. tp->lock is held. | 3706 | * clears. tp->lock is held. |
3659 | */ | 3707 | */ |
3660 | static int tg3_stop_block(struct tg3 *tp, unsigned long ofs, u32 enable_bit) | 3708 | static int tg3_stop_block(struct tg3 *tp, unsigned long ofs, u32 enable_bit, int silent) |
3661 | { | 3709 | { |
3662 | unsigned int i; | 3710 | unsigned int i; |
3663 | u32 val; | 3711 | u32 val; |
@@ -3690,7 +3738,7 @@ static int tg3_stop_block(struct tg3 *tp, unsigned long ofs, u32 enable_bit) | |||
3690 | break; | 3738 | break; |
3691 | } | 3739 | } |
3692 | 3740 | ||
3693 | if (i == MAX_WAIT_CNT) { | 3741 | if (i == MAX_WAIT_CNT && !silent) { |
3694 | printk(KERN_ERR PFX "tg3_stop_block timed out, " | 3742 | printk(KERN_ERR PFX "tg3_stop_block timed out, " |
3695 | "ofs=%lx enable_bit=%x\n", | 3743 | "ofs=%lx enable_bit=%x\n", |
3696 | ofs, enable_bit); | 3744 | ofs, enable_bit); |
@@ -3701,7 +3749,7 @@ static int tg3_stop_block(struct tg3 *tp, unsigned long ofs, u32 enable_bit) | |||
3701 | } | 3749 | } |
3702 | 3750 | ||
3703 | /* tp->lock is held. */ | 3751 | /* tp->lock is held. */ |
3704 | static int tg3_abort_hw(struct tg3 *tp) | 3752 | static int tg3_abort_hw(struct tg3 *tp, int silent) |
3705 | { | 3753 | { |
3706 | int i, err; | 3754 | int i, err; |
3707 | 3755 | ||
@@ -3711,22 +3759,20 @@ static int tg3_abort_hw(struct tg3 *tp) | |||
3711 | tw32_f(MAC_RX_MODE, tp->rx_mode); | 3759 | tw32_f(MAC_RX_MODE, tp->rx_mode); |
3712 | udelay(10); | 3760 | udelay(10); |
3713 | 3761 | ||
3714 | err = tg3_stop_block(tp, RCVBDI_MODE, RCVBDI_MODE_ENABLE); | 3762 | err = tg3_stop_block(tp, RCVBDI_MODE, RCVBDI_MODE_ENABLE, silent); |
3715 | err |= tg3_stop_block(tp, RCVLPC_MODE, RCVLPC_MODE_ENABLE); | 3763 | err |= tg3_stop_block(tp, RCVLPC_MODE, RCVLPC_MODE_ENABLE, silent); |
3716 | err |= tg3_stop_block(tp, RCVLSC_MODE, RCVLSC_MODE_ENABLE); | 3764 | err |= tg3_stop_block(tp, RCVLSC_MODE, RCVLSC_MODE_ENABLE, silent); |
3717 | err |= tg3_stop_block(tp, RCVDBDI_MODE, RCVDBDI_MODE_ENABLE); | 3765 | err |= tg3_stop_block(tp, RCVDBDI_MODE, RCVDBDI_MODE_ENABLE, silent); |
3718 | err |= tg3_stop_block(tp, RCVDCC_MODE, RCVDCC_MODE_ENABLE); | 3766 | err |= tg3_stop_block(tp, RCVDCC_MODE, RCVDCC_MODE_ENABLE, silent); |
3719 | err |= tg3_stop_block(tp, RCVCC_MODE, RCVCC_MODE_ENABLE); | 3767 | err |= tg3_stop_block(tp, RCVCC_MODE, RCVCC_MODE_ENABLE, silent); |
3720 | 3768 | ||
3721 | err |= tg3_stop_block(tp, SNDBDS_MODE, SNDBDS_MODE_ENABLE); | 3769 | err |= tg3_stop_block(tp, SNDBDS_MODE, SNDBDS_MODE_ENABLE, silent); |
3722 | err |= tg3_stop_block(tp, SNDBDI_MODE, SNDBDI_MODE_ENABLE); | 3770 | err |= tg3_stop_block(tp, SNDBDI_MODE, SNDBDI_MODE_ENABLE, silent); |
3723 | err |= tg3_stop_block(tp, SNDDATAI_MODE, SNDDATAI_MODE_ENABLE); | 3771 | err |= tg3_stop_block(tp, SNDDATAI_MODE, SNDDATAI_MODE_ENABLE, silent); |
3724 | err |= tg3_stop_block(tp, RDMAC_MODE, RDMAC_MODE_ENABLE); | 3772 | err |= tg3_stop_block(tp, RDMAC_MODE, RDMAC_MODE_ENABLE, silent); |
3725 | err |= tg3_stop_block(tp, SNDDATAC_MODE, SNDDATAC_MODE_ENABLE); | 3773 | err |= tg3_stop_block(tp, SNDDATAC_MODE, SNDDATAC_MODE_ENABLE, silent); |
3726 | err |= tg3_stop_block(tp, DMAC_MODE, DMAC_MODE_ENABLE); | 3774 | err |= tg3_stop_block(tp, DMAC_MODE, DMAC_MODE_ENABLE, silent); |
3727 | err |= tg3_stop_block(tp, SNDBDC_MODE, SNDBDC_MODE_ENABLE); | 3775 | err |= tg3_stop_block(tp, SNDBDC_MODE, SNDBDC_MODE_ENABLE, silent); |
3728 | if (err) | ||
3729 | goto out; | ||
3730 | 3776 | ||
3731 | tp->mac_mode &= ~MAC_MODE_TDE_ENABLE; | 3777 | tp->mac_mode &= ~MAC_MODE_TDE_ENABLE; |
3732 | tw32_f(MAC_MODE, tp->mac_mode); | 3778 | tw32_f(MAC_MODE, tp->mac_mode); |
@@ -3744,27 +3790,24 @@ static int tg3_abort_hw(struct tg3 *tp) | |||
3744 | printk(KERN_ERR PFX "tg3_abort_hw timed out for %s, " | 3790 | printk(KERN_ERR PFX "tg3_abort_hw timed out for %s, " |
3745 | "TX_MODE_ENABLE will not clear MAC_TX_MODE=%08x\n", | 3791 | "TX_MODE_ENABLE will not clear MAC_TX_MODE=%08x\n", |
3746 | tp->dev->name, tr32(MAC_TX_MODE)); | 3792 | tp->dev->name, tr32(MAC_TX_MODE)); |
3747 | return -ENODEV; | 3793 | err |= -ENODEV; |
3748 | } | 3794 | } |
3749 | 3795 | ||
3750 | err = tg3_stop_block(tp, HOSTCC_MODE, HOSTCC_MODE_ENABLE); | 3796 | err |= tg3_stop_block(tp, HOSTCC_MODE, HOSTCC_MODE_ENABLE, silent); |
3751 | err |= tg3_stop_block(tp, WDMAC_MODE, WDMAC_MODE_ENABLE); | 3797 | err |= tg3_stop_block(tp, WDMAC_MODE, WDMAC_MODE_ENABLE, silent); |
3752 | err |= tg3_stop_block(tp, MBFREE_MODE, MBFREE_MODE_ENABLE); | 3798 | err |= tg3_stop_block(tp, MBFREE_MODE, MBFREE_MODE_ENABLE, silent); |
3753 | 3799 | ||
3754 | tw32(FTQ_RESET, 0xffffffff); | 3800 | tw32(FTQ_RESET, 0xffffffff); |
3755 | tw32(FTQ_RESET, 0x00000000); | 3801 | tw32(FTQ_RESET, 0x00000000); |
3756 | 3802 | ||
3757 | err |= tg3_stop_block(tp, BUFMGR_MODE, BUFMGR_MODE_ENABLE); | 3803 | err |= tg3_stop_block(tp, BUFMGR_MODE, BUFMGR_MODE_ENABLE, silent); |
3758 | err |= tg3_stop_block(tp, MEMARB_MODE, MEMARB_MODE_ENABLE); | 3804 | err |= tg3_stop_block(tp, MEMARB_MODE, MEMARB_MODE_ENABLE, silent); |
3759 | if (err) | ||
3760 | goto out; | ||
3761 | 3805 | ||
3762 | if (tp->hw_status) | 3806 | if (tp->hw_status) |
3763 | memset(tp->hw_status, 0, TG3_HW_STATUS_SIZE); | 3807 | memset(tp->hw_status, 0, TG3_HW_STATUS_SIZE); |
3764 | if (tp->hw_stats) | 3808 | if (tp->hw_stats) |
3765 | memset(tp->hw_stats, 0, sizeof(struct tg3_hw_stats)); | 3809 | memset(tp->hw_stats, 0, sizeof(struct tg3_hw_stats)); |
3766 | 3810 | ||
3767 | out: | ||
3768 | return err; | 3811 | return err; |
3769 | } | 3812 | } |
3770 | 3813 | ||
@@ -4086,7 +4129,7 @@ static void tg3_stop_fw(struct tg3 *tp) | |||
4086 | } | 4129 | } |
4087 | 4130 | ||
4088 | /* tp->lock is held. */ | 4131 | /* tp->lock is held. */ |
4089 | static int tg3_halt(struct tg3 *tp) | 4132 | static int tg3_halt(struct tg3 *tp, int silent) |
4090 | { | 4133 | { |
4091 | int err; | 4134 | int err; |
4092 | 4135 | ||
@@ -4094,7 +4137,7 @@ static int tg3_halt(struct tg3 *tp) | |||
4094 | 4137 | ||
4095 | tg3_write_sig_pre_reset(tp, RESET_KIND_SHUTDOWN); | 4138 | tg3_write_sig_pre_reset(tp, RESET_KIND_SHUTDOWN); |
4096 | 4139 | ||
4097 | tg3_abort_hw(tp); | 4140 | tg3_abort_hw(tp, silent); |
4098 | err = tg3_chip_reset(tp); | 4141 | err = tg3_chip_reset(tp); |
4099 | 4142 | ||
4100 | tg3_write_sig_legacy(tp, RESET_KIND_SHUTDOWN); | 4143 | tg3_write_sig_legacy(tp, RESET_KIND_SHUTDOWN); |
@@ -5049,6 +5092,27 @@ static void tg3_set_bdinfo(struct tg3 *tp, u32 bdinfo_addr, | |||
5049 | } | 5092 | } |
5050 | 5093 | ||
5051 | static void __tg3_set_rx_mode(struct net_device *); | 5094 | static void __tg3_set_rx_mode(struct net_device *); |
5095 | static void tg3_set_coalesce(struct tg3 *tp, struct ethtool_coalesce *ec) | ||
5096 | { | ||
5097 | tw32(HOSTCC_RXCOL_TICKS, ec->rx_coalesce_usecs); | ||
5098 | tw32(HOSTCC_TXCOL_TICKS, ec->tx_coalesce_usecs); | ||
5099 | tw32(HOSTCC_RXMAX_FRAMES, ec->rx_max_coalesced_frames); | ||
5100 | tw32(HOSTCC_TXMAX_FRAMES, ec->tx_max_coalesced_frames); | ||
5101 | if (!(tp->tg3_flags2 & TG3_FLG2_5705_PLUS)) { | ||
5102 | tw32(HOSTCC_RXCOAL_TICK_INT, ec->rx_coalesce_usecs_irq); | ||
5103 | tw32(HOSTCC_TXCOAL_TICK_INT, ec->tx_coalesce_usecs_irq); | ||
5104 | } | ||
5105 | tw32(HOSTCC_RXCOAL_MAXF_INT, ec->rx_max_coalesced_frames_irq); | ||
5106 | tw32(HOSTCC_TXCOAL_MAXF_INT, ec->tx_max_coalesced_frames_irq); | ||
5107 | if (!(tp->tg3_flags2 & TG3_FLG2_5705_PLUS)) { | ||
5108 | u32 val = ec->stats_block_coalesce_usecs; | ||
5109 | |||
5110 | if (!netif_carrier_ok(tp->dev)) | ||
5111 | val = 0; | ||
5112 | |||
5113 | tw32(HOSTCC_STAT_COAL_TICKS, val); | ||
5114 | } | ||
5115 | } | ||
5052 | 5116 | ||
5053 | /* tp->lock is held. */ | 5117 | /* tp->lock is held. */ |
5054 | static int tg3_reset_hw(struct tg3 *tp) | 5118 | static int tg3_reset_hw(struct tg3 *tp) |
@@ -5063,9 +5127,7 @@ static int tg3_reset_hw(struct tg3 *tp) | |||
5063 | tg3_write_sig_pre_reset(tp, RESET_KIND_INIT); | 5127 | tg3_write_sig_pre_reset(tp, RESET_KIND_INIT); |
5064 | 5128 | ||
5065 | if (tp->tg3_flags & TG3_FLAG_INIT_COMPLETE) { | 5129 | if (tp->tg3_flags & TG3_FLAG_INIT_COMPLETE) { |
5066 | err = tg3_abort_hw(tp); | 5130 | tg3_abort_hw(tp, 1); |
5067 | if (err) | ||
5068 | return err; | ||
5069 | } | 5131 | } |
5070 | 5132 | ||
5071 | err = tg3_chip_reset(tp); | 5133 | err = tg3_chip_reset(tp); |
@@ -5373,16 +5435,7 @@ static int tg3_reset_hw(struct tg3 *tp) | |||
5373 | udelay(10); | 5435 | udelay(10); |
5374 | } | 5436 | } |
5375 | 5437 | ||
5376 | tw32(HOSTCC_RXCOL_TICKS, 0); | 5438 | tg3_set_coalesce(tp, &tp->coal); |
5377 | tw32(HOSTCC_TXCOL_TICKS, LOW_TXCOL_TICKS); | ||
5378 | tw32(HOSTCC_RXMAX_FRAMES, 1); | ||
5379 | tw32(HOSTCC_TXMAX_FRAMES, LOW_RXMAX_FRAMES); | ||
5380 | if (!(tp->tg3_flags2 & TG3_FLG2_5705_PLUS)) { | ||
5381 | tw32(HOSTCC_RXCOAL_TICK_INT, 0); | ||
5382 | tw32(HOSTCC_TXCOAL_TICK_INT, 0); | ||
5383 | } | ||
5384 | tw32(HOSTCC_RXCOAL_MAXF_INT, 1); | ||
5385 | tw32(HOSTCC_TXCOAL_MAXF_INT, 0); | ||
5386 | 5439 | ||
5387 | /* set status block DMA address */ | 5440 | /* set status block DMA address */ |
5388 | tw32(HOSTCC_STATUS_BLK_HOST_ADDR + TG3_64BIT_REG_HIGH, | 5441 | tw32(HOSTCC_STATUS_BLK_HOST_ADDR + TG3_64BIT_REG_HIGH, |
@@ -5395,8 +5448,6 @@ static int tg3_reset_hw(struct tg3 *tp) | |||
5395 | * the tg3_periodic_fetch_stats call there, and | 5448 | * the tg3_periodic_fetch_stats call there, and |
5396 | * tg3_get_stats to see how this works for 5705/5750 chips. | 5449 | * tg3_get_stats to see how this works for 5705/5750 chips. |
5397 | */ | 5450 | */ |
5398 | tw32(HOSTCC_STAT_COAL_TICKS, | ||
5399 | DEFAULT_STAT_COAL_TICKS); | ||
5400 | tw32(HOSTCC_STATS_BLK_HOST_ADDR + TG3_64BIT_REG_HIGH, | 5451 | tw32(HOSTCC_STATS_BLK_HOST_ADDR + TG3_64BIT_REG_HIGH, |
5401 | ((u64) tp->stats_mapping >> 32)); | 5452 | ((u64) tp->stats_mapping >> 32)); |
5402 | tw32(HOSTCC_STATS_BLK_HOST_ADDR + TG3_64BIT_REG_LOW, | 5453 | tw32(HOSTCC_STATS_BLK_HOST_ADDR + TG3_64BIT_REG_LOW, |
@@ -5452,7 +5503,8 @@ static int tg3_reset_hw(struct tg3 *tp) | |||
5452 | udelay(100); | 5503 | udelay(100); |
5453 | 5504 | ||
5454 | tw32_mailbox(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW, 0); | 5505 | tw32_mailbox(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW, 0); |
5455 | tr32(MAILBOX_INTERRUPT_0); | 5506 | tr32(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW); |
5507 | tp->last_tag = 0; | ||
5456 | 5508 | ||
5457 | if (!(tp->tg3_flags2 & TG3_FLG2_5705_PLUS)) { | 5509 | if (!(tp->tg3_flags2 & TG3_FLG2_5705_PLUS)) { |
5458 | tw32_f(DMAC_MODE, DMAC_MODE_ENABLE); | 5510 | tw32_f(DMAC_MODE, DMAC_MODE_ENABLE); |
@@ -5730,31 +5782,33 @@ static void tg3_timer(unsigned long __opaque) | |||
5730 | spin_lock_irqsave(&tp->lock, flags); | 5782 | spin_lock_irqsave(&tp->lock, flags); |
5731 | spin_lock(&tp->tx_lock); | 5783 | spin_lock(&tp->tx_lock); |
5732 | 5784 | ||
5733 | /* All of this garbage is because when using non-tagged | 5785 | if (!(tp->tg3_flags & TG3_FLAG_TAGGED_STATUS)) { |
5734 | * IRQ status the mailbox/status_block protocol the chip | 5786 | /* All of this garbage is because when using non-tagged |
5735 | * uses with the cpu is race prone. | 5787 | * IRQ status the mailbox/status_block protocol the chip |
5736 | */ | 5788 | * uses with the cpu is race prone. |
5737 | if (tp->hw_status->status & SD_STATUS_UPDATED) { | 5789 | */ |
5738 | tw32(GRC_LOCAL_CTRL, | 5790 | if (tp->hw_status->status & SD_STATUS_UPDATED) { |
5739 | tp->grc_local_ctrl | GRC_LCLCTRL_SETINT); | 5791 | tw32(GRC_LOCAL_CTRL, |
5740 | } else { | 5792 | tp->grc_local_ctrl | GRC_LCLCTRL_SETINT); |
5741 | tw32(HOSTCC_MODE, tp->coalesce_mode | | 5793 | } else { |
5742 | (HOSTCC_MODE_ENABLE | HOSTCC_MODE_NOW)); | 5794 | tw32(HOSTCC_MODE, tp->coalesce_mode | |
5743 | } | 5795 | (HOSTCC_MODE_ENABLE | HOSTCC_MODE_NOW)); |
5796 | } | ||
5744 | 5797 | ||
5745 | if (!(tr32(WDMAC_MODE) & WDMAC_MODE_ENABLE)) { | 5798 | if (!(tr32(WDMAC_MODE) & WDMAC_MODE_ENABLE)) { |
5746 | tp->tg3_flags2 |= TG3_FLG2_RESTART_TIMER; | 5799 | tp->tg3_flags2 |= TG3_FLG2_RESTART_TIMER; |
5747 | spin_unlock(&tp->tx_lock); | 5800 | spin_unlock(&tp->tx_lock); |
5748 | spin_unlock_irqrestore(&tp->lock, flags); | 5801 | spin_unlock_irqrestore(&tp->lock, flags); |
5749 | schedule_work(&tp->reset_task); | 5802 | schedule_work(&tp->reset_task); |
5750 | return; | 5803 | return; |
5804 | } | ||
5751 | } | 5805 | } |
5752 | 5806 | ||
5753 | if (tp->tg3_flags2 & TG3_FLG2_5705_PLUS) | ||
5754 | tg3_periodic_fetch_stats(tp); | ||
5755 | |||
5756 | /* This part only runs once per second. */ | 5807 | /* This part only runs once per second. */ |
5757 | if (!--tp->timer_counter) { | 5808 | if (!--tp->timer_counter) { |
5809 | if (tp->tg3_flags2 & TG3_FLG2_5705_PLUS) | ||
5810 | tg3_periodic_fetch_stats(tp); | ||
5811 | |||
5758 | if (tp->tg3_flags & TG3_FLAG_USE_LINKCHG_REG) { | 5812 | if (tp->tg3_flags & TG3_FLAG_USE_LINKCHG_REG) { |
5759 | u32 mac_stat; | 5813 | u32 mac_stat; |
5760 | int phy_event; | 5814 | int phy_event; |
@@ -5853,9 +5907,13 @@ static int tg3_test_interrupt(struct tg3 *tp) | |||
5853 | if (tp->tg3_flags2 & TG3_FLG2_USING_MSI) | 5907 | if (tp->tg3_flags2 & TG3_FLG2_USING_MSI) |
5854 | err = request_irq(tp->pdev->irq, tg3_msi, | 5908 | err = request_irq(tp->pdev->irq, tg3_msi, |
5855 | SA_SAMPLE_RANDOM, dev->name, dev); | 5909 | SA_SAMPLE_RANDOM, dev->name, dev); |
5856 | else | 5910 | else { |
5857 | err = request_irq(tp->pdev->irq, tg3_interrupt, | 5911 | irqreturn_t (*fn)(int, void *, struct pt_regs *)=tg3_interrupt; |
5912 | if (tp->tg3_flags & TG3_FLAG_TAGGED_STATUS) | ||
5913 | fn = tg3_interrupt_tagged; | ||
5914 | err = request_irq(tp->pdev->irq, fn, | ||
5858 | SA_SHIRQ | SA_SAMPLE_RANDOM, dev->name, dev); | 5915 | SA_SHIRQ | SA_SAMPLE_RANDOM, dev->name, dev); |
5916 | } | ||
5859 | 5917 | ||
5860 | if (err) | 5918 | if (err) |
5861 | return err; | 5919 | return err; |
@@ -5907,9 +5965,14 @@ static int tg3_test_msi(struct tg3 *tp) | |||
5907 | 5965 | ||
5908 | tp->tg3_flags2 &= ~TG3_FLG2_USING_MSI; | 5966 | tp->tg3_flags2 &= ~TG3_FLG2_USING_MSI; |
5909 | 5967 | ||
5910 | err = request_irq(tp->pdev->irq, tg3_interrupt, | 5968 | { |
5911 | SA_SHIRQ | SA_SAMPLE_RANDOM, dev->name, dev); | 5969 | irqreturn_t (*fn)(int, void *, struct pt_regs *)=tg3_interrupt; |
5970 | if (tp->tg3_flags & TG3_FLAG_TAGGED_STATUS) | ||
5971 | fn = tg3_interrupt_tagged; | ||
5912 | 5972 | ||
5973 | err = request_irq(tp->pdev->irq, fn, | ||
5974 | SA_SHIRQ | SA_SAMPLE_RANDOM, dev->name, dev); | ||
5975 | } | ||
5913 | if (err) | 5976 | if (err) |
5914 | return err; | 5977 | return err; |
5915 | 5978 | ||
@@ -5919,7 +5982,7 @@ static int tg3_test_msi(struct tg3 *tp) | |||
5919 | spin_lock_irq(&tp->lock); | 5982 | spin_lock_irq(&tp->lock); |
5920 | spin_lock(&tp->tx_lock); | 5983 | spin_lock(&tp->tx_lock); |
5921 | 5984 | ||
5922 | tg3_halt(tp); | 5985 | tg3_halt(tp, 1); |
5923 | err = tg3_init_hw(tp); | 5986 | err = tg3_init_hw(tp); |
5924 | 5987 | ||
5925 | spin_unlock(&tp->tx_lock); | 5988 | spin_unlock(&tp->tx_lock); |
@@ -5955,7 +6018,13 @@ static int tg3_open(struct net_device *dev) | |||
5955 | if ((tp->tg3_flags2 & TG3_FLG2_5750_PLUS) && | 6018 | if ((tp->tg3_flags2 & TG3_FLG2_5750_PLUS) && |
5956 | (GET_CHIP_REV(tp->pci_chip_rev_id) != CHIPREV_5750_AX) && | 6019 | (GET_CHIP_REV(tp->pci_chip_rev_id) != CHIPREV_5750_AX) && |
5957 | (GET_CHIP_REV(tp->pci_chip_rev_id) != CHIPREV_5750_BX)) { | 6020 | (GET_CHIP_REV(tp->pci_chip_rev_id) != CHIPREV_5750_BX)) { |
5958 | if (pci_enable_msi(tp->pdev) == 0) { | 6021 | /* All MSI supporting chips should support tagged |
6022 | * status. Assert that this is the case. | ||
6023 | */ | ||
6024 | if (!(tp->tg3_flags & TG3_FLAG_TAGGED_STATUS)) { | ||
6025 | printk(KERN_WARNING PFX "%s: MSI without TAGGED? " | ||
6026 | "Not using MSI.\n", tp->dev->name); | ||
6027 | } else if (pci_enable_msi(tp->pdev) == 0) { | ||
5959 | u32 msi_mode; | 6028 | u32 msi_mode; |
5960 | 6029 | ||
5961 | msi_mode = tr32(MSGINT_MODE); | 6030 | msi_mode = tr32(MSGINT_MODE); |
@@ -5966,9 +6035,14 @@ static int tg3_open(struct net_device *dev) | |||
5966 | if (tp->tg3_flags2 & TG3_FLG2_USING_MSI) | 6035 | if (tp->tg3_flags2 & TG3_FLG2_USING_MSI) |
5967 | err = request_irq(tp->pdev->irq, tg3_msi, | 6036 | err = request_irq(tp->pdev->irq, tg3_msi, |
5968 | SA_SAMPLE_RANDOM, dev->name, dev); | 6037 | SA_SAMPLE_RANDOM, dev->name, dev); |
5969 | else | 6038 | else { |
5970 | err = request_irq(tp->pdev->irq, tg3_interrupt, | 6039 | irqreturn_t (*fn)(int, void *, struct pt_regs *)=tg3_interrupt; |
6040 | if (tp->tg3_flags & TG3_FLAG_TAGGED_STATUS) | ||
6041 | fn = tg3_interrupt_tagged; | ||
6042 | |||
6043 | err = request_irq(tp->pdev->irq, fn, | ||
5971 | SA_SHIRQ | SA_SAMPLE_RANDOM, dev->name, dev); | 6044 | SA_SHIRQ | SA_SAMPLE_RANDOM, dev->name, dev); |
6045 | } | ||
5972 | 6046 | ||
5973 | if (err) { | 6047 | if (err) { |
5974 | if (tp->tg3_flags2 & TG3_FLG2_USING_MSI) { | 6048 | if (tp->tg3_flags2 & TG3_FLG2_USING_MSI) { |
@@ -5984,12 +6058,19 @@ static int tg3_open(struct net_device *dev) | |||
5984 | 6058 | ||
5985 | err = tg3_init_hw(tp); | 6059 | err = tg3_init_hw(tp); |
5986 | if (err) { | 6060 | if (err) { |
5987 | tg3_halt(tp); | 6061 | tg3_halt(tp, 1); |
5988 | tg3_free_rings(tp); | 6062 | tg3_free_rings(tp); |
5989 | } else { | 6063 | } else { |
5990 | tp->timer_offset = HZ / 10; | 6064 | if (tp->tg3_flags & TG3_FLAG_TAGGED_STATUS) |
5991 | tp->timer_counter = tp->timer_multiplier = 10; | 6065 | tp->timer_offset = HZ; |
5992 | tp->asf_counter = tp->asf_multiplier = (10 * 120); | 6066 | else |
6067 | tp->timer_offset = HZ / 10; | ||
6068 | |||
6069 | BUG_ON(tp->timer_offset > HZ); | ||
6070 | tp->timer_counter = tp->timer_multiplier = | ||
6071 | (HZ / tp->timer_offset); | ||
6072 | tp->asf_counter = tp->asf_multiplier = | ||
6073 | ((HZ / tp->timer_offset) * 120); | ||
5993 | 6074 | ||
5994 | init_timer(&tp->timer); | 6075 | init_timer(&tp->timer); |
5995 | tp->timer.expires = jiffies + tp->timer_offset; | 6076 | tp->timer.expires = jiffies + tp->timer_offset; |
@@ -6012,6 +6093,7 @@ static int tg3_open(struct net_device *dev) | |||
6012 | 6093 | ||
6013 | if (tp->tg3_flags2 & TG3_FLG2_USING_MSI) { | 6094 | if (tp->tg3_flags2 & TG3_FLG2_USING_MSI) { |
6014 | err = tg3_test_msi(tp); | 6095 | err = tg3_test_msi(tp); |
6096 | |||
6015 | if (err) { | 6097 | if (err) { |
6016 | spin_lock_irq(&tp->lock); | 6098 | spin_lock_irq(&tp->lock); |
6017 | spin_lock(&tp->tx_lock); | 6099 | spin_lock(&tp->tx_lock); |
@@ -6020,7 +6102,7 @@ static int tg3_open(struct net_device *dev) | |||
6020 | pci_disable_msi(tp->pdev); | 6102 | pci_disable_msi(tp->pdev); |
6021 | tp->tg3_flags2 &= ~TG3_FLG2_USING_MSI; | 6103 | tp->tg3_flags2 &= ~TG3_FLG2_USING_MSI; |
6022 | } | 6104 | } |
6023 | tg3_halt(tp); | 6105 | tg3_halt(tp, 1); |
6024 | tg3_free_rings(tp); | 6106 | tg3_free_rings(tp); |
6025 | tg3_free_consistent(tp); | 6107 | tg3_free_consistent(tp); |
6026 | 6108 | ||
@@ -6293,7 +6375,7 @@ static int tg3_close(struct net_device *dev) | |||
6293 | 6375 | ||
6294 | tg3_disable_ints(tp); | 6376 | tg3_disable_ints(tp); |
6295 | 6377 | ||
6296 | tg3_halt(tp); | 6378 | tg3_halt(tp, 1); |
6297 | tg3_free_rings(tp); | 6379 | tg3_free_rings(tp); |
6298 | tp->tg3_flags &= | 6380 | tp->tg3_flags &= |
6299 | ~(TG3_FLAG_INIT_COMPLETE | | 6381 | ~(TG3_FLAG_INIT_COMPLETE | |
@@ -7013,7 +7095,7 @@ static int tg3_set_ringparam(struct net_device *dev, struct ethtool_ringparam *e | |||
7013 | tp->tx_pending = ering->tx_pending; | 7095 | tp->tx_pending = ering->tx_pending; |
7014 | 7096 | ||
7015 | if (netif_running(dev)) { | 7097 | if (netif_running(dev)) { |
7016 | tg3_halt(tp); | 7098 | tg3_halt(tp, 1); |
7017 | tg3_init_hw(tp); | 7099 | tg3_init_hw(tp); |
7018 | tg3_netif_start(tp); | 7100 | tg3_netif_start(tp); |
7019 | } | 7101 | } |
@@ -7056,7 +7138,7 @@ static int tg3_set_pauseparam(struct net_device *dev, struct ethtool_pauseparam | |||
7056 | tp->tg3_flags &= ~TG3_FLAG_TX_PAUSE; | 7138 | tp->tg3_flags &= ~TG3_FLAG_TX_PAUSE; |
7057 | 7139 | ||
7058 | if (netif_running(dev)) { | 7140 | if (netif_running(dev)) { |
7059 | tg3_halt(tp); | 7141 | tg3_halt(tp, 1); |
7060 | tg3_init_hw(tp); | 7142 | tg3_init_hw(tp); |
7061 | tg3_netif_start(tp); | 7143 | tg3_netif_start(tp); |
7062 | } | 7144 | } |
@@ -7210,6 +7292,14 @@ static void tg3_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid) | |||
7210 | } | 7292 | } |
7211 | #endif | 7293 | #endif |
7212 | 7294 | ||
7295 | static int tg3_get_coalesce(struct net_device *dev, struct ethtool_coalesce *ec) | ||
7296 | { | ||
7297 | struct tg3 *tp = netdev_priv(dev); | ||
7298 | |||
7299 | memcpy(ec, &tp->coal, sizeof(*ec)); | ||
7300 | return 0; | ||
7301 | } | ||
7302 | |||
7213 | static struct ethtool_ops tg3_ethtool_ops = { | 7303 | static struct ethtool_ops tg3_ethtool_ops = { |
7214 | .get_settings = tg3_get_settings, | 7304 | .get_settings = tg3_get_settings, |
7215 | .set_settings = tg3_set_settings, | 7305 | .set_settings = tg3_set_settings, |
@@ -7242,6 +7332,7 @@ static struct ethtool_ops tg3_ethtool_ops = { | |||
7242 | .get_strings = tg3_get_strings, | 7332 | .get_strings = tg3_get_strings, |
7243 | .get_stats_count = tg3_get_stats_count, | 7333 | .get_stats_count = tg3_get_stats_count, |
7244 | .get_ethtool_stats = tg3_get_ethtool_stats, | 7334 | .get_ethtool_stats = tg3_get_ethtool_stats, |
7335 | .get_coalesce = tg3_get_coalesce, | ||
7245 | }; | 7336 | }; |
7246 | 7337 | ||
7247 | static void __devinit tg3_get_eeprom_size(struct tg3 *tp) | 7338 | static void __devinit tg3_get_eeprom_size(struct tg3 *tp) |
@@ -8429,15 +8520,7 @@ static int __devinit tg3_get_invariants(struct tg3 *tp) | |||
8429 | if (tp->tg3_flags2 & TG3_FLG2_5705_PLUS) | 8520 | if (tp->tg3_flags2 & TG3_FLG2_5705_PLUS) |
8430 | tp->tg3_flags2 |= TG3_FLG2_PHY_BER_BUG; | 8521 | tp->tg3_flags2 |= TG3_FLG2_PHY_BER_BUG; |
8431 | 8522 | ||
8432 | /* Only 5701 and later support tagged irq status mode. | ||
8433 | * Also, 5788 chips cannot use tagged irq status. | ||
8434 | * | ||
8435 | * However, since we are using NAPI avoid tagged irq status | ||
8436 | * because the interrupt condition is more difficult to | ||
8437 | * fully clear in that mode. | ||
8438 | */ | ||
8439 | tp->coalesce_mode = 0; | 8523 | tp->coalesce_mode = 0; |
8440 | |||
8441 | if (GET_CHIP_REV(tp->pci_chip_rev_id) != CHIPREV_5700_AX && | 8524 | if (GET_CHIP_REV(tp->pci_chip_rev_id) != CHIPREV_5700_AX && |
8442 | GET_CHIP_REV(tp->pci_chip_rev_id) != CHIPREV_5700_BX) | 8525 | GET_CHIP_REV(tp->pci_chip_rev_id) != CHIPREV_5700_BX) |
8443 | tp->coalesce_mode |= HOSTCC_MODE_32BYTE; | 8526 | tp->coalesce_mode |= HOSTCC_MODE_32BYTE; |
@@ -8501,6 +8584,18 @@ static int __devinit tg3_get_invariants(struct tg3 *tp) | |||
8501 | grc_misc_cfg == GRC_MISC_CFG_BOARD_ID_5788M)) | 8584 | grc_misc_cfg == GRC_MISC_CFG_BOARD_ID_5788M)) |
8502 | tp->tg3_flags2 |= TG3_FLG2_IS_5788; | 8585 | tp->tg3_flags2 |= TG3_FLG2_IS_5788; |
8503 | 8586 | ||
8587 | if (!(tp->tg3_flags2 & TG3_FLG2_IS_5788) && | ||
8588 | (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5700)) | ||
8589 | tp->tg3_flags |= TG3_FLAG_TAGGED_STATUS; | ||
8590 | if (tp->tg3_flags & TG3_FLAG_TAGGED_STATUS) { | ||
8591 | tp->coalesce_mode |= (HOSTCC_MODE_CLRTICK_RXBD | | ||
8592 | HOSTCC_MODE_CLRTICK_TXBD); | ||
8593 | |||
8594 | tp->misc_host_ctrl |= MISC_HOST_CTRL_TAGGED_STATUS; | ||
8595 | pci_write_config_dword(tp->pdev, TG3PCI_MISC_HOST_CTRL, | ||
8596 | tp->misc_host_ctrl); | ||
8597 | } | ||
8598 | |||
8504 | /* these are limited to 10/100 only */ | 8599 | /* these are limited to 10/100 only */ |
8505 | if ((GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5703 && | 8600 | if ((GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5703 && |
8506 | (grc_misc_cfg == 0x8000 || grc_misc_cfg == 0x4000)) || | 8601 | (grc_misc_cfg == 0x8000 || grc_misc_cfg == 0x4000)) || |
@@ -8678,6 +8773,146 @@ static int __devinit tg3_get_device_address(struct tg3 *tp) | |||
8678 | return 0; | 8773 | return 0; |
8679 | } | 8774 | } |
8680 | 8775 | ||
8776 | #define BOUNDARY_SINGLE_CACHELINE 1 | ||
8777 | #define BOUNDARY_MULTI_CACHELINE 2 | ||
8778 | |||
8779 | static u32 __devinit tg3_calc_dma_bndry(struct tg3 *tp, u32 val) | ||
8780 | { | ||
8781 | int cacheline_size; | ||
8782 | u8 byte; | ||
8783 | int goal; | ||
8784 | |||
8785 | pci_read_config_byte(tp->pdev, PCI_CACHE_LINE_SIZE, &byte); | ||
8786 | if (byte == 0) | ||
8787 | cacheline_size = 1024; | ||
8788 | else | ||
8789 | cacheline_size = (int) byte * 4; | ||
8790 | |||
8791 | /* On 5703 and later chips, the boundary bits have no | ||
8792 | * effect. | ||
8793 | */ | ||
8794 | if (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5700 && | ||
8795 | GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5701 && | ||
8796 | !(tp->tg3_flags2 & TG3_FLG2_PCI_EXPRESS)) | ||
8797 | goto out; | ||
8798 | |||
8799 | #if defined(CONFIG_PPC64) || defined(CONFIG_IA64) || defined(CONFIG_PARISC) | ||
8800 | goal = BOUNDARY_MULTI_CACHELINE; | ||
8801 | #else | ||
8802 | #if defined(CONFIG_SPARC64) || defined(CONFIG_ALPHA) | ||
8803 | goal = BOUNDARY_SINGLE_CACHELINE; | ||
8804 | #else | ||
8805 | goal = 0; | ||
8806 | #endif | ||
8807 | #endif | ||
8808 | |||
8809 | if (!goal) | ||
8810 | goto out; | ||
8811 | |||
8812 | /* PCI controllers on most RISC systems tend to disconnect | ||
8813 | * when a device tries to burst across a cache-line boundary. | ||
8814 | * Therefore, letting tg3 do so just wastes PCI bandwidth. | ||
8815 | * | ||
8816 | * Unfortunately, for PCI-E there are only limited | ||
8817 | * write-side controls for this, and thus for reads | ||
8818 | * we will still get the disconnects. We'll also waste | ||
8819 | * these PCI cycles for both read and write for chips | ||
8820 | * other than 5700 and 5701 which do not implement the | ||
8821 | * boundary bits. | ||
8822 | */ | ||
8823 | if ((tp->tg3_flags & TG3_FLAG_PCIX_MODE) && | ||
8824 | !(tp->tg3_flags2 & TG3_FLG2_PCI_EXPRESS)) { | ||
8825 | switch (cacheline_size) { | ||
8826 | case 16: | ||
8827 | case 32: | ||
8828 | case 64: | ||
8829 | case 128: | ||
8830 | if (goal == BOUNDARY_SINGLE_CACHELINE) { | ||
8831 | val |= (DMA_RWCTRL_READ_BNDRY_128_PCIX | | ||
8832 | DMA_RWCTRL_WRITE_BNDRY_128_PCIX); | ||
8833 | } else { | ||
8834 | val |= (DMA_RWCTRL_READ_BNDRY_384_PCIX | | ||
8835 | DMA_RWCTRL_WRITE_BNDRY_384_PCIX); | ||
8836 | } | ||
8837 | break; | ||
8838 | |||
8839 | case 256: | ||
8840 | val |= (DMA_RWCTRL_READ_BNDRY_256_PCIX | | ||
8841 | DMA_RWCTRL_WRITE_BNDRY_256_PCIX); | ||
8842 | break; | ||
8843 | |||
8844 | default: | ||
8845 | val |= (DMA_RWCTRL_READ_BNDRY_384_PCIX | | ||
8846 | DMA_RWCTRL_WRITE_BNDRY_384_PCIX); | ||
8847 | break; | ||
8848 | }; | ||
8849 | } else if (tp->tg3_flags2 & TG3_FLG2_PCI_EXPRESS) { | ||
8850 | switch (cacheline_size) { | ||
8851 | case 16: | ||
8852 | case 32: | ||
8853 | case 64: | ||
8854 | if (goal == BOUNDARY_SINGLE_CACHELINE) { | ||
8855 | val &= ~DMA_RWCTRL_WRITE_BNDRY_DISAB_PCIE; | ||
8856 | val |= DMA_RWCTRL_WRITE_BNDRY_64_PCIE; | ||
8857 | break; | ||
8858 | } | ||
8859 | /* fallthrough */ | ||
8860 | case 128: | ||
8861 | default: | ||
8862 | val &= ~DMA_RWCTRL_WRITE_BNDRY_DISAB_PCIE; | ||
8863 | val |= DMA_RWCTRL_WRITE_BNDRY_128_PCIE; | ||
8864 | break; | ||
8865 | }; | ||
8866 | } else { | ||
8867 | switch (cacheline_size) { | ||
8868 | case 16: | ||
8869 | if (goal == BOUNDARY_SINGLE_CACHELINE) { | ||
8870 | val |= (DMA_RWCTRL_READ_BNDRY_16 | | ||
8871 | DMA_RWCTRL_WRITE_BNDRY_16); | ||
8872 | break; | ||
8873 | } | ||
8874 | /* fallthrough */ | ||
8875 | case 32: | ||
8876 | if (goal == BOUNDARY_SINGLE_CACHELINE) { | ||
8877 | val |= (DMA_RWCTRL_READ_BNDRY_32 | | ||
8878 | DMA_RWCTRL_WRITE_BNDRY_32); | ||
8879 | break; | ||
8880 | } | ||
8881 | /* fallthrough */ | ||
8882 | case 64: | ||
8883 | if (goal == BOUNDARY_SINGLE_CACHELINE) { | ||
8884 | val |= (DMA_RWCTRL_READ_BNDRY_64 | | ||
8885 | DMA_RWCTRL_WRITE_BNDRY_64); | ||
8886 | break; | ||
8887 | } | ||
8888 | /* fallthrough */ | ||
8889 | case 128: | ||
8890 | if (goal == BOUNDARY_SINGLE_CACHELINE) { | ||
8891 | val |= (DMA_RWCTRL_READ_BNDRY_128 | | ||
8892 | DMA_RWCTRL_WRITE_BNDRY_128); | ||
8893 | break; | ||
8894 | } | ||
8895 | /* fallthrough */ | ||
8896 | case 256: | ||
8897 | val |= (DMA_RWCTRL_READ_BNDRY_256 | | ||
8898 | DMA_RWCTRL_WRITE_BNDRY_256); | ||
8899 | break; | ||
8900 | case 512: | ||
8901 | val |= (DMA_RWCTRL_READ_BNDRY_512 | | ||
8902 | DMA_RWCTRL_WRITE_BNDRY_512); | ||
8903 | break; | ||
8904 | case 1024: | ||
8905 | default: | ||
8906 | val |= (DMA_RWCTRL_READ_BNDRY_1024 | | ||
8907 | DMA_RWCTRL_WRITE_BNDRY_1024); | ||
8908 | break; | ||
8909 | }; | ||
8910 | } | ||
8911 | |||
8912 | out: | ||
8913 | return val; | ||
8914 | } | ||
8915 | |||
8681 | static int __devinit tg3_do_test_dma(struct tg3 *tp, u32 *buf, dma_addr_t buf_dma, int size, int to_device) | 8916 | static int __devinit tg3_do_test_dma(struct tg3 *tp, u32 *buf, dma_addr_t buf_dma, int size, int to_device) |
8682 | { | 8917 | { |
8683 | struct tg3_internal_buffer_desc test_desc; | 8918 | struct tg3_internal_buffer_desc test_desc; |
@@ -8764,7 +8999,7 @@ static int __devinit tg3_do_test_dma(struct tg3 *tp, u32 *buf, dma_addr_t buf_dm | |||
8764 | static int __devinit tg3_test_dma(struct tg3 *tp) | 8999 | static int __devinit tg3_test_dma(struct tg3 *tp) |
8765 | { | 9000 | { |
8766 | dma_addr_t buf_dma; | 9001 | dma_addr_t buf_dma; |
8767 | u32 *buf; | 9002 | u32 *buf, saved_dma_rwctrl; |
8768 | int ret; | 9003 | int ret; |
8769 | 9004 | ||
8770 | buf = pci_alloc_consistent(tp->pdev, TEST_BUFFER_SIZE, &buf_dma); | 9005 | buf = pci_alloc_consistent(tp->pdev, TEST_BUFFER_SIZE, &buf_dma); |
@@ -8776,46 +9011,7 @@ static int __devinit tg3_test_dma(struct tg3 *tp) | |||
8776 | tp->dma_rwctrl = ((0x7 << DMA_RWCTRL_PCI_WRITE_CMD_SHIFT) | | 9011 | tp->dma_rwctrl = ((0x7 << DMA_RWCTRL_PCI_WRITE_CMD_SHIFT) | |
8777 | (0x6 << DMA_RWCTRL_PCI_READ_CMD_SHIFT)); | 9012 | (0x6 << DMA_RWCTRL_PCI_READ_CMD_SHIFT)); |
8778 | 9013 | ||
8779 | #ifndef CONFIG_X86 | 9014 | tp->dma_rwctrl = tg3_calc_dma_bndry(tp, tp->dma_rwctrl); |
8780 | { | ||
8781 | u8 byte; | ||
8782 | int cacheline_size; | ||
8783 | pci_read_config_byte(tp->pdev, PCI_CACHE_LINE_SIZE, &byte); | ||
8784 | |||
8785 | if (byte == 0) | ||
8786 | cacheline_size = 1024; | ||
8787 | else | ||
8788 | cacheline_size = (int) byte * 4; | ||
8789 | |||
8790 | switch (cacheline_size) { | ||
8791 | case 16: | ||
8792 | case 32: | ||
8793 | case 64: | ||
8794 | case 128: | ||
8795 | if ((tp->tg3_flags & TG3_FLAG_PCIX_MODE) && | ||
8796 | !(tp->tg3_flags2 & TG3_FLG2_PCI_EXPRESS)) { | ||
8797 | tp->dma_rwctrl |= | ||
8798 | DMA_RWCTRL_WRITE_BNDRY_384_PCIX; | ||
8799 | break; | ||
8800 | } else if (tp->tg3_flags2 & TG3_FLG2_PCI_EXPRESS) { | ||
8801 | tp->dma_rwctrl &= | ||
8802 | ~(DMA_RWCTRL_PCI_WRITE_CMD); | ||
8803 | tp->dma_rwctrl |= | ||
8804 | DMA_RWCTRL_WRITE_BNDRY_128_PCIE; | ||
8805 | break; | ||
8806 | } | ||
8807 | /* fallthrough */ | ||
8808 | case 256: | ||
8809 | if (!(tp->tg3_flags & TG3_FLAG_PCIX_MODE) && | ||
8810 | !(tp->tg3_flags2 & TG3_FLG2_PCI_EXPRESS)) | ||
8811 | tp->dma_rwctrl |= | ||
8812 | DMA_RWCTRL_WRITE_BNDRY_256; | ||
8813 | else if (!(tp->tg3_flags2 & TG3_FLG2_PCI_EXPRESS)) | ||
8814 | tp->dma_rwctrl |= | ||
8815 | DMA_RWCTRL_WRITE_BNDRY_256_PCIX; | ||
8816 | }; | ||
8817 | } | ||
8818 | #endif | ||
8819 | 9015 | ||
8820 | if (tp->tg3_flags2 & TG3_FLG2_PCI_EXPRESS) { | 9016 | if (tp->tg3_flags2 & TG3_FLG2_PCI_EXPRESS) { |
8821 | /* DMA read watermark not used on PCIE */ | 9017 | /* DMA read watermark not used on PCIE */ |
@@ -8834,7 +9030,7 @@ static int __devinit tg3_test_dma(struct tg3 *tp) | |||
8834 | if (ccval == 0x6 || ccval == 0x7) | 9030 | if (ccval == 0x6 || ccval == 0x7) |
8835 | tp->dma_rwctrl |= DMA_RWCTRL_ONE_DMA; | 9031 | tp->dma_rwctrl |= DMA_RWCTRL_ONE_DMA; |
8836 | 9032 | ||
8837 | /* Set bit 23 to renable PCIX hw bug fix */ | 9033 | /* Set bit 23 to enable PCIX hw bug fix */ |
8838 | tp->dma_rwctrl |= 0x009f0000; | 9034 | tp->dma_rwctrl |= 0x009f0000; |
8839 | } else { | 9035 | } else { |
8840 | tp->dma_rwctrl |= 0x001b000f; | 9036 | tp->dma_rwctrl |= 0x001b000f; |
@@ -8875,6 +9071,13 @@ static int __devinit tg3_test_dma(struct tg3 *tp) | |||
8875 | GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5701) | 9071 | GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5701) |
8876 | goto out; | 9072 | goto out; |
8877 | 9073 | ||
9074 | /* It is best to perform DMA test with maximum write burst size | ||
9075 | * to expose the 5700/5701 write DMA bug. | ||
9076 | */ | ||
9077 | saved_dma_rwctrl = tp->dma_rwctrl; | ||
9078 | tp->dma_rwctrl &= ~DMA_RWCTRL_WRITE_BNDRY_MASK; | ||
9079 | tw32(TG3PCI_DMA_RW_CTRL, tp->dma_rwctrl); | ||
9080 | |||
8878 | while (1) { | 9081 | while (1) { |
8879 | u32 *p = buf, i; | 9082 | u32 *p = buf, i; |
8880 | 9083 | ||
@@ -8913,8 +9116,9 @@ static int __devinit tg3_test_dma(struct tg3 *tp) | |||
8913 | if (p[i] == i) | 9116 | if (p[i] == i) |
8914 | continue; | 9117 | continue; |
8915 | 9118 | ||
8916 | if ((tp->dma_rwctrl & DMA_RWCTRL_WRITE_BNDRY_MASK) == | 9119 | if ((tp->dma_rwctrl & DMA_RWCTRL_WRITE_BNDRY_MASK) != |
8917 | DMA_RWCTRL_WRITE_BNDRY_DISAB) { | 9120 | DMA_RWCTRL_WRITE_BNDRY_16) { |
9121 | tp->dma_rwctrl &= ~DMA_RWCTRL_WRITE_BNDRY_MASK; | ||
8918 | tp->dma_rwctrl |= DMA_RWCTRL_WRITE_BNDRY_16; | 9122 | tp->dma_rwctrl |= DMA_RWCTRL_WRITE_BNDRY_16; |
8919 | tw32(TG3PCI_DMA_RW_CTRL, tp->dma_rwctrl); | 9123 | tw32(TG3PCI_DMA_RW_CTRL, tp->dma_rwctrl); |
8920 | break; | 9124 | break; |
@@ -8931,6 +9135,14 @@ static int __devinit tg3_test_dma(struct tg3 *tp) | |||
8931 | break; | 9135 | break; |
8932 | } | 9136 | } |
8933 | } | 9137 | } |
9138 | if ((tp->dma_rwctrl & DMA_RWCTRL_WRITE_BNDRY_MASK) != | ||
9139 | DMA_RWCTRL_WRITE_BNDRY_16) { | ||
9140 | /* DMA test passed without adjusting DMA boundary, | ||
9141 | * just restore the calculated DMA boundary | ||
9142 | */ | ||
9143 | tp->dma_rwctrl = saved_dma_rwctrl; | ||
9144 | tw32(TG3PCI_DMA_RW_CTRL, tp->dma_rwctrl); | ||
9145 | } | ||
8934 | 9146 | ||
8935 | out: | 9147 | out: |
8936 | pci_free_consistent(tp->pdev, TEST_BUFFER_SIZE, buf, buf_dma); | 9148 | pci_free_consistent(tp->pdev, TEST_BUFFER_SIZE, buf, buf_dma); |
@@ -9018,6 +9230,31 @@ static struct pci_dev * __devinit tg3_find_5704_peer(struct tg3 *tp) | |||
9018 | return peer; | 9230 | return peer; |
9019 | } | 9231 | } |
9020 | 9232 | ||
9233 | static void __devinit tg3_init_coal(struct tg3 *tp) | ||
9234 | { | ||
9235 | struct ethtool_coalesce *ec = &tp->coal; | ||
9236 | |||
9237 | memset(ec, 0, sizeof(*ec)); | ||
9238 | ec->cmd = ETHTOOL_GCOALESCE; | ||
9239 | ec->rx_coalesce_usecs = LOW_RXCOL_TICKS; | ||
9240 | ec->tx_coalesce_usecs = LOW_TXCOL_TICKS; | ||
9241 | ec->rx_max_coalesced_frames = LOW_RXMAX_FRAMES; | ||
9242 | ec->tx_max_coalesced_frames = LOW_TXMAX_FRAMES; | ||
9243 | ec->rx_coalesce_usecs_irq = DEFAULT_RXCOAL_TICK_INT; | ||
9244 | ec->tx_coalesce_usecs_irq = DEFAULT_TXCOAL_TICK_INT; | ||
9245 | ec->rx_max_coalesced_frames_irq = DEFAULT_RXCOAL_MAXF_INT; | ||
9246 | ec->tx_max_coalesced_frames_irq = DEFAULT_TXCOAL_MAXF_INT; | ||
9247 | ec->stats_block_coalesce_usecs = DEFAULT_STAT_COAL_TICKS; | ||
9248 | |||
9249 | if (tp->coalesce_mode & (HOSTCC_MODE_CLRTICK_RXBD | | ||
9250 | HOSTCC_MODE_CLRTICK_TXBD)) { | ||
9251 | ec->rx_coalesce_usecs = LOW_RXCOL_TICKS_CLRTCKS; | ||
9252 | ec->rx_coalesce_usecs_irq = DEFAULT_RXCOAL_TICK_INT_CLRTCKS; | ||
9253 | ec->tx_coalesce_usecs = LOW_TXCOL_TICKS_CLRTCKS; | ||
9254 | ec->tx_coalesce_usecs_irq = DEFAULT_TXCOAL_TICK_INT_CLRTCKS; | ||
9255 | } | ||
9256 | } | ||
9257 | |||
9021 | static int __devinit tg3_init_one(struct pci_dev *pdev, | 9258 | static int __devinit tg3_init_one(struct pci_dev *pdev, |
9022 | const struct pci_device_id *ent) | 9259 | const struct pci_device_id *ent) |
9023 | { | 9260 | { |
@@ -9239,7 +9476,7 @@ static int __devinit tg3_init_one(struct pci_dev *pdev, | |||
9239 | (tr32(WDMAC_MODE) & WDMAC_MODE_ENABLE)) { | 9476 | (tr32(WDMAC_MODE) & WDMAC_MODE_ENABLE)) { |
9240 | pci_save_state(tp->pdev); | 9477 | pci_save_state(tp->pdev); |
9241 | tw32(MEMARB_MODE, MEMARB_MODE_ENABLE); | 9478 | tw32(MEMARB_MODE, MEMARB_MODE_ENABLE); |
9242 | tg3_halt(tp); | 9479 | tg3_halt(tp, 1); |
9243 | } | 9480 | } |
9244 | 9481 | ||
9245 | err = tg3_test_dma(tp); | 9482 | err = tg3_test_dma(tp); |
@@ -9263,6 +9500,8 @@ static int __devinit tg3_init_one(struct pci_dev *pdev, | |||
9263 | /* flow control autonegotiation is default behavior */ | 9500 | /* flow control autonegotiation is default behavior */ |
9264 | tp->tg3_flags |= TG3_FLAG_PAUSE_AUTONEG; | 9501 | tp->tg3_flags |= TG3_FLAG_PAUSE_AUTONEG; |
9265 | 9502 | ||
9503 | tg3_init_coal(tp); | ||
9504 | |||
9266 | err = register_netdev(dev); | 9505 | err = register_netdev(dev); |
9267 | if (err) { | 9506 | if (err) { |
9268 | printk(KERN_ERR PFX "Cannot register net device, " | 9507 | printk(KERN_ERR PFX "Cannot register net device, " |
@@ -9305,6 +9544,8 @@ static int __devinit tg3_init_one(struct pci_dev *pdev, | |||
9305 | (tp->tg3_flags & TG3_FLAG_SPLIT_MODE) != 0, | 9544 | (tp->tg3_flags & TG3_FLAG_SPLIT_MODE) != 0, |
9306 | (tp->tg3_flags2 & TG3_FLG2_NO_ETH_WIRE_SPEED) == 0, | 9545 | (tp->tg3_flags2 & TG3_FLG2_NO_ETH_WIRE_SPEED) == 0, |
9307 | (tp->tg3_flags2 & TG3_FLG2_TSO_CAPABLE) != 0); | 9546 | (tp->tg3_flags2 & TG3_FLG2_TSO_CAPABLE) != 0); |
9547 | printk(KERN_INFO "%s: dma_rwctrl[%08x]\n", | ||
9548 | dev->name, tp->dma_rwctrl); | ||
9308 | 9549 | ||
9309 | return 0; | 9550 | return 0; |
9310 | 9551 | ||
@@ -9362,7 +9603,7 @@ static int tg3_suspend(struct pci_dev *pdev, pm_message_t state) | |||
9362 | 9603 | ||
9363 | spin_lock_irq(&tp->lock); | 9604 | spin_lock_irq(&tp->lock); |
9364 | spin_lock(&tp->tx_lock); | 9605 | spin_lock(&tp->tx_lock); |
9365 | tg3_halt(tp); | 9606 | tg3_halt(tp, 1); |
9366 | spin_unlock(&tp->tx_lock); | 9607 | spin_unlock(&tp->tx_lock); |
9367 | spin_unlock_irq(&tp->lock); | 9608 | spin_unlock_irq(&tp->lock); |
9368 | 9609 | ||
diff --git a/drivers/net/tg3.h b/drivers/net/tg3.h index 8de6f21037ba..993f84c93dc4 100644 --- a/drivers/net/tg3.h +++ b/drivers/net/tg3.h | |||
@@ -876,10 +876,12 @@ | |||
876 | #define HOSTCC_STATUS_ERROR_ATTN 0x00000004 | 876 | #define HOSTCC_STATUS_ERROR_ATTN 0x00000004 |
877 | #define HOSTCC_RXCOL_TICKS 0x00003c08 | 877 | #define HOSTCC_RXCOL_TICKS 0x00003c08 |
878 | #define LOW_RXCOL_TICKS 0x00000032 | 878 | #define LOW_RXCOL_TICKS 0x00000032 |
879 | #define LOW_RXCOL_TICKS_CLRTCKS 0x00000014 | ||
879 | #define DEFAULT_RXCOL_TICKS 0x00000048 | 880 | #define DEFAULT_RXCOL_TICKS 0x00000048 |
880 | #define HIGH_RXCOL_TICKS 0x00000096 | 881 | #define HIGH_RXCOL_TICKS 0x00000096 |
881 | #define HOSTCC_TXCOL_TICKS 0x00003c0c | 882 | #define HOSTCC_TXCOL_TICKS 0x00003c0c |
882 | #define LOW_TXCOL_TICKS 0x00000096 | 883 | #define LOW_TXCOL_TICKS 0x00000096 |
884 | #define LOW_TXCOL_TICKS_CLRTCKS 0x00000048 | ||
883 | #define DEFAULT_TXCOL_TICKS 0x0000012c | 885 | #define DEFAULT_TXCOL_TICKS 0x0000012c |
884 | #define HIGH_TXCOL_TICKS 0x00000145 | 886 | #define HIGH_TXCOL_TICKS 0x00000145 |
885 | #define HOSTCC_RXMAX_FRAMES 0x00003c10 | 887 | #define HOSTCC_RXMAX_FRAMES 0x00003c10 |
@@ -892,8 +894,10 @@ | |||
892 | #define HIGH_TXMAX_FRAMES 0x00000052 | 894 | #define HIGH_TXMAX_FRAMES 0x00000052 |
893 | #define HOSTCC_RXCOAL_TICK_INT 0x00003c18 | 895 | #define HOSTCC_RXCOAL_TICK_INT 0x00003c18 |
894 | #define DEFAULT_RXCOAL_TICK_INT 0x00000019 | 896 | #define DEFAULT_RXCOAL_TICK_INT 0x00000019 |
897 | #define DEFAULT_RXCOAL_TICK_INT_CLRTCKS 0x00000014 | ||
895 | #define HOSTCC_TXCOAL_TICK_INT 0x00003c1c | 898 | #define HOSTCC_TXCOAL_TICK_INT 0x00003c1c |
896 | #define DEFAULT_TXCOAL_TICK_INT 0x00000019 | 899 | #define DEFAULT_TXCOAL_TICK_INT 0x00000019 |
900 | #define DEFAULT_TXCOAL_TICK_INT_CLRTCKS 0x00000014 | ||
897 | #define HOSTCC_RXCOAL_MAXF_INT 0x00003c20 | 901 | #define HOSTCC_RXCOAL_MAXF_INT 0x00003c20 |
898 | #define DEFAULT_RXCOAL_MAXF_INT 0x00000005 | 902 | #define DEFAULT_RXCOAL_MAXF_INT 0x00000005 |
899 | #define HOSTCC_TXCOAL_MAXF_INT 0x00003c24 | 903 | #define HOSTCC_TXCOAL_MAXF_INT 0x00003c24 |
@@ -2023,6 +2027,7 @@ struct tg3 { | |||
2023 | 2027 | ||
2024 | struct tg3_hw_status *hw_status; | 2028 | struct tg3_hw_status *hw_status; |
2025 | dma_addr_t status_mapping; | 2029 | dma_addr_t status_mapping; |
2030 | u32 last_tag; | ||
2026 | 2031 | ||
2027 | u32 msg_enable; | 2032 | u32 msg_enable; |
2028 | 2033 | ||
@@ -2068,6 +2073,7 @@ struct tg3 { | |||
2068 | 2073 | ||
2069 | u32 rx_offset; | 2074 | u32 rx_offset; |
2070 | u32 tg3_flags; | 2075 | u32 tg3_flags; |
2076 | #define TG3_FLAG_TAGGED_STATUS 0x00000001 | ||
2071 | #define TG3_FLAG_TXD_MBOX_HWBUG 0x00000002 | 2077 | #define TG3_FLAG_TXD_MBOX_HWBUG 0x00000002 |
2072 | #define TG3_FLAG_RX_CHECKSUMS 0x00000004 | 2078 | #define TG3_FLAG_RX_CHECKSUMS 0x00000004 |
2073 | #define TG3_FLAG_USE_LINKCHG_REG 0x00000008 | 2079 | #define TG3_FLAG_USE_LINKCHG_REG 0x00000008 |
@@ -2225,7 +2231,7 @@ struct tg3 { | |||
2225 | 2231 | ||
2226 | #define SST_25VF0X0_PAGE_SIZE 4098 | 2232 | #define SST_25VF0X0_PAGE_SIZE 4098 |
2227 | 2233 | ||
2228 | 2234 | struct ethtool_coalesce coal; | |
2229 | }; | 2235 | }; |
2230 | 2236 | ||
2231 | #endif /* !(_T3_H) */ | 2237 | #endif /* !(_T3_H) */ |
diff --git a/drivers/net/tulip/tulip_core.c b/drivers/net/tulip/tulip_core.c index d098b3ba3538..e0ae3ed6e578 100644 --- a/drivers/net/tulip/tulip_core.c +++ b/drivers/net/tulip/tulip_core.c | |||
@@ -1104,7 +1104,7 @@ static void set_rx_mode(struct net_device *dev) | |||
1104 | if (entry != 0) { | 1104 | if (entry != 0) { |
1105 | /* Avoid a chip errata by prefixing a dummy entry. Don't do | 1105 | /* Avoid a chip errata by prefixing a dummy entry. Don't do |
1106 | this on the ULI526X as it triggers a different problem */ | 1106 | this on the ULI526X as it triggers a different problem */ |
1107 | if (!(tp->chip_id == ULI526X && (tp->revision = 0x40 || tp->revision == 0x50))) { | 1107 | if (!(tp->chip_id == ULI526X && (tp->revision == 0x40 || tp->revision == 0x50))) { |
1108 | tp->tx_buffers[entry].skb = NULL; | 1108 | tp->tx_buffers[entry].skb = NULL; |
1109 | tp->tx_buffers[entry].mapping = 0; | 1109 | tp->tx_buffers[entry].mapping = 0; |
1110 | tp->tx_ring[entry].length = | 1110 | tp->tx_ring[entry].length = |
diff --git a/drivers/net/wireless/Kconfig b/drivers/net/wireless/Kconfig index 0aaa12c0c098..1d3231cc471a 100644 --- a/drivers/net/wireless/Kconfig +++ b/drivers/net/wireless/Kconfig | |||
@@ -323,7 +323,7 @@ config PRISM54 | |||
323 | For a complete list of supported cards visit <http://prism54.org>. | 323 | For a complete list of supported cards visit <http://prism54.org>. |
324 | Here is the latest confirmed list of supported cards: | 324 | Here is the latest confirmed list of supported cards: |
325 | 325 | ||
326 | 3com OfficeConnect 11g Cardbus Card aka 3CRWE154G72 | 326 | 3com OfficeConnect 11g Cardbus Card aka 3CRWE154G72 (version 1) |
327 | Allnet ALL0271 PCI Card | 327 | Allnet ALL0271 PCI Card |
328 | Compex WL54G Cardbus Card | 328 | Compex WL54G Cardbus Card |
329 | Corega CG-WLCB54GT Cardbus Card | 329 | Corega CG-WLCB54GT Cardbus Card |