Commit cf315ea5 authored by Ngai-Mint Kwan's avatar Ngai-Mint Kwan Committed by Jeff Kirsher

fm10k: fix "failed to kill vid" message for VF

When a VF is under PF VLAN assignment:

ip link set <pf> vf <#> vlan <vid>

This will remove all previous entries in the VLAN table including those
generated by VLAN interfaces created on the VF. The issue arises when
the VF is under PF VLAN assignment and one or more of these VLAN
interfaces of the VF are deleted. When deleting these VLAN interfaces,
the following message will be generated in "dmesg":

failed to kill vid 0081/<vid> for device <vf>

This is due to the fact that "ndo_vlan_rx_kill_vid" exits with an error.
The handler for this ndo is "fm10k_update_vid". Any calls to this
function while under PF VLAN management will exit prematurely and, thus,
it will generate the failure message.

Additionally, since "fm10k_update_vid" exits prematurely, none of the
VLAN update is performed. So, even though the actual VLAN interfaces of
the VF will be deleted, the active_vlans bitmask is not cleared. When
the VF is no longer under PF VLAN assignment, the driver mistakenly
restores the previous entries of the VLAN table based on an
unsynchronized list of active VLANs.

The solution to this issue involves checking the VLAN update action type
before exiting "fm10k_update_vid". If the VLAN update action type is to
"add", this action will not be permitted while the VF is under PF VLAN
assignment and the VLAN update is abandoned like before.

However, if the VLAN update action type is to "kill", then we need to
also clear the active_vlans bitmask. However, we don't need to actually
queue any messages to the PF, because the MAC and VLAN tables have
already been cleared, and the PF would silently ignore these requests
anyways.
Signed-off-by: default avatarNgai-Mint Kwan <ngai-mint.kwan@intel.com>
Signed-off-by: default avatarJacob Keller <jacob.e.keller@intel.com>
Tested-by: default avatarKrishneil Singh <krishneil.k.singh@intel.com>
Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
parent c8eeacb3
...@@ -934,8 +934,12 @@ static int fm10k_update_vid(struct net_device *netdev, u16 vid, bool set) ...@@ -934,8 +934,12 @@ static int fm10k_update_vid(struct net_device *netdev, u16 vid, bool set)
if (vid >= VLAN_N_VID) if (vid >= VLAN_N_VID)
return -EINVAL; return -EINVAL;
/* Verify we have permission to add VLANs */ /* Verify that we have permission to add VLANs. If this is a request
if (hw->mac.vlan_override) * to remove a VLAN, we still want to allow the user to remove the
* VLAN device. In that case, we need to clear the bit in the
* active_vlans bitmask.
*/
if (set && hw->mac.vlan_override)
return -EACCES; return -EACCES;
/* update active_vlans bitmask */ /* update active_vlans bitmask */
...@@ -954,6 +958,12 @@ static int fm10k_update_vid(struct net_device *netdev, u16 vid, bool set) ...@@ -954,6 +958,12 @@ static int fm10k_update_vid(struct net_device *netdev, u16 vid, bool set)
rx_ring->vid &= ~FM10K_VLAN_CLEAR; rx_ring->vid &= ~FM10K_VLAN_CLEAR;
} }
/* If our VLAN has been overridden, there is no reason to send VLAN
* removal requests as they will be silently ignored.
*/
if (hw->mac.vlan_override)
return 0;
/* Do not remove default VLAN ID related entries from VLAN and MAC /* Do not remove default VLAN ID related entries from VLAN and MAC
* tables * tables
*/ */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment