Skip to content

Commit

Permalink
drivers: wifi: esp: Fix issue with incorrect tx timeout
Browse files Browse the repository at this point in the history
It can happen that the command '>' is received between
modem_cmd_send_nolock and modem_cmd_handler_update_cmds. Since the
command handler for '>' is not set, sem_tx_ready will not be given
and _sock_send will timeout. Make sure the command handlers are set
before the send by also passing them to modem_cmd_send_nolock.

Signed-off-by: Tobias Svehagen <tobias.svehagen@gmail.com>
  • Loading branch information
tsvehagen authored and jukkar committed Jul 22, 2020
1 parent 045cc2e commit 71e7cd3
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions drivers/wifi/esp/esp_offload.c
Original file line number Diff line number Diff line change
Expand Up @@ -237,8 +237,8 @@ static int _sock_send(struct esp_data *dev, struct esp_socket *sock)
k_sem_reset(&dev->sem_tx_ready);

ret = modem_cmd_send_nolock(&dev->mctx.iface, &dev->mctx.cmd_handler,
NULL, 0, cmd_buf, &dev->sem_response,
ESP_CMD_TIMEOUT);
cmds, ARRAY_SIZE(cmds), cmd_buf,
&dev->sem_response, ESP_CMD_TIMEOUT);
if (ret < 0) {
LOG_DBG("Failed to send command");
goto out;
Expand Down Expand Up @@ -339,6 +339,10 @@ static int esp_sendto(struct net_pkt *pkt,

LOG_DBG("link %d, timeout %d", sock->link_id, timeout);

if (!esp_flag_is_set(dev, EDF_STA_CONNECTED)) {
return -ENETUNREACH;
}

if (sock->tx_pkt) {
return -EBUSY;
}
Expand Down

0 comments on commit 71e7cd3

Please sign in to comment.