e1000e: cleanup several stats issues
Subsystems (2)
PATCH 1/8 e1000e: cleanup several stats issues
From: Bruce Allan <[email protected]>
Several stats registers are completely unused and we just waste pci bus time reading them. We also omit using the high 32 bits of the GORC/ GOTC counters. We can just read clear them and only read the low registers.
Mii-tool can also break es2lan if it executes a MII PHY register ioctl while the device is in autonegotiation. Unfortunately it seems that several applications and installations still perform this ioctl call periodically and especially in this crucial startup time. We can fool the ioctl by providing fail safe information that mimics the "down" link state and only perform the dangerous PHY reads once after link comes up to fill in the real values. As long as link stays up the information will not change.
---
drivers/net/e1000e/82571.c | 6 -- drivers/net/e1000e/defines.h | 2 + drivers/net/e1000e/e1000.h | 25 +++++-- drivers/net/e1000e/es2lan.c | 2 - drivers/net/e1000e/ethtool.c | 6 +- drivers/net/e1000e/hw.h | 12 +-- drivers/net/e1000e/netdev.c | 155 +++++++++++++++++++++++++----------------- 7 files changed, 122 insertions(+), 86 deletions(-)
drivers/net/e1000e/82571.c +0 -6
@@ -1326,12 +1326,10 @@ struct e1000_info e1000_82571_info = { .mac = e1000_82571, .flags =FLAG_HAS_HW_VLAN_FILTER |FLAG_HAS_JUMBO_FRAMES - |FLAG_HAS_STATS_PTC_PRC |FLAG_HAS_WOL |FLAG_APME_IN_CTRL3 |FLAG_RX_CSUM_ENABLED |FLAG_HAS_CTRLEXT_ON_LOAD - |FLAG_HAS_STATS_ICR_ICT |FLAG_HAS_SMART_POWER_DOWN |FLAG_RESET_OVERWRITES_LAA /* errata */ |FLAG_TARC_SPEED_MODE_BIT /* errata */
@@ -1347,12 +1345,10 @@ struct e1000_info e1000_82572_info = { .mac = e1000_82572, .flags =FLAG_HAS_HW_VLAN_FILTER |FLAG_HAS_JUMBO_FRAMES - |FLAG_HAS_STATS_PTC_PRC |FLAG_HAS_WOL |FLAG_APME_IN_CTRL3 |FLAG_RX_CSUM_ENABLED |FLAG_HAS_CTRLEXT_ON_LOAD - |FLAG_HAS_STATS_ICR_ICT | FLAG_TARC_SPEED_MODE_BIT, /* errata */ .pba = 38, .get_variants = e1000_get_variants_82571,
@@ -1365,11 +1361,9 @@ struct e1000_info e1000_82573_info = { .mac = e1000_82573, .flags =FLAG_HAS_HW_VLAN_FILTER |FLAG_HAS_JUMBO_FRAMES - |FLAG_HAS_STATS_PTC_PRC |FLAG_HAS_WOL |FLAG_APME_IN_CTRL3 |FLAG_RX_CSUM_ENABLED - |FLAG_HAS_STATS_ICR_ICT |FLAG_HAS_SMART_POWER_DOWN |FLAG_HAS_AMT |FLAG_HAS_ERT
drivers/net/e1000e/defines.h +2 -0
@@ -527,8 +527,10 @@#define PHY_ID2 0x03/* Phy Id Reg (word 2) */ #define PHY_AUTONEG_ADV 0x04/* Autoneg Advertisement */ #define PHY_LP_ABILITY 0x05/* Link Partner Ability (Base Page) */ +#define PHY_AUTONEG_EXP 0x06/* Autoneg Expansion Reg */ #define PHY_1000T_CTRL 0x09/* 1000Base-T Control Reg */ #define PHY_1000T_STATUS 0x0A/* 1000Base-T Status Reg */ +#define PHY_EXT_STATUS 0x0F/* Extended Status Reg */ /* NVM Control */ #define E1000_EECD_SK 0x00000001/* NVM Clock */
drivers/net/e1000e/e1000.h +19 -6
@@ -147,6 +147,18 @@ struct e1000_ring {struct e1000_queue_stats stats; }; +/* PHY register snapshot values */ +struct e1000_phy_regs { +u16 bmcr;/* basic mode control register */ +u16 bmsr;/* basic mode status register */ +u16 advertise;/* auto-negotiation advertisement */ +u16 lpa;/* link partner ability register */ +u16 expansion;/* auto-negotiation expansion reg */ +u16 ctrl1000;/* 1000BASE-T control register */ +u16 stat1000;/* 1000BASE-T status register */ +u16 estatus;/* extended status register */ +}; +/* board specific private data structure */ struct e1000_adapter {struct timer_list watchdog_timer;
@@ -202,8 +214,8 @@ struct e1000_adapter {/* Tx stats */ u64 tpt_old;u64 colc_old; -u64 gotcl_old; -u32 gotcl; +u32 gotc; +u64 gotc_old;u32 tx_timeout_count;u32 tx_fifo_head;u32 tx_head_addr;
@@ -227,8 +239,8 @@ struct e1000_adapter {u64 hw_csum_err;u64 hw_csum_good;u64 rx_hdr_split; -u64 gorcl_old; -u32 gorcl; +u32 gorc; +u64 gorc_old;u32 alloc_rx_buff_failed;u32 rx_dma_failed;
@@ -250,6 +262,9 @@ struct e1000_adapter {struct e1000_phy_info phy_info;struct e1000_phy_stats phy_stats; +/* Snapshot of PHY registers */ +struct e1000_phy_regs phy_regs; +struct e1000_ring test_tx_ring;struct e1000_ring test_rx_ring;u32 test_icr;
@@ -286,8 +301,6 @@ struct e1000_info {#define FLAG_HAS_CTRLEXT_ON_LOAD (1 << 5)#define FLAG_HAS_SWSM_ON_LOAD (1 << 6)#define FLAG_HAS_JUMBO_FRAMES (1 << 7) -#define FLAG_HAS_STATS_ICR_ICT (1 << 9) -#define FLAG_HAS_STATS_PTC_PRC (1 << 10)#define FLAG_HAS_SMART_POWER_DOWN (1 << 11)#define FLAG_IS_QUAD_PORT_A (1 << 12)#define FLAG_IS_QUAD_PORT (1 << 13)
drivers/net/e1000e/es2lan.c +0 -2
@@ -1231,12 +1231,10 @@ struct e1000_info e1000_es2_info = { .mac = e1000_80003es2lan, .flags =FLAG_HAS_HW_VLAN_FILTER |FLAG_HAS_JUMBO_FRAMES - |FLAG_HAS_STATS_PTC_PRC |FLAG_HAS_WOL |FLAG_APME_IN_CTRL3 |FLAG_RX_CSUM_ENABLED |FLAG_HAS_CTRLEXT_ON_LOAD - |FLAG_HAS_STATS_ICR_ICT |FLAG_RX_NEEDS_RESTART /* errata */ |FLAG_TARC_SET_BIT_ZERO /* errata */ |FLAG_APME_CHECK_PORT_B
drivers/net/e1000e/ethtool.c +3 -3
@@ -46,8 +46,8 @@ struct e1000_stats {static const struct e1000_stats e1000_gstrings_stats[] = { {"rx_packets" ,E1000_STAT (stats.gprc) }, {"tx_packets" ,E1000_STAT (stats.gptc) }, - {"rx_bytes" ,E1000_STAT (stats.gorcl) }, - {"tx_bytes" ,E1000_STAT (stats.gotcl) }, + {"rx_bytes" ,E1000_STAT (stats.gorc) }, + {"tx_bytes" ,E1000_STAT (stats.gotc) }, {"rx_broadcast" ,E1000_STAT (stats.bprc) }, {"tx_broadcast" ,E1000_STAT (stats.bptc) }, {"rx_multicast" ,E1000_STAT (stats.mprc) },
@@ -83,7 +83,7 @@ static const struct e1000_stats e1000_gstrings_stats[] = { { "rx_flow_control_xoff", E1000_STAT(stats.xoffrxc) }, { "tx_flow_control_xon", E1000_STAT(stats.xontxc) }, { "tx_flow_control_xoff", E1000_STAT(stats.xofftxc) }, - { "rx_long_byte_count", E1000_STAT(stats.gorcl) }, + { "rx_long_byte_count", E1000_STAT(stats.gorc) }, { "rx_csum_offload_good", E1000_STAT(hw_csum_good) }, { "rx_csum_offload_errors", E1000_STAT(hw_csum_err) }, { "rx_header_split", E1000_STAT(rx_hdr_split) },
drivers/net/e1000e/hw.h +4 -8
@@ -592,10 +592,8 @@ struct e1000_hw_stats {u64 bprc;u64 mprc;u64 gptc; -u64 gorcl; -u64 gorch; -u64 gotcl; -u64 gotch; +u64 gorc; +u64 gotc;u64 rnbc;u64 ruc;u64 rfc;
@@ -604,10 +602,8 @@ struct e1000_hw_stats {u64 mgprc;u64 mgpdc;u64 mgptc; -u64 torl; -u64 torh; -u64 totl; -u64 toth; +u64 tor; +u64 tot;u64 tpr;u64 tpt;u64 ptc64;
drivers/net/e1000e/netdev.c +94 -61
239 lines not on this page · raw message
PATCH 2/8 e1000e: Add interrupt moderation run-time ethtool interface
The ethtool -c / -C interface can now be used to modify the irq moderation algorithm. This change does not require an adapter reset and can thus be used at all times. The adapter only supports changing/reading rx-usecs which has special values for 0, 1 and 3:
0 - no irq moderation whatsoever
1 - normal moderation favoring regular mixed traffic (default) 3 - best attempt at low latency possible at cost of CPU
For values between 10 and 10000 the rx-usecs defines "the minimum time between successive irqs" in usec, unlike the module parameter.
---
drivers/net/e1000e/e1000.h | 3 +++ drivers/net/e1000e/ethtool.c | 43 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+), 0 deletions(-)
drivers/net/e1000e/e1000.h +3 -0
@@ -70,6 +70,9 @@ struct e1000_info;#define E1000_MAX_RXD 4096#define E1000_MIN_RXD 80 +#define E1000_MIN_ITR_USECS 10/* 100000 irq/sec */ +#define E1000_MAX_ITR_USECS 10000/* 100 irq/sec */ +/* Early Receive defines */ #define E1000_ERT_2048 0x100
drivers/net/e1000e/ethtool.c +43 -0
55 lines not on this page · raw message
PATCH 3/8 e1000e: Fix HW Error on es2lan, ARP capture issue by BMC
In reply to Auke KokFrom: David Graham <[email protected]>
Several components to this complex fix. The es2lan cards occasionally gave a "HW Error" especially when forcing speed. Some users also reported that the BMC stole ARP packets.
The fixes include setting the proper SW_FW bits to tell the BMC that we're active and not do any un-initialization at all, so the setup routine is largely changed.
---
drivers/net/e1000e/defines.h | 1 drivers/net/e1000e/e1000.h | 2 + drivers/net/e1000e/es2lan.c | 127 +++++++++++++++++++++++++++++++----------- drivers/net/e1000e/phy.c | 73 +++++++++++++----------- 4 files changed, 137 insertions(+), 66 deletions(-)
drivers/net/e1000e/defines.h +1 -0
@@ -184,6 +184,7 @@#define E1000_SWFW_EEP_SM 0x1#define E1000_SWFW_PHY0_SM 0x2#define E1000_SWFW_PHY1_SM 0x4 +#define E1000_SWFW_CSR_SM 0x8/* Device Control */ #define E1000_CTRL_FD 0x00000001/* Full duplex.0=half; 1=full */
drivers/net/e1000e/e1000.h +2 -0
@@ -449,6 +449,8 @@ extern s32 e1000e_read_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 *data);extern s32 e1000e_phy_has_link_generic (struct e1000_hw *hw,u32 iterations,u32 usec_interval,bool *success);extern s32 e1000e_phy_reset_dsp (struct e1000_hw *hw); +extern s32 e1000e_read_phy_reg_mdic (struct e1000_hw *hw,u32 offset,u16 *data); +extern s32 e1000e_write_phy_reg_mdic (struct e1000_hw *hw,u32 offset,u16 data);extern s32 e1000e_check_downshift (struct e1000_hw *hw);static inline s32 e1000_phy_hw_reset (struct e1000_hw *hw)
drivers/net/e1000e/es2lan.c +94 -33
268 lines not on this page · raw message
drivers/net/e1000e/phy.c +40 -33
175 lines not on this page · raw message
PATCH 4/8 e1000e: lower ring minimum size to 64
In reply to Auke KokThe lower limit of 80 descriptors in the ring is only valid for one older 8254x chipset. All e1000e devices can use as low as 64 descriptors.
---
drivers/net/e1000e/e1000.h | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/net/e1000e/e1000.h +2 -2
@@ -64,11 +64,11 @@ struct e1000_info;/* Tx/Rx descriptor defines */ #define E1000_DEFAULT_TXD 256#define E1000_MAX_TXD 4096 -#define E1000_MIN_TXD 80 +#define E1000_MIN_TXD 64#define E1000_DEFAULT_RXD 256#define E1000_MAX_RXD 4096 -#define E1000_MIN_RXD 80 +#define E1000_MIN_RXD 64#define E1000_MIN_ITR_USECS 10/* 100000 irq/sec */ #define E1000_MAX_ITR_USECS 10000/* 100 irq/sec */
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
Re: [E1000-devel] [PATCH 4/8] e1000e: lower ring minimum size to 64
Quoted 5 lines · Auke Kok
The lower limit of 80 descriptors in the ring is only valid for one older 8254x chipset. All e1000e devices can use as low as 64 descriptors.
Signed-off-by Auke Kok <[email protected]>
Jeff,
patch #1-4 are RESENDS, where I omitted the VLAN/TSO fix that PJ will respin. patch 5-8 are trivial patches (partial RESENDS) that I did not see merged yet and I could not find in any of your trees ATM. apologies if I sound pushy - just making sure these don't fall through the cracks ;)
Cheers
Auke
PATCH 5/8 ixgbe: save and restore pcie/msi state to support EEH recovery
In reply to Auke KokFrom: Wendy Xiong <[email protected]>
To enable EEH support for pci-express network adapters, pcie/msi state needs to be saved and restored for that adapter.
Tested this EEH patch with Intel 10G pci-express ixgbe adapter.
---
drivers/net/ixgbe/ixgbe_main.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
drivers/net/ixgbe/ixgbe_main.c +2 -0
@@ -3431,6 +3431,7 @@ static int __devinit ixgbe_probe(struct pci_dev *pdev, }pci_set_master (pdev); +pci_save_state (pdev);#ifdef CONFIG_NETDEVICES_MULTIQUEUE netdev =alloc_etherdev_mq (sizeof (struct ixgbe_adapter ),MAX_TX_QUEUES );
@@ -3721,6 +3722,7 @@ static pci_ers_result_t ixgbe_io_slot_reset(struct pci_dev *pdev)return PCI_ERS_RESULT_DISCONNECT ; }pci_set_master (pdev); +pci_restore_state (pdev);pci_enable_wake (pdev, PCI_D3hot,0 );pci_enable_wake (pdev, PCI_D3cold,0 );
PATCH 6/8 e1000e: save and restore pcie/msi state to support EEH recovery
In reply to Auke KokFrom: Wendy Xiong <[email protected]>
To enable EEH support for pci-express network adapters, pcie/msi state needs to be saved and restored for that adapter.
Tested this EEH patch with 2ports and 4ports pci-express e1000e adapters.
---
drivers/net/e1000e/netdev.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
drivers/net/e1000e/netdev.c +2 -0
@@ -3815,6 +3815,7 @@ static pci_ers_result_t e1000_io_slot_reset(struct pci_dev *pdev)return PCI_ERS_RESULT_DISCONNECT ; }pci_set_master (pdev); +pci_restore_state (pdev);pci_enable_wake (pdev, PCI_D3hot,0 );pci_enable_wake (pdev, PCI_D3cold,0 );
@@ -3941,6 +3942,7 @@ static int __devinit e1000_probe(struct pci_dev *pdev, goto err_pci_reg;pci_set_master (pdev); +pci_save_state (pdev); err = -ENOMEM ; netdev =alloc_etherdev (sizeof (struct e1000_adapter ));
PATCH RESEND 7/8 igb: save and restore pcie/msi state to support EEH recovery
In reply to Auke KokTo enable EEH support for pci-express network adapters, pcie/msi state needs to be saved and restored for that adapter.
[after similar patches for ixgbe and e1000e from Wendy Xiong]
---
drivers/net/igb/igb_main.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
drivers/net/igb/igb_main.c +2 -0
@@ -871,6 +871,7 @@ static int __devinit igb_probe(struct pci_dev *pdev, goto err_pci_reg;pci_set_master (pdev); +pci_save_state (pdev); err = -ENOMEM ; netdev =alloc_etherdev (sizeof (struct igb_adapter ));
@@ -4079,6 +4080,7 @@ static pci_ers_result_t igb_io_slot_reset(struct pci_dev *pdev)return PCI_ERS_RESULT_DISCONNECT ; }pci_set_master (pdev); +pci_restore_state (pdev);pci_enable_wake (pdev, PCI_D3hot,0 );pci_enable_wake (pdev, PCI_D3cold,0 );
PATCH 8/8 e1000e: Increment version to 0.2.1
In reply to Auke KokFrom: Jesse Brandeburg <[email protected]>
---
drivers/net/e1000e/netdev.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/net/e1000e/netdev.c +1 -1
@@ -46,7 +46,7 @@#include "e1000.h" -#define DRV_VERSION "0.2.0" +#define DRV_VERSION "0.2.1"char e1000e_driver_name[] ="e1000e" ;const char e1000e_driver_version[] =DRV_VERSION ;
Quoted 15 lines · Auke Kok
From: Bruce Allan <[email protected]>
Several stats registers are completely unused and we just waste pci bus time reading them. We also omit using the high 32 bits of the GORC/ GOTC counters. We can just read clear them and only read the low registers.
Mii-tool can also break es2lan if it executes a MII PHY register ioctl while the device is in autonegotiation. Unfortunately it seems that several applications and installations still perform this ioctl call periodically and especially in this crucial startup time. We can fool the ioctl by providing fail safe information that mimics the "down" link state and only perform the dangerous PHY reads once after link comes up to fill in the real values. As long as link stays up the information will not change.
Quoted 4 lines
Signed-off-by Bruce Allan <[email protected]>Signed-off-by Jeff Kirsher <[email protected]>Signed-off-by Jesse Brandeburg <[email protected]>Signed-off-by Auke Kok <[email protected]>
applied 1-8
I was mainly waiting for the discussion of the abuse of the ethtool interface, which I chose to allow.
Now, send me a patch to the ethtool man page for this new behavior :)
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
Quoted 22 lines · Jeff Garzik
Quoted 16 lines · Auke Kok
From: Bruce Allan <[email protected]>
Several stats registers are completely unused and we just waste pci bus time reading them. We also omit using the high 32 bits of the GORC/ GOTC counters. We can just read clear them and only read the low registers.
Mii-tool can also break es2lan if it executes a MII PHY register ioctl while the device is in autonegotiation. Unfortunately it seems that several applications and installations still perform this ioctl call periodically and especially in this crucial startup time. We can fool the ioctl by providing fail safe information that mimics the "down" link state and only perform the dangerous PHY reads once after link comes up to fill in the real values. As long as link stays up the information will not change.
Quoted 4 lines
Signed-off-by Bruce Allan <[email protected]>Signed-off-by Jeff Kirsher <[email protected]>Signed-off-by Jesse Brandeburg <[email protected]>Signed-off-by Auke Kok <[email protected]>
Quoted 6 lines
applied 1-8
I was mainly waiting for the discussion of the abuse of the ethtool interface, which I chose to allow.
Now, send me a patch to the ethtool man page for this new behavior :)
agreed - I'll come up with an appropriate explanation to cover this issue.
Thanks.
Auke
Quoted 22 lines · Jeff Garzik
Quoted 16 lines · Auke Kok
From: Bruce Allan <[email protected]>
Several stats registers are completely unused and we just waste pci bus time reading them. We also omit using the high 32 bits of the GORC/ GOTC counters. We can just read clear them and only read the low registers.
Mii-tool can also break es2lan if it executes a MII PHY register ioctl while the device is in autonegotiation. Unfortunately it seems that several applications and installations still perform this ioctl call periodically and especially in this crucial startup time. We can fool the ioctl by providing fail safe information that mimics the "down" link state and only perform the dangerous PHY reads once after link comes up to fill in the real values. As long as link stays up the information will not change.
Quoted 4 lines
Signed-off-by Bruce Allan <[email protected]>Signed-off-by Jeff Kirsher <[email protected]>Signed-off-by Jesse Brandeburg <[email protected]>Signed-off-by Auke Kok <[email protected]>
Quoted 6 lines
applied 1-8
I was mainly waiting for the discussion of the abuse of the ethtool interface, which I chose to allow.
Now, send me a patch to the ethtool man page for this new behavior :)
it almost seems more appropriate to send a patch to the e1000 README and explain the parameter use in there since this is a per-driver modification and there's nothing special about the ethtool call itself.
Would you be OK with a general patch to ethtool that states that "drivers may interpret values differently and users should consult the driver's source code or README for proper use of the parameter." ?
This seems the logical solution.
Auke
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone