]> git.baikalelectronics.ru Git - kernel.git/commitdiff
ice: Add helper function for adding VLAN 0
authorBrett Creeley <brett.creeley@intel.com>
Thu, 2 Dec 2021 16:38:40 +0000 (08:38 -0800)
committerTony Nguyen <anthony.l.nguyen@intel.com>
Wed, 9 Feb 2022 17:24:45 +0000 (09:24 -0800)
There are multiple places where VLAN 0 is being added. Create a function
to be called in order to minimize changes as the implementation is expanded
to support double VLAN and avoid duplicated code.

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>
drivers/net/ethernet/intel/ice/ice_eswitch.c
drivers/net/ethernet/intel/ice/ice_lib.c
drivers/net/ethernet/intel/ice/ice_lib.h
drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c

index 864692b157b6f8901f8d6b6808499bd51331e842..a55c046a607d811d3e72dc7290b863f2cbb1033e 100644 (file)
@@ -126,7 +126,7 @@ static int ice_eswitch_setup_env(struct ice_pf *pf)
        __dev_mc_unsync(uplink_netdev, NULL);
        netif_addr_unlock_bh(uplink_netdev);
 
-       if (ice_vsi_add_vlan(uplink_vsi, 0, ICE_FWD_TO_VSI))
+       if (ice_vsi_add_vlan_zero(uplink_vsi))
                goto err_def_rx;
 
        if (!ice_is_dflt_vsi_in_use(uplink_vsi->vsw)) {
@@ -230,7 +230,7 @@ static int ice_eswitch_setup_reprs(struct ice_pf *pf)
                        goto err;
                }
 
-               if (ice_vsi_add_vlan(vsi, 0, ICE_FWD_TO_VSI)) {
+               if (ice_vsi_add_vlan_zero(vsi)) {
                        ice_fltr_add_mac_and_broadcast(vsi,
                                                       vf->hw_lan_addr.addr,
                                                       ICE_FWD_TO_VSI);
index 5b5480c3d2543a7b805c3bb9922da2df0f34a208..b5d6b317182a3ec82bf4d3b0627fe1e275d5f315 100644 (file)
@@ -2663,7 +2663,7 @@ ice_vsi_setup(struct ice_pf *pf, struct ice_port_info *pi,
                 * so this handles those cases (i.e. adding the PF to a bridge
                 * without the 8021q module loaded).
                 */
-               ret = ice_vsi_add_vlan(vsi, 0, ICE_FWD_TO_VSI);
+               ret = ice_vsi_add_vlan_zero(vsi);
                if (ret)
                        goto unroll_clear_rings;
 
@@ -4111,6 +4111,15 @@ int ice_set_link(struct ice_vsi *vsi, bool ena)
        return 0;
 }
 
+/**
+ * ice_vsi_add_vlan_zero - add VLAN 0 filter(s) for this VSI
+ * @vsi: VSI used to add VLAN filters
+ */
+int ice_vsi_add_vlan_zero(struct ice_vsi *vsi)
+{
+       return ice_vsi_add_vlan(vsi, 0, ICE_FWD_TO_VSI);
+}
+
 /**
  * ice_is_feature_supported
  * @pf: pointer to the struct ice_pf instance
index b2ed189527d6e4d770bf0c534f4c0d93674df1b8..9a554bee4b03e4cbd174451ac2d335df2b873d7a 100644 (file)
@@ -132,7 +132,7 @@ void ice_vsi_ctx_clear_antispoof(struct ice_vsi_ctx *ctx);
 void ice_vsi_ctx_set_allow_override(struct ice_vsi_ctx *ctx);
 
 void ice_vsi_ctx_clear_allow_override(struct ice_vsi_ctx *ctx);
-
+int ice_vsi_add_vlan_zero(struct ice_vsi *vsi);
 bool ice_is_feature_supported(struct ice_pf *pf, enum ice_feature f);
 void ice_clear_feature_support(struct ice_pf *pf, enum ice_feature f);
 void ice_init_feature_support(struct ice_pf *pf);
index 81974dbc1625e95e278ebe2ce504e52e90011ca2..bd57d8f6525760909e1f76a73a290e19d45127b9 100644 (file)
@@ -1857,7 +1857,7 @@ static int ice_init_vf_vsi_res(struct ice_vf *vf)
        if (!vsi)
                return -ENOMEM;
 
-       err = ice_vsi_add_vlan(vsi, 0, ICE_FWD_TO_VSI);
+       err = ice_vsi_add_vlan_zero(vsi);
        if (err) {
                dev_warn(dev, "Failed to add VLAN 0 filter for VF %d\n",
                         vf->vf_id);