fm10k: fix multi-bit VLAN update requests from VF
authorJacob Keller <jacob.e.keller@intel.com>
Thu, 31 Mar 2016 16:52:30 +0000 (09:52 -0700)
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>
Thu, 14 Apr 2016 03:06:55 +0000 (20:06 -0700)
commitf808c5dbcdc393be8e9f676c61baac6a3db382c1
treec7ecff5bab3471fb8a95d93b07ed6e59ccf48711
parent3f3f7cb875c0f621485644d4fd7453b0d37f00e4
fm10k: fix multi-bit VLAN update requests from VF

The VF uses a multi-bit update request to clear unused VLANs whenever it
resets. However, an accident in a previous refector broke multi-bit
updates for VFs, due to misreading a comment in fm10k_vf.c and
attempting to reduce code duplication. The problem occurs because
a multi-bit request has a non-zero length, and the PF would simply drop
any request with the upper 16 bits set.

We can't simply remove the check of the upper 16 bits and the call to
fm10k_iov_select vid, because this would remove the checks for default
VID and for ensuring no other VLANs can be enabled except pf_vid when it
has been set. To resolve that issue, this revision uses the
iov_select_vid when we have a single-bit update, and denies any
multi-bit update when the VLAN was administratively set by the PF. This
should be ok since the PF properly updates VLAN_TABLE when it assigns
the PF vid. This ensures that requests to add or remove the PF vid work
as expected, but a rogue VF could not use the multi-bit update as
a loophole to attempt receiving traffic on other VLANs.

Reported-by: Ngai-Mint Kwan <ngai-mint.kwan@intel.com>
Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Tested-by: Krishneil Singh <Krishneil.k.singh@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
drivers/net/ethernet/intel/fm10k/fm10k_pf.c