net: gptp: Create a stack size Kconfig option

The stack size was previously hardcoded in the source code, making it
difficult to change when enabling options that require a larger stack.

Signed-off-by: Ambroise Vincent <ambroise.vincent@arm.com>
This commit is contained in:
Ambroise Vincent 2023-10-12 08:48:56 +01:00 committed by Carles Cufí
parent 357f88bb59
commit 68dfd819c1
2 changed files with 8 additions and 3 deletions

View file

@ -103,6 +103,13 @@ config NET_GPTP_CLOCK_ACCURACY
default 0x31 if NET_GPTP_CLOCK_ACCURACY_GT_10S
default 0xfe
config NET_GPTP_STACK_SIZE
int "gPTP thread stack size"
default 2048
help
Set the gPTP thread stack size in bytes. The gPTP thread handles the
gPTP state machine. There is one gPTP thread in the system.
config NET_GPTP_NUM_PORTS
int "Number of gPTP ports"
default 1

View file

@ -20,8 +20,6 @@ LOG_MODULE_REGISTER(net_gptp, CONFIG_NET_GPTP_LOG_LEVEL);
#include "gptp_private.h"
#define NET_GPTP_STACK_SIZE 2048
#if CONFIG_NET_GPTP_NUM_PORTS > 32
/*
* Boolean arrays sizes have been hardcoded.
@ -31,7 +29,7 @@ LOG_MODULE_REGISTER(net_gptp, CONFIG_NET_GPTP_LOG_LEVEL);
#error Maximum number of ports exceeded. (Max is 32).
#endif
K_KERNEL_STACK_DEFINE(gptp_stack, NET_GPTP_STACK_SIZE);
K_KERNEL_STACK_DEFINE(gptp_stack, CONFIG_NET_GPTP_STACK_SIZE);
K_FIFO_DEFINE(gptp_rx_queue);
static k_tid_t tid;