drivers: modem: hl7800: Make RX net_bufs configurable

Make receive network buffer count and size
configurable via kconfig.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
This commit is contained in:
Ryan Erickson 2020-10-19 14:46:28 -05:00 committed by Jukka Rissanen
commit d3dcf49735
2 changed files with 11 additions and 5 deletions

View file

@ -21,6 +21,14 @@ config MODEM_HL7800_FW_UPDATE
Enable the ability to update the HL7800 via XMODEM Enable the ability to update the HL7800 via XMODEM
by providing an update file to the update API. by providing an update file to the update API.
config MODEM_HL7800_RECV_BUF_CNT
int "The number of allocated network buffers"
default 30
config MODEM_HL7800_RECV_BUF_SIZE
int "The size of the network buffers in bytes"
default 128
config MODEM_HL7800_SET_APN_NAME_ON_STARTUP config MODEM_HL7800_SET_APN_NAME_ON_STARTUP
bool "Set APN name during driver init" bool "Set APN name during driver init"
help help

View file

@ -257,8 +257,6 @@ static const struct mdm_control_pinconfig pinconfig[] = {
#define MDM_MTU 1500 #define MDM_MTU 1500
#define MDM_MAX_RESP_SIZE 128 #define MDM_MAX_RESP_SIZE 128
#define MDM_RECV_MAX_BUF 30
#define MDM_RECV_BUF_SIZE 128
#define MDM_HANDLER_MATCH_MAX_LEN 100 #define MDM_HANDLER_MATCH_MAX_LEN 100
#define MDM_MAX_SOCKETS 6 #define MDM_MAX_SOCKETS 6
@ -379,8 +377,8 @@ static const char TIME_STRING_FORMAT[] = "\"yy/MM/dd,hh:mm:ss?zz\"";
} \ } \
} while (0) } while (0)
NET_BUF_POOL_DEFINE(mdm_recv_pool, MDM_RECV_MAX_BUF, MDM_RECV_BUF_SIZE, 0, NET_BUF_POOL_DEFINE(mdm_recv_pool, CONFIG_MODEM_HL7800_RECV_BUF_CNT,
NULL); CONFIG_MODEM_HL7800_RECV_BUF_SIZE, 0, NULL);
static uint8_t mdm_recv_buf[MDM_MAX_DATA_LENGTH]; static uint8_t mdm_recv_buf[MDM_MAX_DATA_LENGTH];
@ -3117,7 +3115,7 @@ static inline struct net_buf *read_rx_allocator(k_timeout_t timeout,
static size_t hl7800_read_rx(struct net_buf **buf) static size_t hl7800_read_rx(struct net_buf **buf)
{ {
uint8_t uart_buffer[MDM_RECV_BUF_SIZE]; uint8_t uart_buffer[CONFIG_MODEM_HL7800_RECV_BUF_SIZE];
size_t bytes_read, total_read; size_t bytes_read, total_read;
int ret; int ret;
uint16_t rx_len; uint16_t rx_len;