Intel Wired LAN Driver Updates 2013.02.16
Subsystems (3)
This series contains updates to e1000, e1000e, igb, igbvf and ixgbe. The e1000, e1000e, igb and igbvf are single patch changes and the remaining 11 patches are all against ixgbe.
The e1000 patch is a comment cleanup to align e1000 with the code commenting style for /drivers/net. It also contains a few other white space cleanups (i.e. fix lines over 80 char, remove unnecessary blank lines and fix the use of tabs/spaces).
The e1000e patch from Koki (Fujitsu) adds a warning when link speed is downgraded due to SmartSpeed.
The igb patch from Stefan (Red Hat) increases the timeout in the ethtool offline self-test because some i350 adapters would sometimes fail the self-test because link auto negotiation may take longer than the current 4 second timeout.
The igbvf patch from Alex is meant to address several race issues that become possible because next_to_watch could possibly be set to a value that shows that the descriptor is done when it is not. In order to correct that we instead make next_to_watch a pointer that is set to NULL during cleanup, and set to the eop_desc after the descriptor rings have been written.
The remaining patches for ixgbe are a mix of fixes and added support as well as some cleanup. Most notably is the added support for displaying the number of Tx/Rx channels via ethtool by Alex. Also Aurélien adds the ability for reading data from SFP+ modules over i2c for diagnostic monitoring.
The following are changes since commit efd9450e7e36717f24dff3bd584faa80a85231d6:
net: use skb_reset_mac_len() in dev_gro_receive()
and are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/net-next master
Alexander Duyck (8):
igbvf: Make next_to_watch a pointer and adjust memory barriers to
avoid races
ixgbe: Define FCoE and Flow director limits much sooner to allow for
changes
ixgbe: Add function for setting XPS queue mapping
ixgbe: Update ixgbe driver to use __netdev_pick_tx in
ixgbe_select_queue
ixgbe: Make ixgbe_setup_tc usable even when DCB is not enabled
ixgbe: Add support for displaying the number of Tx/Rx channels
ixgbe: Add support for set_channels ethtool operation
ixgbe: Update DESC_NEEDED define to adjust for changes to
MAX_SKB_FRAGS
Aurélien Guillaume (1):
ixgbe: implement SFF diagnostic monitoring via ethtool
Emil Tantilov (3):
ixgbe: fix possible data corruption in read_i2c_byte
ixgbe: cleanup error checking in ixgbe_identify_sfp_module_generic()
ixgbe: fix Tx timeouts with BQL
Jeff Kirsher (1):
e1000: fix whitespace issues and multi-line comments
Koki Sanagi (1):
e1000e: display a warning message when SmartSpeed works
Stefan Assmann (1):
igb: increase timeout for ethtool offline self-test
drivers/net/ethernet/intel/e1000/e1000.h | 65 +-- drivers/net/ethernet/intel/e1000/e1000_ethtool.c | 140 +++--- drivers/net/ethernet/intel/e1000/e1000_hw.c | 558 +++++++++++++---------- drivers/net/ethernet/intel/e1000/e1000_main.c | 322 +++++++------ drivers/net/ethernet/intel/e1000/e1000_param.c | 29 +- drivers/net/ethernet/intel/e1000e/netdev.c | 7 + drivers/net/ethernet/intel/igb/igb_ethtool.c | 2 +- drivers/net/ethernet/intel/igbvf/igbvf.h | 2 +- drivers/net/ethernet/intel/igbvf/netdev.c | 52 ++- drivers/net/ethernet/intel/ixgbe/ixgbe.h | 17 +- drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c | 257 ++++++++++- drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c | 21 +- drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 125 ++--- drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c | 36 +- 14 files changed, 973 insertions(+), 660 deletions(-)
Signature · 1 line
1.7.11.7
PATCH 1/15 e1000: fix whitespace issues and multi-line comments
Fixes whitespace issues, such as lines exceeding 80 chars, needless blank lines and the use of spaces where tabs are needed. In addition, fix multi-line comments to align with the networking standard.
--- drivers/net/ethernet/intel/e1000/e1000.h | 65 +-- drivers/net/ethernet/intel/e1000/e1000_ethtool.c | 140 +++--- drivers/net/ethernet/intel/e1000/e1000_hw.c | 558 +++++++++++++---------- drivers/net/ethernet/intel/e1000/e1000_main.c | 322 +++++++------ drivers/net/ethernet/intel/e1000/e1000_param.c | 29 +- 5 files changed, 586 insertions(+), 528 deletions(-)
drivers/net/ethernet/intel/e1000/e1000.h +33 -32
@@ -81,68 +81,69 @@ struct e1000_adapter;#include "e1000_hw.h" -#define E1000_MAX_INTR 10 +#define E1000_MAX_INTR 10/* TX/RX descriptor defines */ -#define E1000_DEFAULT_TXD 256 -#define E1000_MAX_TXD 256 -#define E1000_MIN_TXD 48 -#define E1000_MAX_82544_TXD 4096 +#define E1000_DEFAULT_TXD 256 +#define E1000_MAX_TXD 256 +#define E1000_MIN_TXD 48 +#define E1000_MAX_82544_TXD 4096 -#define E1000_DEFAULT_RXD 256 -#define E1000_MAX_RXD 256 -#define E1000_MIN_RXD 48 -#define E1000_MAX_82544_RXD 4096 +#define E1000_DEFAULT_RXD 256 +#define E1000_MAX_RXD 256 +#define E1000_MIN_RXD 48 +#define E1000_MAX_82544_RXD 4096#define E1000_MIN_ITR_USECS 10/* 100000 irq/sec */ #define E1000_MAX_ITR_USECS 10000/* 100 irq/sec */ /* this is the size past which hardware will drop packets when setting LPE=0 */ -#define MAXIMUM_ETHERNET_VLAN_SIZE 1522 +#define MAXIMUM_ETHERNET_VLAN_SIZE 1522/* Supported Rx Buffer Sizes */ -#define E1000_RXBUFFER_128 128/* Used for packet split */ -#define E1000_RXBUFFER_256 256/* Used for packet split */ -#define E1000_RXBUFFER_512 512 -#define E1000_RXBUFFER_1024 1024 -#define E1000_RXBUFFER_2048 2048 -#define E1000_RXBUFFER_4096 4096 -#define E1000_RXBUFFER_8192 8192 -#define E1000_RXBUFFER_16384 16384 +#define E1000_RXBUFFER_128 128/* Used for packet split */ +#define E1000_RXBUFFER_256 256/* Used for packet split */ +#define E1000_RXBUFFER_512 512 +#define E1000_RXBUFFER_1024 1024 +#define E1000_RXBUFFER_2048 2048 +#define E1000_RXBUFFER_4096 4096 +#define E1000_RXBUFFER_8192 8192 +#define E1000_RXBUFFER_16384 16384/* SmartSpeed delimiters */ -#define E1000_SMARTSPEED_DOWNSHIFT 3 -#define E1000_SMARTSPEED_MAX 15 +#define E1000_SMARTSPEED_DOWNSHIFT 3 +#define E1000_SMARTSPEED_MAX 15/* Packet Buffer allocations */ -#define E1000_PBA_BYTES_SHIFT 0xA -#define E1000_TX_HEAD_ADDR_SHIFT 7 -#define E1000_PBA_TX_MASK 0xFFFF0000 +#define E1000_PBA_BYTES_SHIFT 0xA +#define E1000_TX_HEAD_ADDR_SHIFT 7 +#define E1000_PBA_TX_MASK 0xFFFF0000/* Flow Control Watermarks */ -#define E1000_FC_HIGH_DIFF 0x1638/* High: 5688 bytes below Rx FIFO size */ -#define E1000_FC_LOW_DIFF 0x1640/* Low: 5696 bytes below Rx FIFO size */ +#define E1000_FC_HIGH_DIFF 0x1638/* High: 5688 bytes below Rx FIFO size */ +#define E1000_FC_LOW_DIFF 0x1640/* Low: 5696 bytes below Rx FIFO size */ -#define E1000_FC_PAUSE_TIME 0xFFFF/* pause for the max or until send xon */ +#define E1000_FC_PAUSE_TIME 0xFFFF/* pause for the max or until send xon */ /* How many Tx Descriptors do we need to call netif_wake_queue ? */ #define E1000_TX_QUEUE_WAKE 16/* How many Rx Buffers do we bundle into one write to the hardware ? */ -#define E1000_RX_BUFFER_WRITE 16/* Must be power of 2 */ +#define E1000_RX_BUFFER_WRITE 16/* Must be power of 2 */ -#define AUTO_ALL_MODES 0 -#define E1000_EEPROM_82544_APM 0x0004 -#define E1000_EEPROM_APME 0x0400 +#define AUTO_ALL_MODES 0 +#define E1000_EEPROM_82544_APM 0x0004 +#define E1000_EEPROM_APME 0x0400#ifndef E1000_MASTER_SLAVE /* Switch to override PHY master/slave setting */ #define E1000_MASTER_SLAVE e1000_ms_hw_default#endif -#define E1000_MNG_VLAN_NONE (-1) +#define E1000_MNG_VLAN_NONE (-1)/* wrapper around a pointer to a socket buffer, -* so a DMA handle can be stored along with the buffer */ +* so a DMA handle can be stored along with the buffer +*/ struct e1000_buffer {struct sk_buff *skb;dma_addr_t dma;
drivers/net/ethernet/intel/e1000/e1000_ethtool.c +72 -68
303 lines not on this page · raw message
drivers/net/ethernet/intel/e1000/e1000_hw.c +309 -249
1,120 lines not on this page · raw message
drivers/net/ethernet/intel/e1000/e1000_main.c +158 -164
1,011 lines not on this page · raw message
drivers/net/ethernet/intel/e1000/e1000_param.c +14 -15
@@ -267,7 +267,6 @@ static void e1000_check_copper_options(struct e1000_adapter *adapter);* value exists, a default value is used. The final value is stored * in a variable in the adapter structure. **/ -void e1000_check_options (struct e1000_adapter *adapter) {struct e1000_option opt;
@@ -319,7 +318,8 @@ void e1000_check_options(struct e1000_adapter *adapter) .def = E1000_DEFAULT_RXD, .arg = { .r = { .min = E1000_MIN_RXD, - .max = mac_type < e1000_82544 ? E1000_MAX_RXD : E1000_MAX_82544_RXD + .max = mac_type < e1000_82544 ?E1000_MAX_RXD : +E1000_MAX_82544_RXD }} };
@@ -408,7 +408,7 @@ void e1000_check_options(struct e1000_adapter *adapter)if (num_TxAbsIntDelay > bd) { adapter->tx_abs_int_delay = TxAbsIntDelay[bd];e1000_validate_option (&adapter->tx_abs_int_delay, &opt, - adapter); + adapter); }else { adapter->tx_abs_int_delay = opt.def; }
@@ -426,7 +426,7 @@ void e1000_check_options(struct e1000_adapter *adapter)if (num_RxIntDelay > bd) { adapter->rx_int_delay = RxIntDelay[bd];e1000_validate_option (&adapter->rx_int_delay, &opt, - adapter); + adapter); }else { adapter->rx_int_delay = opt.def; }
@@ -444,7 +444,7 @@ void e1000_check_options(struct e1000_adapter *adapter)if (num_RxAbsIntDelay > bd) { adapter->rx_abs_int_delay = RxAbsIntDelay[bd];e1000_validate_option (&adapter->rx_abs_int_delay, &opt, - adapter); + adapter); }else { adapter->rx_abs_int_delay = opt.def; }
@@ -479,16 +479,17 @@ void e1000_check_options(struct e1000_adapter *adapter)break ;case 4 :e_dev_info ("%s set to simplified " -"(2000-8000) ints mode\n" , opt.name); +"(2000-8000) ints mode\n" , opt.name); adapter->itr_setting = adapter->itr;break ;default :e1000_validate_option (&adapter->itr, &opt, - adapter); + adapter);/* save the setting, because the dynamic bits * change itr. * clear the lower two bits because they are -* used as control */ +* used as control +*/ adapter->itr_setting = adapter->itr & ~3 ;break ; }
@@ -533,7 +534,6 @@ void e1000_check_options(struct e1000_adapter *adapter)* * Handles speed and duplex options on fiber adapters **/ -static void e1000_check_fiber_options (struct e1000_adapter *adapter) {int bd = adapter->bd_number;
@@ -559,7 +559,6 @@ static void e1000_check_fiber_options(struct e1000_adapter *adapter)* * Handles speed and duplex options on copper adapters **/ -static void e1000_check_copper_options (struct e1000_adapter *adapter) {struct e1000_option opt;
@@ -681,22 +680,22 @@ static void e1000_check_copper_options(struct e1000_adapter *adapter)e_dev_info ("Using Autonegotiation at Half Duplex only\n" ); adapter->hw.autoneg = adapter->fc_autoneg =1 ; adapter->hw.autoneg_advertised =ADVERTISE_10_HALF | -ADVERTISE_100_HALF ; +ADVERTISE_100_HALF ;break ;case FULL_DUPLEX :e_dev_info ("Full Duplex specified without Speed\n" );e_dev_info ("Using Autonegotiation at Full Duplex only\n" ); adapter->hw.autoneg = adapter->fc_autoneg =1 ; adapter->hw.autoneg_advertised =ADVERTISE_10_FULL | -ADVERTISE_100_FULL | -ADVERTISE_1000_FULL ; +ADVERTISE_100_FULL | +ADVERTISE_1000_FULL ;break ;case SPEED_10 :e_dev_info ("10 Mbps Speed specified without Duplex\n" );e_dev_info ("Using Autonegotiation at 10 Mbps only\n" ); adapter->hw.autoneg = adapter->fc_autoneg =1 ; adapter->hw.autoneg_advertised =ADVERTISE_10_HALF | -ADVERTISE_10_FULL ; +ADVERTISE_10_FULL ;break ;case SPEED_10 +HALF_DUPLEX :e_dev_info ("Forcing to 10 Mbps Half Duplex\n" );
@@ -715,7 +714,7 @@ static void e1000_check_copper_options(struct e1000_adapter *adapter)e_dev_info ("Using Autonegotiation at 100 Mbps only\n" ); adapter->hw.autoneg = adapter->fc_autoneg =1 ; adapter->hw.autoneg_advertised =ADVERTISE_100_HALF | -ADVERTISE_100_FULL ; +ADVERTISE_100_FULL ;break ;case SPEED_100 +HALF_DUPLEX :e_dev_info ("Forcing to 100 Mbps Half Duplex\n" );
Signature · 1 line
1.7.11.7
PATCH 2/15 e1000e: display a warning message when SmartSpeed works
In reply to Jeff KirsherFrom: Koki Sanagi <[email protected]>
Current e1000e driver doesn't tell nothing when Link Speed is downgraded due to SmartSpeed. As a result, users suspect that there is something wrong with NIC. If the cause of it is SmartSpeed, there is no means to replace NIC. This patch make e1000e notify users that SmartSpeed worked.
--- drivers/net/ethernet/intel/e1000e/netdev.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/net/ethernet/intel/e1000e/netdev.c +7 -0
@@ -4830,6 +4830,13 @@ static void e1000_watchdog_task(struct work_struct *work) &adapter->link_speed, &adapter->link_duplex);e1000_print_link_info (adapter); + +/* check if SmartSpeed worked */ +e1000e_check_downshift (hw); +if (phy->speed_downgraded) +netdev_warn (netdev, +"Link Speed was downgraded by SmartSpeed\n" ); +/* On supported PHYs, check for duplex mismatch only * if link has autonegotiated at 10/100 half */
Signature · 1 line
1.7.11.7
PATCH 3/15 igbvf: Make next_to_watch a pointer and adjust memory barriers to avoid races
In reply to Jeff KirsherFrom: Alexander Duyck <[email protected]>
This change is meant to address several race issues that become possible because next_to_watch could possibly be set to a value that shows that the descriptor is done when it is not. In order to correct that we instead make next_to_watch a pointer that is set to NULL during cleanup, and set to the eop_desc after the descriptor rings have been written.
To enforce proper ordering the next_to_watch pointer is not set until after a wmb writing the values to the last descriptor in a transmit. In order to guarantee that the descriptor is not read until after the eop_desc we use the read_barrier_depends which is only really necessary on the alpha architecture.
--- drivers/net/ethernet/intel/igbvf/igbvf.h | 2 +- drivers/net/ethernet/intel/igbvf/netdev.c | 52 ++++++++++++++++++------------- 2 files changed, 31 insertions(+), 23 deletions(-)
drivers/net/ethernet/intel/igbvf/igbvf.h +1 -1
@@ -127,8 +127,8 @@ struct igbvf_buffer {/* Tx */ struct {unsigned long time_stamp; +union e1000_adv_tx_desc *next_to_watch;u16 length; -u16 next_to_watch;u16 mapped_as_page; };/* Rx */
drivers/net/ethernet/intel/igbvf/netdev.c +30 -22
134 lines not on this page · raw message
Signature · 1 line
1.7.11.7
PATCH 4/15 igb: increase timeout for ethtool offline self-test
In reply to Jeff KirsherFrom: Stefan Assmann <[email protected]>
On several machines with i350 adapters the ethtool offline self-test sometimes fails. This happens because link auto negotiation may take longer than the timeout of 4 seconds. Increasing the timeout by 1 seconds resolves the issue.
Output from a failing i350 offline self-test:
while [ 1 ]; do ethtool -t eth2 offline; done
The test result is PASS
The test extra info:
Register test (offline) 0 Eeprom test (offline) 0 Interrupt test (offline) 0 Loopback test (offline) 0 Link test (on/offline) 0
The test result is FAIL
The test extra info:
Register test (offline) 0 Eeprom test (offline) 0 Interrupt test (offline) 0 Loopback test (offline) 0 Link test (on/offline) 1
The test result is PASS
The test extra info:
Register test (offline) 0 Eeprom test (offline) 0 Interrupt test (offline) 0 Loopback test (offline) 0 Link test (on/offline) 0
--- drivers/net/ethernet/intel/igb/igb_ethtool.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/intel/igb/igb_ethtool.c +1 -1
@@ -1891,7 +1891,7 @@ static int igb_link_test(struct igb_adapter *adapter, u64 *data) }else { hw->mac.ops.check_for_link (&adapter->hw);if (hw->mac.autoneg) -msleep (4000 ); +msleep (5000 );if (!(rd32 (E1000_STATUS ) &E1000_STATUS_LU )) *data =1 ;
Signature · 1 line
1.7.11.7
PATCH 5/15 ixgbe: Define FCoE and Flow director limits much sooner to allow for changes
In reply to Jeff KirsherFrom: Alexander Duyck <[email protected]>
Instead of adjusting the FCoE and Flow director limits based on the number of CPUs we can define them much sooner. This allows the user to come through later and adjust them once we have updated the code to support the set_channels ethtool operation.
I am still allowing for FCoE and RSS queues to be separated if the number queues is less than the number of CPUs. This essentially treats the two groupings like they are two separate traffic classes.
In addition I am changing the initialization to use the MAX_TX/RX_QUEUES defines instead of trying to compute the value as it will be possible in upcoming patches for the user to request the maximum number of queues.
I have also updated things so that the upper limit on queues is exactly 63 instead of allowing it to go up to 64. The reason for this change is to address the fact thqt the driver only supports up to 63 queue vectors since the hardware supports 64 MSI-X vectors, but one must be reserved for "other" causes.
--- drivers/net/ethernet/intel/ixgbe/ixgbe.h | 11 +++----- drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c | 7 +----- drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 36 +++++++++++---------------- 3 files changed, 19 insertions(+), 35 deletions(-)
drivers/net/ethernet/intel/ixgbe/ixgbe.h +3 -8
@@ -278,15 +278,10 @@ enum ixgbe_ring_f_enum {#define IXGBE_MAX_RSS_INDICES 16#define IXGBE_MAX_VMDQ_INDICES 64 -#define IXGBE_MAX_FDIR_INDICES 64 -#ifdef IXGBE_FCOE +#define IXGBE_MAX_FDIR_INDICES 63/* based on q_vector limit */ #define IXGBE_MAX_FCOE_INDICES 8 -#define MAX_RX_QUEUES (IXGBE_MAX_FDIR_INDICES + IXGBE_MAX_FCOE_INDICES) -#define MAX_TX_QUEUES (IXGBE_MAX_FDIR_INDICES + IXGBE_MAX_FCOE_INDICES) -#else -#define MAX_RX_QUEUES IXGBE_MAX_FDIR_INDICES -#define MAX_TX_QUEUES IXGBE_MAX_FDIR_INDICES -#endif /* IXGBE_FCOE */ +#define MAX_RX_QUEUES (IXGBE_MAX_FDIR_INDICES + 1) +#define MAX_TX_QUEUES (IXGBE_MAX_FDIR_INDICES + 1)struct ixgbe_ring_feature {u16 limit;/* upper limit on feature indices */ u16 indices;/* current value of indices */
drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c +1 -6
@@ -386,7 +386,6 @@ static bool ixgbe_set_dcb_sriov_queues(struct ixgbe_adapter *adapter) fcoe = &adapter->ring_feature[RING_F_FCOE ];/* limit ourselves based on feature limits */ - fcoe_i =min_t (u16, fcoe_i,num_online_cpus ()); fcoe_i =min_t (u16, fcoe_i, fcoe->limit);if (fcoe_i) {
@@ -562,9 +561,6 @@ static bool ixgbe_set_sriov_queues(struct ixgbe_adapter *adapter) fcoe_i =min_t (u16, fcoe_i, fcoe->limit);if (vmdq_i >1 && fcoe_i) { -/* reserve no more than number of CPUs */ - fcoe_i =min_t (u16, fcoe_i,num_online_cpus ()); -/* alloc queues for FCoE separately */ fcoe->indices = fcoe_i; fcoe->offset = vmdq_i * rss_i;
@@ -623,8 +619,7 @@ static bool ixgbe_set_rss_queues(struct ixgbe_adapter *adapter)if (rss_i >1 && adapter->atr_sample_rate) { f = &adapter->ring_feature[RING_F_FDIR ]; - f->indices =min_t (u16,num_online_cpus (), f->limit); - rss_i =max_t (u16, rss_i, f->indices); + rss_i = f->indices = f->limit;if (!(adapter->flags &IXGBE_FLAG_FDIR_PERFECT_CAPABLE )) adapter->flags |=IXGBE_FLAG_FDIR_HASH_CAPABLE ;
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +15 -21
@@ -4465,7 +4465,7 @@ static int ixgbe_sw_init(struct ixgbe_adapter *adapter) {struct ixgbe_hw *hw = &adapter->hw;struct pci_dev *pdev = adapter->pdev; -unsigned int rss; +unsigned int rss, fdir;u32 fwsm;#ifdef CONFIG_IXGBE_DCB int j;
@@ -4485,9 +4485,10 @@ static int ixgbe_sw_init(struct ixgbe_adapter *adapter) adapter->ring_feature[RING_F_RSS ].limit = rss; adapter->flags2 |=IXGBE_FLAG2_RSC_CAPABLE ; adapter->flags2 |=IXGBE_FLAG2_RSC_ENABLED ; - adapter->ring_feature[RING_F_FDIR ].limit =IXGBE_MAX_FDIR_INDICES ; adapter->max_q_vectors =MAX_Q_VECTORS_82599 ; adapter->atr_sample_rate =20 ; + fdir =min_t (int,IXGBE_MAX_FDIR_INDICES ,num_online_cpus ()); + adapter->ring_feature[RING_F_FDIR ].limit = fdir; adapter->fdir_pballoc =IXGBE_FDIR_PBALLOC_64K ;#ifdef CONFIG_IXGBE_DCA adapter->flags |=IXGBE_FLAG_DCA_CAPABLE ;
@@ -7230,9 +7231,8 @@ static int ixgbe_probe(struct pci_dev *pdev, const struct pci_device_id *ent)const struct ixgbe_info *ii = ixgbe_info_tbl[ent->driver_data];static int cards_found;int i, err, pci_using_dac; +unsigned int indices =MAX_TX_QUEUES ;u8 part_str[IXGBE_PBANUM_LENGTH ]; -unsigned int indices =num_possible_cpus (); -unsigned int dcb_max =0 ;#ifdef IXGBE_FCOE u16 device_caps;#endif
@@ -7281,25 +7281,15 @@ static int ixgbe_probe(struct pci_dev *pdev, const struct pci_device_id *ent)pci_set_master (pdev);pci_save_state (pdev); +if (ii->mac == ixgbe_mac_82598EB) {#ifdef CONFIG_IXGBE_DCB -if (ii->mac == ixgbe_mac_82598EB) - dcb_max = min_t(unsigned int, indices * MAX_TRAFFIC_CLASS, -IXGBE_MAX_RSS_INDICES ); -else - dcb_max = min_t(unsigned int, indices * MAX_TRAFFIC_CLASS, -IXGBE_MAX_FDIR_INDICES ); +/* 8 TC w/ 4 queues per TC */ + indices =4 *MAX_TRAFFIC_CLASS ; +#else + indices =IXGBE_MAX_RSS_INDICES ;#endif + } -if (ii->mac == ixgbe_mac_82598EB) - indices = min_t(unsigned int, indices, IXGBE_MAX_RSS_INDICES); -else - indices = min_t(unsigned int, indices, IXGBE_MAX_FDIR_INDICES); - -#ifdef IXGBE_FCOE - indices += min_t(unsigned int, num_possible_cpus(), -IXGBE_MAX_FCOE_INDICES ); -#endif - indices = max_t(unsigned int, dcb_max, indices); netdev =alloc_etherdev_mq (sizeof (struct ixgbe_adapter ), indices);if (!netdev) { err = -ENOMEM ;
@@ -7454,13 +7444,17 @@ skip_sriov:#ifdef IXGBE_FCOE if (adapter->flags &IXGBE_FLAG_FCOE_CAPABLE ) { +unsigned int fcoe_l; +if (hw->mac.ops.get_device_caps) { hw->mac.ops.get_device_caps (hw, &device_caps);if (device_caps &IXGBE_DEVICE_CAPS_FCOE_OFFLOADS ) adapter->flags &= ~IXGBE_FLAG_FCOE_CAPABLE ; } - adapter->ring_feature[RING_F_FCOE ].limit =IXGBE_FCRETA_SIZE ; + + fcoe_l =min_t (int,IXGBE_FCRETA_SIZE ,num_online_cpus ()); + adapter->ring_feature[RING_F_FCOE ].limit = fcoe_l; netdev->features |=NETIF_F_FSO |NETIF_F_FCOE_CRC ;
Signature · 1 line
1.7.11.7
PATCH 6/15 ixgbe: Add function for setting XPS queue mapping
In reply to Jeff KirsherFrom: Alexander Duyck <[email protected]>
This change adds support for ixgbe to configure the XPS queue mapping on load. The result of this change is that on open we will now be resetting the number of Tx queues, and then setting the default configuration for XPS based on if ATR is enabled or disabled.
--- drivers/net/ethernet/intel/ixgbe/ixgbe.h | 1 + drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c | 14 +++++++++----- drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 10 ++++++++++ 3 files changed, 20 insertions(+), 5 deletions(-)
drivers/net/ethernet/intel/ixgbe/ixgbe.h +1 -0
@@ -201,6 +201,7 @@ struct ixgbe_rx_queue_stats {enum ixgbe_ring_state_t { __IXGBE_TX_FDIR_INIT_DONE, + __IXGBE_TX_XPS_INIT_DONE, __IXGBE_TX_DETECT_HANG, __IXGBE_HANG_CHECK_ARMED, __IXGBE_RX_RSC_ENABLED,
drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c +9 -5
@@ -771,19 +771,23 @@ static int ixgbe_alloc_q_vector(struct ixgbe_adapter *adapter, {struct ixgbe_q_vector *q_vector;struct ixgbe_ring *ring; -int node =-1 ; +int node =NUMA_NO_NODE ;int cpu =-1 ;int ring_count, size; +u8 tcs =netdev_get_num_tc (adapter->netdev); ring_count = txr_count + rxr_count; size =sizeof (struct ixgbe_q_vector ) + (sizeof (struct ixgbe_ring ) * ring_count);/* customize cpu for Flow Director mapping */ -if (adapter->flags &IXGBE_FLAG_FDIR_HASH_CAPABLE ) { -if (cpu_online (v_idx)) { - cpu = v_idx; - node =cpu_to_node (cpu); +if ((tcs <=1 ) && !(adapter->flags &IXGBE_FLAG_SRIOV_ENABLED )) { +u16 rss_i = adapter->ring_feature[RING_F_RSS ].indices; +if (rss_i >1 && adapter->atr_sample_rate) { +if (cpu_online (v_idx)) { + cpu = v_idx; + node =cpu_to_node (cpu); + } } }
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +10 -0
@@ -2813,6 +2813,16 @@ void ixgbe_configure_tx_ring(struct ixgbe_adapter *adapter, ring->atr_sample_rate =0 ; } +/* initialize XPS */ +if (!test_and_set_bit (__IXGBE_TX_XPS_INIT_DONE, &ring->state)) { +struct ixgbe_q_vector *q_vector = ring->q_vector; + +if (q_vector) +netif_set_xps_queue (adapter->netdev, + &q_vector->affinity_mask, + ring->queue_index); + } +clear_bit (__IXGBE_HANG_CHECK_ARMED, &ring->state);/* enable queue */
Signature · 1 line
1.7.11.7
PATCH 7/15 ixgbe: Update ixgbe driver to use __netdev_pick_tx in ixgbe_select_queue
In reply to Jeff KirsherFrom: Alexander Duyck <[email protected]>
This change updates the ixgbe driver to use __netdev_pick_tx instead of the current logic it is using to select a queue. The main result of this change is that ixgbe can now fully support XPS, and in the case of non-FCoE enabled configs it means we don't need to have our own ndo_select_queue.
--- drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 48 +++++++++++++++------------ 1 file changed, 26 insertions(+), 22 deletions(-)
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +26 -22
@@ -6374,38 +6374,40 @@ static inline int ixgbe_maybe_stop_tx(struct ixgbe_ring *tx_ring, u16 size)return __ixgbe_maybe_stop_tx (tx_ring, size); } +#ifdef IXGBE_FCOE static u16 ixgbe_select_queue (struct net_device *dev,struct sk_buff *skb) { -struct ixgbe_adapter *adapter =netdev_priv (dev); -int txq =skb_rx_queue_recorded (skb) ?skb_get_rx_queue (skb) : -smp_processor_id (); -#ifdef IXGBE_FCOE -__be16 protocol =vlan_get_protocol (skb); +struct ixgbe_adapter *adapter; +struct ixgbe_ring_feature *f; +int txq; -if (((protocol ==htons (ETH_P_FCOE )) || - (protocol ==htons (ETH_P_FIP ))) && - (adapter->flags &IXGBE_FLAG_FCOE_ENABLED )) { -struct ixgbe_ring_feature *f; +/* +* only execute the code below if protocol is FCoE +* or FIP and we have FCoE enabled on the adapter +*/ +switch (vlan_get_protocol (skb)) { +case __constant_htons (ETH_P_FCOE ): +case __constant_htons (ETH_P_FIP ): + adapter =netdev_priv (dev); - f = &adapter->ring_feature[RING_F_FCOE ]; +if (adapter->flags &IXGBE_FLAG_FCOE_ENABLED ) +break ; +default : +return __netdev_pick_tx (dev, skb); + } -while (txq >= f->indices) - txq -= f->indices; - txq += adapter->ring_feature[RING_F_FCOE ].offset; + f = &adapter->ring_feature[RING_F_FCOE ]; -return txq; - } -#endif + txq =skb_rx_queue_recorded (skb) ?skb_get_rx_queue (skb) : +smp_processor_id (); -if (adapter->flags &IXGBE_FLAG_FDIR_HASH_CAPABLE ) { -while (unlikely (txq >= dev->real_num_tx_queues)) - txq -= dev->real_num_tx_queues; -return txq; - } +while (txq >= f->indices) + txq -= f->indices; -return skb_tx_hash (dev, skb); +return txq + f->offset; } +#endif netdev_tx_t ixgbe_xmit_frame_ring (struct sk_buff *skb,struct ixgbe_adapter *adapter,struct ixgbe_ring *tx_ring)
@@ -7129,7 +7131,9 @@ static const struct net_device_ops ixgbe_netdev_ops = { .ndo_open = ixgbe_open, .ndo_stop = ixgbe_close, .ndo_start_xmit = ixgbe_xmit_frame, +#ifdef IXGBE_FCOE .ndo_select_queue = ixgbe_select_queue, +#endif .ndo_set_rx_mode = ixgbe_set_rx_mode, .ndo_validate_addr = eth_validate_addr, .ndo_set_mac_address = ixgbe_set_mac,
Signature · 1 line
1.7.11.7
PATCH 8/15 ixgbe: Make ixgbe_setup_tc usable even when DCB is not enabled
In reply to Jeff KirsherFrom: Alexander Duyck <[email protected]>
The ixgbe_setup_tc code is essentially the same code we need any time we have to update the number of queues. As such I am making it available always and just stripping the DCB specific bits out when DCB is disabled instead of stripping the entire function.
--- drivers/net/ethernet/intel/ixgbe/ixgbe.h | 2 +- drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 19 +++++++------------ 2 files changed, 8 insertions(+), 13 deletions(-)
drivers/net/ethernet/intel/ixgbe/ixgbe.h +1 -1
@@ -700,8 +700,8 @@ extern bool ixgbe_verify_lesm_fw_enabled_82599(struct ixgbe_hw *hw);extern void ixgbe_set_rx_mode (struct net_device *netdev);#ifdef CONFIG_IXGBE_DCB extern void ixgbe_set_rx_drop_en (struct ixgbe_adapter *adapter); -extern int ixgbe_setup_tc (struct net_device *dev,u8 tc);#endif +extern int ixgbe_setup_tc (struct net_device *dev,u8 tc);extern void ixgbe_tx_ctxtdesc (struct ixgbe_ring *,u32 ,u32 ,u32 ,u32 );extern void ixgbe_do_reset (struct net_device *netdev);#ifdef CONFIG_IXGBE_HWMON
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +7 -12
@@ -6812,6 +6812,7 @@ static void ixgbe_set_prio_tc_map(struct ixgbe_adapter *adapter) } } +#endif /* CONFIG_IXGBE_DCB */ /** * ixgbe_setup_tc - configure net_device for multiple traffic classes *
@@ -6837,6 +6838,7 @@ int ixgbe_setup_tc(struct net_device *dev, u8 tc)ixgbe_close (dev);ixgbe_clear_interrupt_scheme (adapter); +#ifdef CONFIG_IXGBE_DCB if (tc) {netdev_set_num_tc (dev, tc);ixgbe_set_prio_tc_map (adapter);
@@ -6859,31 +6861,24 @@ int ixgbe_setup_tc(struct net_device *dev, u8 tc) adapter->dcb_cfg.pfc_mode_enable = false; } -ixgbe_init_interrupt_scheme (adapter);ixgbe_validate_rtr (adapter, tc); + +#endif /* CONFIG_IXGBE_DCB */ +ixgbe_init_interrupt_scheme (adapter); +if (netif_running (dev)) -ixgbe_open (dev); +return ixgbe_open (dev);return 0 ; } -#endif /* CONFIG_IXGBE_DCB */ #ifdef CONFIG_PCI_IOV void ixgbe_sriov_reinit (struct ixgbe_adapter *adapter) {struct net_device *netdev = adapter->netdev;rtnl_lock (); -#ifdef CONFIG_IXGBE_DCB ixgbe_setup_tc (netdev,netdev_get_num_tc (netdev)); -#else -if (netif_running (netdev)) -ixgbe_close (netdev); -ixgbe_clear_interrupt_scheme (adapter); -ixgbe_init_interrupt_scheme (adapter); -if (netif_running (netdev)) -ixgbe_open (netdev); -#endif rtnl_unlock (); }
Signature · 1 line
1.7.11.7
PATCH 9/15 ixgbe: Add support for displaying the number of Tx/Rx channels
In reply to Jeff KirsherFrom: Alexander Duyck <[email protected]>
This patch adds support for the ethtool get_channels operation.
Since the ixgbe driver has to support DCB as well as the other modes the assumption I made here is that the number of channels in DCB modes refers to the number of queues per traffic class, not the number of queues total.
--- drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c | 72 ++++++++++++++++++++++++ 1 file changed, 72 insertions(+)
drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c +72 -0
@@ -2731,6 +2731,77 @@ static int ixgbe_get_ts_info(struct net_device *dev,return 0 ; } +static unsigned int ixgbe_max_channels (struct ixgbe_adapter *adapter) +{ +unsigned int max_combined; +u8 tcs =netdev_get_num_tc (adapter->netdev); + +if (!(adapter->flags &IXGBE_FLAG_MSIX_ENABLED )) { +/* We only support one q_vector without MSI-X */ + max_combined =1 ; + }else if (adapter->flags &IXGBE_FLAG_SRIOV_ENABLED ) { +/* SR-IOV currently only allows one queue on the PF */ + max_combined =1 ; + }else if (tcs >1 ) { +/* For DCB report channels per traffic class */ +if (adapter->hw.mac.type == ixgbe_mac_82598EB) { +/* 8 TC w/ 4 queues per TC */ + max_combined =4 ; + }else if (tcs >4 ) { +/* 8 TC w/ 8 queues per TC */ + max_combined =8 ; + }else { +/* 4 TC w/ 16 queues per TC */ + max_combined =16 ; + } + }else if (adapter->atr_sample_rate) { +/* support up to 64 queues with ATR */ + max_combined =IXGBE_MAX_FDIR_INDICES ; + }else { +/* support up to 16 queues with RSS */ + max_combined =IXGBE_MAX_RSS_INDICES ; + } + +return max_combined; +} + +static void ixgbe_get_channels (struct net_device *dev, +struct ethtool_channels *ch) +{ +struct ixgbe_adapter *adapter =netdev_priv (dev); + +/* report maximum channels */ + ch->max_combined =ixgbe_max_channels (adapter); + +/* report info for other vector */ +if (adapter->flags &IXGBE_FLAG_MSIX_ENABLED ) { + ch->max_other =NON_Q_VECTORS ; + ch->other_count =NON_Q_VECTORS ; + } + +/* record RSS queues */ + ch->combined_count = adapter->ring_feature[RING_F_RSS ].indices; + +/* nothing else to report if RSS is disabled */ +if (ch->combined_count ==1 ) +return ; + +/* we do not support ATR queueing if SR-IOV is enabled */ +if (adapter->flags &IXGBE_FLAG_SRIOV_ENABLED ) +return ; + +/* same thing goes for being DCB enabled */ +if (netdev_get_num_tc (dev) >1 ) +return ; + +/* if ATR is disabled we can exit */ +if (!adapter->atr_sample_rate) +return ; + +/* report flow director queues as maximum channels */ + ch->combined_count = adapter->ring_feature[RING_F_FDIR ].indices; +} +static const struct ethtool_ops ixgbe_ethtool_ops = { .get_settings = ixgbe_get_settings, .set_settings = ixgbe_set_settings,
@@ -2759,6 +2830,7 @@ static const struct ethtool_ops ixgbe_ethtool_ops = { .set_coalesce = ixgbe_set_coalesce, .get_rxnfc = ixgbe_get_rxnfc, .set_rxnfc = ixgbe_set_rxnfc, + .get_channels = ixgbe_get_channels, .get_ts_info = ixgbe_get_ts_info, };
Signature · 1 line
1.7.11.7
PATCH 10/15 ixgbe: Add support for set_channels ethtool operation
In reply to Jeff KirsherFrom: Alexander Duyck <[email protected]>
This change adds support for the ethtool set_channels operation.
Since the ixgbe driver has to support DCB as well as the other modes the assumption I made here is that the number of channels in DCB modes refers to the number of queues per traffic class, not the number of queues total.
--- drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c | 38 ++++++++++++++++++++++++ 1 file changed, 38 insertions(+)
drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c +38 -0
@@ -2802,6 +2802,43 @@ static void ixgbe_get_channels(struct net_device *dev, ch->combined_count = adapter->ring_feature[RING_F_FDIR ].indices; } +static int ixgbe_set_channels (struct net_device *dev, +struct ethtool_channels *ch) +{ +struct ixgbe_adapter *adapter =netdev_priv (dev); +unsigned int count = ch->combined_count; + +/* verify they are not requesting separate vectors */ +if (!count || ch->rx_count || ch->tx_count) +return -EINVAL ; + +/* verify other_count has not changed */ +if (ch->other_count !=NON_Q_VECTORS ) +return -EINVAL ; + +/* verify the number of channels does not exceed hardware limits */ +if (count >ixgbe_max_channels (adapter)) +return -EINVAL ; + +/* update feature limits from largest to smallest supported values */ + adapter->ring_feature[RING_F_FDIR ].limit = count; + +/* cap RSS limit at 16 */ +if (count >IXGBE_MAX_RSS_INDICES ) + count =IXGBE_MAX_RSS_INDICES ; + adapter->ring_feature[RING_F_RSS ].limit = count; + +#ifdef IXGBE_FCOE +/* cap FCoE limit at 8 */ +if (count >IXGBE_FCRETA_SIZE ) + count =IXGBE_FCRETA_SIZE ; + adapter->ring_feature[RING_F_FCOE ].limit = count; + +#endif +/* use setup TC to update any traffic class queue mapping */ +return ixgbe_setup_tc (dev,netdev_get_num_tc (dev)); +} +static const struct ethtool_ops ixgbe_ethtool_ops = { .get_settings = ixgbe_get_settings, .set_settings = ixgbe_set_settings,
@@ -2831,6 +2868,7 @@ static const struct ethtool_ops ixgbe_ethtool_ops = { .get_rxnfc = ixgbe_get_rxnfc, .set_rxnfc = ixgbe_set_rxnfc, .get_channels = ixgbe_get_channels, + .set_channels = ixgbe_set_channels, .get_ts_info = ixgbe_get_ts_info, };
Signature · 1 line
1.7.11.7
PATCH 11/15 ixgbe: fix possible data corruption in read_i2c_byte
In reply to Jeff KirsherFrom: Emil Tantilov <[email protected]>
This patch makes sure that the SW lock is released after all i2c operations complete in the retry code path.
--- drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c +1 -1
@@ -1307,9 +1307,9 @@ s32 ixgbe_read_i2c_byte_generic(struct ixgbe_hw *hw, u8 byte_offset,break ; fail: +ixgbe_i2c_bus_clear (hw); hw->mac.ops.release_swfw_sync (hw, swfw_mask);msleep (100 ); -ixgbe_i2c_bus_clear (hw); retry++;if (retry < max_retry)hw_dbg (hw,"I2C byte read error - Retrying.\n" );
Signature · 1 line
1.7.11.7
PATCH 12/15 ixgbe: cleanup error checking in ixgbe_identify_sfp_module_generic()
In reply to Jeff KirsherFrom: Emil Tantilov <[email protected]>
This patch replaces instances where a return code from i2c operations were checked against a list of error codes with a much simpler if ( status != 0 ) check.
Some whitespace cleanups included.
--- drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c | 34 ++++++++-------------------- 1 file changed, 10 insertions(+), 24 deletions(-)
drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c +10 -24
@@ -852,11 +852,9 @@ s32 ixgbe_identify_sfp_module_generic(struct ixgbe_hw *hw) status = hw->phy.ops.read_i2c_eeprom (hw,IXGBE_SFF_IDENTIFIER , - &identifier); + &identifier); -if (status ==IXGBE_ERR_SWFW_SYNC || - status ==IXGBE_ERR_I2C || - status ==IXGBE_ERR_SFP_NOT_PRESENT ) +if (status !=0 ) goto err_read_i2c_eeprom;/* LAN ID is needed for sfp_type determination */
@@ -870,26 +868,20 @@ s32 ixgbe_identify_sfp_module_generic(struct ixgbe_hw *hw)IXGBE_SFF_1GBE_COMP_CODES , &comp_codes_1g); -if (status ==IXGBE_ERR_SWFW_SYNC || - status ==IXGBE_ERR_I2C || - status ==IXGBE_ERR_SFP_NOT_PRESENT ) +if (status !=0 ) goto err_read_i2c_eeprom; status = hw->phy.ops.read_i2c_eeprom (hw,IXGBE_SFF_10GBE_COMP_CODES , &comp_codes_10g); -if (status ==IXGBE_ERR_SWFW_SYNC || - status ==IXGBE_ERR_I2C || - status ==IXGBE_ERR_SFP_NOT_PRESENT ) +if (status !=0 ) goto err_read_i2c_eeprom; status = hw->phy.ops.read_i2c_eeprom (hw,IXGBE_SFF_CABLE_TECHNOLOGY , &cable_tech); -if (status ==IXGBE_ERR_SWFW_SYNC || - status ==IXGBE_ERR_I2C || - status ==IXGBE_ERR_SFP_NOT_PRESENT ) +if (status !=0 ) goto err_read_i2c_eeprom;/* ID Module
@@ -984,30 +976,24 @@ s32 ixgbe_identify_sfp_module_generic(struct ixgbe_hw *hw)if (hw->phy.type != ixgbe_phy_nl) { hw->phy.id = identifier; status = hw->phy.ops.read_i2c_eeprom (hw, -IXGBE_SFF_VENDOR_OUI_BYTE0 , - &oui_bytes[0 ]); +IXGBE_SFF_VENDOR_OUI_BYTE0 , + &oui_bytes[0 ]); -if (status ==IXGBE_ERR_SWFW_SYNC || - status ==IXGBE_ERR_I2C || - status ==IXGBE_ERR_SFP_NOT_PRESENT ) +if (status !=0 ) goto err_read_i2c_eeprom; status = hw->phy.ops.read_i2c_eeprom (hw,IXGBE_SFF_VENDOR_OUI_BYTE1 , &oui_bytes[1 ]); -if (status ==IXGBE_ERR_SWFW_SYNC || - status ==IXGBE_ERR_I2C || - status ==IXGBE_ERR_SFP_NOT_PRESENT ) +if (status !=0 ) goto err_read_i2c_eeprom; status = hw->phy.ops.read_i2c_eeprom (hw,IXGBE_SFF_VENDOR_OUI_BYTE2 , &oui_bytes[2 ]); -if (status ==IXGBE_ERR_SWFW_SYNC || - status ==IXGBE_ERR_I2C || - status ==IXGBE_ERR_SFP_NOT_PRESENT ) +if (status !=0 ) goto err_read_i2c_eeprom; vendor_oui =
Signature · 1 line
1.7.11.7
PATCH 13/15 ixgbe: implement SFF diagnostic monitoring via ethtool
In reply to Jeff KirsherFrom: Aurélien Guillaume <[email protected]>
This patch adds support for reading data from SFP+ modules over i2c.
--- drivers/net/ethernet/intel/ixgbe/ixgbe.h | 1 + drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c | 114 +++++++++++++++++++++++ drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 4 + 3 files changed, 119 insertions(+)
drivers/net/ethernet/intel/ixgbe/ixgbe.h +1 -0
@@ -620,6 +620,7 @@ enum ixgbe_state_t { __IXGBE_DOWN, __IXGBE_SERVICE_SCHED, __IXGBE_IN_SFP_INIT, + __IXGBE_READ_I2C, }; struct ixgbe_cb {
drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c +114 -0
132 lines not on this page · raw message
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +4 -0
@@ -5709,6 +5709,10 @@ static void ixgbe_sfp_detection_subtask(struct ixgbe_adapter *adapter) !(adapter->flags2 & IXGBE_FLAG2_SFP_NEEDS_RESET)) return; +/* concurent i2c reads are not supported */ +if (test_bit (__IXGBE_READ_I2C, &adapter->state)) +return ; +/* someone else is in init, wait until next service event */ if (test_and_set_bit (__IXGBE_IN_SFP_INIT, &adapter->state))return ;
Signature · 1 line
1.7.11.7
Re: [net-next 13/15] ixgbe: implement SFF diagnostic monitoring via ethtool
2013/2/16 Jeff Kirsher <[email protected]>:
Quoted 48 lines
From: Aurélien Guillaume <[email protected]>
This patch adds support for reading data from SFP+ modules over i2c.
Signed-off-by Aurélien Guillaume <[email protected]>Signed-off-by Emil Tantilov <[email protected]>Tested-by Phil Schmitt <[email protected]>Signed-off-by Jeff Kirsher <[email protected]>--- drivers/net/ethernet/intel/ixgbe/ixgbe.h | 1 + drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c | 114 +++++++++++++++++++++++ drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 4 + 3 files changed, 119 insertions(+)drivers/net/ethernet/intel/ixgbe/ixgbe.h +1
-0@@ -620,6 +620,7 @@ enum ixgbe_state_t { __IXGBE_DOWN, __IXGBE_SERVICE_SCHED, __IXGBE_IN_SFP_INIT, + __IXGBE_READ_I2C, }; struct ixgbe_cb {drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c +7
-0@@ -39,6 +39,7 @@#include <linux/uaccess.h> #include "ixgbe.h" +#include "ixgbe_phy.h" #define IXGBE_ALL_RAR_ENTRIES 16@@ -2839,6 +2840,117 @@ static int ixgbe_set_channels(struct net_device *dev,return ixgbe_setup_tc (dev,netdev_get_num_tc (dev)); } +static int ixgbe_get_module_info (struct net_device *dev, +struct ethtool_modinfo *modinfo) +{ +struct ixgbe_adapter *adapter =netdev_priv (dev); +struct ixgbe_hw *hw = &adapter->hw; +u32 status;
drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c static int ixgbe_set_channels(struct net_device *dev, · line 2858
Quoted 10 lines
drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c +10
-0+u8 sff8472_rev, addr_mode; +int ret_val =0 ; +bool page_swap = false; + +/* avoid concurent i2c reads */ +while (test_bit (__IXGBE_IN_SFP_INIT, &adapter->state)) +msleep (100 ); + +/* used by the service task */ +set_bit (__IXGBE_READ_I2C, &adapter->state);
This is racy. Why do you need another bit?
while (test_and_set_bit(__IXGBE_IN_SFP_INIT, &adapter->state))
msleep(100);
...
clear_bit(__IXGBE_IN_SFP_INIT, &adapter->state)
Best Regards,
Michał Mirosław
RE: [net-next 13/15] ixgbe: implement SFF diagnostic monitoring via ethtool
Quoted 66 lines
-----Original Message-----
From: Michał Mirosław [mailto:[email protected]]
Sent: Saturday, February 16, 2013 2:54 AM
To: Kirsher, Jeffrey T
Cc: [email protected]; Aurélien Guillaume; [email protected]; [email protected]; [email protected]; Tantilov, Emil S
Subject: Re: [net-next 13/15] ixgbe: implement SFF diagnostic monitoring via ethtool2013/2/16 Jeff Kirsher <[email protected]>:
Quoted 11 lines
From: Aurélien Guillaume <[email protected]>
This patch adds support for reading data from SFP+ modules over i2c.
Signed-off-by Aurélien Guillaume <[email protected]>Signed-off-by Emil Tantilov <[email protected]>Tested-by Phil Schmitt <[email protected]>Signed-off-by Jeff Kirsher <[email protected]>--- drivers/net/ethernet/intel/ixgbe/ixgbe.h | 1 + drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c | 114+++++++++++++++++++++++
Review
Quoted 4 lines
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 4 + 3 files changed, 119 insertions(+)(quoted diff) +0
-0
b/drivers/net/ethernet/intel/ixgbe/ixgbe.hReview
Quoted 12 lines
index b91f9b6..196002b 100644
drivers/net/ethernet/intel/ixgbe/ixgbe.h +1
-0@@ -620,6 +620,7 @@ enum ixgbe_state_t { __IXGBE_DOWN, __IXGBE_SERVICE_SCHED, __IXGBE_IN_SFP_INIT, + __IXGBE_READ_I2C, }; struct ixgbe_cb {(quoted diff) +0
-0
b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.cdrivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c static int ixgbe_set_channels(struct net_device
Quoted 12 lines
index 7349a8b..e6cebdc 100644
drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c +1
-0@@ -39,6 +39,7 @@#include <linux/uaccess.h> #include "ixgbe.h" +#include "ixgbe_phy.h" #define IXGBE_ALL_RAR_ENTRIES 16@@ -2839,6 +2840,117 @@ static int ixgbe_set_channels(struct net_device*dev,
Quoted 13 lines
drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c +10
-0return ixgbe_setup_tc (dev,netdev_get_num_tc (dev)); } +static int ixgbe_get_module_info (struct net_device *dev, +struct ethtool_modinfo *modinfo) +{ +struct ixgbe_adapter *adapter =netdev_priv (dev); +struct ixgbe_hw *hw = &adapter->hw; +u32 status; +u8 sff8472_rev, addr_mode; +int ret_val =0 ; +bool page_swap = false; +
Quoted 8 lines
drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c static int ixgbe_set_channels(struct net_device *dev, · line 2858
Quoted 6 lines
drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c +6
-0+/* avoid concurent i2c reads */ +while (test_bit (__IXGBE_IN_SFP_INIT, &adapter->state)) +msleep (100 ); + +/* used by the service task */ +set_bit (__IXGBE_READ_I2C, &adapter->state);This is racy. Why do you need another bit?
The I2C bit helps to reduce the delay in the service task relative to the initialization of the SFP modules.
Quoted 5 lines
while (
test_and_set_bit(__IXGBE_IN_SFP_INIT, &adapter->state))msleep(100);...
clear_bit(__IXGBE_IN_SFP_INIT, &adapter->state)
This is what I had initially, but the i2c reads can take a long time on some parts and __IXGBE_IN_SFP_INIT protects portions of the code that have nothing to do with I2C reads. Setting __IXGBE_IN_SFP_INIT in ethtool while dumping the SFF data can introduce needlessly long delays in the SFP initialization path.
Thanks,
Emil
Quoted 2 lines
Best Regards,
Michał Mirosław
Re: [net-next 13/15] ixgbe: implement SFF diagnostic monitoring via ethtool
2013/2/17 Tantilov, Emil S <[email protected]>:
Quoted 27 lines
Quoted 15 lines
Review static int ixgbe_set_channels(struct net_device
Quoted 1 line
(quoted diff) +0
-0@@ -2839,6 +2840,117 @@ static int ixgbe_set_channels(struct net_device*dev,
Quoted 13 lines
drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c +10
-0return ixgbe_setup_tc (dev,netdev_get_num_tc (dev)); } +static int ixgbe_get_module_info (struct net_device *dev, +struct ethtool_modinfo *modinfo) +{ +struct ixgbe_adapter *adapter =netdev_priv (dev); +struct ixgbe_hw *hw = &adapter->hw; +u32 status; +u8 sff8472_rev, addr_mode; +int ret_val =0 ; +bool page_swap = false; +Quoted 8 lines
drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c static int ixgbe_set_channels(struct net_device *dev, · line 2858
Quoted 6 lines
drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c +6
-0+/* avoid concurent i2c reads */ +while (test_bit (__IXGBE_IN_SFP_INIT, &adapter->state)) +msleep (100 ); + +/* used by the service task */ +set_bit (__IXGBE_READ_I2C, &adapter->state);This is racy. Why do you need another bit?
The I2C bit helps to reduce the delay in the service task relative to the initialization of the SFP modules.
Quoted 1 line
Quoted 6 lines
Quoted 4 lines
while (
test_and_set_bit(__IXGBE_IN_SFP_INIT, &adapter->state))msleep(100);...
clear_bit(__IXGBE_IN_SFP_INIT, &adapter->state)This is what I had initially, but the i2c reads can take a long time on some parts and
__IXGBE_IN_SFP_INITprotects portions of the code that have nothing to do with I2C reads. Setting__IXGBE_IN_SFP_INITin ethtool while dumping the SFF data can introduce needlessly long delays in the SFP initialization path.
Maybe it would be enough to protect the body of read_i2c_eeprom() usign a mutex? It seems you want __IXGBE_READ_I2C to work like a mutex, but you test it in non-atomic way.
Best Regards,
Michał Mirosław
Re: [net-next 13/15] ixgbe: implement SFF diagnostic monitoring via ethtool
In reply to Jeff KirsherQuoted 3 lines · Jeff Kirsher
From: Aurélien Guillaume <[email protected]>
This patch adds support for reading data from SFP+ modules over i2c.
[...]
Quoted 2 lines
drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c +0
-0
[...]
Quoted 5 lines
drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c +5
-0+static int ixgbe_get_module_eeprom (struct net_device *dev, +struct ethtool_eeprom *ee, +u8 *data) +{ +struct ixgbe_adapter *adapter =netdev_priv (dev);
drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c static int ixgbe_set_channels(struct net_device *dev, · line 2912
Quoted 10 lines
drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c +10
-0+struct ixgbe_hw *hw = &adapter->hw; +u32 status =IXGBE_ERR_PHY_ADDR_INVALID ; +u8 databyte =0xFF ; +int i =0 ; +int ret_val =0 ; + +/* ixgbe_get_module_info is called before this function in all +* cases, so we do not need any checks we already do above, +* and can trust ee->len to be a known value. +*/
[...]
Whatever makes you think that?
All you are guaranteed is that:
ee->offset <= ee->offset + ee->len <= eeprom_len
Same as for the regular EEPROM read function.
This implementation doesn't result in a heap overrun at present because the caller allocates a whole page as a buffer. But you should not assume that it's safe to write more than ee->len bytes, nor that ee->offset == 0.
Ben.
Signature · 3 lines
Ben Hutchings, Staff Engineer, Solarflare Not speaking for my employer; that's the marketing department's job. They asked us to note that Solarflare product names are trademarked.
RE: [net-next 13/15] ixgbe: implement SFF diagnostic monitoring via ethtool
Quoted 38 lines
-----Original Message-----
From: Ben Hutchings [mailto:[email protected]]
Sent: Tuesday, February 19, 2013 2:14 PM
To: Kirsher, Jeffrey T; Aurélien Guillaume
Cc: [email protected]; [email protected]; [email protected]; [email protected]; Tantilov, Emil S
Subject: Re: [net-next 13/15] ixgbe: implement SFF diagnostic monitoring via ethtoolQuoted 3 lines · Jeff Kirsher
From: Aurélien Guillaume <[email protected]>
This patch adds support for reading data from SFP+ modules over i2c.
[...]
Quoted 2 lines
drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c +0
-0[...]
Quoted 5 lines
drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c +5
-0+static int ixgbe_get_module_eeprom (struct net_device *dev, +struct ethtool_eeprom *ee, +u8 *data) +{ +struct ixgbe_adapter *adapter =netdev_priv (dev);drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c static int ixgbe_set_channels(struct net_device *dev, · line 2912
Quoted 10 lines
drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c +10
-0+struct ixgbe_hw *hw = &adapter->hw; +u32 status =IXGBE_ERR_PHY_ADDR_INVALID ; +u8 databyte =0xFF ; +int i =0 ; +int ret_val =0 ; + +/* ixgbe_get_module_info is called before this function in all +* cases, so we do not need any checks we already do above, +* and can trust ee->len to be a known value. +*/ [...]
Whatever makes you think that?
All you are guaranteed is that:
ee->offset <= ee->offset + ee->len <= eeprom_len
Quoted 8 lines
Same as for the regular EEPROM read function.
This implementation doesn't result in a heap overrun at present because the caller allocates a whole page as a buffer. But you should not assume that it's safe to write more than
ee->lenbytes, nor thatee->offset== 0.Ben.
Thanks Ben, we'll address this in a follow up patch.
Emil
PATCH 14/15 ixgbe: fix Tx timeouts with BQL
In reply to Jeff KirsherFrom: Emil Tantilov <[email protected]>
This patch makes sure that TXDCTL.WTHRESH is set to 1 when BQL is enabled and EITR is set to more than 100k interrupts per second to avoid Tx timeouts.
--- drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c | 33 +++++++++++++++++++----- drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 8 +++++- 2 files changed, 34 insertions(+), 7 deletions(-)
drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c +27 -6
@@ -2113,13 +2113,17 @@ static int ixgbe_set_coalesce(struct net_device *netdev,struct ixgbe_adapter *adapter =netdev_priv (netdev);struct ixgbe_q_vector *q_vector;int i; -u16 tx_itr_param, rx_itr_param; +u16 tx_itr_param, rx_itr_param, tx_itr_prev;bool need_reset = false; -/* don't accept tx specific changes if we've got mixed RxTx vectors */ -if (adapter->q_vector[0 ]->tx.count && adapter->q_vector[0 ]->rx.count - && ec->tx_coalesce_usecs) -return -EINVAL ; +if (adapter->q_vector[0 ]->tx.count && adapter->q_vector[0 ]->rx.count) { +/* reject Tx specific changes in case of mixed RxTx vectors */ +if (ec->tx_coalesce_usecs) +return -EINVAL ; + tx_itr_prev = adapter->rx_itr_setting; + }else { + tx_itr_prev = adapter->tx_itr_setting; + }if ((ec->rx_coalesce_usecs > (IXGBE_MAX_EITR >>2 )) || (ec->tx_coalesce_usecs > (IXGBE_MAX_EITR >>2 )))
@@ -2145,8 +2149,25 @@ static int ixgbe_set_coalesce(struct net_device *netdev,else tx_itr_param = adapter->tx_itr_setting; +/* mixed Rx/Tx */ +if (adapter->q_vector[0 ]->tx.count && adapter->q_vector[0 ]->rx.count) + adapter->tx_itr_setting = adapter->rx_itr_setting; + +#if IS_ENABLED (CONFIG_BQL ) +/* detect ITR changes that require update of TXDCTL.WTHRESH */ +if ((adapter->tx_itr_setting >1 ) && + (adapter->tx_itr_setting <IXGBE_100K_ITR )) { +if ((tx_itr_prev ==1 ) || + (tx_itr_prev >IXGBE_100K_ITR )) + need_reset = true; + }else { +if ((tx_itr_prev >1 ) && + (tx_itr_prev <IXGBE_100K_ITR )) + need_reset = true; + } +#endif /* check the old value and enable RSC if necessary */ - need_reset =ixgbe_update_rsc (adapter); + need_reset |=ixgbe_update_rsc (adapter);for (i =0 ; i < adapter->num_q_vectors; i++) { q_vector = adapter->q_vector[i];
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +7 -1
@@ -2786,13 +2786,19 @@ void ixgbe_configure_tx_ring(struct ixgbe_adapter *adapter,/* * set WTHRESH to encourage burst writeback, it should not be set -* higher than 1 when ITR is 0 as it could cause false TX hangs +* higher than 1 when: +* - ITR is 0 as it could cause false TX hangs +* - ITR is set to > 100k int/sec and BQL is enabled * * In order to avoid issues WTHRESH + PTHRESH should always be equal * to or less than the number of on chip descriptors, which is * currently 40. */ +#if IS_ENABLED (CONFIG_BQL ) +if (!ring->q_vector || (ring->q_vector->itr <IXGBE_100K_ITR )) +#elseif (!ring->q_vector || (ring->q_vector->itr <8 )) +#endif txdctl |= (1 <<16 );/* WTHRESH = 1 */ else txdctl |= (8 <<16 );/* WTHRESH = 8 */
Signature · 1 line
1.7.11.7
PATCH 15/15 ixgbe: Update DESC_NEEDED define to adjust for changes to MAX_SKB_FRAGS
In reply to Jeff KirsherFrom: Alexander Duyck <[email protected]>
Recent changes have made it so that MAX_SKB_FRAGS is now never less than 16. As a result we were seeing issues on systems with 64K pages as it would cause DESC_NEEDED to increase to 68, and we would need over 136 descriptors free before clean_tx_irq would wake the queue.
This patch makes it so that DESC_NEEDED is always MAX_SKB_FRAGS + 4. This should prevent any possible deadlocks on the systems with 64K pages as we will now only require 42 descriptors to wake.
--- drivers/net/ethernet/intel/ixgbe/ixgbe.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/intel/ixgbe/ixgbe.h +1 -1
@@ -156,7 +156,7 @@ struct vf_macvlans {/* Tx Descriptors needed, worst case */ #define TXD_USE_COUNT (S ) DIV_ROUND_UP((S), IXGBE_MAX_DATA_PER_TXD) -#define DESC_NEEDED ((MAX_SKB_FRAGS * TXD_USE_COUNT(PAGE_SIZE)) + 4) +#define DESC_NEEDED (MAX_SKB_FRAGS + 4)/* wrapper around a pointer to a socket buffer, * so a DMA handle can be stored along with the buffer */
Signature · 1 line
1.7.11.7
David Miller
maintainerFrom: Jeff Kirsher <[email protected]>
Date: Sat, 16 Feb 2013 00:33:21 -0800
Quoted 3 lines
This series contains updates to e1000, e1000e, igb, igbvf and ixgbe. The e1000, e1000e, igb and igbvf are single patch changes and the remaining 11 patches are all against ixgbe.
...
Quoted 1 line
git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/net-nextmaster
Pulled.
I trust that Emil will work out the I2C mutex locking issues being discussed with Michał Mirosław wrt. patch #13.
Thanks.
Quoted 16 lines
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of David Miller
Sent: Monday, February 18, 2013 9:37 AM
To: Kirsher, Jeffrey T
Cc: [email protected]; [email protected]; [email protected]
Subject: Re: [net-next 00/15][pull request] Intel Wired LAN Driver Updates 2013.02.16From: Jeff Kirsher <[email protected]>
Date: Sat, 16 Feb 2013 00:33:21 -0800Quoted 3 lines
This series contains updates to e1000, e1000e, igb, igbvf and ixgbe. The e1000, e1000e, igb and igbvf are single patch changes and the remaining 11 patches are all against ixgbe.
...
Quoted 8 lines
Quoted 1 line
git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/net-nextmasterPulled.
I trust that Emil will work out the I2C mutex locking issues being discussed with Michał Mirosław wrt. patch #13.
Thanks.
Thanks Dave, I will work on improving the I2C locking for sure.
Emil