* [PATCH net-next v2 0/2] dpaa2-eth: devlink port number from the DPMAC
@ 2026-09-28 11:22 Vincent Jardin via B4 Relay
2026-09-28 11:22 ` [PATCH net-next v2 1/2] dpaa2-eth: use the DPMAC id as the devlink physical port number Vincent Jardin via B4 Relay
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Vincent Jardin via B4 Relay @ 2026-09-28 11:22 UTC (permalink / raw)
To: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni
Cc: Ioana Ciornei, Vladimir Oltean, netdev, linux-kernel, Vincent Jardin
dpaa2-eth registers every DPNI as a physical devlink port without a
port number, so all the DPAA2 interfaces report the same
phys_port_name "p0", including the DPNIs that have no DPMAC behind
them.
Patch 1 uses the DPMAC id as the physical port number. The attributes
of a registered devlink port cannot change, so when the DPNI endpoint
changes at runtime a warning says the number is stale until the DPNI
is rebound.
Patch 2 registers the DPNIs without a DPMAC as virtual ports. They
have no phys_port_name, so "p<dpmac id>" is unique.
With both patches, udev can name an interface using its DPMAC, for
instance:
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="fsl_dpaa2_eth", \
ATTR{phys_port_name}=="p3", NAME="dpmac3"
Signed-off-by: Vincent Jardin <vjardin@free.fr>
---
Changes in v2:
- 1/2: shorter warning (Ioana Ciornei)
- 1/2: keep the registered port number in priv under mac_lock, so avoid
IRQ race with the port registration at probe (Sashiko)
- 1/2: the port check moved to 1/2 from 2/2 (Ioana Ciornei)
- 2/2: new subject, commit log updates (Ioana Ciornei, Sashiko)
- rebased on net-next
- Link to v1: https://lore.kernel.org/r/20260923-for-upstream-dpaa2_ports-v1-0-b59c865edd00@free.fr
---
Vincent Jardin (2):
dpaa2-eth: use the DPMAC id as the devlink physical port number
dpaa2-eth: mark DPNIs without a DPMAC as virtual devlink ports
.../ethernet/freescale/dpaa2/dpaa2-eth-devlink.c | 45 +++++++++++++++++++++-
drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c | 2 +
drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.h | 3 ++
3 files changed, 48 insertions(+), 2 deletions(-)
---
base-commit: 014d795c73837ea2339a4ea8e8f82c6e959b845d
change-id: 20260923-for-upstream-dpaa2_ports-04087b33bb8f
Best regards,
--
Vincent Jardin <vjardin@free.fr>
^ permalink raw reply [flat|nested] 6+ messages in thread* [PATCH net-next v2 1/2] dpaa2-eth: use the DPMAC id as the devlink physical port number
2026-09-28 11:22 [PATCH net-next v2 0/2] dpaa2-eth: devlink port number from the DPMAC Vincent Jardin via B4 Relay
@ 2026-09-28 11:22 ` Vincent Jardin via B4 Relay
2026-10-01 12:53 ` Simon Horman
2026-09-28 11:22 ` [PATCH net-next v2 2/2] dpaa2-eth: mark DPNIs without a DPMAC as virtual devlink ports Vincent Jardin via B4 Relay
2026-10-02 0:20 ` [PATCH net-next v2 0/2] dpaa2-eth: devlink port number from the DPMAC patchwork-bot+netdevbpf
2 siblings, 1 reply; 6+ messages in thread
From: Vincent Jardin via B4 Relay @ 2026-09-28 11:22 UTC (permalink / raw)
To: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni
Cc: Ioana Ciornei, Vladimir Oltean, netdev, linux-kernel, Vincent Jardin
From: Vincent Jardin <vjardin@free.fr>
dpaa2-eth registers every DPNI as a devlink port of flavour physical
without setting a port number. All DPAA2 interfaces report the same
phys_port_name, p0 (see devlink port show).
The DPNI endpoint can change at runtime while the attributes of a
registered devlink port cannot, so log a warning when it happens.
Another benefit: udev rules can match ATTR{phys_port_name} to name an
interface based on its DPMAC.
Signed-off-by: Vincent Jardin <vjardin@free.fr>
---
.../ethernet/freescale/dpaa2/dpaa2-eth-devlink.c | 40 +++++++++++++++++++++-
drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c | 2 ++
drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.h | 3 ++
3 files changed, 44 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth-devlink.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth-devlink.c
index 8775c931106b..4c0a04c2d458 100644
--- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth-devlink.c
+++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth-devlink.c
@@ -213,20 +213,58 @@ void dpaa2_eth_dl_unregister(struct dpaa2_eth_priv *priv)
devlink_unregister(priv->devlink);
}
+static u32 dpaa2_eth_dl_port_number(struct dpaa2_eth_priv *priv)
+{
+ lockdep_assert_held(&priv->mac_lock);
+
+ return dpaa2_eth_has_mac(priv) ? priv->mac->mc_dev->obj_desc.id : 0;
+}
+
int dpaa2_eth_dl_port_add(struct dpaa2_eth_priv *priv)
{
struct devlink_port *devlink_port = &priv->devlink_port;
struct devlink_port_attrs attrs = {};
+ u32 port_number;
+ int err;
+
+ mutex_lock(&priv->mac_lock);
+ port_number = dpaa2_eth_dl_port_number(priv);
+ priv->dl_port_number = port_number;
+ priv->dl_port_valid = true;
+ mutex_unlock(&priv->mac_lock);
attrs.flavour = DEVLINK_PORT_FLAVOUR_PHYSICAL;
+ attrs.phys.port_number = port_number;
devlink_port_attrs_set(devlink_port, &attrs);
- return devlink_port_register(priv->devlink, devlink_port, 0);
+ err = devlink_port_register(priv->devlink, devlink_port, 0);
+ if (err) {
+ mutex_lock(&priv->mac_lock);
+ priv->dl_port_valid = false;
+ mutex_unlock(&priv->mac_lock);
+ }
+
+ return err;
+}
+
+void dpaa2_eth_dl_port_check(struct dpaa2_eth_priv *priv)
+{
+ mutex_lock(&priv->mac_lock);
+ if (priv->dl_port_valid &&
+ priv->dl_port_number != dpaa2_eth_dl_port_number(priv))
+ netdev_warn(priv->net_dev,
+ "devlink port number %u is stale, rebind to update\n",
+ priv->dl_port_number);
+ mutex_unlock(&priv->mac_lock);
}
void dpaa2_eth_dl_port_del(struct dpaa2_eth_priv *priv)
{
struct devlink_port *devlink_port = &priv->devlink_port;
+ mutex_lock(&priv->mac_lock);
+ priv->dl_port_valid = false;
+ mutex_unlock(&priv->mac_lock);
+
devlink_port_unregister(devlink_port);
}
diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
index 6f1046c9cc51..def2d5c0e7f7 100644
--- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
+++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
@@ -4771,6 +4771,8 @@ static irqreturn_t dpni_irq0_handler_thread(int irq_num, void *arg)
dpaa2_eth_disconnect_mac(priv);
else
dpaa2_eth_connect_mac(priv);
+
+ dpaa2_eth_dl_port_check(priv);
}
return IRQ_HANDLED;
diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.h b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.h
index 834cba8c3a41..3e0acd15549e 100644
--- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.h
+++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.h
@@ -632,6 +632,8 @@ struct dpaa2_eth_priv {
struct devlink *devlink;
struct dpaa2_eth_trap_data *trap_data;
struct devlink_port devlink_port;
+ u32 dl_port_number;
+ bool dl_port_valid;
u32 rx_copybreak;
@@ -802,6 +804,7 @@ void dpaa2_eth_dl_unregister(struct dpaa2_eth_priv *priv);
int dpaa2_eth_dl_port_add(struct dpaa2_eth_priv *priv);
void dpaa2_eth_dl_port_del(struct dpaa2_eth_priv *priv);
+void dpaa2_eth_dl_port_check(struct dpaa2_eth_priv *priv);
int dpaa2_eth_dl_traps_register(struct dpaa2_eth_priv *priv);
void dpaa2_eth_dl_traps_unregister(struct dpaa2_eth_priv *priv);
--
2.43.0
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH net-next v2 1/2] dpaa2-eth: use the DPMAC id as the devlink physical port number
2026-09-28 11:22 ` [PATCH net-next v2 1/2] dpaa2-eth: use the DPMAC id as the devlink physical port number Vincent Jardin via B4 Relay
@ 2026-10-01 12:53 ` Simon Horman
0 siblings, 0 replies; 6+ messages in thread
From: Simon Horman @ 2026-10-01 12:53 UTC (permalink / raw)
To: vjardin
Cc: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Ioana Ciornei, Vladimir Oltean, netdev,
linux-kernel
On Mon, Sep 28, 2026 at 01:22:45PM +0200, Vincent Jardin via B4 Relay wrote:
> From: Vincent Jardin <vjardin@free.fr>
>
> dpaa2-eth registers every DPNI as a devlink port of flavour physical
> without setting a port number. All DPAA2 interfaces report the same
> phys_port_name, p0 (see devlink port show).
>
> The DPNI endpoint can change at runtime while the attributes of a
> registered devlink port cannot, so log a warning when it happens.
>
> Another benefit: udev rules can match ATTR{phys_port_name} to name an
> interface based on its DPMAC.
>
> Signed-off-by: Vincent Jardin <vjardin@free.fr>
Reviewed-by: Simon Horman <horms@kernel.org>
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH net-next v2 2/2] dpaa2-eth: mark DPNIs without a DPMAC as virtual devlink ports
2026-09-28 11:22 [PATCH net-next v2 0/2] dpaa2-eth: devlink port number from the DPMAC Vincent Jardin via B4 Relay
2026-09-28 11:22 ` [PATCH net-next v2 1/2] dpaa2-eth: use the DPMAC id as the devlink physical port number Vincent Jardin via B4 Relay
@ 2026-09-28 11:22 ` Vincent Jardin via B4 Relay
2026-10-01 12:54 ` Simon Horman
2026-10-02 0:20 ` [PATCH net-next v2 0/2] dpaa2-eth: devlink port number from the DPMAC patchwork-bot+netdevbpf
2 siblings, 1 reply; 6+ messages in thread
From: Vincent Jardin via B4 Relay @ 2026-09-28 11:22 UTC (permalink / raw)
To: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni
Cc: Ioana Ciornei, Vladimir Oltean, netdev, linux-kernel, Vincent Jardin
From: Vincent Jardin <vjardin@free.fr>
A DPNI whose endpoint is not a DPMAC has no physical connector: it
may have no endpoint at all, or be connected to another DPNI or to a
DPSW port. Until now, such a DPNI was still registered as a physical
devlink port with number 0, so userspace saw a physical port that does
not exist.
Register these DPNIs as virtual devlink ports instead. A virtual port
has no phys_port_name, so only the DPNIs that serve a DPMAC at probe
time report one, "p<dpmac id>", and those names do not collide.
Signed-off-by: Vincent Jardin <vjardin@free.fr>
---
drivers/net/ethernet/freescale/dpaa2/dpaa2-eth-devlink.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth-devlink.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth-devlink.c
index 4c0a04c2d458..6defc00199bf 100644
--- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth-devlink.c
+++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth-devlink.c
@@ -233,7 +233,10 @@ int dpaa2_eth_dl_port_add(struct dpaa2_eth_priv *priv)
priv->dl_port_valid = true;
mutex_unlock(&priv->mac_lock);
- attrs.flavour = DEVLINK_PORT_FLAVOUR_PHYSICAL;
+ if (port_number)
+ attrs.flavour = DEVLINK_PORT_FLAVOUR_PHYSICAL;
+ else
+ attrs.flavour = DEVLINK_PORT_FLAVOUR_VIRTUAL;
attrs.phys.port_number = port_number;
devlink_port_attrs_set(devlink_port, &attrs);
err = devlink_port_register(priv->devlink, devlink_port, 0);
--
2.43.0
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH net-next v2 2/2] dpaa2-eth: mark DPNIs without a DPMAC as virtual devlink ports
2026-09-28 11:22 ` [PATCH net-next v2 2/2] dpaa2-eth: mark DPNIs without a DPMAC as virtual devlink ports Vincent Jardin via B4 Relay
@ 2026-10-01 12:54 ` Simon Horman
0 siblings, 0 replies; 6+ messages in thread
From: Simon Horman @ 2026-10-01 12:54 UTC (permalink / raw)
To: vjardin
Cc: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Ioana Ciornei, Vladimir Oltean, netdev,
linux-kernel
On Mon, Sep 28, 2026 at 01:22:46PM +0200, Vincent Jardin via B4 Relay wrote:
> From: Vincent Jardin <vjardin@free.fr>
>
> A DPNI whose endpoint is not a DPMAC has no physical connector: it
> may have no endpoint at all, or be connected to another DPNI or to a
> DPSW port. Until now, such a DPNI was still registered as a physical
> devlink port with number 0, so userspace saw a physical port that does
> not exist.
>
> Register these DPNIs as virtual devlink ports instead. A virtual port
> has no phys_port_name, so only the DPNIs that serve a DPMAC at probe
> time report one, "p<dpmac id>", and those names do not collide.
>
> Signed-off-by: Vincent Jardin <vjardin@free.fr>
Reviewed-by: Simon Horman <horms@kernel.org>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH net-next v2 0/2] dpaa2-eth: devlink port number from the DPMAC
2026-09-28 11:22 [PATCH net-next v2 0/2] dpaa2-eth: devlink port number from the DPMAC Vincent Jardin via B4 Relay
2026-09-28 11:22 ` [PATCH net-next v2 1/2] dpaa2-eth: use the DPMAC id as the devlink physical port number Vincent Jardin via B4 Relay
2026-09-28 11:22 ` [PATCH net-next v2 2/2] dpaa2-eth: mark DPNIs without a DPMAC as virtual devlink ports Vincent Jardin via B4 Relay
@ 2026-10-02 0:20 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 6+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-10-02 0:20 UTC (permalink / raw)
To: Vincent Jardin
Cc: andrew+netdev, davem, edumazet, kuba, pabeni, ioana.ciornei,
vladimir.oltean, netdev, linux-kernel
Hello:
This series was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Mon, 28 Sep 2026 13:22:44 +0200 you wrote:
> dpaa2-eth registers every DPNI as a physical devlink port without a
> port number, so all the DPAA2 interfaces report the same
> phys_port_name "p0", including the DPNIs that have no DPMAC behind
> them.
>
> Patch 1 uses the DPMAC id as the physical port number. The attributes
> of a registered devlink port cannot change, so when the DPNI endpoint
> changes at runtime a warning says the number is stale until the DPNI
> is rebound.
>
> [...]
Here is the summary with links:
- [net-next,v2,1/2] dpaa2-eth: use the DPMAC id as the devlink physical port number
https://git.kernel.org/netdev/net-next/c/526025d552ba
- [net-next,v2,2/2] dpaa2-eth: mark DPNIs without a DPMAC as virtual devlink ports
https://git.kernel.org/netdev/net-next/c/aed5a323ec37
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-10-02 0:20 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-28 11:22 [PATCH net-next v2 0/2] dpaa2-eth: devlink port number from the DPMAC Vincent Jardin via B4 Relay
2026-09-28 11:22 ` [PATCH net-next v2 1/2] dpaa2-eth: use the DPMAC id as the devlink physical port number Vincent Jardin via B4 Relay
2026-10-01 12:53 ` Simon Horman
2026-09-28 11:22 ` [PATCH net-next v2 2/2] dpaa2-eth: mark DPNIs without a DPMAC as virtual devlink ports Vincent Jardin via B4 Relay
2026-10-01 12:54 ` Simon Horman
2026-10-02 0:20 ` [PATCH net-next v2 0/2] dpaa2-eth: devlink port number from the DPMAC patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®