1
0
Fork 0

i40e: VF's promiscuous attribute is not kept

This patch fixes a bug where the promiscuous mode was not being
kept when the VF switched to a new VLAN.
Now we are config two times a promiscuous mode when we switch VLAN.
Without this change when we change VF VLAN we still receive
all the packets from previous VLAN and only unicast from new VLAN.

Signed-off-by: Grzegorz Siwik <grzegorz.siwik@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
hifive-unleashed-5.2
Grzegorz Siwik 2019-03-29 15:08:30 -07:00 committed by Jeff Kirsher
parent a734d1f4c2
commit 937f599a11
1 changed files with 23 additions and 0 deletions

View File

@ -4016,6 +4016,7 @@ int i40e_ndo_set_vf_port_vlan(struct net_device *netdev, int vf_id,
{
u16 vlanprio = vlan_id | (qos << I40E_VLAN_PRIORITY_SHIFT);
struct i40e_netdev_priv *np = netdev_priv(netdev);
bool allmulti = false, alluni = false;
struct i40e_pf *pf = np->vsi->back;
struct i40e_vsi *vsi;
struct i40e_vf *vf;
@ -4100,6 +4101,15 @@ int i40e_ndo_set_vf_port_vlan(struct net_device *netdev, int vf_id,
}
spin_unlock_bh(&vsi->mac_filter_hash_lock);
/* disable promisc modes in case they were enabled */
ret = i40e_config_vf_promiscuous_mode(vf, vf->lan_vsi_id,
allmulti, alluni);
if (ret) {
dev_err(&pf->pdev->dev, "Unable to config VF promiscuous mode\n");
goto error_pvid;
}
if (vlan_id || qos)
ret = i40e_vsi_add_pvid(vsi, vlanprio);
else
@ -4126,6 +4136,12 @@ int i40e_ndo_set_vf_port_vlan(struct net_device *netdev, int vf_id,
spin_unlock_bh(&vsi->mac_filter_hash_lock);
if (test_bit(I40E_VF_STATE_UC_PROMISC, &vf->vf_states))
alluni = true;
if (test_bit(I40E_VF_STATE_MC_PROMISC, &vf->vf_states))
allmulti = true;
/* Schedule the worker thread to take care of applying changes */
i40e_service_event_schedule(vsi->back);
@ -4138,6 +4154,13 @@ int i40e_ndo_set_vf_port_vlan(struct net_device *netdev, int vf_id,
* default LAN MAC address.
*/
vf->port_vlan_id = le16_to_cpu(vsi->info.pvid);
ret = i40e_config_vf_promiscuous_mode(vf, vsi->id, allmulti, alluni);
if (ret) {
dev_err(&pf->pdev->dev, "Unable to config vf promiscuous mode\n");
goto error_pvid;
}
ret = 0;
error_pvid: