aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/tg3.c
diff options
context:
space:
mode:
authorMatt Carlson <mcarlson@broadcom.com>2010-09-30 06:34:36 -0400
committerDavid S. Miller <davem@davemloft.net>2010-10-01 03:24:44 -0400
commit7cb32cf23c63a371cf89bfaad3f911a1609241cc (patch)
tree2fd3bd526e8b25f03f4d87a0e7c4baea45acf473 /drivers/net/tg3.c
parent2c49a44df33e22e1f48bd8d51781e7f38d55d002 (diff)
tg3: Add extend rx ring sizes for 5717 and 5719
This patch increases the rx ring sizes for those asic revs that support them. Signed-off-by: Matt Carlson <mcarlson@broadcom.com> Reviewed-by: Michael Chan <mchan@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/tg3.c')
-rw-r--r--drivers/net/tg3.c55
1 files changed, 40 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