aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorAkeem G Abodunrin <akeem.g.abodunrin@intel.com>2019-04-16 13:21:16 -0400
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>2019-05-04 17:07:34 -0400
commitbb877b22bcb5334fc4e1752fe77e96ab762c3738 (patch)
tree20a661059505572403e3e9f0c593780d0793abf0 /drivers/net
parente80e76db6c5bbc7a8f8512f3dc630a2170745b0b (diff)
ice: Don't remove VLAN filters that were never programmed
In case of non-trusted VFs, it is possible to program VLAN filter far less than what is requested by the VF originally, thereby makes number of VLAN elements being tracked by VF different from actual VLAN tags. This patch makes sure that we are not attempting to remove VLAN filter that does not exist. Signed-off-by: Akeem G Abodunrin <akeem.g.abodunrin@intel.com> Signed-off-by: Anirudh Venkataramanan <anirudh.venkataramanan@intel.com> Tested-by: Andrew Bowers <andrewx.bowers@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/ethernet/intel/ice/ice_lib.c6
-rw-r--r--drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c12
2 files changed, 16 insertions, 2 deletions
diff --git a/drivers/net/ethernet/intel/ice/ice_lib.c b/drivers/net/ethernet/intel/ice/ice_lib.c
index 947730d74612..83d0aef7f77e 100644
--- a/drivers/net/ethernet/intel/ice/ice_lib.c
+++ b/drivers/net/ethernet/intel/ice/ice_lib.c
@@ -1616,7 +1616,11 @@ int ice_vsi_kill_vlan(struct ice_vsi *vsi, u16 vid)
1616 list_add(&list->list_entry, &tmp_add_list); 1616 list_add(&list->list_entry, &tmp_add_list);
1617 1617
1618 status = ice_remove_vlan(&pf->hw, &tmp_add_list); 1618 status = ice_remove_vlan(&pf->hw, &tmp_add_list);
1619 if (status) { 1619 if (status == ICE_ERR_DOES_NOT_EXIST) {
1620 dev_dbg(&pf->pdev->dev,
1621 "Failed to remove VLAN %d on VSI %i, it does not exist, status: %d\n",
1622 vid, vsi->vsi_num, status);
1623 } else if (status) {
1620 dev_err(&pf->pdev->dev, 1624 dev_err(&pf->pdev->dev,
1621 "Error removing VLAN %d on vsi %i error: %d\n", 1625 "Error removing VLAN %d on vsi %i error: %d\n",
1622 vid, vsi->vsi_num, status); 1626 vid, vsi->vsi_num, status);
diff --git a/drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c b/drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c
index abc958788267..f4b466cd4b7a 100644
--- a/drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c
+++ b/drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c
@@ -2402,7 +2402,17 @@ static int ice_vc_process_vlan_msg(struct ice_vf *vf, u8 *msg, bool add_v)
2402 } 2402 }
2403 } 2403 }
2404 } else { 2404 } else {
2405 for (i = 0; i < vfl->num_elements; i++) { 2405 /* In case of non_trusted VF, number of VLAN elements passed
2406 * to PF for removal might be greater than number of VLANs
2407 * filter programmed for that VF - So, use actual number of
2408 * VLANS added earlier with add VLAN opcode. In order to avoid
2409 * removing VLAN that doesn't exist, which result to sending
2410 * erroneous failed message back to the VF
2411 */
2412 int num_vf_vlan;
2413
2414 num_vf_vlan = vf->num_vlan;
2415 for (i = 0; i < vfl->num_elements && i < num_vf_vlan; i++) {
2406 u16 vid = vfl->vlan_id[i]; 2416 u16 vid = vfl->vlan_id[i];
2407 2417
2408 /* Make sure ice_vsi_kill_vlan is successful before 2418 /* Make sure ice_vsi_kill_vlan is successful before