diff options
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 | 57 | 
1 files changed, 57 insertions, 0 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 6e8f2aab6080..5291f2888ef8 100644 --- a/drivers/net/ethernet/intel/ice/ice_vsi_vlan_lib.c +++ b/drivers/net/ethernet/intel/ice/ice_vsi_vlan_lib.c @@ -787,3 +787,60 @@ int ice_vsi_clear_outer_port_vlan(struct ice_vsi *vsi)  	kfree(ctxt);  	return err;  } + +int ice_vsi_clear_port_vlan(struct ice_vsi *vsi) +{ +	struct ice_hw *hw = &vsi->back->hw; +	struct ice_vsi_ctx *ctxt; +	int err; + +	ctxt = kzalloc(sizeof(*ctxt), GFP_KERNEL); +	if (!ctxt) +		return -ENOMEM; + +	ctxt->info = vsi->info; + +	ctxt->info.port_based_outer_vlan = 0; +	ctxt->info.port_based_inner_vlan = 0; + +	ctxt->info.inner_vlan_flags = +		FIELD_PREP(ICE_AQ_VSI_INNER_VLAN_TX_MODE_M, +			   ICE_AQ_VSI_INNER_VLAN_TX_MODE_ALL); +	if (ice_is_dvm_ena(hw)) { +		ctxt->info.inner_vlan_flags |= +			FIELD_PREP(ICE_AQ_VSI_INNER_VLAN_EMODE_M, +				   ICE_AQ_VSI_INNER_VLAN_EMODE_NOTHING); +		ctxt->info.outer_vlan_flags = +			FIELD_PREP(ICE_AQ_VSI_OUTER_VLAN_TX_MODE_M, +				   ICE_AQ_VSI_OUTER_VLAN_TX_MODE_ALL); +		ctxt->info.outer_vlan_flags |= +			FIELD_PREP(ICE_AQ_VSI_OUTER_TAG_TYPE_M, +				   ICE_AQ_VSI_OUTER_TAG_VLAN_8100); +		ctxt->info.outer_vlan_flags |= +			ICE_AQ_VSI_OUTER_VLAN_EMODE_NOTHING << +			ICE_AQ_VSI_OUTER_VLAN_EMODE_S; +	} + +	ctxt->info.sw_flags2 &= ~ICE_AQ_VSI_SW_FLAG_RX_VLAN_PRUNE_ENA; +	ctxt->info.valid_sections = +		cpu_to_le16(ICE_AQ_VSI_PROP_OUTER_TAG_VALID | +			    ICE_AQ_VSI_PROP_VLAN_VALID | +			    ICE_AQ_VSI_PROP_SW_VALID); + +	err = ice_update_vsi(hw, vsi->idx, ctxt, NULL); +	if (err) { +		dev_err(ice_pf_to_dev(vsi->back), "update VSI for clearing port based VLAN failed, err %d aq_err %s\n", +			err, ice_aq_str(hw->adminq.sq_last_status)); +	} else { +		vsi->info.port_based_outer_vlan = +			ctxt->info.port_based_outer_vlan; +		vsi->info.port_based_inner_vlan = +			ctxt->info.port_based_inner_vlan; +		vsi->info.outer_vlan_flags = ctxt->info.outer_vlan_flags; +		vsi->info.inner_vlan_flags = ctxt->info.inner_vlan_flags; +		vsi->info.sw_flags2 = ctxt->info.sw_flags2; +	} + +	kfree(ctxt); +	return err; +}  | 
