diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-10-23 14:47:02 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-10-23 14:47:02 -0400 |
commit | 5f05647dd81c11a6a165ccc8f0c1370b16f3bcb0 (patch) | |
tree | 7851ef1c93aa1aba7ef327ca4b75fd35e6d10f29 /drivers/net/tg3.c | |
parent | 02f36038c568111ad4fc433f6fa760ff5e38fab4 (diff) | |
parent | ec37a48d1d16c30b655ac5280209edf52a6775d4 (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6: (1699 commits)
bnx2/bnx2x: Unsupported Ethtool operations should return -EINVAL.
vlan: Calling vlan_hwaccel_do_receive() is always valid.
tproxy: use the interface primary IP address as a default value for --on-ip
tproxy: added IPv6 support to the socket match
cxgb3: function namespace cleanup
tproxy: added IPv6 support to the TPROXY target
tproxy: added IPv6 socket lookup function to nf_tproxy_core
be2net: Changes to use only priority codes allowed by f/w
tproxy: allow non-local binds of IPv6 sockets if IP_TRANSPARENT is enabled
tproxy: added tproxy sockopt interface in the IPV6 layer
tproxy: added udp6_lib_lookup function
tproxy: added const specifiers to udp lookup functions
tproxy: split off ipv6 defragmentation to a separate module
l2tp: small cleanup
nf_nat: restrict ICMP translation for embedded header
can: mcp251x: fix generation of error frames
can: mcp251x: fix endless loop in interrupt handler if CANINTF_MERRF is set
can-raw: add msg_flags to distinguish local traffic
9p: client code cleanup
rds: make local functions/variables static
...
Fix up conflicts in net/core/dev.c, drivers/net/pcmcia/smc91c92_cs.c and
drivers/net/wireless/ath/ath9k/debug.c as per David
Diffstat (limited to 'drivers/net/tg3.c')
-rw-r--r-- | drivers/net/tg3.c | 734 |
1 files changed, 490 insertions, 244 deletions
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c index 1ec4b9e0239a..852e917778f8 100644 --- a/drivers/net/tg3.c +++ b/drivers/net/tg3.c | |||
@@ -69,10 +69,10 @@ | |||
69 | 69 | ||
70 | #define DRV_MODULE_NAME "tg3" | 70 | #define DRV_MODULE_NAME "tg3" |
71 | #define TG3_MAJ_NUM 3 | 71 | #define TG3_MAJ_NUM 3 |
72 | #define TG3_MIN_NUM 113 | 72 | #define TG3_MIN_NUM 115 |
73 | #define DRV_MODULE_VERSION \ | 73 | #define DRV_MODULE_VERSION \ |
74 | __stringify(TG3_MAJ_NUM) "." __stringify(TG3_MIN_NUM) | 74 | __stringify(TG3_MAJ_NUM) "." __stringify(TG3_MIN_NUM) |
75 | #define DRV_MODULE_RELDATE "August 2, 2010" | 75 | #define DRV_MODULE_RELDATE "October 14, 2010" |
76 | 76 | ||
77 | #define TG3_DEF_MAC_MODE 0 | 77 | #define TG3_DEF_MAC_MODE 0 |
78 | #define TG3_DEF_RX_MODE 0 | 78 | #define TG3_DEF_RX_MODE 0 |
@@ -101,9 +101,15 @@ | |||
101 | * You can't change the ring sizes, but you can change where you place | 101 | * You can't change the ring sizes, but you can change where you place |
102 | * them in the NIC onboard memory. | 102 | * them in the NIC onboard memory. |
103 | */ | 103 | */ |
104 | #define TG3_RX_RING_SIZE 512 | 104 | #define TG3_RX_STD_RING_SIZE(tp) \ |
105 | ((GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5717 || \ | ||
106 | GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5719) ? \ | ||
107 | RX_STD_MAX_SIZE_5717 : 512) | ||
105 | #define TG3_DEF_RX_RING_PENDING 200 | 108 | #define TG3_DEF_RX_RING_PENDING 200 |
106 | #define TG3_RX_JUMBO_RING_SIZE 256 | 109 | #define TG3_RX_JMB_RING_SIZE(tp) \ |
110 | ((GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5717 || \ | ||
111 | GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5719) ? \ | ||
112 | 1024 : 256) | ||
107 | #define TG3_DEF_RX_JUMBO_RING_PENDING 100 | 113 | #define TG3_DEF_RX_JUMBO_RING_PENDING 100 |
108 | #define TG3_RSS_INDIR_TBL_SIZE 128 | 114 | #define TG3_RSS_INDIR_TBL_SIZE 128 |
109 | 115 | ||
@@ -113,19 +119,16 @@ | |||
113 | * hw multiply/modulo instructions. Another solution would be to | 119 | * hw multiply/modulo instructions. Another solution would be to |
114 | * replace things like '% foo' with '& (foo - 1)'. | 120 | * replace things like '% foo' with '& (foo - 1)'. |
115 | */ | 121 | */ |
116 | #define TG3_RX_RCB_RING_SIZE(tp) \ | ||
117 | (((tp->tg3_flags & TG3_FLAG_JUMBO_CAPABLE) && \ | ||
118 | !(tp->tg3_flags2 & TG3_FLG2_5780_CLASS)) ? 1024 : 512) | ||
119 | 122 | ||
120 | #define TG3_TX_RING_SIZE 512 | 123 | #define TG3_TX_RING_SIZE 512 |
121 | #define TG3_DEF_TX_RING_PENDING (TG3_TX_RING_SIZE - 1) | 124 | #define TG3_DEF_TX_RING_PENDING (TG3_TX_RING_SIZE - 1) |
122 | 125 | ||
123 | #define TG3_RX_RING_BYTES (sizeof(struct tg3_rx_buffer_desc) * \ | 126 | #define TG3_RX_STD_RING_BYTES(tp) \ |
124 | TG3_RX_RING_SIZE) | 127 | (sizeof(struct tg3_rx_buffer_desc) * TG3_RX_STD_RING_SIZE(tp)) |
125 | #define TG3_RX_JUMBO_RING_BYTES (sizeof(struct tg3_ext_rx_buffer_desc) * \ | 128 | #define TG3_RX_JMB_RING_BYTES(tp) \ |
126 | TG3_RX_JUMBO_RING_SIZE) | 129 | (sizeof(struct tg3_ext_rx_buffer_desc) * TG3_RX_JMB_RING_SIZE(tp)) |
127 | #define TG3_RX_RCB_RING_BYTES(tp) (sizeof(struct tg3_rx_buffer_desc) * \ | 130 | #define TG3_RX_RCB_RING_BYTES(tp) \ |
128 | TG3_RX_RCB_RING_SIZE(tp)) | 131 | (sizeof(struct tg3_rx_buffer_desc) * (tp->rx_ret_ring_mask + 1)) |
129 | #define TG3_TX_RING_BYTES (sizeof(struct tg3_tx_buffer_desc) * \ | 132 | #define TG3_TX_RING_BYTES (sizeof(struct tg3_tx_buffer_desc) * \ |
130 | TG3_TX_RING_SIZE) | 133 | TG3_TX_RING_SIZE) |
131 | #define NEXT_TX(N) (((N) + 1) & (TG3_TX_RING_SIZE - 1)) | 134 | #define NEXT_TX(N) (((N) + 1) & (TG3_TX_RING_SIZE - 1)) |
@@ -143,11 +146,11 @@ | |||
143 | #define TG3_RX_STD_MAP_SZ TG3_RX_DMA_TO_MAP_SZ(TG3_RX_STD_DMA_SZ) | 146 | #define TG3_RX_STD_MAP_SZ TG3_RX_DMA_TO_MAP_SZ(TG3_RX_STD_DMA_SZ) |
144 | #define TG3_RX_JMB_MAP_SZ TG3_RX_DMA_TO_MAP_SZ(TG3_RX_JMB_DMA_SZ) | 147 | #define TG3_RX_JMB_MAP_SZ TG3_RX_DMA_TO_MAP_SZ(TG3_RX_JMB_DMA_SZ) |
145 | 148 | ||
146 | #define TG3_RX_STD_BUFF_RING_SIZE \ | 149 | #define TG3_RX_STD_BUFF_RING_SIZE(tp) \ |
147 | (sizeof(struct ring_info) * TG3_RX_RING_SIZE) | 150 | (sizeof(struct ring_info) * TG3_RX_STD_RING_SIZE(tp)) |
148 | 151 | ||
149 | #define TG3_RX_JMB_BUFF_RING_SIZE \ | 152 | #define TG3_RX_JMB_BUFF_RING_SIZE(tp) \ |
150 | (sizeof(struct ring_info) * TG3_RX_JUMBO_RING_SIZE) | 153 | (sizeof(struct ring_info) * TG3_RX_JMB_RING_SIZE(tp)) |
151 | 154 | ||
152 | /* Due to a hardware bug, the 5701 can only DMA to memory addresses | 155 | /* Due to a hardware bug, the 5701 can only DMA to memory addresses |
153 | * that are at least dword aligned when used in PCIX mode. The driver | 156 | * that are at least dword aligned when used in PCIX mode. The driver |
@@ -264,7 +267,6 @@ static DEFINE_PCI_DEVICE_TABLE(tg3_pci_tbl) = { | |||
264 | {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, TG3PCI_DEVICE_TIGON3_57788)}, | 267 | {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, TG3PCI_DEVICE_TIGON3_57788)}, |
265 | {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, TG3PCI_DEVICE_TIGON3_5717)}, | 268 | {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, TG3PCI_DEVICE_TIGON3_5717)}, |
266 | {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, TG3PCI_DEVICE_TIGON3_5718)}, | 269 | {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, TG3PCI_DEVICE_TIGON3_5718)}, |
267 | {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, TG3PCI_DEVICE_TIGON3_5724)}, | ||
268 | {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, TG3PCI_DEVICE_TIGON3_57781)}, | 270 | {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, TG3PCI_DEVICE_TIGON3_57781)}, |
269 | {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, TG3PCI_DEVICE_TIGON3_57785)}, | 271 | {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, TG3PCI_DEVICE_TIGON3_57785)}, |
270 | {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, TG3PCI_DEVICE_TIGON3_57761)}, | 272 | {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, TG3PCI_DEVICE_TIGON3_57761)}, |
@@ -752,42 +754,6 @@ static void tg3_int_reenable(struct tg3_napi *tnapi) | |||
752 | HOSTCC_MODE_ENABLE | tnapi->coal_now); | 754 | HOSTCC_MODE_ENABLE | tnapi->coal_now); |
753 | } | 755 | } |
754 | 756 | ||
755 | static void tg3_napi_disable(struct tg3 *tp) | ||
756 | { | ||
757 | int i; | ||
758 | |||
759 | for (i = tp->irq_cnt - 1; i >= 0; i--) | ||
760 | napi_disable(&tp->napi[i].napi); | ||
761 | } | ||
762 | |||
763 | static void tg3_napi_enable(struct tg3 *tp) | ||
764 | { | ||
765 | int i; | ||
766 | |||
767 | for (i = 0; i < tp->irq_cnt; i++) | ||
768 | napi_enable(&tp->napi[i].napi); | ||
769 | } | ||
770 | |||
771 | static inline void tg3_netif_stop(struct tg3 *tp) | ||
772 | { | ||
773 | tp->dev->trans_start = jiffies; /* prevent tx timeout */ | ||
774 | tg3_napi_disable(tp); | ||
775 | netif_tx_disable(tp->dev); | ||
776 | } | ||
777 | |||
778 | static inline void tg3_netif_start(struct tg3 *tp) | ||
779 | { | ||
780 | /* NOTE: unconditional netif_tx_wake_all_queues is only | ||
781 | * appropriate so long as all callers are assured to | ||
782 | * have free tx slots (such as after tg3_init_hw) | ||
783 | */ | ||
784 | netif_tx_wake_all_queues(tp->dev); | ||
785 | |||
786 | tg3_napi_enable(tp); | ||
787 | tp->napi[0].hw_status->status |= SD_STATUS_UPDATED; | ||
788 | tg3_enable_ints(tp); | ||
789 | } | ||
790 | |||
791 | static void tg3_switch_clocks(struct tg3 *tp) | 757 | static void tg3_switch_clocks(struct tg3 *tp) |
792 | { | 758 | { |
793 | u32 clock_ctrl; | 759 | u32 clock_ctrl; |
@@ -1196,6 +1162,52 @@ static void tg3_mdio_fini(struct tg3 *tp) | |||
1196 | } | 1162 | } |
1197 | } | 1163 | } |
1198 | 1164 | ||
1165 | static int tg3_phy_cl45_write(struct tg3 *tp, u32 devad, u32 addr, u32 val) | ||
1166 | { | ||
1167 | int err; | ||
1168 | |||
1169 | err = tg3_writephy(tp, MII_TG3_MMD_CTRL, devad); | ||
1170 | if (err) | ||
1171 | goto done; | ||
1172 | |||
1173 | err = tg3_writephy(tp, MII_TG3_MMD_ADDRESS, addr); | ||
1174 | if (err) | ||
1175 | goto done; | ||
1176 | |||
1177 | err = tg3_writephy(tp, MII_TG3_MMD_CTRL, | ||
1178 | MII_TG3_MMD_CTRL_DATA_NOINC | devad); | ||
1179 | if (err) | ||
1180 | goto done; | ||
1181 | |||
1182 | err = tg3_writephy(tp, MII_TG3_MMD_ADDRESS, val); | ||
1183 | |||
1184 | done: | ||
1185 | return err; | ||
1186 | } | ||
1187 | |||
1188 | static int tg3_phy_cl45_read(struct tg3 *tp, u32 devad, u32 addr, u32 *val) | ||
1189 | { | ||
1190 | int err; | ||
1191 | |||
1192 | err = tg3_writephy(tp, MII_TG3_MMD_CTRL, devad); | ||
1193 | if (err) | ||
1194 | goto done; | ||
1195 | |||
1196 | err = tg3_writephy(tp, MII_TG3_MMD_ADDRESS, addr); | ||
1197 | if (err) | ||
1198 | goto done; | ||
1199 | |||
1200 | err = tg3_writephy(tp, MII_TG3_MMD_CTRL, | ||
1201 | MII_TG3_MMD_CTRL_DATA_NOINC | devad); | ||
1202 | if (err) | ||
1203 | goto done; | ||
1204 | |||
1205 | err = tg3_readphy(tp, MII_TG3_MMD_ADDRESS, val); | ||
1206 | |||
1207 | done: | ||
1208 | return err; | ||
1209 | } | ||
1210 | |||
1199 | /* tp->lock is held. */ | 1211 | /* tp->lock is held. */ |
1200 | static inline void tg3_generate_fw_event(struct tg3 *tp) | 1212 | static inline void tg3_generate_fw_event(struct tg3 *tp) |
1201 | { | 1213 | { |
@@ -1572,6 +1584,17 @@ static void tg3_phy_fini(struct tg3 *tp) | |||
1572 | } | 1584 | } |
1573 | } | 1585 | } |
1574 | 1586 | ||
1587 | static int tg3_phydsp_read(struct tg3 *tp, u32 reg, u32 *val) | ||
1588 | { | ||
1589 | int err; | ||
1590 | |||
1591 | err = tg3_writephy(tp, MII_TG3_DSP_ADDRESS, reg); | ||
1592 | if (!err) | ||
1593 | err = tg3_readphy(tp, MII_TG3_DSP_RW_PORT, val); | ||
1594 | |||
1595 | return err; | ||
1596 | } | ||
1597 | |||
1575 | static int tg3_phydsp_write(struct tg3 *tp, u32 reg, u32 val) | 1598 | static int tg3_phydsp_write(struct tg3 *tp, u32 reg, u32 val) |
1576 | { | 1599 | { |
1577 | int err; | 1600 | int err; |
@@ -1735,6 +1758,42 @@ static void tg3_phy_apply_otp(struct tg3 *tp) | |||
1735 | tg3_writephy(tp, MII_TG3_AUX_CTRL, phy); | 1758 | tg3_writephy(tp, MII_TG3_AUX_CTRL, phy); |
1736 | } | 1759 | } |
1737 | 1760 | ||
1761 | static void tg3_phy_eee_adjust(struct tg3 *tp, u32 current_link_up) | ||
1762 | { | ||
1763 | u32 val; | ||
1764 | |||
1765 | if (!(tp->phy_flags & TG3_PHYFLG_EEE_CAP)) | ||
1766 | return; | ||
1767 | |||
1768 | tp->setlpicnt = 0; | ||
1769 | |||
1770 | if (tp->link_config.autoneg == AUTONEG_ENABLE && | ||
1771 | current_link_up == 1 && | ||
1772 | (tp->link_config.active_speed == SPEED_1000 || | ||
1773 | (tp->link_config.active_speed == SPEED_100 && | ||
1774 | tp->link_config.active_duplex == DUPLEX_FULL))) { | ||
1775 | u32 eeectl; | ||
1776 | |||
1777 | if (tp->link_config.active_speed == SPEED_1000) | ||
1778 | eeectl = TG3_CPMU_EEE_CTRL_EXIT_16_5_US; | ||
1779 | else | ||
1780 | eeectl = TG3_CPMU_EEE_CTRL_EXIT_36_US; | ||
1781 | |||
1782 | tw32(TG3_CPMU_EEE_CTRL, eeectl); | ||
1783 | |||
1784 | tg3_phy_cl45_read(tp, 0x7, TG3_CL45_D7_EEERES_STAT, &val); | ||
1785 | |||
1786 | if (val == TG3_CL45_D7_EEERES_STAT_LP_1000T || | ||
1787 | val == TG3_CL45_D7_EEERES_STAT_LP_100TX) | ||
1788 | tp->setlpicnt = 2; | ||
1789 | } | ||
1790 | |||
1791 | if (!tp->setlpicnt) { | ||
1792 | val = tr32(TG3_CPMU_EEE_MODE); | ||
1793 | tw32(TG3_CPMU_EEE_MODE, val & ~TG3_CPMU_EEEMD_LPI_ENABLE); | ||
1794 | } | ||
1795 | } | ||
1796 | |||
1738 | static int tg3_wait_macro_done(struct tg3 *tp) | 1797 | static int tg3_wait_macro_done(struct tg3 *tp) |
1739 | { | 1798 | { |
1740 | int limit = 100; | 1799 | int limit = 100; |
@@ -1917,19 +1976,16 @@ static int tg3_phy_reset_5703_4_5(struct tg3 *tp) | |||
1917 | */ | 1976 | */ |
1918 | static int tg3_phy_reset(struct tg3 *tp) | 1977 | static int tg3_phy_reset(struct tg3 *tp) |
1919 | { | 1978 | { |
1920 | u32 cpmuctrl; | 1979 | u32 val, cpmuctrl; |
1921 | u32 phy_status; | ||
1922 | int err; | 1980 | int err; |
1923 | 1981 | ||
1924 | if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906) { | 1982 | if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906) { |
1925 | u32 val; | ||
1926 | |||
1927 | val = tr32(GRC_MISC_CFG); | 1983 | val = tr32(GRC_MISC_CFG); |
1928 | tw32_f(GRC_MISC_CFG, val & ~GRC_MISC_CFG_EPHY_IDDQ); | 1984 | tw32_f(GRC_MISC_CFG, val & ~GRC_MISC_CFG_EPHY_IDDQ); |
1929 | udelay(40); | 1985 | udelay(40); |
1930 | } | 1986 | } |
1931 | err = tg3_readphy(tp, MII_BMSR, &phy_status); | 1987 | err = tg3_readphy(tp, MII_BMSR, &val); |
1932 | err |= tg3_readphy(tp, MII_BMSR, &phy_status); | 1988 | err |= tg3_readphy(tp, MII_BMSR, &val); |
1933 | if (err != 0) | 1989 | if (err != 0) |
1934 | return -EBUSY; | 1990 | return -EBUSY; |
1935 | 1991 | ||
@@ -1961,18 +2017,14 @@ static int tg3_phy_reset(struct tg3 *tp) | |||
1961 | return err; | 2017 | return err; |
1962 | 2018 | ||
1963 | if (cpmuctrl & CPMU_CTRL_GPHY_10MB_RXONLY) { | 2019 | if (cpmuctrl & CPMU_CTRL_GPHY_10MB_RXONLY) { |
1964 | u32 phy; | 2020 | val = MII_TG3_DSP_EXP8_AEDW | MII_TG3_DSP_EXP8_REJ2MHz; |
1965 | 2021 | tg3_phydsp_write(tp, MII_TG3_DSP_EXP8, val); | |
1966 | phy = MII_TG3_DSP_EXP8_AEDW | MII_TG3_DSP_EXP8_REJ2MHz; | ||
1967 | tg3_phydsp_write(tp, MII_TG3_DSP_EXP8, phy); | ||
1968 | 2022 | ||
1969 | tw32(TG3_CPMU_CTRL, cpmuctrl); | 2023 | tw32(TG3_CPMU_CTRL, cpmuctrl); |
1970 | } | 2024 | } |
1971 | 2025 | ||
1972 | if (GET_CHIP_REV(tp->pci_chip_rev_id) == CHIPREV_5784_AX || | 2026 | if (GET_CHIP_REV(tp->pci_chip_rev_id) == CHIPREV_5784_AX || |
1973 | GET_CHIP_REV(tp->pci_chip_rev_id) == CHIPREV_5761_AX) { | 2027 | GET_CHIP_REV(tp->pci_chip_rev_id) == CHIPREV_5761_AX) { |
1974 | u32 val; | ||
1975 | |||
1976 | val = tr32(TG3_CPMU_LSPD_1000MB_CLK); | 2028 | val = tr32(TG3_CPMU_LSPD_1000MB_CLK); |
1977 | if ((val & CPMU_LSPD_1000MB_MACCLK_MASK) == | 2029 | if ((val & CPMU_LSPD_1000MB_MACCLK_MASK) == |
1978 | CPMU_LSPD_1000MB_MACCLK_12_5) { | 2030 | CPMU_LSPD_1000MB_MACCLK_12_5) { |
@@ -2028,23 +2080,19 @@ out: | |||
2028 | /* Cannot do read-modify-write on 5401 */ | 2080 | /* Cannot do read-modify-write on 5401 */ |
2029 | tg3_writephy(tp, MII_TG3_AUX_CTRL, 0x4c20); | 2081 | tg3_writephy(tp, MII_TG3_AUX_CTRL, 0x4c20); |
2030 | } else if (tp->tg3_flags & TG3_FLAG_JUMBO_CAPABLE) { | 2082 | } else if (tp->tg3_flags & TG3_FLAG_JUMBO_CAPABLE) { |
2031 | u32 phy_reg; | ||
2032 | |||
2033 | /* Set bit 14 with read-modify-write to preserve other bits */ | 2083 | /* Set bit 14 with read-modify-write to preserve other bits */ |
2034 | if (!tg3_writephy(tp, MII_TG3_AUX_CTRL, 0x0007) && | 2084 | if (!tg3_writephy(tp, MII_TG3_AUX_CTRL, 0x0007) && |
2035 | !tg3_readphy(tp, MII_TG3_AUX_CTRL, &phy_reg)) | 2085 | !tg3_readphy(tp, MII_TG3_AUX_CTRL, &val)) |
2036 | tg3_writephy(tp, MII_TG3_AUX_CTRL, phy_reg | 0x4000); | 2086 | tg3_writephy(tp, MII_TG3_AUX_CTRL, val | 0x4000); |
2037 | } | 2087 | } |
2038 | 2088 | ||
2039 | /* Set phy register 0x10 bit 0 to high fifo elasticity to support | 2089 | /* Set phy register 0x10 bit 0 to high fifo elasticity to support |
2040 | * jumbo frames transmission. | 2090 | * jumbo frames transmission. |
2041 | */ | 2091 | */ |
2042 | if (tp->tg3_flags & TG3_FLAG_JUMBO_CAPABLE) { | 2092 | if (tp->tg3_flags & TG3_FLAG_JUMBO_CAPABLE) { |
2043 | u32 phy_reg; | 2093 | if (!tg3_readphy(tp, MII_TG3_EXT_CTRL, &val)) |
2044 | |||
2045 | if (!tg3_readphy(tp, MII_TG3_EXT_CTRL, &phy_reg)) | ||
2046 | tg3_writephy(tp, MII_TG3_EXT_CTRL, | 2094 | tg3_writephy(tp, MII_TG3_EXT_CTRL, |
2047 | phy_reg | MII_TG3_EXT_CTRL_FIFO_ELASTIC); | 2095 | val | MII_TG3_EXT_CTRL_FIFO_ELASTIC); |
2048 | } | 2096 | } |
2049 | 2097 | ||
2050 | if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906) { | 2098 | if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906) { |
@@ -2920,6 +2968,44 @@ static void tg3_phy_copper_begin(struct tg3 *tp) | |||
2920 | tg3_writephy(tp, MII_TG3_CTRL, new_adv); | 2968 | tg3_writephy(tp, MII_TG3_CTRL, new_adv); |
2921 | } | 2969 | } |
2922 | 2970 | ||
2971 | if (tp->phy_flags & TG3_PHYFLG_EEE_CAP) { | ||
2972 | u32 val = 0; | ||
2973 | |||
2974 | tw32(TG3_CPMU_EEE_MODE, | ||
2975 | tr32(TG3_CPMU_EEE_MODE) & ~TG3_CPMU_EEEMD_LPI_ENABLE); | ||
2976 | |||
2977 | /* Enable SM_DSP clock and tx 6dB coding. */ | ||
2978 | val = MII_TG3_AUXCTL_SHDWSEL_AUXCTL | | ||
2979 | MII_TG3_AUXCTL_ACTL_SMDSP_ENA | | ||
2980 | MII_TG3_AUXCTL_ACTL_TX_6DB; | ||
2981 | tg3_writephy(tp, MII_TG3_AUX_CTRL, val); | ||
2982 | |||
2983 | if ((GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5717 || | ||
2984 | GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_57765) && | ||
2985 | !tg3_phydsp_read(tp, MII_TG3_DSP_CH34TP2, &val)) | ||
2986 | tg3_phydsp_write(tp, MII_TG3_DSP_CH34TP2, | ||
2987 | val | MII_TG3_DSP_CH34TP2_HIBW01); | ||
2988 | |||
2989 | if (tp->link_config.autoneg == AUTONEG_ENABLE) { | ||
2990 | /* Advertise 100-BaseTX EEE ability */ | ||
2991 | if (tp->link_config.advertising & | ||
2992 | (ADVERTISED_100baseT_Half | | ||
2993 | ADVERTISED_100baseT_Full)) | ||
2994 | val |= TG3_CL45_D7_EEEADV_CAP_100TX; | ||
2995 | /* Advertise 1000-BaseT EEE ability */ | ||
2996 | if (tp->link_config.advertising & | ||
2997 | (ADVERTISED_1000baseT_Half | | ||
2998 | ADVERTISED_1000baseT_Full)) | ||
2999 | val |= TG3_CL45_D7_EEEADV_CAP_1000T; | ||
3000 | } | ||
3001 | tg3_phy_cl45_write(tp, 0x7, TG3_CL45_D7_EEEADV_CAP, val); | ||
3002 | |||
3003 | /* Turn off SM_DSP clock. */ | ||
3004 | val = MII_TG3_AUXCTL_SHDWSEL_AUXCTL | | ||
3005 | MII_TG3_AUXCTL_ACTL_TX_6DB; | ||
3006 | tg3_writephy(tp, MII_TG3_AUX_CTRL, val); | ||
3007 | } | ||
3008 | |||
2923 | if (tp->link_config.autoneg == AUTONEG_DISABLE && | 3009 | if (tp->link_config.autoneg == AUTONEG_DISABLE && |
2924 | tp->link_config.speed != SPEED_INVALID) { | 3010 | tp->link_config.speed != SPEED_INVALID) { |
2925 | u32 bmcr, orig_bmcr; | 3011 | u32 bmcr, orig_bmcr; |
@@ -3060,7 +3146,7 @@ static int tg3_adv_1000T_flowctrl_ok(struct tg3 *tp, u32 *lcladv, u32 *rmtadv) | |||
3060 | static int tg3_setup_copper_phy(struct tg3 *tp, int force_reset) | 3146 | static int tg3_setup_copper_phy(struct tg3 *tp, int force_reset) |
3061 | { | 3147 | { |
3062 | int current_link_up; | 3148 | int current_link_up; |
3063 | u32 bmsr, dummy; | 3149 | u32 bmsr, val; |
3064 | u32 lcl_adv, rmt_adv; | 3150 | u32 lcl_adv, rmt_adv; |
3065 | u16 current_speed; | 3151 | u16 current_speed; |
3066 | u8 current_duplex; | 3152 | u8 current_duplex; |
@@ -3140,8 +3226,8 @@ static int tg3_setup_copper_phy(struct tg3 *tp, int force_reset) | |||
3140 | } | 3226 | } |
3141 | 3227 | ||
3142 | /* Clear pending interrupts... */ | 3228 | /* Clear pending interrupts... */ |
3143 | tg3_readphy(tp, MII_TG3_ISTAT, &dummy); | 3229 | tg3_readphy(tp, MII_TG3_ISTAT, &val); |
3144 | tg3_readphy(tp, MII_TG3_ISTAT, &dummy); | 3230 | tg3_readphy(tp, MII_TG3_ISTAT, &val); |
3145 | 3231 | ||
3146 | if (tp->phy_flags & TG3_PHYFLG_USE_MI_INTERRUPT) | 3232 | if (tp->phy_flags & TG3_PHYFLG_USE_MI_INTERRUPT) |
3147 | tg3_writephy(tp, MII_TG3_IMASK, ~MII_TG3_INT_LINKCHG); | 3233 | tg3_writephy(tp, MII_TG3_IMASK, ~MII_TG3_INT_LINKCHG); |
@@ -3162,8 +3248,6 @@ static int tg3_setup_copper_phy(struct tg3 *tp, int force_reset) | |||
3162 | current_duplex = DUPLEX_INVALID; | 3248 | current_duplex = DUPLEX_INVALID; |
3163 | 3249 | ||
3164 | if (tp->phy_flags & TG3_PHYFLG_CAPACITIVE_COUPLING) { | 3250 | if (tp->phy_flags & TG3_PHYFLG_CAPACITIVE_COUPLING) { |
3165 | u32 val; | ||
3166 | |||
3167 | tg3_writephy(tp, MII_TG3_AUX_CTRL, 0x4007); | 3251 | tg3_writephy(tp, MII_TG3_AUX_CTRL, 0x4007); |
3168 | tg3_readphy(tp, MII_TG3_AUX_CTRL, &val); | 3252 | tg3_readphy(tp, MII_TG3_AUX_CTRL, &val); |
3169 | if (!(val & (1 << 10))) { | 3253 | if (!(val & (1 << 10))) { |
@@ -3238,13 +3322,11 @@ static int tg3_setup_copper_phy(struct tg3 *tp, int force_reset) | |||
3238 | 3322 | ||
3239 | relink: | 3323 | relink: |
3240 | if (current_link_up == 0 || (tp->phy_flags & TG3_PHYFLG_IS_LOW_POWER)) { | 3324 | if (current_link_up == 0 || (tp->phy_flags & TG3_PHYFLG_IS_LOW_POWER)) { |
3241 | u32 tmp; | ||
3242 | |||
3243 | tg3_phy_copper_begin(tp); | 3325 | tg3_phy_copper_begin(tp); |
3244 | 3326 | ||
3245 | tg3_readphy(tp, MII_BMSR, &tmp); | 3327 | tg3_readphy(tp, MII_BMSR, &bmsr); |
3246 | if (!tg3_readphy(tp, MII_BMSR, &tmp) && | 3328 | if (!tg3_readphy(tp, MII_BMSR, &bmsr) && |
3247 | (tmp & BMSR_LSTATUS)) | 3329 | (bmsr & BMSR_LSTATUS)) |
3248 | current_link_up = 1; | 3330 | current_link_up = 1; |
3249 | } | 3331 | } |
3250 | 3332 | ||
@@ -3285,6 +3367,8 @@ relink: | |||
3285 | tw32_f(MAC_MODE, tp->mac_mode); | 3367 | tw32_f(MAC_MODE, tp->mac_mode); |
3286 | udelay(40); | 3368 | udelay(40); |
3287 | 3369 | ||
3370 | tg3_phy_eee_adjust(tp, current_link_up); | ||
3371 | |||
3288 | if (tp->tg3_flags & TG3_FLAG_USE_LINKCHG_REG) { | 3372 | if (tp->tg3_flags & TG3_FLAG_USE_LINKCHG_REG) { |
3289 | /* Polled via timer. */ | 3373 | /* Polled via timer. */ |
3290 | tw32_f(MAC_EVENT, 0); | 3374 | tw32_f(MAC_EVENT, 0); |
@@ -4353,6 +4437,11 @@ static int tg3_setup_phy(struct tg3 *tp, int force_reset) | |||
4353 | return err; | 4437 | return err; |
4354 | } | 4438 | } |
4355 | 4439 | ||
4440 | static inline int tg3_irq_sync(struct tg3 *tp) | ||
4441 | { | ||
4442 | return tp->irq_sync; | ||
4443 | } | ||
4444 | |||
4356 | /* This is called whenever we suspect that the system chipset is re- | 4445 | /* This is called whenever we suspect that the system chipset is re- |
4357 | * ordering the sequence of MMIO to the tx send mailbox. The symptom | 4446 | * ordering the sequence of MMIO to the tx send mailbox. The symptom |
4358 | * is bogus tx completions. We try to recover by setting the | 4447 | * is bogus tx completions. We try to recover by setting the |
@@ -4484,22 +4573,21 @@ static int tg3_alloc_rx_skb(struct tg3 *tp, struct tg3_rx_prodring_set *tpr, | |||
4484 | u32 opaque_key, u32 dest_idx_unmasked) | 4573 | u32 opaque_key, u32 dest_idx_unmasked) |
4485 | { | 4574 | { |
4486 | struct tg3_rx_buffer_desc *desc; | 4575 | struct tg3_rx_buffer_desc *desc; |
4487 | struct ring_info *map, *src_map; | 4576 | struct ring_info *map; |
4488 | struct sk_buff *skb; | 4577 | struct sk_buff *skb; |
4489 | dma_addr_t mapping; | 4578 | dma_addr_t mapping; |
4490 | int skb_size, dest_idx; | 4579 | int skb_size, dest_idx; |
4491 | 4580 | ||
4492 | src_map = NULL; | ||
4493 | switch (opaque_key) { | 4581 | switch (opaque_key) { |
4494 | case RXD_OPAQUE_RING_STD: | 4582 | case RXD_OPAQUE_RING_STD: |
4495 | dest_idx = dest_idx_unmasked % TG3_RX_RING_SIZE; | 4583 | dest_idx = dest_idx_unmasked & tp->rx_std_ring_mask; |
4496 | desc = &tpr->rx_std[dest_idx]; | 4584 | desc = &tpr->rx_std[dest_idx]; |
4497 | map = &tpr->rx_std_buffers[dest_idx]; | 4585 | map = &tpr->rx_std_buffers[dest_idx]; |
4498 | skb_size = tp->rx_pkt_map_sz; | 4586 | skb_size = tp->rx_pkt_map_sz; |
4499 | break; | 4587 | break; |
4500 | 4588 | ||
4501 | case RXD_OPAQUE_RING_JUMBO: | 4589 | case RXD_OPAQUE_RING_JUMBO: |
4502 | dest_idx = dest_idx_unmasked % TG3_RX_JUMBO_RING_SIZE; | 4590 | dest_idx = dest_idx_unmasked & tp->rx_jmb_ring_mask; |
4503 | desc = &tpr->rx_jmb[dest_idx].std; | 4591 | desc = &tpr->rx_jmb[dest_idx].std; |
4504 | map = &tpr->rx_jmb_buffers[dest_idx]; | 4592 | map = &tpr->rx_jmb_buffers[dest_idx]; |
4505 | skb_size = TG3_RX_JMB_MAP_SZ; | 4593 | skb_size = TG3_RX_JMB_MAP_SZ; |
@@ -4549,12 +4637,12 @@ static void tg3_recycle_rx(struct tg3_napi *tnapi, | |||
4549 | struct tg3 *tp = tnapi->tp; | 4637 | struct tg3 *tp = tnapi->tp; |
4550 | struct tg3_rx_buffer_desc *src_desc, *dest_desc; | 4638 | struct tg3_rx_buffer_desc *src_desc, *dest_desc; |
4551 | struct ring_info *src_map, *dest_map; | 4639 | struct ring_info *src_map, *dest_map; |
4552 | struct tg3_rx_prodring_set *spr = &tp->prodring[0]; | 4640 | struct tg3_rx_prodring_set *spr = &tp->napi[0].prodring; |
4553 | int dest_idx; | 4641 | int dest_idx; |
4554 | 4642 | ||
4555 | switch (opaque_key) { | 4643 | switch (opaque_key) { |
4556 | case RXD_OPAQUE_RING_STD: | 4644 | case RXD_OPAQUE_RING_STD: |
4557 | dest_idx = dest_idx_unmasked % TG3_RX_RING_SIZE; | 4645 | dest_idx = dest_idx_unmasked & tp->rx_std_ring_mask; |
4558 | dest_desc = &dpr->rx_std[dest_idx]; | 4646 | dest_desc = &dpr->rx_std[dest_idx]; |
4559 | dest_map = &dpr->rx_std_buffers[dest_idx]; | 4647 | dest_map = &dpr->rx_std_buffers[dest_idx]; |
4560 | src_desc = &spr->rx_std[src_idx]; | 4648 | src_desc = &spr->rx_std[src_idx]; |
@@ -4562,7 +4650,7 @@ static void tg3_recycle_rx(struct tg3_napi *tnapi, | |||
4562 | break; | 4650 | break; |
4563 | 4651 | ||
4564 | case RXD_OPAQUE_RING_JUMBO: | 4652 | case RXD_OPAQUE_RING_JUMBO: |
4565 | dest_idx = dest_idx_unmasked % TG3_RX_JUMBO_RING_SIZE; | 4653 | dest_idx = dest_idx_unmasked & tp->rx_jmb_ring_mask; |
4566 | dest_desc = &dpr->rx_jmb[dest_idx].std; | 4654 | dest_desc = &dpr->rx_jmb[dest_idx].std; |
4567 | dest_map = &dpr->rx_jmb_buffers[dest_idx]; | 4655 | dest_map = &dpr->rx_jmb_buffers[dest_idx]; |
4568 | src_desc = &spr->rx_jmb[src_idx].std; | 4656 | src_desc = &spr->rx_jmb[src_idx].std; |
@@ -4619,7 +4707,7 @@ static int tg3_rx(struct tg3_napi *tnapi, int budget) | |||
4619 | u32 sw_idx = tnapi->rx_rcb_ptr; | 4707 | u32 sw_idx = tnapi->rx_rcb_ptr; |
4620 | u16 hw_idx; | 4708 | u16 hw_idx; |
4621 | int received; | 4709 | int received; |
4622 | struct tg3_rx_prodring_set *tpr = tnapi->prodring; | 4710 | struct tg3_rx_prodring_set *tpr = &tnapi->prodring; |
4623 | 4711 | ||
4624 | hw_idx = *(tnapi->rx_rcb_prod_idx); | 4712 | hw_idx = *(tnapi->rx_rcb_prod_idx); |
4625 | /* | 4713 | /* |
@@ -4644,13 +4732,13 @@ static int tg3_rx(struct tg3_napi *tnapi, int budget) | |||
4644 | desc_idx = desc->opaque & RXD_OPAQUE_INDEX_MASK; | 4732 | desc_idx = desc->opaque & RXD_OPAQUE_INDEX_MASK; |
4645 | opaque_key = desc->opaque & RXD_OPAQUE_RING_MASK; | 4733 | opaque_key = desc->opaque & RXD_OPAQUE_RING_MASK; |
4646 | if (opaque_key == RXD_OPAQUE_RING_STD) { | 4734 | if (opaque_key == RXD_OPAQUE_RING_STD) { |
4647 | ri = &tp->prodring[0].rx_std_buffers[desc_idx]; | 4735 | ri = &tp->napi[0].prodring.rx_std_buffers[desc_idx]; |
4648 | dma_addr = dma_unmap_addr(ri, mapping); | 4736 | dma_addr = dma_unmap_addr(ri, mapping); |
4649 | skb = ri->skb; | 4737 | skb = ri->skb; |
4650 | post_ptr = &std_prod_idx; | 4738 | post_ptr = &std_prod_idx; |
4651 | rx_std_posted++; | 4739 | rx_std_posted++; |
4652 | } else if (opaque_key == RXD_OPAQUE_RING_JUMBO) { | 4740 | } else if (opaque_key == RXD_OPAQUE_RING_JUMBO) { |
4653 | ri = &tp->prodring[0].rx_jmb_buffers[desc_idx]; | 4741 | ri = &tp->napi[0].prodring.rx_jmb_buffers[desc_idx]; |
4654 | dma_addr = dma_unmap_addr(ri, mapping); | 4742 | dma_addr = dma_unmap_addr(ri, mapping); |
4655 | skb = ri->skb; | 4743 | skb = ri->skb; |
4656 | post_ptr = &jmb_prod_idx; | 4744 | post_ptr = &jmb_prod_idx; |
@@ -4719,7 +4807,7 @@ static int tg3_rx(struct tg3_napi *tnapi, int budget) | |||
4719 | >> RXD_TCPCSUM_SHIFT) == 0xffff)) | 4807 | >> RXD_TCPCSUM_SHIFT) == 0xffff)) |
4720 | skb->ip_summed = CHECKSUM_UNNECESSARY; | 4808 | skb->ip_summed = CHECKSUM_UNNECESSARY; |
4721 | else | 4809 | else |
4722 | skb->ip_summed = CHECKSUM_NONE; | 4810 | skb_checksum_none_assert(skb); |
4723 | 4811 | ||
4724 | skb->protocol = eth_type_trans(skb, tp->dev); | 4812 | skb->protocol = eth_type_trans(skb, tp->dev); |
4725 | 4813 | ||
@@ -4762,7 +4850,8 @@ next_pkt: | |||
4762 | (*post_ptr)++; | 4850 | (*post_ptr)++; |
4763 | 4851 | ||
4764 | if (unlikely(rx_std_posted >= tp->rx_std_max_post)) { | 4852 | if (unlikely(rx_std_posted >= tp->rx_std_max_post)) { |
4765 | tpr->rx_std_prod_idx = std_prod_idx % TG3_RX_RING_SIZE; | 4853 | tpr->rx_std_prod_idx = std_prod_idx & |
4854 | tp->rx_std_ring_mask; | ||
4766 | tw32_rx_mbox(TG3_RX_STD_PROD_IDX_REG, | 4855 | tw32_rx_mbox(TG3_RX_STD_PROD_IDX_REG, |
4767 | tpr->rx_std_prod_idx); | 4856 | tpr->rx_std_prod_idx); |
4768 | work_mask &= ~RXD_OPAQUE_RING_STD; | 4857 | work_mask &= ~RXD_OPAQUE_RING_STD; |
@@ -4770,7 +4859,7 @@ next_pkt: | |||
4770 | } | 4859 | } |
4771 | next_pkt_nopost: | 4860 | next_pkt_nopost: |
4772 | sw_idx++; | 4861 | sw_idx++; |
4773 | sw_idx &= (TG3_RX_RCB_RING_SIZE(tp) - 1); | 4862 | sw_idx &= tp->rx_ret_ring_mask; |
4774 | 4863 | ||
4775 | /* Refresh hw_idx to see if there is new work */ | 4864 | /* Refresh hw_idx to see if there is new work */ |
4776 | if (sw_idx == hw_idx) { | 4865 | if (sw_idx == hw_idx) { |
@@ -4786,13 +4875,14 @@ next_pkt_nopost: | |||
4786 | /* Refill RX ring(s). */ | 4875 | /* Refill RX ring(s). */ |
4787 | if (!(tp->tg3_flags3 & TG3_FLG3_ENABLE_RSS)) { | 4876 | if (!(tp->tg3_flags3 & TG3_FLG3_ENABLE_RSS)) { |
4788 | if (work_mask & RXD_OPAQUE_RING_STD) { | 4877 | if (work_mask & RXD_OPAQUE_RING_STD) { |
4789 | tpr->rx_std_prod_idx = std_prod_idx % TG3_RX_RING_SIZE; | 4878 | tpr->rx_std_prod_idx = std_prod_idx & |
4879 | tp->rx_std_ring_mask; | ||
4790 | tw32_rx_mbox(TG3_RX_STD_PROD_IDX_REG, | 4880 | tw32_rx_mbox(TG3_RX_STD_PROD_IDX_REG, |
4791 | tpr->rx_std_prod_idx); | 4881 | tpr->rx_std_prod_idx); |
4792 | } | 4882 | } |
4793 | if (work_mask & RXD_OPAQUE_RING_JUMBO) { | 4883 | if (work_mask & RXD_OPAQUE_RING_JUMBO) { |
4794 | tpr->rx_jmb_prod_idx = jmb_prod_idx % | 4884 | tpr->rx_jmb_prod_idx = jmb_prod_idx & |
4795 | TG3_RX_JUMBO_RING_SIZE; | 4885 | tp->rx_jmb_ring_mask; |
4796 | tw32_rx_mbox(TG3_RX_JMB_PROD_IDX_REG, | 4886 | tw32_rx_mbox(TG3_RX_JMB_PROD_IDX_REG, |
4797 | tpr->rx_jmb_prod_idx); | 4887 | tpr->rx_jmb_prod_idx); |
4798 | } | 4888 | } |
@@ -4803,8 +4893,8 @@ next_pkt_nopost: | |||
4803 | */ | 4893 | */ |
4804 | smp_wmb(); | 4894 | smp_wmb(); |
4805 | 4895 | ||
4806 | tpr->rx_std_prod_idx = std_prod_idx % TG3_RX_RING_SIZE; | 4896 | tpr->rx_std_prod_idx = std_prod_idx & tp->rx_std_ring_mask; |
4807 | tpr->rx_jmb_prod_idx = jmb_prod_idx % TG3_RX_JUMBO_RING_SIZE; | 4897 | tpr->rx_jmb_prod_idx = jmb_prod_idx & tp->rx_jmb_ring_mask; |
4808 | 4898 | ||
4809 | if (tnapi != &tp->napi[1]) | 4899 | if (tnapi != &tp->napi[1]) |
4810 | napi_schedule(&tp->napi[1].napi); | 4900 | napi_schedule(&tp->napi[1].napi); |
@@ -4860,9 +4950,11 @@ static int tg3_rx_prodring_xfer(struct tg3 *tp, | |||
4860 | if (spr->rx_std_cons_idx < src_prod_idx) | 4950 | if (spr->rx_std_cons_idx < src_prod_idx) |
4861 | cpycnt = src_prod_idx - spr->rx_std_cons_idx; | 4951 | cpycnt = src_prod_idx - spr->rx_std_cons_idx; |
4862 | else | 4952 | else |
4863 | cpycnt = TG3_RX_RING_SIZE - spr->rx_std_cons_idx; | 4953 | cpycnt = tp->rx_std_ring_mask + 1 - |
4954 | spr->rx_std_cons_idx; | ||
4864 | 4955 | ||
4865 | cpycnt = min(cpycnt, TG3_RX_RING_SIZE - dpr->rx_std_prod_idx); | 4956 | cpycnt = min(cpycnt, |
4957 | tp->rx_std_ring_mask + 1 - dpr->rx_std_prod_idx); | ||
4866 | 4958 | ||
4867 | si = spr->rx_std_cons_idx; | 4959 | si = spr->rx_std_cons_idx; |
4868 | di = dpr->rx_std_prod_idx; | 4960 | di = dpr->rx_std_prod_idx; |
@@ -4896,10 +4988,10 @@ static int tg3_rx_prodring_xfer(struct tg3 *tp, | |||
4896 | dbd->addr_lo = sbd->addr_lo; | 4988 | dbd->addr_lo = sbd->addr_lo; |
4897 | } | 4989 | } |
4898 | 4990 | ||
4899 | spr->rx_std_cons_idx = (spr->rx_std_cons_idx + cpycnt) % | 4991 | spr->rx_std_cons_idx = (spr->rx_std_cons_idx + cpycnt) & |
4900 | TG3_RX_RING_SIZE; | 4992 | tp->rx_std_ring_mask; |
4901 | dpr->rx_std_prod_idx = (dpr->rx_std_prod_idx + cpycnt) % | 4993 | dpr->rx_std_prod_idx = (dpr->rx_std_prod_idx + cpycnt) & |
4902 | TG3_RX_RING_SIZE; | 4994 | tp->rx_std_ring_mask; |
4903 | } | 4995 | } |
4904 | 4996 | ||
4905 | while (1) { | 4997 | while (1) { |
@@ -4916,10 +5008,11 @@ static int tg3_rx_prodring_xfer(struct tg3 *tp, | |||
4916 | if (spr->rx_jmb_cons_idx < src_prod_idx) | 5008 | if (spr->rx_jmb_cons_idx < src_prod_idx) |
4917 | cpycnt = src_prod_idx - spr->rx_jmb_cons_idx; | 5009 | cpycnt = src_prod_idx - spr->rx_jmb_cons_idx; |
4918 | else | 5010 | else |
4919 | cpycnt = TG3_RX_JUMBO_RING_SIZE - spr->rx_jmb_cons_idx; | 5011 | cpycnt = tp->rx_jmb_ring_mask + 1 - |
5012 | spr->rx_jmb_cons_idx; | ||
4920 | 5013 | ||
4921 | cpycnt = min(cpycnt, | 5014 | cpycnt = min(cpycnt, |
4922 | TG3_RX_JUMBO_RING_SIZE - dpr->rx_jmb_prod_idx); | 5015 | tp->rx_jmb_ring_mask + 1 - dpr->rx_jmb_prod_idx); |
4923 | 5016 | ||
4924 | si = spr->rx_jmb_cons_idx; | 5017 | si = spr->rx_jmb_cons_idx; |
4925 | di = dpr->rx_jmb_prod_idx; | 5018 | di = dpr->rx_jmb_prod_idx; |
@@ -4953,10 +5046,10 @@ static int tg3_rx_prodring_xfer(struct tg3 *tp, | |||
4953 | dbd->addr_lo = sbd->addr_lo; | 5046 | dbd->addr_lo = sbd->addr_lo; |
4954 | } | 5047 | } |
4955 | 5048 | ||
4956 | spr->rx_jmb_cons_idx = (spr->rx_jmb_cons_idx + cpycnt) % | 5049 | spr->rx_jmb_cons_idx = (spr->rx_jmb_cons_idx + cpycnt) & |
4957 | TG3_RX_JUMBO_RING_SIZE; | 5050 | tp->rx_jmb_ring_mask; |
4958 | dpr->rx_jmb_prod_idx = (dpr->rx_jmb_prod_idx + cpycnt) % | 5051 | dpr->rx_jmb_prod_idx = (dpr->rx_jmb_prod_idx + cpycnt) & |
4959 | TG3_RX_JUMBO_RING_SIZE; | 5052 | tp->rx_jmb_ring_mask; |
4960 | } | 5053 | } |
4961 | 5054 | ||
4962 | return err; | 5055 | return err; |
@@ -4981,14 +5074,14 @@ static int tg3_poll_work(struct tg3_napi *tnapi, int work_done, int budget) | |||
4981 | work_done += tg3_rx(tnapi, budget - work_done); | 5074 | work_done += tg3_rx(tnapi, budget - work_done); |
4982 | 5075 | ||
4983 | if ((tp->tg3_flags3 & TG3_FLG3_ENABLE_RSS) && tnapi == &tp->napi[1]) { | 5076 | if ((tp->tg3_flags3 & TG3_FLG3_ENABLE_RSS) && tnapi == &tp->napi[1]) { |
4984 | struct tg3_rx_prodring_set *dpr = &tp->prodring[0]; | 5077 | struct tg3_rx_prodring_set *dpr = &tp->napi[0].prodring; |
4985 | int i, err = 0; | 5078 | int i, err = 0; |
4986 | u32 std_prod_idx = dpr->rx_std_prod_idx; | 5079 | u32 std_prod_idx = dpr->rx_std_prod_idx; |
4987 | u32 jmb_prod_idx = dpr->rx_jmb_prod_idx; | 5080 | u32 jmb_prod_idx = dpr->rx_jmb_prod_idx; |
4988 | 5081 | ||
4989 | for (i = 1; i < tp->irq_cnt; i++) | 5082 | for (i = 1; i < tp->irq_cnt; i++) |
4990 | err |= tg3_rx_prodring_xfer(tp, dpr, | 5083 | err |= tg3_rx_prodring_xfer(tp, dpr, |
4991 | tp->napi[i].prodring); | 5084 | &tp->napi[i].prodring); |
4992 | 5085 | ||
4993 | wmb(); | 5086 | wmb(); |
4994 | 5087 | ||
@@ -5098,6 +5191,59 @@ tx_recovery: | |||
5098 | return work_done; | 5191 | return work_done; |
5099 | } | 5192 | } |
5100 | 5193 | ||
5194 | static void tg3_napi_disable(struct tg3 *tp) | ||
5195 | { | ||
5196 | int i; | ||
5197 | |||
5198 | for (i = tp->irq_cnt - 1; i >= 0; i--) | ||
5199 | napi_disable(&tp->napi[i].napi); | ||
5200 | } | ||
5201 | |||
5202 | static void tg3_napi_enable(struct tg3 *tp) | ||
5203 | { | ||
5204 | int i; | ||
5205 | |||
5206 | for (i = 0; i < tp->irq_cnt; i++) | ||
5207 | napi_enable(&tp->napi[i].napi); | ||
5208 | } | ||
5209 | |||
5210 | static void tg3_napi_init(struct tg3 *tp) | ||
5211 | { | ||
5212 | int i; | ||
5213 | |||
5214 | netif_napi_add(tp->dev, &tp->napi[0].napi, tg3_poll, 64); | ||
5215 | for (i = 1; i < tp->irq_cnt; i++) | ||
5216 | netif_napi_add(tp->dev, &tp->napi[i].napi, tg3_poll_msix, 64); | ||
5217 | } | ||
5218 | |||
5219 | static void tg3_napi_fini(struct tg3 *tp) | ||
5220 | { | ||
5221 | int i; | ||
5222 | |||
5223 | for (i = 0; i < tp->irq_cnt; i++) | ||
5224 | netif_napi_del(&tp->napi[i].napi); | ||
5225 | } | ||
5226 | |||
5227 | static inline void tg3_netif_stop(struct tg3 *tp) | ||
5228 | { | ||
5229 | tp->dev->trans_start = jiffies; /* prevent tx timeout */ | ||
5230 | tg3_napi_disable(tp); | ||
5231 | netif_tx_disable(tp->dev); | ||
5232 | } | ||
5233 | |||
5234 | static inline void tg3_netif_start(struct tg3 *tp) | ||
5235 | { | ||
5236 | /* NOTE: unconditional netif_tx_wake_all_queues is only | ||
5237 | * appropriate so long as all callers are assured to | ||
5238 | * have free tx slots (such as after tg3_init_hw) | ||
5239 | */ | ||
5240 | netif_tx_wake_all_queues(tp->dev); | ||
5241 | |||
5242 | tg3_napi_enable(tp); | ||
5243 | tp->napi[0].hw_status->status |= SD_STATUS_UPDATED; | ||
5244 | tg3_enable_ints(tp); | ||
5245 | } | ||
5246 | |||
5101 | static void tg3_irq_quiesce(struct tg3 *tp) | 5247 | static void tg3_irq_quiesce(struct tg3 *tp) |
5102 | { | 5248 | { |
5103 | int i; | 5249 | int i; |
@@ -5111,11 +5257,6 @@ static void tg3_irq_quiesce(struct tg3 *tp) | |||
5111 | synchronize_irq(tp->napi[i].irq_vec); | 5257 | synchronize_irq(tp->napi[i].irq_vec); |
5112 | } | 5258 | } |
5113 | 5259 | ||
5114 | static inline int tg3_irq_sync(struct tg3 *tp) | ||
5115 | { | ||
5116 | return tp->irq_sync; | ||
5117 | } | ||
5118 | |||
5119 | /* Fully shutdown all tg3 driver activity elsewhere in the system. | 5260 | /* Fully shutdown all tg3 driver activity elsewhere in the system. |
5120 | * If irq_sync is non-zero, then the IRQ handler must be synchronized | 5261 | * If irq_sync is non-zero, then the IRQ handler must be synchronized |
5121 | * with as well. Most of the time, this is not necessary except when | 5262 | * with as well. Most of the time, this is not necessary except when |
@@ -5404,8 +5545,7 @@ static inline int tg3_4g_overflow_test(dma_addr_t mapping, int len) | |||
5404 | { | 5545 | { |
5405 | u32 base = (u32) mapping & 0xffffffff; | 5546 | u32 base = (u32) mapping & 0xffffffff; |
5406 | 5547 | ||
5407 | return ((base > 0xffffdcc0) && | 5548 | return (base > 0xffffdcc0) && (base + len + 8 < base); |
5408 | (base + len + 8 < base)); | ||
5409 | } | 5549 | } |
5410 | 5550 | ||
5411 | /* Test for DMA addresses > 40-bit */ | 5551 | /* Test for DMA addresses > 40-bit */ |
@@ -5414,7 +5554,7 @@ static inline int tg3_40bit_overflow_test(struct tg3 *tp, dma_addr_t mapping, | |||
5414 | { | 5554 | { |
5415 | #if defined(CONFIG_HIGHMEM) && (BITS_PER_LONG == 64) | 5555 | #if defined(CONFIG_HIGHMEM) && (BITS_PER_LONG == 64) |
5416 | if (tp->tg3_flags & TG3_FLAG_40BIT_DMA_BUG) | 5556 | if (tp->tg3_flags & TG3_FLAG_40BIT_DMA_BUG) |
5417 | return (((u64) mapping + len) > DMA_BIT_MASK(40)); | 5557 | return ((u64) mapping + len) > DMA_BIT_MASK(40); |
5418 | return 0; | 5558 | return 0; |
5419 | #else | 5559 | #else |
5420 | return 0; | 5560 | return 0; |
@@ -5574,9 +5714,9 @@ static netdev_tx_t tg3_start_xmit(struct sk_buff *skb, | |||
5574 | goto out_unlock; | 5714 | goto out_unlock; |
5575 | } | 5715 | } |
5576 | 5716 | ||
5577 | if (skb_shinfo(skb)->gso_type & SKB_GSO_TCPV6) | 5717 | if (skb_is_gso_v6(skb)) { |
5578 | hdrlen = skb_headlen(skb) - ETH_HLEN; | 5718 | hdrlen = skb_headlen(skb) - ETH_HLEN; |
5579 | else { | 5719 | } else { |
5580 | struct iphdr *iph = ip_hdr(skb); | 5720 | struct iphdr *iph = ip_hdr(skb); |
5581 | 5721 | ||
5582 | tcp_opt_len = tcp_optlen(skb); | 5722 | tcp_opt_len = tcp_optlen(skb); |
@@ -5605,7 +5745,7 @@ static netdev_tx_t tg3_start_xmit(struct sk_buff *skb, | |||
5605 | } | 5745 | } |
5606 | 5746 | ||
5607 | #if TG3_VLAN_TAG_USED | 5747 | #if TG3_VLAN_TAG_USED |
5608 | if (tp->vlgrp != NULL && vlan_tx_tag_present(skb)) | 5748 | if (vlan_tx_tag_present(skb)) |
5609 | base_flags |= (TXD_FLAG_VLAN | | 5749 | base_flags |= (TXD_FLAG_VLAN | |
5610 | (vlan_tx_tag_get(skb) << 16)); | 5750 | (vlan_tx_tag_get(skb) << 16)); |
5611 | #endif | 5751 | #endif |
@@ -5798,7 +5938,7 @@ static netdev_tx_t tg3_start_xmit_dma_bug(struct sk_buff *skb, | |||
5798 | iph = ip_hdr(skb); | 5938 | iph = ip_hdr(skb); |
5799 | tcp_opt_len = tcp_optlen(skb); | 5939 | tcp_opt_len = tcp_optlen(skb); |
5800 | 5940 | ||
5801 | if (skb_shinfo(skb)->gso_type & SKB_GSO_TCPV6) { | 5941 | if (skb_is_gso_v6(skb)) { |
5802 | hdr_len = skb_headlen(skb) - ETH_HLEN; | 5942 | hdr_len = skb_headlen(skb) - ETH_HLEN; |
5803 | } else { | 5943 | } else { |
5804 | u32 ip_tcp_len; | 5944 | u32 ip_tcp_len; |
@@ -5851,7 +5991,7 @@ static netdev_tx_t tg3_start_xmit_dma_bug(struct sk_buff *skb, | |||
5851 | } | 5991 | } |
5852 | } | 5992 | } |
5853 | #if TG3_VLAN_TAG_USED | 5993 | #if TG3_VLAN_TAG_USED |
5854 | if (tp->vlgrp != NULL && vlan_tx_tag_present(skb)) | 5994 | if (vlan_tx_tag_present(skb)) |
5855 | base_flags |= (TXD_FLAG_VLAN | | 5995 | base_flags |= (TXD_FLAG_VLAN | |
5856 | (vlan_tx_tag_get(skb) << 16)); | 5996 | (vlan_tx_tag_get(skb) << 16)); |
5857 | #endif | 5997 | #endif |
@@ -6057,16 +6197,16 @@ static void tg3_rx_prodring_free(struct tg3 *tp, | |||
6057 | { | 6197 | { |
6058 | int i; | 6198 | int i; |
6059 | 6199 | ||
6060 | if (tpr != &tp->prodring[0]) { | 6200 | if (tpr != &tp->napi[0].prodring) { |
6061 | for (i = tpr->rx_std_cons_idx; i != tpr->rx_std_prod_idx; | 6201 | for (i = tpr->rx_std_cons_idx; i != tpr->rx_std_prod_idx; |
6062 | i = (i + 1) % TG3_RX_RING_SIZE) | 6202 | i = (i + 1) & tp->rx_std_ring_mask) |
6063 | tg3_rx_skb_free(tp, &tpr->rx_std_buffers[i], | 6203 | tg3_rx_skb_free(tp, &tpr->rx_std_buffers[i], |
6064 | tp->rx_pkt_map_sz); | 6204 | tp->rx_pkt_map_sz); |
6065 | 6205 | ||
6066 | if (tp->tg3_flags & TG3_FLAG_JUMBO_CAPABLE) { | 6206 | if (tp->tg3_flags & TG3_FLAG_JUMBO_CAPABLE) { |
6067 | for (i = tpr->rx_jmb_cons_idx; | 6207 | for (i = tpr->rx_jmb_cons_idx; |
6068 | i != tpr->rx_jmb_prod_idx; | 6208 | i != tpr->rx_jmb_prod_idx; |
6069 | i = (i + 1) % TG3_RX_JUMBO_RING_SIZE) { | 6209 | i = (i + 1) & tp->rx_jmb_ring_mask) { |
6070 | tg3_rx_skb_free(tp, &tpr->rx_jmb_buffers[i], | 6210 | tg3_rx_skb_free(tp, &tpr->rx_jmb_buffers[i], |
6071 | TG3_RX_JMB_MAP_SZ); | 6211 | TG3_RX_JMB_MAP_SZ); |
6072 | } | 6212 | } |
@@ -6075,12 +6215,13 @@ static void tg3_rx_prodring_free(struct tg3 *tp, | |||
6075 | return; | 6215 | return; |
6076 | } | 6216 | } |
6077 | 6217 | ||
6078 | for (i = 0; i < TG3_RX_RING_SIZE; i++) | 6218 | for (i = 0; i <= tp->rx_std_ring_mask; i++) |
6079 | tg3_rx_skb_free(tp, &tpr->rx_std_buffers[i], | 6219 | tg3_rx_skb_free(tp, &tpr->rx_std_buffers[i], |
6080 | tp->rx_pkt_map_sz); | 6220 | tp->rx_pkt_map_sz); |
6081 | 6221 | ||
6082 | if (tp->tg3_flags & TG3_FLAG_JUMBO_CAPABLE) { | 6222 | if ((tp->tg3_flags & TG3_FLAG_JUMBO_CAPABLE) && |
6083 | for (i = 0; i < TG3_RX_JUMBO_RING_SIZE; i++) | 6223 | !(tp->tg3_flags2 & TG3_FLG2_5780_CLASS)) { |
6224 | for (i = 0; i <= tp->rx_jmb_ring_mask; i++) | ||
6084 | tg3_rx_skb_free(tp, &tpr->rx_jmb_buffers[i], | 6225 | tg3_rx_skb_free(tp, &tpr->rx_jmb_buffers[i], |
6085 | TG3_RX_JMB_MAP_SZ); | 6226 | TG3_RX_JMB_MAP_SZ); |
6086 | } | 6227 | } |
@@ -6103,16 +6244,17 @@ static int tg3_rx_prodring_alloc(struct tg3 *tp, | |||
6103 | tpr->rx_jmb_cons_idx = 0; | 6244 | tpr->rx_jmb_cons_idx = 0; |
6104 | tpr->rx_jmb_prod_idx = 0; | 6245 | tpr->rx_jmb_prod_idx = 0; |
6105 | 6246 | ||
6106 | if (tpr != &tp->prodring[0]) { | 6247 | if (tpr != &tp->napi[0].prodring) { |
6107 | memset(&tpr->rx_std_buffers[0], 0, TG3_RX_STD_BUFF_RING_SIZE); | 6248 | memset(&tpr->rx_std_buffers[0], 0, |
6108 | if (tp->tg3_flags & TG3_FLAG_JUMBO_CAPABLE) | 6249 | TG3_RX_STD_BUFF_RING_SIZE(tp)); |
6250 | if (tpr->rx_jmb_buffers) | ||
6109 | memset(&tpr->rx_jmb_buffers[0], 0, | 6251 | memset(&tpr->rx_jmb_buffers[0], 0, |
6110 | TG3_RX_JMB_BUFF_RING_SIZE); | 6252 | TG3_RX_JMB_BUFF_RING_SIZE(tp)); |
6111 | goto done; | 6253 | goto done; |
6112 | } | 6254 | } |
6113 | 6255 | ||
6114 | /* Zero out all descriptors. */ | 6256 | /* Zero out all descriptors. */ |
6115 | memset(tpr->rx_std, 0, TG3_RX_RING_BYTES); | 6257 | memset(tpr->rx_std, 0, TG3_RX_STD_RING_BYTES(tp)); |
6116 | 6258 | ||
6117 | rx_pkt_dma_sz = TG3_RX_STD_DMA_SZ; | 6259 | rx_pkt_dma_sz = TG3_RX_STD_DMA_SZ; |
6118 | if ((tp->tg3_flags2 & TG3_FLG2_5780_CLASS) && | 6260 | if ((tp->tg3_flags2 & TG3_FLG2_5780_CLASS) && |
@@ -6124,7 +6266,7 @@ static int tg3_rx_prodring_alloc(struct tg3 *tp, | |||
6124 | * stuff once. This works because the card does not | 6266 | * stuff once. This works because the card does not |
6125 | * write into the rx buffer posting rings. | 6267 | * write into the rx buffer posting rings. |
6126 | */ | 6268 | */ |
6127 | for (i = 0; i < TG3_RX_RING_SIZE; i++) { | 6269 | for (i = 0; i <= tp->rx_std_ring_mask; i++) { |
6128 | struct tg3_rx_buffer_desc *rxd; | 6270 | struct tg3_rx_buffer_desc *rxd; |
6129 | 6271 | ||
6130 | rxd = &tpr->rx_std[i]; | 6272 | rxd = &tpr->rx_std[i]; |
@@ -6148,15 +6290,16 @@ static int tg3_rx_prodring_alloc(struct tg3 *tp, | |||
6148 | } | 6290 | } |
6149 | } | 6291 | } |
6150 | 6292 | ||
6151 | if (!(tp->tg3_flags & TG3_FLAG_JUMBO_CAPABLE)) | 6293 | if (!(tp->tg3_flags & TG3_FLAG_JUMBO_CAPABLE) || |
6294 | (tp->tg3_flags2 & TG3_FLG2_5780_CLASS)) | ||
6152 | goto done; | 6295 | goto done; |
6153 | 6296 | ||
6154 | memset(tpr->rx_jmb, 0, TG3_RX_JUMBO_RING_BYTES); | 6297 | memset(tpr->rx_jmb, 0, TG3_RX_JMB_RING_BYTES(tp)); |
6155 | 6298 | ||
6156 | if (!(tp->tg3_flags & TG3_FLAG_JUMBO_RING_ENABLE)) | 6299 | if (!(tp->tg3_flags & TG3_FLAG_JUMBO_RING_ENABLE)) |
6157 | goto done; | 6300 | goto done; |
6158 | 6301 | ||
6159 | for (i = 0; i < TG3_RX_JUMBO_RING_SIZE; i++) { | 6302 | for (i = 0; i <= tp->rx_jmb_ring_mask; i++) { |
6160 | struct tg3_rx_buffer_desc *rxd; | 6303 | struct tg3_rx_buffer_desc *rxd; |
6161 | 6304 | ||
6162 | rxd = &tpr->rx_jmb[i].std; | 6305 | rxd = &tpr->rx_jmb[i].std; |
@@ -6196,12 +6339,12 @@ static void tg3_rx_prodring_fini(struct tg3 *tp, | |||
6196 | kfree(tpr->rx_jmb_buffers); | 6339 | kfree(tpr->rx_jmb_buffers); |
6197 | tpr->rx_jmb_buffers = NULL; | 6340 | tpr->rx_jmb_buffers = NULL; |
6198 | if (tpr->rx_std) { | 6341 | if (tpr->rx_std) { |
6199 | pci_free_consistent(tp->pdev, TG3_RX_RING_BYTES, | 6342 | pci_free_consistent(tp->pdev, TG3_RX_STD_RING_BYTES(tp), |
6200 | tpr->rx_std, tpr->rx_std_mapping); | 6343 | tpr->rx_std, tpr->rx_std_mapping); |
6201 | tpr->rx_std = NULL; | 6344 | tpr->rx_std = NULL; |
6202 | } | 6345 | } |
6203 | if (tpr->rx_jmb) { | 6346 | if (tpr->rx_jmb) { |
6204 | pci_free_consistent(tp->pdev, TG3_RX_JUMBO_RING_BYTES, | 6347 | pci_free_consistent(tp->pdev, TG3_RX_JMB_RING_BYTES(tp), |
6205 | tpr->rx_jmb, tpr->rx_jmb_mapping); | 6348 | tpr->rx_jmb, tpr->rx_jmb_mapping); |
6206 | tpr->rx_jmb = NULL; | 6349 | tpr->rx_jmb = NULL; |
6207 | } | 6350 | } |
@@ -6210,23 +6353,25 @@ static void tg3_rx_prodring_fini(struct tg3 *tp, | |||
6210 | static int tg3_rx_prodring_init(struct tg3 *tp, | 6353 | static int tg3_rx_prodring_init(struct tg3 *tp, |
6211 | struct tg3_rx_prodring_set *tpr) | 6354 | struct tg3_rx_prodring_set *tpr) |
6212 | { | 6355 | { |
6213 | tpr->rx_std_buffers = kzalloc(TG3_RX_STD_BUFF_RING_SIZE, GFP_KERNEL); | 6356 | tpr->rx_std_buffers = kzalloc(TG3_RX_STD_BUFF_RING_SIZE(tp), |
6357 | GFP_KERNEL); | ||
6214 | if (!tpr->rx_std_buffers) | 6358 | if (!tpr->rx_std_buffers) |
6215 | return -ENOMEM; | 6359 | return -ENOMEM; |
6216 | 6360 | ||
6217 | tpr->rx_std = pci_alloc_consistent(tp->pdev, TG3_RX_RING_BYTES, | 6361 | tpr->rx_std = pci_alloc_consistent(tp->pdev, TG3_RX_STD_RING_BYTES(tp), |
6218 | &tpr->rx_std_mapping); | 6362 | &tpr->rx_std_mapping); |
6219 | if (!tpr->rx_std) | 6363 | if (!tpr->rx_std) |
6220 | goto err_out; | 6364 | goto err_out; |
6221 | 6365 | ||
6222 | if (tp->tg3_flags & TG3_FLAG_JUMBO_CAPABLE) { | 6366 | if ((tp->tg3_flags & TG3_FLAG_JUMBO_CAPABLE) && |
6223 | tpr->rx_jmb_buffers = kzalloc(TG3_RX_JMB_BUFF_RING_SIZE, | 6367 | !(tp->tg3_flags2 & TG3_FLG2_5780_CLASS)) { |
6368 | tpr->rx_jmb_buffers = kzalloc(TG3_RX_JMB_BUFF_RING_SIZE(tp), | ||
6224 | GFP_KERNEL); | 6369 | GFP_KERNEL); |
6225 | if (!tpr->rx_jmb_buffers) | 6370 | if (!tpr->rx_jmb_buffers) |
6226 | goto err_out; | 6371 | goto err_out; |
6227 | 6372 | ||
6228 | tpr->rx_jmb = pci_alloc_consistent(tp->pdev, | 6373 | tpr->rx_jmb = pci_alloc_consistent(tp->pdev, |
6229 | TG3_RX_JUMBO_RING_BYTES, | 6374 | TG3_RX_JMB_RING_BYTES(tp), |
6230 | &tpr->rx_jmb_mapping); | 6375 | &tpr->rx_jmb_mapping); |
6231 | if (!tpr->rx_jmb) | 6376 | if (!tpr->rx_jmb) |
6232 | goto err_out; | 6377 | goto err_out; |
@@ -6253,7 +6398,7 @@ static void tg3_free_rings(struct tg3 *tp) | |||
6253 | for (j = 0; j < tp->irq_cnt; j++) { | 6398 | for (j = 0; j < tp->irq_cnt; j++) { |
6254 | struct tg3_napi *tnapi = &tp->napi[j]; | 6399 | struct tg3_napi *tnapi = &tp->napi[j]; |
6255 | 6400 | ||
6256 | tg3_rx_prodring_free(tp, &tp->prodring[j]); | 6401 | tg3_rx_prodring_free(tp, &tnapi->prodring); |
6257 | 6402 | ||
6258 | if (!tnapi->tx_buffers) | 6403 | if (!tnapi->tx_buffers) |
6259 | continue; | 6404 | continue; |
@@ -6325,7 +6470,7 @@ static int tg3_init_rings(struct tg3 *tp) | |||
6325 | if (tnapi->rx_rcb) | 6470 | if (tnapi->rx_rcb) |
6326 | memset(tnapi->rx_rcb, 0, TG3_RX_RCB_RING_BYTES(tp)); | 6471 | memset(tnapi->rx_rcb, 0, TG3_RX_RCB_RING_BYTES(tp)); |
6327 | 6472 | ||
6328 | if (tg3_rx_prodring_alloc(tp, &tp->prodring[i])) { | 6473 | if (tg3_rx_prodring_alloc(tp, &tnapi->prodring)) { |
6329 | tg3_free_rings(tp); | 6474 | tg3_free_rings(tp); |
6330 | return -ENOMEM; | 6475 | return -ENOMEM; |
6331 | } | 6476 | } |
@@ -6361,6 +6506,8 @@ static void tg3_free_consistent(struct tg3 *tp) | |||
6361 | tnapi->rx_rcb = NULL; | 6506 | tnapi->rx_rcb = NULL; |
6362 | } | 6507 | } |
6363 | 6508 | ||
6509 | tg3_rx_prodring_fini(tp, &tnapi->prodring); | ||
6510 | |||
6364 | if (tnapi->hw_status) { | 6511 | if (tnapi->hw_status) { |
6365 | pci_free_consistent(tp->pdev, TG3_HW_STATUS_SIZE, | 6512 | pci_free_consistent(tp->pdev, TG3_HW_STATUS_SIZE, |
6366 | tnapi->hw_status, | 6513 | tnapi->hw_status, |
@@ -6374,9 +6521,6 @@ static void tg3_free_consistent(struct tg3 *tp) | |||
6374 | tp->hw_stats, tp->stats_mapping); | 6521 | tp->hw_stats, tp->stats_mapping); |
6375 | tp->hw_stats = NULL; | 6522 | tp->hw_stats = NULL; |
6376 | } | 6523 | } |
6377 | |||
6378 | for (i = 0; i < tp->irq_cnt; i++) | ||
6379 | tg3_rx_prodring_fini(tp, &tp->prodring[i]); | ||
6380 | } | 6524 | } |
6381 | 6525 | ||
6382 | /* | 6526 | /* |
@@ -6387,11 +6531,6 @@ static int tg3_alloc_consistent(struct tg3 *tp) | |||
6387 | { | 6531 | { |
6388 | int i; | 6532 | int i; |
6389 | 6533 | ||
6390 | for (i = 0; i < tp->irq_cnt; i++) { | ||
6391 | if (tg3_rx_prodring_init(tp, &tp->prodring[i])) | ||
6392 | goto err_out; | ||
6393 | } | ||
6394 | |||
6395 | tp->hw_stats = pci_alloc_consistent(tp->pdev, | 6534 | tp->hw_stats = pci_alloc_consistent(tp->pdev, |
6396 | sizeof(struct tg3_hw_stats), | 6535 | sizeof(struct tg3_hw_stats), |
6397 | &tp->stats_mapping); | 6536 | &tp->stats_mapping); |
@@ -6413,6 +6552,9 @@ static int tg3_alloc_consistent(struct tg3 *tp) | |||
6413 | memset(tnapi->hw_status, 0, TG3_HW_STATUS_SIZE); | 6552 | memset(tnapi->hw_status, 0, TG3_HW_STATUS_SIZE); |
6414 | sblk = tnapi->hw_status; | 6553 | sblk = tnapi->hw_status; |
6415 | 6554 | ||
6555 | if (tg3_rx_prodring_init(tp, &tnapi->prodring)) | ||
6556 | goto err_out; | ||
6557 | |||
6416 | /* If multivector TSS is enabled, vector 0 does not handle | 6558 | /* If multivector TSS is enabled, vector 0 does not handle |
6417 | * tx interrupts. Don't allocate any resources for it. | 6559 | * tx interrupts. Don't allocate any resources for it. |
6418 | */ | 6560 | */ |
@@ -6452,8 +6594,6 @@ static int tg3_alloc_consistent(struct tg3 *tp) | |||
6452 | break; | 6594 | break; |
6453 | } | 6595 | } |
6454 | 6596 | ||
6455 | tnapi->prodring = &tp->prodring[i]; | ||
6456 | |||
6457 | /* | 6597 | /* |
6458 | * If multivector RSS is enabled, vector 0 does not handle | 6598 | * If multivector RSS is enabled, vector 0 does not handle |
6459 | * rx or tx interrupts. Don't allocate any resources for it. | 6599 | * rx or tx interrupts. Don't allocate any resources for it. |
@@ -6596,6 +6736,10 @@ static void tg3_ape_send_event(struct tg3 *tp, u32 event) | |||
6596 | int i; | 6736 | int i; |
6597 | u32 apedata; | 6737 | u32 apedata; |
6598 | 6738 | ||
6739 | /* NCSI does not support APE events */ | ||
6740 | if (tp->tg3_flags3 & TG3_FLG3_APE_HAS_NCSI) | ||
6741 | return; | ||
6742 | |||
6599 | apedata = tg3_ape_read32(tp, TG3_APE_SEG_SIG); | 6743 | apedata = tg3_ape_read32(tp, TG3_APE_SEG_SIG); |
6600 | if (apedata != APE_SEG_SIG_MAGIC) | 6744 | if (apedata != APE_SEG_SIG_MAGIC) |
6601 | return; | 6745 | return; |
@@ -6647,6 +6791,8 @@ static void tg3_ape_driver_state_change(struct tg3 *tp, int kind) | |||
6647 | APE_HOST_DRIVER_ID_MAGIC(TG3_MAJ_NUM, TG3_MIN_NUM)); | 6791 | APE_HOST_DRIVER_ID_MAGIC(TG3_MAJ_NUM, TG3_MIN_NUM)); |
6648 | tg3_ape_write32(tp, TG3_APE_HOST_BEHAVIOR, | 6792 | tg3_ape_write32(tp, TG3_APE_HOST_BEHAVIOR, |
6649 | APE_HOST_BEHAV_NO_PHYLOCK); | 6793 | APE_HOST_BEHAV_NO_PHYLOCK); |
6794 | tg3_ape_write32(tp, TG3_APE_HOST_DRVR_STATE, | ||
6795 | TG3_APE_HOST_DRVR_STATE_START); | ||
6650 | 6796 | ||
6651 | event = APE_EVENT_STATUS_STATE_START; | 6797 | event = APE_EVENT_STATUS_STATE_START; |
6652 | break; | 6798 | break; |
@@ -6658,6 +6804,16 @@ static void tg3_ape_driver_state_change(struct tg3 *tp, int kind) | |||
6658 | */ | 6804 | */ |
6659 | tg3_ape_write32(tp, TG3_APE_HOST_SEG_SIG, 0x0); | 6805 | tg3_ape_write32(tp, TG3_APE_HOST_SEG_SIG, 0x0); |
6660 | 6806 | ||
6807 | if (device_may_wakeup(&tp->pdev->dev) && | ||
6808 | (tp->tg3_flags & TG3_FLAG_WOL_ENABLE)) { | ||
6809 | tg3_ape_write32(tp, TG3_APE_HOST_WOL_SPEED, | ||
6810 | TG3_APE_HOST_WOL_SPEED_AUTO); | ||
6811 | apedata = TG3_APE_HOST_DRVR_STATE_WOL; | ||
6812 | } else | ||
6813 | apedata = TG3_APE_HOST_DRVR_STATE_UNLOAD; | ||
6814 | |||
6815 | tg3_ape_write32(tp, TG3_APE_HOST_DRVR_STATE, apedata); | ||
6816 | |||
6661 | event = APE_EVENT_STATUS_STATE_UNLOAD; | 6817 | event = APE_EVENT_STATUS_STATE_UNLOAD; |
6662 | break; | 6818 | break; |
6663 | case RESET_KIND_SUSPEND: | 6819 | case RESET_KIND_SUSPEND: |
@@ -7515,6 +7671,9 @@ static void tg3_rings_reset(struct tg3 *tp) | |||
7515 | /* Disable all transmit rings but the first. */ | 7671 | /* Disable all transmit rings but the first. */ |
7516 | if (!(tp->tg3_flags2 & TG3_FLG2_5705_PLUS)) | 7672 | if (!(tp->tg3_flags2 & TG3_FLG2_5705_PLUS)) |
7517 | limit = NIC_SRAM_SEND_RCB + TG3_BDINFO_SIZE * 16; | 7673 | limit = NIC_SRAM_SEND_RCB + TG3_BDINFO_SIZE * 16; |
7674 | else if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5717 || | ||
7675 | GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5719) | ||
7676 | limit = NIC_SRAM_SEND_RCB + TG3_BDINFO_SIZE * 4; | ||
7518 | else if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_57765) | 7677 | else if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_57765) |
7519 | limit = NIC_SRAM_SEND_RCB + TG3_BDINFO_SIZE * 2; | 7678 | limit = NIC_SRAM_SEND_RCB + TG3_BDINFO_SIZE * 2; |
7520 | else | 7679 | else |
@@ -7548,7 +7707,7 @@ static void tg3_rings_reset(struct tg3 *tp) | |||
7548 | 7707 | ||
7549 | /* Zero mailbox registers. */ | 7708 | /* Zero mailbox registers. */ |
7550 | if (tp->tg3_flags & TG3_FLAG_SUPPORT_MSIX) { | 7709 | if (tp->tg3_flags & TG3_FLAG_SUPPORT_MSIX) { |
7551 | for (i = 1; i < TG3_IRQ_MAX_VECS; i++) { | 7710 | for (i = 1; i < tp->irq_max; i++) { |
7552 | tp->napi[i].tx_prod = 0; | 7711 | tp->napi[i].tx_prod = 0; |
7553 | tp->napi[i].tx_cons = 0; | 7712 | tp->napi[i].tx_cons = 0; |
7554 | if (tp->tg3_flags3 & TG3_FLG3_ENABLE_TSS) | 7713 | if (tp->tg3_flags3 & TG3_FLG3_ENABLE_TSS) |
@@ -7594,8 +7753,8 @@ static void tg3_rings_reset(struct tg3 *tp) | |||
7594 | 7753 | ||
7595 | if (tnapi->rx_rcb) { | 7754 | if (tnapi->rx_rcb) { |
7596 | tg3_set_bdinfo(tp, rxrcb, tnapi->rx_rcb_mapping, | 7755 | tg3_set_bdinfo(tp, rxrcb, tnapi->rx_rcb_mapping, |
7597 | (TG3_RX_RCB_RING_SIZE(tp) << | 7756 | (tp->rx_ret_ring_mask + 1) << |
7598 | BDINFO_FLAGS_MAXLEN_SHIFT), 0); | 7757 | BDINFO_FLAGS_MAXLEN_SHIFT, 0); |
7599 | rxrcb += TG3_BDINFO_SIZE; | 7758 | rxrcb += TG3_BDINFO_SIZE; |
7600 | } | 7759 | } |
7601 | 7760 | ||
@@ -7618,7 +7777,7 @@ static void tg3_rings_reset(struct tg3 *tp) | |||
7618 | } | 7777 | } |
7619 | 7778 | ||
7620 | tg3_set_bdinfo(tp, rxrcb, tnapi->rx_rcb_mapping, | 7779 | tg3_set_bdinfo(tp, rxrcb, tnapi->rx_rcb_mapping, |
7621 | (TG3_RX_RCB_RING_SIZE(tp) << | 7780 | ((tp->rx_ret_ring_mask + 1) << |
7622 | BDINFO_FLAGS_MAXLEN_SHIFT), 0); | 7781 | BDINFO_FLAGS_MAXLEN_SHIFT), 0); |
7623 | 7782 | ||
7624 | stblk += 8; | 7783 | stblk += 8; |
@@ -7631,7 +7790,7 @@ static int tg3_reset_hw(struct tg3 *tp, int reset_phy) | |||
7631 | { | 7790 | { |
7632 | u32 val, rdmac_mode; | 7791 | u32 val, rdmac_mode; |
7633 | int i, err, limit; | 7792 | int i, err, limit; |
7634 | struct tg3_rx_prodring_set *tpr = &tp->prodring[0]; | 7793 | struct tg3_rx_prodring_set *tpr = &tp->napi[0].prodring; |
7635 | 7794 | ||
7636 | tg3_disable_ints(tp); | 7795 | tg3_disable_ints(tp); |
7637 | 7796 | ||
@@ -7720,6 +7879,22 @@ static int tg3_reset_hw(struct tg3 *tp, int reset_phy) | |||
7720 | tw32(TG3_CPMU_LSPD_10MB_CLK, val); | 7879 | tw32(TG3_CPMU_LSPD_10MB_CLK, val); |
7721 | } | 7880 | } |
7722 | 7881 | ||
7882 | /* Enable MAC control of LPI */ | ||
7883 | if (tp->phy_flags & TG3_PHYFLG_EEE_CAP) { | ||
7884 | tw32_f(TG3_CPMU_EEE_LNKIDL_CTRL, | ||
7885 | TG3_CPMU_EEE_LNKIDL_PCIE_NL0 | | ||
7886 | TG3_CPMU_EEE_LNKIDL_UART_IDL); | ||
7887 | |||
7888 | tw32_f(TG3_CPMU_EEE_CTRL, | ||
7889 | TG3_CPMU_EEE_CTRL_EXIT_20_1_US); | ||
7890 | |||
7891 | tw32_f(TG3_CPMU_EEE_MODE, | ||
7892 | TG3_CPMU_EEEMD_ERLY_L1_XIT_DET | | ||
7893 | TG3_CPMU_EEEMD_LPI_IN_TX | | ||
7894 | TG3_CPMU_EEEMD_LPI_IN_RX | | ||
7895 | TG3_CPMU_EEEMD_EEE_ENABLE); | ||
7896 | } | ||
7897 | |||
7723 | /* This works around an issue with Athlon chipsets on | 7898 | /* This works around an issue with Athlon chipsets on |
7724 | * B3 tigon3 silicon. This bit has no effect on any | 7899 | * B3 tigon3 silicon. This bit has no effect on any |
7725 | * other revision. But do not set this on PCI Express | 7900 | * other revision. But do not set this on PCI Express |
@@ -7845,7 +8020,10 @@ static int tg3_reset_hw(struct tg3 *tp, int reset_phy) | |||
7845 | tw32(BUFMGR_DMA_HIGH_WATER, | 8020 | tw32(BUFMGR_DMA_HIGH_WATER, |
7846 | tp->bufmgr_config.dma_high_water); | 8021 | tp->bufmgr_config.dma_high_water); |
7847 | 8022 | ||
7848 | tw32(BUFMGR_MODE, BUFMGR_MODE_ENABLE | BUFMGR_MODE_ATTN_ENABLE); | 8023 | val = BUFMGR_MODE_ENABLE | BUFMGR_MODE_ATTN_ENABLE; |
8024 | if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5719) | ||
8025 | val |= BUFMGR_MODE_NO_TX_UNDERRUN; | ||
8026 | tw32(BUFMGR_MODE, val); | ||
7849 | for (i = 0; i < 2000; i++) { | 8027 | for (i = 0; i < 2000; i++) { |
7850 | if (tr32(BUFMGR_MODE) & BUFMGR_MODE_ENABLE) | 8028 | if (tr32(BUFMGR_MODE) & BUFMGR_MODE_ENABLE) |
7851 | break; | 8029 | break; |
@@ -7928,10 +8106,14 @@ static int tg3_reset_hw(struct tg3 *tp, int reset_phy) | |||
7928 | BDINFO_FLAGS_DISABLED); | 8106 | BDINFO_FLAGS_DISABLED); |
7929 | } | 8107 | } |
7930 | 8108 | ||
7931 | if (tp->tg3_flags3 & TG3_FLG3_5717_PLUS) | 8109 | if (tp->tg3_flags3 & TG3_FLG3_5717_PLUS) { |
7932 | val = (RX_STD_MAX_SIZE_5705 << BDINFO_FLAGS_MAXLEN_SHIFT) | | 8110 | if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_57765) |
7933 | (TG3_RX_STD_DMA_SZ << 2); | 8111 | val = RX_STD_MAX_SIZE_5705; |
7934 | else | 8112 | else |
8113 | val = RX_STD_MAX_SIZE_5717; | ||
8114 | val <<= BDINFO_FLAGS_MAXLEN_SHIFT; | ||
8115 | val |= (TG3_RX_STD_DMA_SZ << 2); | ||
8116 | } else | ||
7935 | val = TG3_RX_STD_DMA_SZ << BDINFO_FLAGS_MAXLEN_SHIFT; | 8117 | val = TG3_RX_STD_DMA_SZ << BDINFO_FLAGS_MAXLEN_SHIFT; |
7936 | } else | 8118 | } else |
7937 | val = RX_STD_MAX_SIZE_5705 << BDINFO_FLAGS_MAXLEN_SHIFT; | 8119 | val = RX_STD_MAX_SIZE_5705 << BDINFO_FLAGS_MAXLEN_SHIFT; |
@@ -8015,6 +8197,23 @@ static int tg3_reset_hw(struct tg3 *tp, int reset_phy) | |||
8015 | GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_57780) | 8197 | GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_57780) |
8016 | rdmac_mode |= RDMAC_MODE_IPV6_LSO_EN; | 8198 | rdmac_mode |= RDMAC_MODE_IPV6_LSO_EN; |
8017 | 8199 | ||
8200 | if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5761 || | ||
8201 | GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5784 || | ||
8202 | GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5785 || | ||
8203 | GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_57780 || | ||
8204 | (tp->tg3_flags3 & TG3_FLG3_5717_PLUS)) { | ||
8205 | val = tr32(TG3_RDMA_RSRVCTRL_REG); | ||
8206 | tw32(TG3_RDMA_RSRVCTRL_REG, | ||
8207 | val | TG3_RDMA_RSRVCTRL_FIFO_OFLW_FIX); | ||
8208 | } | ||
8209 | |||
8210 | if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5719) { | ||
8211 | val = tr32(TG3_LSO_RD_DMA_CRPTEN_CTRL); | ||
8212 | tw32(TG3_LSO_RD_DMA_CRPTEN_CTRL, val | | ||
8213 | TG3_LSO_RD_DMA_CRPTEN_CTRL_BLEN_BD_4K | | ||
8214 | TG3_LSO_RD_DMA_CRPTEN_CTRL_BLEN_LSO_4K); | ||
8215 | } | ||
8216 | |||
8018 | /* Receive/send statistics. */ | 8217 | /* Receive/send statistics. */ |
8019 | if (tp->tg3_flags2 & TG3_FLG2_5750_PLUS) { | 8218 | if (tp->tg3_flags2 & TG3_FLG2_5750_PLUS) { |
8020 | val = tr32(RCVLPC_STATS_ENABLE); | 8219 | val = tr32(RCVLPC_STATS_ENABLE); |
@@ -8197,7 +8396,11 @@ static int tg3_reset_hw(struct tg3 *tp, int reset_phy) | |||
8197 | 8396 | ||
8198 | tw32(SNDBDC_MODE, SNDBDC_MODE_ENABLE | SNDBDC_MODE_ATTN_ENABLE); | 8397 | tw32(SNDBDC_MODE, SNDBDC_MODE_ENABLE | SNDBDC_MODE_ATTN_ENABLE); |
8199 | tw32(RCVBDI_MODE, RCVBDI_MODE_ENABLE | RCVBDI_MODE_RCB_ATTN_ENAB); | 8398 | tw32(RCVBDI_MODE, RCVBDI_MODE_ENABLE | RCVBDI_MODE_RCB_ATTN_ENAB); |
8200 | tw32(RCVDBDI_MODE, RCVDBDI_MODE_ENABLE | RCVDBDI_MODE_INV_RING_SZ); | 8399 | val = RCVDBDI_MODE_ENABLE | RCVDBDI_MODE_INV_RING_SZ; |
8400 | if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5717 || | ||
8401 | GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5719) | ||
8402 | val |= RCVDBDI_MODE_LRG_RING_SZ; | ||
8403 | tw32(RCVDBDI_MODE, val); | ||
8201 | tw32(SNDDATAI_MODE, SNDDATAI_MODE_ENABLE); | 8404 | tw32(SNDDATAI_MODE, SNDDATAI_MODE_ENABLE); |
8202 | if (tp->tg3_flags2 & TG3_FLG2_HW_TSO) | 8405 | if (tp->tg3_flags2 & TG3_FLG2_HW_TSO) |
8203 | tw32(SNDDATAI_MODE, SNDDATAI_MODE_ENABLE | 0x8); | 8406 | tw32(SNDDATAI_MODE, SNDDATAI_MODE_ENABLE | 0x8); |
@@ -8500,6 +8703,12 @@ static void tg3_timer(unsigned long __opaque) | |||
8500 | if (tp->tg3_flags2 & TG3_FLG2_5705_PLUS) | 8703 | if (tp->tg3_flags2 & TG3_FLG2_5705_PLUS) |
8501 | tg3_periodic_fetch_stats(tp); | 8704 | tg3_periodic_fetch_stats(tp); |
8502 | 8705 | ||
8706 | if (tp->setlpicnt && !--tp->setlpicnt) { | ||
8707 | u32 val = tr32(TG3_CPMU_EEE_MODE); | ||
8708 | tw32(TG3_CPMU_EEE_MODE, | ||
8709 | val | TG3_CPMU_EEEMD_LPI_ENABLE); | ||
8710 | } | ||
8711 | |||
8503 | if (tp->tg3_flags & TG3_FLAG_USE_LINKCHG_REG) { | 8712 | if (tp->tg3_flags & TG3_FLAG_USE_LINKCHG_REG) { |
8504 | u32 mac_stat; | 8713 | u32 mac_stat; |
8505 | int phy_event; | 8714 | int phy_event; |
@@ -8816,16 +9025,14 @@ static bool tg3_enable_msix(struct tg3 *tp) | |||
8816 | for (i = 0; i < tp->irq_max; i++) | 9025 | for (i = 0; i < tp->irq_max; i++) |
8817 | tp->napi[i].irq_vec = msix_ent[i].vector; | 9026 | tp->napi[i].irq_vec = msix_ent[i].vector; |
8818 | 9027 | ||
8819 | tp->dev->real_num_tx_queues = 1; | 9028 | netif_set_real_num_tx_queues(tp->dev, 1); |
8820 | if (tp->irq_cnt > 1) { | 9029 | rc = tp->irq_cnt > 1 ? tp->irq_cnt - 1 : 1; |
8821 | tp->tg3_flags3 |= TG3_FLG3_ENABLE_RSS; | 9030 | if (netif_set_real_num_rx_queues(tp->dev, rc)) { |
8822 | 9031 | pci_disable_msix(tp->pdev); | |
8823 | if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5717 || | 9032 | return false; |
8824 | GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5719) { | ||
8825 | tp->tg3_flags3 |= TG3_FLG3_ENABLE_TSS; | ||
8826 | tp->dev->real_num_tx_queues = tp->irq_cnt - 1; | ||
8827 | } | ||
8828 | } | 9033 | } |
9034 | if (tp->irq_cnt > 1) | ||
9035 | tp->tg3_flags3 |= TG3_FLG3_ENABLE_RSS; | ||
8829 | 9036 | ||
8830 | return true; | 9037 | return true; |
8831 | } | 9038 | } |
@@ -8858,7 +9065,8 @@ defcfg: | |||
8858 | if (!(tp->tg3_flags2 & TG3_FLG2_USING_MSIX)) { | 9065 | if (!(tp->tg3_flags2 & TG3_FLG2_USING_MSIX)) { |
8859 | tp->irq_cnt = 1; | 9066 | tp->irq_cnt = 1; |
8860 | tp->napi[0].irq_vec = tp->pdev->irq; | 9067 | tp->napi[0].irq_vec = tp->pdev->irq; |
8861 | tp->dev->real_num_tx_queues = 1; | 9068 | netif_set_real_num_tx_queues(tp->dev, 1); |
9069 | netif_set_real_num_rx_queues(tp->dev, 1); | ||
8862 | } | 9070 | } |
8863 | } | 9071 | } |
8864 | 9072 | ||
@@ -8917,6 +9125,8 @@ static int tg3_open(struct net_device *dev) | |||
8917 | if (err) | 9125 | if (err) |
8918 | goto err_out1; | 9126 | goto err_out1; |
8919 | 9127 | ||
9128 | tg3_napi_init(tp); | ||
9129 | |||
8920 | tg3_napi_enable(tp); | 9130 | tg3_napi_enable(tp); |
8921 | 9131 | ||
8922 | for (i = 0; i < tp->irq_cnt; i++) { | 9132 | for (i = 0; i < tp->irq_cnt; i++) { |
@@ -9004,6 +9214,7 @@ err_out3: | |||
9004 | 9214 | ||
9005 | err_out2: | 9215 | err_out2: |
9006 | tg3_napi_disable(tp); | 9216 | tg3_napi_disable(tp); |
9217 | tg3_napi_fini(tp); | ||
9007 | tg3_free_consistent(tp); | 9218 | tg3_free_consistent(tp); |
9008 | 9219 | ||
9009 | err_out1: | 9220 | err_out1: |
@@ -9051,6 +9262,8 @@ static int tg3_close(struct net_device *dev) | |||
9051 | memcpy(&tp->estats_prev, tg3_get_estats(tp), | 9262 | memcpy(&tp->estats_prev, tg3_get_estats(tp), |
9052 | sizeof(tp->estats_prev)); | 9263 | sizeof(tp->estats_prev)); |
9053 | 9264 | ||
9265 | tg3_napi_fini(tp); | ||
9266 | |||
9054 | tg3_free_consistent(tp); | 9267 | tg3_free_consistent(tp); |
9055 | 9268 | ||
9056 | tg3_set_power_state(tp, PCI_D3hot); | 9269 | tg3_set_power_state(tp, PCI_D3hot); |
@@ -9596,6 +9809,9 @@ static int tg3_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) | |||
9596 | if (netif_running(dev)) { | 9809 | if (netif_running(dev)) { |
9597 | cmd->speed = tp->link_config.active_speed; | 9810 | cmd->speed = tp->link_config.active_speed; |
9598 | cmd->duplex = tp->link_config.active_duplex; | 9811 | cmd->duplex = tp->link_config.active_duplex; |
9812 | } else { | ||
9813 | cmd->speed = SPEED_INVALID; | ||
9814 | cmd->duplex = DUPLEX_INVALID; | ||
9599 | } | 9815 | } |
9600 | cmd->phy_address = tp->phy_addr; | 9816 | cmd->phy_address = tp->phy_addr; |
9601 | cmd->transceiver = XCVR_INTERNAL; | 9817 | cmd->transceiver = XCVR_INTERNAL; |
@@ -9822,10 +10038,10 @@ static void tg3_get_ringparam(struct net_device *dev, struct ethtool_ringparam * | |||
9822 | { | 10038 | { |
9823 | struct tg3 *tp = netdev_priv(dev); | 10039 | struct tg3 *tp = netdev_priv(dev); |
9824 | 10040 | ||
9825 | ering->rx_max_pending = TG3_RX_RING_SIZE - 1; | 10041 | ering->rx_max_pending = tp->rx_std_ring_mask; |
9826 | ering->rx_mini_max_pending = 0; | 10042 | ering->rx_mini_max_pending = 0; |
9827 | if (tp->tg3_flags & TG3_FLAG_JUMBO_RING_ENABLE) | 10043 | if (tp->tg3_flags & TG3_FLAG_JUMBO_RING_ENABLE) |
9828 | ering->rx_jumbo_max_pending = TG3_RX_JUMBO_RING_SIZE - 1; | 10044 | ering->rx_jumbo_max_pending = tp->rx_jmb_ring_mask; |
9829 | else | 10045 | else |
9830 | ering->rx_jumbo_max_pending = 0; | 10046 | ering->rx_jumbo_max_pending = 0; |
9831 | 10047 | ||
@@ -9846,8 +10062,8 @@ static int tg3_set_ringparam(struct net_device *dev, struct ethtool_ringparam *e | |||
9846 | struct tg3 *tp = netdev_priv(dev); | 10062 | struct tg3 *tp = netdev_priv(dev); |
9847 | int i, irq_sync = 0, err = 0; | 10063 | int i, irq_sync = 0, err = 0; |
9848 | 10064 | ||
9849 | if ((ering->rx_pending > TG3_RX_RING_SIZE - 1) || | 10065 | if ((ering->rx_pending > tp->rx_std_ring_mask) || |
9850 | (ering->rx_jumbo_pending > TG3_RX_JUMBO_RING_SIZE - 1) || | 10066 | (ering->rx_jumbo_pending > tp->rx_jmb_ring_mask) || |
9851 | (ering->tx_pending > TG3_TX_RING_SIZE - 1) || | 10067 | (ering->tx_pending > TG3_TX_RING_SIZE - 1) || |
9852 | (ering->tx_pending <= MAX_SKB_FRAGS) || | 10068 | (ering->tx_pending <= MAX_SKB_FRAGS) || |
9853 | ((tp->tg3_flags2 & TG3_FLG2_TSO_BUG) && | 10069 | ((tp->tg3_flags2 & TG3_FLG2_TSO_BUG) && |
@@ -9869,7 +10085,7 @@ static int tg3_set_ringparam(struct net_device *dev, struct ethtool_ringparam *e | |||
9869 | tp->rx_pending = 63; | 10085 | tp->rx_pending = 63; |
9870 | tp->rx_jumbo_pending = ering->rx_jumbo_pending; | 10086 | tp->rx_jumbo_pending = ering->rx_jumbo_pending; |
9871 | 10087 | ||
9872 | for (i = 0; i < TG3_IRQ_MAX_VECS; i++) | 10088 | for (i = 0; i < tp->irq_max; i++) |
9873 | tp->napi[i].tx_pending = ering->tx_pending; | 10089 | tp->napi[i].tx_pending = ering->tx_pending; |
9874 | 10090 | ||
9875 | if (netif_running(dev)) { | 10091 | if (netif_running(dev)) { |
@@ -9917,8 +10133,7 @@ static int tg3_set_pauseparam(struct net_device *dev, struct ethtool_pauseparam | |||
9917 | 10133 | ||
9918 | if (!(phydev->supported & SUPPORTED_Pause) || | 10134 | if (!(phydev->supported & SUPPORTED_Pause) || |
9919 | (!(phydev->supported & SUPPORTED_Asym_Pause) && | 10135 | (!(phydev->supported & SUPPORTED_Asym_Pause) && |
9920 | ((epause->rx_pause && !epause->tx_pause) || | 10136 | (epause->rx_pause != epause->tx_pause))) |
9921 | (!epause->rx_pause && epause->tx_pause)))) | ||
9922 | return -EINVAL; | 10137 | return -EINVAL; |
9923 | 10138 | ||
9924 | tp->link_config.flowctrl = 0; | 10139 | tp->link_config.flowctrl = 0; |
@@ -10610,12 +10825,13 @@ static int tg3_run_loopback(struct tg3 *tp, int loopback_mode) | |||
10610 | int num_pkts, tx_len, rx_len, i, err; | 10825 | int num_pkts, tx_len, rx_len, i, err; |
10611 | struct tg3_rx_buffer_desc *desc; | 10826 | struct tg3_rx_buffer_desc *desc; |
10612 | struct tg3_napi *tnapi, *rnapi; | 10827 | struct tg3_napi *tnapi, *rnapi; |
10613 | struct tg3_rx_prodring_set *tpr = &tp->prodring[0]; | 10828 | struct tg3_rx_prodring_set *tpr = &tp->napi[0].prodring; |
10614 | 10829 | ||
10615 | tnapi = &tp->napi[0]; | 10830 | tnapi = &tp->napi[0]; |
10616 | rnapi = &tp->napi[0]; | 10831 | rnapi = &tp->napi[0]; |
10617 | if (tp->irq_cnt > 1) { | 10832 | if (tp->irq_cnt > 1) { |
10618 | rnapi = &tp->napi[1]; | 10833 | if (tp->tg3_flags3 & TG3_FLG3_ENABLE_RSS) |
10834 | rnapi = &tp->napi[1]; | ||
10619 | if (tp->tg3_flags3 & TG3_FLG3_ENABLE_TSS) | 10835 | if (tp->tg3_flags3 & TG3_FLG3_ENABLE_TSS) |
10620 | tnapi = &tp->napi[1]; | 10836 | tnapi = &tp->napi[1]; |
10621 | } | 10837 | } |
@@ -12332,6 +12548,11 @@ static int __devinit tg3_phy_probe(struct tg3 *tp) | |||
12332 | } | 12548 | } |
12333 | } | 12549 | } |
12334 | 12550 | ||
12551 | if (tp->pdev->device == TG3PCI_DEVICE_TIGON3_5718 || | ||
12552 | (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_57765 && | ||
12553 | tp->pci_chip_rev_id != CHIPREV_ID_57765_A0)) | ||
12554 | tp->phy_flags |= TG3_PHYFLG_EEE_CAP; | ||
12555 | |||
12335 | if (!(tp->phy_flags & TG3_PHYFLG_ANY_SERDES) && | 12556 | if (!(tp->phy_flags & TG3_PHYFLG_ANY_SERDES) && |
12336 | !(tp->tg3_flags3 & TG3_FLG3_ENABLE_APE) && | 12557 | !(tp->tg3_flags3 & TG3_FLG3_ENABLE_APE) && |
12337 | !(tp->tg3_flags & TG3_FLAG_ENABLE_ASF)) { | 12558 | !(tp->tg3_flags & TG3_FLAG_ENABLE_ASF)) { |
@@ -12403,14 +12624,18 @@ skip_phy_reset: | |||
12403 | 12624 | ||
12404 | static void __devinit tg3_read_vpd(struct tg3 *tp) | 12625 | static void __devinit tg3_read_vpd(struct tg3 *tp) |
12405 | { | 12626 | { |
12406 | u8 vpd_data[TG3_NVM_VPD_LEN]; | 12627 | u8 *vpd_data; |
12407 | unsigned int block_end, rosize, len; | 12628 | unsigned int block_end, rosize, len; |
12408 | int j, i = 0; | 12629 | int j, i = 0; |
12409 | u32 magic; | 12630 | u32 magic; |
12410 | 12631 | ||
12411 | if ((tp->tg3_flags3 & TG3_FLG3_NO_NVRAM) || | 12632 | if ((tp->tg3_flags3 & TG3_FLG3_NO_NVRAM) || |
12412 | tg3_nvram_read(tp, 0x0, &magic)) | 12633 | tg3_nvram_read(tp, 0x0, &magic)) |
12413 | goto out_not_found; | 12634 | goto out_no_vpd; |
12635 | |||
12636 | vpd_data = kmalloc(TG3_NVM_VPD_LEN, GFP_KERNEL); | ||
12637 | if (!vpd_data) | ||
12638 | goto out_no_vpd; | ||
12414 | 12639 | ||
12415 | if (magic == TG3_EEPROM_MAGIC) { | 12640 | if (magic == TG3_EEPROM_MAGIC) { |
12416 | for (i = 0; i < TG3_NVM_VPD_LEN; i += 4) { | 12641 | for (i = 0; i < TG3_NVM_VPD_LEN; i += 4) { |
@@ -12494,43 +12719,51 @@ partno: | |||
12494 | 12719 | ||
12495 | memcpy(tp->board_part_number, &vpd_data[i], len); | 12720 | memcpy(tp->board_part_number, &vpd_data[i], len); |
12496 | 12721 | ||
12497 | return; | ||
12498 | |||
12499 | out_not_found: | 12722 | out_not_found: |
12500 | if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906) | 12723 | kfree(vpd_data); |
12724 | if (tp->board_part_number[0]) | ||
12725 | return; | ||
12726 | |||
12727 | out_no_vpd: | ||
12728 | if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5717) { | ||
12729 | if (tp->pdev->device == TG3PCI_DEVICE_TIGON3_5717) | ||
12730 | strcpy(tp->board_part_number, "BCM5717"); | ||
12731 | else if (tp->pdev->device == TG3PCI_DEVICE_TIGON3_5718) | ||
12732 | strcpy(tp->board_part_number, "BCM5718"); | ||
12733 | else | ||
12734 | goto nomatch; | ||
12735 | } else if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_57780) { | ||
12736 | if (tp->pdev->device == TG3PCI_DEVICE_TIGON3_57780) | ||
12737 | strcpy(tp->board_part_number, "BCM57780"); | ||
12738 | else if (tp->pdev->device == TG3PCI_DEVICE_TIGON3_57760) | ||
12739 | strcpy(tp->board_part_number, "BCM57760"); | ||
12740 | else if (tp->pdev->device == TG3PCI_DEVICE_TIGON3_57790) | ||
12741 | strcpy(tp->board_part_number, "BCM57790"); | ||
12742 | else if (tp->pdev->device == TG3PCI_DEVICE_TIGON3_57788) | ||
12743 | strcpy(tp->board_part_number, "BCM57788"); | ||
12744 | else | ||
12745 | goto nomatch; | ||
12746 | } else if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_57765) { | ||
12747 | if (tp->pdev->device == TG3PCI_DEVICE_TIGON3_57761) | ||
12748 | strcpy(tp->board_part_number, "BCM57761"); | ||
12749 | else if (tp->pdev->device == TG3PCI_DEVICE_TIGON3_57765) | ||
12750 | strcpy(tp->board_part_number, "BCM57765"); | ||
12751 | else if (tp->pdev->device == TG3PCI_DEVICE_TIGON3_57781) | ||
12752 | strcpy(tp->board_part_number, "BCM57781"); | ||
12753 | else if (tp->pdev->device == TG3PCI_DEVICE_TIGON3_57785) | ||
12754 | strcpy(tp->board_part_number, "BCM57785"); | ||
12755 | else if (tp->pdev->device == TG3PCI_DEVICE_TIGON3_57791) | ||
12756 | strcpy(tp->board_part_number, "BCM57791"); | ||
12757 | else if (tp->pdev->device == TG3PCI_DEVICE_TIGON3_57795) | ||
12758 | strcpy(tp->board_part_number, "BCM57795"); | ||
12759 | else | ||
12760 | goto nomatch; | ||
12761 | } else if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906) { | ||
12501 | strcpy(tp->board_part_number, "BCM95906"); | 12762 | strcpy(tp->board_part_number, "BCM95906"); |
12502 | else if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_57780 && | 12763 | } else { |
12503 | tp->pdev->device == TG3PCI_DEVICE_TIGON3_57780) | 12764 | nomatch: |
12504 | strcpy(tp->board_part_number, "BCM57780"); | ||
12505 | else if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_57780 && | ||
12506 | tp->pdev->device == TG3PCI_DEVICE_TIGON3_57760) | ||
12507 | strcpy(tp->board_part_number, "BCM57760"); | ||
12508 | else if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_57780 && | ||
12509 | tp->pdev->device == TG3PCI_DEVICE_TIGON3_57790) | ||
12510 | strcpy(tp->board_part_number, "BCM57790"); | ||
12511 | else if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_57780 && | ||
12512 | tp->pdev->device == TG3PCI_DEVICE_TIGON3_57788) | ||
12513 | strcpy(tp->board_part_number, "BCM57788"); | ||
12514 | else if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_57765 && | ||
12515 | tp->pdev->device == TG3PCI_DEVICE_TIGON3_57761) | ||
12516 | strcpy(tp->board_part_number, "BCM57761"); | ||
12517 | else if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_57765 && | ||
12518 | tp->pdev->device == TG3PCI_DEVICE_TIGON3_57765) | ||
12519 | strcpy(tp->board_part_number, "BCM57765"); | ||
12520 | else if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_57765 && | ||
12521 | tp->pdev->device == TG3PCI_DEVICE_TIGON3_57781) | ||
12522 | strcpy(tp->board_part_number, "BCM57781"); | ||
12523 | else if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_57765 && | ||
12524 | tp->pdev->device == TG3PCI_DEVICE_TIGON3_57785) | ||
12525 | strcpy(tp->board_part_number, "BCM57785"); | ||
12526 | else if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_57765 && | ||
12527 | tp->pdev->device == TG3PCI_DEVICE_TIGON3_57791) | ||
12528 | strcpy(tp->board_part_number, "BCM57791"); | ||
12529 | else if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_57765 && | ||
12530 | tp->pdev->device == TG3PCI_DEVICE_TIGON3_57795) | ||
12531 | strcpy(tp->board_part_number, "BCM57795"); | ||
12532 | else | ||
12533 | strcpy(tp->board_part_number, "none"); | 12765 | strcpy(tp->board_part_number, "none"); |
12766 | } | ||
12534 | } | 12767 | } |
12535 | 12768 | ||
12536 | static int __devinit tg3_fw_img_is_valid(struct tg3 *tp, u32 offset) | 12769 | static int __devinit tg3_fw_img_is_valid(struct tg3 *tp, u32 offset) |
@@ -12639,6 +12872,9 @@ static void __devinit tg3_read_sb_ver(struct tg3 *tp, u32 val) | |||
12639 | case TG3_EEPROM_SB_REVISION_5: | 12872 | case TG3_EEPROM_SB_REVISION_5: |
12640 | offset = TG3_EEPROM_SB_F1R5_EDH_OFF; | 12873 | offset = TG3_EEPROM_SB_F1R5_EDH_OFF; |
12641 | break; | 12874 | break; |
12875 | case TG3_EEPROM_SB_REVISION_6: | ||
12876 | offset = TG3_EEPROM_SB_F1R6_EDH_OFF; | ||
12877 | break; | ||
12642 | default: | 12878 | default: |
12643 | return; | 12879 | return; |
12644 | } | 12880 | } |
@@ -12738,10 +12974,12 @@ static void __devinit tg3_read_dash_ver(struct tg3 *tp) | |||
12738 | 12974 | ||
12739 | apedata = tg3_ape_read32(tp, TG3_APE_FW_VERSION); | 12975 | apedata = tg3_ape_read32(tp, TG3_APE_FW_VERSION); |
12740 | 12976 | ||
12741 | if (tg3_ape_read32(tp, TG3_APE_FW_FEATURES) & TG3_APE_FW_FEATURE_NCSI) | 12977 | if (tg3_ape_read32(tp, TG3_APE_FW_FEATURES) & TG3_APE_FW_FEATURE_NCSI) { |
12978 | tp->tg3_flags3 |= TG3_FLG3_APE_HAS_NCSI; | ||
12742 | fwtype = "NCSI"; | 12979 | fwtype = "NCSI"; |
12743 | else | 12980 | } else { |
12744 | fwtype = "DASH"; | 12981 | fwtype = "DASH"; |
12982 | } | ||
12745 | 12983 | ||
12746 | vlen = strlen(tp->fw_ver); | 12984 | vlen = strlen(tp->fw_ver); |
12747 | 12985 | ||
@@ -12797,6 +13035,18 @@ static void inline vlan_features_add(struct net_device *dev, unsigned long flags | |||
12797 | #endif | 13035 | #endif |
12798 | } | 13036 | } |
12799 | 13037 | ||
13038 | static inline u32 tg3_rx_ret_ring_size(struct tg3 *tp) | ||
13039 | { | ||
13040 | if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5717 || | ||
13041 | GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5719) | ||
13042 | return 4096; | ||
13043 | else if ((tp->tg3_flags & TG3_FLAG_JUMBO_CAPABLE) && | ||
13044 | !(tp->tg3_flags2 & TG3_FLG2_5780_CLASS)) | ||
13045 | return 1024; | ||
13046 | else | ||
13047 | return 512; | ||
13048 | } | ||
13049 | |||
12800 | static int __devinit tg3_get_invariants(struct tg3 *tp) | 13050 | static int __devinit tg3_get_invariants(struct tg3 *tp) |
12801 | { | 13051 | { |
12802 | static struct pci_device_id write_reorder_chipsets[] = { | 13052 | static struct pci_device_id write_reorder_chipsets[] = { |
@@ -12841,7 +13091,6 @@ static int __devinit tg3_get_invariants(struct tg3 *tp) | |||
12841 | 13091 | ||
12842 | if (tp->pdev->device == TG3PCI_DEVICE_TIGON3_5717 || | 13092 | if (tp->pdev->device == TG3PCI_DEVICE_TIGON3_5717 || |
12843 | tp->pdev->device == TG3PCI_DEVICE_TIGON3_5718 || | 13093 | tp->pdev->device == TG3PCI_DEVICE_TIGON3_5718 || |
12844 | tp->pdev->device == TG3PCI_DEVICE_TIGON3_5724 || | ||
12845 | tp->pdev->device == TG3PCI_DEVICE_TIGON3_5719) | 13094 | tp->pdev->device == TG3PCI_DEVICE_TIGON3_5719) |
12846 | pci_read_config_dword(tp->pdev, | 13095 | pci_read_config_dword(tp->pdev, |
12847 | TG3PCI_GEN2_PRODID_ASICREV, | 13096 | TG3PCI_GEN2_PRODID_ASICREV, |
@@ -13412,10 +13661,6 @@ static int __devinit tg3_get_invariants(struct tg3 *tp) | |||
13412 | if (err) | 13661 | if (err) |
13413 | return err; | 13662 | return err; |
13414 | 13663 | ||
13415 | if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5717 && | ||
13416 | tp->pci_chip_rev_id != CHIPREV_ID_5717_A0) | ||
13417 | return -ENOTSUPP; | ||
13418 | |||
13419 | /* Initialize data/descriptor byte/word swapping. */ | 13664 | /* Initialize data/descriptor byte/word swapping. */ |
13420 | val = tr32(GRC_MODE); | 13665 | val = tr32(GRC_MODE); |
13421 | val &= GRC_MODE_HOST_STACKUP; | 13666 | val &= GRC_MODE_HOST_STACKUP; |
@@ -13555,7 +13800,11 @@ static int __devinit tg3_get_invariants(struct tg3 *tp) | |||
13555 | #endif | 13800 | #endif |
13556 | } | 13801 | } |
13557 | 13802 | ||
13558 | tp->rx_std_max_post = TG3_RX_RING_SIZE; | 13803 | tp->rx_std_ring_mask = TG3_RX_STD_RING_SIZE(tp) - 1; |
13804 | tp->rx_jmb_ring_mask = TG3_RX_JMB_RING_SIZE(tp) - 1; | ||
13805 | tp->rx_ret_ring_mask = tg3_rx_ret_ring_size(tp) - 1; | ||
13806 | |||
13807 | tp->rx_std_max_post = tp->rx_std_ring_mask + 1; | ||
13559 | 13808 | ||
13560 | /* Increment the rx prod index on the rx std ring by at most | 13809 | /* Increment the rx prod index on the rx std ring by at most |
13561 | * 8 for these chips to workaround hw errata. | 13810 | * 8 for these chips to workaround hw errata. |
@@ -14444,7 +14693,7 @@ static int __devinit tg3_init_one(struct pci_dev *pdev, | |||
14444 | } | 14693 | } |
14445 | 14694 | ||
14446 | if ((tp->tg3_flags3 & TG3_FLG3_5755_PLUS) && | 14695 | if ((tp->tg3_flags3 & TG3_FLG3_5755_PLUS) && |
14447 | tp->pci_chip_rev_id != CHIPREV_ID_5717_A0 && | 14696 | GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5717 && |
14448 | GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5719) | 14697 | GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5719) |
14449 | dev->netdev_ops = &tg3_netdev_ops; | 14698 | dev->netdev_ops = &tg3_netdev_ops; |
14450 | else | 14699 | else |
@@ -14583,7 +14832,7 @@ static int __devinit tg3_init_one(struct pci_dev *pdev, | |||
14583 | intmbx = MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW; | 14832 | intmbx = MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW; |
14584 | rcvmbx = MAILBOX_RCVRET_CON_IDX_0 + TG3_64BIT_REG_LOW; | 14833 | rcvmbx = MAILBOX_RCVRET_CON_IDX_0 + TG3_64BIT_REG_LOW; |
14585 | sndmbx = MAILBOX_SNDHOST_PROD_IDX_0 + TG3_64BIT_REG_LOW; | 14834 | sndmbx = MAILBOX_SNDHOST_PROD_IDX_0 + TG3_64BIT_REG_LOW; |
14586 | for (i = 0; i < TG3_IRQ_MAX_VECS; i++) { | 14835 | for (i = 0; i < tp->irq_max; i++) { |
14587 | struct tg3_napi *tnapi = &tp->napi[i]; | 14836 | struct tg3_napi *tnapi = &tp->napi[i]; |
14588 | 14837 | ||
14589 | tnapi->tp = tp; | 14838 | tnapi->tp = tp; |
@@ -14598,13 +14847,10 @@ static int __devinit tg3_init_one(struct pci_dev *pdev, | |||
14598 | tnapi->consmbox = rcvmbx; | 14847 | tnapi->consmbox = rcvmbx; |
14599 | tnapi->prodmbox = sndmbx; | 14848 | tnapi->prodmbox = sndmbx; |
14600 | 14849 | ||
14601 | if (i) { | 14850 | if (i) |
14602 | tnapi->coal_now = HOSTCC_MODE_COAL_VEC1_NOW << (i - 1); | 14851 | tnapi->coal_now = HOSTCC_MODE_COAL_VEC1_NOW << (i - 1); |
14603 | netif_napi_add(dev, &tnapi->napi, tg3_poll_msix, 64); | 14852 | else |
14604 | } else { | ||
14605 | tnapi->coal_now = HOSTCC_MODE_NOW; | 14853 | tnapi->coal_now = HOSTCC_MODE_NOW; |
14606 | netif_napi_add(dev, &tnapi->napi, tg3_poll, 64); | ||
14607 | } | ||
14608 | 14854 | ||
14609 | if (!(tp->tg3_flags & TG3_FLAG_SUPPORT_MSIX)) | 14855 | if (!(tp->tg3_flags & TG3_FLAG_SUPPORT_MSIX)) |
14610 | break; | 14856 | break; |