Skip to content

mlxsw: Improve extensibility

Jiri Pirko netdev 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest18 patches 5 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/18bridge: Export VLAN filtering stateinclude/linux/if_bridge.h net/bridge/br_if.c net/bridge/br_mdb.c +3 more+21 -132 replies
2/18bridge: Export multicast enabled stateinclude/linux/if_bridge.h net/bridge/br_multicast.c+13 -01 reply
3/18mlxsw: spectrum: Set port's mode according to FID mappingsdrivers/net/ethernet/mellanox/mlxsw/spectrum.c drivers/net/ethernet/mellanox/mlxsw/spectrum.h drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c +1 more+63 -280 replies
4/18mlxsw: spectrum: Introduce Port-VLAN structuredrivers/net/ethernet/mellanox/mlxsw/spectrum.c drivers/net/ethernet/mellanox/mlxsw/spectrum.h+68 -30 replies
5/18mlxsw: spectrum: Change signature of FID leave functiondrivers/net/ethernet/mellanox/mlxsw/spectrum.c drivers/net/ethernet/mellanox/mlxsw/spectrum.h drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c+47 -210 replies
6/18mlxsw: spectrum_router: Replace vPorts with Port-VLANdrivers/net/ethernet/mellanox/mlxsw/spectrum.c drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c+67 -740 replies
7/18mlxsw: spectrum: Don't lose bridge port device during enslavementdrivers/net/ethernet/mellanox/mlxsw/spectrum.c+44 -230 replies
8/18mlxsw: spectrum: Don't create FIDs upon creation of VLAN uppersdrivers/net/ethernet/mellanox/mlxsw/spectrum.c drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c+13 -980 replies
9/18mlxsw: spectrum: Replace vPorts with Port-VLANdrivers/net/ethernet/mellanox/mlxsw/spectrum.c drivers/net/ethernet/mellanox/mlxsw/spectrum.h drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c +1 more+1423 -12450 replies
10/18mlxsw: spectrum_router: Allocate FID prior to RIF configurationdrivers/net/ethernet/mellanox/mlxsw/spectrum_router.c+12 -130 replies
11/18mlxsw: spectrum_router: Allocate RIF prior to its configurationdrivers/net/ethernet/mellanox/mlxsw/spectrum_router.c+19 -210 replies
12/18mlxsw: spectrum_router: Extend the RIF structdrivers/net/ethernet/mellanox/mlxsw/spectrum_router.c+27 -40 replies
13/18mlxsw: spectrum_router: Configure RIFs based on RIF structdrivers/net/ethernet/mellanox/mlxsw/spectrum_router.c+23 -330 replies
14/18mlxsw: spectrum_router: Destroy RIF only based on its structdrivers/net/ethernet/mellanox/mlxsw/spectrum_router.c+6 -60 replies
15/18mlxsw: spectrum_router: Flood packets to router after RIF creationdrivers/net/ethernet/mellanox/mlxsw/spectrum_router.c+8 -80 replies
16/18mlxsw: spectrum_router: Determine VR first when creating RIFdrivers/net/ethernet/mellanox/mlxsw/spectrum_router.c+22 -160 replies
17/18mlxsw: spectrum: Implement common FID coredrivers/net/ethernet/mellanox/mlxsw/Makefile drivers/net/ethernet/mellanox/mlxsw/spectrum.c drivers/net/ethernet/mellanox/mlxsw/spectrum.h +5 more+1278 -7610 replies
18/18mlxsw: spectrum_router: Implement common RIF coredrivers/net/ethernet/mellanox/mlxsw/spectrum.h drivers/net/ethernet/mellanox/mlxsw/spectrum_fid.c drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c+337 -2370 replies

Reviews trailers per patch

2 of 18 patches have a Reviewed-by or Acked-by.

PatchNikolay Aleksandrov
1/18R-b
2/18R-b
3/18
4/18
5/18
6/18
7/18
8/18
9/18
10/18
11/18
12/18
13/18
14/18
15/18
16/18
17/18
18/18

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [patch net-next 00/18] mlxsw: Improve extensibility

From: Jiri Pirko <[email protected]>

Ido says:

Since the initial introduction of the bridge offload in commit 56ade8fe3fe1 ("mlxsw: spectrum: Add initial support for Spectrum ASIC") the per-port struct was used to store both physical properties of the port as well as logical bridge properties such as learning and active VLANs in the VLAN-aware bridge.

The above resulted in a bloated struct and code that is getting increasingly difficult to extend when stacked devices are taken into account as well as more advanced use cases such as IGMP snooping.

Due to the incremental development nature of this driver as well as the complexity of the underlying hardware, subsequent design decisions failed to generalize the FID and RIF resources, which could've benefited from a more generic design, resulting in consolidated code paths and better extensibility with regards to future ASICs and use cases.

