* [PATCH net-next 0/2] dpaa2-eth: devlink port number from the DPMAC
@ 2026-09-23 12:57 Vincent Jardin via B4 Relay
2026-09-23 12:58 ` [PATCH net-next 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; 5+ messages in thread
From: Vincent Jardin via B4 Relay @ 2026-09-23 12:57 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>
---
Vincent Jardin (2):
dpaa2-eth: use the DPMAC id as the devlink physical port number
dpaa2-eth: DPNIs without a DPMAC should be virtual devlink ports
.../ethernet/freescale/dpaa2/dpaa2-eth-devlink.c | 35 +++++++++++++++++++++-
drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c | 2 ++
drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.h | 1 +
3 files changed, 37 insertions(+), 1 deletion(-)
---
base-commit: 944ae66642b726bd6b25ae71b1e9ff88a0e0bdb0
change-id: 20260923-for-upstream-dpaa2_ports-04087b33bb8f
Best regards,
--
Vincent Jardin <vjardin@free.fr>
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH net-next 1/2] dpaa2-eth: use the DPMAC id as the devlink physical port number
2026-09-23 12:57 [PATCH net-next 0/2] dpaa2-eth: devlink port number from the DPMAC Vincent Jardin via B4 Relay
@ 2026-09-23 12:58 ` Vincent Jardin via B4 Relay
2026-09-23 12:58 ` [PATCH net-next 2/2] dpaa2-eth: DPNIs without a DPMAC should be virtual devlink ports Vincent Jardin via B4 Relay
2026-09-23 15:09 ` [PATCH net-next 0/2] dpaa2-eth: devlink port number from the DPMAC Ioana Ciornei
2 siblings, 0 replies; 5+ messages in thread
From: Vincent Jardin via B4 Relay @ 2026-09-23 12:58 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 therefore 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 | 26 ++++++++++++++++++++++
drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c | 2 ++
drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.h | 1 +
3 files changed, 29 insertions(+)
diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth-devlink.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth-devlink.c
index 8775c931106b..8b2addd3f83a 100644
--- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth-devlink.c
+++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth-devlink.c
@@ -213,16 +213,42 @@ 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)
+{
+ u32 port_number = 0;
+
+ mutex_lock(&priv->mac_lock);
+ if (priv->mac)
+ port_number = priv->mac->mc_dev->obj_desc.id;
+ mutex_unlock(&priv->mac_lock);
+
+ return port_number;
+}
+
int dpaa2_eth_dl_port_add(struct dpaa2_eth_priv *priv)
{
struct devlink_port *devlink_port = &priv->devlink_port;
struct devlink_port_attrs attrs = {};
attrs.flavour = DEVLINK_PORT_FLAVOUR_PHYSICAL;
+ attrs.phys.port_number = dpaa2_eth_dl_port_number(priv);
devlink_port_attrs_set(devlink_port, &attrs);
return devlink_port_register(priv->devlink, devlink_port, 0);
}
+void dpaa2_eth_dl_port_check(struct dpaa2_eth_priv *priv)
+{
+ u32 registered = priv->devlink_port.attrs.phys.port_number;
+ u32 current_number = dpaa2_eth_dl_port_number(priv);
+
+ if (registered == current_number)
+ return;
+
+ netdev_warn(priv->net_dev,
+ "devlink port number %u is stale, the DPMAC endpoint is now %u (0: none); rebind the DPNI to update it\n",
+ registered, current_number);
+}
+
void dpaa2_eth_dl_port_del(struct dpaa2_eth_priv *priv)
{
struct devlink_port *devlink_port = &priv->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..071a3d23cf1e 100644
--- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.h
+++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.h
@@ -802,6 +802,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] 5+ messages in thread
* [PATCH net-next 2/2] dpaa2-eth: DPNIs without a DPMAC should be virtual devlink ports
2026-09-23 12:57 [PATCH net-next 0/2] dpaa2-eth: devlink port number from the DPMAC Vincent Jardin via B4 Relay
2026-09-23 12:58 ` [PATCH net-next 1/2] dpaa2-eth: use the DPMAC id as the devlink physical port number Vincent Jardin via B4 Relay
@ 2026-09-23 12:58 ` Vincent Jardin via B4 Relay
2026-09-23 15:09 ` [PATCH net-next 0/2] dpaa2-eth: devlink port number from the DPMAC Ioana Ciornei
2 siblings, 0 replies; 5+ messages in thread
From: Vincent Jardin via B4 Relay @ 2026-09-23 12:58 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. It is still registered as a physical devlink port, number 0,
so userspace sees a physical port that does not exist.
A virtual port has no phys_port_name, so only the DPNIs that serve a
DPMAC report one, and "p<dpmac id>" never collides.
Signed-off-by: Vincent Jardin <vjardin@free.fr>
---
drivers/net/ethernet/freescale/dpaa2/dpaa2-eth-devlink.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth-devlink.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth-devlink.c
index 8b2addd3f83a..30e6cb2190db 100644
--- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth-devlink.c
+++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth-devlink.c
@@ -230,16 +230,23 @@ int dpaa2_eth_dl_port_add(struct dpaa2_eth_priv *priv)
struct devlink_port *devlink_port = &priv->devlink_port;
struct devlink_port_attrs attrs = {};
- attrs.flavour = DEVLINK_PORT_FLAVOUR_PHYSICAL;
attrs.phys.port_number = dpaa2_eth_dl_port_number(priv);
+ if (attrs.phys.port_number)
+ attrs.flavour = DEVLINK_PORT_FLAVOUR_PHYSICAL;
+ else
+ attrs.flavour = DEVLINK_PORT_FLAVOUR_VIRTUAL;
devlink_port_attrs_set(devlink_port, &attrs);
return devlink_port_register(priv->devlink, devlink_port, 0);
}
void dpaa2_eth_dl_port_check(struct dpaa2_eth_priv *priv)
{
- u32 registered = priv->devlink_port.attrs.phys.port_number;
+ const struct devlink_port_attrs *attrs = &priv->devlink_port.attrs;
u32 current_number = dpaa2_eth_dl_port_number(priv);
+ u32 registered = 0;
+
+ if (attrs->flavour == DEVLINK_PORT_FLAVOUR_PHYSICAL)
+ registered = attrs->phys.port_number;
if (registered == current_number)
return;
--
2.43.0
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net-next 0/2] dpaa2-eth: devlink port number from the DPMAC
2026-09-23 12:57 [PATCH net-next 0/2] dpaa2-eth: devlink port number from the DPMAC Vincent Jardin via B4 Relay
2026-09-23 12:58 ` [PATCH net-next 1/2] dpaa2-eth: use the DPMAC id as the devlink physical port number Vincent Jardin via B4 Relay
2026-09-23 12:58 ` [PATCH net-next 2/2] dpaa2-eth: DPNIs without a DPMAC should be virtual devlink ports Vincent Jardin via B4 Relay
@ 2026-09-23 15:09 ` Ioana Ciornei
2026-09-24 11:58 ` Vincent Jardin
2 siblings, 1 reply; 5+ messages in thread
From: Ioana Ciornei @ 2026-09-23 15:09 UTC (permalink / raw)
To: vjardin
Cc: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Vladimir Oltean, netdev, linux-kernel
On Wed, Sep 23, 2026 at 02:57:59PM +0200, Vincent Jardin via B4 Relay 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.
>
> 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"
Is consistent naming the end goal? Because renaming can already be done
for DPAA2 network interfaces based on the of_node. I usually have
something like below in my udev rules file:
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="fsl_dpaa2_eth", \
ENV{OF_FULLNAME}=="/soc/fsl-mc@80c000000/dpmacs/ethernet@1", NAME="endpmac1"
Anyhow, I will give the series a spin tomorrow.
Ioana
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net-next 0/2] dpaa2-eth: devlink port number from the DPMAC
2026-09-23 15:09 ` [PATCH net-next 0/2] dpaa2-eth: devlink port number from the DPMAC Ioana Ciornei
@ 2026-09-24 11:58 ` Vincent Jardin
0 siblings, 0 replies; 5+ messages in thread
From: Vincent Jardin @ 2026-09-24 11:58 UTC (permalink / raw)
To: Ioana Ciornei
Cc: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Vladimir Oltean, netdev, linux-kernel
Hi Ioana,
> Is consistent naming the end goal? Because renaming can already be done
> for DPAA2 network interfaces based on the of_node. I usually have
> something like below in my udev rules file:
>
> SUBSYSTEM=="net", ACTION=="add", DRIVERS=="fsl_dpaa2_eth", \
> ENV{OF_FULLNAME}=="/soc/fsl-mc@80c000000/dpmacs/ethernet@1", NAME="endpmac1"
It was the root of my initial investigation, but I need more:
- I need to have an attribute that I can use from the userland to name and
rename many times, so in between it I would need something to rely with
- cosmetic: just have a propver devlink
> Anyhow, I will give the series a spin tomorrow.
Thanks: it should not hurt, and devlink should be more coherent then.
best regards,
Vincent
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-09-24 11:58 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-23 12:57 [PATCH net-next 0/2] dpaa2-eth: devlink port number from the DPMAC Vincent Jardin via B4 Relay
2026-09-23 12:58 ` [PATCH net-next 1/2] dpaa2-eth: use the DPMAC id as the devlink physical port number Vincent Jardin via B4 Relay
2026-09-23 12:58 ` [PATCH net-next 2/2] dpaa2-eth: DPNIs without a DPMAC should be virtual devlink ports Vincent Jardin via B4 Relay
2026-09-23 15:09 ` [PATCH net-next 0/2] dpaa2-eth: devlink port number from the DPMAC Ioana Ciornei
2026-09-24 11:58 ` Vincent Jardin
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®