drivers: eth: native_posix: Add Kconfig to Configure RX Timeout

Add Kconfig to set sleep timeout between empty read attempts in rx thread
for ethernet native posix driver.

Signed-off-by: Nicola Ochsenbein <Nicola.Ochsenbein@husqvarnagroup.com>
This commit is contained in:
Nicola Ochsenbein 2023-08-22 14:27:02 +02:00 committed by Carles Cufí
commit e3654e045e
2 changed files with 11 additions and 5 deletions

View file

@ -125,4 +125,14 @@ config ETH_NATIVE_POSIX_MAC_ADDR
means the code will make 00:00:5E:00:53:XX, where XX will be
random.
config ETH_NATIVE_POSIX_RX_TIMEOUT
int "Ethernet RX timeout"
default 1 if NET_GPTP
default 50
range 1 100
help
Native posix ethernet driver repeatedly checks for new data.
Specify how long the thread sleeps between these checks if no new data
available.
endif # ETH_NATIVE_POSIX

View file

@ -376,11 +376,7 @@ static void eth_rx(struct eth_context *ctx)
}
}
if (IS_ENABLED(CONFIG_NET_GPTP)) {
k_sleep(K_MSEC(1));
} else {
k_sleep(K_MSEC(50));
}
k_sleep(K_MSEC(CONFIG_ETH_NATIVE_POSIX_RX_TIMEOUT));
}
}