diff --git a/subsys/net/ip/Kconfig b/subsys/net/ip/Kconfig index 4203a42ee18..35ed6db87c1 100644 --- a/subsys/net/ip/Kconfig +++ b/subsys/net/ip/Kconfig @@ -279,6 +279,32 @@ config NET_TC_NUM_PRIORITIES default NUM_COOP_PRIORITIES if NET_TC_THREAD_COOPERATIVE default NUM_PREEMPT_PRIORITIES if NET_TC_THREAD_PREEMPTIVE +config NET_TC_THREAD_PRIO_CUSTOM + bool "Customize traffic class thread priority" + help + Customise net threads priority by each. + +if NET_TC_THREAD_PRIO_CUSTOM +config NET_TC_TX_THREAD_BASE_PRIO + int "Transmit traffic class base thread priority" + default 0 + help + Transmit traffic class threads priority will increase/decrease + from this priority. + If NET_TC_TX_COUNT is 1, this will be transmit traffic class + thread priority. + +config NET_TC_RX_THREAD_BASE_PRIO + int "Receive traffic class base thread priority" + default 0 + help + Receive traffic class threads priority will increase/decrease + from this priority. + If NET_TC_RX_COUNT is 1, this will be receive traffic class + thread priority. + +endif # NET_TC_THREAD_CUSTOM_PRIO + choice prompt "Priority to traffic class mapping" help diff --git a/subsys/net/ip/net_tc.c b/subsys/net/ip/net_tc.c index d789232b582..7be023ca0e9 100644 --- a/subsys/net/ip/net_tc.c +++ b/subsys/net/ip/net_tc.c @@ -104,8 +104,9 @@ int net_rx_priority2tc(enum net_priority prio) #endif } - -#if defined(CONFIG_NET_TC_THREAD_COOPERATIVE) +#if defined(CONFIG_NET_TC_THREAD_PRIO_CUSTOM) +#define BASE_PRIO_TX CONFIG_NET_TC_TX_THREAD_BASE_PRIO +#elif defined(CONFIG_NET_TC_THREAD_COOPERATIVE) #define BASE_PRIO_TX (CONFIG_NET_TC_NUM_PRIORITIES - 1) #else #define BASE_PRIO_TX (CONFIG_NET_TC_TX_COUNT - 1) @@ -113,7 +114,9 @@ int net_rx_priority2tc(enum net_priority prio) #define PRIO_TX(i, _) (BASE_PRIO_TX - i) -#if defined(CONFIG_NET_TC_THREAD_COOPERATIVE) +#if defined(CONFIG_NET_TC_THREAD_PRIO_CUSTOM) +#define BASE_PRIO_RX CONFIG_NET_TC_RX_THREAD_BASE_PRIO +#elif defined(CONFIG_NET_TC_THREAD_COOPERATIVE) #define BASE_PRIO_RX (CONFIG_NET_TC_NUM_PRIORITIES - 1) #else #define BASE_PRIO_RX (CONFIG_NET_TC_RX_COUNT - 1)