1
0
Fork 0
mirror of synced 2025-03-06 20:59:54 +01:00
linux/drivers/net/ethernet
Ivan Vecera f09cbb6c94 i40e: Remove VEB recursion
The VEB (virtual embedded switch) as a switch element can be
connected according datasheet though its uplink to:
- Physical port
- Port Virtualizer (not used directly by i40e driver but can
  be present in MFP mode where the physical port is shared
  between PFs)
- No uplink (aka floating VEB)

But VEB uplink cannot be connected to another VEB and any attempt
to do so results in:

"i40e 0000:02:00.0: couldn't add VEB, err -EIO aq_err I40E_AQ_RC_ENOENT"

that indicates "the uplink SEID does not point to valid element".

Remove this logic from the driver code this way:

1) For debugfs only allow to build floating VEB (uplink_seid == 0)
   or main VEB (uplink_seid == mac_seid)
2) Do not recurse in i40e_veb_link_event() as no VEB cannot have
   sub-VEBs
3) Ditto for i40e_veb_rebuild() + simplify the function as we know
   that the VEB for rebuild can be only the main LAN VEB or some
   of the floating VEBs
4) In i40e_rebuild() there is no need to check veb->uplink_seid
   as the possible ones are 0 and MAC SEID
5) In i40e_vsi_release() do not take into account VEBs whose
   uplink is another VEB as this is not possible
6) Remove veb_idx field from i40e_veb as a VEB cannot have
   sub-VEBs

Tested using i40e debugfs interface:
1) Initial state
[root@cnb-03 net-next]# CMD="/sys/kernel/debug/i40e/0000:02:00.0/command"
[root@cnb-03 net-next]# echo dump switch > $CMD
[root@cnb-03 net-next]# dmesg -c
[   98.440641] i40e 0000:02:00.0: header: 3 reported 3 total
[   98.446053] i40e 0000:02:00.0: type=19 seid=392 uplink=160 downlink=16
[   98.452593] i40e 0000:02:00.0: type=17 seid=160 uplink=2 downlink=0
[   98.458856] i40e 0000:02:00.0: type=19 seid=390 uplink=160 downlink=16

2) Add floating VEB
[root@cnb-03 net-next]# echo add relay > $CMD
[root@cnb-03 net-next]# dmesg -c
[  122.745630] i40e 0000:02:00.0: added relay 162
[root@cnb-03 net-next]# echo dump switch > $CMD
[root@cnb-03 net-next]# dmesg -c
[  136.650049] i40e 0000:02:00.0: header: 4 reported 4 total
[  136.655466] i40e 0000:02:00.0: type=19 seid=392 uplink=160 downlink=16
[  136.661994] i40e 0000:02:00.0: type=17 seid=160 uplink=2 downlink=0
[  136.668264] i40e 0000:02:00.0: type=19 seid=390 uplink=160 downlink=16
[  136.674787] i40e 0000:02:00.0: type=17 seid=162 uplink=0 downlink=0

3) Add VMDQ2 VSI to this new VEB
[root@cnb-03 net-next]# dmesg -c
[  168.351763] i40e 0000:02:00.0: added VSI 394 to relay 162
[  168.374652] enp2s0f0np0v0: NIC Link is Up, 40 Gbps Full Duplex, Flow Control: None
[root@cnb-03 net-next]# echo dump switch > $CMD
[root@cnb-03 net-next]# dmesg -c
[  195.683204] i40e 0000:02:00.0: header: 5 reported 5 total
[  195.688611] i40e 0000:02:00.0: type=19 seid=394 uplink=162 downlink=16
[  195.695143] i40e 0000:02:00.0: type=17 seid=162 uplink=0 downlink=0
[  195.701410] i40e 0000:02:00.0: type=19 seid=392 uplink=160 downlink=16
[  195.707935] i40e 0000:02:00.0: type=17 seid=160 uplink=2 downlink=0
[  195.714201] i40e 0000:02:00.0: type=19 seid=390 uplink=160 downlink=16

4) Try to delete the VEB
[root@cnb-03 net-next]# echo del relay 162 > $CMD
[root@cnb-03 net-next]# dmesg -c
[  239.260901] i40e 0000:02:00.0: deleting relay 162
[  239.265621] i40e 0000:02:00.0: can't remove VEB 162 with 1 VSIs left

5) Do PF reset and check switch status after rebuild
[root@cnb-03 net-next]# echo pfr > $CMD
[root@cnb-03 net-next]# echo dump switch > $CMD
[root@cnb-03 net-next]# dmesg -c
...
[  272.333655] i40e 0000:02:00.0: header: 5 reported 5 total
[  272.339066] i40e 0000:02:00.0: type=19 seid=394 uplink=162 downlink=16
[  272.345599] i40e 0000:02:00.0: type=17 seid=162 uplink=0 downlink=0
[  272.351862] i40e 0000:02:00.0: type=19 seid=392 uplink=160 downlink=16
[  272.358387] i40e 0000:02:00.0: type=17 seid=160 uplink=2 downlink=0
[  272.364654] i40e 0000:02:00.0: type=19 seid=390 uplink=160 downlink=16

6) Delete VSI and delete VEB
[  297.199116] i40e 0000:02:00.0: deleting VSI 394
[  299.807580] i40e 0000:02:00.0: deleting relay 162
[  309.767905] i40e 0000:02:00.0: header: 3 reported 3 total
[  309.773318] i40e 0000:02:00.0: type=19 seid=392 uplink=160 downlink=16
[  309.779845] i40e 0000:02:00.0: type=17 seid=160 uplink=2 downlink=0
[  309.786111] i40e 0000:02:00.0: type=19 seid=390 uplink=160 downlink=16

