i40e: Fix correct max_pkt_size on VF RX queue

Setting VLAN port increasing RX queue max_pkt_size
by 4 bytes to take VLAN tag into account.
Trigger the VF reset when setting port VLAN for
VF to renegotiate its capabilities and reinitialize.

Fixes: ba4e003d29 ("i40e: don't hold spinlock while resetting VF")
Signed-off-by: Sylwester Dziedziuch <sylwesterx.dziedziuch@intel.com>
Signed-off-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Signed-off-by: Eryk Rybak <eryk.roch.rybak@intel.com>
Tested-by: Konrad Jankowski <konrad0.jankowski@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
This commit is contained in:
Eryk Rybak 2021-01-21 16:17:22 +00:00 committed by Tony Nguyen
parent c366ce2875
commit 6afbd7b3c5

View File

@ -674,14 +674,13 @@ static int i40e_config_vsi_rx_queue(struct i40e_vf *vf, u16 vsi_id,
u16 vsi_queue_id,
struct virtchnl_rxq_info *info)
{
u16 pf_queue_id = i40e_vc_get_pf_queue_id(vf, vsi_id, vsi_queue_id);
struct i40e_pf *pf = vf->pf;
struct i40e_vsi *vsi = pf->vsi[vf->lan_vsi_idx];
struct i40e_hw *hw = &pf->hw;
struct i40e_hmc_obj_rxq rx_ctx;
u16 pf_queue_id;
int ret = 0;
pf_queue_id = i40e_vc_get_pf_queue_id(vf, vsi_id, vsi_queue_id);
/* clear the context structure first */
memset(&rx_ctx, 0, sizeof(struct i40e_hmc_obj_rxq));
@ -719,6 +718,10 @@ static int i40e_config_vsi_rx_queue(struct i40e_vf *vf, u16 vsi_id,
}
rx_ctx.rxmax = info->max_pkt_size;
/* if port VLAN is configured increase the max packet size */
if (vsi->info.pvid)
rx_ctx.rxmax += VLAN_HLEN;
/* enable 32bytes desc always */
rx_ctx.dsize = 1;
@ -4169,34 +4172,6 @@ error_param:
return ret;
}
/**
* i40e_vsi_has_vlans - True if VSI has configured VLANs
* @vsi: pointer to the vsi
*
* Check if a VSI has configured any VLANs. False if we have a port VLAN or if
* we have no configured VLANs. Do not call while holding the
* mac_filter_hash_lock.
*/
static bool i40e_vsi_has_vlans(struct i40e_vsi *vsi)
{
bool have_vlans;
/* If we have a port VLAN, then the VSI cannot have any VLANs
* configured, as all MAC/VLAN filters will be assigned to the PVID.
*/
if (vsi->info.pvid)
return false;
/* Since we don't have a PVID, we know that if the device is in VLAN
* mode it must be because of a VLAN filter configured on this VSI.
*/
spin_lock_bh(&vsi->mac_filter_hash_lock);
have_vlans = i40e_is_vsi_in_vlan(vsi);
spin_unlock_bh(&vsi->mac_filter_hash_lock);
return have_vlans;
}
/**
* i40e_ndo_set_vf_port_vlan
* @netdev: network interface device structure
@ -4253,19 +4228,9 @@ int i40e_ndo_set_vf_port_vlan(struct net_device *netdev, int vf_id,
/* duplicate request, so just return success */
goto error_pvid;
if (i40e_vsi_has_vlans(vsi)) {
dev_err(&pf->pdev->dev,
"VF %d has already configured VLAN filters and the administrator is requesting a port VLAN override.\nPlease unload and reload the VF driver for this change to take effect.\n",
vf_id);
/* Administrator Error - knock the VF offline until he does
* the right thing by reconfiguring his network correctly
* and then reloading the VF driver.
*/
i40e_vc_disable_vf(vf);
/* During reset the VF got a new VSI, so refresh the pointer. */
vsi = pf->vsi[vf->lan_vsi_idx];
}
i40e_vc_disable_vf(vf);
/* During reset the VF got a new VSI, so refresh a pointer. */
vsi = pf->vsi[vf->lan_vsi_idx];
/* Locked once because multiple functions below iterate list */
spin_lock_bh(&vsi->mac_filter_hash_lock);