diff options
author | Matt Carlson <mcarlson@broadcom.com> | 2011-12-14 06:09:58 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-12-15 13:09:10 -0500 |
commit | a4cb428d31e11af1662e19c6fab9133c0f7a0eda (patch) | |
tree | fcf4cf8bf9f007549510f2d508b61c4c39ea7f7e | |
parent | 4f272096054b6154e31e850f192eef5782f156c6 (diff) |
tg3: Make the TX BD DMA limit configurable
The 57766 ASIC rev will impose a new TX BD DMA limit on the driver.
This patch prepares for 57766 support by making the tx BD DMA limit
tunable.
Signed-off-by: Matt Carlson <mcarlson@broadcom.com>
Reviewed-by: Michael Chan <mchan@broadcom.com>
Reviewed-by: Benjamin Li <benli@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/ethernet/broadcom/tg3.c | 16 | ||||
-rw-r--r-- | drivers/net/ethernet/broadcom/tg3.h | 1 |
2 files changed, 9 insertions, 8 deletions
diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c index 8a6ea1970ea7..9c9a4b4a9f69 100644 --- a/drivers/net/ethernet/broadcom/tg3.c +++ b/drivers/net/ethernet/broadcom/tg3.c | |||
@@ -199,7 +199,7 @@ static inline void _tg3_flag_clear(enum TG3_FLAGS flag, unsigned long *bits) | |||
199 | 199 | ||
200 | /* minimum number of free TX descriptors required to wake up TX process */ | 200 | /* minimum number of free TX descriptors required to wake up TX process */ |
201 | #define TG3_TX_WAKEUP_THRESH(tnapi) ((tnapi)->tx_pending / 4) | 201 | #define TG3_TX_WAKEUP_THRESH(tnapi) ((tnapi)->tx_pending / 4) |
202 | #define TG3_TX_BD_DMA_MAX 4096 | 202 | #define TG3_TX_BD_DMA_MAX_4K 4096 |
203 | 203 | ||
204 | #define TG3_RAW_IP_ALIGN 2 | 204 | #define TG3_RAW_IP_ALIGN 2 |
205 | 205 | ||
@@ -6449,17 +6449,17 @@ static bool tg3_tx_frag_set(struct tg3_napi *tnapi, u32 *entry, u32 *budget, | |||
6449 | if (tg3_40bit_overflow_test(tp, map, len)) | 6449 | if (tg3_40bit_overflow_test(tp, map, len)) |
6450 | hwbug = 1; | 6450 | hwbug = 1; |
6451 | 6451 | ||
6452 | if (tg3_flag(tp, 4K_FIFO_LIMIT)) { | 6452 | if (tp->dma_limit) { |
6453 | u32 prvidx = *entry; | 6453 | u32 prvidx = *entry; |
6454 | u32 tmp_flag = flags & ~TXD_FLAG_END; | 6454 | u32 tmp_flag = flags & ~TXD_FLAG_END; |
6455 | while (len > TG3_TX_BD_DMA_MAX && *budget) { | 6455 | while (len > tp->dma_limit && *budget) { |
6456 | u32 frag_len = TG3_TX_BD_DMA_MAX; | 6456 | u32 frag_len = tp->dma_limit; |
6457 | len -= TG3_TX_BD_DMA_MAX; | 6457 | len -= tp->dma_limit; |
6458 | 6458 | ||
6459 | /* Avoid the 8byte DMA problem */ | 6459 | /* Avoid the 8byte DMA problem */ |
6460 | if (len <= 8) { | 6460 | if (len <= 8) { |
6461 | len += TG3_TX_BD_DMA_MAX / 2; | 6461 | len += tp->dma_limit / 2; |
6462 | frag_len = TG3_TX_BD_DMA_MAX / 2; | 6462 | frag_len = tp->dma_limit / 2; |
6463 | } | 6463 | } |
6464 | 6464 | ||
6465 | tnapi->tx_buffers[*entry].fragmented = true; | 6465 | tnapi->tx_buffers[*entry].fragmented = true; |
@@ -14041,7 +14041,7 @@ static int __devinit tg3_get_invariants(struct tg3 *tp) | |||
14041 | tg3_flag_set(tp, SHORT_DMA_BUG); | 14041 | tg3_flag_set(tp, SHORT_DMA_BUG); |
14042 | 14042 | ||
14043 | if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5719) | 14043 | if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5719) |
14044 | tg3_flag_set(tp, 4K_FIFO_LIMIT); | 14044 | tp->dma_limit = TG3_TX_BD_DMA_MAX_4K; |
14045 | 14045 | ||
14046 | if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5717 || | 14046 | if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5717 || |
14047 | GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5719 || | 14047 | GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5719 || |
diff --git a/drivers/net/ethernet/broadcom/tg3.h b/drivers/net/ethernet/broadcom/tg3.h index 9d9f6349cb8c..2ba5be16575b 100644 --- a/drivers/net/ethernet/broadcom/tg3.h +++ b/drivers/net/ethernet/broadcom/tg3.h | |||
@@ -2994,6 +2994,7 @@ struct tg3 { | |||
2994 | /* begin "tx thread" cacheline section */ | 2994 | /* begin "tx thread" cacheline section */ |
2995 | void (*write32_tx_mbox) (struct tg3 *, u32, | 2995 | void (*write32_tx_mbox) (struct tg3 *, u32, |
2996 | u32); | 2996 | u32); |
2997 | u32 dma_limit; | ||
2997 | 2998 | ||
2998 | /* begin "rx thread" cacheline section */ | 2999 | /* begin "rx thread" cacheline section */ |
2999 | struct tg3_napi napi[TG3_IRQ_MAX_VECS]; | 3000 | struct tg3_napi napi[TG3_IRQ_MAX_VECS]; |