diff options
author | Brett Creeley <brett.creeley@intel.com> | 2021-12-02 08:38:42 -0800 |
---|---|---|
committer | Tony Nguyen <anthony.l.nguyen@intel.com> | 2022-02-09 09:24:45 -0800 |
commit | fb05ba1257d727b4532dc943851d5ee24ae7cafd (patch) | |
tree | f4785aeff44196464f109d947e1495d742b3494a /drivers/net/ethernet/intel/ice/ice_vsi_vlan_lib.c | |
parent | bc42afa954870985ca07dbb38c79eca1a5d81a39 (diff) |
ice: Introduce ice_vlan struct
Add a new struct for VLAN related information. Currently this holds
VLAN ID and priority values, but will be expanded to hold TPID value.
This reduces the changes necessary if any other values are added in
future. Remove the action argument from these calls as it's always
ICE_FWD_VSI.
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.c | 31 |
1 files changed, 18 insertions, 13 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 6b0a4bf28305..74b6dec0744b 100644 --- a/drivers/net/ethernet/intel/ice/ice_vsi_vlan_lib.c +++ b/drivers/net/ethernet/intel/ice/ice_vsi_vlan_lib.c @@ -9,20 +9,18 @@ /** * ice_vsi_add_vlan - default add VLAN implementation for all VSI types * @vsi: VSI being configured - * @vid: VLAN ID to be added - * @action: filter action to be performed on match + * @vlan: VLAN filter to add */ -int -ice_vsi_add_vlan(struct ice_vsi *vsi, u16 vid, enum ice_sw_fwd_act_type action) +int ice_vsi_add_vlan(struct ice_vsi *vsi, struct ice_vlan *vlan) { int err = 0; - if (!ice_fltr_add_vlan(vsi, vid, action)) { + 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", - vid, vsi->vsi_num); + vlan->vid, vsi->vsi_num); } return err; @@ -31,9 +29,9 @@ ice_vsi_add_vlan(struct ice_vsi *vsi, u16 vid, enum ice_sw_fwd_act_type action) /** * ice_vsi_del_vlan - default del VLAN implementation for all VSI types * @vsi: VSI being configured - * @vid: VLAN ID to be removed + * @vlan: VLAN filter to delete */ -int ice_vsi_del_vlan(struct ice_vsi *vsi, u16 vid) +int ice_vsi_del_vlan(struct ice_vsi *vsi, struct ice_vlan *vlan) { struct ice_pf *pf = vsi->back; struct device *dev; @@ -41,16 +39,16 @@ int ice_vsi_del_vlan(struct ice_vsi *vsi, u16 vid) dev = ice_pf_to_dev(pf); - err = ice_fltr_remove_vlan(vsi, vid, ICE_FWD_TO_VSI); + err = ice_fltr_remove_vlan(vsi, vlan); 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", - vid, vsi->vsi_num); + vlan->vid, vsi->vsi_num); err = 0; } else { dev_err(dev, "Error removing VLAN %d on VSI %i error: %d\n", - vid, vsi->vsi_num, err); + vlan->vid, vsi->vsi_num, err); } return err; @@ -214,9 +212,16 @@ out: return ret; } -int ice_vsi_set_port_vlan(struct ice_vsi *vsi, u16 pvid_info) +int ice_vsi_set_port_vlan(struct ice_vsi *vsi, struct ice_vlan *vlan) { - return ice_vsi_manage_pvid(vsi, pvid_info, true); + u16 port_vlan_info; + + if (vlan->prio > 7) + return -EINVAL; + + port_vlan_info = vlan->vid | (vlan->prio << VLAN_PRIO_SHIFT); + + return ice_vsi_manage_pvid(vsi, port_vlan_info, true); } /** |