* [PATCH] net: ldpaa_eth: track the open state in the driver
@ 2026-11-27 8:17 Vincent Jardin
2026-11-27 14:38 ` Sverdlin, Alexander
0 siblings, 1 reply; 3+ messages in thread
From: Vincent Jardin @ 2026-11-27 8:17 UTC (permalink / raw)
To: u-boot
Cc: Jerome Forissier, Tom Rini, Alexander Sverdlin, Maxime Leroy,
Peng Fan, Vincent Jardin
From: Maxime Leroy <maxime@leroys.fr>
ldpaa_eth_open() and ldpaa_eth_stop() use eth_is_active() to check
if the port is open.
But eth_is_active() tells whether the port is in use, not whether it
is open!
Fixes: 44340456475d ("net: tftp: don't call stop callback from UDP handler")
Signed-off-by: Maxime Leroy <maxime@leroys.fr>
Signed-off-by: Vincent Jardin <vjardin@free.fr>
---
It has been tested on an LX2160A board (Nodebox v3) on its RGMII port
(DPMAC 17), at the U-Boot prompt: 3 rounds of a tftp of a missing file
with the errors:
"TFTP error: 'File not found' (1)"
then a tftp of an existing file, each load transferring the file.
Two loads in a row and a ping.
drivers/net/ldpaa_eth/ldpaa_eth.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ldpaa_eth/ldpaa_eth.c b/drivers/net/ldpaa_eth/ldpaa_eth.c
index 27ae6747464..03d704eab69 100644
--- a/drivers/net/ldpaa_eth/ldpaa_eth.c
+++ b/drivers/net/ldpaa_eth/ldpaa_eth.c
@@ -380,7 +380,7 @@ static int ldpaa_eth_open(struct udevice *dev)
struct dpni_queue d_queue_cfg = { 0 };
struct dpni_queue_id d_queue;
- if (eth_is_active(dev))
+ if (priv->started)
return 0;
if (get_mc_boot_status() != 0) {
@@ -476,6 +476,8 @@ static int ldpaa_eth_open(struct udevice *dev)
goto err_qdid;
}
+ priv->started = true;
+
return dpmac_link_state.up;
err_qdid:
@@ -502,8 +504,9 @@ static void ldpaa_eth_stop(struct udevice *dev)
int err = 0;
u64 *data;
- if (!eth_is_active(dev))
+ if (!priv->started)
return;
+ priv->started = false;
data = kzalloc(sizeof(u64) * LDPAA_ETH_DPNI_NUM_STATS, GFP_KERNEL);
if (data) {
---
base-commit: 9d67454e920b3908529c9fc642a8c911db040896
branch: for-upstream/ldpaa-eth-open-state-v1
--
2.43.0
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] net: ldpaa_eth: track the open state in the driver
2026-11-27 8:17 [PATCH] net: ldpaa_eth: track the open state in the driver Vincent Jardin
@ 2026-11-27 14:38 ` Sverdlin, Alexander
2026-11-27 21:51 ` Vincent Jardin
0 siblings, 1 reply; 3+ messages in thread
From: Sverdlin, Alexander @ 2026-11-27 14:38 UTC (permalink / raw)
To: vjardin@free.fr, u-boot@lists.u-boot-project.org
Cc: jerome.forissier@arm.com, trini@konsulko.com, maxime@leroys.fr,
peng.fan@nxp.com
Hi Vincent!
On Fri, 2026-11-27 at 09:17 +0100, Vincent Jardin wrote:
> From: Maxime Leroy <maxime@leroys.fr>
>
> ldpaa_eth_open() and ldpaa_eth_stop() use eth_is_active() to check
> if the port is open.
> But eth_is_active() tells whether the port is in use, not whether it
> is open!
>
> Fixes: 44340456475d ("net: tftp: don't call stop callback from UDP handler")
One could argue, that the underlying bug is the driver using eth_is_active() as
its start/stop guard. That came in with 267c5146d3f
("drivers: net: ldpaa: add DTS based probing support", v2020.07), and it can be
triggered without 44340456475d:
With netconsole active: net_loop(NETCONS) succeeds, then calls
eth_halt_state_only(), leaving the device PASSIVE but still running.
bootm then calls eth_halt(), which exists specifically to stop what netconsole
left up (bootm.c).
ldpaa_eth_stop() returns early, so the DPNI and DPMAC are still enabled when
Linux starts.
This has been possible since fa795f45254 (v2021.04) made eth_halt() call .stop
based on running instead of state.
I'd say, the Fixes: tag could be 267c5146d3f
("drivers: net: ldpaa: add DTS based probing support"),
while 44340456475d exposed additional to non-netconsole TFTP error path.
Other than that and a nit below,
Reviewed-by: Alexander Sverdlin <alexander.sverdlin@siemens.com>
> Signed-off-by: Maxime Leroy <maxime@leroys.fr>
> Signed-off-by: Vincent Jardin <vjardin@free.fr>
>
> ---
> It has been tested on an LX2160A board (Nodebox v3) on its RGMII port
> (DPMAC 17), at the U-Boot prompt: 3 rounds of a tftp of a missing file
> with the errors:
> "TFTP error: 'File not found' (1)"
> then a tftp of an existing file, each load transferring the file.
> Two loads in a row and a ping.
>
> drivers/net/ldpaa_eth/ldpaa_eth.c | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/ldpaa_eth/ldpaa_eth.c b/drivers/net/ldpaa_eth/ldpaa_eth.c
> index 27ae6747464..03d704eab69 100644
> --- a/drivers/net/ldpaa_eth/ldpaa_eth.c
> +++ b/drivers/net/ldpaa_eth/ldpaa_eth.c
> @@ -380,7 +380,7 @@ static int ldpaa_eth_open(struct udevice *dev)
> struct dpni_queue d_queue_cfg = { 0 };
> struct dpni_queue_id d_queue;
>
> - if (eth_is_active(dev))
> + if (priv->started)
> return 0;
>
> if (get_mc_boot_status() != 0) {
> @@ -476,6 +476,8 @@ static int ldpaa_eth_open(struct udevice *dev)
> goto err_qdid;
> }
>
> + priv->started = true;
> +
> return dpmac_link_state.up;
>
> err_qdid:
> @@ -502,8 +504,9 @@ static void ldpaa_eth_stop(struct udevice *dev)
> int err = 0;
> u64 *data;
>
> - if (!eth_is_active(dev))
> + if (!priv->started)
> return;
There could be a blank line here if you ever would need to re-spin.
> + priv->started = false;
>
> data = kzalloc(sizeof(u64) * LDPAA_ETH_DPNI_NUM_STATS, GFP_KERNEL);
> if (data) {
--
Alexander Sverdlin
Siemens AG
www.siemens.com
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] net: ldpaa_eth: track the open state in the driver
2026-11-27 14:38 ` Sverdlin, Alexander
@ 2026-11-27 21:51 ` Vincent Jardin
0 siblings, 0 replies; 3+ messages in thread
From: Vincent Jardin @ 2026-11-27 21:51 UTC (permalink / raw)
To: Sverdlin, Alexander
Cc: u-boot@lists.u-boot-project.org, jerome.forissier@arm.com,
trini@konsulko.com, maxime@leroys.fr, peng.fan@nxp.com
Hi Alexander,
> I'd say, the Fixes: tag could be 267c5146d3f
> ("drivers: net: ldpaa: add DTS based probing support"),
> while 44340456475d exposed additional to non-netconsole TFTP error path.
>
> Other than that and a nit below,
> Reviewed-by: Alexander Sverdlin <alexander.sverdlin@siemens.com>
thanks, I did apply your comments into a v2 and kept your reviewed-by:
https://lore.kernel.org/all/20261127214450.865924-1-vjardin@free.fr/
Best regards,
Vincent
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-11-27 21:52 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-27 8:17 [PATCH] net: ldpaa_eth: track the open state in the driver Vincent Jardin
2026-11-27 14:38 ` Sverdlin, Alexander
2026-11-27 21:51 ` Vincent Jardin
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.