drivers: modem: gsm: allocate in modem_cmd_handler with K_NO_WAIT

All net_bufs allocated to modem_cmd_handler's data->rx_buf are consumed
synchronously in gsm_ppp.c in the same thread. This means that
allocating them with timeout makes no sense, because timeout
will *always* be hit when there are no more buffers in net_buf_pool.

Get rid of the unnecessary timeout, as it doesn't help and just slows
down processing of incoming data, increasing possibility of data
overrun.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
This commit is contained in:
Marcin Niestroj 2020-10-26 19:37:09 +01:00 committed by Maureen Helm
commit 94caa8f2fd

View file

@ -28,7 +28,6 @@ LOG_MODULE_REGISTER(modem_gsm, CONFIG_MODEM_LOG_LEVEL);
#define GSM_RX_STACK_SIZE CONFIG_MODEM_GSM_RX_STACK_SIZE #define GSM_RX_STACK_SIZE CONFIG_MODEM_GSM_RX_STACK_SIZE
#define GSM_RECV_MAX_BUF 30 #define GSM_RECV_MAX_BUF 30
#define GSM_RECV_BUF_SIZE 128 #define GSM_RECV_BUF_SIZE 128
#define GSM_BUF_ALLOC_TIMEOUT K_SECONDS(1)
/* During the modem setup, we first create DLCI control channel and then /* During the modem setup, we first create DLCI control channel and then
* PPP and AT channels. Currently the modem does not create possible GNSS * PPP and AT channels. Currently the modem does not create possible GNSS
@ -730,7 +729,7 @@ static int gsm_init(const struct device *device)
gsm->cmd_handler_data.match_buf = &gsm->cmd_match_buf[0]; gsm->cmd_handler_data.match_buf = &gsm->cmd_match_buf[0];
gsm->cmd_handler_data.match_buf_len = sizeof(gsm->cmd_match_buf); gsm->cmd_handler_data.match_buf_len = sizeof(gsm->cmd_match_buf);
gsm->cmd_handler_data.buf_pool = &gsm_recv_pool; gsm->cmd_handler_data.buf_pool = &gsm_recv_pool;
gsm->cmd_handler_data.alloc_timeout = GSM_BUF_ALLOC_TIMEOUT; gsm->cmd_handler_data.alloc_timeout = K_NO_WAIT;
gsm->cmd_handler_data.eol = "\r"; gsm->cmd_handler_data.eol = "\r";
k_sem_init(&gsm->sem_response, 0, 1); k_sem_init(&gsm->sem_response, 0, 1);