net: ppp_l2: Make prio of PPP TX thread configurable

The PPP TX thread handles the transmission of packets at PPP layer.
Make it's priority configurable, so it's priority can be configured higher
then higher protocol layers.

Signed-off-by: Sjors Hettinga <s.a.hettinga@gmail.com>
This commit is contained in:
Sjors Hettinga 2023-08-02 08:49:24 +02:00 committed by Carles Cufí
parent cb31883e1b
commit 6783848b8f
2 changed files with 18 additions and 2 deletions

View file

@ -92,4 +92,20 @@ config NET_L2_PPP_TX_STACK_SIZE
help
Set the TX handler stack size.
config NET_L2_PPP_THREAD_PRIO
int "Priority of the PPP TX thread"
default 1
help
Set the priority of the the PPP TX thread, that handles all
transmission of PPP packets.
Value 0 = highest priortity.
When CONFIG_NET_TC_THREAD_COOPERATIVE = y, lowest priority is
CONFIG_NUM_COOP_PRIORITIES-1 else lowest priority is
CONFIG_NUM_PREEMPT_PRIORITIES-1.
When using PPP in combination with TCP, make sure the priority
is higher (or equal) than the TCP work queue, otherwise the
TCP stack will consume all net_bufs before transferring
execution to the lower layer network stack, with a high risk of
running out of net_bufs.
endif # NET_L2_PPP

View file

@ -26,9 +26,9 @@ static K_FIFO_DEFINE(tx_queue);
#if defined(CONFIG_NET_TC_THREAD_COOPERATIVE)
/* Lowest priority cooperative thread */
#define THREAD_PRIORITY K_PRIO_COOP(CONFIG_NUM_COOP_PRIORITIES - 1)
#define THREAD_PRIORITY K_PRIO_COOP(CONFIG_NET_L2_PPP_THREAD_PRIO)
#else
#define THREAD_PRIORITY K_PRIO_PREEMPT(CONFIG_NUM_PREEMPT_PRIORITIES - 1)
#define THREAD_PRIORITY K_PRIO_PREEMPT(CONFIG_NET_L2_PPP_THREAD_PRIO)
#endif
static void tx_handler(void);