summaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/intel/ice/ice_vsi_vlan_lib.c
diff options
context:
space:
mode:
authorBrett Creeley <brett.creeley@intel.com>2021-12-02 08:38:49 -0800
committerTony Nguyen <anthony.l.nguyen@intel.com>2022-02-09 09:24:45 -0800
commita1ffafb0b4a4fb74d41112b71a02c39ece0fe2d8 (patch)
tree6647ee574213672246f13d8240f74fd7db6eccd9 /drivers/net/ethernet/intel/ice/ice_vsi_vlan_lib.c
parentcc71de8fa13395d106ad8c542eadabe13315d081 (diff)
downloadlinux-stable-a1ffafb0b4a4fb74d41112b71a02c39ece0fe2d8.tar.gz
linux-stable-a1ffafb0b4a4fb74d41112b71a02c39ece0fe2d8.tar.bz2
linux-stable-a1ffafb0b4a4fb74d41112b71a02c39ece0fe2d8.zip
ice: Support configuring the device to Double VLAN Mode
In order to support configuring the device in Double VLAN Mode (DVM), the DDP and FW have to support DVM. If both support DVM, the PF that downloads the package needs to update the default recipes, set the VLAN mode, and update boost TCAM entries. To support updating the default recipes in DVM, add support for updating an existing switch recipe's lkup_idx and mask. This is done by first calling the get recipe AQ (0x0292) with the desired recipe ID. Then, if that is successful update one of the lookup indices (lkup_idx) and its associated mask if the mask is valid otherwise the already existing mask will be used. The VLAN mode of the device has to be configured while the global configuration lock is held while downloading the DDP, specifically after the DDP has been downloaded. If supported, the device will default to DVM. Co-developed-by: Dan Nowlin <dan.nowlin@intel.com> Signed-off-by: Dan Nowlin <dan.nowlin@intel.com> Signed-off-by: Brett Creeley <brett.creeley@intel.com> Tested-by: Gurucharan G <gurucharanx.g@intel.com> Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
Diffstat (limited to 'drivers/net/ethernet/intel/ice/ice_vsi_vlan_lib.c')
-rw-r--r--drivers/net/ethernet/intel/ice/ice_vsi_vlan_lib.c25
1 files changed, 11 insertions, 14 deletions
diff --git a/drivers/net/ethernet/intel/ice/ice_vsi_vlan_lib.c b/drivers/net/ethernet/intel/ice/ice_vsi_vlan_lib.c
index 62a2630d6fab..5b4a0abb4607 100644
--- a/drivers/net/ethernet/intel/ice/ice_vsi_vlan_lib.c
+++ b/drivers/net/ethernet/intel/ice/ice_vsi_vlan_lib.c
@@ -39,20 +39,20 @@ static bool validate_vlan(struct ice_vsi *vsi, struct ice_vlan *vlan)
*/
int ice_vsi_add_vlan(struct ice_vsi *vsi, struct ice_vlan *vlan)
{
- int err = 0;
+ int err;
if (!validate_vlan(vsi, vlan))
return -EINVAL;
- if (!ice_fltr_add_vlan(vsi, vlan)) {
- vsi->num_vlan++;
- } else {
- err = -ENODEV;
- dev_err(ice_pf_to_dev(vsi->back), "Failure Adding VLAN %d on VSI %i\n",
- vlan->vid, vsi->vsi_num);
+ err = ice_fltr_add_vlan(vsi, vlan);
+ if (err && err != -EEXIST) {
+ dev_err(ice_pf_to_dev(vsi->back), "Failure Adding VLAN %d on VSI %i, status %d\n",
+ vlan->vid, vsi->vsi_num, err);
+ return err;
}
- return err;
+ vsi->num_vlan++;
+ return 0;
}
/**
@@ -72,16 +72,13 @@ int ice_vsi_del_vlan(struct ice_vsi *vsi, struct ice_vlan *vlan)
dev = ice_pf_to_dev(pf);
err = ice_fltr_remove_vlan(vsi, vlan);
- if (!err) {
+ if (!err)
vsi->num_vlan--;
- } else if (err == -ENOENT) {
- dev_dbg(dev, "Failed to remove VLAN %d on VSI %i, it does not exist\n",
- vlan->vid, vsi->vsi_num);
+ else if (err == -ENOENT || err == -EBUSY)
err = 0;
- } else {
+ else
dev_err(dev, "Error removing VLAN %d on VSI %i error: %d\n",
vlan->vid, vsi->vsi_num, err);
- }
return err;
}