From 5fa69327f2de55ec3b785e399ed1fc7d0730084d Mon Sep 17 00:00:00 2001 From: Marcin Niestroj Date: Mon, 26 Oct 2020 19:37:35 +0100 Subject: [PATCH] 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 --- drivers/modem/ublox-sara-r4.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/modem/ublox-sara-r4.c b/drivers/modem/ublox-sara-r4.c index 1be5f67778..5f6ae28453 100644 --- a/drivers/modem/ublox-sara-r4.c +++ b/drivers/modem/ublox-sara-r4.c @@ -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);