1
0
Fork 0
mirror of synced 2025-03-06 20:59:54 +01:00
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 ethernet: aeroflex: use eth_hw_addr_set() 2021-10-16 08:53:45 +01:00
agere et131x: support arbitrary MAX_SKB_FRAGS 2022-02-08 16:51:23 -08:00
alacritech slic: remove a copy of the NAPI_POLL_WEIGHT define 2022-04-29 11:56:41 +01:00
allwinner net: ethernet: sun4i-emac: Fix an error handling path in emac_probe() 2022-01-15 22:34:52 +00:00
alteon net: alteon: Simplify DMA setting 2022-01-09 16:52:18 -08:00
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 net: ethernet: Use netif_rx(). 2022-03-04 12:02:19 +00:00
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 Updates for the interrupt subsystem: 2022-01-13 08:53:45 -08:00
cortina eth: remove copies of the NAPI_POLL_WEIGHT define 2022-04-29 11:56:41 +01:00
davicom net: ethernet: Use netif_rx(). 2022-03-04 12:02:19 +00:00
dec eth: de4x5: remove support for Generic DECchip & DIGITAL EtherWORKS PCI/EISA 2022-05-23 11:43:51 +01:00
dlink net: sundance: Replace one-element array with non-array object 2022-02-05 15:30:32 +00:00
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 ethernet: use eth_hw_addr_set() in unmaintained drivers 2021-10-18 13:20:38 +01:00
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 net: ethernet: litex: Add the dependency on HAS_IOMEM 2022-02-08 20:43:40 -08:00
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 net: nixge: Use GFP_KERNEL instead of GFP_ATOMIC when possible 2022-02-17 20:03:39 -08:00
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 ethtool: extend ringparam setting/getting API with rx_buf_len 2021-11-22 12:31:49 +00:00
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 ethernet: replace netdev->dev_addr 16bit writes 2021-10-14 09:22:27 -07:00
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 Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2022-03-03 11:55:12 -08:00
seeq ethernet: seeq/ether3: don't write directly to netdev->dev_addr 2022-01-26 15:40:01 +00:00
sfc sfc/siena: fix wrong tx channel offset with efx_separate_tx_channels 2022-06-01 17:47:17 -07:00
sgi
silan ethernet: use eth_hw_addr_set() in unmaintained drivers 2021-10-18 13:20:38 +01:00
sis ethernet: sis900: fix indentation 2021-11-12 20:13:28 -08:00
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 tehuti: Use dma_set_mask_and_coherent() and simplify code 2022-01-02 12:21:16 +00:00
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 ethernet: tundra: don't write directly to netdev->dev_addr 2022-01-26 15:40:01 +00:00
vertexcom net: ethernet: Use netif_rx(). 2022-03-04 12:02:19 +00:00
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 ethernet: use eth_hw_addr_set() in unmaintained drivers 2021-10-18 13:20:38 +01:00
xscale eth: switch to netif_napi_add_weight() 2022-05-08 11:33:57 +01:00
dnet.c ethernet: manually convert memcpy(dev_addr,..., sizeof(addr)) 2021-10-14 09:22:19 -07:00
dnet.h
ec_bhf.c ethernet: ec_bhf: use eth_hw_addr_set() 2021-10-16 08:53:46 +01:00
ethoc.c net: ethoc: Use platform_get_irq() to get the interrupt 2021-12-27 12:22:19 +00:00
fealnx.c ethernet: use eth_hw_addr_set() in unmaintained drivers 2021-10-18 13:20:38 +01:00
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