Commit ec08e1c0 authored by IBEN EL HADJ MESSAOUD Marwa's avatar IBEN EL HADJ MESSAOUD Marwa Committed by Carles Cufi
Browse files

drivers: ethernet: Modify RX thread creation and update KConfig



This change will allow users to configure the Ethernet RX thread
according to their specific real-time requirements.
Adding preemptive threading helps to reduce jitter and
the impact of Ethernet traffic on real-time performance.

Signed-off-by: default avatarIBEN EL HADJ MESSAOUD Marwa <marwa.ibenelhadjmessaoud-ext@st.com>
parent 1bea5fca
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -46,10 +46,15 @@ config ETH_STM32_HAL_RX_THREAD_STACK_SIZE
	  RX thread stack size

config ETH_STM32_HAL_RX_THREAD_PRIO
	int "RX thread priority"
	int "STM32 Ethernet RX Thread Priority"
	default 2
	help
	  RX thread priority
	  This option allows to configure the priority of the RX thread that
	  handles incoming Ethernet packets.
	  Switching between preemptive and cooperative scheduling can be done by
	  NET_TC_THREAD_PREEMPTIVE.
	  Preemptive scheduling can lead to more responsive handling of network traffic,
	  especially under high load.

config ETH_STM32_HAL_USE_DTCM_FOR_DMA_BUFFER
	bool "Use DTCM for DMA buffers"
+3 −1
Original line number Diff line number Diff line
@@ -1331,7 +1331,9 @@ static void eth_iface_init(struct net_if *iface)
		k_thread_create(&dev_data->rx_thread, dev_data->rx_thread_stack,
				K_KERNEL_STACK_SIZEOF(dev_data->rx_thread_stack),
				rx_thread, (void *) dev, NULL, NULL,
				K_PRIO_COOP(CONFIG_ETH_STM32_HAL_RX_THREAD_PRIO),
				IS_ENABLED(CONFIG_NET_TC_THREAD_PREEMPTIVE)
					? K_PRIO_PREEMPT(CONFIG_ETH_STM32_HAL_RX_THREAD_PRIO)
					: K_PRIO_COOP(CONFIG_ETH_STM32_HAL_RX_THREAD_PRIO),
				0, K_NO_WAIT);

		k_thread_name_set(&dev_data->rx_thread, "stm_eth");