mgmt: smp: shell: allow to configure multiple RX buffers via Kconfig

With only single RX buffer there is a high chance that such buffer will
not be processed before new bytes come in over UART. This is why it is
good to have at least two buffers, one which can be processed by SMP
layer, while another is being filled with new incoming bytes.

Add Kconfig option which allows to configure multiple buffers filled
with received UART SMP fragments. Use default value of 2, so we can
safely process already received frame in thread, while new fragment
comes in concurrently.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
This commit is contained in:
Marcin Niestroj 2020-07-20 17:07:42 +02:00 committed by Carles Cufí
commit 7451a32e98
2 changed files with 11 additions and 3 deletions

View file

@ -263,15 +263,23 @@ config MCUMGR_SMP_SHELL
Enables handling of SMP commands received over shell. This allows Enables handling of SMP commands received over shell. This allows
the shell to be use for both mcumgr commands and shell commands. the shell to be use for both mcumgr commands and shell commands.
if MCUMGR_SMP_SHELL
config MCUMGR_SMP_SHELL_MTU config MCUMGR_SMP_SHELL_MTU
int "Shell SMP MTU" int "Shell SMP MTU"
default 256 default 256
depends on MCUMGR_SMP_SHELL
help help
Maximum size of SMP frames sent and received over shell. This value Maximum size of SMP frames sent and received over shell. This value
must satisfy the following relation: must satisfy the following relation:
MCUMGR_SMP_SHELL_MTU <= MCUMGR_BUF_SIZE + 2 MCUMGR_SMP_SHELL_MTU <= MCUMGR_BUF_SIZE + 2
config MCUMGR_SMP_SHELL_RX_BUF_COUNT
int "Shell SMP RX buffer count"
default 2
help
Number of buffers used for receiving SMP fragments over shell.
endif # MCUMGR_SMP_SHELL
config MCUMGR_SMP_UART config MCUMGR_SMP_UART
bool "UART mcumgr SMP transport" bool "UART mcumgr SMP transport"

View file

@ -20,8 +20,8 @@ LOG_MODULE_REGISTER(shell_uart);
#endif #endif
#ifdef CONFIG_MCUMGR_SMP_SHELL #ifdef CONFIG_MCUMGR_SMP_SHELL
NET_BUF_POOL_DEFINE(smp_shell_rx_pool, 1, SMP_SHELL_RX_BUF_SIZE, NET_BUF_POOL_DEFINE(smp_shell_rx_pool, CONFIG_MCUMGR_SMP_SHELL_RX_BUF_COUNT,
0, NULL); SMP_SHELL_RX_BUF_SIZE, 0, NULL);
#endif /* CONFIG_MCUMGR_SMP_SHELL */ #endif /* CONFIG_MCUMGR_SMP_SHELL */
SHELL_UART_DEFINE(shell_transport_uart, SHELL_UART_DEFINE(shell_transport_uart,