i40e: Check and correct speed values for link on open
Subsystems (2)
PATCH 1/9 i40e: Check and correct speed values for link on open
From: Jan Sokolowski <[email protected]>
If our card has been put in an unstable state due to other drivers interacting with it, speed settings might be incorrect. If incorrect, forcefully reset them on open to known default values.
--- drivers/net/ethernet/intel/i40e/i40e_main.c | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_main.c +24 -3
@@ -6622,6 +6622,24 @@ static i40e_status i40e_force_link_state(struct i40e_pf *pf, bool is_up)struct i40e_hw *hw = &pf->hw;i40e_status err;u64 mask; +u8 speed; + +/* Card might've been put in an unstable state by other drivers +* and applications, which causes incorrect speed values being +* set on startup. In order to clear speed registers, we call +* get_phy_capabilities twice, once to get initial state of +* available speeds, and once to get current phy config. +*/ + err =i40e_aq_get_phy_capabilities (hw, false, true, &abilities, +NULL ); +if (err) { +dev_err (&pf->pdev->dev, +"failed to get phy cap., ret = %s last_status = %s\n" , +i40e_stat_str (hw, err), +i40e_aq_str (hw, hw->aq.asq_last_status)); +return err; + } + speed = abilities.link_speed;/* Get the current phy config */ err = i40e_aq_get_phy_capabilities(hw, false, false, &abilities,
@@ -6635,9 +6653,9 @@ static i40e_status i40e_force_link_state(struct i40e_pf *pf, bool is_up) }/* If link needs to go up, but was not forced to go down, -* no need for a flap +* and its speed values are OK, no need for a flap */ -if (is_up && abilities.phy_type !=0 ) +if (is_up && abilities.phy_type !=0 && abilities.link_speed !=0 )return I40E_SUCCESS ;/* To force link we need to set bits for all supported PHY types,
@@ -6649,7 +6667,10 @@ static i40e_status i40e_force_link_state(struct i40e_pf *pf, bool is_up) config.phy_type_ext = is_up ? (u8)((mask >>32 ) &0xff ) :0 ;/* Copy the old settings, except of phy_type */ config.abilities = abilities.abilities; - config.link_speed = abilities.link_speed; +if (abilities.link_speed !=0 ) + config.link_speed = abilities.link_speed; +else + config.link_speed = speed; config.eee_capability = abilities.eee_capability; config.eeer = abilities.eeer_val; config.low_power_ctrl = abilities.d3_lpan;
Signature · 1 line
2.9.5
PATCH 2/9 i40evf: Don't enable vlan stripping when rx offload is turned on
From: Patryk Ma?ek <[email protected]>
With current implementation of i40evf_set_features when user sets any offload via ethtool we set I40EVF_FLAG_AQ_ENABLE_VLAN_STRIPPING as a required aq which triggers driver to call i40evf_enable_vlan_stripping. This shouldn't take place. This patches fixes it by setting the flag only when vlan offload is turned on.
--- drivers/net/ethernet/intel/i40evf/i40evf_main.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
drivers/net/ethernet/intel/i40evf/i40evf_main.c +6 -5
@@ -3120,18 +3120,19 @@ static int i40evf_set_features(struct net_device *netdev, {struct i40evf_adapter *adapter =netdev_priv (netdev); -/* Don't allow changing VLAN_RX flag when VLAN is set for VF -* and return an error in this case +/* Don't allow changing VLAN_RX flag when adapter is not capable +* of VLAN offload */ -if (VLAN_ALLOWED (adapter)) { +if (!VLAN_ALLOWED (adapter)) { +if ((netdev->features ^ features) &NETIF_F_HW_VLAN_CTAG_RX ) +return -EINVAL ; + }else if ((netdev->features ^ features) &NETIF_F_HW_VLAN_CTAG_RX ) {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 ; }return 0 ;
Signature · 1 line
2.9.5
Bowers
PATCH 2/9 i40evf: Don't enable vlan stripping when rx offload is turned on
Quoted 17 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On Behalf Of Alice Michael
Sent: Tuesday, August 28, 2018 10:16 AM
To: Michael, Alice <[email protected]>; intel-wired- lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next PATCH S96 2/9] i40evf: Don't enable vlan stripping when rx offload is turned onFrom: Patryk Ma?ek <[email protected]>
With current implementation of
i40evf_set_featureswhen user sets any offload via ethtool we setI40EVF_FLAG_AQ_ENABLE_VLAN_STRIPPINGas a required aq which triggers driver to calli40evf_enable_vlan_stripping. This shouldn't take place.
This patches fixes it by setting the flag only when vlan offload is turned on.
Quoted 4 lines
Signed-off-by Patryk Ma?ek <[email protected]>--- drivers/net/ethernet/intel/i40evf/i40evf_main.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
PATCH 3/9 i40e: hold the rtnl lock on clearing interrupt scheme
In reply to Alice MichaelFrom: Patryk Ma?ek <[email protected]>
Hold the rtnl lock when we're clearing interrupt scheme in i40e_shutdown and in i40e_remove.
--- drivers/net/ethernet/intel/i40e/i40e_main.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/net/ethernet/intel/i40e/i40e_main.c +8 -0
@@ -14726,6 +14726,7 @@ static void i40e_remove(struct pci_dev *pdev)free_irq (pf->pdev->irq, pf);/* Clear all dynamic memory lists of rings, q_vectors, and VSIs */ +rtnl_lock ();i40e_clear_interrupt_scheme (pf);for (i =0 ; i < pf->num_alloc_vsi; i++) {if (pf->vsi[i]) {
@@ -14735,6 +14736,7 @@ static void i40e_remove(struct pci_dev *pdev) pf->vsi[i] =NULL ; } } +rtnl_unlock ();/* shutdown the adminq */ i40e_shutdown_adminq (hw);
@@ -14963,7 +14965,13 @@ static void i40e_shutdown(struct pci_dev *pdev) !(pf->flags & I40E_FLAG_MSIX_ENABLED))free_irq (pf->pdev->irq, pf); +/* Since we're going to destroy queues during the +* i40e_clear_interrupt_scheme() we should hold the RTNL lock for this +* whole section +*/ +rtnl_lock ();i40e_clear_interrupt_scheme (pf); +rtnl_unlock ();if (system_state ==SYSTEM_POWER_OFF ) {pci_wake_from_d3 (pdev, pf->wol_en);
Signature · 1 line
2.9.5
Bowers
PATCH 3/9 i40e: hold the rtnl lock on clearing interrupt scheme
Quoted 11 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On Behalf Of Alice Michael
Sent: Tuesday, August 28, 2018 10:16 AM
To: Michael, Alice <[email protected]>; intel-wired-
lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next PATCH S96 3/9] i40e: hold the rtnl lock on clearing interrupt schemeFrom: Patryk Ma?ek <[email protected]>
Quoted 7 lines
Hold the rtnl lock when we're clearing interrupt scheme in
i40e_shutdownand ini40e_remove.Signed-off-by Patryk Ma?ek <[email protected]>--- drivers/net/ethernet/intel/i40e/i40e_main.c | 8 ++++++++ 1 file changed, 8 insertions(+)
PATCH 4/9 i40e: use declared variables for pf and hw
In reply to Alice MichaelFrom: Patryk Ma?ek <[email protected]>
In order to slightly simplify the code use the variables for pf and hw that are declared in i40e_set_mac function.
--- drivers/net/ethernet/intel/i40e/i40e_main.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_main.c +4 -5
@@ -1537,8 +1537,8 @@ static int i40e_set_mac(struct net_device *netdev, void *p)return 0 ; } -if (test_bit (__I40E_VSI_DOWN, vsi->back->state) || -test_bit (__I40E_RESET_RECOVERY_PENDING, vsi->back->state)) +if (test_bit (__I40E_DOWN, pf->state) || +test_bit (__I40E_RESET_RECOVERY_PENDING, pf->state))return -EADDRNOTAVAIL ;if (ether_addr_equal (hw->mac.addr, addr->sa_data))
@@ -1562,8 +1562,7 @@ static int i40e_set_mac(struct net_device *netdev, void *p)if (vsi->type ==I40E_VSI_MAIN ) {i40e_status ret; - ret =i40e_aq_mac_address_write (&vsi->back->hw, -I40E_AQC_WRITE_TYPE_LAA_WOL , + ret =i40e_aq_mac_address_write (hw,I40E_AQC_WRITE_TYPE_LAA_WOL , addr->sa_data,NULL );if (ret) netdev_info(netdev, "Ignoring error from firmware on LAA update, status %s, AQ ret %s\n",
@@ -1574,7 +1573,7 @@ static int i40e_set_mac(struct net_device *netdev, void *p)/* schedule our worker thread which will take care of * applying the new filter changes */ -i40e_service_event_schedule (vsi->back); +i40e_service_event_schedule (pf);return 0 ; }
Signature · 1 line
2.9.5
Bowers
PATCH 4/9 i40e: use declared variables for pf and hw
Quoted 11 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On Behalf Of Alice Michael
Sent: Tuesday, August 28, 2018 10:16 AM
To: Michael, Alice <[email protected]>; intel-wired-
lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next PATCH S96 4/9] i40e: use declared variables for pf and hwFrom: Patryk Ma?ek <[email protected]>
Quoted 7 lines
In order to slightly simplify the code use the variables for pf and hw that are declared in
i40e_set_macfunction.Signed-off-by Patryk Ma?ek <[email protected]>--- drivers/net/ethernet/intel/i40e/i40e_main.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
PATCH 5/9 i40e: add a helper function to validate a vf based on the vf id
In reply to Alice MichaelFrom: Harshitha Ramamurthy <[email protected]>
When we are trying to change VF settings, it is possible for 2 race conditions to happen. One, when the VF is created but not yet enabled. Second, the VF is enabled but the vsi is still not created or not yet re-created in the VF reset flow.
This patch introduces a helper function to validate that the vf is enabled and that the vsi is set up. This patch also calls this function from other functions which could get into these race conditions. While we are poking around here, remove unnecessary parenthesis that checkpatch was complaining about.
--- drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 62 ++++++++++++++-------- 1 file changed, 41 insertions(+), 21 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +41 -21
@@ -3833,6 +3833,35 @@ int i40e_vc_process_vflr_event(struct i40e_pf *pf) }/** +* i40e_validate_vf +* @pf: the physical function +* @vf_id: VF identifier +* +* Check that the VF is enabled and the vsi exists. +* +* Returns 0 on success, negative on failure +**/ +static int i40e_validate_vf (struct i40e_pf *pf,int vf_id) +{ +struct i40e_vsi *vsi; +struct i40e_vf *vf; +int ret =0 ; + +if (vf_id >= pf->num_alloc_vfs) { +dev_err (&pf->pdev->dev, +"Invalid VF Identifier %d\n" , vf_id); + ret = -EINVAL ; + goto err_out; + } + vf = &pf->vf[vf_id]; + vsi =i40e_find_vsi_from_id (pf, vf->lan_vsi_id); +if (!vsi) + ret = -EINVAL ; +err_out: +return ret; +} + +/** * i40e_ndo_set_vf_mac * @netdev: network interface device structure * @vf_id: VF identifier
@@ -3853,14 +3882,11 @@ int i40e_ndo_set_vf_mac(struct net_device *netdev, int vf_id, u8 *mac)u8 i;/* validate the request */ -if (vf_id >= pf->num_alloc_vfs) { -dev_err (&pf->pdev->dev, -"Invalid VF Identifier %d\n" , vf_id); - ret = -EINVAL ; + ret =i40e_validate_vf (pf, vf_id); +if (ret) goto error_param; - } - vf = &(pf->vf[vf_id]); + vf = &pf->vf[vf_id]; vsi = pf->vsi[vf->lan_vsi_idx];/* When the VF is resetting wait until it is done.
@@ -3979,11 +4005,9 @@ int i40e_ndo_set_vf_port_vlan(struct net_device *netdev, int vf_id,int ret =0 ;/* validate the request */ -if (vf_id >= pf->num_alloc_vfs) { -dev_err (&pf->pdev->dev,"Invalid VF Identifier %d\n" , vf_id); - ret = -EINVAL ; + ret =i40e_validate_vf (pf, vf_id); +if (ret) goto error_pvid; - }if ((vlan_id >I40E_MAX_VLANID ) || (qos >7 )) {dev_err (&pf->pdev->dev,"Invalid VF Parameters\n" );
@@ -3997,7 +4021,7 @@ int i40e_ndo_set_vf_port_vlan(struct net_device *netdev, int vf_id, goto error_pvid; } - vf = &(pf->vf[vf_id]); + vf = &pf->vf[vf_id]; vsi = pf->vsi[vf->lan_vsi_idx];if (!test_bit (I40E_VF_STATE_INIT , &vf->vf_states)) { dev_err(&pf->pdev->dev, "VF %d still in reset. Try again.\n",
@@ -4117,11 +4141,9 @@ int i40e_ndo_set_vf_bw(struct net_device *netdev, int vf_id, int min_tx_rate,int ret =0 ;/* validate the request */ -if (vf_id >= pf->num_alloc_vfs) { -dev_err (&pf->pdev->dev,"Invalid VF Identifier %d.\n" , vf_id); - ret = -EINVAL ; + ret =i40e_validate_vf (pf, vf_id); +if (ret) goto error; - }if (min_tx_rate) { dev_err(&pf->pdev->dev, "Invalid min tx rate (%d) (greater than 0) specified for VF %d.\n",
@@ -4129,7 +4151,7 @@ int i40e_ndo_set_vf_bw(struct net_device *netdev, int vf_id, int min_tx_rate,return -EINVAL ; } - vf = &(pf->vf[vf_id]); + vf = &pf->vf[vf_id]; vsi = pf->vsi[vf->lan_vsi_idx];if (!test_bit (I40E_VF_STATE_INIT , &vf->vf_states)) { dev_err(&pf->pdev->dev, "VF %d still in reset. Try again.\n",
@@ -4165,13 +4187,11 @@ int i40e_ndo_get_vf_config(struct net_device *netdev,int ret =0 ;/* validate the request */ -if (vf_id >= pf->num_alloc_vfs) { -dev_err (&pf->pdev->dev,"Invalid VF Identifier %d\n" , vf_id); - ret = -EINVAL ; + ret =i40e_validate_vf (pf, vf_id); +if (ret) goto error_param; - } - vf = &(pf->vf[vf_id]); + vf = &pf->vf[vf_id];/* first vsi is always the LAN vsi */ vsi = pf->vsi[vf->lan_vsi_idx];if (!test_bit (I40E_VF_STATE_INIT , &vf->vf_states)) {
Signature · 1 line
2.9.5
Bowers
PATCH 5/9 i40e: add a helper function to validate a vf based on the vf id
Quoted 22 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On Behalf Of Alice Michael
Sent: Tuesday, August 28, 2018 10:16 AM
To: Michael, Alice <[email protected]>; intel-wired-
lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next PATCH S96 5/9] i40e: add a helper function to validate a vf based on the vf idFrom: Harshitha Ramamurthy <[email protected]>
When we are trying to change VF settings, it is possible for 2 race conditions to happen. One, when the VF is created but not yet enabled.
Second, the VF is enabled but the vsi is still not created or not yet re-created in the VF reset flow.This patch introduces a helper function to validate that the vf is enabled and that the vsi is set up. This patch also calls this function from other functions which could get into these race conditions.
While we are poking around here, remove unnecessary parenthesis that checkpatch was complaining about.
Quoted 5 lines
Signed-off-by Harshitha Ramamurthy <[email protected]>--- drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 62 ++++++++++++++--- ----- 1 file changed, 41 insertions(+), 21 deletions(-)
PATCH 6/9 i40e: fix double 'NIC Link is Down' messages
In reply to Alice MichaelFrom: Sergey Nemov <[email protected]>
When isup is false meaning that interface is going to shut down set new speed to 0 to avoid double 'NIC Link is Down' messages.
--- drivers/net/ethernet/intel/i40e/i40e_main.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/ethernet/intel/i40e/i40e_main.c +4 -1
@@ -6437,7 +6437,10 @@ void i40e_print_link_message(struct i40e_vsi *vsi, bool isup)char *req_fec ="" ;char *an ="" ; - new_speed = pf->hw.phy.link_info.link_speed; +if (isup) + new_speed = pf->hw.phy.link_info.link_speed; +else + new_speed =I40E_LINK_SPEED_UNKNOWN ;if ((vsi->current_isup == isup) && (vsi->current_speed == new_speed))return ;
Signature · 1 line
2.9.5
Bowers
PATCH 6/9 i40e: fix double 'NIC Link is Down' messages
Quoted 11 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On Behalf Of Alice Michael
Sent: Tuesday, August 28, 2018 10:16 AM
To: Michael, Alice <[email protected]>; intel-wired-
lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next PATCH S96 6/9] i40e: fix double 'NIC Link is Down' messagesFrom: Sergey Nemov <[email protected]>
Quoted 7 lines
When isup is false meaning that interface is going to shut down set new speed to 0 to avoid double 'NIC Link is Down' messages.
Signed-off-by Sergey Nemov <[email protected]>--- drivers/net/ethernet/intel/i40e/i40e_main.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
PATCH 7/9 i40e: Remove unused msglen parameter from virtchnl functions
In reply to Alice MichaelFrom: Patryk Ma?ek <[email protected]>
msglen parameter seems to be unused in several virtchnl function. This patch removes it from signatures of those functions.
--- drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 96 +++++++++------------- 1 file changed, 37 insertions(+), 59 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +37 -59
@@ -1973,13 +1973,11 @@ static inline int i40e_getnum_vf_vsi_vlan_filters(struct i40e_vsi *vsi)* i40e_vc_config_promiscuous_mode_msg * @vf: pointer to the VF info * @msg: pointer to the msg buffer -* @msglen: msg length * * called from the VF to configure the promiscuous mode of * VF vsis **/ -static int i40e_vc_config_promiscuous_mode_msg (struct i40e_vf *vf, -u8 *msg,u16 msglen) +static int i40e_vc_config_promiscuous_mode_msg (struct i40e_vf *vf,u8 *msg) {struct virtchnl_promisc_info *info = (struct virtchnl_promisc_info *)msg;
@@ -2034,12 +2032,11 @@ static int i40e_vc_config_promiscuous_mode_msg(struct i40e_vf *vf,* i40e_vc_config_queues_msg * @vf: pointer to the VF info * @msg: pointer to the msg buffer -* @msglen: msg length * * called from the VF to configure the rx/tx * queues **/ -static int i40e_vc_config_queues_msg (struct i40e_vf *vf,u8 *msg,u16 msglen) +static int i40e_vc_config_queues_msg (struct i40e_vf *vf,u8 *msg) {struct virtchnl_vsi_queue_config_info *qci = (struct virtchnl_vsi_queue_config_info *)msg;
@@ -2152,12 +2149,11 @@ static int i40e_validate_queue_map(struct i40e_vf *vf, u16 vsi_id,* i40e_vc_config_irq_map_msg * @vf: pointer to the VF info * @msg: pointer to the msg buffer -* @msglen: msg length * * called from the VF to configure the irq to * queue map **/ -static int i40e_vc_config_irq_map_msg (struct i40e_vf *vf,u8 *msg,u16 msglen) +static int i40e_vc_config_irq_map_msg (struct i40e_vf *vf,u8 *msg) {struct virtchnl_irq_map_info *irqmap_info = (struct virtchnl_irq_map_info *)msg;
@@ -2249,11 +2245,10 @@ static int i40e_ctrl_vf_rx_rings(struct i40e_vsi *vsi, unsigned long q_map,* i40e_vc_enable_queues_msg * @vf: pointer to the VF info * @msg: pointer to the msg buffer -* @msglen: msg length * * called from the VF to enable all or specific queue(s) **/ -static int i40e_vc_enable_queues_msg (struct i40e_vf *vf,u8 *msg,u16 msglen) +static int i40e_vc_enable_queues_msg (struct i40e_vf *vf,u8 *msg) {struct virtchnl_queue_select *vqs = (struct virtchnl_queue_select *)msg;
@@ -2308,12 +2303,11 @@ static int i40e_vc_enable_queues_msg(struct i40e_vf *vf, u8 *msg, u16 msglen)* i40e_vc_disable_queues_msg * @vf: pointer to the VF info * @msg: pointer to the msg buffer -* @msglen: msg length * * called from the VF to disable all or specific * queue(s) **/ -static int i40e_vc_disable_queues_msg (struct i40e_vf *vf,u8 *msg,u16 msglen) +static int i40e_vc_disable_queues_msg (struct i40e_vf *vf,u8 *msg) {struct virtchnl_queue_select *vqs = (struct virtchnl_queue_select *)msg;
@@ -2356,14 +2350,13 @@ static int i40e_vc_disable_queues_msg(struct i40e_vf *vf, u8 *msg, u16 msglen)* i40e_vc_request_queues_msg * @vf: pointer to the VF info * @msg: pointer to the msg buffer -* @msglen: msg length * * VFs get a default number of queues but can use this message to request a * different number. If the request is successful, PF will reset the VF and * return 0. If unsuccessful, PF will send message informing VF of number of * available queues and return result of sending VF a message. **/ -static int i40e_vc_request_queues_msg (struct i40e_vf *vf,u8 *msg,int msglen) +static int i40e_vc_request_queues_msg (struct i40e_vf *vf,u8 *msg) {struct virtchnl_vf_res_request *vfres = (struct virtchnl_vf_res_request *)msg;
@@ -2407,11 +2400,10 @@ static int i40e_vc_request_queues_msg(struct i40e_vf *vf, u8 *msg, int msglen)* i40e_vc_get_stats_msg * @vf: pointer to the VF info * @msg: pointer to the msg buffer -* @msglen: msg length * * called from the VF to get vsi stats **/ -static int i40e_vc_get_stats_msg (struct i40e_vf *vf,u8 *msg,u16 msglen) +static int i40e_vc_get_stats_msg (struct i40e_vf *vf,u8 *msg) {struct virtchnl_queue_select *vqs = (struct virtchnl_queue_select *)msg;
@@ -2517,11 +2509,10 @@ static inline int i40e_check_vf_permission(struct i40e_vf *vf,* i40e_vc_add_mac_addr_msg * @vf: pointer to the VF info * @msg: pointer to the msg buffer -* @msglen: msg length * * add guest mac address filter **/ -static int i40e_vc_add_mac_addr_msg (struct i40e_vf *vf,u8 *msg,u16 msglen) +static int i40e_vc_add_mac_addr_msg (struct i40e_vf *vf,u8 *msg) {struct virtchnl_ether_addr_list *al = (struct virtchnl_ether_addr_list *)msg;
@@ -2588,11 +2579,10 @@ static int i40e_vc_add_mac_addr_msg(struct i40e_vf *vf, u8 *msg, u16 msglen)* i40e_vc_del_mac_addr_msg * @vf: pointer to the VF info * @msg: pointer to the msg buffer -* @msglen: msg length * * remove guest mac address filter **/ -static int i40e_vc_del_mac_addr_msg (struct i40e_vf *vf,u8 *msg,u16 msglen) +static int i40e_vc_del_mac_addr_msg (struct i40e_vf *vf,u8 *msg) {struct virtchnl_ether_addr_list *al = (struct virtchnl_ether_addr_list *)msg;
@@ -2648,11 +2638,10 @@ static int i40e_vc_del_mac_addr_msg(struct i40e_vf *vf, u8 *msg, u16 msglen)* i40e_vc_add_vlan_msg * @vf: pointer to the VF info * @msg: pointer to the msg buffer -* @msglen: msg length * * program guest vlan id **/ -static int i40e_vc_add_vlan_msg (struct i40e_vf *vf,u8 *msg,u16 msglen) +static int i40e_vc_add_vlan_msg (struct i40e_vf *vf,u8 *msg) {struct virtchnl_vlan_filter_list *vfl = (struct virtchnl_vlan_filter_list *)msg;
@@ -2721,11 +2710,10 @@ static int i40e_vc_add_vlan_msg(struct i40e_vf *vf, u8 *msg, u16 msglen)* i40e_vc_remove_vlan_msg * @vf: pointer to the VF info * @msg: pointer to the msg buffer -* @msglen: msg length * * remove programmed guest vlan id **/ -static int i40e_vc_remove_vlan_msg (struct i40e_vf *vf,u8 *msg,u16 msglen) +static int i40e_vc_remove_vlan_msg (struct i40e_vf *vf,u8 *msg) {struct virtchnl_vlan_filter_list *vfl = (struct virtchnl_vlan_filter_list *)msg;
@@ -2808,13 +2796,11 @@ static int i40e_vc_iwarp_msg(struct i40e_vf *vf, u8 *msg, u16 msglen)* i40e_vc_iwarp_qvmap_msg * @vf: pointer to the VF info * @msg: pointer to the msg buffer -* @msglen: msg length * @config: config qvmap or release it * * called from the VF for the iwarp msgs **/ -static int i40e_vc_iwarp_qvmap_msg (struct i40e_vf *vf,u8 *msg,u16 msglen, -bool config) +static int i40e_vc_iwarp_qvmap_msg (struct i40e_vf *vf,u8 *msg,bool config) {struct virtchnl_iwarp_qvlist_info *qvlist_info = (struct virtchnl_iwarp_qvlist_info *)msg;
@@ -2845,11 +2831,10 @@ static int i40e_vc_iwarp_qvmap_msg(struct i40e_vf *vf, u8 *msg, u16 msglen,* i40e_vc_config_rss_key * @vf: pointer to the VF info * @msg: pointer to the msg buffer -* @msglen: msg length * * Configure the VF's RSS key **/ -static int i40e_vc_config_rss_key (struct i40e_vf *vf,u8 *msg,u16 msglen) +static int i40e_vc_config_rss_key (struct i40e_vf *vf,u8 *msg) {struct virtchnl_rss_key *vrk = (struct virtchnl_rss_key *)msg;
@@ -2877,11 +2862,10 @@ static int i40e_vc_config_rss_key(struct i40e_vf *vf, u8 *msg, u16 msglen)* i40e_vc_config_rss_lut * @vf: pointer to the VF info * @msg: pointer to the msg buffer -* @msglen: msg length * * Configure the VF's RSS LUT **/ -static int i40e_vc_config_rss_lut (struct i40e_vf *vf,u8 *msg,u16 msglen) +static int i40e_vc_config_rss_lut (struct i40e_vf *vf,u8 *msg) {struct virtchnl_rss_lut *vrl = (struct virtchnl_rss_lut *)msg;
@@ -2909,11 +2893,10 @@ static int i40e_vc_config_rss_lut(struct i40e_vf *vf, u8 *msg, u16 msglen)* i40e_vc_get_rss_hena * @vf: pointer to the VF info * @msg: pointer to the msg buffer -* @msglen: msg length * * Return the RSS HENA bits allowed by the hardware **/ -static int i40e_vc_get_rss_hena (struct i40e_vf *vf,u8 *msg,u16 msglen) +static int i40e_vc_get_rss_hena (struct i40e_vf *vf,u8 *msg) {struct virtchnl_rss_hena *vrh =NULL ;struct i40e_pf *pf = vf->pf;
@@ -2945,11 +2928,10 @@ static int i40e_vc_get_rss_hena(struct i40e_vf *vf, u8 *msg, u16 msglen)* i40e_vc_set_rss_hena * @vf: pointer to the VF info * @msg: pointer to the msg buffer -* @msglen: msg length * * Set the RSS HENA bits for the VF **/ -static int i40e_vc_set_rss_hena (struct i40e_vf *vf,u8 *msg,u16 msglen) +static int i40e_vc_set_rss_hena (struct i40e_vf *vf,u8 *msg) {struct virtchnl_rss_hena *vrh = (struct virtchnl_rss_hena *)msg;
@@ -2974,12 +2956,10 @@ static int i40e_vc_set_rss_hena(struct i40e_vf *vf, u8 *msg, u16 msglen)* i40e_vc_enable_vlan_stripping * @vf: pointer to the VF info * @msg: pointer to the msg buffer -* @msglen: msg length * * Enable vlan header stripping for the VF **/ -static int i40e_vc_enable_vlan_stripping (struct i40e_vf *vf,u8 *msg, -u16 msglen) +static int i40e_vc_enable_vlan_stripping (struct i40e_vf *vf,u8 *msg) {struct i40e_vsi *vsi = vf->pf->vsi[vf->lan_vsi_idx];i40e_status aq_ret =0 ;
@@ -3001,12 +2981,10 @@ static int i40e_vc_enable_vlan_stripping(struct i40e_vf *vf, u8 *msg,* i40e_vc_disable_vlan_stripping * @vf: pointer to the VF info * @msg: pointer to the msg buffer -* @msglen: msg length * * Disable vlan header stripping for the VF **/ -static int i40e_vc_disable_vlan_stripping (struct i40e_vf *vf,u8 *msg, -u16 msglen) +static int i40e_vc_disable_vlan_stripping (struct i40e_vf *vf,u8 *msg) {struct i40e_vsi *vsi = vf->pf->vsi[vf->lan_vsi_idx];i40e_status aq_ret =0 ;
@@ -3706,65 +3684,65 @@ int i40e_vc_process_vf_msg(struct i40e_pf *pf, s16 vf_id, u32 v_opcode, ret =0 ;break ;case VIRTCHNL_OP_CONFIG_PROMISCUOUS_MODE : - ret =i40e_vc_config_promiscuous_mode_msg (vf, msg, msglen); + ret =i40e_vc_config_promiscuous_mode_msg (vf, msg);break ;case VIRTCHNL_OP_CONFIG_VSI_QUEUES : - ret =i40e_vc_config_queues_msg (vf, msg, msglen); + ret =i40e_vc_config_queues_msg (vf, msg);break ;case VIRTCHNL_OP_CONFIG_IRQ_MAP : - ret =i40e_vc_config_irq_map_msg (vf, msg, msglen); + ret =i40e_vc_config_irq_map_msg (vf, msg);break ;case VIRTCHNL_OP_ENABLE_QUEUES : - ret =i40e_vc_enable_queues_msg (vf, msg, msglen); + ret =i40e_vc_enable_queues_msg (vf, msg);i40e_vc_notify_vf_link_state (vf);break ;case VIRTCHNL_OP_DISABLE_QUEUES : - ret =i40e_vc_disable_queues_msg (vf, msg, msglen); + ret =i40e_vc_disable_queues_msg (vf, msg);break ;case VIRTCHNL_OP_ADD_ETH_ADDR : - ret =i40e_vc_add_mac_addr_msg (vf, msg, msglen); + ret =i40e_vc_add_mac_addr_msg (vf, msg);break ;case VIRTCHNL_OP_DEL_ETH_ADDR : - ret =i40e_vc_del_mac_addr_msg (vf, msg, msglen); + ret =i40e_vc_del_mac_addr_msg (vf, msg);break ;case VIRTCHNL_OP_ADD_VLAN : - ret =i40e_vc_add_vlan_msg (vf, msg, msglen); + ret =i40e_vc_add_vlan_msg (vf, msg);break ;case VIRTCHNL_OP_DEL_VLAN : - ret =i40e_vc_remove_vlan_msg (vf, msg, msglen); + ret =i40e_vc_remove_vlan_msg (vf, msg);break ;case VIRTCHNL_OP_GET_STATS : - ret =i40e_vc_get_stats_msg (vf, msg, msglen); + ret =i40e_vc_get_stats_msg (vf, msg);break ;case VIRTCHNL_OP_IWARP : ret =i40e_vc_iwarp_msg (vf, msg, msglen);break ;case VIRTCHNL_OP_CONFIG_IWARP_IRQ_MAP : - ret =i40e_vc_iwarp_qvmap_msg (vf, msg, msglen, true); + ret =i40e_vc_iwarp_qvmap_msg (vf, msg, true);break ;case VIRTCHNL_OP_RELEASE_IWARP_IRQ_MAP : - ret =i40e_vc_iwarp_qvmap_msg (vf, msg, msglen, false); + ret =i40e_vc_iwarp_qvmap_msg (vf, msg, false);break ;case VIRTCHNL_OP_CONFIG_RSS_KEY : - ret =i40e_vc_config_rss_key (vf, msg, msglen); + ret =i40e_vc_config_rss_key (vf, msg);break ;case VIRTCHNL_OP_CONFIG_RSS_LUT : - ret =i40e_vc_config_rss_lut (vf, msg, msglen); + ret =i40e_vc_config_rss_lut (vf, msg);break ;case VIRTCHNL_OP_GET_RSS_HENA_CAPS : - ret =i40e_vc_get_rss_hena (vf, msg, msglen); + ret =i40e_vc_get_rss_hena (vf, msg);break ;case VIRTCHNL_OP_SET_RSS_HENA : - ret =i40e_vc_set_rss_hena (vf, msg, msglen); + ret =i40e_vc_set_rss_hena (vf, msg);break ;case VIRTCHNL_OP_ENABLE_VLAN_STRIPPING : - ret =i40e_vc_enable_vlan_stripping (vf, msg, msglen); + ret =i40e_vc_enable_vlan_stripping (vf, msg);break ;case VIRTCHNL_OP_DISABLE_VLAN_STRIPPING : - ret =i40e_vc_disable_vlan_stripping (vf, msg, msglen); + ret =i40e_vc_disable_vlan_stripping (vf, msg);break ;case VIRTCHNL_OP_REQUEST_QUEUES : - ret =i40e_vc_request_queues_msg (vf, msg, msglen); + ret =i40e_vc_request_queues_msg (vf, msg);break ;case VIRTCHNL_OP_ENABLE_CHANNELS : ret =i40e_vc_add_qch_msg (vf, msg);
Signature · 1 line
2.9.5
Bowers
PATCH 7/9 i40e: Remove unused msglen parameter from virtchnl functions
Quoted 11 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On Behalf Of Alice Michael
Sent: Tuesday, August 28, 2018 10:16 AM
To: Michael, Alice <[email protected]>; intel-wired-
lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next PATCH S96 7/9] i40e: Remove unused msglen parameter from virtchnl functionsFrom: Patryk Ma?ek <[email protected]>
Quoted 8 lines
msglen parameter seems to be unused in several virtchnl function. This patch removes it from signatures of those functions.
Signed-off-by Patryk Ma?ek <[email protected]>--- drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 96 +++++++++----------- -- 1 file changed, 37 insertions(+), 59 deletions(-)
PATCH 8/9 i40evf: cancel workqueue sync for adminq when a VF is removed
In reply to Alice MichaelFrom: Lihong Yang <[email protected]>
If a VF is being removed, there is no need to continue with the workqueue sync for the adminq task, thus cancel it. Without this call, when VFs are created and removed right away, there might be a chance for the driver to crash with events stuck in the adminq.
--- drivers/net/ethernet/intel/i40evf/i40evf_main.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/ethernet/intel/i40evf/i40evf_main.c +2 -0
@@ -3910,6 +3910,8 @@ static void i40evf_remove(struct pci_dev *pdev)if (adapter->watchdog_timer.function)del_timer_sync (&adapter->watchdog_timer); +cancel_work_sync (&adapter->adminq_task); +i40evf_free_rss (adapter);if (hw->aq.asq.count)
Signature · 1 line
2.9.5
Bowers
PATCH 8/9 i40evf: cancel workqueue sync for adminq when a VF is removed
Quoted 16 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On Behalf Of Alice Michael
Sent: Tuesday, August 28, 2018 10:16 AM
To: Michael, Alice <[email protected]>; intel-wired- lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next PATCH S96 8/9] i40evf: cancel workqueue sync for adminq when a VF is removedFrom: Lihong Yang <[email protected]>
If a VF is being removed, there is no need to continue with the workqueue sync for the adminq task, thus cancel it. Without this call, when VFs are created and removed right away, there might be a chance for the driver to crash with events stuck in the adminq.
Quoted 4 lines
Signed-off-by Lihong Yang <[email protected]>--- drivers/net/ethernet/intel/i40evf/i40evf_main.c | 2 ++ 1 file changed, 2 insertions(+)
PATCH 9/9 i40e: Prevent deleting MAC address from VF when set by PF
In reply to Alice MichaelFrom: Patryk Ma?ek <[email protected]>
To prevent VF from deleting MAC address that was assigned by the PF we need to check for that scenario when we try to delete a MAC address from a VF.
--- drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +10 -0
@@ -2606,6 +2606,16 @@ static int i40e_vc_del_mac_addr_msg(struct i40e_vf *vf, u8 *msg) ret =I40E_ERR_INVALID_MAC_ADDR ; goto error_param; } + +if (vf->pf_set_mac && +ether_addr_equal (al->list[i].addr, + vf->default_lan_addr.addr)) { +dev_err (&pf->pdev->dev, +"MAC addr %pM has been set by PF, cannot delete it for VF %d, reset VF to change MAC addr\n" , + vf->default_lan_addr.addr, vf->vf_id); + ret =I40E_ERR_PARAM ; + goto error_param; + } } vsi = pf->vsi[vf->lan_vsi_idx];
Signature · 1 line
2.9.5
Bowers
PATCH 9/9 i40e: Prevent deleting MAC address from VF when set by PF
Quoted 11 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On Behalf Of Alice Michael
Sent: Tuesday, August 28, 2018 10:16 AM
To: Michael, Alice <[email protected]>; intel-wired-
lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next PATCH S96 9/9] i40e: Prevent deleting MAC address from VF when set by PFFrom: Patryk Ma?ek <[email protected]>
Quoted 8 lines
To prevent VF from deleting MAC address that was assigned by the PF we need to check for that scenario when we try to delete a MAC address from a VF.
Signed-off-by Patryk Ma?ek <[email protected]>--- drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
Bowers
PATCH 1/9 i40e: Check and correct speed values for link on open
In reply to Alice MichaelQuoted 15 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On Behalf Of Alice Michael
Sent: Tuesday, August 28, 2018 10:16 AM
To: Michael, Alice <[email protected]>; intel-wired- lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next PATCH S96 1/9] i40e: Check and correct speed values for link on openFrom: Jan Sokolowski <[email protected]>
If our card has been put in an unstable state due to other drivers interacting with it, speed settings might be incorrect. If incorrect, forcefully reset them on open to known default values.
Quoted 5 lines
Signed-off-by Jan Sokolowski <[email protected]>--- drivers/net/ethernet/intel/i40e/i40e_main.c | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-)