[PATCH net-next v4 00/13] dpaa2-switch: add support for LAG offload
From: Ioana Ciornei <ioana.ciornei@nxp.com>
Date: 2026-06-29 11:23:24
Also in:
lkml
This patch set adds support in dpaa2-switch for offloading upper bond devices. The first two patches remove the necessity to hold rtnl_lock during the event processing workqueue by ensuring that all event were processed before any changes in FDB layout happens. Patch #3 updates the logic around choosing the FDB that should be used on a switch port. This is necessary since with the addition of the LAG offload, we need to take into account all ports which are under the same bridge, even though not directly. The next four patches clean up the FDB event by making them easier to integrate with bond devices and also add the dpaa2_switch_port_to_bridge_port() helper to be used in the LAG offload support. The 8th patch adds the necessary new APIs for the LAG configuration while the next one uses them, both in the prechangeupper phase and the changeupper one. Which ports can be part of the same LAG group is configurable at boot time, thus we use the prechangeupper callback in order to validate that a requested configuration can be offloaded or not. This set also extends the handling of FDBs and port objects so that they are handled by the driver even on an offloaded bond device. Changes in v4: - Moved and split some patches so that any preparatory work is being done before the driver offloads upper bond devices. - Add a defensive check in dpaa2_switch_port_bond_leave() for a NULL port_priv->lag - Extend the dpaa2_switch_prevent_bridging_with_8021q_upper() function so that we prevent a bond device with VLAN uppers joinging a bridge. The restriction is related to VLAN management in terms of the FDB which can change upon a topology change. VLAN uppers can only be added once the bridge topology is setup. - Remove all FDB management from the bond join/leave paths. Decided to reconfigure the FDB only on bridge join/leave since the FDB determines the forwarding domain and when a bond is not bridged, from a configuration standpoint, the individual lowers can be viewed as standalone. - Moved here the update to the dpaa2_switch_port_to_bridge_port() function so that the LAG state is taken into account. - Add a new per LAG field - primary - which is used to keep track of the primary port of a LAG group instead of determining each time we need to use it. - Set 'skb->offload_fwd_mark' only when the port is under a bridge. - Migrate FDBs in case the primary interface of a LAG changes. - Use lag->primary instead of determining each time the primary interface of a LAG device - Link to v3: https://lore.kernel.org/all/20260603143623.3712024-1-ioana.ciornei@nxp.com/ (local) Changes in v3: - Add a check in dpsw_lag_set() for cfg->num_ifs against DPSW_MAX_LAG_IFS - Add kerneldoc for the dpsw_lag_cfg structure. - Fix logic in prechangeupper callback in order to not call dpaa2_switch_prechangeupper_sanity_checks() on !info->linking - Fixed up the logic in the dpaa2_switch_port_bond_join()'s error path so that the FDBs are cleaned-up properly and we do not end-up with FDB's leaked, meaning that they could have been marked as in-use but actually no port was using it. - Mark the port_priv->lag field as __rcu and use the proper accesors for it. This will eventually become useful in a later patch when the lag field will be accessed concurrently from the NAPI context and the join/leave paths - Access lag field through rtnl_dereference() so that we adapt to the __rcu change. - Check that the brport is non-NULL before calling switchdev_bridge_port_unoffload() on it. - Get hold on port_priv->ethsw_data only after we know the device is a dpaa2-switch one - Update dpaa2_switch_foreign_dev_check() so that we check if there is any port in the same switch as dev which offloads foreign_dev in case this is a bridge port. - Add mutex_destroy on the per LAG fdb_lock - Make sure that all FDB events were processed on the workqueue on the .remove() path. - Delete the refcounted entry in dpaa2_switch_lag_fdb_del() as soon as possible, even if the HW deletion would fail - Access the port_priv->lag field only through the proper rcu accessors. - Change the mask so that we restrict the trap only to the link local addresses (01:80:c2:00:00:00 to 01:80:c2:00:00:0F) instead of the entire reserved bridge block of addresses - Link to v2: https://lore.kernel.org/all/20260512131554.952971-1-ioana.ciornei@nxp.com/ (local) Changes in v2: - Extend dpaa2_switch_prechangeupper_sanity_checks() with netdev_walk_all_lower_dev() so that checks are done on all lower devices of a bridge, even for the lowers of a bridged bond. - Manage better the default VLAN on bond join - Clean-up the error path in dpaa2_switch_port_bond_join() - Call dpaa2_switch_port_bridge_leave() in case a port is leaving a bond which is also a bridged port - Update dpaa2_switch_port_bond_leave() so that in case of any failure the driver tries to cleanup the LAG offload configuration. - Call switchdev_bridge_port_unoffload() in a switch port is leaving a bridge bond device. - The rollback in dpaa2_switch_port_mdb_add() uses the newly introduced dpaa2_switch_port_fdb_del() helper instead of the _mc counterpart. - Update dpaa2_switch_foreign_dev_check() so that we check if between the switch port and the foreign net_device is an offloaded path. Before this change we also checked if the foreign_dev was offloaded or not by the switch port. - Update the switchdev_bridge_port_unoffload() by passing it the proper context and the notifier blocks. - Add dev_hold() and dev_put() calls for orig_dev - In case dev_mc_add() fails, remove the MDB address from HW with the proper function, dpaa2_switch_lag_fdb_del() or dpaa2_switch_port_fdb_del(), depending on the LAG offload state. - Fix 32bit build by using BIT_ULL - Take a reference to port_priv->lag instead of reading it multiple times. - Link to v1: https://lore.kernel.org/all/20260506151540.1242997-1-ioana.ciornei@nxp.com/ (local) Ioana Ciornei (13): dpaa2-switch: remove unnecessary dev_mc_add/dev_mc_del calls dpaa2-switch: avoid holding rtnl_lock in dpaa2_switch_event_work() dpaa2-switch: extend the FDB management to cover bond scenarios dpaa2-switch: create a separate dpaa2_switch_port_fdb_event() function dpaa2-switch: check early if an FDB entry should be added dpaa2-switch: add dpaa2_switch_port_to_bridge_port() helper dpaa2-switch: consolidate unicast and multicast management dpaa2-switch: add LAG configuration API dpaa2-switch: add support for LAG offload dpaa2-switch: offload FDBs added on an upper bond device dpaa2-switch: offload port objects on an upper bond device dpaa2-switch: trap all link local reserved addresses to the CPU dpaa2-switch: add support for imprecise source port .../ethernet/freescale/dpaa2/dpaa2-switch.c | 931 +++++++++++++++--- .../ethernet/freescale/dpaa2/dpaa2-switch.h | 42 +- .../net/ethernet/freescale/dpaa2/dpsw-cmd.h | 18 +- drivers/net/ethernet/freescale/dpaa2/dpsw.c | 60 ++ drivers/net/ethernet/freescale/dpaa2/dpsw.h | 30 + 5 files changed, 948 insertions(+), 133 deletions(-) -- 2.25.1