ixgb, e1000 fixes
Subsystems (2)
cover ixgb, e1000 fixes
Hi,
This patch series contains exclusively fixes for ixgb and e1000. Most importantly, it addresses two issues in the recently merged msi interrupt handler and dynamic itr code, as well as some major manageability feature handling code.
These patches apply against netdev-2.6 #upstream-linus commit 0ae851352a87db3f829511816a2da227860bf585. Please pull:
git pull git://lost.foo-projects.org/~ahkok/git/netdev-2.6 upstream-linus
to receive them.
Cheers,
Auke
---
Bruce Allan <[email protected]>:
e1000: Fix PBA allocation calculations
e1000: set max frame size before enabling new link settings
Jesse Brandeburg <[email protected]>:
e1000: Fix early TSO completion
ixgb: Maybe stop TX if not enough free descriptors
e1000: dynamic itr code fixes
e1000: minor tso ipv6 cleanups
e1000: omit stats for broken counter in 82543
e1000: Fix all manageability workarounds
e1000: Make copybreak parameter changeable by user.
e1000: Fire a link even interrupt instead of a watchdog at init.
e1000: Fix powerdown link loss when forced to gig speed
e1000: disable TSO when debugging slab
e1000: always turn on receives on esb2
e1000: simplify msi specific interrupt handler
e1000: Rewrite parm handling code to warn when forcing autoneg to gig only.
e1000: Don't set tipg (fiber) timings for pci-e adapters to fix fiber output
e1000: Fix poor quad port performance with NAPI
Jeff Kirsher <[email protected]>:
e1000: For older adapters, we know that the pci bus type is pci.
Auke Kok <[email protected]>:
e1000: display FC link properties
e1000: Version increment 7.3.20-k2 and minor cleanups
Aaron Salter <[email protected]>:
ixgb: Write RA register high word first, increment version
--- drivers/net/e1000/e1000.h | 7 +- drivers/net/e1000/e1000_ethtool.c | 3 + drivers/net/e1000/e1000_hw.c | 59 +++--- drivers/net/e1000/e1000_hw.h | 2 + drivers/net/e1000/e1000_main.c | 455 ++++++++++++++++++++++++------------- drivers/net/e1000/e1000_osdep.h | 9 +- drivers/net/e1000/e1000_param.c | 19 +- drivers/net/ixgb/ixgb.h | 1 + drivers/net/ixgb/ixgb_ethtool.c | 1 + drivers/net/ixgb/ixgb_hw.c | 3 +- drivers/net/ixgb/ixgb_main.c | 60 +++++- 11 files changed, 398 insertions(+), 221 deletions(-)
---
Auke Kok <[email protected]>
PATCH 1/22 e1000: Fix early TSO completion
This fix was already merged in commit 96f9c2e277768099479fbed7c3b69c294b1fadef but reverted in commit 989316ddfeafd0e8fb51a4d811383769ad62637a. After stresstesting we found that the fix does not add new regressions and works around a TX hang spotted by several users.
---
drivers/net/ixgb/ixgb_main.c | 21 +++++++++++++++++++-- 1 files changed, 19 insertions(+), 2 deletions(-)
drivers/net/ixgb/ixgb_main.c +19 -2
@@ -1287,6 +1287,9 @@ ixgb_tx_map(struct ixgb_adapter *adapterstruct ixgb_buffer *buffer_info;int len = skb->len;unsigned int offset =0 , size, count =0 , i; +#ifdef NETIF_F_TSO +unsigned int mss =skb_shinfo (skb)->gso_size; +#endif unsigned int nr_frags =skb_shinfo (skb)->nr_frags;unsigned int f;
@@ -1298,6 +1301,12 @@ ixgb_tx_map(struct ixgb_adapter *adapterwhile (len) { buffer_info = &tx_ring->buffer_info[i]; size =min (len,IXGB_MAX_DATA_PER_TXD ); +#ifdef NETIF_F_TSO +/* Workaround for premature desc write-backs +* in TSO mode. Append 4-byte sentinel desc */ +if (unlikely (mss && !nr_frags && size == len && size >8 )) + size -=4 ; +#endif buffer_info->length = size;WARN_ON (buffer_info->dma !=0 ); buffer_info->dma =
@@ -1324,6 +1333,13 @@ ixgb_tx_map(struct ixgb_adapter *adapterwhile (len) { buffer_info = &tx_ring->buffer_info[i]; size =min (len,IXGB_MAX_DATA_PER_TXD ); +#ifdef NETIF_F_TSO +/* Workaround for premature desc write-backs +* in TSO mode. Append 4-byte sentinel desc */ +if (unlikely (mss && !nr_frags && size == len + && size >8 )) + size -=4 ; +#endif buffer_info->length = size; buffer_info->dma = pci_map_page(adapter->pdev,
@@ -1401,8 +1417,9 @@ ixgb_tx_queue(struct ixgb_adapter *adapt/* Tx Descriptors needed, worst case */ #define TXD_USE_COUNT (S ) (((S) >> IXGB_MAX_TXD_PWR) + \ (((S) & (IXGB_MAX_DATA_PER_TXD - 1)) ? 1 : 0)) -#define DESC_NEEDED TXD_USE_COUNT(IXGB_MAX_DATA_PER_TXD) + \ - MAX_SKB_FRAGS * TXD_USE_COUNT(PAGE_SIZE) + 1 +#define DESC_NEEDED TXD_USE_COUNT(IXGB_MAX_DATA_PER_TXD)/* skb->date */ + \ +MAX_SKB_FRAGS *TXD_USE_COUNT (PAGE_SIZE ) +1 /* for context */ \ + + 1 /* one more needed for sentinel TSO workaround */static int ixgb_xmit_frame (struct sk_buff *skb,struct net_device *netdev)
---
Auke Kok <[email protected]>
Re: [PATCH 01/22] e1000: Fix early TSO completion
Quoted 7 lines · Auke
This fix was already merged in commit
96f9c2e277768099479fbed7c3b69c294b1fadefbut reverted in commit989316ddfeafd0e8fb51a4d811383769ad62637a. After stresstesting we found that the fix does not add new regressions and works around a TX hang spotted by several users.Signed-off-by Jesse Brandeburg <[email protected]>Signed-off-by Auke Kok <[email protected]>
ACK content except for one detail: don't add new NETIF_F_TSO ifdefs. Modern 2.6 kernel code should simply assume that TSO is present.
Jeff
PATCH 2/22 ixgb: Maybe stop TX if not enough free descriptors
In reply to Kok, AukeA similar patch to commit 65c7973fa5b46b024f38be208aa477e8daf9a603 but now for ixgb.
---
drivers/net/ixgb/ixgb.h | 1 + drivers/net/ixgb/ixgb_ethtool.c | 1 + drivers/net/ixgb/ixgb_main.c | 37 ++++++++++++++++++++++++++++++++++--- 3 files changed, 36 insertions(+), 3 deletions(-)
drivers/net/ixgb/ixgb.h +1 -0
@@ -171,6 +171,7 @@ struct ixgb_adapter {/* TX */ struct ixgb_desc_ring tx_ring____cacheline_aligned_in_smp ; +unsigned int restart_queue;unsigned long timeo_start;uint32_t tx_cmd_type;uint64_t hw_csum_tx_good;
drivers/net/ixgb/ixgb_ethtool.c +1 -0
@@ -79,6 +79,7 @@ static struct ixgb_stats ixgb_gstrings_s {"tx_window_errors", IXGB_STAT(net_stats.tx_window_errors)}, {"tx_deferred_ok", IXGB_STAT(stats.dc)}, {"tx_timeout_count", IXGB_STAT(tx_timeout_count) }, + {"tx_restart_queue", IXGB_STAT(restart_queue) }, {"rx_long_length_errors", IXGB_STAT(stats.roc)}, {"rx_short_length_errors", IXGB_STAT(stats.ruc)}, #ifdef NETIF_F_TSO
drivers/net/ixgb/ixgb_main.c +34 -3
@@ -1414,6 +1414,37 @@ ixgb_tx_queue(struct ixgb_adapter *adaptIXGB_WRITE_REG (&adapter->hw,TDT , i); } +static int __ixgb_maybe_stop_tx (struct net_device *netdev,int size) +{ +struct ixgb_adapter *adapter =netdev_priv (netdev); +struct ixgb_desc_ring *tx_ring = &adapter->tx_ring; + +netif_stop_queue (netdev); +/* Herbert's original patch had: +* smp_mb__after_netif_stop_queue(); +* but since that doesn't exist yet, just open code it. */ +smp_mb (); + +/* We need to check again in a case another CPU has just +* made room available. */ +if (likely (IXGB_DESC_UNUSED (tx_ring) < size)) +return -EBUSY ; + +/* A reprieve! */ +netif_start_queue (netdev); + ++adapter->restart_queue; +return 0 ; +} + +static int ixgb_maybe_stop_tx (struct net_device *netdev, +struct ixgb_desc_ring *tx_ring,int size) +{ +if (likely (IXGB_DESC_UNUSED (tx_ring) >= size)) +return 0 ; +return __ixgb_maybe_stop_tx (netdev, size); +} + +/* Tx Descriptors needed, worst case */ #define TXD_USE_COUNT (S ) (((S) >> IXGB_MAX_TXD_PWR) + \ (((S) & (IXGB_MAX_DATA_PER_TXD - 1)) ? 1 : 0))
@@ -1447,7 +1478,8 @@ ixgb_xmit_frame(struct sk_buff *skb, strspin_lock_irqsave (&adapter->tx_lock, flags);#endif -if (unlikely (IXGB_DESC_UNUSED (&adapter->tx_ring) <DESC_NEEDED )) { +if (unlikely (ixgb_maybe_stop_tx (netdev, &adapter->tx_ring, +DESC_NEEDED ))) {netif_stop_queue (netdev);spin_unlock_irqrestore (&adapter->tx_lock, flags);return NETDEV_TX_BUSY ;
@@ -1485,8 +1517,7 @@ ixgb_xmit_frame(struct sk_buff *skb, str#ifdef NETIF_F_LLTX /* Make sure there is space in the ring for the next send. */ -if (unlikely (IXGB_DESC_UNUSED (&adapter->tx_ring) <DESC_NEEDED )) -netif_stop_queue (netdev); +ixgb_maybe_stop_tx (netdev, &adapter->tx_ring,DESC_NEEDED );spin_unlock_irqrestore (&adapter->tx_lock, flags);
---
Auke Kok <[email protected]>
Re: [PATCH 02/22] ixgb: Maybe stop TX if not enough free descriptors
Quoted 6 lines · Auke
A similar patch to commit
65c7973fa5b46b024f38be208aa477e8daf9a603but now for ixgb.Cc Herbert Xu <[email protected]>Signed-off-by Jesse Brandeburg <[email protected]>Signed-off-by Auke Kok <[email protected]>
ACK
PATCH 3/22 ixgb: Write RA register high word first, increment version
In reply to Kok, AukeWe need to disable the AV bit before flushing the low register.
---
drivers/net/ixgb/ixgb_hw.c | 3 ++- drivers/net/ixgb/ixgb_main.c | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-)
drivers/net/ixgb/ixgb_hw.c +2 -1
@@ -399,8 +399,9 @@ ixgb_init_rx_addrs(struct ixgb_hw *hw)/* Zero out the other 15 receive addresses. */ DEBUGOUT ("Clearing RAR[1-15]\n" );for (i =1 ; i <IXGB_RAR_ENTRIES ; i++) { -IXGB_WRITE_REG_ARRAY (hw,RA , (i <<1 ),0 ); +/* Write high reg first to disable the AV bit first */ IXGB_WRITE_REG_ARRAY (hw,RA , ((i <<1 ) +1 ),0 ); +IXGB_WRITE_REG_ARRAY (hw,RA , (i <<1 ),0 ); }return ;
drivers/net/ixgb/ixgb_main.c +1 -1
@@ -36,7 +36,7 @@ static char ixgb_driver_string[] = "Inte#else #define DRIVERNAPI "-NAPI"#endif -#define DRV_VERSION "1.0.117-k2"DRIVERNAPI +#define DRV_VERSION "1.0.126-k2"DRIVERNAPIchar ixgb_driver_version[] =DRV_VERSION ;static char ixgb_copyright[] ="Copyright (c) 1999-2006 Intel Corporation." ;
---
Auke Kok <[email protected]>
Re: [PATCH 03/22] ixgb: Write RA register high word first, increment version
Quoted 15 lines · Auke
We need to disable the AV bit before flushing the low register.
Signed-off-by <[email protected]>Signed-off-by Auke Kok <[email protected]>---
drivers/net/ixgb/ixgb_hw.c | 3 ++- drivers/net/ixgb/ixgb_main.c | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-)drivers/net/ixgb/ixgb_hw.c +0
-0
drivers/net/ixgb/ixgb_hw.c ixgb_init_rx_addrs(struct ixgb_hw *hw) · line 404
Quoted 7 lines
drivers/net/ixgb/ixgb_hw.c +2
-1@@ -399,8 +399,9 @@ ixgb_init_rx_addrs(struct ixgb_hw *hw)/* Zero out the other 15 receive addresses. */ DEBUGOUT ("Clearing RAR[1-15]\n" );for (i =1 ; i <IXGB_RAR_ENTRIES ; i++) { -IXGB_WRITE_REG_ARRAY (hw,RA , (i <<1 ),0 ); +/* Write high reg first to disable the AV bit first */ IXGB_WRITE_REG_ARRAY (hw,RA , ((i <<1 ) +1 ),0 ); +IXGB_WRITE_REG_ARRAY (hw,RA , (i <<1 ),0 );
Are you sure the order is guaranteed even after this code change, when considering all manner of CPU and bus posted writes?
ACK if yes
PATCH 4/22 e1000: display FC link properties
In reply to Kok, AukePreviously there was no way of determining the actual flow control properties of a link state. We display them at link up to provide this information as some other drivers do. Ethtool needs probably to add this status information.
---
drivers/net/e1000/e1000_main.c | 15 +++++++++++---- 1 files changed, 11 insertions(+), 4 deletions(-)
drivers/net/e1000/e1000_main.c +11 -4
@@ -2454,15 +2454,22 @@ e1000_watchdog(unsigned long data)if (link) {if (!netif_carrier_ok (netdev)) { +uint32_t ctrl;boolean_t txb2b =1 ;e1000_get_speed_and_duplex (&adapter->hw, &adapter->link_speed, &adapter->link_duplex); -DPRINTK (LINK ,INFO ,"NIC Link is Up %d Mbps %s\n" , - adapter->link_speed, - adapter->link_duplex ==FULL_DUPLEX ? -"Full Duplex" :"Half Duplex" ); + ctrl =E1000_READ_REG (&adapter->hw,CTRL ); +DPRINTK (LINK ,INFO ,"NIC Link is Up %d Mbps %s, " +"Flow Control: %s\n" , + adapter->link_speed, + adapter->link_duplex ==FULL_DUPLEX ? +"Full Duplex" :"Half Duplex" , + ((ctrl &E1000_CTRL_TFCE ) && (ctrl & +E1000_CTRL_RFCE )) ?"RX/TX" : ((ctrl & +E1000_CTRL_RFCE ) ?"RX" : ((ctrl & +E1000_CTRL_TFCE ) ?"TX" :"None" )));/* tweak tx_queue_len according to speed/duplex * and adjust the timeout factor */
---
Auke Kok <[email protected]>
PATCH 5/22 e1000: dynamic itr code fixes
In reply to Kok, AukeThe dynamic interrupt rate control patches omitted proper counting for jumbo's and TSO. We also & out the lower bits of a user-provided hardcoded itr setting beccause they are used for control.
---
drivers/net/e1000/e1000_main.c | 52 ++++++++++++++++++++++++++------------- drivers/net/e1000/e1000_param.c | 4 ++- 2 files changed, 37 insertions(+), 19 deletions(-)
drivers/net/e1000/e1000_main.c +34 -18
@@ -2635,29 +2635,38 @@ static unsigned int e1000_update_itr(strif (packets ==0 ) goto update_itr_done; -switch (itr_setting) {case lowest_latency: -if ((packets <5 ) && (bytes >512 )) +/* handle TSO and jumbo frames */ +if (bytes/packets >8000 ) + retval = bulk_latency; +else if ((packets <5 ) && (bytes >512 )) { retval = low_latency; + }break ;case low_latency:/* 50 usec aka 20000 ints/s */ if (bytes >10000 ) { -if ((packets <10 ) || - ((bytes/packets) >1200 )) +/* this if handles the TSO accounting */ +if (bytes/packets >8000 ) { retval = bulk_latency; -else if ((packets >35 )) + }else if ((packets <10 ) || ((bytes/packets) >1200 )) { + retval = bulk_latency; + }else if ((packets >35 )) { retval = lowest_latency; - }else if (packets <=2 && bytes <512 ) + } + }else if (bytes/packets >2000 ) { + retval = bulk_latency; + }else if (packets <=2 && bytes <512 ) { retval = lowest_latency; + }break ;case bulk_latency:/* 250 usec aka 4000 ints/s */ if (bytes >25000 ) { -if (packets >35 ) - retval = low_latency; - }else { -if (bytes <6000 ) +if (packets >35 ) { retval = low_latency; + } + }else if (bytes <6000 ) { + retval = low_latency; }break ; }
@@ -2686,17 +2695,20 @@ static void e1000_set_itr(struct e1000_a adapter->tx_itr, adapter->total_tx_packets, adapter->total_tx_bytes); +/* conservative mode (itr 3) eliminates the lowest_latency setting */ +if (adapter->itr_setting ==3 && adapter->tx_itr == lowest_latency) + adapter->tx_itr = low_latency; + adapter->rx_itr =e1000_update_itr (adapter, adapter->rx_itr, adapter->total_rx_packets, adapter->total_rx_bytes); +/* conservative mode (itr 3) eliminates the lowest_latency setting */ +if (adapter->itr_setting ==3 && adapter->rx_itr == lowest_latency) + adapter->rx_itr = low_latency; current_itr =max (adapter->rx_itr, adapter->tx_itr); -/* conservative mode eliminates the lowest_latency setting */ -if (current_itr == lowest_latency && (adapter->itr_setting ==3 )) - current_itr = low_latency; -switch (current_itr) {/* counts and packets in update_itr are dependent on these numbers */ case lowest_latency:
@@ -3875,11 +3887,15 @@ e1000_clean_tx_irq(struct e1000_adapter cleaned = (i == eop);if (cleaned) { -/* this packet count is wrong for TSO but has a -* tendency to make dynamic ITR change more -* towards bulk */ +struct sk_buff *skb = buffer_info->skb; +#ifdef NETIF_F_TSO +unsigned int segs =skb_shinfo (skb)->gso_segs; +if (segs) + total_tx_packets += segs; +#endif + total_tx_packets++; - total_tx_bytes += buffer_info->skb->len; + total_tx_bytes += skb->len; }e1000_unmap_and_free_tx_resource (adapter, buffer_info); tx_desc->upper.data =0 ;
drivers/net/e1000/e1000_param.c +3 -1
@@ -487,7 +487,9 @@ e1000_check_options(struct e1000_adaptere1000_validate_option (&adapter->itr, &opt, adapter);/* save the setting, because the dynamic bits change itr */ - adapter->itr_setting = adapter->itr; +/* clear the lower two bits because they are +* used as control */ + adapter->itr_setting = adapter->itr & ~3 ;break ; } }else {
---
Auke Kok <[email protected]>
PATCH 6/22 e1000: minor tso ipv6 cleanups
In reply to Kok, AukeZero descriptor ip_config field and use skb_shinfo to detect IPV6 packet.
---
drivers/net/e1000/e1000_main.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
drivers/net/e1000/e1000_main.c +2 -1
@@ -2780,7 +2780,7 @@ e1000_tso(struct e1000_adapter *adapter, cmd_length =E1000_TXD_CMD_IP ; ipcse = skb->h.raw - skb->data -1 ; #ifdef NETIF_F_TSO6 - }else if (skb->protocol ==htons (ETH_P_IPV6 )) { + }else if (skb_shinfo (skb)->gso_type ==SKB_GSO_TCPV6 ) { skb->nh.ipv6h->payload_len =0 ; skb->h.th->check = ~csum_ipv6_magic(&skb->nh.ipv6h->saddr,
@@ -2843,6 +2843,7 @@ e1000_tx_csum(struct e1000_adapter *adap buffer_info = &tx_ring->buffer_info[i]; context_desc =E1000_CONTEXT_DESC (*tx_ring, i); + context_desc->lower_setup.ip_config =0 ; context_desc->upper_setup.tcp_fields.tucss = css; context_desc->upper_setup.tcp_fields.tucso = css + skb->csum_offset; context_desc->upper_setup.tcp_fields.tucse =0 ;
---
Auke Kok <[email protected]>
Re: [PATCH 06/22] e1000: minor tso ipv6 cleanups
Quoted 4 lines · Auke
Zero descriptor
ip_configfield and useskb_shinfoto detect IPV6 packet.Signed-off-by Jesse Brandeburg <[email protected]>Signed-off-by Auke Kok <[email protected]>
ACK patches 4-6
PATCH 7/22 e1000: omit stats for broken counter in 82543
In reply to Kok, Auke82543 does not count tx_carrier_errors properly in FD mode.
---
drivers/net/e1000/e1000_main.c | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-)
drivers/net/e1000/e1000_main.c +6 -1
@@ -3592,7 +3592,12 @@ e1000_update_stats(struct e1000_adapter adapter->net_stats.tx_errors = adapter->stats.txerrc; adapter->net_stats.tx_aborted_errors = adapter->stats.ecol; adapter->net_stats.tx_window_errors = adapter->stats.latecol; - adapter->net_stats.tx_carrier_errors = adapter->stats.tncrs; +if (adapter->hw.mac_type == e1000_82543 && + adapter->link_duplex ==FULL_DUPLEX ) { + adapter->net_stats.tx_carrier_errors =0 ; + adapter->stats.tncrs =0 ; + }else + adapter->net_stats.tx_carrier_errors = adapter->stats.tncrs;/* Tx Dropped needs to be maintained elsewhere */
---
Auke Kok <[email protected]>
Re: [PATCH 07/22] e1000: omit stats for broken counter in 82543
Quoted 14 lines · Auke
82543 does not count
tx_carrier_errorsproperly in FD mode.Signed-off-by Jesse Brandeburg <[email protected]>Signed-off-by Auke Kok <[email protected]>---
drivers/net/e1000/e1000_main.c | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-)drivers/net/e1000/e1000_main.c +0
-0
drivers/net/e1000/e1000_main.c e1000_update_stats(struct e1000_adapter · line 3600
Quoted 10 lines
drivers/net/e1000/e1000_main.c +6
-1@@ -3592,7 +3592,12 @@ e1000_update_stats(struct e1000_adapter adapter->net_stats.tx_errors = adapter->stats.txerrc; adapter->net_stats.tx_aborted_errors = adapter->stats.ecol; adapter->net_stats.tx_window_errors = adapter->stats.latecol; - adapter->net_stats.tx_carrier_errors = adapter->stats.tncrs; +if (adapter->hw.mac_type == e1000_82543 && + adapter->link_duplex ==FULL_DUPLEX ) { + adapter->net_stats.tx_carrier_errors =0 ; + adapter->stats.tncrs =0 ; + }else + adapter->net_stats.tx_carrier_errors = adapter->stats.tncrs;
test a feature bit (really a quirk bit, in this case)
PATCH 8/22 e1000: Fix all manageability workarounds
In reply to Kok, AukeSeveral bugs existed in how we handle various manageability issues and workarounds. We consolidate all release and init code in two single functions and call them from appropriate locations. This fixes several BMC packet redirect issues and powerup/down hiccups.
Add 3 extra packet redirect counters for tracking purposes to make sure we can test that all packets arrive properly.
---
drivers/net/e1000/e1000_ethtool.c | 3 + drivers/net/e1000/e1000_hw.c | 5 + drivers/net/e1000/e1000_hw.h | 1 drivers/net/e1000/e1000_main.c | 135 +++++++++++++++++++++---------------- 4 files changed, 83 insertions(+), 61 deletions(-)
drivers/net/e1000/e1000_ethtool.c +3 -0
@@ -100,6 +100,9 @@ static const struct e1000_stats e1000_gs { "rx_csum_offload_errors", E1000_STAT(hw_csum_err) }, { "rx_header_split", E1000_STAT(rx_hdr_split) }, { "alloc_rx_buff_failed", E1000_STAT(alloc_rx_buff_failed) }, + { "tx_smbus", E1000_STAT(stats.mgptc) }, + { "rx_smbus", E1000_STAT(stats.mgprc) }, + { "dropped_smbus", E1000_STAT(stats.mgpdc) }, };#define E1000_QUEUE_STATS_LEN 0
drivers/net/e1000/e1000_hw.c +2 -3
@@ -7817,9 +7817,8 @@ e1000_enable_mng_pass_thru(struct e1000_ fwsm =E1000_READ_REG (hw,FWSM ); factps =E1000_READ_REG (hw,FACTPS ); -if (((fwsm &E1000_FWSM_MODE_MASK ) == - (e1000_mng_mode_pt <<E1000_FWSM_MODE_SHIFT )) && - (factps &E1000_FACTPS_MNGCG )) +if ((((fwsm &E1000_FWSM_MODE_MASK ) >>E1000_FWSM_MODE_SHIFT ) == + e1000_mng_mode_pt) && !(factps &E1000_FACTPS_MNGCG ))return TRUE; }else if ((manc &E1000_MANC_SMBUS_EN ) && !(manc &E1000_MANC_ASF_EN ))
drivers/net/e1000/e1000_hw.h +1 -0
@@ -1301,6 +1301,7 @@ struct e1000_ffvt_entry {#define E1000_82542_RSSIR E1000_RSSIR#define E1000_82542_KUMCTRLSTA E1000_KUMCTRLSTA#define E1000_82542_SW_FW_SYNC E1000_SW_FW_SYNC +#define E1000_82542_MANC2H E1000_MANC2H/* Statistics counters collected by the MAC */ struct e1000_hw_stats {
drivers/net/e1000/e1000_main.c +77 -58
213 lines not on this page · raw message
---
Auke Kok <[email protected]>
Jeff Garzik
NAKRe: [PATCH 08/22] e1000: Fix all manageability workarounds
drivers/net/e1000/e1000_main.c e1000_get_hw_control(struct e1000_adapte · line 489
Quoted 13 lines · Auke
drivers/net/e1000/e1000_main.c +13
-0+/* enable receiving management packets to the host */ +/* this will probably generate destination unreachable messages +* from the host OS, but the packets will be handled on SMBUS */ +if (adapter->hw.mac_type >= e1000_82571) { + manc |=E1000_MANC_EN_MNG2HOST ; +#define E1000_MNG2HOST_PORT_623 (1 << 5) +#define E1000_MNG2HOST_PORT_664 (1 << 6) + manc2h |=E1000_MNG2HOST_PORT_623 ; + manc2h |=E1000_MNG2HOST_PORT_664 ; +E1000_WRITE_REG (&adapter->hw,MANC2H , manc2h); + } + +E1000_WRITE_REG (&adapter->hw,MANC , manc);
NAK, test a management packet feature, not a mac type
Quoted 4 lines
drivers/net/e1000/e1000_main.c +4
-0+ } +} + +static void
drivers/net/e1000/e1000_main.c e1000_get_hw_control(struct e1000_adapte · line 503
Quoted 10 lines
drivers/net/e1000/e1000_main.c +10
-0+e1000_release_manageability(struct e1000_adapter *adapter) +{ +if (adapter->en_mng_pt) { +uint32_t manc =E1000_READ_REG (&adapter->hw,MANC ); + +/* re-enable hardware interception of ARP */ + manc |=E1000_MANC_ARP_EN ; + +if (adapter->hw.mac_type >= e1000_82571) + manc &= ~E1000_MANC_EN_MNG2HOST ;
ditto. can't you see how fragile the above code test is, when compared with testing a feature bit?
Quoted 61 lines
drivers/net/e1000/e1000_main.c +12
-18+/* don't explicitly have to mess with MANC2H since +* MANC has an enable disable that gates MANC2H */ + +/* XXX stop the hardware watchdog ? */ + +E1000_WRITE_REG (&adapter->hw,MANC , manc); + } +} +int e1000_up (struct e1000_adapter *adapter) {@@ -475,6 +522,7 @@ e1000_up(struct e1000_adapter *adapter)e1000_set_multi (netdev);e1000_restore_vlan (adapter); +e1000_init_manageability (adapter);e1000_configure_tx (adapter);e1000_setup_rctl (adapter);@@ -705,14 +753,7 @@ e1000_reset(struct e1000_adapter *adapte phy_data); } -if ((adapter->en_mng_pt) && - (adapter->hw.mac_type >= e1000_82540) && - (adapter->hw.mac_type < e1000_82571) && - (adapter->hw.media_type == e1000_media_type_copper)) { - manc =E1000_READ_REG (&adapter->hw,MANC ); - manc |= (E1000_MANC_ARP_EN |E1000_MANC_EN_MNG2HOST ); -E1000_WRITE_REG (&adapter->hw,MANC , manc); - } +e1000_release_manageability (adapter); }/** @@ -1078,22 +1119,13 @@ e1000_remove(struct pci_dev *pdev) {struct net_device *netdev =pci_get_drvdata (pdev);struct e1000_adapter *adapter =netdev_priv (netdev); -uint32_t manc;#ifdef CONFIG_E1000_NAPI int i;#endif flush_scheduled_work (); -if (adapter->hw.mac_type >= e1000_82540 && - adapter->hw.mac_type < e1000_82571 && - adapter->hw.media_type == e1000_media_type_copper) { - manc =E1000_READ_REG (&adapter->hw,MANC ); -if (manc &E1000_MANC_SMBUS_EN ) { - manc |=E1000_MANC_ARP_EN ; -E1000_WRITE_REG (&adapter->hw,MANC , manc); - } - } +e1000_release_manageability (adapter);/* Release control of h/w to f/w. If f/w is AMT enabled, this * would have already happened in close and is redundant. */
drivers/net/e1000/e1000_main.c e1000_update_stats(struct e1000_adapter · line 3655
Quoted 9 lines
drivers/net/e1000/e1000_main.c +6
-0@@ -3615,6 +3647,14 @@ e1000_update_stats(struct e1000_adapter adapter->phy_stats.receive_errors += phy_tmp; } +/* Management Stats */ +if (adapter->hw.mac_type > e1000_82544) { + adapter->stats.mgptc +=E1000_READ_REG (hw,MGTPTC ); + adapter->stats.mgprc +=E1000_READ_REG (hw,MGTPRC ); + adapter->stats.mgpdc +=E1000_READ_REG (hw,MGTPDC ); + }
test a feature bit
Quoted 94 lines
drivers/net/e1000/e1000_main.c +12
-35spin_unlock_irqrestore (&adapter->stats_lock, flags); }#ifdef CONFIG_PCI_MSI @@ -5027,7 +5067,7 @@ e1000_suspend(struct pci_dev *pdev, pm_m {struct net_device *netdev =pci_get_drvdata (pdev);struct e1000_adapter *adapter =netdev_priv (netdev); -uint32_t ctrl, ctrl_ext, rctl, manc, status; +uint32_t ctrl, ctrl_ext, rctl, status;uint32_t wufc = adapter->wol;#ifdef CONFIG_PM int retval =0 ;@@ -5096,16 +5136,12 @@ e1000_suspend(struct pci_dev *pdev, pm_mpci_enable_wake (pdev, PCI_D3cold,0 ); } -if (adapter->hw.mac_type >= e1000_82540 && - adapter->hw.mac_type < e1000_82571 && - adapter->hw.media_type == e1000_media_type_copper) { - manc =E1000_READ_REG (&adapter->hw,MANC ); -if (manc &E1000_MANC_SMBUS_EN ) { - manc |=E1000_MANC_ARP_EN ; -E1000_WRITE_REG (&adapter->hw,MANC , manc); -pci_enable_wake (pdev, PCI_D3hot,1 ); -pci_enable_wake (pdev, PCI_D3cold,1 ); - } +e1000_release_manageability (adapter); + +/* make sure adapter isn't asleep if manageability is enabled */ +if (adapter->en_mng_pt) { +pci_enable_wake (pdev, PCI_D3hot,1 ); +pci_enable_wake (pdev, PCI_D3cold,1 ); }if (adapter->hw.phy_type == e1000_phy_igp_3)@@ -5131,7 +5167,7 @@ e1000_resume(struct pci_dev *pdev) {struct net_device *netdev =pci_get_drvdata (pdev);struct e1000_adapter *adapter =netdev_priv (netdev); -uint32_t manc, err; +uint32_t err;pci_set_power_state (pdev,PCI_D0 );e1000_pci_restore_state (adapter);@@ -5151,19 +5187,13 @@ e1000_resume(struct pci_dev *pdev)e1000_reset (adapter);E1000_WRITE_REG (&adapter->hw,WUS , ~0 ); +e1000_init_manageability (adapter); +if (netif_running (netdev))e1000_up (adapter);netif_device_attach (netdev); -if (adapter->hw.mac_type >= e1000_82540 && - adapter->hw.mac_type < e1000_82571 && - adapter->hw.media_type == e1000_media_type_copper) { - manc =E1000_READ_REG (&adapter->hw,MANC ); - manc &= ~(E1000_MANC_ARP_EN ); -E1000_WRITE_REG (&adapter->hw,MANC , manc); - } -/* If the controller is 82573 and f/w is AMT, do not set * DRV_LOAD until the interface is up. For all other cases, * let the f/w know that the h/w is now under the control @@ -5264,7 +5294,8 @@ static void e1000_io_resume(struct pci_d {struct net_device *netdev =pci_get_drvdata (pdev);struct e1000_adapter *adapter = netdev->priv; -uint32_t manc, swsm; + +e1000_init_manageability (adapter);if (netif_running (netdev)) {if (e1000_up (adapter)) {@@ -5275,26 +5306,14 @@ static void e1000_io_resume(struct pci_dnetif_device_attach (netdev); -if (adapter->hw.mac_type >= e1000_82540 && - adapter->hw.mac_type < e1000_82571 && - adapter->hw.media_type == e1000_media_type_copper) { - manc =E1000_READ_REG (&adapter->hw,MANC ); - manc &= ~(E1000_MANC_ARP_EN ); -E1000_WRITE_REG (&adapter->hw,MANC , manc); - } - -switch (adapter->hw.mac_type) { -case e1000_82573: - swsm =E1000_READ_REG (&adapter->hw,SWSM ); -E1000_WRITE_REG (&adapter->hw,SWSM , - swsm |E1000_SWSM_DRV_LOAD ); -break ;
drivers/net/e1000/e1000_main.c static void e1000_io_resume(struct pci_d · line 5315
Quoted 10 lines
drivers/net/e1000/e1000_main.c +7
-3-default : -break ; - } +/* If the controller is 82573 and f/w is AMT, do not set +* DRV_LOAD until the interface is up. For all other cases, +* let the f/w know that the h/w is now under the control +* of the driver. */ +if (adapter->hw.mac_type != e1000_82573 || + !e1000_check_mng_mode (&adapter->hw)) +e1000_get_hw_control (adapter);
ditto
Quoted 15 lines
drivers/net/e1000/e1000_main.c +0
-3-if (netif_running (netdev)) -mod_timer (&adapter->watchdog_timer, jiffies); }/* e1000_main.c */ ---Auke Kok <[email protected]>
-
To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 9/22 e1000: Fix PBA allocation calculations
In reply to Kok, AukeAssign the PBA to be large enough to contain at least 2 jumbo frames on all adapters. This dramatically increases performance on several adapters and fixes TX performance degradation issues where the PBA was misallocated in the old algorithm.
---
drivers/net/e1000/e1000_main.c | 100 ++++++++++++++++++++++++++++++++++------ 1 files changed, 86 insertions(+), 14 deletions(-)
drivers/net/e1000/e1000_main.c +86 -14
@@ -662,16 +662,34 @@ e1000_reinit_locked(struct e1000_adaptervoid e1000_reset (struct e1000_adapter *adapter) { -uint32_t pba, manc; +uint32_t pba =0 , tx_space, min_tx_space, min_rx_space;uint16_t fc_high_water_mark =E1000_FC_HIGH_DIFF ; +boolean_t legacy_pba_adjust = FALSE;/* Repartition Pba for greater than 9k mtu * To take effect CTRL.RST is required. */ switch (adapter->hw.mac_type) { +case e1000_82542_rev2_0: +case e1000_82542_rev2_1: +case e1000_82543: +case e1000_82544: +case e1000_82540: +case e1000_82541: +case e1000_82541_rev_2: + legacy_pba_adjust = TRUE; + pba =E1000_PBA_48K ; +break ; +case e1000_82545: +case e1000_82545_rev_3: +case e1000_82546: +case e1000_82546_rev_3: + pba =E1000_PBA_48K ; +break ;case e1000_82547:case e1000_82547_rev_2: + legacy_pba_adjust = TRUE; pba =E1000_PBA_30K ;break ;case e1000_82571:
@@ -680,27 +698,81 @@ e1000_reset(struct e1000_adapter *adapte pba =E1000_PBA_38K ;break ;case e1000_82573: - pba =E1000_PBA_12K ; +#define E1000_PBA_20K 0x0014 + pba =E1000_PBA_20K ;break ;case e1000_ich8lan: pba =E1000_PBA_8K ; -break ; -default : - pba =E1000_PBA_48K ; +case e1000_undefined: +case e1000_num_macs:break ; } -if ((adapter->hw.mac_type != e1000_82573) && - (adapter->netdev->mtu >E1000_RXBUFFER_8192 )) - pba -=8 ;/* allocate more FIFO for Tx */ +if (legacy_pba_adjust == TRUE) { +if (adapter->netdev->mtu >E1000_RXBUFFER_8192 ) + pba -=8 ;/* allocate more FIFO for Tx */ +if (adapter->hw.mac_type == e1000_82547) { + adapter->tx_fifo_head =0 ; + adapter->tx_head_addr = pba <<E1000_TX_HEAD_ADDR_SHIFT ; + adapter->tx_fifo_size = + (E1000_PBA_40K - pba) <<E1000_PBA_BYTES_SHIFT ; +atomic_set (&adapter->tx_fifo_stall,0 ); + } + }else if (adapter->hw.max_frame_size >MAXIMUM_ETHERNET_FRAME_SIZE ) { +/* adjust PBA for jumbo frames */ +E1000_WRITE_REG (&adapter->hw,PBA , pba); + +/* To maintain wire speed transmits, the Tx FIFO should be +* large enough to accomodate two full transmit packets, +* rounded up to the next 1KB and expressed in KB. Likewise, +* the Rx FIFO should be large enough to accomodate at least +* one full receive packet and is similarly rounded up and +* expressed in KB. */ + pba =E1000_READ_REG (&adapter->hw,PBA ); +/* upper 16 bits has Tx packet buffer allocation size in KB */ + tx_space = pba >>16 ; +/* lower 16 bits has Rx packet buffer allocation size in KB */ + pba &=0xffff ; +/* don't include ethernet FCS because hardware appends/strips */ + min_tx_space = + min_rx_space = adapter->netdev->mtu +ENET_HEADER_SIZE + +VLAN_TAG_SIZE ; + min_tx_space *=2 ; +E1000_ROUNDUP (min_tx_space,1024 ); + min_tx_space >>=10 ; +E1000_ROUNDUP (min_rx_space,1024 ); + min_rx_space >>=10 ; + +/* If current Tx allocation is less than the min Tx FIFO size, +* and the min Tx FIFO size is less than the current Rx FIFO +* allocation, take space away from current Rx allocation */ +if (tx_space < min_tx_space && + ((min_tx_space - tx_space) < pba)) { + pba = pba - (min_tx_space - tx_space); -if (adapter->hw.mac_type == e1000_82547) { - adapter->tx_fifo_head =0 ; - adapter->tx_head_addr = pba <<E1000_TX_HEAD_ADDR_SHIFT ; - adapter->tx_fifo_size = - (E1000_PBA_40K - pba) <<E1000_PBA_BYTES_SHIFT ; -atomic_set (&adapter->tx_fifo_stall,0 ); +/* PCI/PCIx hardware has PBA alignment constraints */ +switch (adapter->hw.mac_type) { + case e1000_82545 ... e1000_82546_rev_3: + pba &= ~(E1000_PBA_8K -1 ); +break ; +default : +break ; + } + +/* if short on rx space, rx wins and must trump tx +* adjustment or use Early Receive if available */ +if (pba < min_rx_space) { +switch (adapter->hw.mac_type) { +case e1000_82573: +/* ERT enabled in e1000_configure_rx */ +break ; +default : + pba = min_rx_space; +break ; + } + } + } }E1000_WRITE_REG (&adapter->hw,PBA , pba);
---
Auke Kok <[email protected]>
PATCH 10/22 e1000: Make copybreak parameter changeable by user.
In reply to Kok, AukeAllow the user to vary the size that copybreak works. Currently cb is enabled for packets < 256 bytes, but various tests indicate that this should be configurable for specific use cases.
---
drivers/net/e1000/e1000_main.c | 20 ++++++++++++++++---- 1 files changed, 16 insertions(+), 4 deletions(-)
drivers/net/e1000/e1000_main.c +16 -4
@@ -213,6 +213,13 @@ static void e1000_netpoll (struct net_deextern void e1000_check_options (struct e1000_adapter *adapter); +#define COPYBREAK_DEFAULT 256 +static unsigned int copybreak__read_mostly =COPYBREAK_DEFAULT ; +module_param (copybreak, uint,0644 ); +MODULE_PARM_DESC (copybreak, +"Maximum size of packet that is copied to a new buffer on receive" ); + +static pci_ers_result_t e1000_io_error_detected (struct pci_dev *pdev,pci_channel_state_t state);static pci_ers_result_t e1000_io_slot_reset (struct pci_dev *pdev);
@@ -264,7 +271,13 @@ e1000_init_module(void)printk (KERN_INFO "%s\n" , e1000_copyright); ret =pci_register_driver (&e1000_driver); - +if (copybreak !=COPYBREAK_DEFAULT ) { +if (copybreak ==0 ) +printk (KERN_INFO "e1000: copybreak disabled\n" ); +else +printk (KERN_INFO "e1000: copybreak enabled for " +"packets <= %u bytes\n" , copybreak); + }return ret; }
@@ -4235,8 +4248,7 @@ e1000_clean_rx_irq(struct e1000_adapter/* code added for copybreak, this should improve * performance for small packets with large amounts * of reassembly being done in the stack */ -#define E1000_CB_LENGTH 256 -if (length <E1000_CB_LENGTH ) { +if (length < copybreak) {struct sk_buff *new_skb =netdev_alloc_skb (netdev, length +NET_IP_ALIGN );if (new_skb) {
@@ -4394,7 +4406,7 @@ e1000_clean_rx_irq_ps(struct e1000_adapt/* page alloc/put takes too long and effects small packet * throughput, so unsplit small packets and save the alloc/put*/ -if (l1 && ((length + l1) <= adapter->rx_ps_bsize0)) { +if (l1 && (l1 <= copybreak) && ((length + l1) <= adapter->rx_ps_bsize0)) {u8 *vaddr;/* there is no documentation about how to call * kmap_atomic, so we can't hold the mapping
---
Auke Kok <[email protected]>
PATCH 11/22 e1000: Fire a link even interrupt instead of a watchdog at init.
In reply to Kok, AukeInstead of calling a watchdog event we let our interrupt handler cascade a link event. This allows us to spot link up immediately after _up() without racing against a new watchdog.
---
drivers/net/e1000/e1000_main.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
drivers/net/e1000/e1000_main.c +2 -1
@@ -558,7 +558,8 @@ e1000_up(struct e1000_adapter *adapter)clear_bit (__E1000_DOWN, &adapter->flags); -mod_timer (&adapter->watchdog_timer, jiffies +2 *HZ ); +/* fire a link change interrupt to start the watchdog */ +E1000_WRITE_REG (&adapter->hw,ICS ,E1000_ICS_LSC );return 0 ; }
---
Auke Kok <[email protected]>
Re: [PATCH 11/22] e1000: Fire a link even interrupt instead of a watchdog at init.
Quoted 17 lines · Auke
Instead of calling a watchdog event we let our interrupt handler cascade a link event. This allows us to spot link up immediately after
_up()without racing against a new watchdog.Signed-off-by Jesse Brandeburg <[email protected]>Signed-off-by Auke Kok <[email protected]>---
drivers/net/e1000/e1000_main.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)drivers/net/e1000/e1000_main.c +0
-0
drivers/net/e1000/e1000_main.c e1000_up(struct e1000_adapter *adapter) · line 564
Quoted 8 lines
drivers/net/e1000/e1000_main.c +2
-1@@ -558,7 +558,8 @@ e1000_up(struct e1000_adapter *adapter)clear_bit (__E1000_DOWN, &adapter->flags); -mod_timer (&adapter->watchdog_timer, jiffies +2 *HZ ); +/* fire a link change interrupt to start the watchdog */ +E1000_WRITE_REG (&adapter->hw,ICS ,E1000_ICS_LSC );return 0 ; }
Hi Auke,
Could you explain the race, how it would be triggered, and what it might look like if it were to occur?
Thanks,
Shaw
PATCH 12/22 e1000: Fix powerdown link loss when forced to gig speed
In reply to Kok, Aukedisable phy power mode to prevent the NIC from attempting to autoneg to i10/100mbit when running in forced gig mode as it would lose link at shutdown. This allows you to force gig speed and still use WoL/IPMI after shutdow.
---
drivers/net/e1000/e1000_main.c | 14 ++++++++++++++ 1 files changed, 14 insertions(+), 0 deletions(-)
drivers/net/e1000/e1000_main.c +14 -0
@@ -819,6 +819,20 @@ e1000_reset(struct e1000_adapter *adapteif (e1000_init_hw (&adapter->hw))DPRINTK (PROBE ,ERR ,"Hardware Error\n" );e1000_update_mng_vlan (adapter); + +/* if (adapter->hwflags & HWFLAGS_PHY_PWR_BIT) { */ +if (adapter->hw.mac_type >= e1000_82544 && + adapter->hw.mac_type <= e1000_82547_rev_2 && + adapter->hw.autoneg ==1 && + adapter->hw.autoneg_advertised ==ADVERTISE_1000_FULL ) { +uint32_t ctrl =E1000_READ_REG (&adapter->hw,CTRL ); +/* clear phy power management bit if we are in gig only mode, +* which if enabled will attempt negotiation to 100Mb, which +* can cause a loss of link at power off or driver unload */ + ctrl &= ~E1000_CTRL_SWDPIN3 ; +E1000_WRITE_REG (&adapter->hw,CTRL , ctrl); + } +/* Enable h/w to recognize an 802.1Q VLAN Ethernet packet */ E1000_WRITE_REG (&adapter->hw,VET ,ETHERNET_IEEE_VLAN_TYPE );
---
Auke Kok <[email protected]>
Re: [PATCH 12/22] e1000: Fix powerdown link loss when forced to gig speed
Quoted 7 lines · Auke
disable phy power mode to prevent the NIC from attempting to autoneg to i10/100mbit when running in forced gig mode as it would lose link at shutdown. This allows you to force gig speed and still use WoL/IPMI after shutdow.
Signed-off-by Jesse Brandeburg <[email protected]>Signed-off-by Auke Kok <[email protected]>
ACK patches 9-12. in case you're wondering why I didn't gripe about feature bits more: Reset code [e1000_reset] will naturally have quite a few "if chip rev == blah" tests, and creating feature bits for each of those cases can be tedious. However, flags should be used (a la tg3) rather than all these 'switch(rev)' statements and 'if (rev > x && rev < y)' statements.
PATCH 13/22 e1000: disable TSO when debugging slab
In reply to Kok, AukeCONFIG_DEBUG_SLAB kills TSO on the 82544, so we're better off turing TSO off in this rare case, assuming performance is not an issue for people running slab debugging.
---
drivers/net/e1000/e1000_main.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-)
drivers/net/e1000/e1000_main.c +6 -0
@@ -998,6 +998,12 @@ e1000_probe(struct pci_dev *pdev, (adapter->hw.mac_type != e1000_82547)) netdev->features |=NETIF_F_TSO ; +#ifdef CONFIG_DEBUG_SLAB +/* 82544's work arounds do not play nicely with DEBUG SLAB */ +if (adapter->hw.mac_type == e1000_82544) + netdev->features &= ~NETIF_F_TSO ; +#endif +#ifdef NETIF_F_TSO6 if (adapter->hw.mac_type > e1000_82547_rev_2) netdev->features |=NETIF_F_TSO6 ;
---
Auke Kok <[email protected]>
Re: [PATCH 13/22] e1000: disable TSO when debugging slab
Quoted 16 lines · Auke
CONFIG_DEBUG_SLABkills TSO on the 82544, so we're better off turing TSO off in this rare case, assuming performance is not an issue for people running slab debugging.Signed-off-by Jesse Brandeburg <[email protected]>Signed-off-by Auke Kok <[email protected]>---
drivers/net/e1000/e1000_main.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-)drivers/net/e1000/e1000_main.c +0
-0
drivers/net/e1000/e1000_main.c e1000_probe(struct pci_dev *pdev, · line 1005
Quoted 8 lines
drivers/net/e1000/e1000_main.c +5
-0@@ -998,6 +998,12 @@ e1000_probe(struct pci_dev *pdev, (adapter->hw.mac_type != e1000_82547)) netdev->features |=NETIF_F_TSO ; +#ifdef CONFIG_DEBUG_SLAB +/* 82544's work arounds do not play nicely with DEBUG SLAB */ +if (adapter->hw.mac_type == e1000_82544) + netdev->features &= ~NETIF_F_TSO ; +#endif
ACK, provided that you greatly enhance the comment to explain -why-, not just the desired results.
Re: [PATCH 13/22] e1000: disable TSO when debugging slab
Quoted 9 lines · Jeff Garzik
Review
Quoted 6 lines
(quoted diff) +5
-0+#ifdef CONFIG_DEBUG_SLAB + /* 82544's work arounds do not play nicely with DEBUG SLAB */ + if (adapter->hw.mac_type == e1000_82544) + netdev->features &= ~NETIF_F_TSO; +#endifACK, provided that you greatly enhance the comment to explain -why-, not just the desired results.
Actually, CONFIG_DEBUG_SLAB is not the only thing that can break the 82544 work-around, Xen for example will also generate packets that breaks it. Jesse has a more recent fix that resolves both problems.
I've updated his patch to make it smaller.
Note that the only reason we don't see this normally is because the TCP stack starts writing from the end, i.e., it writes the TCP header first then slaps on the IP header, etc. So the end of the TCP header (skb->tail - 1 here) is always aligned correctly.
Had we made the start of the IP header (e.g., IPv6) 8-byte aligned instead, this would happen for normal TCP traffic as well.
Cheers,
Signature · 5 lines
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
--drivers/net/e1000/e1000_main.c +10 -0
@@ -3168,6 +3168,16 @@ #ifdef NETIF_F_TSOif (skb->data_len && (hdr_len == (skb->len - skb->data_len))) {switch (adapter->hw.mac_type) {unsigned int pull_size; +case e1000_82544: +/* Make sure we have room to chop off 4 bytes, +* and that the end alignment will work out to +* this hardware's requirements +* NOTE: this is a TSO only workaround +* if end byte alignment not correct move us +* into the next dword */ +if ((unsigned long )(skb->tail -1 ) &4 ) +break ; +/* fall through */ case e1000_82571:case e1000_82572:case e1000_82573:
PATCH 14/22 e1000: always turn on receives on esb2
In reply to Kok, AukeIn rare occasions, esb2 systems would end up started without the RX unit being turned on. Add a check that runs post-init to make sure.
---
drivers/net/e1000/e1000_main.c | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-)
drivers/net/e1000/e1000_main.c +7 -0
@@ -2673,6 +2673,13 @@ e1000_watchdog(unsigned long data)netif_wake_queue (netdev);mod_timer (&adapter->phy_info_timer, jiffies +2 *HZ ); adapter->smartspeed =0 ; + }else { +/* make sure the receive unit is started */ +if (adapter->hw.mac_type == e1000_80003es2lan) { +struct e1000_hw *hw = &adapter->hw; +uint32_t rctl =E1000_READ_REG (hw,RCTL ); +E1000_WRITE_REG (hw,RCTL , rctl |E1000_RCTL_EN ); + } } }else {if (netif_carrier_ok (netdev)) {
---
Auke Kok <[email protected]>
Re: [PATCH 14/22] e1000: always turn on receives on esb2
Quoted 15 lines · Auke
In rare occasions, esb2 systems would end up started without the RX unit being turned on. Add a check that runs post-init to make sure.
Signed-off-by Jesse Brandeburg <[email protected]>Signed-off-by Auke Kok <[email protected]>---
drivers/net/e1000/e1000_main.c | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-)drivers/net/e1000/e1000_main.c +0
-0
drivers/net/e1000/e1000_main.c e1000_watchdog(unsigned long data) · line 2682
Quoted 10 lines
drivers/net/e1000/e1000_main.c +7
-0@@ -2673,6 +2673,13 @@ e1000_watchdog(unsigned long data)netif_wake_queue (netdev);mod_timer (&adapter->phy_info_timer, jiffies +2 *HZ ); adapter->smartspeed =0 ; + }else { +/* make sure the receive unit is started */ +if (adapter->hw.mac_type == e1000_80003es2lan) { +struct e1000_hw *hw = &adapter->hw; +uint32_t rctl =E1000_READ_REG (hw,RCTL ); +E1000_WRITE_REG (hw,RCTL , rctl |E1000_RCTL_EN ); + }
seems like feature flag territory to me
PATCH 15/22 e1000: simplify msi specific interrupt handler
In reply to Kok, AukeSimplify the msi interrupt handler to avoid issues with delayed ICR reads. This avoids adapter specific problems at the cost of some performance.
---
drivers/net/e1000/e1000.h | 1 - drivers/net/e1000/e1000_main.c | 60 +++++++++++++--------------------------- 2 files changed, 19 insertions(+), 42 deletions(-)
drivers/net/e1000/e1000.h +0 -1
@@ -257,7 +257,6 @@ struct e1000_adapter {spinlock_t tx_queue_lock;#endif atomic_t irq_sem; -unsigned int detect_link;unsigned int total_tx_bytes;unsigned int total_tx_packets;unsigned int total_rx_bytes;
drivers/net/e1000/e1000_main.c +19 -41
76 lines not on this page · raw message
---
Auke Kok <[email protected]>
Re: [PATCH 15/22] e1000: simplify msi specific interrupt handler
Quoted 75 lines · Auke
Simplify the msi interrupt handler to avoid issues with delayed ICR reads. This avoids adapter specific problems at the cost of some performance.
Signed-off-by Jesse Brandeburg <[email protected]>Signed-off-by Auke Kok <[email protected]>---
drivers/net/e1000/e1000.h | 1 - drivers/net/e1000/e1000_main.c | 60 +++++++++++++--------------------------- 2 files changed, 19 insertions(+), 42 deletions(-)drivers/net/e1000/e1000.h +0
-1@@ -257,7 +257,6 @@ struct e1000_adapter {spinlock_t tx_queue_lock;#endif atomic_t irq_sem; -unsigned int detect_link;unsigned int total_tx_bytes;unsigned int total_tx_packets;unsigned int total_rx_bytes;drivers/net/e1000/e1000_main.c +6
-28@@ -3778,8 +3778,8 @@ e1000_update_stats(struct e1000_adapter* @data: pointer to a network interface device structure **/ -static -irqreturn_t e1000_intr_msi (int irq,void *data) +static irqreturn_t +e1000_intr_msi (int irq,void *data) {struct net_device *netdev = data;struct e1000_adapter *adapter =netdev_priv (netdev);@@ -3787,49 +3787,27 @@ irqreturn_t e1000_intr_msi(int irq, void#ifndef CONFIG_E1000_NAPI int i;#endif +uint32_t icr =E1000_READ_REG (hw,ICR ); -/* this code avoids the read of ICR but has to get 1000 interrupts -* at every link change event before it will notice the change */ -if (++adapter->detect_link >=1000 ) { -uint32_t icr =E1000_READ_REG (hw,ICR );#ifdef CONFIG_E1000_NAPI -/* read ICR disables interrupts using IAM, so keep up with our -* enable/disable accounting */ -atomic_inc (&adapter->irq_sem); +/* read ICR disables interrupts using IAM, so keep up with our +* enable/disable accounting */ +atomic_inc (&adapter->irq_sem);#endif - adapter->detect_link =0 ; -if ((icr & (E1000_ICR_RXSEQ |E1000_ICR_LSC )) && - (icr &E1000_ICR_INT_ASSERTED )) { - hw->get_link_status =1 ; -/* 80003ES2LAN workaround-- -* For packet buffer work-around on link down event; -* disable receives here in the ISR and -* reset adapter in watchdog -*/ -if (netif_carrier_ok (netdev) && - (adapter->hw.mac_type == e1000_80003es2lan)) { -/* disable receives */ -uint32_t rctl =E1000_READ_REG (hw,RCTL ); -E1000_WRITE_REG (hw,RCTL , rctl & ~E1000_RCTL_EN ); - } -/* guard against interrupt when we're going down */ -if (!test_bit (__E1000_DOWN, &adapter->flags)) -mod_timer (&adapter->watchdog_timer, - jiffies +1 );
drivers/net/e1000/e1000_main.c irqreturn_t e1000_intr_msi(int irq, void · line 3806
Quoted 10 lines
drivers/net/e1000/e1000_main.c +10
-0+if (icr & (E1000_ICR_RXSEQ |E1000_ICR_LSC )) { + hw->get_link_status =1 ; +/* 80003ES2LAN workaround-- For packet buffer work-around on +* link down event; disable receives here in the ISR and reset +* adapter in watchdog */ +if (netif_carrier_ok (netdev) && + (adapter->hw.mac_type == e1000_80003es2lan)) { +/* disable receives */ +uint32_t rctl =E1000_READ_REG (hw,RCTL ); +E1000_WRITE_REG (hw,RCTL , rctl & ~E1000_RCTL_EN );
feature flag
PATCH 16/22 e1000: Rewrite parm handling code to warn when forcing autoneg to gig only.
In reply to Kok, Auke---
drivers/net/e1000/e1000_param.c | 15 +++------------ 1 files changed, 3 insertions(+), 12 deletions(-)
drivers/net/e1000/e1000_param.c +3 -12
@@ -760,22 +760,13 @@ e1000_check_copper_options(struct e1000_case SPEED_1000 :DPRINTK (PROBE ,INFO ,"1000 Mbps Speed specified without " "Duplex\n" ); -DPRINTK (PROBE ,INFO , -"Using Autonegotiation at 1000 Mbps " -"Full Duplex only\n" ); - adapter->hw.autoneg = adapter->fc_autoneg =1 ; - adapter->hw.autoneg_advertised =ADVERTISE_1000_FULL ; -break ; + goto full_duplex_only;case SPEED_1000 +HALF_DUPLEX :DPRINTK (PROBE ,INFO ,"Half Duplex is not supported at 1000 Mbps\n" ); -DPRINTK (PROBE ,INFO , -"Using Autonegotiation at 1000 Mbps " -"Full Duplex only\n" ); - adapter->hw.autoneg = adapter->fc_autoneg =1 ; - adapter->hw.autoneg_advertised =ADVERTISE_1000_FULL ; -break ; +/* fall through */ case SPEED_1000 +FULL_DUPLEX : +full_duplex_only:DPRINTK (PROBE ,INFO ,"Using Autonegotiation at 1000 Mbps Full Duplex only\n" ); adapter->hw.autoneg = adapter->fc_autoneg =1 ;
---
Auke Kok <[email protected]>
PATCH 17/22 e1000: set max frame size before enabling new link settings
In reply to Kok, Auke---
drivers/net/e1000/e1000_main.c | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-)
drivers/net/e1000/e1000_main.c +1 -2
@@ -3584,12 +3584,11 @@ e1000_change_mtu(struct net_device *netd adapter->rx_buffer_len =MAXIMUM_ETHERNET_VLAN_SIZE ; netdev->mtu = new_mtu; + adapter->hw.max_frame_size = max_frame;if (netif_running (netdev))e1000_reinit_locked (adapter); - adapter->hw.max_frame_size = max_frame; -return 0 ; }
---
Auke Kok <[email protected]>
PATCH 18/22 e1000: For older adapters, we know that the pci bus type is pci.
In reply to Kok, Auke---
drivers/net/e1000/e1000_hw.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/net/e1000/e1000_hw.c +1 -1
@@ -6575,7 +6575,7 @@ e1000_get_bus_info(struct e1000_hw *hw)switch (hw->mac_type) {case e1000_82542_rev2_0:case e1000_82542_rev2_1: - hw->bus_type = e1000_bus_type_unknown; + hw->bus_type = e1000_bus_type_pci; hw->bus_speed = e1000_bus_speed_unknown; hw->bus_width = e1000_bus_width_unknown;break ;
---
Auke Kok <[email protected]>
PATCH 19/22 e1000: Don't set tipg (fiber) timings for pci-e adapters to fix fiber output
In reply to Kok, Aukethe driver has (ancient) code for messing with TIPG from the 82542 days. Unfortunately this code was running on our current adapters and setting TIPG for fiber to be +1 over the copper value. This caused 1.45Mpps to be sent instead of 1.487Mpps.
---
drivers/net/e1000/e1000_main.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)
drivers/net/e1000/e1000_main.c +3 -3
@@ -1669,9 +1669,9 @@ e1000_configure_tx(struct e1000_adapter }/* Set the default values for the Tx Inter Packet Gap timer */ - -if (hw->media_type == e1000_media_type_fiber || - hw->media_type == e1000_media_type_internal_serdes) +if (adapter->hw.mac_type <= e1000_82547_rev_2 && + (hw->media_type == e1000_media_type_fiber || + hw->media_type == e1000_media_type_internal_serdes)) tipg =DEFAULT_82543_TIPG_IPGT_FIBER ;else tipg =DEFAULT_82543_TIPG_IPGT_COPPER ;
---
Auke Kok <[email protected]>
PATCH 20/22 e1000: Fix poor quad port performance with NAPI
In reply to Kok, AukeThis fix attempts to solve a customer reported issue with NAPI enabled e1000 having bad performance when transmitting simultaneously on four ports. The issue comes down to an interaction between NAPI hardware interrupt balancing, and the driver rescheduling poll on the same processor.
We try to fix by allowing the driver to re-enable interrupts sooner instead of polling one more time, when there was recently all the work completed in cleanup.
---
drivers/net/e1000/e1000_main.c | 25 ++++++++++++++++--------- 1 files changed, 16 insertions(+), 9 deletions(-)
drivers/net/e1000/e1000_main.c +16 -9
@@ -3826,7 +3826,7 @@ e1000_intr_msi(int irq, void *data)for (i =0 ; i <E1000_MAX_INTR ; i++)if (unlikely (!adapter->clean_rx (adapter, adapter->rx_ring) & - !e1000_clean_tx_irq (adapter, adapter->tx_ring))) +e1000_clean_tx_irq (adapter, adapter->tx_ring)))break ;if (likely (adapter->itr_setting &3 ))
@@ -3979,7 +3979,7 @@ e1000_clean(struct net_device *poll_dev, poll_dev->quota -= work_done;/* If no Tx and not enough Rx work done, exit the polling mode */ -if ((!tx_cleaned && (work_done ==0 )) || +if ((tx_cleaned && (work_done < work_to_do)) || !netif_running (poll_dev)) { quit_polling:if (likely (adapter->itr_setting &3 ))
@@ -4009,7 +4009,7 @@ e1000_clean_tx_irq(struct e1000_adapter#ifdef CONFIG_E1000_NAPI unsigned int count =0 ;#endif -boolean_t cleaned = FALSE; +boolean_t cleaned = TRUE;unsigned int total_tx_bytes=0 , total_tx_packets=0 ; i = tx_ring->next_to_clean;
@@ -4025,13 +4025,17 @@ e1000_clean_tx_irq(struct e1000_adapterif (cleaned) {struct sk_buff *skb = buffer_info->skb;#ifdef NETIF_F_TSO -unsigned int segs =skb_shinfo (skb)->gso_segs; -if (segs) - total_tx_packets += segs; -#endif - +unsigned int segs, bytecount; + segs =skb_shinfo (skb)->gso_segs ?:1 ; +/* multiply data chunks by size of headers */ + bytecount = ((segs -1 ) *skb_headlen (skb)) + + skb->len; + total_tx_packets += segs; + total_tx_bytes += bytecount; +#else total_tx_packets++; total_tx_bytes += skb->len; +#endif }e1000_unmap_and_free_tx_resource (adapter, buffer_info); tx_desc->upper.data =0 ;
@@ -4044,7 +4048,10 @@ e1000_clean_tx_irq(struct e1000_adapter#ifdef CONFIG_E1000_NAPI #define E1000_TX_WEIGHT 64/* weight of a sort for tx, to avoid endless transmit cleanup */ -if (count++ ==E1000_TX_WEIGHT )break ; +if (count++ ==E1000_TX_WEIGHT ) { + cleaned = FALSE; +break ; + }#endif }
---
Auke Kok <[email protected]>
Re: [PATCH 20/22] e1000: Fix poor quad port performance with NAPI
Quoted 6 lines · Auke
This fix attempts to solve a customer reported issue with NAPI enabled e1000 having bad performance when transmitting simultaneously on four ports. The issue comes down to an interaction between NAPI hardware interrupt balancing, and the driver rescheduling poll on the same processor.
Quoted 6 lines
We try to fix by allowing the driver to re-enable interrupts sooner instead of polling one more time, when there was recently all the work completed in cleanup.
Signed-off-by Jesse Brandeburg <[email protected]>Signed-off-by Auke Kok <[email protected]>
ACK patches 16-20
PATCH 21/22 e1000: Version increment 7.3.20-k2 and minor cleanups
In reply to Kok, Auke---
drivers/net/e1000/e1000.h | 6 +---- drivers/net/e1000/e1000_hw.c | 52 +++++++++++++++++++-------------------- drivers/net/e1000/e1000_hw.h | 1 + drivers/net/e1000/e1000_main.c | 9 +++---- drivers/net/e1000/e1000_osdep.h | 9 +------ 5 files changed, 32 insertions(+), 45 deletions(-)
drivers/net/e1000/e1000.h +1 -5
@@ -61,6 +61,7 @@#include <linux/ip.h> #ifdef NETIF_F_TSO6 #include <linux/ipv6.h> +#include <net/ip6_checksum.h> #endif #include <linux/tcp.h> #include <linux/udp.h>
@@ -85,11 +86,7 @@ struct e1000_adapter;#include "e1000_hw.h" -#ifdef DBG -#define E1000_DBG(args...) printk(KERN_DEBUG "e1000: " args) -#else #define E1000_DBG(args...) -#endif #define E1000_ERR(args...) printk(KERN_ERR "e1000: " args)
@@ -361,5 +358,4 @@ enum e1000_state_t { __E1000_RESETTING, __E1000_DOWN }; -#endif /* _E1000_H_ */
drivers/net/e1000/e1000_hw.c +25 -27
136 lines not on this page · raw message
drivers/net/e1000/e1000_hw.h +1 -0
@@ -1042,6 +1042,7 @@ struct e1000_ffvt_entry {#define E1000_ICRXDMTC 0x04120/* Interrupt Cause Rx Descriptor Minimum Threshold Count */ #define E1000_ICRXOC 0x04124/* Interrupt Cause Receiver Overrun Count */ #define E1000_RXCSUM 0x05000/* RX Checksum Control - RW */ +#define E1000_RLPML 0x05004/* RX Long Packet Max Length */ #define E1000_RFCTL 0x05008/* Receive Filter Control*/ #define E1000_MTA 0x05200/* Multicast Table Array - RW Array */ #define E1000_RA 0x05400/* Receive Address - RW Array */
drivers/net/e1000/e1000_main.c +4 -5
@@ -27,7 +27,6 @@*******************************************************************************/ #include "e1000.h" -#include <net/ip6_checksum.h> char e1000_driver_name[] ="e1000" ;static char e1000_driver_string[] ="Intel(R) PRO/1000 Network Driver" ;
@@ -36,7 +35,7 @@ static char e1000_driver_string[] = "Int#else #define DRIVERNAPI "-NAPI"#endif -#define DRV_VERSION "7.3.15-k2"DRIVERNAPI +#define DRV_VERSION "7.3.20-k2"DRIVERNAPIchar e1000_driver_version[] =DRV_VERSION ;static char e1000_copyright[] ="Copyright (c) 1999-2006 Intel Corporation." ;
@@ -1353,7 +1352,6 @@ e1000_sw_init(struct e1000_adapter *adapspin_lock_init (&adapter->stats_lock);set_bit (__E1000_DOWN, &adapter->flags); -return 0 ; }
@@ -1713,7 +1711,8 @@ e1000_configure_tx(struct e1000_adapter tarc =E1000_READ_REG (hw,TARC0 );/* set the speed mode bit, we'll clear it if we're not at * gigabit link later */ - tarc |= (1 <<21 ); +#define SPEED_MODE_BIT (1 << 21) + tarc |=SPEED_MODE_BIT ;E1000_WRITE_REG (hw,TARC0 , tarc); }else if (hw->mac_type == e1000_80003es2lan) { tarc =E1000_READ_REG (hw,TARC0 );
@@ -2631,7 +2630,7 @@ e1000_watchdog(unsigned long data) txb2b == 0) {uint32_t tarc0; tarc0 =E1000_READ_REG (&adapter->hw,TARC0 ); - tarc0 &= ~(1 <<21 ); + tarc0 &= ~SPEED_MODE_BIT ;E1000_WRITE_REG (&adapter->hw,TARC0 , tarc0); }
drivers/net/e1000/e1000_osdep.h +1 -8
@@ -48,17 +48,10 @@ typedef enum { TRUE = 1 } boolean_t; -#define MSGOUT (S ,A ,B ) printk(KERN_DEBUG S "\n", A, B) - -#ifdef DBG -#define DEBUGOUT (S ) printk(KERN_DEBUG S "\n") -#define DEBUGOUT1(S, A...) printk(KERN_DEBUG S "\n", A) -#else #define DEBUGOUT (S ) #define DEBUGOUT1(S, A...) -#endif -#define DEBUGFUNC (F ) DEBUGOUT(F) +#define DEBUGFUNC (F ) DEBUGOUT(F "\n")#define DEBUGOUT2 DEBUGOUT1#define DEBUGOUT3 DEBUGOUT2#define DEBUGOUT7 DEBUGOUT3
---
Auke Kok <[email protected]>
Re: [PATCH 21/22] e1000: Version increment 7.3.20-k2 and minor cleanups
Quoted 1 line · Auke
Signed-off-by Auke Kok <[email protected]>
ACK
PATCH 22/22 # This series applies on GIT commit 0ae851352a87db3f829511816a2da227860bf585
In reply to Kok, Auke00_ixgb_sentinel.patch
01_ixgb_maybe_stop_tx.patch
02_ixgb_reorder_write.patch
03_e1000_add_fc_detect_printout.patch
04_e1000_itr_fixups.patch
05_e1000_cosmetic_csum_changes.patch
06_e1000_fix_tx_carrier_errors.patch
07_e1000_init_release_manageability.patch
08_e1000_pba_calc.patch
09_e1000_copybreak_size_parm.patch
10_e1000_fire_link_event.patch
11_e1000_phy_link_power_mode.patch
12_e1000_debug_slab_82544.patch
13_e1000_start_rx_unit.patch
14_e1000_msi_intr_fixes.patch
15_e1000_gig_full_forcing.patch
16_e1000_set_framesiz_before_reset.patch
17_e1000_set_type_to_pci.patch
18_e1000_tipg_type.patch
19_e1000_e1000_clean_tx_irq.patch
20_e1000_cleanups_version.patch
---
0 files changed, 0 insertions(+), 0 deletions(-)
---
Auke Kok <[email protected]>