i40evf: assign num_active_queues inside i40evf_alloc_queues
Subsystems (2)
PATCH 1/13 i40evf: assign num_active_queues inside i40evf_alloc_queues
From: Jacob Keller <[email protected]>
The variable num_active_queues represents the number of active queues we have for the device. We assign this pretty early in i40evf_init_subtask.
Several code locations are written with loops over the tx_rings and rx_rings structures, which don't get allocated until i40evf_alloc_queues, and which get freed by i40evf_free_queues.
These call sites were written under the assumption that tx_rings and rx_rings would always be allocated at least when num_active_queues is non-zero.
Lets fix this by moving the assignment into the function where we allocate queues. We'll use a temporary variable for storage so that we don't assign the value in the adapter structure until after the rings have been set up.
Finally, when we free the queues, we'll clear the value to ensure that we do not loop over the rings memory that no longer exists.
This resolves a possible NULL pointer derference in i40evf_get_ethtool_stats which could occur if the VF fails to recover from a reset, and then a user requests statistics.
--- drivers/net/ethernet/intel/i40evf/i40evf_main.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-)
drivers/net/ethernet/intel/i40evf/i40evf_main.c +11 -7
@@ -1198,6 +1198,7 @@ static void i40evf_free_queues(struct i40evf_adapter *adapter) {if (!adapter->vsi_res)return ; + adapter->num_active_queues =0 ;kfree (adapter->tx_rings); adapter->tx_rings =NULL ;kfree (adapter->rx_rings);
@@ -1214,18 +1215,22 @@ static void i40evf_free_queues(struct i40evf_adapter *adapter)**/ static int i40evf_alloc_queues (struct i40evf_adapter *adapter) { -int i; +int i, num_active_queues; + + num_active_queues =min_t (int, + adapter->vsi_res->num_queue_pairs, + (int )(num_online_cpus ())); - adapter->tx_rings =kcalloc (adapter->num_active_queues, + adapter->tx_rings =kcalloc (num_active_queues,sizeof (struct i40e_ring ),GFP_KERNEL );if (!adapter->tx_rings) goto err_out; - adapter->rx_rings =kcalloc (adapter->num_active_queues, + adapter->rx_rings =kcalloc (num_active_queues,sizeof (struct i40e_ring ),GFP_KERNEL );if (!adapter->rx_rings) goto err_out; -for (i =0 ; i < adapter->num_active_queues; i++) { +for (i =0 ; i < num_active_queues; i++) {struct i40e_ring *tx_ring;struct i40e_ring *rx_ring;
@@ -1247,6 +1252,8 @@ static int i40evf_alloc_queues(struct i40evf_adapter *adapter) rx_ring->rx_itr_setting = (I40E_ITR_DYNAMIC |I40E_ITR_RX_DEF ); } + adapter->num_active_queues = num_active_queues; +return 0 ; err_out:
@@ -2636,9 +2643,6 @@ static void i40evf_init_task(struct work_struct *work) adapter->watchdog_timer.data = (unsigned long )adapter;mod_timer (&adapter->watchdog_timer, jiffies +1 ); - adapter->num_active_queues =min_t (int, - adapter->vsi_res->num_queue_pairs, - (int )(num_online_cpus ())); adapter->tx_desc_count =I40EVF_DEFAULT_TXD ; adapter->rx_desc_count =I40EVF_DEFAULT_RXD ; err =i40evf_init_interrupt_scheme (adapter);
Signature · 1 line
2.9.3
PATCH 2/13 i40e/i40evf: update WOL and I40E_AQC_ADDR_VALID_MASK flags
Update a few flags related to FW interactions.
Copyright updated to 2017.
--- drivers/net/ethernet/intel/i40e/i40e_adminq_cmd.h | 4 ++-- drivers/net/ethernet/intel/i40evf/i40e_adminq_cmd.h | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_adminq_cmd.h +2 -2
@@ -1,7 +1,7 @@/******************************************************************************* * * Intel Ethernet Controller XL710 Family Linux Driver -* Copyright(c) 2013 - 2016 Intel Corporation. +* Copyright(c) 2013 - 2017 Intel Corporation. * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License,
@@ -531,7 +531,7 @@ struct i40e_aqc_mac_address_read {#define I40E_AQC_PORT_ADDR_VALID 0x40#define I40E_AQC_WOL_ADDR_VALID 0x80#define I40E_AQC_MC_MAG_EN_VALID 0x100 -#define I40E_AQC_ADDR_VALID_MASK 0x1F0 +#define I40E_AQC_ADDR_VALID_MASK 0x3F0u8 reserved[6 ];__le32 addr_high;__le32 addr_low;
drivers/net/ethernet/intel/i40evf/i40e_adminq_cmd.h +3 -2
@@ -1,7 +1,7 @@/******************************************************************************* * * Intel Ethernet Controller XL710 Family Linux Virtual Function Driver -* Copyright(c) 2013 - 2016 Intel Corporation. +* Copyright(c) 2013 - 2017 Intel Corporation. * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License,
@@ -528,7 +528,7 @@ struct i40e_aqc_mac_address_read {#define I40E_AQC_PORT_ADDR_VALID 0x40#define I40E_AQC_WOL_ADDR_VALID 0x80#define I40E_AQC_MC_MAG_EN_VALID 0x100 -#define I40E_AQC_ADDR_VALID_MASK 0x1F0 +#define I40E_AQC_ADDR_VALID_MASK 0x3F0u8 reserved[6 ];__le32 addr_high;__le32 addr_low;
@@ -586,6 +586,7 @@ struct i40e_aqc_set_wol_filter {__le16 cmd_flags;#define I40E_AQC_SET_WOL_FILTER 0x8000#define I40E_AQC_SET_WOL_FILTER_NO_TCO_WOL 0x4000 +#define I40E_AQC_SET_WOL_FILTER_WOL_PRESERVE_ON_PFR 0x2000#define I40E_AQC_SET_WOL_FILTER_ACTION_CLEAR 0#define I40E_AQC_SET_WOL_FILTER_ACTION_SET 1__le16 valid_flags;
Signature · 1 line
2.9.3
PATCH 3/13 i40e: use dev_dbg instead of dev_info when warning about missing routine
In reply to Alice MichaelFrom: Jacob Keller <[email protected]>
When searching for the vf_capability client routine, dev_info() was used, instead of the normal dev_dbg(). This causes the message to be displayed at standard log levels which can cause administrators to worry. Avoid this by using dev_dbg instead.
Copyright updated to 2017.
--- drivers/net/ethernet/intel/i40e/i40e_client.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_client.c +3 -3
@@ -1,7 +1,7 @@/******************************************************************************* * * Intel Ethernet Controller XL710 Family Linux Driver -* Copyright(c) 2013 - 2015 Intel Corporation. +* Copyright(c) 2013 - 2017 Intel Corporation. * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License,
@@ -273,8 +273,8 @@ int i40e_vf_client_capable(struct i40e_pf *pf, u32 vf_id)if (!cdev || !cdev->client) goto out;if (!cdev->client->ops || !cdev->client->ops->vf_capable) { -dev_info (&pf->pdev->dev, -"Cannot locate client instance VF capability routine\n" ); +dev_dbg (&pf->pdev->dev, +"Cannot locate client instance VF capability routine\n" ); goto out; }if (!test_bit (__I40E_CLIENT_INSTANCE_OPENED, &cdev->state))
Signature · 1 line
2.9.3
PATCH 4/13 i40e: comment that udp_port must be in host byte order
In reply to Alice MichaelFrom: Jacob Keller <[email protected]>
The firmware expects the port number passed when setting up the UDP tunnel configuration to be in Little Endian format. The i40e_aq_add_udp_tunnel command byte swaps the value from host order to Little Endian.
Since commit fe0b0cd97b4f ("i40e: send correct port number to AdminQ when enabling UDP tunnels") we've correctly sent the value in host order.
Let's also add a comment to the function explaining that it must be in host order, as the port numbers are commonly stored as Big Endian values.
--- drivers/net/ethernet/intel/i40e/i40e_common.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/net/ethernet/intel/i40e/i40e_common.c +5 -1
@@ -3614,11 +3614,15 @@ i40e_status i40e_aq_get_cee_dcb_config(struct i40e_hw *hw,/** * i40e_aq_add_udp_tunnel * @hw: pointer to the hw struct -* @udp_port: the UDP port to add +* @udp_port: the UDP port to add in Host byte order * @header_len: length of the tunneling header length in DWords * @protocol_index: protocol index type * @filter_index: pointer to filter index * @cmd_details: pointer to command details structure or NULL +* +* Note: Firmware expects the udp_port value to be in Little Endian format, +* and this function will call cpu_to_le16 to convert from Host byte order to +* Little Endian order. **/ i40e_status i40e_aq_add_udp_tunnel(struct i40e_hw *hw, u16 udp_port, u8 protocol_index,
Signature · 1 line
2.9.3
PATCH 5/13 i40e: Fix potential out of bound array access
In reply to Alice MichaelFrom: Sudheer Mogilappagari <[email protected]>
This is a fix for the static code analysis issue where dcbcfg->numapps could be greater than size of array (i.e dcbcfg->app[I40E_DCBX_MAX_APPS]). The fix makes sure that the array is not accessed past the size of of the array (i.e. I40E_DCBX_MAX_APPS).
Copyright updated to 2017.
--- drivers/net/ethernet/intel/i40e/i40e_dcb.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/ethernet/intel/i40e/i40e_dcb.c +3 -1
@@ -1,7 +1,7 @@/******************************************************************************* * * Intel Ethernet Controller XL710 Family Linux Driver -* Copyright(c) 2013 - 2014 Intel Corporation. +* Copyright(c) 2013 - 2017 Intel Corporation. * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License,
@@ -390,6 +390,8 @@ static void i40e_parse_cee_app_tlv(struct i40e_cee_feat_tlv *tlv,if (!dcbcfg->numapps)return ; +if (dcbcfg->numapps >I40E_DCBX_MAX_APPS ) + dcbcfg->numapps =I40E_DCBX_MAX_APPS ;for (i =0 ; i < dcbcfg->numapps; i++) {u8 up, selector;
Signature · 1 line
2.9.3
PATCH 6/13 i40e: Support firmware CEE DCB UP to TC map re-definition
In reply to Alice MichaelChanges parsing of FW 4.33 AQ command Get CEE DCBX OPER CFG (0x0A07). Change is required because FW now creates the oper_prio_tc nibbles reversed from those in the CEE Priority Group sub-TLV. This change will only apply to FW 4.33 as future FW versions will use a different function to parse the CEE data.
--- drivers/net/ethernet/intel/i40e/i40e_dcb.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_dcb.c +7 -4
@@ -620,14 +620,17 @@ static void i40e_cee_to_dcb_v1_config(/* CEE PG data to ETS config */ dcbcfg->etscfg.maxtcs = cee_cfg->oper_num_tc; +/* Note that the FW creates the oper_prio_tc nibbles reversed +* from those in the CEE Priority Group sub-TLV. +*/ for (i =0 ; i <4 ; i++) { tc = (u8)((cee_cfg->oper_prio_tc[i] & -I40E_CEE_PGID_PRIO_1_MASK ) >> -I40E_CEE_PGID_PRIO_1_SHIFT ); - dcbcfg->etscfg.prioritytable[i*2 ] = tc; - tc = (u8)((cee_cfg->oper_prio_tc[i] &I40E_CEE_PGID_PRIO_0_MASK ) >>I40E_CEE_PGID_PRIO_0_SHIFT ); + dcbcfg->etscfg.prioritytable[i *2 ] = tc; + tc = (u8)((cee_cfg->oper_prio_tc[i] & +I40E_CEE_PGID_PRIO_1_MASK ) >> +I40E_CEE_PGID_PRIO_1_SHIFT ); dcbcfg->etscfg.prioritytable[i*2 +1 ] = tc; }
Signature · 1 line
2.9.3
PATCH 7/13 i40e: Add message for unsupported MFP mode
In reply to Alice MichaelFrom: Carolyn Wyborny <[email protected]>
This patch adds a check and message if the device is in MFP mode as changing RSS input set is not supported in MFP mode.
--- drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/net/ethernet/intel/i40e/i40e_ethtool.c +6 -0
@@ -2711,6 +2711,12 @@ static int i40e_set_rss_hash_opt(struct i40e_pf *pf, struct ethtool_rxnfc *nfc)u8 flow_pctype =0 ;u64 i_set, i_setc; +if (pf->flags &I40E_FLAG_MFP_ENABLED ) { +dev_err (&pf->pdev->dev, +"Change of RSS hash input set is not supported when MFP mode is enabled\n" ); +return -EOPNOTSUPP ; + } +/* RSS does not support anything other than hashing * to queues on src and dst IPs and ports */
Signature · 1 line
2.9.3
PATCH 8/13 i40e: genericize the partition bandwidth control
In reply to Alice MichaelFrom: Shannon Nelson <[email protected]>
Partition bandwidth control is not in just one form of MFP (multi-function partitioning), so make the code more generic and be sure to nudge the Tx scheduler for all MFP.
Copyright updated to 2017.
--- drivers/net/ethernet/intel/i40e/i40e.h | 13 +++++---- drivers/net/ethernet/intel/i40e/i40e_main.c | 41 ++++++++++++++--------------- 2 files changed, 26 insertions(+), 28 deletions(-)
drivers/net/ethernet/intel/i40e/i40e.h +6 -7
@@ -1,7 +1,7 @@/******************************************************************************* * * Intel Ethernet Controller XL710 Family Linux Driver -* Copyright(c) 2013 - 2016 Intel Corporation. +* Copyright(c) 2013 - 2017 Intel Corporation. * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License,
@@ -516,9 +516,8 @@ struct i40e_pf {bool ptp_tx;bool ptp_rx;u16 rss_table_size;/* HW RSS table size */ -/* These are only valid in NPAR modes */ -u32 npar_max_bw; -u32 npar_min_bw; +u32 max_bw; +u32 min_bw;u32 ioremap_len;u32 fd_inv;
@@ -971,9 +970,9 @@ int i40e_ptp_get_ts_config(struct i40e_pf *pf, struct ifreq *ifr);void i40e_ptp_init (struct i40e_pf *pf);void i40e_ptp_stop (struct i40e_pf *pf);int i40e_is_vsi_uplink_mode_veb (struct i40e_vsi *vsi); -i40e_status i40e_get_npar_bw_setting (struct i40e_pf *pf); -i40e_status i40e_set_npar_bw_setting (struct i40e_pf *pf); -i40e_status i40e_commit_npar_bw_setting (struct i40e_pf *pf); +i40e_status i40e_get_partition_bw_setting (struct i40e_pf *pf); +i40e_status i40e_set_partition_bw_setting (struct i40e_pf *pf); +i40e_status i40e_commit_partition_bw_setting (struct i40e_pf *pf);void i40e_print_link_message (struct i40e_vsi *vsi,bool isup);static inline bool i40e_enabled_xdp_vsi (struct i40e_vsi *vsi)
drivers/net/ethernet/intel/i40e/i40e_main.c +20 -21
100 lines not on this page · raw message
Signature · 1 line
2.9.3
PATCH 9/13 i40e: Add support for OEM firmware version
In reply to Alice MichaelFrom: Filip Sadowski <[email protected]>
This patch adds support for OEM firmware version. If OEM specific adapter is detected ethtool reports OEM product version in firmware version string instead of etrack id.
--- drivers/net/ethernet/intel/i40e/i40e.h | 48 ++++++++++++++++++++--------- drivers/net/ethernet/intel/i40e/i40e_main.c | 47 ++++++++++++++++++++++++++++ 2 files changed, 81 insertions(+), 14 deletions(-)
drivers/net/ethernet/intel/i40e/i40e.h +34 -14
@@ -103,6 +103,12 @@ (I40E_AQ_PHY_DEBUG_DISABLE_LINK_FW | \ I40E_AQ_PHY_DEBUG_DISABLE_ALL_LINK_FW) +#define I40E_OEM_EETRACK_ID 0xffffffff +#define I40E_OEM_GEN_SHIFT 24 +#define I40E_OEM_SNAP_MASK 0x00ff0000 +#define I40E_OEM_SNAP_SHIFT 16 +#define I40E_OEM_RELEASE_MASK 0x0000ffff +/* The values in here are decimal coded as hex as is the case in the NVM map*/ #define I40E_CURRENT_NVM_VERSION_HI 0x2#define I40E_CURRENT_NVM_VERSION_LO 0x40
@@ -733,22 +739,36 @@ static inline char *i40e_nvm_version_str(struct i40e_hw *hw) {static char buf[32 ];u32 full_ver; -u8 ver, patch; -u16 build; full_ver = hw->nvm.oem_ver; - ver = (u8)(full_ver >>I40E_OEM_VER_SHIFT ); - build = (u16)((full_ver >>I40E_OEM_VER_BUILD_SHIFT ) & -I40E_OEM_VER_BUILD_MASK ); - patch = (u8)(full_ver &I40E_OEM_VER_PATCH_MASK ); - -snprintf (buf,sizeof (buf), -"%x.%02x 0x%x %d.%d.%d" , - (hw->nvm.version &I40E_NVM_VERSION_HI_MASK ) >> -I40E_NVM_VERSION_HI_SHIFT , - (hw->nvm.version &I40E_NVM_VERSION_LO_MASK ) >> -I40E_NVM_VERSION_LO_SHIFT , - hw->nvm.eetrack, ver, build, patch); + +if (hw->nvm.eetrack ==I40E_OEM_EETRACK_ID ) { +u8 gen, snap; +u16 release; + + gen = (u8)(full_ver >>I40E_OEM_GEN_SHIFT ); + snap = (u8)((full_ver &I40E_OEM_SNAP_MASK ) >> +I40E_OEM_SNAP_SHIFT ); + release = (u16)(full_ver &I40E_OEM_RELEASE_MASK ); + +snprintf (buf,sizeof (buf),"%x.%x.%x" , gen, snap, release); + }else { +u8 ver, patch; +u16 build; + + ver = (u8)(full_ver >>I40E_OEM_VER_SHIFT ); + build = (u16)((full_ver >>I40E_OEM_VER_BUILD_SHIFT ) & +I40E_OEM_VER_BUILD_MASK ); + patch = (u8)(full_ver &I40E_OEM_VER_PATCH_MASK ); + +snprintf (buf,sizeof (buf), +"%x.%02x 0x%x %d.%d.%d" , + (hw->nvm.version &I40E_NVM_VERSION_HI_MASK ) >> +I40E_NVM_VERSION_HI_SHIFT , + (hw->nvm.version &I40E_NVM_VERSION_LO_MASK ) >> +I40E_NVM_VERSION_LO_SHIFT , + hw->nvm.eetrack, ver, build, patch); + }return buf; }
drivers/net/ethernet/intel/i40e/i40e_main.c +47 -0
65 lines not on this page · raw message
Signature · 1 line
2.9.3
PATCH 10/13 i40e: fix disabling overflow promiscuous mode
In reply to Alice MichaelFrom: Alan Brady <[email protected]>
There exists a bug in which the driver does not correctly exit overflow promiscuous mode. This can occur if "too many" mac filters are added, putting the driver into overflow promiscuous mode, and the filters are then removed. When the failed filters are removed, the driver reports exiting overflow promiscuous mode which is correct, however traffic continues to be received as if in promiscuous mode still.
The bug occurs because the conditional for toggling promiscuous mode was set to only execute when promiscuous mode was enabled and not when it was disabled as well. This patch fixes the conditional to correctly execute when promiscuous mode is toggled and not just enabled. Without this patch, the driver is unable to correctly exit overflow promiscuous mode.
--- drivers/net/ethernet/intel/i40e/i40e_main.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_main.c +2 -3
@@ -2281,9 +2281,8 @@ int i40e_sync_vsi_filters(struct i40e_vsi *vsi) i40e_aq_str(hw, hw->aq.asq_last_status)); } } -if ((changed_flags &IFF_PROMISC ) || - (promisc_changed && -test_bit (__I40E_VSI_OVERFLOW_PROMISC, vsi->state))) { + +if ((changed_flags &IFF_PROMISC ) || promisc_changed) {bool cur_promisc; cur_promisc = (!!(vsi->current_netdev_flags & IFF_PROMISC) ||
Signature · 1 line
2.9.3
PATCH 11/13 i40e: clear only cause_ena bit
In reply to Alice MichaelFrom: Shannon Nelson <[email protected]>
When disabling interrupts, we should only be clearing the CAUSE_ENA bit, not clearing the whole register. Clearing the whole register sets the NEXTQ_IDX field to 0 instead of 0x7ff which can confuse the Firmware in some reset sequences.
--- drivers/net/ethernet/intel/i40e/i40e_main.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_main.c +12 -2
@@ -3588,14 +3588,24 @@ static void i40e_vsi_disable_irq(struct i40e_vsi *vsi)int base = vsi->base_vector;int i; +/* disable interrupt causation from each queue */ for (i =0 ; i < vsi->num_queue_pairs; i++) { -wr32 (hw,I40E_QINT_TQCTL (vsi->tx_rings[i]->reg_idx),0 ); -wr32 (hw,I40E_QINT_RQCTL (vsi->rx_rings[i]->reg_idx),0 ); +u32 val; + + val =rd32 (hw,I40E_QINT_TQCTL (vsi->tx_rings[i]->reg_idx)); + val &= ~I40E_QINT_TQCTL_CAUSE_ENA_MASK ; +wr32 (hw,I40E_QINT_TQCTL (vsi->tx_rings[i]->reg_idx), val); + + val =rd32 (hw,I40E_QINT_RQCTL (vsi->rx_rings[i]->reg_idx)); + val &= ~I40E_QINT_RQCTL_CAUSE_ENA_MASK ; +wr32 (hw,I40E_QINT_RQCTL (vsi->rx_rings[i]->reg_idx), val); +if (!i40e_enabled_xdp_vsi (vsi))continue ;wr32 (hw,I40E_QINT_TQCTL (vsi->xdp_rings[i]->reg_idx),0 ); } +/* disable each interrupt */ if (pf->flags &I40E_FLAG_MSIX_ENABLED ) {for (i = vsi->base_vector; i < (vsi->num_q_vectors + vsi->base_vector); i++)
Signature · 1 line
2.9.3
PATCH 12/13 i40e: Handle PE_CRITERR properly with IWARP enabled
In reply to Alice MichaelFrom: Catherine Sullivan <[email protected]>
When IWARP is enabled, we weren't clearing the PE_CRITERR, just logging it and removing it from the mask. We need to do a corer to reset the PE_CRITERR register, so set the bit for that as we handle the interrupt.
We should also be checking for the error against the PFINT_ICR0 register, and only need to clear it in the value getting written to PFINT_ICR0_ENA.
--- drivers/net/ethernet/intel/i40e/i40e_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_main.c +2 -2
@@ -3684,10 +3684,10 @@ static irqreturn_t i40e_intr(int irq, void *data) pf->sw_int_count++;if ((pf->flags &I40E_FLAG_IWARP_ENABLED ) && - (ena_mask &I40E_PFINT_ICR0_ENA_PE_CRITERR_MASK )) { + (icr0 &I40E_PFINT_ICR0_ENA_PE_CRITERR_MASK )) { ena_mask &= ~I40E_PFINT_ICR0_ENA_PE_CRITERR_MASK ; - icr0 &= ~I40E_PFINT_ICR0_ENA_PE_CRITERR_MASK ;dev_dbg (&pf->pdev->dev,"cleared PE_CRITERR\n" ); +set_bit (__I40E_CORE_RESET_REQUESTED, pf->state); }/* only q0 is used in MSI/Legacy mode, and none are used in MSIX */
Signature · 1 line
2.9.3
PATCH 13/13 i40e: don't hold RTNL lock for the entire reset
In reply to Alice MichaelFrom: Jacob Keller <[email protected]>
We recently refactored i40e_do_reset() and its friends to be able to hold the RTNL lock only for the portions that actually need to be protected. However, a separate refactoring added several new callers of these functions during the PCIe error recovery and suspend/resume cycles.
When merging the changes together, it was not noticed that we could reduce the RTNL scope by letting the reset function handle the lock itself, as previously it was not possible.
Fix this by replacing these call sites to indicate that the reset function should handle its own lock. This enables multiple PFs to reset or resume simultaneously without serializing the resets via the RTNL lock. The end result is that on systems with lots of PFs and VFs the resets don't stall waiting for each other to finish.
It is probable that we can also do the same for i40e_do_reset_safe, but this author did not research that change carefully enough to be confident.
--- drivers/net/ethernet/intel/i40e/i40e_main.c | 27 +++++++-------------------- 1 file changed, 7 insertions(+), 20 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_main.c +7 -20
@@ -6565,9 +6565,7 @@ static void i40e_reset_subtask(struct i40e_pf *pf)if (reset_flags && !test_bit (__I40E_DOWN, pf->state) && !test_bit (__I40E_CONFIG_BUSY, pf->state)) { -rtnl_lock (); -i40e_do_reset (pf, reset_flags, true); -rtnl_unlock (); +i40e_do_reset (pf, reset_flags, false); } }
@@ -11905,11 +11903,8 @@ static pci_ers_result_t i40e_pci_error_detected(struct pci_dev *pdev, }/* shutdown all operations */ -if (!test_bit (__I40E_SUSPENDED, pf->state)) { -rtnl_lock (); -i40e_prep_for_reset (pf, true); -rtnl_unlock (); - } +if (!test_bit (__I40E_SUSPENDED, pf->state)) +i40e_prep_for_reset (pf, false);/* Request a slot reset */ return PCI_ERS_RESULT_NEED_RESET ;
@@ -11975,9 +11970,7 @@ static void i40e_pci_error_resume(struct pci_dev *pdev)if (test_bit (__I40E_SUSPENDED, pf->state))return ; -rtnl_lock (); -i40e_handle_reset_warning (pf, true); -rtnl_unlock (); +i40e_handle_reset_warning (pf, false); }/**
@@ -12057,9 +12050,7 @@ static void i40e_shutdown(struct pci_dev *pdev)if (pf->wol_en && (pf->flags &I40E_FLAG_WOL_MC_MAGIC_PKT_WAKE ))i40e_enable_mc_magic_wake (pf); -rtnl_lock (); -i40e_prep_for_reset (pf, true); -rtnl_unlock (); +i40e_prep_for_reset (pf, false);wr32 (hw,I40E_PFPM_APM , (pf->wol_en ?I40E_PFPM_APM_APME_MASK :0 ));
@@ -12091,9 +12082,7 @@ static int i40e_suspend(struct pci_dev *pdev, pm_message_t state)if (pf->wol_en && (pf->flags &I40E_FLAG_WOL_MC_MAGIC_PKT_WAKE ))i40e_enable_mc_magic_wake (pf); -rtnl_lock (); -i40e_prep_for_reset (pf, true); -rtnl_unlock (); +i40e_prep_for_reset (pf, false);wr32 (hw,I40E_PFPM_APM , (pf->wol_en ?I40E_PFPM_APM_APME_MASK :0 ));wr32 (hw,I40E_PFPM_WUFC , (pf->wol_en ?I40E_PFPM_WUFC_MAG_MASK :0 ));
@@ -12139,9 +12128,7 @@ static int i40e_resume(struct pci_dev *pdev)/* handling the reset will rebuild the device state */ if (test_and_clear_bit (__I40E_SUSPENDED, pf->state)) {clear_bit (__I40E_DOWN, pf->state); -rtnl_lock (); -i40e_reset_and_rebuild (pf, false, true); -rtnl_unlock (); +i40e_reset_and_rebuild (pf, false, false); }return 0 ;
Signature · 1 line
2.9.3
Bowers
PATCH 1/13 i40evf: assign num_active_queues inside i40evf_alloc_queues
In reply to Alice MichaelQuoted 28 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On Behalf Of Alice Michael
Sent: Wednesday, June 7, 2017 2:43 AM
To: Michael, Alice <[email protected]>; intel-wired- lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next PATCH S72-V3 01/13] i40evf: assignnum_active_queuesinsidei40evf_alloc_queuesFrom: Jacob Keller <[email protected]>
The variable
num_active_queuesrepresents the number of active queues we have for the device. We assign this pretty early ini40evf_init_subtask.Several code locations are written with loops over the
tx_ringsandrx_ringsstructures, which don't get allocated untili40evf_alloc_queues, and which get freed byi40evf_free_queues.These call sites were written under the assumption that
tx_ringsandrx_ringswould always be allocated at least whennum_active_queuesis non-zero.Lets fix this by moving the assignment into the function where we allocate queues. We'll use a temporary variable for storage so that we don't assign the value in the adapter structure until after the rings have been set up.
Finally, when we free the queues, we'll clear the value to ensure that we do not loop over the rings memory that no longer exists.
Quoted 8 lines
This resolves a possible NULL pointer derference in
i40evf_get_ethtool_statswhich could occur if the VF fails to recover from a reset, and then a user requests statistics.Signed-off-by Jacob Keller <[email protected]>--- drivers/net/ethernet/intel/i40evf/i40evf_main.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-)
Bowers
PATCH 2/13 i40e/i40evf: update WOL and I40E_AQC_ADDR_VALID_MASK flags
In reply to Alice MichaelQuoted 11 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On Behalf Of Alice Michael
Sent: Wednesday, June 7, 2017 2:43 AM
To: Michael, Alice <[email protected]>; intel-wired- lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next PATCH S72-V3 02/13] i40e/i40evf: update WOL andI40E_AQC_ADDR_VALID_MASKflagsUpdate a few flags related to FW interactions.
Quoted 7 lines
Copyright updated to 2017.
Signed-off-by Alice Michael <[email protected]>--- drivers/net/ethernet/intel/i40e/i40e_adminq_cmd.h | 4 ++-- drivers/net/ethernet/intel/i40evf/i40e_adminq_cmd.h | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-)
Bowers
PATCH 3/13 i40e: use dev_dbg instead of dev_info when warning about missing routine
In reply to Alice MichaelQuoted 16 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On Behalf Of Alice Michael
Sent: Wednesday, June 7, 2017 2:43 AM
To: Michael, Alice <[email protected]>; intel-wired- lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next PATCH S72-V3 03/13] i40e: usedev_dbginstead ofdev_infowhen warning about missing routineFrom: Jacob Keller <[email protected]>
When searching for the
vf_capabilityclient routine,dev_info()was used, instead of the normaldev_dbg(). This causes the message to be displayed at standard log levels which can cause administrators to worry. Avoid this by usingdev_dbginstead.
Quoted 6 lines
Copyright updated to 2017.
Signed-off-by Jacob Keller <[email protected]>--- drivers/net/ethernet/intel/i40e/i40e_client.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
Bowers
PATCH 4/13 i40e: comment that udp_port must be in host byte order
In reply to Alice MichaelQuoted 19 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On Behalf Of Alice Michael
Sent: Wednesday, June 7, 2017 2:43 AM
To: Michael, Alice <[email protected]>; intel-wired- lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next PATCH S72-V3 04/13] i40e: comment thatudp_portmust be in host byte orderFrom: Jacob Keller <[email protected]>
The firmware expects the port number passed when setting up the UDP tunnel configuration to be in Little Endian format.
Thei40e_aq_add_udp_tunnelcommand byte swaps the value from host order to Little Endian.Since commit
fe0b0cd97b4f("i40e: send correct port number to AdminQ when enabling UDP tunnels") we've correctly sent the value in host order.
Quoted 7 lines
Let's also add a comment to the function explaining that it must be in host order, as the port numbers are commonly stored as Big Endian values.
Signed-off-by Jacob Keller <[email protected]>--- drivers/net/ethernet/intel/i40e/i40e_common.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
Bowers
PATCH 5/13 i40e: Fix potential out of bound array access
In reply to Alice MichaelQuoted 17 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On Behalf Of Alice Michael
Sent: Wednesday, June 7, 2017 2:43 AM
To: Michael, Alice <[email protected]>; intel-wired-
lan at lists.osuosl.org
Cc: Mogilappagari, Sudheer <[email protected]>
Subject: [Intel-wired-lan] [next PATCH S72-V3 05/13] i40e: Fix potential out of bound array accessFrom: Sudheer Mogilappagari <[email protected]>
This is a fix for the static code analysis issue where
dcbcfg->numappscould be greater than size of array (i.e dcbcfg->app[I40E_DCBX_MAX_APPS]). The fix makes sure that the array is not accessed past the size of of the array (i.e.I40E_DCBX_MAX_APPS).
Quoted 6 lines
Copyright updated to 2017.
Signed-off-by Sudheer Mogilappagari <[email protected]>--- drivers/net/ethernet/intel/i40e/i40e_dcb.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
Bowers
PATCH 7/13 i40e: Add message for unsupported MFP mode
In reply to Alice MichaelQuoted 11 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On Behalf Of Alice Michael
Sent: Wednesday, June 7, 2017 2:43 AM
To: Michael, Alice <[email protected]>; intel-wired-
lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next PATCH S72-V3 07/13] i40e: Add message for unsupported MFP modeFrom: Carolyn Wyborny <[email protected]>
Quoted 7 lines
This patch adds a check and message if the device is in MFP mode as changing RSS input set is not supported in MFP mode.
Signed-off-by Carolyn Wyborny <[email protected]>--- drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 6 ++++++ 1 file changed, 6 insertions(+)
Bowers
PATCH 11/13 i40e: clear only cause_ena bit
In reply to Alice MichaelQuoted 17 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On Behalf Of Alice Michael
Sent: Wednesday, June 7, 2017 2:43 AM
To: Michael, Alice <[email protected]>; intel-wired- lan at lists.osuosl.org
Cc: Shannon Nelson <[email protected]>
Subject: [Intel-wired-lan] [next PATCH S72-V3 11/13] i40e: clear onlycause_enabitFrom: Shannon Nelson <[email protected]>
When disabling interrupts, we should only be clearing the
CAUSE_ENAbit, not clearing the whole register. Clearing the whole register sets theNEXTQ_IDXfield to 0 instead of0x7ffwhich can confuse the Firmware in some reset sequences.
Quoted 5 lines
Signed-off-by Shannon Nelson <[email protected]>Signed-off-by Mitch Williams <[email protected]>--- drivers/net/ethernet/intel/i40e/i40e_main.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)
Bowers
PATCH 6/13 i40e: Support firmware CEE DCB UP to TC map re-definition
In reply to Alice MichaelQuoted 16 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On Behalf Of Alice Michael
Sent: Wednesday, June 7, 2017 2:43 AM
To: Michael, Alice <[email protected]>; intel-wired-
lan at lists.osuosl.org
Cc: Bowers, Gregory J <[email protected]>
Subject: [Intel-wired-lan] [next PATCH S72-V3 06/13] i40e: Support firmware CEE DCB UP to TC map re-definitionChanges parsing of FW 4.33 AQ command Get CEE DCBX OPER CFG (
0x0A07). Change is required because FW now creates theoper_prio_tcnibbles reversed from those in the CEE Priority Group sub-TLV.
This change will only apply to FW 4.33 as future FW versions will use a different function to parse the CEE data.
Quoted 4 lines
Signed-off-by Greg Bowers <[email protected]>--- drivers/net/ethernet/intel/i40e/i40e_dcb.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
Bowers
PATCH 8/13 i40e: genericize the partition bandwidth control
In reply to Alice MichaelQuoted 18 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On Behalf Of Alice Michael
Sent: Wednesday, June 7, 2017 2:43 AM
To: Michael, Alice <[email protected]>; intel-wired- lan at lists.osuosl.org
Cc: Shannon Nelson <[email protected]>
Subject: [Intel-wired-lan] [next PATCH S72-V3 08/13] i40e: genericize the partition bandwidth controlFrom: Shannon Nelson <[email protected]>
Partition bandwidth control is not in just one form of MFP (multi-function partitioning), so make the code more generic and be sure to nudge the Tx scheduler for all MFP.
Copyright updated to 2017.
Quoted 7 lines
Signed-off-by Shannon Nelson <[email protected]>Signed-off-by Mitch Williams <[email protected]>--- drivers/net/ethernet/intel/i40e/i40e.h | 13 +++++---- drivers/net/ethernet/intel/i40e/i40e_main.c | 41 ++++++++++++++---------- ----- 2 files changed, 26 insertions(+), 28 deletions(-)
Bowers
PATCH 12/13 i40e: Handle PE_CRITERR properly with IWARP enabled
In reply to Alice MichaelQuoted 16 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On Behalf Of Alice Michael
Sent: Wednesday, June 7, 2017 2:43 AM
To: Michael, Alice <[email protected]>; intel-wired- lan at lists.osuosl.org
Cc: Catherine Sullivan <[email protected]>
Subject: [Intel-wired-lan] [next PATCH S72-V3 12/13] i40e: HandlePE_CRITERRproperly with IWARP enabledFrom: Catherine Sullivan <[email protected]>
When IWARP is enabled, we weren't clearing the
PE_CRITERR, just logging it and removing it from the mask. We need to do a corer to reset thePE_CRITERRregister, so set the bit for that as we handle the interrupt.
Quoted 8 lines
We should also be checking for the error against the
PFINT_ICR0register, and only need to clear it in the value getting written toPFINT_ICR0_ENA.Signed-off-by Catherine Sullivan <[email protected]>Signed-off-by Mitch Williams <[email protected]>--- drivers/net/ethernet/intel/i40e/i40e_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Bowers
PATCH 13/13 i40e: don't hold RTNL lock for the entire reset
In reply to Alice MichaelQuoted 26 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On Behalf Of Alice Michael
Sent: Wednesday, June 7, 2017 2:43 AM
To: Michael, Alice <[email protected]>; intel-wired-
lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next PATCH S72-V3 13/13] i40e: don't hold RTNL lock for the entire resetFrom: Jacob Keller <[email protected]>
We recently refactored
i40e_do_reset()and its friends to be able to hold the RTNL lock only for the portions that actually need to be protected. However, a separate refactoring added several new callers of these functions during the PCIe error recovery and suspend/resume cycles.When merging the changes together, it was not noticed that we could reduce the RTNL scope by letting the reset function handle the lock itself, as previously it was not possible.
Fix this by replacing these call sites to indicate that the reset function should handle its own lock. This enables multiple PFs to reset or resume simultaneously without serializing the resets via the RTNL lock. The end result is that on systems with lots of PFs and VFs the resets don't stall waiting for each other to finish.
Quoted 7 lines
It is probable that we can also do the same for
i40e_do_reset_safe, but this author did not research that change carefully enough to be confident.Signed-off-by Jacob Keller <[email protected]>--- drivers/net/ethernet/intel/i40e/i40e_main.c | 27 +++++++-------------------- 1 file changed, 7 insertions(+), 20 deletions(-)
Bowers
PATCH 9/13 i40e: Add support for OEM firmware version
In reply to Alice MichaelQuoted 16 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On Behalf Of Alice Michael
Sent: Wednesday, June 7, 2017 2:43 AM
To: Michael, Alice <[email protected]>; intel-wired-
lan at lists.osuosl.org
Cc: Sadowski, Filip <[email protected]>
Subject: [Intel-wired-lan] [next PATCH S72-V3 09/13] i40e: Add support for OEM firmware versionFrom: Filip Sadowski <[email protected]>
This patch adds support for OEM firmware version. If OEM specific adapter is detected ethtool reports OEM product version in firmware version string instead of etrack id.
Quoted 7 lines
Signed-off-by Filip Sadowski <[email protected]>--- drivers/net/ethernet/intel/i40e/i40e.h | 48 ++++++++++++++++++++----- ---- drivers/net/ethernet/intel/i40e/i40e_main.c | 47 ++++++++++++++++++++++++++++ 2 files changed, 81 insertions(+), 14 deletions(-)
Bowers
PATCH 10/13 i40e: fix disabling overflow promiscuous mode
In reply to Alice MichaelQuoted 24 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On Behalf Of Alice Michael
Sent: Wednesday, June 7, 2017 2:43 AM
To: Michael, Alice <[email protected]>; intel-wired- lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next PATCH S72-V3 10/13] i40e: fix disabling overflow promiscuous modeFrom: Alan Brady <[email protected]>
There exists a bug in which the driver does not correctly exit overflow promiscuous mode. This can occur if "too many" mac filters are added, putting the driver into overflow promiscuous mode, and the filters are then removed. When the failed filters are removed, the driver reports exiting overflow promiscuous mode which is correct, however traffic continues to be received as if in promiscuous mode still.
The bug occurs because the conditional for toggling promiscuous mode was set to only execute when promiscuous mode was enabled and not when it was disabled as well. This patch fixes the conditional to correctly execute when promiscuous mode is toggled and not just enabled. Without this patch, the driver is unable to correctly exit overflow promiscuous mode.
Quoted 4 lines
Signed-off-by Alan Brady <[email protected]>--- drivers/net/ethernet/intel/i40e/i40e_main.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)