i40e: Add returning AQ critical error to SW
Subsystems (2)
PATCH 1/13 i40e: Add returning AQ critical error to SW
From: Michal Kosiarz <[email protected]>
The FW has the ability to return a critical error on every AQ command. When this critical error occurs then we need to send the correct response to the caller.
--- drivers/net/ethernet/intel/i40e/i40e_adminq.c | 13 +++++++++---- drivers/net/ethernet/intel/i40e/i40e_common.c | 2 ++ drivers/net/ethernet/intel/i40e/i40e_status.h | 1 + drivers/net/ethernet/intel/i40evf/i40e_adminq.c | 13 +++++++++---- drivers/net/ethernet/intel/i40evf/i40e_common.c | 2 ++ drivers/net/ethernet/intel/i40evf/i40e_status.h | 1 + 6 files changed, 24 insertions(+), 8 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_adminq.c +9 -4
@@ -907,10 +907,15 @@ i40e_status i40e_asq_send_command(struct i40e_hw *hw,/* update the error if time out occurred */ if ((!cmd_completed) && (!details->async && !details->postpone)) { -i40e_debug (hw, -I40E_DEBUG_AQ_MESSAGE , -"AQTX: Writeback timeout.\n" ); - status =I40E_ERR_ADMIN_QUEUE_TIMEOUT ; +if (rd32 (hw, hw->aq.asq.len) &I40E_GL_ATQLEN_ATQCRIT_MASK ) { +i40e_debug (hw,I40E_DEBUG_AQ_MESSAGE , +"AQTX: AQ Critical error.\n" ); + status =I40E_ERR_ADMIN_QUEUE_CRITICAL_ERROR ; + }else { +i40e_debug (hw,I40E_DEBUG_AQ_MESSAGE , +"AQTX: Writeback timeout.\n" ); + status =I40E_ERR_ADMIN_QUEUE_TIMEOUT ; + } } asq_send_command_error:
drivers/net/ethernet/intel/i40e/i40e_common.c +2 -0
@@ -278,6 +278,8 @@ const char *i40e_stat_str(struct i40e_hw *hw, i40e_status stat_err)return "I40E_NOT_SUPPORTED" ;case I40E_ERR_FIRMWARE_API_VERSION :return "I40E_ERR_FIRMWARE_API_VERSION" ; +case I40E_ERR_ADMIN_QUEUE_CRITICAL_ERROR : +return "I40E_ERR_ADMIN_QUEUE_CRITICAL_ERROR" ; }snprintf (hw->err_str,sizeof (hw->err_str),"%d" , stat_err);
drivers/net/ethernet/intel/i40e/i40e_status.h +1 -0
@@ -95,6 +95,7 @@ enum i40e_status_code {I40E_ERR_NOT_READY =-63 ,I40E_NOT_SUPPORTED =-64 ,I40E_ERR_FIRMWARE_API_VERSION =-65 , + I40E_ERR_ADMIN_QUEUE_CRITICAL_ERROR = -66, };#endif /* _I40E_STATUS_H_ */
drivers/net/ethernet/intel/i40evf/i40e_adminq.c +9 -4
@@ -837,10 +837,15 @@ i40e_status i40evf_asq_send_command(struct i40e_hw *hw,/* update the error if time out occurred */ if ((!cmd_completed) && (!details->async && !details->postpone)) { -i40e_debug (hw, -I40E_DEBUG_AQ_MESSAGE , -"AQTX: Writeback timeout.\n" ); - status =I40E_ERR_ADMIN_QUEUE_TIMEOUT ; +if (rd32 (hw, hw->aq.asq.len) &I40E_VF_ATQLEN1_ATQCRIT_MASK ) { +i40e_debug (hw,I40E_DEBUG_AQ_MESSAGE , +"AQTX: AQ Critical error.\n" ); + status =I40E_ERR_ADMIN_QUEUE_CRITICAL_ERROR ; + }else { +i40e_debug (hw,I40E_DEBUG_AQ_MESSAGE , +"AQTX: Writeback timeout.\n" ); + status =I40E_ERR_ADMIN_QUEUE_TIMEOUT ; + } } asq_send_command_error:
drivers/net/ethernet/intel/i40evf/i40e_common.c +2 -0
@@ -284,6 +284,8 @@ const char *i40evf_stat_str(struct i40e_hw *hw, i40e_status stat_err)return "I40E_NOT_SUPPORTED" ;case I40E_ERR_FIRMWARE_API_VERSION :return "I40E_ERR_FIRMWARE_API_VERSION" ; +case I40E_ERR_ADMIN_QUEUE_CRITICAL_ERROR : +return "I40E_ERR_ADMIN_QUEUE_CRITICAL_ERROR" ; }snprintf (hw->err_str,sizeof (hw->err_str),"%d" , stat_err);
drivers/net/ethernet/intel/i40evf/i40e_status.h +1 -0
@@ -95,6 +95,7 @@ enum i40e_status_code {I40E_ERR_NOT_READY =-63 ,I40E_NOT_SUPPORTED =-64 ,I40E_ERR_FIRMWARE_API_VERSION =-65 , + I40E_ERR_ADMIN_QUEUE_CRITICAL_ERROR = -66, };#endif /* _I40E_STATUS_H_ */
Signature · 1 line
2.9.5
PATCH 2/13 i40e: Fix for adding multiple ethtool filters on the same location
From: Patryk Ma?ek <[email protected]>
This patch reorders i40e_add_del_fdir and i40e_update_ethtool_fdir_entry calls so that we first remove an already existing filter (inside i40e_update_ethtool_fdir_entry using i40e_add_del_fdir) and then we add a new one with i40e_add_del_fdir.
After applying this patch, creating multiple identical filters (with the same location) one after another doesn't revert their behavior but behaves correctly.
--- drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_ethtool.c +6 -6
@@ -3939,19 +3939,19 @@ static int i40e_add_fdir_ethtool(struct i40e_vsi *vsi, input->flex_offset = userdef.flex_offset; } - ret =i40e_add_del_fdir (vsi, input, true); -if (ret) - goto free_input; -/* Add the input filter to the fdir_input_list, possibly replacing * a previous filter. Do not free the input structure after adding it * to the list as this would cause a use-after-free bug. */ i40e_update_ethtool_fdir_entry (vsi, input, fsp->location,NULL ); - + ret =i40e_add_del_fdir (vsi, input, true); +if (ret) + goto remove_sw_rule;return 0 ; -free_input: +remove_sw_rule: +hlist_del (&input->fdir_node); + pf->fdir_pf_active_filters--;kfree (input);return ret; }
Signature · 1 line
2.9.5
Malek
PATCH 2/13 i40e: Fix for adding multiple ethtool filters on the same location
ACK
-----Original Message-----
From: Michael, Alice
Sent: Wednesday, December 27, 2017 13:33
To: Michael, Alice <[email protected]>; intel-wired-lan at lists.osuosl.org
Cc: Malek, Patryk <[email protected]>
Subject: [next PATCH S84-V2 02/13] i40e: Fix for adding multiple ethtool filters on the same location
From: Patryk Ma?ek <[email protected]>
This patch reorders i40e_add_del_fdir and i40e_update_ethtool_fdir_entry calls so that we first remove an already existing filter (inside i40e_update_ethtool_fdir_entry using i40e_add_del_fdir) and then we add a new one with i40e_add_del_fdir. After applying this patch, creating multiple identical filters (with the same location) one after another doesn't revert their behavior but behaves correctly.
--- drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_ethtool.c +6 -6
@@ -3939,19 +3939,19 @@ static int i40e_add_fdir_ethtool(struct i40e_vsi *vsi, input->flex_offset = userdef.flex_offset; } - ret =i40e_add_del_fdir (vsi, input, true); -if (ret) - goto free_input; -/* Add the input filter to the fdir_input_list, possibly replacing * a previous filter. Do not free the input structure after adding it * to the list as this would cause a use-after-free bug. */ i40e_update_ethtool_fdir_entry (vsi, input, fsp->location,NULL ); - + ret =i40e_add_del_fdir (vsi, input, true); +if (ret) + goto remove_sw_rule;return 0 ; -free_input: +remove_sw_rule: +hlist_del (&input->fdir_node); + pf->fdir_pf_active_filters--;kfree (input);return ret; }
--
2.9.5
--------------------------------------------------------------------
Intel Technology Poland sp. z o.o.
ul. Slowackiego 173 | 80-298 Gdansk | Sad Rejonowy Gdansk Polnoc | VII Wydzial Gospodarczy Krajowego Rejestru Sadowego - KRS 101882 | NIP 957-07-52-316 | Kapital zakladowy 200.000 PLN.
Ta wiadomosc wraz z zalacznikami jest przeznaczona dla okreslonego adresata i moze zawierac informacje poufne. W razie przypadkowego otrzymania tej wiadomosci, prosimy o powiadomienie nadawcy oraz trwale jej usuniecie; jakiekolwiek przegladanie lub rozpowszechnianie jest zabronione.
This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). If you are not the intended recipient, please contact the sender and delete all copies; any review or distribution by others is strictly prohibited.
Bowers
PATCH 2/13 i40e: Fix for adding multiple ethtool filters on the same location
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, December 27, 2017 4:33 AM
To: Michael, Alice <[email protected]>; intel-wired- lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next PATCH S84-V2 02/13] i40e: Fix for adding multiple ethtool filters on the same locationFrom: Patryk Ma?ek <[email protected]>
This patch reorders
i40e_add_del_fdirandi40e_update_ethtool_fdir_entrycalls so that we first remove an already existing filter (insidei40e_update_ethtool_fdir_entryusingi40e_add_del_fdir) and then we add a new one withi40e_add_del_fdir.
After applying this patch, creating multiple identical filters (with the same location) one after another doesn't revert their behavior but behaves correctly.
Quoted 4 lines
Signed-off-by Patryk Ma?ek <[email protected]>--- drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
PATCH 3/13 i40evf: Allow turning off offloads when the
In reply to Alice MichaelThis patch adds back the capability to turn off offloads when VF has VLAN set. The commit 0a3b4f702fb1 ("i40evf: enable support for VF VLAN tag stripping control") adds the i40evf_set_features function and changes the 'turn off' flow for offloads. This patch adds that capability back by moving checking the VLAN option for VF to the next statement.
--- drivers/net/ethernet/intel/i40evf/i40evf_main.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-)
drivers/net/ethernet/intel/i40evf/i40evf_main.c +12 -6
@@ -2344,13 +2344,19 @@ static int i40evf_set_features(struct net_device *netdev, {struct i40evf_adapter *adapter =netdev_priv (netdev); -if (!VLAN_ALLOWED (adapter)) +/* Don't allow changing VLAN_RX flag when VLAN is set for VF +* and return an error in this case +*/ +if (VLAN_ALLOWED (adapter)) { +if (features &NETIF_F_HW_VLAN_CTAG_RX ) + adapter->aq_required |= +I40EVF_FLAG_AQ_ENABLE_VLAN_STRIPPING ; +else + adapter->aq_required |= +I40EVF_FLAG_AQ_DISABLE_VLAN_STRIPPING ; + }else if ((netdev->features ^ features) &NETIF_F_HW_VLAN_CTAG_RX ) {return -EINVAL ; - -if (features &NETIF_F_HW_VLAN_CTAG_RX ) - adapter->aq_required |=I40EVF_FLAG_AQ_ENABLE_VLAN_STRIPPING ; -else - adapter->aq_required |=I40EVF_FLAG_AQ_DISABLE_VLAN_STRIPPING ; + }return 0 ; }
Signature · 1 line
2.9.5
Bowers
PATCH 3/13 i40evf: Allow turning off offloads when the
Quoted 16 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On Behalf Of Alice Michael
Sent: Wednesday, December 27, 2017 4:33 AM
To: Michael, Alice <[email protected]>; intel-wired-
lan at lists.osuosl.org
Cc: Jablonski, Pawel <[email protected]>
Subject: [Intel-wired-lan] [next PATCH S84-V2 03/13] i40evf: Allow turning off offloads when theThis patch adds back the capability to turn off offloads when VF has VLAN set. The commit
0a3b4f702fb1("i40evf: enable support for VF VLAN tag stripping control") adds thei40evf_set_featuresfunction and changes the 'turn off' flow for offloads. This patch adds that capability back by moving checking the VLAN option for VF to the next statement.
Quoted 4 lines
Signed-off-by Pawe? Jab?o?ski <[email protected]>--- drivers/net/ethernet/intel/i40evf/i40evf_main.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-)
PATCH 4/13 i40e/i40evf: Use ring pointers to clean up _set_itr_per_queue
In reply to Alice MichaelFrom: Alexander Duyck <[email protected]>
This change cleans up the i40e/i40evf_set_itr_per_queue function by dropping all the unneeded pointer chases. Instead we can just pull out the pointers for the Tx and Rx rings and use them throughout the function.
--- drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 22 +++++++++-------- drivers/net/ethernet/intel/i40evf/i40evf_ethtool.c | 28 +++++++++++----------- 2 files changed, 26 insertions(+), 24 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_ethtool.c +12 -10
@@ -2305,6 +2305,8 @@ static void i40e_set_itr_per_queue(struct i40e_vsi *vsi, struct ethtool_coalesce *ec, int queue) { +struct i40e_ring *rx_ring = vsi->rx_rings[queue]; +struct i40e_ring *tx_ring = vsi->tx_rings[queue];struct i40e_pf *pf = vsi->back;struct i40e_hw *hw = &pf->hw;struct i40e_q_vector *q_vector;
@@ -2312,26 +2314,26 @@ static void i40e_set_itr_per_queue(struct i40e_vsi *vsi, intrl =i40e_intrl_usec_to_reg (vsi->int_rate_limit); - vsi->rx_rings[queue]->rx_itr_setting = ec->rx_coalesce_usecs; - vsi->tx_rings[queue]->tx_itr_setting = ec->tx_coalesce_usecs; + rx_ring->rx_itr_setting = ec->rx_coalesce_usecs; + tx_ring->tx_itr_setting = ec->tx_coalesce_usecs;if (ec->use_adaptive_rx_coalesce) - vsi->rx_rings[queue]->rx_itr_setting |=I40E_ITR_DYNAMIC ; + rx_ring->rx_itr_setting |=I40E_ITR_DYNAMIC ;else - vsi->rx_rings[queue]->rx_itr_setting &= ~I40E_ITR_DYNAMIC ; + rx_ring->rx_itr_setting &= ~I40E_ITR_DYNAMIC ;if (ec->use_adaptive_tx_coalesce) - vsi->tx_rings[queue]->tx_itr_setting |=I40E_ITR_DYNAMIC ; + tx_ring->tx_itr_setting |=I40E_ITR_DYNAMIC ;else - vsi->tx_rings[queue]->tx_itr_setting &= ~I40E_ITR_DYNAMIC ; + tx_ring->tx_itr_setting &= ~I40E_ITR_DYNAMIC ; - q_vector = vsi->rx_rings[queue]->q_vector; - q_vector->rx.itr =ITR_TO_REG (vsi->rx_rings[queue]->rx_itr_setting); + q_vector = rx_ring->q_vector; + q_vector->rx.itr =ITR_TO_REG (rx_ring->rx_itr_setting); vector = vsi->base_vector + q_vector->v_idx;wr32 (hw,I40E_PFINT_ITRN (I40E_RX_ITR , vector -1 ), q_vector->rx.itr); - q_vector = vsi->tx_rings[queue]->q_vector; - q_vector->tx.itr =ITR_TO_REG (vsi->tx_rings[queue]->tx_itr_setting); + q_vector = tx_ring->q_vector; + q_vector->tx.itr =ITR_TO_REG (tx_ring->tx_itr_setting); vector = vsi->base_vector + q_vector->v_idx;wr32 (hw,I40E_PFINT_ITRN (I40E_TX_ITR , vector -1 ), q_vector->tx.itr);
drivers/net/ethernet/intel/i40evf/i40evf_ethtool.c +14 -14
@@ -512,31 +512,31 @@ static void i40evf_set_itr_per_queue(struct i40evf_adapter *adapter, struct ethtool_coalesce *ec, int queue) { +struct i40e_ring *rx_ring = &adapter->rx_rings[queue]; +struct i40e_ring *tx_ring = &adapter->tx_rings[queue];struct i40e_vsi *vsi = &adapter->vsi;struct i40e_hw *hw = &adapter->hw;struct i40e_q_vector *q_vector;u16 vector; - adapter->rx_rings[queue].rx_itr_setting = ec->rx_coalesce_usecs; - adapter->tx_rings[queue].tx_itr_setting = ec->tx_coalesce_usecs; + rx_ring->rx_itr_setting = ec->rx_coalesce_usecs; + tx_ring->tx_itr_setting = ec->tx_coalesce_usecs; -if (ec->use_adaptive_rx_coalesce) - adapter->rx_rings[queue].rx_itr_setting |=I40E_ITR_DYNAMIC ; -else - adapter->rx_rings[queue].rx_itr_setting &= ~I40E_ITR_DYNAMIC ; + rx_ring->rx_itr_setting |=I40E_ITR_DYNAMIC ; +if (!ec->use_adaptive_rx_coalesce) + rx_ring->rx_itr_setting ^=I40E_ITR_DYNAMIC ; -if (ec->use_adaptive_tx_coalesce) - adapter->tx_rings[queue].tx_itr_setting |=I40E_ITR_DYNAMIC ; -else - adapter->tx_rings[queue].tx_itr_setting &= ~I40E_ITR_DYNAMIC ; + tx_ring->tx_itr_setting |=I40E_ITR_DYNAMIC ; +if (!ec->use_adaptive_tx_coalesce) + tx_ring->tx_itr_setting ^=I40E_ITR_DYNAMIC ; - q_vector = adapter->rx_rings[queue].q_vector; - q_vector->rx.itr =ITR_TO_REG (adapter->rx_rings[queue].rx_itr_setting); + q_vector = rx_ring->q_vector; + q_vector->rx.itr =ITR_TO_REG (rx_ring->rx_itr_setting); vector = vsi->base_vector + q_vector->v_idx;wr32 (hw,I40E_VFINT_ITRN1 (I40E_RX_ITR , vector -1 ), q_vector->rx.itr); - q_vector = adapter->tx_rings[queue].q_vector; - q_vector->tx.itr =ITR_TO_REG (adapter->tx_rings[queue].tx_itr_setting); + q_vector = tx_ring->q_vector; + q_vector->tx.itr =ITR_TO_REG (tx_ring->tx_itr_setting); vector = vsi->base_vector + q_vector->v_idx;wr32 (hw,I40E_VFINT_ITRN1 (I40E_TX_ITR , vector -1 ), q_vector->tx.itr);
Signature · 1 line
2.9.5
Bowers
PATCH 4/13 i40e/i40evf: Use ring pointers to clean up _set_itr_per_queue
Quoted 15 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On Behalf Of Alice Michael
Sent: Wednesday, December 27, 2017 4:33 AM
To: Michael, Alice <[email protected]>; intel-wired-
lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next PATCH S84-V2 04/13] i40e/i40evf: Use ring pointers to clean up_set_itr_per_queueFrom: Alexander Duyck <[email protected]>
This change cleans up the i40e/i40evf_set_itr_per_queue function by dropping all the unneeded pointer chases. Instead we can just pull out the pointers for the Tx and Rx rings and use them throughout the function.
Quoted 6 lines
Signed-off-by Alexander Duyck <[email protected]>--- drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 22 +++++++++-------- drivers/net/ethernet/intel/i40evf/i40evf_ethtool.c | 28 +++++++++++------- ---- 2 files changed, 26 insertions(+), 24 deletions(-)
PATCH 5/13 i40e: Display LLDP information on vSphere Web Client
In reply to Alice MichaelFrom: Menon, Upasana <[email protected]>
This patch enables driver to display LLDP information on the vSphere Web Client with Intel adapters (X710, XL710) and Distributed Virtual Switch.
--- drivers/net/ethernet/intel/i40e/i40e_adminq_cmd.h | 12 ++++++++++ drivers/net/ethernet/intel/i40e/i40e_common.c | 27 ++++++++++++++++++++++ drivers/net/ethernet/intel/i40e/i40e_prototype.h | 4 ++++ .../net/ethernet/intel/i40evf/i40e_adminq_cmd.h | 12 ++++++++++ 4 files changed, 55 insertions(+)
drivers/net/ethernet/intel/i40e/i40e_adminq_cmd.h +12 -0
@@ -205,6 +205,7 @@ enum i40e_admin_queue_opc {/* DCB commands */ i40e_aqc_opc_dcb_ignore_pfc =0x0301 , i40e_aqc_opc_dcb_updated =0x0302 , + i40e_aqc_opc_set_dcb_parameters =0x0303 ,/* TX scheduler */ i40e_aqc_opc_configure_vsi_bw_limit = 0x0400,
@@ -2496,6 +2497,17 @@ struct i40e_aqc_lldp_start {I40E_CHECK_CMD_LENGTH (i40e_aqc_lldp_start); +/* Set DCB (direct 0x0303) */ +struct i40e_aqc_set_dcb_parameters { +u8 command; +#define I40E_AQ_DCB_SET_AGENT 0x1 +#define I40E_DCB_VALID 0x1 +u8 valid_flags; +u8 reserved[14 ]; +}; + +I40E_CHECK_CMD_LENGTH (i40e_aqc_set_dcb_parameters); +/* Get CEE DCBX Oper Config (0x0A07) * uses the generic descriptor struct * returns below as indirect response
drivers/net/ethernet/intel/i40e/i40e_common.c +27 -0
@@ -3641,7 +3641,34 @@ i40e_status i40e_aq_start_lldp(struct i40e_hw *hw,i40e_fill_default_direct_cmd_desc (&desc, i40e_aqc_opc_lldp_start); cmd->command =I40E_AQ_LLDP_AGENT_START ; + status =i40e_asq_send_command (hw, &desc,NULL ,0 , cmd_details); +return status; +} + +/** +* i40e_aq_set_dcb_parameters +* @hw: pointer to the hw struct +* @cmd_details: pointer to command details structure or NULL +* @dcb_enable: True if DCB configuration needs to be applied +* +**/ +enum i40e_status_code +i40e_aq_set_dcb_parameters (struct i40e_hw *hw,bool dcb_enable, +struct i40e_asq_cmd_details *cmd_details) +{ +struct i40e_aq_desc desc; +struct i40e_aqc_set_dcb_parameters *cmd = + (struct i40e_aqc_set_dcb_parameters *)&desc.params.raw; +i40e_status status; + +i40e_fill_default_direct_cmd_desc (&desc, + i40e_aqc_opc_set_dcb_parameters); + +if (dcb_enable) { + cmd->valid_flags =I40E_DCB_VALID ; + cmd->command =I40E_AQ_DCB_SET_AGENT ; + } status =i40e_asq_send_command (hw, &desc,NULL ,0 , cmd_details);return status;
drivers/net/ethernet/intel/i40e/i40e_prototype.h +4 -0
@@ -225,6 +225,10 @@ i40e_status i40e_aq_cfg_lldp_mib_change_event(struct i40e_hw *hw, struct i40e_asq_cmd_details *cmd_details);i40e_status i40e_aq_stop_lldp (struct i40e_hw *hw,bool shutdown_agent,struct i40e_asq_cmd_details *cmd_details); +i40e_status i40e_aq_set_dcb_parameters (struct i40e_hw *hw, +bool dcb_enable, +struct i40e_asq_cmd_details + *cmd_details);i40e_status i40e_aq_start_lldp (struct i40e_hw *hw,struct i40e_asq_cmd_details *cmd_details); i40e_status i40e_aq_get_cee_dcb_config(struct i40e_hw *hw,
drivers/net/ethernet/intel/i40evf/i40e_adminq_cmd.h +12 -0
@@ -205,6 +205,7 @@ enum i40e_admin_queue_opc {/* DCB commands */ i40e_aqc_opc_dcb_ignore_pfc =0x0301 , i40e_aqc_opc_dcb_updated =0x0302 , + i40e_aqc_opc_set_dcb_parameters =0x0303 ,/* TX scheduler */ i40e_aqc_opc_configure_vsi_bw_limit = 0x0400,
@@ -2461,6 +2462,17 @@ struct i40e_aqc_lldp_start {I40E_CHECK_CMD_LENGTH (i40e_aqc_lldp_start); +/* Set DCB (direct 0x0303) */ +struct i40e_aqc_set_dcb_parameters { +u8 command; +#define I40E_AQ_DCB_SET_AGENT 0x1 +#define I40E_DCB_VALID 0x1 +u8 valid_flags; +u8 reserved[14 ]; +}; + +I40E_CHECK_CMD_LENGTH (i40e_aqc_set_dcb_parameters); +/* Apply MIB changes (0x0A07) * uses the generic struc as it contains no data */
Signature · 1 line
2.9.5
Bowers
PATCH 5/13 i40e: Display LLDP information on vSphere Web Client
Quoted 15 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On Behalf Of Alice Michael
Sent: Wednesday, December 27, 2017 4:33 AM
To: Michael, Alice <[email protected]>; intel-wired- lan at lists.osuosl.org
Cc: Menon, Upasana <[email protected]>; Menon at osuosl.org
Subject: [Intel-wired-lan] [next PATCH S84-V2 05/13] i40e: Display LLDP information on vSphere Web ClientFrom: Menon, Upasana <[email protected]>
This patch enables driver to display LLDP information on the vSphere Web Client with Intel adapters (X710, XL710) and Distributed Virtual Switch.
Quoted 8 lines
Signed-off-by Menon, Upasana <[email protected]>--- drivers/net/ethernet/intel/i40e/i40e_adminq_cmd.h | 12 ++++++++++ drivers/net/ethernet/intel/i40e/i40e_common.c | 27 ++++++++++++++++++++++ drivers/net/ethernet/intel/i40e/i40e_prototype.h | 4 ++++ .../net/ethernet/intel/i40evf/i40e_adminq_cmd.h | 12 ++++++++++ 4 files changed, 55 insertions(+)
PATCH 6/13 i40e: change flags to use 64 bits
In reply to Alice MichaelAs we have added more flags, we need to now use more bits and have overflooded the 32 bit size. So make it 64.
also change all the existing bits to unsigned long long bits.
--- drivers/net/ethernet/intel/i40e/i40e.h | 67 +++++++++++++------------- drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 4 +- 2 files changed, 36 insertions(+), 35 deletions(-)
drivers/net/ethernet/intel/i40e/i40e.h +34 -33
@@ -508,39 +508,40 @@ struct i40e_pf {#define I40E_HW_PORT_ID_VALID BIT(17)#define I40E_HW_RESTART_AUTONEG BIT(18) -u32 flags; -#define I40E_FLAG_RX_CSUM_ENABLED BIT(0) -#define I40E_FLAG_MSI_ENABLED BIT(1) -#define I40E_FLAG_MSIX_ENABLED BIT(2) -#define I40E_FLAG_RSS_ENABLED BIT(3) -#define I40E_FLAG_VMDQ_ENABLED BIT(4) -#define I40E_FLAG_FILTER_SYNC BIT(5) -#define I40E_FLAG_SRIOV_ENABLED BIT(6) -#define I40E_FLAG_DCB_CAPABLE BIT(7) -#define I40E_FLAG_DCB_ENABLED BIT(8) -#define I40E_FLAG_FD_SB_ENABLED BIT(9) -#define I40E_FLAG_FD_ATR_ENABLED BIT(10) -#define I40E_FLAG_FD_SB_AUTO_DISABLED BIT(11) -#define I40E_FLAG_FD_ATR_AUTO_DISABLED BIT(12) -#define I40E_FLAG_MFP_ENABLED BIT(13) -#define I40E_FLAG_UDP_FILTER_SYNC BIT(14) -#define I40E_FLAG_HW_ATR_EVICT_ENABLED BIT(15) -#define I40E_FLAG_VEB_MODE_ENABLED BIT(16) -#define I40E_FLAG_VEB_STATS_ENABLED BIT(17) -#define I40E_FLAG_LINK_POLLING_ENABLED BIT(18) -#define I40E_FLAG_TRUE_PROMISC_SUPPORT BIT(19) -#define I40E_FLAG_TEMP_LINK_POLLING BIT(20) -#define I40E_FLAG_LEGACY_RX BIT(21) -#define I40E_FLAG_PTP BIT(22) -#define I40E_FLAG_IWARP_ENABLED BIT(23) -#define I40E_FLAG_SERVICE_CLIENT_REQUESTED BIT(24) -#define I40E_FLAG_CLIENT_L2_CHANGE BIT(25) -#define I40E_FLAG_CLIENT_RESET BIT(26) -#define I40E_FLAG_LINK_DOWN_ON_CLOSE_ENABLED BIT(27) -#define I40E_FLAG_SOURCE_PRUNING_DISABLED BIT(28) -#define I40E_FLAG_TC_MQPRIO BIT(29) -#define I40E_FLAG_FD_SB_INACTIVE BIT(30) -#define I40E_FLAG_FD_SB_TO_CLOUD_FILTER BIT(31) +u64 flags; +#define I40E_FLAG_RX_CSUM_ENABLED BIT_ULL(0) +#define I40E_FLAG_MSI_ENABLED BIT_ULL(1) +#define I40E_FLAG_MSIX_ENABLED BIT_ULL(2) +#define I40E_FLAG_RSS_ENABLED BIT_ULL(3) +#define I40E_FLAG_VMDQ_ENABLED BIT_ULL(4) +#define I40E_FLAG_FILTER_SYNC BIT_ULL(5) +#define I40E_FLAG_SRIOV_ENABLED BIT_ULL(6) +#define I40E_FLAG_DCB_CAPABLE BIT_ULL(7) +#define I40E_FLAG_DCB_ENABLED BIT_ULL(8) +#define I40E_FLAG_FD_SB_ENABLED BIT_ULL(9) +#define I40E_FLAG_FD_ATR_ENABLED BIT_ULL(10) +#define I40E_FLAG_FD_SB_AUTO_DISABLED BIT_ULL(11) +#define I40E_FLAG_FD_ATR_AUTO_DISABLED BIT_ULL(12) +#define I40E_FLAG_MFP_ENABLED BIT_ULL(13) +#define I40E_FLAG_UDP_FILTER_SYNC BIT_ULL(14) +#define I40E_FLAG_HW_ATR_EVICT_ENABLED BIT_ULL(15) +#define I40E_FLAG_VEB_MODE_ENABLED BIT_ULL(16) +#define I40E_FLAG_VEB_STATS_ENABLED BIT_ULL(17) +#define I40E_FLAG_LINK_POLLING_ENABLED BIT_ULL(18) +#define I40E_FLAG_TRUE_PROMISC_SUPPORT BIT_ULL(19) +#define I40E_FLAG_TEMP_LINK_POLLING BIT_ULL(20) +#define I40E_FLAG_LEGACY_RX BIT_ULL(21) +#define I40E_FLAG_PTP BIT_ULL(22) +#define I40E_FLAG_IWARP_ENABLED BIT_ULL(23) +#define I40E_FLAG_SERVICE_CLIENT_REQUESTED BIT_ULL(24) +#define I40E_FLAG_CLIENT_L2_CHANGE BIT_ULL(25) +#define I40E_FLAG_CLIENT_RESET BIT_ULL(26) +#define I40E_FLAG_LINK_DOWN_ON_CLOSE_ENABLED BIT_ULL(27) +#define I40E_FLAG_SOURCE_PRUNING_DISABLED BIT_ULL(28) +#define I40E_FLAG_TC_MQPRIO BIT_ULL(29) +#define I40E_FLAG_FD_SB_INACTIVE BIT_ULL(30) +#define I40E_FLAG_FD_SB_TO_CLOUD_FILTER BIT_ULL(31) +#define I40E_FLAG_DISABLE_FW_LLDP BIT_ULL(32)struct i40e_client_instance *cinst;bool stat_offsets_loaded;
drivers/net/ethernet/intel/i40e/i40e_ethtool.c +2 -2
@@ -4266,7 +4266,7 @@ static int i40e_set_priv_flags(struct net_device *dev, u32 flags)struct i40e_netdev_priv *np =netdev_priv (dev);struct i40e_vsi *vsi = np->vsi;struct i40e_pf *pf = vsi->back; -u32 orig_flags, new_flags, changed_flags; +u64 orig_flags, new_flags, changed_flags;u32 i, j; orig_flags =READ_ONCE (pf->flags);
@@ -4323,7 +4323,7 @@ static int i40e_set_priv_flags(struct net_device *dev, u32 flags)* originally. We'll just punt with an error and log something in the * message buffer. */ -if (cmpxchg (&pf->flags, orig_flags, new_flags) != orig_flags) { +if (cmpxchg64 (&pf->flags, orig_flags, new_flags) != orig_flags) {dev_warn (&pf->pdev->dev,"Unable to update pf->flags as it was modified by another thread...\n" );return -EAGAIN ;
Signature · 1 line
2.9.5
PATCH 7/13 i40e: Implement an ethtool private flag to stop LLDP in FW
In reply to Alice MichaelFrom: Dave Ertman <[email protected]>
Implement the private flag disable-fw-lldp for ethtool to disable the processing of LLDP packets by the FW. This will stop the FW from consuming LLDPDU and cause them to be sent up the stack.
The FW is also being configured to apply a default DCB configuration on link up.
Toggling the value of this flag will also cause a PF reset.
Disabling FW DCB will also disable DCBX.
--- drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 47 +++++++++++++++++++++++++- drivers/net/ethernet/intel/i40e/i40e_main.c | 14 ++++++-- 2 files changed, 58 insertions(+), 3 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_ethtool.c +46 -1
@@ -235,6 +235,7 @@ static const struct i40e_priv_flags i40e_gstrings_priv_flags[] = {I40E_PRIV_FLAG ("legacy-rx" ,I40E_FLAG_LEGACY_RX ,0 ),I40E_PRIV_FLAG ("disable-source-pruning" ,I40E_FLAG_SOURCE_PRUNING_DISABLED ,0 ), + I40E_PRIV_FLAG("disable-fw-lldp", I40E_FLAG_DISABLE_FW_LLDP, 0), };#define I40E_PRIV_FLAGS_STR_LEN ARRAY_SIZE(i40e_gstrings_priv_flags)
@@ -4317,6 +4318,25 @@ static int i40e_set_priv_flags(struct net_device *dev, u32 flags) !(pf->hw_features & I40E_HW_ATR_EVICT_CAPABLE))return -EOPNOTSUPP ; +/* Disable FW LLDP not supported if NPAR active or if FW +* API version < 1.7 +*/ +if (new_flags &I40E_FLAG_DISABLE_FW_LLDP ) { +if (pf->hw.func_caps.npar_enable) { +dev_warn (&pf->pdev->dev, +"Unable to stop FW LLDP if NPAR active\n" ); +return -EOPNOTSUPP ; + } + +if (pf->hw.aq.api_maj_ver <1 || + (pf->hw.aq.api_maj_ver ==1 && + pf->hw.aq.api_min_ver <7 )) { +dev_warn (&pf->pdev->dev, +"FW ver does not support stopping FW LLDP\n" ); +return -EOPNOTSUPP ; + } + } +/* Compare and exchange the new flags into place. If we failed, that * is if cmpxchg returns anything but the old value, this means that * something else has modified the flags variable since we copied it
@@ -4362,12 +4382,37 @@ static int i40e_set_priv_flags(struct net_device *dev, u32 flags) } } +if (changed_flags &I40E_FLAG_DISABLE_FW_LLDP ) { +if (pf->flags &I40E_FLAG_DISABLE_FW_LLDP ) { +struct i40e_dcbx_config *dcbcfg; +int i; + +i40e_aq_stop_lldp (&pf->hw, true,NULL ); +i40e_aq_set_dcb_parameters (&pf->hw, true,NULL ); +/* reset local_dcbx_config to default */ + dcbcfg = &pf->hw.local_dcbx_config; + dcbcfg->etscfg.willing =1 ; + dcbcfg->etscfg.maxtcs =0 ; + dcbcfg->etscfg.tcbwtable[0 ] =100 ; +for (i =1 ; i <I40E_MAX_TRAFFIC_CLASS ; i++) + dcbcfg->etscfg.tcbwtable[i] =0 ; +for (i =0 ; i <I40E_MAX_USER_PRIORITY ; i++) + dcbcfg->etscfg.prioritytable[i] =0 ; + dcbcfg->etscfg.tsatable[0 ] =I40E_IEEE_TSA_ETS ; + dcbcfg->pfc.willing =1 ; + dcbcfg->pfc.pfccap =I40E_MAX_TRAFFIC_CLASS ; + }else { +i40e_aq_start_lldp (&pf->hw,NULL ); + } + } +/* Issue reset to cause things to take effect, as additional bits * are added we will need to create a mask of bits requiring reset */ if (changed_flags & (I40E_FLAG_VEB_STATS_ENABLED |I40E_FLAG_LEGACY_RX | -I40E_FLAG_SOURCE_PRUNING_DISABLED )) +I40E_FLAG_SOURCE_PRUNING_DISABLED | +I40E_FLAG_DISABLE_FW_LLDP ))i40e_do_reset (pf,BIT (__I40E_PF_RESET_REQUESTED), true);return 0 ;
drivers/net/ethernet/intel/i40e/i40e_main.c +12 -2
@@ -6305,8 +6305,11 @@ static int i40e_init_pf_dcb(struct i40e_pf *pf)struct i40e_hw *hw = &pf->hw;int err =0 ; -/* Do not enable DCB for SW1 and SW2 images even if the FW is capable */ -if (pf->hw_features &I40E_HW_NO_DCB_SUPPORT ) +/* Do not enable DCB for SW1 and SW2 images even if the FW is capable +* Also do not enable DCBx if FW LLDP agent is disabled +*/ +if ((pf->hw_features &I40E_HW_NO_DCB_SUPPORT ) || + (pf->flags &I40E_FLAG_DISABLE_FW_LLDP )) goto out;/* Get the initial DCB configuration */
@@ -9266,6 +9269,9 @@ static void i40e_rebuild(struct i40e_pf *pf, bool reinit, bool lock_acquired) goto end_core_reset; } +/* Enable FW to write a default DCB config on link-up */ +i40e_aq_set_dcb_parameters (hw, true,NULL ); +#ifdef CONFIG_I40E_DCB ret =i40e_init_pf_dcb (pf);if (ret) {
@@ -13589,6 +13595,10 @@ static int i40e_probe(struct pci_dev *pdev, const struct pci_device_id *ent)pci_set_drvdata (pdev, pf);pci_save_state (pdev); + +/* Enable FW to write default DCB config on link-up */ +i40e_aq_set_dcb_parameters (hw, true,NULL ); +#ifdef CONFIG_I40E_DCB err =i40e_init_pf_dcb (pf);if (err) {
Signature · 1 line
2.9.5
PATCH 8/13 i40e: fix FW_LLDP flag on init
In reply to Alice MichaelFrom: Alan Brady <[email protected]>
Using ethtool --set-priv-flags disable-fw-lldp <on/off> is persistent across reboots/reloads so we need some mechanism in the driver to detect if it's on or off on init so we can set the ethtool private flag appropriately. Without this, every time the driver is reloaded the flag will default to off regardless of whether it's on or off in FW.
We detect this by first attempting to program DCB and if AQ fails returning I40E_AQ_RC_EPERM, we know that LLDP is disabled in FW.
--- drivers/net/ethernet/intel/i40e/i40e_main.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/ethernet/intel/i40e/i40e_main.c +3 -0
@@ -6336,6 +6336,9 @@ static int i40e_init_pf_dcb(struct i40e_pf *pf)dev_dbg (&pf->pdev->dev,"DCBX offload is supported for this PF.\n" ); } + }else if (pf->hw.aq.asq_last_status ==I40E_AQ_RC_EPERM ) { +dev_info (&pf->pdev->dev,"FW LLDP disabled for this PF.\n" ); + pf->flags |=I40E_FLAG_DISABLE_FW_LLDP ; }else { dev_info(&pf->pdev->dev, "Query for DCB configuration failed, err %s aq_err %s\n",
Signature · 1 line
2.9.5
PATCH 9/13 i40e: Fix compilation issue with DPDK
In reply to Alice MichaelFrom: Jeff Kirsher <[email protected]>
When using GCC 6.3.0 and EXTRA_CFLAGS=-Og, the compiler is not smart enough to see that when you have an integrated VF that just one of the if statemets has to be true so that ntu is always set. Fix the way that the code is for integrated VFs so that the compiler won't complain.
--- drivers/net/ethernet/intel/i40e/i40e_adminq.c | 2 +- drivers/net/ethernet/intel/i40evf/i40e_adminq.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_adminq.c +1 -1
@@ -976,7 +976,7 @@ i40e_status i40e_clean_arq_element(struct i40e_hw *hw, }/* set next_to_use to head */ - ntu = (rd32 (hw, hw->aq.arq.head) &I40E_PF_ARQH_ARQH_MASK ); + ntu =rd32 (hw, hw->aq.arq.head) &I40E_PF_ARQH_ARQH_MASK ;if (ntu == ntc) {/* nothing to do - shouldn't need to update ring's values */ ret_code =I40E_ERR_ADMIN_QUEUE_NO_WORK ;
drivers/net/ethernet/intel/i40evf/i40e_adminq.c +1 -1
@@ -906,7 +906,7 @@ i40e_status i40evf_clean_arq_element(struct i40e_hw *hw, }/* set next_to_use to head */ - ntu = (rd32 (hw, hw->aq.arq.head) &I40E_VF_ARQH1_ARQH_MASK ); + ntu =rd32 (hw, hw->aq.arq.head) &I40E_VF_ARQH1_ARQH_MASK ;if (ntu == ntc) {/* nothing to do - shouldn't need to update ring's values */ ret_code =I40E_ERR_ADMIN_QUEUE_NO_WORK ;
Signature · 1 line
2.9.5
PATCH 10/13 i40e: Fix kdump failure
In reply to Alice MichaelFrom: Avinash Dayanand <[email protected]>
kdump fails in the system when used in conjunction with Ethernet driver X722/X710. This is mainly because when we are resource constrained i.e. when we have just one online_cpus, we are enabling VMDq and iWARP. It doesn't make sense to enable them with just one cpu and starve kdump for lack of IRQs.
So don't enable VMDq or iWARP when we just have a single cpu.
--- 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
@@ -11115,13 +11115,13 @@ static int i40e_sw_init(struct i40e_pf *pf) pf->hw.aq.fw_maj_ver >= 6) pf->hw_features |=I40E_HW_PTP_L4_CAPABLE ; -if (pf->hw.func_caps.vmdq) { +if (pf->hw.func_caps.vmdq &&num_online_cpus () !=1 ) { pf->num_vmdq_vsis =I40E_DEFAULT_NUM_VMDQ_VSI ; pf->flags |=I40E_FLAG_VMDQ_ENABLED ; pf->num_vmdq_qps =i40e_default_queues_per_vmdq (pf); } -if (pf->hw.func_caps.iwarp) { +if (pf->hw.func_caps.iwarp &&num_online_cpus () !=1 ) { pf->flags |=I40E_FLAG_IWARP_ENABLED ;/* IWARP needs one extra vector for CQP just like MISC.*/ pf->num_iwarp_msix = (int )num_online_cpus () +1 ;
Signature · 1 line
2.9.5
PATCH 11/13 i40e: program fragmented IPv4 filter input set
In reply to Alice MichaelFrom: Jacob Keller <[email protected]>
When implementing support for IP_USER_FLOW filters, we correctly programmed a filter for both the non fragmented IPv4/Other filter, as well as the fragmented IPv4 filters. However, we did not properly program the input set for fragmented IPv4 PCTYPE. This meant that the filters would almost certainly not match, unless the user specified all of the flow types.
Add support to program the fragmented IPv4 filter input set. Since we always program these filters together, we'll assume that the two input sets must match, and will thus always program the input sets to the same value.
--- drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 10 ++++++++++ drivers/net/ethernet/intel/i40e/i40e_main.c | 3 +++ 2 files changed, 13 insertions(+)
drivers/net/ethernet/intel/i40e/i40e_ethtool.c +10 -0
@@ -3809,6 +3809,16 @@ static int i40e_check_fdir_input_set(struct i40e_vsi *vsi,i40e_write_fd_input_set (pf, index, new_mask); +/* IP_USER_FLOW filters match both IPv4/Other and IPv4/Fragmented +* frames. If we're programming the input set for IPv4/Other, we also +* need to program the IPv4/Fragmented input set. Since we don't have +* separate support, we'll always assume and enforce that the two flow +* types must have matching input sets. +*/ +if (index ==I40E_FILTER_PCTYPE_NONF_IPV4_OTHER ) +i40e_write_fd_input_set (pf,I40E_FILTER_PCTYPE_FRAG_IPV4 , + new_mask); +/* Add the new offset and update table, if necessary */ if (new_flex_offset) { err = i40e_add_flex_offset(&pf->l4_flex_pit_list, src_offset,
drivers/net/ethernet/intel/i40e/i40e_main.c +3 -0
@@ -7736,6 +7736,9 @@ static void i40e_fdir_filter_exit(struct i40e_pf *pf)/* Reprogram the default input set for Other/IPv4 */ i40e_write_fd_input_set (pf,I40E_FILTER_PCTYPE_NONF_IPV4_OTHER ,I40E_L3_SRC_MASK |I40E_L3_DST_MASK ); + +i40e_write_fd_input_set (pf,I40E_FILTER_PCTYPE_FRAG_IPV4 , +I40E_L3_SRC_MASK |I40E_L3_DST_MASK ); }/**
Signature · 1 line
2.9.5
PATCH 12/13 i40e: disallow programming multiple filters with same criteria
In reply to Alice MichaelFrom: Jacob Keller <[email protected]>
Our hardware does not allow situations where two filters might conflict when matching. Essentially hardware only programs one filter for each set of matching criteria. We don't support filters with overlapping input sets, because each flow type can only use a single input set.
Additionally, different flow types will never have overlapping matches, because of how the hardware parses the flow type before checking matching criteria.
For this reason, we do not need or use the location number when programming filters to hardware.
In order to avoid confusing scenarios with filters that match the same criteria but program the flow to different queues, do not allow multiple filters that match identical criteria to be programmed.
This ensures that we avoid odd scenarios when deleting filters, and when programming new filters that match the same criteria.
Instead, users that wish to update the criteria for a filter must use the same location id, or must delete all the matching filters first.
--- drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 87 ++++++++++++++++++++++++++ 1 file changed, 87 insertions(+)
drivers/net/ethernet/intel/i40e/i40e_ethtool.c +87 -0
@@ -3841,6 +3841,87 @@ static int i40e_check_fdir_input_set(struct i40e_vsi *vsi, }/** +* i40e_match_fdir_filter - Return true of two filters match +* @a: pointer to filter struct +* @b: pointer to filter struct +* +* Returns true if the two filters match exactly the same criteria. I.e. they +* match the same flow type and have the same parameters. We don't need to +* check any input-set since all filters of the same flow type must use the +* same input set. +**/ +static bool i40e_match_fdir_filter (struct i40e_fdir_filter *a, +struct i40e_fdir_filter *b) +{ +/* The filters do not much if any of these criteria differ. */ +if (a->dst_ip != b->dst_ip || + a->src_ip != b->src_ip || + a->dst_port != b->dst_port || + a->src_port != b->src_port || + a->flow_type != b->flow_type || + a->ip4_proto != b->ip4_proto) +return false; + +return true; +} + +/** +* i40e_disallow_matching_filters - Check that new filters differ +* @vsi: pointer to the targeted VSI +* @input: new filter to check +* +* Due to hardware limitations, it is not possible for two filters that match +* similar criteria to be programmed at the same time. This is true for a few +* reasons: +* +* (a) all filters matching a particular flow type must use the same input +* set, that is they must match the same criteria. +* (b) different flow types will never match the same packet, as the flow type +* is decided by hardware before checking which rules apply. +* (c) hardware has no way to distinguish which order filters apply in. +* +* Due to this, we can't really support using the location data to order +* filters in the hardware parsing. It is technically possible for the user to +* request two filters matching the same criteria but which select different +* queues. In this case, rather than keep both filters in the list, we reject +* the 2nd filter when the user requests adding it. +* +* This avoids needing to track location for programming the filter to +* hardware, and ensures that we avoid some strange scenarios involving +* deleting filters which match the same criteria. +**/ +static int i40e_disallow_matching_filters (struct i40e_vsi *vsi, +struct i40e_fdir_filter *input) +{ +struct i40e_pf *pf = vsi->back; +struct i40e_fdir_filter *rule; +struct hlist_node *node2; + +/* Loop through every filter, and check that it doesn't match */ +hlist_for_each_entry_safe (rule, node2, + &pf->fdir_filter_list, fdir_node) { +/* Don't check the filters match if they share the same fd_id, +* since the new filter is actually just updating the target +* of the old filter. +*/ +if (rule->fd_id == input->fd_id) +continue ; + +/* If any filters match, then print a warning message to the +* kernel message buffer and bail out. +*/ +if (i40e_match_fdir_filter (rule, input)) { +dev_warn (&pf->pdev->dev, +"Existing user defined filter %d already matches this flow.\n" , + rule->fd_id); +return -EINVAL ; + } + } + +return 0 ; +} + +/** * i40e_add_fdir_ethtool - Add/Remove Flow Director filters * @vsi: pointer to the targeted VSI * @cmd: command to get or set RX flow classification rules
@@ -3952,6 +4033,11 @@ static int i40e_add_fdir_ethtool(struct i40e_vsi *vsi, input->flex_offset = userdef.flex_offset; } +/* Avoid programming two filters with identical match criteria. */ + ret =i40e_disallow_matching_filters (vsi, input); +if (ret) + goto free_filter_memory; +/* Add the input filter to the fdir_input_list, possibly replacing * a previous filter. Do not free the input structure after adding it * to the list as this would cause a use-after-free bug.
@@ -3965,6 +4051,7 @@ static int i40e_add_fdir_ethtool(struct i40e_vsi *vsi, remove_sw_rule:hlist_del (&input->fdir_node); pf->fdir_pf_active_filters--; +free_filter_memory:kfree (input);return ret; }
Signature · 1 line
2.9.5
PATCH 13/13 i40e: fix reported mask for ntuple filters
In reply to Alice MichaelFrom: Jacob Keller <[email protected]>
In commit 36777d9fa24c ("i40e: check current configured input set when adding ntuple filters") some code was added to report the input set mask for a given filter when reporting it to the user.
This code is necessary so that the reported filter correctly displays that it is or is not masking certain fields.
Unfortunately the code was incorrect. Development error accidentally swapped the mask values for the IPv4 addresses with the L4 port numbers. The port numbers are only 16bits wide while IPv4 addresses are 32 bits. Unfortunately we assigned only 16 bits to the IPv4 address masks. Additionally we assigned 32bit value 0xFFFFFFF to the TCP port numbers. This second part does not matter as the value would be truncated to 16bits regardless, but it is unnecessary.
Fix the reported masks to properly report that the entire field is masked.
Testing-hints:
Upstream commit message will need to reword to target the equivalent upstream commit for the "Fixes" line.
--- drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_ethtool.c +4 -4
@@ -2749,16 +2749,16 @@ static int i40e_get_ethtool_fdir_entry(struct i40e_pf *pf, no_input_set:if (input_set &I40E_L3_SRC_MASK ) - fsp->m_u.tcp_ip4_spec.ip4src =htonl (0xFFFF ); + fsp->m_u.tcp_ip4_spec.ip4src =htonl (0xFFFFFFFF );if (input_set &I40E_L3_DST_MASK ) - fsp->m_u.tcp_ip4_spec.ip4dst =htonl (0xFFFF ); + fsp->m_u.tcp_ip4_spec.ip4dst =htonl (0xFFFFFFFF );if (input_set &I40E_L4_SRC_MASK ) - fsp->m_u.tcp_ip4_spec.psrc =htons (0xFFFFFFFF ); + fsp->m_u.tcp_ip4_spec.psrc =htons (0xFFFF );if (input_set &I40E_L4_DST_MASK ) - fsp->m_u.tcp_ip4_spec.pdst =htons (0xFFFFFFFF ); + fsp->m_u.tcp_ip4_spec.pdst =htons (0xFFFF );if (rule->dest_ctl ==I40E_FILTER_PROGRAM_DESC_DEST_DROP_PACKET ) fsp->ring_cookie =RX_CLS_FLOW_DISC ;
Signature · 1 line
2.9.5