linux/drivers/net/ethernet
Mateusz Palczewski c87c938f62 i40e: Add VF VLAN pruning
VFs by default are able to see all tagged traffic regardless of trust
and VLAN filters configured.

Add new private flag vf-vlan-pruning that allows changing of default
VF behavior for tagged traffic. When the flag is turned on
untrusted VF will only be able to receive untagged traffic
or traffic with VLAN tags it has created interfaces for

The flag is off by default and can only be changed if
there are no VFs spawned on the PF. This flag will only be effective
when no PVID is set on VF and VF is not trusted.
Add new function that computes the correct VLAN ID for VF VLAN filters
based on trust, PVID, vf-vlan-prune-disable flag and current VLAN ID.

Testing Hints:

Test 1: vf-vlan-pruning == off
==============================
1. Set the private flag
> ethtool --set-priv-flag eth0 vf-vlan-pruning off (default setting)
2. Use scapy to send any VLAN tagged traffic and make sure the VF
receives all VLAN tagged traffic that matches its destination MAC
filters (unicast, multicast, and broadcast).

Test 2: vf-vlan-pruning == on
==============================
1. Set the private flag
> ethtool --set-priv-flag eth0 vf-vlan-pruning on
2. Use scapy to send any VLAN tagged traffic and make sure the VF does
not receive any VLAN tagged traffic that matches its destination MAC
filters (unicast, multicast, and broadcast).
3. Add a VLAN filter on the VF netdev
> ip link add link eth0v0 name vlan10 type vlan id 10
4. Bring the VLAN netdev up
> ip link set vlan10 up
4. Use scapy to send traffic with VLAN 10, VLAN 11 (anything not VLAN
10), and untagged traffic. Make sure the VF only receives VLAN 10
and untagged traffic when the link partner is sending.

Test 3: vf-vlan-pruning == off && VF is in a port VLAN
==============================
1. Set the private flag
> ethtool --set-priv-flag eth0 vf-vlan-pruning off (default setting)
2. Create a VF
> echo 1 > sriov_numvfs
3. Put the VF in a port VLAN
> ip link set eth0 vf 0 vlan 10
4. Use scapy to send traffic with VLAN 10 and VLAN 11 (anything not VLAN
10) and make sure the VF only receives untagged traffic when the link
partner is sending VLAN 10 tagged traffic as the VLAN tag is expected
to be stripped by HW for port VLANs and not visible to the VF.

Test 4: Change vf-vlan-pruning while VFs are created
==============================
echo 0 > sriov_numvfs
ethtool --set-priv-flag eth0 vf-vlan-pruning off
echo 1 > sriov_numvfs
ethtool --set-priv-flag eth0 vf-vlan-pruning on (expect failure)

