Skip to content

Commit

Permalink
ice: Don't modify stripping for add/del VLANs on VF
Browse files Browse the repository at this point in the history
Currently when adding/deleting vlans in ice_vc_process_vlan_msg()
we are calling ice_vsi_manage_vlan_stripping() to enable/disable
when adding and deleting a VLAN respectively. This is wrong
because adding/deleting VLANs has nothing to do with configuring
VLAN stripping. VLAN stripping is configured through the
following VIRTCHNL operations:
	VIRTCHNL_OP_ENABLE_VLAN_STRIPPING
	VIRTCHNL_OP_DISABLE_VLAN_STRIPPING

Unfortunately we can't just remove this because then stripping
will never be configured on VF initialization. Fix this by
adding a new function that initializes (disables/enables) VLAN
stripping for the VF based on the device supported capabilities.
This allows us to remove the call to
ice_vsi_manage_vlan_stripping() in ice_vc_process_vlan_msg().

Signed-off-by: Brett Creeley <brett.creeley@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
  • Loading branch information
Brett Creeley authored and Jeff Kirsher committed Nov 22, 2019
1 parent d4bc4e2 commit 2f9ec24
Showing 1 changed file with 31 additions and 8 deletions.
39 changes: 31 additions & 8 deletions drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c
Original file line number Diff line number Diff line change
Expand Up @@ -2735,14 +2735,6 @@ static int ice_vc_process_vlan_msg(struct ice_vf *vf, u8 *msg, bool add_v)
goto error_param;
}

if (ice_vsi_manage_vlan_stripping(vsi, add_v)) {
dev_err(&pf->pdev->dev,
"%sable VLAN stripping failed for VSI %i\n",
add_v ? "en" : "dis", vsi->vsi_num);
v_ret = VIRTCHNL_STATUS_ERR_PARAM;
goto error_param;
}

if (test_bit(ICE_VF_STATE_UC_PROMISC, vf->vf_states) ||
test_bit(ICE_VF_STATE_MC_PROMISC, vf->vf_states))
vlan_promisc = true;
Expand Down Expand Up @@ -2933,6 +2925,33 @@ static int ice_vc_dis_vlan_stripping(struct ice_vf *vf)
v_ret, NULL, 0);
}

/**
* ice_vf_init_vlan_stripping - enable/disable VLAN stripping on initialization
* @vf: VF to enable/disable VLAN stripping for on initialization
*
* If the VIRTCHNL_VF_OFFLOAD_VLAN flag is set enable VLAN stripping, else if
* the flag is cleared then we want to disable stripping. For example, the flag
* will be cleared when port VLANs are configured by the administrator before
* passing the VF to the guest or if the AVF driver doesn't support VLAN
* offloads.
*/
static int ice_vf_init_vlan_stripping(struct ice_vf *vf)
{
struct ice_vsi *vsi = vf->pf->vsi[vf->lan_vsi_idx];

if (!vsi)
return -EINVAL;

/* don't modify stripping if port VLAN is configured */
if (vsi->info.pvid)
return 0;

if (ice_vf_vlan_offload_ena(vf->driver_caps))
return ice_vsi_manage_vlan_stripping(vsi, true);
else
return ice_vsi_manage_vlan_stripping(vsi, false);
}

/**
* ice_vc_process_vf_msg - Process request from VF
* @pf: pointer to the PF structure
Expand Down Expand Up @@ -2987,6 +3006,10 @@ void ice_vc_process_vf_msg(struct ice_pf *pf, struct ice_rq_event_info *event)
break;
case VIRTCHNL_OP_GET_VF_RESOURCES:
err = ice_vc_get_vf_res_msg(vf, msg);
if (ice_vf_init_vlan_stripping(vf))
dev_err(&pf->pdev->dev,
"Failed to initialize VLAN stripping for VF %d\n",
vf->vf_id);
ice_vc_notify_vf_link_state(vf);
break;
case VIRTCHNL_OP_RESET_VF:
Expand Down

0 comments on commit 2f9ec24

Please sign in to comment.