drivers: wifi: esp: Fix issue with incorrect tx timeout
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>
This commit is contained in:
parent
045cc2eb2a
commit
71e7cd3f99
1 changed files with 6 additions and 2 deletions
|
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue