1
0
Fork 0
mirror of synced 2025-03-06 20:59:54 +01:00
linux/drivers/net/ethernet/intel/i40e
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
..
i40e.h i40e: Remove VEB recursion 2024-02-16 09:28:14 -08:00
i40e_adminq.c i40e: Remove queue tracking fields from i40e_adminq_ring 2023-11-27 09:31:34 -08:00
i40e_adminq.h i40e: Remove queue tracking fields from i40e_adminq_ring 2023-11-27 09:31:34 -08:00
i40e_adminq_cmd.h i40e: Include types.h to some headers 2024-01-18 09:52:52 -08:00
i40e_alloc.h i40e: Move memory allocation structures to i40e_alloc.h 2023-10-05 09:13:42 -07:00
i40e_client.c i40e: Remove circular header dependencies and fix headers 2023-10-05 09:18:09 -07:00
i40e_common.c i40e: field get conversion 2023-12-18 11:20:43 -08:00
i40e_dcb.c i40e: Fix wrong mask used during DCB config 2024-02-12 16:58:08 -08:00
i40e_dcb.h net: intel: fix old compiler regressions 2024-02-07 09:15:27 -08:00
i40e_dcb_nl.c i40e: Introduce and use macros for iterating VSIs and VEBs 2024-02-16 09:28:14 -08:00
i40e_ddp.c i40e: field get conversion 2023-12-18 11:20:43 -08:00
i40e_debug.h i40e: Initialize hardware capabilities at single place 2023-11-14 20:05:44 -08:00
i40e_debugfs.c i40e: Remove VEB recursion 2024-02-16 09:28:14 -08:00
i40e_devids.h i40e: Add basic support for I710 devices 2022-09-06 12:49:00 -07:00
i40e_devlink.c i40e: Do not call devlink_port_type_clear() 2023-11-06 16:16:13 -08:00
i40e_devlink.h i40e: Add initial devlink support 2023-10-15 14:33:41 +01:00
i40e_diag.c i40e: remove i40e_status 2023-07-31 14:37:25 -07:00
i40e_diag.h i40e: Include types.h to some headers 2024-01-18 09:52:52 -08:00
i40e_ethtool.c ethtool: add suffix _u32 to legacy bitmap members of struct ethtool_keee 2024-01-31 12:30:47 +00:00
i40e_hmc.c i40e: Remove circular header dependencies and fix headers 2023-10-05 09:18:09 -07:00
i40e_hmc.h i40e: Remove circular header dependencies and fix headers 2023-10-05 09:18:09 -07:00
i40e_io.h i40e: Split i40e_osdep.h 2023-10-05 09:13:43 -07:00
i40e_lan_hmc.c i40e: Remove circular header dependencies and fix headers 2023-10-05 09:18:09 -07:00
i40e_lan_hmc.h i40e: Remove circular header dependencies and fix headers 2023-10-05 09:18:09 -07:00
i40e_main.c i40e: Remove VEB recursion 2024-02-16 09:28:14 -08:00
i40e_nvm.c i40e: field get conversion 2023-12-18 11:20:43 -08:00
i40e_prototype.h i40e: Move inline helpers to i40e_prototype.h 2023-11-14 20:05:45 -08:00
i40e_ptp.c i40e: field get conversion 2023-12-18 11:20:43 -08:00
i40e_register.h Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2023-12-21 22:17:23 +01:00
i40e_trace.h i40e: add xdp_buff to i40e_ring struct 2023-03-09 13:11:24 -08:00
i40e_txrx.c i40e: set xdp_rxq_info::frag_size 2024-01-24 16:24:07 -08:00
i40e_txrx.h i40e: Consolidate hardware capabilities 2023-11-14 20:05:44 -08:00
i40e_txrx_common.h i40e: Remove circular header dependencies and fix headers 2023-10-05 09:18:09 -07:00
i40e_type.h Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2023-12-21 22:17:23 +01:00
i40e_virtchnl_pf.c i40e: Do not allow untrusted VF to remove administratively set MAC 2024-02-12 16:34:29 -08:00
i40e_virtchnl_pf.h Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2024-01-04 18:06:46 -08:00
i40e_xsk.c intel: xsk: initialize skb_frag_t::bv_offset in ZC drivers 2024-01-24 16:24:07 -08:00
i40e_xsk.h i40e: Remove circular header dependencies and fix headers 2023-10-05 09:18:09 -07:00
Makefile i40e: Add initial devlink support 2023-10-15 14:33:41 +01:00