This patchset tries to solve both of these design problems, as they're tightly coupled. To ease the code review, the changes are done in a bottom-up manner, in which the port struct is the first to be patched, then the FIDs the ports are mapped to and finally the RIFs configured on top.

The first half of the patchset gradually moves away from the previous design to a design that is more in sync with the underlying hardware and which clearly separates between hardware-specific structs and logical ones such as a bridge port.

All the bridge-specific information is removed from the port struct, as well as the list of VLAN devices ("vPorts") configured on top of it. Instead, a linked list of VLANs is introduced, which allows each VLAN to hold a state, such as mapping to a particular FID and membership in a bridge. The data structures are depicted in the following figure:

                                  mlxsw_sp_bridge_device
                                       +----------+
                                       |          |
                                  +----+          |
                                  |    |          |
                                  |    +----------+
                                  |
             mlxsw_sp_bridge_port |
                 +----------+     |
                 |          |     |
              +-->          +-----+--> ..
              |  |          |
              |  +----+-----+
              |       |
              |       v
              | mlxsw_sp_bridge_vlan
              |  +----------+
              |  | vid X    |
              |  |          +--> ..
              |  |          |
              |  +----+-----+
              |       |
              +--+----v-----+
                 | vid X    |
              +--+          +--> ..
              |  |          |
mlxsw_sp_port |  +----------+
+----------+  | mlxsw_sp_port_vlan
|          |  |
|          +--+
|          |

+----------+

This model allows us to consolidate many of the code paths relating to VLAN-aware and VLAN-unaware bridges, as the latter is simply represented using a bridge port with a VLAN list size of one. Another advantage of the model is that it's easy to extend it with future per-VLAN attributes - such as mrouter indication - by merely pushing these down from the bridge port struct to the bridge VLAN one.

The second half of the patchset builds on top of previous work and prepares the driver for the common FID and RIF cores, which are finally implemented in the last two patches. These exploit the fact that despite the different kinds of FIDs and RIFs, they do share a common object on which the core operations can operate on.

By hiding both objects from the rest of the driver and modeling their operations using a VFT, it'll be easier to extend the driver for future use cases such as VXLAN.

Tested using following LNST recipes:
https://github.com/jpirko/lnst/tree/master/recipes/switchdev

Ido Schimmel (18):
bridge: Export VLAN filtering state
bridge: Export multicast enabled state
mlxsw: spectrum: Set port's mode according to FID mappings
mlxsw: spectrum: Introduce Port-VLAN structure
mlxsw: spectrum: Change signature of FID leave function
mlxsw: spectrum_router: Replace vPorts with Port-VLAN
mlxsw: spectrum: Don't lose bridge port device during enslavement
mlxsw: spectrum: Don't create FIDs upon creation of VLAN uppers
mlxsw: spectrum: Replace vPorts with Port-VLAN
mlxsw: spectrum_router: Allocate FID prior to RIF configuration
mlxsw: spectrum_router: Allocate RIF prior to its configuration
mlxsw: spectrum_router: Extend the RIF struct
mlxsw: spectrum_router: Configure RIFs based on RIF struct
mlxsw: spectrum_router: Destroy RIF only based on its struct
mlxsw: spectrum_router: Flood packets to router after RIF creation
mlxsw: spectrum_router: Determine VR first when creating RIF
mlxsw: spectrum: Implement common FID core
mlxsw: spectrum_router: Implement common RIF core

 drivers/net/ethernet/mellanox/mlxsw/Makefile       |    3 +-
 drivers/net/ethernet/mellanox/mlxsw/spectrum.c     |  974 ++----------
 drivers/net/ethernet/mellanox/mlxsw/spectrum.h     |  240 ++-
 drivers/net/ethernet/mellanox/mlxsw/spectrum_acl.c |   17 +
 drivers/net/ethernet/mellanox/mlxsw/spectrum_fid.c |  992 ++++++++++++
 .../net/ethernet/mellanox/mlxsw/spectrum_flower.c  |    6 +-
 .../net/ethernet/mellanox/mlxsw/spectrum_router.c  |  746 +++++----
 .../ethernet/mellanox/mlxsw/spectrum_switchdev.c   | 1662 +++++++++++++-------
 include/linux/if_bridge.h                          |   14 +
 net/bridge/br_if.c                                 |    2 +-
 net/bridge/br_mdb.c                                |    4 +-
 net/bridge/br_multicast.c                          |    8 +
 net/bridge/br_netlink.c                            |    2 +-
 net/bridge/br_private.h                            |    9 -
 net/bridge/br_vlan.c                               |    8 +
 15 files changed, 2787 insertions(+), 1900 deletions(-)
 create mode 100644 drivers/net/ethernet/mellanox/mlxsw/spectrum_fid.c
Signature · 1 line
2.9.3