All of lore.kernel.org
 help / color / mirror / Atom feed
* [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

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.