aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/e1000e/netdev.c
diff options
context:
space:
mode:
authorJesse Brandeburg <jesse.brandeburg@intel.com>2010-09-29 17:38:49 -0400
committerDavid S. Miller <davem@davemloft.net>2010-09-30 20:59:31 -0400
commit3a3b75860527a11ba5035c6aa576079245d09e2a (patch)
tree0dbd487fe8910a02c39ab4f84da6d16ebe6d29e3 /drivers/net/e1000e/netdev.c
parent6af3b9ebfea38d0a057fbd7bdcecc61ac5662f02 (diff)
e1000e: use hardware writeback batching
Most e1000e parts support batching writebacks. The problem with this is that when some of the TADV or TIDV timers are not set, Tx can sit forever. This is solved in this patch with write flushes using the Flush Partial Descriptors (FPD) bit in TIDV and RDTR. This improves bus utilization and removes partial writes on e1000e, particularly from 82571 parts in S5500 chipset based machines. Only ES2LAN and 82571/2 parts are included in this optimization, to reduce testing load. Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com> Tested-by: Emil Tantilov <emil.s.tantilov@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/e1000e/netdev.c')
-rw-r--r--drivers/net/e1000e/netdev.c53
1 files changed, 53 insertions, 0 deletions
diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c
index c69563c3ce96..1aa4228e860a 100644
--- a/drivers/net/e1000e/netdev.c
+++ b/drivers/net/e1000e/netdev.c
@@ -2650,6 +2650,26 @@ static void e1000_configure_tx(struct e1000_adapter *adapter)
2650 /* Tx irq moderation */ 2650 /* Tx irq moderation */
2651 ew32(TADV, adapter->tx_abs_int_delay); 2651 ew32(TADV, adapter->tx_abs_int_delay);
2652 2652
2653 if (adapter->flags2 & FLAG2_DMA_BURST) {
2654 u32 txdctl = er32(TXDCTL(0));
2655 txdctl &= ~(E1000_TXDCTL_PTHRESH | E1000_TXDCTL_HTHRESH |
2656 E1000_TXDCTL_WTHRESH);
2657 /*
2658 * set up some performance related parameters to encourage the
2659 * hardware to use the bus more efficiently in bursts, depends
2660 * on the tx_int_delay to be enabled,
2661 * wthresh = 5 ==> burst write a cacheline (64 bytes) at a time
2662 * hthresh = 1 ==> prefetch when one or more available
2663 * pthresh = 0x1f ==> prefetch if internal cache 31 or less
2664 * BEWARE: this seems to work but should be considered first if
2665 * there are tx hangs or other tx related bugs
2666 */
2667 txdctl |= E1000_TXDCTL_DMA_BURST_ENABLE;
2668 ew32(TXDCTL(0), txdctl);
2669 /* erratum work around: set txdctl the same for both queues */
2670 ew32(TXDCTL(1), txdctl);
2671 }
2672
2653 /* Program the Transmit Control Register */ 2673 /* Program the Transmit Control Register */
2654 tctl = er32(TCTL); 2674 tctl = er32(TCTL);
2655 tctl &= ~E1000_TCTL_CT; 2675 tctl &= ~E1000_TCTL_CT;
@@ -2872,6 +2892,29 @@ static void e1000_configure_rx(struct e1000_adapter *adapter)
2872 e1e_flush(); 2892 e1e_flush();
2873 msleep(10); 2893 msleep(10);
2874 2894
2895 if (adapter->flags2 & FLAG2_DMA_BURST) {
2896 /*
2897 * set the writeback threshold (only takes effect if the RDTR
2898 * is set). set GRAN=1 and write back up to 0x4 worth, and
2899 * enable prefetching of 0x20 rx descriptors
2900 * granularity = 01
2901 * wthresh = 04,
2902 * hthresh = 04,
2903 * pthresh = 0x20
2904 */
2905 ew32(RXDCTL(0), E1000_RXDCTL_DMA_BURST_ENABLE);
2906 ew32(RXDCTL(1), E1000_RXDCTL_DMA_BURST_ENABLE);
2907
2908 /*
2909 * override the delay timers for enabling bursting, only if
2910 * the value was not set by the user via module options
2911 */
2912 if (adapter->rx_int_delay == DEFAULT_RDTR)
2913 adapter->rx_int_delay = BURST_RDTR;
2914 if (adapter->rx_abs_int_delay == DEFAULT_RADV)
2915 adapter->rx_abs_int_delay = BURST_RADV;
2916 }
2917
2875 /* set the Receive Delay Timer Register */ 2918 /* set the Receive Delay Timer Register */
2876 ew32(RDTR, adapter->rx_int_delay); 2919 ew32(RDTR, adapter->rx_int_delay);
2877 2920
@@ -4235,6 +4278,16 @@ link_up:
4235 /* Force detection of hung controller every watchdog period */ 4278 /* Force detection of hung controller every watchdog period */
4236 adapter->detect_tx_hung = 1; 4279 adapter->detect_tx_hung = 1;
4237 4280
4281 /* flush partial descriptors to memory before detecting tx hang */
4282 if (adapter->flags2 & FLAG2_DMA_BURST) {
4283 ew32(TIDV, adapter->tx_int_delay | E1000_TIDV_FPD);
4284 ew32(RDTR, adapter->rx_int_delay | E1000_RDTR_FPD);
4285 /*
4286 * no need to flush the writes because the timeout code does
4287 * an er32 first thing
4288 */
4289 }
4290
4238 /* 4291 /*
4239 * With 82571 controllers, LAA may be overwritten due to controller 4292 * With 82571 controllers, LAA may be overwritten due to controller
4240 * reset from the other port. Set the appropriate LAA in RAR[0] 4293 * reset from the other port. Set the appropriate LAA in RAR[0]