From: Ioana Ciornei <ioana.ciornei@nxp.com>
To: andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com,
kuba@kernel.org, pabeni@redhat.com, netdev@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH net-next v2 03/13] dpaa2-switch: change dpaa2_switch_port_set_fdb() function prototype
Date: Tue, 12 May 2026 16:15:44 +0300 [thread overview]
Message-ID: <20260512131554.952971-4-ioana.ciornei@nxp.com> (raw)
In-Reply-To: <20260512131554.952971-1-ioana.ciornei@nxp.com>
Since there dpaa2_switch_port_set_fdb() never fails and its return value
was never checked, change its prototype to return void.
Also, instead of determining if the DPAA2 port is joining or leaving an
upper based on the value of the 'bridge_dev' parameter, add the
'linking' parameter to explicitly specify the action. This will enable
us to pass the upper device that we are joining/leaving in all possible
cases. This will get used in the next patches to determine what kind of
device the upper is: a bridge or a bond.
Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
---
Changes in v2:
- none
---
.../ethernet/freescale/dpaa2/dpaa2-switch.c | 33 +++++++++----------
1 file changed, 15 insertions(+), 18 deletions(-)
diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c
index 88f52ac04c0a..91be5a12a006 100644
--- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c
+++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c
@@ -62,18 +62,17 @@ dpaa2_switch_lag_get_unused(struct ethsw_core *ethsw)
return NULL;
}
-static u16 dpaa2_switch_port_set_fdb(struct ethsw_port_priv *port_priv,
- struct net_device *bridge_dev)
+static void dpaa2_switch_port_set_fdb(struct ethsw_port_priv *port_priv,
+ struct net_device *upper_dev,
+ bool linking)
{
struct ethsw_port_priv *other_port_priv = NULL;
struct dpaa2_switch_fdb *fdb;
struct net_device *other_dev;
struct list_head *iter;
- /* If we leave a bridge (bridge_dev is NULL), find an unused
- * FDB and use that.
- */
- if (!bridge_dev) {
+ /* If we leave a bridge, find an unused FDB and use that. */
+ if (!linking) {
fdb = dpaa2_switch_fdb_get_unused(port_priv->ethsw_data);
/* If there is no unused FDB, we must be the last port that
@@ -83,13 +82,13 @@ static u16 dpaa2_switch_port_set_fdb(struct ethsw_port_priv *port_priv,
if (!fdb) {
port_priv->fdb->bridge_dev = NULL;
- return 0;
+ return;
}
port_priv->fdb = fdb;
port_priv->fdb->in_use = true;
port_priv->fdb->bridge_dev = NULL;
- return 0;
+ return;
}
/* The below call to netdev_for_each_lower_dev() demands the RTNL lock
@@ -101,7 +100,7 @@ static u16 dpaa2_switch_port_set_fdb(struct ethsw_port_priv *port_priv,
/* If part of a bridge, use the FDB of the first dpaa2 switch interface
* to be present in that bridge
*/
- netdev_for_each_lower_dev(bridge_dev, other_dev, iter) {
+ netdev_for_each_lower_dev(upper_dev, other_dev, iter) {
if (!dpaa2_switch_port_dev_check(other_dev))
continue;
@@ -127,9 +126,7 @@ static u16 dpaa2_switch_port_set_fdb(struct ethsw_port_priv *port_priv,
}
/* Keep track of the new upper bridge device */
- port_priv->fdb->bridge_dev = bridge_dev;
-
- return 0;
+ port_priv->fdb->bridge_dev = upper_dev;
}
static void dpaa2_switch_fdb_get_flood_cfg(struct ethsw_core *ethsw, u16 fdb_id,
@@ -2040,7 +2037,7 @@ static int dpaa2_switch_port_bridge_join(struct net_device *netdev,
if (err)
return err;
- dpaa2_switch_port_set_fdb(port_priv, upper_dev);
+ dpaa2_switch_port_set_fdb(port_priv, upper_dev, true);
/* Inherit the initial bridge port learning state */
learn_ena = br_port_flag_is_set(netdev, BR_LEARNING);
@@ -2066,7 +2063,7 @@ static int dpaa2_switch_port_bridge_join(struct net_device *netdev,
err_switchdev_offload:
err_egress_flood:
- dpaa2_switch_port_set_fdb(port_priv, NULL);
+ dpaa2_switch_port_set_fdb(port_priv, upper_dev, false);
return err;
}
@@ -2113,7 +2110,7 @@ static int dpaa2_switch_port_bridge_leave(struct net_device *netdev)
if (err)
netdev_err(netdev, "Unable to clear RX VLANs from old FDB table, err (%d)\n", err);
- dpaa2_switch_port_set_fdb(port_priv, NULL);
+ dpaa2_switch_port_set_fdb(port_priv, port_priv->fdb->bridge_dev, false);
/* Restore all RX VLANs into the new FDB table that we just joined */
err = vlan_for_each(netdev, dpaa2_switch_port_restore_rxvlan, netdev);
@@ -2398,7 +2395,7 @@ static int dpaa2_switch_port_bond_join(struct net_device *netdev,
return err;
/* Setup the egress flood policy (broadcast, unknown unicast) */
- dpaa2_switch_port_set_fdb(port_priv, bond_dev);
+ dpaa2_switch_port_set_fdb(port_priv, bond_dev, true);
err = dpaa2_switch_fdb_set_egress_flood(ethsw, port_priv->fdb->fdb_id);
if (err)
goto err_egress_flood;
@@ -2441,7 +2438,7 @@ static int dpaa2_switch_port_bond_join(struct net_device *netdev,
port_priv->lag = NULL;
dpaa2_switch_set_lag_cfg(bond_dev, lag_id, ethsw);
err_egress_flood:
- dpaa2_switch_port_set_fdb(port_priv, NULL);
+ dpaa2_switch_port_set_fdb(port_priv, bond_dev, false);
dpaa2_switch_port_add_vlan(port_priv, DEFAULT_VLAN_ID,
BRIDGE_VLAN_INFO_UNTAGGED |
BRIDGE_VLAN_INFO_PVID);
@@ -2472,7 +2469,7 @@ static int dpaa2_switch_port_bond_leave(struct net_device *netdev,
goto lag_cleanup;
/* Setup the FDB for this port which is now standalone */
- dpaa2_switch_port_set_fdb(port_priv, NULL);
+ dpaa2_switch_port_set_fdb(port_priv, bond_dev, false);
/* Setup the egress flood policy (broadcast, unknown unicast).
* When the port is not under a bond, only the CTRL interface is part
--
2.25.1
next prev parent reply other threads:[~2026-05-12 13:16 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-12 13:15 [PATCH net-next v2 00/13] dpaa2-switch: add support for LAG offload Ioana Ciornei
2026-05-12 13:15 ` [PATCH net-next v2 01/13] dpaa2-switch: add LAG configuration API Ioana Ciornei
2026-05-12 13:15 ` [PATCH net-next v2 02/13] dpaa2-switch: add support for LAG offload Ioana Ciornei
2026-05-12 13:15 ` Ioana Ciornei [this message]
2026-05-12 13:15 ` [PATCH net-next v2 04/13] dpaa2-switch: extend dpaa2_switch_port_set_fdb() to cover bond scenarios Ioana Ciornei
2026-05-12 13:15 ` [PATCH net-next v2 05/13] dpaa2-switch: add dpaa2_switch_port_to_bridge_port() helper Ioana Ciornei
2026-05-12 13:15 ` [PATCH net-next v2 06/13] dpaa2-switch: create a separate dpaa2_switch_port_fdb_event() function Ioana Ciornei
2026-05-12 13:15 ` [PATCH net-next v2 07/13] dpaa2-switch: check early if an FDB entry should be added Ioana Ciornei
2026-05-12 13:15 ` [PATCH net-next v2 08/13] dpaa2-switch: consolidate unicast and multicast management Ioana Ciornei
2026-05-12 13:15 ` [PATCH net-next v2 09/13] dpaa2-switch: offload FDBs added on an upper bond device Ioana Ciornei
2026-05-12 13:15 ` [PATCH net-next v2 10/13] dpaa2-switch: offload port objects " Ioana Ciornei
2026-05-12 13:15 ` [PATCH net-next v2 11/13] dpaa2-switch: trap all link local reserved addresses to the CPU Ioana Ciornei
2026-05-12 13:15 ` [PATCH net-next v2 12/13] dpaa2-switch: add support for imprecise source port Ioana Ciornei
2026-05-12 13:23 ` [PATCH net-next v2 13/13] dpaa2-switch: do not error out when the same VLAN is installed multiple times Ioana Ciornei
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260512131554.952971-4-ioana.ciornei@nxp.com \
--to=ioana.ciornei@nxp.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox