net: ip: Allow traffic class thread priority customization

Add traffic class priority custom option to customize traffic class
priority base for throughput performace.

Wi-Fi traffic performance depends on cooperation between net threads
and Wi-Fi driver threads. So we want traffic class threads priority
to be more flexible to fit more vendors.

Eg: when traffic class tx thread priority is higher than driver tx
thread, it will consume much more cpu time and send packets until driver
queue full.
When traffic class tx thread priority is lower than driver tx thread,
it will become serial transmition, also affecting throughput.

Signed-off-by: Fengming Ye <frank.ye@nxp.com>
This commit is contained in:
Fengming Ye 2024-02-04 17:57:44 +09:00 committed by Alberto Escolar
parent bd94e199e5
commit ac8920e342
2 changed files with 32 additions and 3 deletions

View file

@ -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

View file

@ -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)