drivers: modem: ublox-sara-r4: 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 ublox-sara-r4.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:35 +01:00 committed by Maureen Helm
parent 94caa8f2fd
commit 5fa69327f2

View file

@ -88,8 +88,6 @@ static struct modem_pin modem_pins[] = {
#define MDM_WAIT_FOR_RSSI_COUNT 10
#define MDM_WAIT_FOR_RSSI_DELAY K_SECONDS(2)
#define BUF_ALLOC_TIMEOUT K_SECONDS(1)
#define MDM_MANUFACTURER_LENGTH 10
#define MDM_MODEL_LENGTH 16
#define MDM_REVISION_LENGTH 64
@ -1743,7 +1741,7 @@ static int modem_init(const struct device *dev)
mdata.cmd_handler_data.match_buf = &mdata.cmd_match_buf[0];
mdata.cmd_handler_data.match_buf_len = sizeof(mdata.cmd_match_buf);
mdata.cmd_handler_data.buf_pool = &mdm_recv_pool;
mdata.cmd_handler_data.alloc_timeout = BUF_ALLOC_TIMEOUT;
mdata.cmd_handler_data.alloc_timeout = K_NO_WAIT;
mdata.cmd_handler_data.eol = "\r";
ret = modem_cmd_handler_init(&mctx.cmd_handler,
&mdata.cmd_handler_data);