zephyr/drivers/wifi
Marcin Niestroj 956923f8e5 drivers: wifi: esp: schedule each RX packet on separate work
So far a dedicated FIFO was used for all RX packets, which was consumed
in single submitted work. This work was also responsible for closing
socket and notifying uppper network layers if some errors occurred
previously or socket was simply closed by peer. There is however a
potential race condition in scenario described below:

  esp_rx thread             | esp_workq thread
  --------------------------|-----------------------------
                            | ---- esp_recv_work ----
                            | handle RX packets from FIFO
                            |
  ---- on_cmd_ipd ----      |
  put new RX packet to FIFO |
  ---- on_cmd_ipd ----      |
                            |
  ---- on_cmd_closed ----   |
  mark socket as closed     |
  ---- on_cmd_closed ----   |
                            |
                            | handle close
                            | ---- esp_recv_work ----

In this case we assume that esp_workq was preempted just after
processing all RX packets from FIFO and before checking if socket was
closed. In such scenario RX packet put to FIFO just before doing close
is going to be unhandled, so application layer will miss part of the
data.

Change the way RX packets are scheduled to workqueue, by using the
already available net_pkt->work objects (used for example in native TCP
stack). Create a separate work for closing connection. As a result all
RX packets and close handlers are on the same queue and there is no risk
of handling close events before handling all previously received data.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2021-01-22 12:02:10 +01:00
..
esp drivers: wifi: esp: schedule each RX packet on separate work 2021-01-22 12:02:10 +01:00
eswifi drivers: wifi: eswifi: set NET_CONTEXT_CONNECTED state 2020-12-14 18:15:49 +02:00
simplelink drivers: wifi: fix simplelink driver to use zsock_ functions 2020-10-01 17:35:45 +03:00
winc1500 drivers: wifi: winc1500: set NET_CONTEXT_CONNECTED state 2020-12-14 18:15:49 +02:00
CMakeLists.txt drivers: wifi: Add ESP8266 and ESP32 wifi modem driver 2020-03-21 19:08:02 +02:00
Kconfig drivers: wifi: rename WiFi kconfig prompt 2020-11-03 19:18:37 +02:00