Skip to content

Commit 6783848

Browse files
ssharkscarlescufi
authored andcommitted
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 <[email protected]>
1 parent cb31883 commit 6783848

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

subsys/net/l2/ppp/Kconfig

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,4 +92,20 @@ config NET_L2_PPP_TX_STACK_SIZE
9292
help
9393
Set the TX handler stack size.
9494

95+
config NET_L2_PPP_THREAD_PRIO
96+
int "Priority of the PPP TX thread"
97+
default 1
98+
help
99+
Set the priority of the the PPP TX thread, that handles all
100+
transmission of PPP packets.
101+
Value 0 = highest priortity.
102+
When CONFIG_NET_TC_THREAD_COOPERATIVE = y, lowest priority is
103+
CONFIG_NUM_COOP_PRIORITIES-1 else lowest priority is
104+
CONFIG_NUM_PREEMPT_PRIORITIES-1.
105+
When using PPP in combination with TCP, make sure the priority
106+
is higher (or equal) than the TCP work queue, otherwise the
107+
TCP stack will consume all net_bufs before transferring
108+
execution to the lower layer network stack, with a high risk of
109+
running out of net_bufs.
110+
95111
endif # NET_L2_PPP

subsys/net/l2/ppp/ppp_l2.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ static K_FIFO_DEFINE(tx_queue);
2626

2727
#if defined(CONFIG_NET_TC_THREAD_COOPERATIVE)
2828
/* Lowest priority cooperative thread */
29-
#define THREAD_PRIORITY K_PRIO_COOP(CONFIG_NUM_COOP_PRIORITIES - 1)
29+
#define THREAD_PRIORITY K_PRIO_COOP(CONFIG_NET_L2_PPP_THREAD_PRIO)
3030
#else
31-
#define THREAD_PRIORITY K_PRIO_PREEMPT(CONFIG_NUM_PREEMPT_PRIORITIES - 1)
31+
#define THREAD_PRIORITY K_PRIO_PREEMPT(CONFIG_NET_L2_PPP_THREAD_PRIO)
3232
#endif
3333

3434
static void tx_handler(void);

0 commit comments

Comments
 (0)