Signed-off-by: Sylwester Dziedziuch <sylwesterx.dziedziuch@intel.com>
Signed-off-by: Przemyslaw Patynowski <przemyslawx.patynowski@intel.com>
Signed-off-by: Mateusz Palczewski <mateusz.palczewski@intel.com>
Tested-by: Konrad Jankowski <konrad0.jankowski@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
2022-06-07 10:27:02 -07:00
..
3com eth: switch to netif_napi_add_weight() 2022-05-08 11:33:57 +01:00
8390 ethernet: 8390: Remove unnecessary print function dev_err() 2022-03-11 22:59:03 -08:00
actions
adaptec eth: switch to netif_napi_add_weight() 2022-05-08 11:33:57 +01:00
aeroflex
agere
alacritech slic: remove a copy of the NAPI_POLL_WEIGHT define 2022-04-29 11:56:41 +01:00
allwinner
alteon
altera net: altera: Replace kernel.h with the necessary inclusions 2022-06-07 11:13:43 +02:00
amazon eth: remove remaining copies of the NAPI_POLL_WEIGHT define 2022-04-30 14:00:45 +01:00
amd net: allow gso_max_size to exceed 65536 2022-05-16 10:18:55 +01:00
apm drivers: net: xgene: Fix regression in CRC stripping 2022-03-23 10:30:05 -07:00
apple net: ethernet: Prepare cleanup of powerpc's asm/prom.h 2022-05-05 15:53:02 -07:00
aquantia Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2022-05-12 16:15:30 -07:00
arc eth: switch to netif_napi_add_weight() 2022-05-08 11:33:57 +01:00
asix
atheros eth: switch to netif_napi_add_weight() 2022-05-08 11:33:57 +01:00
broadcom eth: tg3: silence the GCC 12 array-bounds warning 2022-05-22 22:21:11 +01:00
brocade eth: remove remaining copies of the NAPI_POLL_WEIGHT define 2022-04-30 14:00:45 +01:00
cadence Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2022-05-23 21:19:17 -07:00
calxeda net: calxedaxgmac: Fix typo (doubled "the") 2022-04-11 20:49:21 -07:00
cavium net: thunderx: remove null check after call container_of() 2022-05-17 17:39:49 -07:00
chelsio Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2022-05-12 16:15:30 -07:00
cirrus cirrus: cs89x0: fix typo in comment 2022-05-22 20:44:29 +01:00
cisco
cortina eth: remove copies of the NAPI_POLL_WEIGHT define 2022-04-29 11:56:41 +01:00
davicom
dec eth: de4x5: remove support for Generic DECchip & DIGITAL EtherWORKS PCI/EISA 2022-05-23 11:43:51 +01:00
dlink
emulex net: make drivers set the TSO limit not the GSO limit 2022-05-06 12:07:56 +01:00
engleder tsnep: Add free running cycle counter support 2022-05-10 09:48:09 +02:00
ezchip eth: switch to netif_napi_add_weight() 2022-05-08 11:33:57 +01:00
faraday net: ftgmac100: Disable hardware checksum on AST2600 2022-05-18 14:03:30 +01:00
freescale net: enetc: Use pci_release_region() to release some resources 2022-05-28 20:20:42 +01:00
fujitsu
fungible net: switch to netif_napi_add_tx() 2022-05-05 15:54:12 -07:00
google gve: Fix spelling mistake "droping" -> "dropping" 2022-03-16 19:29:00 -07:00
hisilicon net: hns3: fix incorrect type of argument in declaration of function hclge_comm_get_rss_indir_tbl 2022-05-09 14:30:38 +01:00
huawei Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2022-05-23 21:19:17 -07:00
i825xx Networking changes for 5.18. 2022-03-24 13:13:26 -07:00
ibm eth: switch to netif_napi_add_weight() 2022-05-08 11:33:57 +01:00
intel i40e: Add VF VLAN pruning 2022-06-07 10:27:02 -07:00
litex
marvell octeontx2-af: fix error code in is_valid_offset() 2022-06-01 11:49:44 +02:00
mediatek net: ethernet: mtk_eth_soc: out of bounds read in mtk_hwlro_get_fdir_entry() 2022-05-27 07:59:41 +01:00
mellanox Networking fixes for 5.19-rc1, including fixes from bpf, and netfilter. 2022-06-02 12:50:16 -07:00
micrel net: micrel: Fix KS8851 Kconfig 2022-04-05 17:32:05 -07:00
microchip net: lan743x: PCI11010 / PCI11414 fix 2022-05-27 12:09:46 +01:00
microsoft eth: switch to netif_napi_add_weight() 2022-05-08 11:33:57 +01:00
moxa eth: switch to netif_napi_add_weight() 2022-05-08 11:33:57 +01:00
mscc net: mscc: ocelot: switch from {,un}set to {,un}assign for tag_8021q CPU ports 2022-05-23 10:39:54 +01:00
myricom eth: switch to netif_napi_add_weight() 2022-05-08 11:33:57 +01:00
natsemi net: remove comments that mention obsolete __SLOW_DOWN_IO 2022-04-26 17:09:24 -07:00
neterion net: vxge: Remove unnecessary synchronize_irq() before free_irq() 2022-05-17 13:03:14 +02:00
netronome nfp: remove padding in nfp_nfdk_tx_desc 2022-06-02 11:08:43 +02:00
ni
nvidia eth: remove remaining copies of the NAPI_POLL_WEIGHT define 2022-04-30 14:00:45 +01:00
nxp eth: switch to netif_napi_add_weight() 2022-05-08 11:33:57 +01:00
oki-semi eth: pch_gbe: remove a copy of the NAPI_POLL_WEIGHT define 2022-04-29 11:56:41 +01:00
packetengines drivers: net: packetengines: fix typos in comments 2022-03-14 10:04:28 -07:00
pasemi
pensando ionic: fix missing pci_release_regions() on error in ionic_probe() 2022-05-09 15:49:12 -07:00
qlogic qed: fix typos in comments 2022-05-22 20:44:30 +01:00
qualcomm net: add per-cpu storage and net->core_stats 2022-03-11 23:17:24 -08:00
rdc
realtek eth: switch to netif_napi_add_weight() 2022-05-08 11:33:57 +01:00
renesas ravb: Add support for RZ/V2M 2022-05-16 10:14:27 +01:00
rocker net: switch to netif_napi_add_tx() 2022-05-05 15:54:12 -07:00
samsung
seeq
sfc sfc/siena: fix wrong tx channel offset with efx_separate_tx_channels 2022-06-01 17:47:17 -07:00
sgi
silan
sis
smsc asm-generic changes for 5.19 2022-05-26 10:50:30 -07:00
socionext net: switch to netif_napi_add_tx() 2022-05-05 15:54:12 -07:00
stmicro stmmac: intel: Add RPL-P PCI ID 2022-06-02 10:14:43 -07:00
sun Networking changes for 5.19. 2022-05-25 12:22:58 -07:00
sunplus net: ethernet: SP7021: fix a use after free of skb->len 2022-05-19 17:46:56 -07:00
synopsys net: allow gso_max_size to exceed 65536 2022-05-16 10:18:55 +01:00
tehuti
ti net: ethernet: ti: am65-cpsw-nuss: Fix some refcount leaks 2022-05-27 08:00:40 +01:00
toshiba eth: switch to netif_napi_add_weight() 2022-05-08 11:33:57 +01:00
tundra
vertexcom
via eth: velocity: remove a copy of the NAPI_POLL_WEIGHT define 2022-04-29 11:56:42 +01:00
wiznet eth: switch to netif_napi_add_weight() 2022-05-08 11:33:57 +01:00
xilinx net: axienet: Use NAPI for TX completion path 2022-05-13 12:22:11 +01:00
xircom
xscale eth: switch to netif_napi_add_weight() 2022-05-08 11:33:57 +01:00
dnet.c
dnet.h
ec_bhf.c
ethoc.c
fealnx.c
jme.c jme: remove an unnecessary indirection 2022-05-05 15:53:28 -07:00
jme.h jme: remove an unnecessary indirection 2022-05-05 15:53:28 -07:00
Kconfig net: ethernet: Add driver for Sunplus SP7021 2022-05-10 11:31:32 +02:00
korina.c
lantiq_etop.c eth: switch to netif_napi_add_weight() 2022-05-08 11:33:57 +01:00
lantiq_xrx200.c net: switch to netif_napi_add_tx() 2022-05-05 15:54:12 -07:00
Makefile net: ethernet: Add driver for Sunplus SP7021 2022-05-10 11:31:32 +02:00