modem: cmux: make work buffer size configurable
A Kconfig item is added and the buffer is embedded into the modem_cmux struct. The default value is increased from 16 to 64 bytes in an effort to reduce the number of modem_pipe_receive() calls. CONFIG_MODEM_CHAT_LOG_BUFFER is renamed to CONFIG_MODEM_CHAT_LOG_BUFFER_SIZE for consistency. Signed-off-by: Tomi Fontanilles <tomi.fontanilles@nordicsemi.no>
This commit is contained in:
parent
419a398c01
commit
18170ebce1
|
@ -188,6 +188,12 @@ LoRaWAN
|
|||
MCUmgr
|
||||
======
|
||||
|
||||
Modem
|
||||
=====
|
||||
|
||||
* The ``CONFIG_MODEM_CHAT_LOG_BUFFER`` Kconfig option was
|
||||
renamed to :kconfig:option:`MODEM_CHAT_LOG_BUFFER_SIZE`.
|
||||
|
||||
Shell
|
||||
=====
|
||||
|
||||
|
|
|
@ -141,6 +141,8 @@ struct modem_cmux {
|
|||
uint16_t receive_buf_size;
|
||||
uint16_t receive_buf_len;
|
||||
|
||||
uint8_t work_buf[CONFIG_MODEM_CMUX_WORK_BUFFER_SIZE];
|
||||
|
||||
/* Transmit buffer */
|
||||
struct ring_buf transmit_rb;
|
||||
struct k_mutex transmit_rb_lock;
|
||||
|
|
|
@ -14,8 +14,8 @@ config MODEM_CHAT
|
|||
|
||||
if MODEM_CHAT
|
||||
|
||||
config MODEM_CHAT_LOG_BUFFER
|
||||
int "Modem chat log buffer size"
|
||||
config MODEM_CHAT_LOG_BUFFER_SIZE
|
||||
int "Modem chat log buffer size in bytes"
|
||||
default 128
|
||||
|
||||
endif
|
||||
|
@ -29,6 +29,11 @@ config MODEM_CMUX
|
|||
|
||||
if MODEM_CMUX
|
||||
|
||||
config MODEM_CMUX_WORK_BUFFER_SIZE
|
||||
int "CMUX module work buffer size in bytes"
|
||||
range 16 1500
|
||||
default 64
|
||||
|
||||
module = MODEM_CMUX
|
||||
module-str = modem_cmux
|
||||
source "subsys/logging/Kconfig.template.log_config"
|
||||
|
|
|
@ -20,7 +20,7 @@ LOG_MODULE_REGISTER(modem_chat, CONFIG_MODEM_MODULES_LOG_LEVEL);
|
|||
|
||||
#if defined(CONFIG_LOG) && (CONFIG_MODEM_MODULES_LOG_LEVEL == LOG_LEVEL_DBG)
|
||||
|
||||
static char log_buffer[CONFIG_MODEM_CHAT_LOG_BUFFER];
|
||||
static char log_buffer[CONFIG_MODEM_CHAT_LOG_BUFFER_SIZE];
|
||||
|
||||
static void modem_chat_log_received_command(struct modem_chat *chat)
|
||||
{
|
||||
|
|
|
@ -842,11 +842,10 @@ static void modem_cmux_receive_handler(struct k_work *item)
|
|||
{
|
||||
struct k_work_delayable *dwork = k_work_delayable_from_work(item);
|
||||
struct modem_cmux *cmux = CONTAINER_OF(dwork, struct modem_cmux, receive_work);
|
||||
uint8_t buf[16];
|
||||
int ret;
|
||||
|
||||
/* Receive data from pipe */
|
||||
ret = modem_pipe_receive(cmux->pipe, buf, sizeof(buf));
|
||||
ret = modem_pipe_receive(cmux->pipe, cmux->work_buf, sizeof(cmux->work_buf));
|
||||
if (ret < 1) {
|
||||
if (ret < 0) {
|
||||
LOG_ERR("Pipe receiving error: %d", ret);
|
||||
|
@ -855,8 +854,8 @@ static void modem_cmux_receive_handler(struct k_work *item)
|
|||
}
|
||||
|
||||
/* Process received data */
|
||||
for (uint16_t i = 0; i < (uint16_t)ret; i++) {
|
||||
modem_cmux_process_received_byte(cmux, buf[i]);
|
||||
for (int i = 0; i < ret; i++) {
|
||||
modem_cmux_process_received_byte(cmux, cmux->work_buf[i]);
|
||||
}
|
||||
|
||||
/* Reschedule received work */
|
||||
|
|
Loading…
Reference in New Issue