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 <ioana.ciornei@nxp.com>
Link: https://patch.msgid.link/20260629112309.154328-4-ioana.ciornei@nxp.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
This commit is contained in:
Ioana Ciornei 2026-06-29 14:22:59 +03:00 committed by Paolo Abeni
parent 0cf0b8ac40
commit 900c915030

View File

@ -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;