From 501bf8634d46ffc9db3635d6a16f637489e2841d Mon Sep 17 00:00:00 2001 From: p-szafonimateusz Date: Mon, 8 Jun 2026 15:10:29 +0200 Subject: [PATCH] arch/sim/sim_cansock.c: drain all pending TX frames per txavail Loop devif_poll() until it reports nothing more to send, matching the batch-drain behaviour of the upper-half CAN drivers, so a transfer completes on one notification. Signed-off-by: p-szafonimateusz --- arch/sim/src/sim/sim_cansock.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/arch/sim/src/sim/sim_cansock.c b/arch/sim/src/sim/sim_cansock.c index eabda777e9d..d5bc261794d 100644 --- a/arch/sim/src/sim/sim_cansock.c +++ b/arch/sim/src/sim/sim_cansock.c @@ -137,7 +137,11 @@ static int sim_can_txavail(struct net_driver_s *dev) netdev_lock(dev); if (IFF_IS_UP(priv->dev.d_flags)) { - devif_poll(&priv->dev, sim_can_txpoll); + /* Drain all pending TX frames */ + + while (devif_poll(&priv->dev, sim_can_txpoll) > 0) + { + } } netdev_unlock(dev);