arch/sim: Drain all host CAN frames per RX work cycle.

sim_can_work() in sim_cansock.c and sim_canchar.c read a single frame
from the host socket and requeued itself after SIM_CAN_WORK_DELAY
(USEC2TICK(1000), one 10 ms tick with the default sim tick), capping
RX at about 100 frames/s. A burst from the bus was then delivered
over hundreds of milliseconds, and frames from an earlier burst
reached sockets opened later. Loop while frames are available.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: raiden00pl <raiden00@railab.me>
This commit is contained in:
raiden00pl 2026-10-07 10:23:18 +02:00 • committed by Xiang Xiao
parent 20f3b65937
commit 2b359b11c5
2 changed files with 10 additions and 2 deletions

View file

@ -292,7 +292,11 @@ static void sim_can_work(void *arg)
struct can_hdr_s hdr;
int ret;
if (host_can_avail(&priv->host))
/* Drain all frames queued on the host socket, otherwise only one frame
* is delivered per work period and the RX path lags behind the bus.
*/
while (host_can_avail(&priv->host))
{
/* Wait for data from host stack */

View file

@ -174,7 +174,11 @@ static void sim_can_work(void *arg)
struct canfd_frame hframe;
int ret;
if (host_can_avail(&priv->host))
/* Drain all frames queued on the host socket, otherwise only one frame
* is delivered per work period and the RX path lags behind the bus.
*/
while (host_can_avail(&priv->host))
{
/* Wait for data from host stack */