diff options
-rw-r--r-- | drivers/net/tg3.c | 67 | ||||
-rw-r--r-- | drivers/net/tg3.h | 9 |
2 files changed, 53 insertions, 23 deletions
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c index 58787ea8b7a4..4aecb0a82e56 100644 --- a/drivers/net/tg3.c +++ b/drivers/net/tg3.c | |||
@@ -7952,6 +7952,48 @@ static void tg3_rings_reset(struct tg3 *tp) | |||
7952 | } | 7952 | } |
7953 | } | 7953 | } |
7954 | 7954 | ||
7955 | static void tg3_setup_rxbd_thresholds(struct tg3 *tp) | ||
7956 | { | ||
7957 | u32 val, bdcache_maxcnt, host_rep_thresh, nic_rep_thresh; | ||
7958 | |||
7959 | if (!(tp->tg3_flags2 & TG3_FLG2_5750_PLUS) || | ||
7960 | (tp->tg3_flags2 & TG3_FLG2_5780_CLASS) || | ||
7961 | GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5750 || | ||
7962 | GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5752) | ||
7963 | bdcache_maxcnt = TG3_SRAM_RX_STD_BDCACHE_SIZE_5700; | ||
7964 | else if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5755 || | ||
7965 | GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5787) | ||
7966 | bdcache_maxcnt = TG3_SRAM_RX_STD_BDCACHE_SIZE_5755; | ||
7967 | else | ||
7968 | bdcache_maxcnt = TG3_SRAM_RX_STD_BDCACHE_SIZE_5906; | ||
7969 | |||
7970 | nic_rep_thresh = min(bdcache_maxcnt / 2, tp->rx_std_max_post); | ||
7971 | host_rep_thresh = max_t(u32, tp->rx_pending / 8, 1); | ||
7972 | |||
7973 | val = min(nic_rep_thresh, host_rep_thresh); | ||
7974 | tw32(RCVBDI_STD_THRESH, val); | ||
7975 | |||
7976 | if (tp->tg3_flags3 & TG3_FLG3_57765_PLUS) | ||
7977 | tw32(STD_REPLENISH_LWM, bdcache_maxcnt); | ||
7978 | |||
7979 | if (!(tp->tg3_flags & TG3_FLAG_JUMBO_CAPABLE) || | ||
7980 | (tp->tg3_flags2 & TG3_FLG2_5780_CLASS)) | ||
7981 | return; | ||
7982 | |||
7983 | if (!(tp->tg3_flags2 & TG3_FLG2_5705_PLUS)) | ||
7984 | bdcache_maxcnt = TG3_SRAM_RX_JMB_BDCACHE_SIZE_5700; | ||
7985 | else | ||
7986 | bdcache_maxcnt = TG3_SRAM_RX_JMB_BDCACHE_SIZE_5717; | ||
7987 | |||
7988 | host_rep_thresh = max_t(u32, tp->rx_jumbo_pending / 8, 1); | ||
7989 | |||
7990 | val = min(bdcache_maxcnt / 2, host_rep_thresh); | ||
7991 | tw32(RCVBDI_JUMBO_THRESH, val); | ||
7992 | |||
7993 | if (tp->tg3_flags3 & TG3_FLG3_57765_PLUS) | ||
7994 | tw32(JMB_REPLENISH_LWM, bdcache_maxcnt); | ||
7995 | } | ||
7996 | |||
7955 | /* tp->lock is held. */ | 7997 | /* tp->lock is held. */ |
7956 | static int tg3_reset_hw(struct tg3 *tp, int reset_phy) | 7998 | static int tg3_reset_hw(struct tg3 *tp, int reset_phy) |
7957 | { | 7999 | { |
@@ -8223,21 +8265,10 @@ static int tg3_reset_hw(struct tg3 *tp, int reset_phy) | |||
8223 | return -ENODEV; | 8265 | return -ENODEV; |
8224 | } | 8266 | } |
8225 | 8267 | ||
8226 | /* Setup replenish threshold. */ | 8268 | if (tp->pci_chip_rev_id == CHIPREV_ID_5906_A1) |
8227 | val = tp->rx_pending / 8; | 8269 | tw32(ISO_PKT_TX, (tr32(ISO_PKT_TX) & ~0x3) | 0x2); |
8228 | if (val == 0) | ||
8229 | val = 1; | ||
8230 | else if (val > tp->rx_std_max_post) | ||
8231 | val = tp->rx_std_max_post; | ||
8232 | else if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906) { | ||
8233 | if (tp->pci_chip_rev_id == CHIPREV_ID_5906_A1) | ||
8234 | tw32(ISO_PKT_TX, (tr32(ISO_PKT_TX) & ~0x3) | 0x2); | ||
8235 | 8270 | ||
8236 | if (val > (TG3_RX_INTERNAL_RING_SZ_5906 / 2)) | 8271 | tg3_setup_rxbd_thresholds(tp); |
8237 | val = TG3_RX_INTERNAL_RING_SZ_5906 / 2; | ||
8238 | } | ||
8239 | |||
8240 | tw32(RCVBDI_STD_THRESH, val); | ||
8241 | 8272 | ||
8242 | /* Initialize TG3_BDINFO's at: | 8273 | /* Initialize TG3_BDINFO's at: |
8243 | * RCVDBDI_STD_BD: standard eth size rx ring | 8274 | * RCVDBDI_STD_BD: standard eth size rx ring |
@@ -8275,8 +8306,6 @@ static int tg3_reset_hw(struct tg3 *tp, int reset_phy) | |||
8275 | if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5719 || | 8306 | if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5719 || |
8276 | ((tp->tg3_flags & TG3_FLAG_JUMBO_CAPABLE) && | 8307 | ((tp->tg3_flags & TG3_FLAG_JUMBO_CAPABLE) && |
8277 | !(tp->tg3_flags2 & TG3_FLG2_5780_CLASS))) { | 8308 | !(tp->tg3_flags2 & TG3_FLG2_5780_CLASS))) { |
8278 | /* Setup replenish threshold. */ | ||
8279 | tw32(RCVBDI_JUMBO_THRESH, tp->rx_jumbo_pending / 8); | ||
8280 | 8309 | ||
8281 | if (tp->tg3_flags & TG3_FLAG_JUMBO_RING_ENABLE) { | 8310 | if (tp->tg3_flags & TG3_FLAG_JUMBO_RING_ENABLE) { |
8282 | tw32(RCVDBDI_JUMBO_BD + TG3_BDINFO_HOST_ADDR + TG3_64BIT_REG_HIGH, | 8311 | tw32(RCVDBDI_JUMBO_BD + TG3_BDINFO_HOST_ADDR + TG3_64BIT_REG_HIGH, |
@@ -8317,11 +8346,6 @@ static int tg3_reset_hw(struct tg3 *tp, int reset_phy) | |||
8317 | tp->rx_jumbo_pending : 0; | 8346 | tp->rx_jumbo_pending : 0; |
8318 | tw32_rx_mbox(TG3_RX_JMB_PROD_IDX_REG, tpr->rx_jmb_prod_idx); | 8347 | tw32_rx_mbox(TG3_RX_JMB_PROD_IDX_REG, tpr->rx_jmb_prod_idx); |
8319 | 8348 | ||
8320 | if (tp->tg3_flags3 & TG3_FLG3_57765_PLUS) { | ||
8321 | tw32(STD_REPLENISH_LWM, 32); | ||
8322 | tw32(JMB_REPLENISH_LWM, 16); | ||
8323 | } | ||
8324 | |||
8325 | tg3_rings_reset(tp); | 8349 | tg3_rings_reset(tp); |
8326 | 8350 | ||
8327 | /* Initialize MAC address and backoff seed. */ | 8351 | /* Initialize MAC address and backoff seed. */ |
@@ -13599,6 +13623,7 @@ static int __devinit tg3_get_invariants(struct tg3 *tp) | |||
13599 | (tp->tg3_flags2 & TG3_FLG2_5780_CLASS)) | 13623 | (tp->tg3_flags2 & TG3_FLG2_5780_CLASS)) |
13600 | tp->tg3_flags2 |= TG3_FLG2_5750_PLUS; | 13624 | tp->tg3_flags2 |= TG3_FLG2_5750_PLUS; |
13601 | 13625 | ||
13626 | |||
13602 | if ((GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705) || | 13627 | if ((GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705) || |
13603 | (tp->tg3_flags2 & TG3_FLG2_5750_PLUS)) | 13628 | (tp->tg3_flags2 & TG3_FLG2_5750_PLUS)) |
13604 | tp->tg3_flags2 |= TG3_FLG2_5705_PLUS; | 13629 | tp->tg3_flags2 |= TG3_FLG2_5705_PLUS; |
diff --git a/drivers/net/tg3.h b/drivers/net/tg3.h index db50bfe046e4..dd331f8d3f7a 100644 --- a/drivers/net/tg3.h +++ b/drivers/net/tg3.h | |||
@@ -23,8 +23,6 @@ | |||
23 | #define TG3_BDINFO_NIC_ADDR 0xcUL /* 32-bit */ | 23 | #define TG3_BDINFO_NIC_ADDR 0xcUL /* 32-bit */ |
24 | #define TG3_BDINFO_SIZE 0x10UL | 24 | #define TG3_BDINFO_SIZE 0x10UL |
25 | 25 | ||
26 | #define TG3_RX_INTERNAL_RING_SZ_5906 32 | ||
27 | |||
28 | #define TG3_RX_STD_MAX_SIZE_5700 512 | 26 | #define TG3_RX_STD_MAX_SIZE_5700 512 |
29 | #define TG3_RX_STD_MAX_SIZE_5717 2048 | 27 | #define TG3_RX_STD_MAX_SIZE_5717 2048 |
30 | #define TG3_RX_JMB_MAX_SIZE_5700 256 | 28 | #define TG3_RX_JMB_MAX_SIZE_5700 256 |
@@ -2136,6 +2134,13 @@ | |||
2136 | #define NIC_SRAM_MBUF_POOL_BASE5705 0x00010000 | 2134 | #define NIC_SRAM_MBUF_POOL_BASE5705 0x00010000 |
2137 | #define NIC_SRAM_MBUF_POOL_SIZE5705 0x0000e000 | 2135 | #define NIC_SRAM_MBUF_POOL_SIZE5705 0x0000e000 |
2138 | 2136 | ||
2137 | #define TG3_SRAM_RX_STD_BDCACHE_SIZE_5700 128 | ||
2138 | #define TG3_SRAM_RX_STD_BDCACHE_SIZE_5755 64 | ||
2139 | #define TG3_SRAM_RX_STD_BDCACHE_SIZE_5906 32 | ||
2140 | |||
2141 | #define TG3_SRAM_RX_JMB_BDCACHE_SIZE_5700 64 | ||
2142 | #define TG3_SRAM_RX_JMB_BDCACHE_SIZE_5717 16 | ||
2143 | |||
2139 | 2144 | ||
2140 | /* Currently this is fixed. */ | 2145 | /* Currently this is fixed. */ |
2141 | #define TG3_PHY_MII_ADDR 0x01 | 2146 | #define TG3_PHY_MII_ADDR 0x01 |