aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorAuke Kok <auke-jan.h.kok@intel.com>2007-10-25 16:57:53 -0400
committerJeff Garzik <jeff@garzik.org>2007-10-29 05:47:08 -0400
commitdf762464ad0fad721f9fc5724e85b3df0d550acd (patch)
treef3286bd44409b353e7737188c45163ccde7a9632 /drivers/net
parent47f44e40a3c12f8604aba9288d7a7f991cbf17ba (diff)
e1000e: Fix PBA calculation for jumbo frame packets
Upon inspection the rx FIFO size calculation code was found to have 2 significant flaws: A superfluous minus sign resulting in the wrong size to be used for jumbo frames on 82573 and ich9, as well as that this code rewrote the read-only adapter->pba variable resulting in different values at each run. Without this patch jumbo's will work but performance will be awkward since the TX size is not adequate for two whole frames. Signed-off-by: Auke Kok <auke-jan.h.kok@intel.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/e1000e/netdev.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c
index 46c5ac6b4d77..e87ed3133528 100644
--- a/drivers/net/e1000e/netdev.c
+++ b/drivers/net/e1000e/netdev.c
@@ -2328,8 +2328,11 @@ void e1000e_reset(struct e1000_adapter *adapter)
2328 struct e1000_mac_info *mac = &adapter->hw.mac; 2328 struct e1000_mac_info *mac = &adapter->hw.mac;
2329 struct e1000_hw *hw = &adapter->hw; 2329 struct e1000_hw *hw = &adapter->hw;
2330 u32 tx_space, min_tx_space, min_rx_space; 2330 u32 tx_space, min_tx_space, min_rx_space;
2331 u32 pba;
2331 u16 hwm; 2332 u16 hwm;
2332 2333
2334 ew32(PBA, adapter->pba);
2335
2333 if (mac->max_frame_size > ETH_FRAME_LEN + ETH_FCS_LEN ) { 2336 if (mac->max_frame_size > ETH_FRAME_LEN + ETH_FCS_LEN ) {
2334 /* To maintain wire speed transmits, the Tx FIFO should be 2337 /* To maintain wire speed transmits, the Tx FIFO should be
2335 * large enough to accommodate two full transmit packets, 2338 * large enough to accommodate two full transmit packets,
@@ -2337,11 +2340,11 @@ void e1000e_reset(struct e1000_adapter *adapter)
2337 * the Rx FIFO should be large enough to accommodate at least 2340 * the Rx FIFO should be large enough to accommodate at least
2338 * one full receive packet and is similarly rounded up and 2341 * one full receive packet and is similarly rounded up and
2339 * expressed in KB. */ 2342 * expressed in KB. */
2340 adapter->pba = er32(PBA); 2343 pba = er32(PBA);
2341 /* upper 16 bits has Tx packet buffer allocation size in KB */ 2344 /* upper 16 bits has Tx packet buffer allocation size in KB */
2342 tx_space = adapter->pba >> 16; 2345 tx_space = pba >> 16;
2343 /* lower 16 bits has Rx packet buffer allocation size in KB */ 2346 /* lower 16 bits has Rx packet buffer allocation size in KB */
2344 adapter->pba &= 0xffff; 2347 pba &= 0xffff;
2345 /* the tx fifo also stores 16 bytes of information about the tx 2348 /* the tx fifo also stores 16 bytes of information about the tx
2346 * but don't include ethernet FCS because hardware appends it */ 2349 * but don't include ethernet FCS because hardware appends it */
2347 min_tx_space = (mac->max_frame_size + 2350 min_tx_space = (mac->max_frame_size +
@@ -2357,20 +2360,21 @@ void e1000e_reset(struct e1000_adapter *adapter)
2357 /* If current Tx allocation is less than the min Tx FIFO size, 2360 /* If current Tx allocation is less than the min Tx FIFO size,
2358 * and the min Tx FIFO size is less than the current Rx FIFO 2361 * and the min Tx FIFO size is less than the current Rx FIFO
2359 * allocation, take space away from current Rx allocation */ 2362 * allocation, take space away from current Rx allocation */
2360 if (tx_space < min_tx_space && 2363 if ((tx_space < min_tx_space) &&
2361 ((min_tx_space - tx_space) < adapter->pba)) { 2364 ((min_tx_space - tx_space) < pba)) {
2362 adapter->pba -= - (min_tx_space - tx_space); 2365 pba -= min_tx_space - tx_space;
2363 2366
2364 /* if short on rx space, rx wins and must trump tx 2367 /* if short on rx space, rx wins and must trump tx
2365 * adjustment or use Early Receive if available */ 2368 * adjustment or use Early Receive if available */
2366 if ((adapter->pba < min_rx_space) && 2369 if ((pba < min_rx_space) &&
2367 (!(adapter->flags & FLAG_HAS_ERT))) 2370 (!(adapter->flags & FLAG_HAS_ERT)))
2368 /* ERT enabled in e1000_configure_rx */ 2371 /* ERT enabled in e1000_configure_rx */
2369 adapter->pba = min_rx_space; 2372 pba = min_rx_space;
2370 } 2373 }
2374
2375 ew32(PBA, pba);
2371 } 2376 }
2372 2377
2373 ew32(PBA, adapter->pba);
2374 2378
2375 /* flow control settings */ 2379 /* flow control settings */
2376 /* The high water mark must be low enough to fit one full frame 2380 /* The high water mark must be low enough to fit one full frame