Reviewed-by: Wojciech Drewek <wojciech.drewek@intel.com>
Signed-off-by: Ivan Vecera <ivecera@redhat.com>
Tested-by: Pucha Himasekhar Reddy <himasekharx.reddy.pucha@intel.com> (A Contingent worker at Intel)
Reviewed-by: Simon Horman <horms@kernel.org>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
2024-02-16 09:28:14 -08:00
..
3com
8390 net: fill in MODULE_DESCRIPTION()s for 8390 2024-01-24 15:12:20 -08:00
actions net: ethernet: actions: Convert to platform remove callback returning void 2023-09-20 09:06:37 +01:00
adaptec
adi net: ethernet: adi: adin1110: Fix uninitialized variable 2023-10-21 11:54:42 +01:00
aeroflex net: ethernet: aeroflex: Convert to platform remove callback returning void 2023-09-20 09:06:37 +01:00
agere et131x: Use pci_dev_id() to simplify the code 2023-08-13 12:30:39 +01:00
alacritech net: ethernet: slicoss: remove redundant increment of pointer data 2023-07-28 15:37:08 -07:00
allwinner net: ethernet: allwinner: Convert to platform remove callback returning void 2023-09-20 09:06:37 +01:00
alteon
altera net: ethernet: Use device_get_match_data() 2023-10-13 10:04:53 +01:00
amazon net: ena: Remove unlikely() from IS_ERR() condition 2024-02-15 13:24:21 +01:00
amd Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2024-02-15 16:20:04 -08:00
apm Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2023-10-26 13:46:28 -07:00
apple net: ethernet: apple: Convert to platform remove callback returning void 2023-09-20 09:06:37 +01:00
aquantia net: atlantic: convert EEE handling to use linkmode bitmaps 2024-02-09 12:55:46 -08:00
arc net: ethernet: arc: Convert to platform remove callback returning void 2023-09-20 09:06:37 +01:00
asix net: asix: fix fortify warning 2023-12-12 13:20:37 -08:00
atheros ethernet: atheros: fix a memleak in atl1e_setup_ring_resources 2023-12-15 10:55:35 +00:00
broadcom Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2024-02-15 16:20:04 -08:00
brocade bnad: fix work_queue type mismatch 2024-02-14 12:49:47 +00:00
cadence net: macb: Convert to ndo_hwtstamp_get() and ndo_hwtstamp_set() 2023-11-18 14:52:57 +00:00
calxeda net: ethernet: calxeda: Convert to platform remove callback returning void 2023-09-20 09:06:38 +01:00
cavium net: fill in MODULE_DESCRIPTION()s for liquidio 2024-01-24 15:12:20 -08:00
chelsio net: ethtool: pass a pointer to parameters to get/set_rxfh ethtool ops 2023-12-13 22:07:16 -08:00
cirrus net: fill in MODULE_DESCRIPTION()s for ep93xxx_eth 2024-01-24 15:12:20 -08:00
cisco net: remove stale mentions of dev_base_lock in comments 2024-02-14 11:20:13 +00:00
cortina net: ethernet: cortina: Drop TSO support 2024-01-07 16:05:00 +00:00
davicom net: ethernet: davicom: Convert to platform remove callback returning void 2023-09-20 09:06:38 +01:00
dec net: tulip: Annotate struct mediatable with __counted_by 2023-10-02 11:24:55 -07:00
dlink net: dl2k: Use proper conversion of dev_addr before IO to device 2023-12-12 11:25:36 +01:00
emulex net: ethtool: pass a pointer to parameters to get/set_rxfh ethtool ops 2023-12-13 22:07:16 -08:00
engleder Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2024-02-08 15:30:33 -08:00
ezchip net: fill in MODULE_DESCRIPTION()s for nps_enet 2024-01-24 15:12:20 -08:00
faraday net: ethernet: faraday: Convert to platform remove callback returning void 2023-09-20 09:06:38 +01:00
freescale net: fec: Refactor: Replace FEC_ENET_FCE with FEC_RCR_FLOWCTL 2024-02-13 18:50:12 -08:00
fujitsu
fungible net: ethtool: pass a pointer to parameters to get/set_rxfh ethtool ops 2023-12-13 22:07:16 -08:00
google Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2024-02-01 15:12:37 -08:00
hisilicon Networking changes for 6.8. 2024-01-11 10:07:29 -08:00
huawei net: ethtool: pass a pointer to parameters to get/set_rxfh ethtool ops 2023-12-13 22:07:16 -08:00
i825xx net/sun3_82586: Avoid reading past buffer in debug output 2024-02-08 18:41:10 -08:00
ibm mm, treewide: rename MAX_ORDER to MAX_PAGE_ORDER 2024-01-08 15:27:15 -08:00
intel i40e: Remove VEB recursion 2024-02-16 09:28:14 -08:00
litex net: fill in MODULE_DESCRIPTION()s for litex 2024-01-24 15:12:21 -08:00
marvell Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2024-02-15 16:20:04 -08:00
mediatek net: ethernet: mtk_eth_soc: set DMA coherent mask to get PPE working 2024-01-25 17:20:12 -08:00
mellanox Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2024-02-15 16:20:04 -08:00
micrel spi: Updates for v6.8 2024-01-09 15:02:12 -08:00
microchip Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2024-02-15 16:20:04 -08:00
microsoft net: mana: Assigning IRQ affinity on HT cores 2024-02-01 13:06:40 +01:00
moxa net: ethernet: moxa:: Convert to platform remove callback returning void 2023-09-20 09:06:39 +01:00
mscc net: ocelot: update the MODULE_DESCRIPTION() 2024-02-05 12:35:18 +00:00
myricom
natsemi net: ethernet: natsemi: Convert to platform remove callback returning void 2023-09-20 09:06:40 +01:00
neterion net: fill in MODULE_DESCRIPTION()s for s2io 2024-01-11 16:16:08 -08:00
netronome nfp: enable NETDEV_XDP_ACT_REDIRECT feature flag 2024-02-05 11:11:09 +00:00
ni netdev: replace napi_reschedule with napi_schedule 2023-10-11 17:28:06 -07:00
nvidia net: remove stale mentions of dev_base_lock in comments 2024-02-14 11:20:13 +00:00
nxp net: ethernet: nxp: Convert to platform remove callback returning void 2023-09-20 09:06:40 +01:00
oki-semi
packetengines
pasemi
pensando ionic: implement xdp frags support 2024-02-16 08:48:08 +00:00
qlogic netxen_nic: remove redundant assignment to variable capability 2024-02-08 19:06:27 -08:00
qualcomm qca_7k: Replace old mail address 2024-01-31 13:38:51 +00:00
rdc
realtek r8169: add support for returning tx_lpi_timer in ethtool get_eee 2024-02-13 18:53:05 -08:00
renesas net: ravb: Add runtime PM support 2024-02-16 08:32:04 +00:00
rocker
samsung net: sxgbe: remove eee_enabled/eee_active in sxgbe_get_eee() 2024-02-07 09:03:37 -08:00
seeq net: ethernet: seeq: Convert to platform remove callback returning void 2023-09-20 09:06:40 +01:00
sfc net: remove stale mentions of dev_base_lock in comments 2024-02-14 11:20:13 +00:00
sgi net: ethernet: sgi: Convert to platform remove callback returning void 2023-09-20 09:06:40 +01:00
silan
sis
smsc net: fill in MODULE_DESCRIPTION()s for SMSC drivers 2024-01-29 12:12:51 +00:00
socionext eth: link netdev to page_pools in drivers 2023-11-28 15:48:39 +01:00
stmicro Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2024-02-15 16:20:04 -08:00
sun net: ethernet: sun: Convert to platform remove callback returning void 2023-09-20 09:06:41 +01:00
sunplus net: ethernet: sunplus: Convert to platform remove callback returning void 2023-09-20 09:06:41 +01:00
synopsys
tehuti
ti net: ti: icssg-prueth: Remove duplicate cleanup calls in emac_ndo_stop() 2024-02-16 11:53:49 +00:00
toshiba Networking changes for 6.8. 2024-01-11 10:07:29 -08:00
tundra net: ethernet: tundra: Convert to platform remove callback returning void 2023-09-20 09:06:41 +01:00
vertexcom
via net: ethernet: via: Convert to platform remove callback returning void 2023-09-20 09:06:41 +01:00
wangxun net: txgbe: use irq_domain for interrupt controller 2024-01-27 14:31:55 +00:00
wiznet ethernet: wiznet: Use devm_platform_get_and_ioremap_resource() in w5300_hw_probe() 2024-02-09 12:27:36 -08:00
xilinx net: emaclite: Use devm_platform_get_and_ioremap_resource() in xemaclite_of_probe() 2024-02-09 12:27:43 -08:00
xircom xirc2ps_cs: remove redundant assignment to variable okay, clean up freespace 2024-02-08 19:04:28 -08:00
xscale net: xscale: Drop unused PHY number 2023-11-01 22:15:15 -07:00
dnet.c net: ethernet: dnet: Convert to platform remove callback returning void 2023-09-20 09:06:38 +01:00
dnet.h
ec_bhf.c net: fill in MODULE_DESCRIPTION()s for ec_bhf 2024-01-29 12:12:51 +00:00
ethoc.c net: ethernet: ethoc: Convert to platform remove callback returning void 2023-09-20 09:06:38 +01:00
fealnx.c
jme.c
jme.h
Kconfig net: ethernet: remove duplicated CONFIG_SUNGEM_PHY entry 2024-02-07 13:17:51 +00:00
korina.c net: ethernet: korina: Convert to platform remove callback returning void 2023-09-20 09:06:39 +01:00
lantiq_etop.c net: ethernet: lantiq_etop: Convert to platform remove callback returning void 2023-09-20 09:06:39 +01:00
lantiq_xrx200.c net: ethernet: lantiq_xrx200: Convert to platform remove callback returning void 2023-09-20 09:06:39 +01:00
Makefile