From 900c915030f696be8cf48a13c274040a06bda40d Mon Sep 17 00:00:00 2001 From: Ioana Ciornei Date: Mon, 29 Jun 2026 14:22:59 +0300 Subject: [PATCH] dpaa2-switch: extend the FDB management to cover bond scenarios The dpaa2_switch_fdb_for_join() function is responsible with determining what FDB should be used by a port as a consequence of it joining a bridge. The rule is that all DPAA2 switch ports under the same bridge will use the FDB of the first port which joined that bridge. Extend the function so that the function also covers the scenario in which there is bridged bond device. For this to happen, in case a bond device is encountered through the bridge ports the function needs to descend one level through its lowers as well. Signed-off-by: Ioana Ciornei Link: https://patch.msgid.link/20260629112309.154328-4-ioana.ciornei@nxp.com Signed-off-by: Paolo Abeni --- .../ethernet/freescale/dpaa2/dpaa2-switch.c | 35 +++++++++++++------ 1 file changed, 25 insertions(+), 10 deletions(-) diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c index 67c639fad0db..eacab00b586a 100644 --- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c +++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c @@ -71,9 +71,9 @@ static struct dpaa2_switch_fdb * dpaa2_switch_fdb_for_join(struct ethsw_port_priv *port_priv, struct net_device *upper_dev) { - struct ethsw_port_priv *other_port_priv; - struct net_device *other_dev; - struct list_head *iter; + struct ethsw_port_priv *other_port_priv = NULL; + struct net_device *other_dev, *other_dev2; + struct list_head *iter, *iter2; /* The below call to netdev_for_each_lower_dev() demands the RTNL lock * being held. Assert on it so that it's easier to catch new code @@ -82,17 +82,32 @@ dpaa2_switch_fdb_for_join(struct ethsw_port_priv *port_priv, ASSERT_RTNL(); /* If part of a bridge, use the FDB of the first dpaa2 switch interface - * to be present in that bridge + * to be present in that bridge. The search descends one level through + * a bridged bond's lowers as well. */ netdev_for_each_lower_dev(upper_dev, other_dev, iter) { - if (!dpaa2_switch_port_dev_check(other_dev)) - continue; + if (netif_is_lag_master(other_dev)) { + netdev_for_each_lower_dev(other_dev, other_dev2, iter2) { + if (!dpaa2_switch_port_dev_check(other_dev2)) + continue; - if (other_dev == port_priv->netdev) - continue; + if (other_dev2 == port_priv->netdev) + continue; - other_port_priv = netdev_priv(other_dev); - return other_port_priv->fdb; + other_port_priv = netdev_priv(other_dev2); + break; + } + } else { + if (!dpaa2_switch_port_dev_check(other_dev)) + continue; + + if (other_dev == port_priv->netdev) + continue; + + other_port_priv = netdev_priv(other_dev); + } + if (other_port_priv) + return other_port_priv->fdb; } return port_priv->fdb;