aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/tg3.c55
-rw-r--r--drivers/net/tg3.h3
2 files changed, 43 insertions, 15 deletions
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index af59a293b5ba..d6de46b60b7e 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -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_STD_RING_SIZE(tp) 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_JMB_RING_SIZE(tp) 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,9 +119,6 @@
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)
@@ -125,7 +128,7 @@
125#define TG3_RX_JMB_RING_BYTES(tp) \ 128#define TG3_RX_JMB_RING_BYTES(tp) \
126 (sizeof(struct tg3_ext_rx_buffer_desc) * TG3_RX_JMB_RING_SIZE(tp)) 129 (sizeof(struct tg3_ext_rx_buffer_desc) * TG3_RX_JMB_RING_SIZE(tp))
127#define TG3_RX_RCB_RING_BYTES(tp) \ 130#define TG3_RX_RCB_RING_BYTES(tp) \
128 (sizeof(struct tg3_rx_buffer_desc) * 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))
@@ -4724,7 +4727,7 @@ next_pkt:
4724 } 4727 }
4725next_pkt_nopost: 4728next_pkt_nopost:
4726 sw_idx++; 4729 sw_idx++;
4727 sw_idx &= (TG3_RX_RCB_RING_SIZE(tp) - 1); 4730 sw_idx &= tp->rx_ret_ring_mask;
4728 4731
4729 /* Refresh hw_idx to see if there is new work */ 4732 /* Refresh hw_idx to see if there is new work */
4730 if (sw_idx == hw_idx) { 4733 if (sw_idx == hw_idx) {
@@ -7612,8 +7615,8 @@ static void tg3_rings_reset(struct tg3 *tp)
7612 7615
7613 if (tnapi->rx_rcb) { 7616 if (tnapi->rx_rcb) {
7614 tg3_set_bdinfo(tp, rxrcb, tnapi->rx_rcb_mapping, 7617 tg3_set_bdinfo(tp, rxrcb, tnapi->rx_rcb_mapping,
7615 (TG3_RX_RCB_RING_SIZE(tp) << 7618 (tp->rx_ret_ring_mask + 1) <<
7616 BDINFO_FLAGS_MAXLEN_SHIFT), 0); 7619 BDINFO_FLAGS_MAXLEN_SHIFT, 0);
7617 rxrcb += TG3_BDINFO_SIZE; 7620 rxrcb += TG3_BDINFO_SIZE;
7618 } 7621 }
7619 7622
@@ -7636,7 +7639,7 @@ static void tg3_rings_reset(struct tg3 *tp)
7636 } 7639 }
7637 7640
7638 tg3_set_bdinfo(tp, rxrcb, tnapi->rx_rcb_mapping, 7641 tg3_set_bdinfo(tp, rxrcb, tnapi->rx_rcb_mapping,
7639 (TG3_RX_RCB_RING_SIZE(tp) << 7642 ((tp->rx_ret_ring_mask + 1) <<
7640 BDINFO_FLAGS_MAXLEN_SHIFT), 0); 7643 BDINFO_FLAGS_MAXLEN_SHIFT), 0);
7641 7644
7642 stblk += 8; 7645 stblk += 8;
@@ -7949,10 +7952,14 @@ static int tg3_reset_hw(struct tg3 *tp, int reset_phy)
7949 BDINFO_FLAGS_DISABLED); 7952 BDINFO_FLAGS_DISABLED);
7950 } 7953 }
7951 7954
7952 if (tp->tg3_flags3 & TG3_FLG3_5717_PLUS) 7955 if (tp->tg3_flags3 & TG3_FLG3_5717_PLUS) {
7953 val = (RX_STD_MAX_SIZE_5705 << BDINFO_FLAGS_MAXLEN_SHIFT) | 7956 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_57765)
7954 (TG3_RX_STD_DMA_SZ << 2); 7957 val = RX_STD_MAX_SIZE_5705;
7955 else 7958 else
7959 val = RX_STD_MAX_SIZE_5717;
7960 val <<= BDINFO_FLAGS_MAXLEN_SHIFT;
7961 val |= (TG3_RX_STD_DMA_SZ << 2);
7962 } else
7956 val = TG3_RX_STD_DMA_SZ << BDINFO_FLAGS_MAXLEN_SHIFT; 7963 val = TG3_RX_STD_DMA_SZ << BDINFO_FLAGS_MAXLEN_SHIFT;
7957 } else 7964 } else
7958 val = RX_STD_MAX_SIZE_5705 << BDINFO_FLAGS_MAXLEN_SHIFT; 7965 val = RX_STD_MAX_SIZE_5705 << BDINFO_FLAGS_MAXLEN_SHIFT;
@@ -8235,7 +8242,11 @@ static int tg3_reset_hw(struct tg3 *tp, int reset_phy)
8235 8242
8236 tw32(SNDBDC_MODE, SNDBDC_MODE_ENABLE | SNDBDC_MODE_ATTN_ENABLE); 8243 tw32(SNDBDC_MODE, SNDBDC_MODE_ENABLE | SNDBDC_MODE_ATTN_ENABLE);
8237 tw32(RCVBDI_MODE, RCVBDI_MODE_ENABLE | RCVBDI_MODE_RCB_ATTN_ENAB); 8244 tw32(RCVBDI_MODE, RCVBDI_MODE_ENABLE | RCVBDI_MODE_RCB_ATTN_ENAB);
8238 tw32(RCVDBDI_MODE, RCVDBDI_MODE_ENABLE | RCVDBDI_MODE_INV_RING_SZ); 8245 val = RCVDBDI_MODE_ENABLE | RCVDBDI_MODE_INV_RING_SZ;
8246 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5717 ||
8247 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5719)
8248 val |= RCVDBDI_MODE_LRG_RING_SZ;
8249 tw32(RCVDBDI_MODE, val);
8239 tw32(SNDDATAI_MODE, SNDDATAI_MODE_ENABLE); 8250 tw32(SNDDATAI_MODE, SNDDATAI_MODE_ENABLE);
8240 if (tp->tg3_flags2 & TG3_FLG2_HW_TSO) 8251 if (tp->tg3_flags2 & TG3_FLG2_HW_TSO)
8241 tw32(SNDDATAI_MODE, SNDDATAI_MODE_ENABLE | 0x8); 8252 tw32(SNDDATAI_MODE, SNDDATAI_MODE_ENABLE | 0x8);
@@ -12851,6 +12862,18 @@ static void inline vlan_features_add(struct net_device *dev, unsigned long flags
12851#endif 12862#endif
12852} 12863}
12853 12864
12865static inline u32 tg3_rx_ret_ring_size(struct tg3 *tp)
12866{
12867 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5717 ||
12868 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5719)
12869 return 4096;
12870 else if ((tp->tg3_flags & TG3_FLAG_JUMBO_CAPABLE) &&
12871 !(tp->tg3_flags2 & TG3_FLG2_5780_CLASS))
12872 return 1024;
12873 else
12874 return 512;
12875}
12876
12854static int __devinit tg3_get_invariants(struct tg3 *tp) 12877static int __devinit tg3_get_invariants(struct tg3 *tp)
12855{ 12878{
12856 static struct pci_device_id write_reorder_chipsets[] = { 12879 static struct pci_device_id write_reorder_chipsets[] = {
@@ -13606,6 +13629,8 @@ static int __devinit tg3_get_invariants(struct tg3 *tp)
13606 13629
13607 tp->rx_std_ring_mask = TG3_RX_STD_RING_SIZE(tp) - 1; 13630 tp->rx_std_ring_mask = TG3_RX_STD_RING_SIZE(tp) - 1;
13608 tp->rx_jmb_ring_mask = TG3_RX_JMB_RING_SIZE(tp) - 1; 13631 tp->rx_jmb_ring_mask = TG3_RX_JMB_RING_SIZE(tp) - 1;
13632 tp->rx_ret_ring_mask = tg3_rx_ret_ring_size(tp) - 1;
13633
13609 tp->rx_std_max_post = tp->rx_std_ring_mask + 1; 13634 tp->rx_std_max_post = tp->rx_std_ring_mask + 1;
13610 13635
13611 /* Increment the rx prod index on the rx std ring by at most 13636 /* Increment the rx prod index on the rx std ring by at most
diff --git a/drivers/net/tg3.h b/drivers/net/tg3.h
index 9763298c22c6..f6b709a3ca32 100644
--- a/drivers/net/tg3.h
+++ b/drivers/net/tg3.h
@@ -26,6 +26,7 @@
26#define TG3_RX_INTERNAL_RING_SZ_5906 32 26#define TG3_RX_INTERNAL_RING_SZ_5906 32
27 27
28#define RX_STD_MAX_SIZE_5705 512 28#define RX_STD_MAX_SIZE_5705 512
29#define RX_STD_MAX_SIZE_5717 2048
29#define RX_JUMBO_MAX_SIZE 0xdeadbeef /* XXX */ 30#define RX_JUMBO_MAX_SIZE 0xdeadbeef /* XXX */
30 31
31/* First 256 bytes are a mirror of PCI config space. */ 32/* First 256 bytes are a mirror of PCI config space. */
@@ -972,6 +973,7 @@
972#define RCVDBDI_MODE_JUMBOBD_NEEDED 0x00000004 973#define RCVDBDI_MODE_JUMBOBD_NEEDED 0x00000004
973#define RCVDBDI_MODE_FRM_TOO_BIG 0x00000008 974#define RCVDBDI_MODE_FRM_TOO_BIG 0x00000008
974#define RCVDBDI_MODE_INV_RING_SZ 0x00000010 975#define RCVDBDI_MODE_INV_RING_SZ 0x00000010
976#define RCVDBDI_MODE_LRG_RING_SZ 0x00010000
975#define RCVDBDI_STATUS 0x00002404 977#define RCVDBDI_STATUS 0x00002404
976#define RCVDBDI_STATUS_JUMBOBD_NEEDED 0x00000004 978#define RCVDBDI_STATUS_JUMBOBD_NEEDED 0x00000004
977#define RCVDBDI_STATUS_FRM_TOO_BIG 0x00000008 979#define RCVDBDI_STATUS_FRM_TOO_BIG 0x00000008
@@ -2764,6 +2766,7 @@ struct tg3 {
2764 u32 rx_copy_thresh; 2766 u32 rx_copy_thresh;
2765 u32 rx_std_ring_mask; 2767 u32 rx_std_ring_mask;
2766 u32 rx_jmb_ring_mask; 2768 u32 rx_jmb_ring_mask;
2769 u32 rx_ret_ring_mask;
2767 u32 rx_pending; 2770 u32 rx_pending;
2768 u32 rx_jumbo_pending; 2771 u32 rx_jumbo_pending;
2769 u32 rx_std_max_post; 2772 u32 rx_std_max_post;