You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2020/11/13 09:23:05 UTC

[GitHub] [incubator-nuttx] donghengqaz opened a new pull request #2294: xtensa/esp32: Refactor ESP32 Wi-Fi driver

donghengqaz opened a new pull request #2294:
URL: https://github.com/apache/incubator-nuttx/pull/2294


   ## Summary
   
   Refactor ESP32 Wi-Fi driver.
   
   ## Impact
   
   Increate UDP/TX throughput.
   
   ## Testing
   
   Using iperf to test TCP/UDP throughput.
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] acassis merged pull request #2294: xtensa/esp32: Refactor ESP32 Wi-Fi driver

Posted by GitBox <gi...@apache.org>.
acassis merged pull request #2294:
URL: https://github.com/apache/incubator-nuttx/pull/2294


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] donghengqaz commented on a change in pull request #2294: xtensa/esp32: Refactor ESP32 Wi-Fi driver

Posted by GitBox <gi...@apache.org>.
donghengqaz commented on a change in pull request #2294:
URL: https://github.com/apache/incubator-nuttx/pull/2294#discussion_r526031328



##########
File path: arch/xtensa/src/esp32/esp32_wifi_adapter.c
##########
@@ -2210,6 +2300,19 @@ void esp_phy_disable_clock(void)
   leave_critical_section(flags);
 }
 
+/****************************************************************************
+ * Name: esp_phy_update_country_info
+ *
+ * Description:
+ *   Don't support
+ *
+ ****************************************************************************/
+
+static int32_t esp_phy_update_country_info(const char *country)

Review comment:
       In the callback table, some functions' return type is `int` and some are `int32_t`, so I should keep function and type same.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] donghengqaz commented on a change in pull request #2294: [WIP] xtensa/esp32: Refactor ESP32 Wi-Fi driver

Posted by GitBox <gi...@apache.org>.
donghengqaz commented on a change in pull request #2294:
URL: https://github.com/apache/incubator-nuttx/pull/2294#discussion_r524913220



##########
File path: arch/xtensa/src/esp32/esp32_wifi_adapter.c
##########
@@ -2210,6 +2300,19 @@ void esp_phy_disable_clock(void)
   leave_critical_section(flags);
 }
 
+/****************************************************************************
+ * Name: esp_phy_update_country_info
+ *
+ * Description:
+ *   Don't support
+ *
+ ****************************************************************************/
+
+static int32_t esp_phy_update_country_info(const char *country)
+{
+  return 0;

Review comment:
       These function mainly for internal WiFi libs not for NuttX, so we should keep 0 here.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] donghengqaz edited a comment on pull request #2294: xtensa/esp32: Refactor ESP32 Wi-Fi driver

Posted by GitBox <gi...@apache.org>.
donghengqaz edited a comment on pull request #2294:
URL: https://github.com/apache/incubator-nuttx/pull/2294#issuecomment-738517194


   > Hi @donghengqaz
   > Is this PR ready to merge?
   
   Yes, I use this branch to test throughput and its performance is much better than old one. Although these are some functions which are not implemented, they are used by WiFi mesh or BT/BLE, these functions are not in our current plan. Besides this, some functions are not same as NuttX, and we just keep it empty if there are not in NuttX or we don't use it.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] donghengqaz commented on a change in pull request #2294: xtensa/esp32: Refactor ESP32 Wi-Fi driver

Posted by GitBox <gi...@apache.org>.
donghengqaz commented on a change in pull request #2294:
URL: https://github.com/apache/incubator-nuttx/pull/2294#discussion_r530746166



##########
File path: arch/xtensa/src/esp32/esp32_wifi_adapter.c
##########
@@ -1854,6 +1937,58 @@ static void esp_evt_work_cb(FAR void *arg)
     }
 }
 
+/****************************************************************************
+ * Name: wifi_env_is_chip
+ *
+ * Description:
+ *   Config chip environment
+ *
+ * Returned Value:
+ *   True if on FPGA or false if not.
+ *
+ ****************************************************************************/
+
+static bool wifi_env_is_chip(void)
+{
+  return true;
+}

Review comment:
       This function's description is not right, but this function is also needed, because it one of wifi adapter structure member.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] ghn-certi commented on a change in pull request #2294: [WIP] xtensa/esp32: Refactor ESP32 Wi-Fi driver

Posted by GitBox <gi...@apache.org>.
ghn-certi commented on a change in pull request #2294:
URL: https://github.com/apache/incubator-nuttx/pull/2294#discussion_r522993141



##########
File path: arch/xtensa/src/esp32/esp32_wlan.c
##########
@@ -307,76 +361,204 @@ static inline bool esp_isfreebuffer(FAR struct esp_dev_s *priv)
  *
  ****************************************************************************/
 
-static int esp_transmit(FAR struct esp_dev_s *priv)
+static int wlan_transmit(FAR struct wlan_priv_s *priv)
 {
-  int ret = 0;
-  uint8_t *buffer;
-  uint32_t buffer_len;
-
-  /* Set up all but the last TX descriptor */
+  int ret;
+  struct net_driver_s *dev = &priv->dev;
+  void *buffer = dev->d_buf;
+  uint32_t len = dev->d_len;
 
-  buffer = priv->esp_dev.d_buf;
-  buffer_len = priv->esp_dev.d_len;
-  ret = esp_wifi_sta_send_data(buffer, buffer_len);
+  if (!wifi_tx_available(priv))
+    {
+      return -ENOBUFS;
+    }
 
-  if (ret != 0)
+  ret = esp_wifi_sta_send_data(buffer, len);
+  if (ret)
     {
-      wlerr("ERROR: Failed to transmit frame\n");
-      (void)wd_start(&priv->esp_txtimeout, ESP_TXTIMEOUT,
-                     esp_txtimeout_expiry, (uint32_t)priv);
+      priv->tx_rst = len;
+      if (buffer != priv->txbuf)
+        {
+          memcpy(priv->txbuf, buffer, len);
+        }
+
+      wd_start(&priv->txtimeout, WLAN_TXTIMEOUT,
+               wlan_txtimeout_expiry, (uint32_t)priv);
+
       return -EIO;
     }
+  else
+    {
+      priv->tx_rst = 0;
+    }
 
   return OK;
 }
 
 /****************************************************************************
- * Function: esp_recvframe
+ * Function: wlan_recvframe
  *
  * Description:
- *   It scans the RX descriptors of the received frame.
- *
- *   NOTE: This function will silently discard any packets containing errors.
+ *   Try to receive RX buffer from RX done buffer list.
  *
  * Input Parameters:
  *   priv  - Reference to the driver state structure
  *
  * Returned Value:
- *   OK if a packet was successfully returned; -EAGAIN if there are no
- *   further packets available
+ *   RX buffer if success or NULl if no buffer in list.
  *
  ****************************************************************************/
 
-static int esp_recvframe(FAR struct esp_dev_s *priv)
+static struct wlan_rxbuf *wlan_recvframe(FAR struct wlan_priv_s *priv)
 {
-  struct net_driver_s *dev = &priv->esp_dev;
-  uint8_t *buffer;
-  uint32_t buffer_len = 0;
-  buffer = dev->d_buf;
-  buffer_len = dev->d_len;
-
-  /* Check if there are free buffers.  We cannot receive new frames in this
-   * design unless there is at least one free buffer.
-   */
+  irqstate_t flags;
+  sq_entry_t *entry;
+  struct wlan_rxbuf *rxbuf;
+
+  flags = enter_critical_section();
 
-  if (!esp_isfreebuffer(priv))
+  entry = sq_remfirst(&priv->rxb);
+  if (entry)
+    {
+      rxbuf = container_of(entry, struct wlan_rxbuf, entry);
+    }
+  else
     {
-      wlerr("ERROR: No free buffers\n");
-      return -ENOMEM;
+      rxbuf = NULL;
     }
 
-  /* Check if any errors are reported in the frame */
+  leave_critical_section(flags);
+
+  return rxbuf;
+}
 
-  if (buffer == NULL || buffer_len == 0)
+/****************************************************************************
+ * Name: wlan_tx_done
+ *
+ * Description:
+ *   TxDone callback function type.
+ *
+ * Input Parameters:
+ *   ifidx  - The interface id that the tx callback has been triggered from.
+ *   data   - Pointer to the data transmitted.
+ *   len    - Length of the data transmitted.
+ *   status - True if data was transmitted sucessfully or false if failed.
+ *
+ * Returned Value:
+ *   None
+ *
+ ****************************************************************************/
+
+static void wlan_tx_done(uint8_t ifidx, uint8_t *data,
+                         uint16_t *len, bool status)
+{
+  FAR struct wlan_priv_s *priv = &g_wlan_priv; 
+
+  wd_cancel(&priv->txtimeout);
+
+  wlan_txavail(&priv->dev);
+}
+
+/****************************************************************************
+ * Function: wlan_rx_done
+ *
+ * Description:
+ *   This function should be called when a packet is ready to be read
+ *   from the interface. It uses the function low_level_input() that
+ *   should handle the actual reception of bytes from the network
+ *   interface. Then the type of the received packet is determined and
+ *   the appropriate input function is called.
+ *
+ * Input Parameters:
+ *   buffer - WiFi receive buffer
+ *   len    - Length of receive buffer
+ *   eb     - WiFi receive callback input eb pointer
+ *
+ * Returned Value:
+ *   OK on success; a negated errno on failure
+ *
+ ****************************************************************************/
+
+static int wlan_rx_done(void *buffer, uint16_t len, void *eb)
+{
+  struct wlan_rxbuf *rxbuf;
+  irqstate_t flags;
+  FAR struct wlan_priv_s *priv = &g_wlan_priv;
+
+  if (len > WLAN_BUF_SIZE)
     {
-      return -EAGAIN;
+      wlerr("ERROR: Wlan receive %d larger than %d\n",
+            len, WLAN_BUF_SIZE);
     }
 
-  return OK;
+  rxbuf = wlan_alloc_buffer(priv);
+  if (!rxbuf)
+    {
+      if (eb)
+        {
+          esp_wifi_free_eb(eb);
+        }
+  
+      return -ENOBUFS;
+    }
+
+  memcpy(rxbuf->buffer, buffer, len);
+  rxbuf->len = len;
+
+  if (eb)
+    {
+      esp_wifi_free_eb(eb);
+    }
+
+  flags = enter_critical_section();
+  sq_addlast(&rxbuf->entry, &priv->rxb);
+  leave_critical_section(flags);
+
+  if (work_available(&priv->rxwork))
+    {
+      work_queue(WLAN_WORK, &priv->rxwork, wlan_rxpoll, priv, 0);
+    }
+
+  return 0;

Review comment:
       ```suggestion
     return OK;
   ```




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] ghn-certi commented on a change in pull request #2294: [WIP] xtensa/esp32: Refactor ESP32 Wi-Fi driver

Posted by GitBox <gi...@apache.org>.
ghn-certi commented on a change in pull request #2294:
URL: https://github.com/apache/incubator-nuttx/pull/2294#discussion_r522993825



##########
File path: arch/xtensa/src/esp32/esp32_wlan.c
##########
@@ -307,76 +361,204 @@ static inline bool esp_isfreebuffer(FAR struct esp_dev_s *priv)
  *
  ****************************************************************************/
 
-static int esp_transmit(FAR struct esp_dev_s *priv)
+static int wlan_transmit(FAR struct wlan_priv_s *priv)
 {
-  int ret = 0;
-  uint8_t *buffer;
-  uint32_t buffer_len;
-
-  /* Set up all but the last TX descriptor */
+  int ret;
+  struct net_driver_s *dev = &priv->dev;
+  void *buffer = dev->d_buf;
+  uint32_t len = dev->d_len;
 
-  buffer = priv->esp_dev.d_buf;
-  buffer_len = priv->esp_dev.d_len;
-  ret = esp_wifi_sta_send_data(buffer, buffer_len);
+  if (!wifi_tx_available(priv))
+    {
+      return -ENOBUFS;
+    }
 
-  if (ret != 0)
+  ret = esp_wifi_sta_send_data(buffer, len);
+  if (ret)
     {
-      wlerr("ERROR: Failed to transmit frame\n");
-      (void)wd_start(&priv->esp_txtimeout, ESP_TXTIMEOUT,
-                     esp_txtimeout_expiry, (uint32_t)priv);
+      priv->tx_rst = len;
+      if (buffer != priv->txbuf)
+        {
+          memcpy(priv->txbuf, buffer, len);
+        }
+
+      wd_start(&priv->txtimeout, WLAN_TXTIMEOUT,
+               wlan_txtimeout_expiry, (uint32_t)priv);
+
       return -EIO;
     }
+  else
+    {
+      priv->tx_rst = 0;
+    }
 
   return OK;
 }
 
 /****************************************************************************
- * Function: esp_recvframe
+ * Function: wlan_recvframe
  *
  * Description:
- *   It scans the RX descriptors of the received frame.
- *
- *   NOTE: This function will silently discard any packets containing errors.
+ *   Try to receive RX buffer from RX done buffer list.
  *
  * Input Parameters:
  *   priv  - Reference to the driver state structure
  *
  * Returned Value:
- *   OK if a packet was successfully returned; -EAGAIN if there are no
- *   further packets available
+ *   RX buffer if success or NULl if no buffer in list.
  *
  ****************************************************************************/
 
-static int esp_recvframe(FAR struct esp_dev_s *priv)
+static struct wlan_rxbuf *wlan_recvframe(FAR struct wlan_priv_s *priv)
 {
-  struct net_driver_s *dev = &priv->esp_dev;
-  uint8_t *buffer;
-  uint32_t buffer_len = 0;
-  buffer = dev->d_buf;
-  buffer_len = dev->d_len;
-
-  /* Check if there are free buffers.  We cannot receive new frames in this
-   * design unless there is at least one free buffer.
-   */
+  irqstate_t flags;
+  sq_entry_t *entry;
+  struct wlan_rxbuf *rxbuf;
+
+  flags = enter_critical_section();
 
-  if (!esp_isfreebuffer(priv))
+  entry = sq_remfirst(&priv->rxb);
+  if (entry)
+    {
+      rxbuf = container_of(entry, struct wlan_rxbuf, entry);
+    }
+  else
     {
-      wlerr("ERROR: No free buffers\n");
-      return -ENOMEM;
+      rxbuf = NULL;
     }
 
-  /* Check if any errors are reported in the frame */
+  leave_critical_section(flags);
+
+  return rxbuf;
+}
 
-  if (buffer == NULL || buffer_len == 0)
+/****************************************************************************
+ * Name: wlan_tx_done
+ *
+ * Description:
+ *   TxDone callback function type.
+ *
+ * Input Parameters:
+ *   ifidx  - The interface id that the tx callback has been triggered from.
+ *   data   - Pointer to the data transmitted.
+ *   len    - Length of the data transmitted.
+ *   status - True if data was transmitted sucessfully or false if failed.
+ *
+ * Returned Value:
+ *   None
+ *
+ ****************************************************************************/
+
+static void wlan_tx_done(uint8_t ifidx, uint8_t *data,
+                         uint16_t *len, bool status)
+{
+  FAR struct wlan_priv_s *priv = &g_wlan_priv; 
+
+  wd_cancel(&priv->txtimeout);
+
+  wlan_txavail(&priv->dev);
+}
+
+/****************************************************************************
+ * Function: wlan_rx_done
+ *
+ * Description:
+ *   This function should be called when a packet is ready to be read
+ *   from the interface. It uses the function low_level_input() that
+ *   should handle the actual reception of bytes from the network
+ *   interface. Then the type of the received packet is determined and
+ *   the appropriate input function is called.
+ *
+ * Input Parameters:
+ *   buffer - WiFi receive buffer
+ *   len    - Length of receive buffer
+ *   eb     - WiFi receive callback input eb pointer
+ *
+ * Returned Value:
+ *   OK on success; a negated errno on failure
+ *
+ ****************************************************************************/
+
+static int wlan_rx_done(void *buffer, uint16_t len, void *eb)
+{
+  struct wlan_rxbuf *rxbuf;
+  irqstate_t flags;
+  FAR struct wlan_priv_s *priv = &g_wlan_priv;
+
+  if (len > WLAN_BUF_SIZE)
     {
-      return -EAGAIN;
+      wlerr("ERROR: Wlan receive %d larger than %d\n",
+            len, WLAN_BUF_SIZE);
     }
 
-  return OK;
+  rxbuf = wlan_alloc_buffer(priv);
+  if (!rxbuf)
+    {
+      if (eb)
+        {
+          esp_wifi_free_eb(eb);
+        }
+  
+      return -ENOBUFS;
+    }
+
+  memcpy(rxbuf->buffer, buffer, len);
+  rxbuf->len = len;
+
+  if (eb)
+    {
+      esp_wifi_free_eb(eb);
+    }
+
+  flags = enter_critical_section();
+  sq_addlast(&rxbuf->entry, &priv->rxb);
+  leave_critical_section(flags);
+
+  if (work_available(&priv->rxwork))
+    {
+      work_queue(WLAN_WORK, &priv->rxwork, wlan_rxpoll, priv, 0);
+    }
+
+  return 0;
+}
+
+static int wlan_combine_ipv4ack(FAR struct wlan_priv_s *priv)
+{
+  struct tcp_hdr_s *tcp_hdr;
+  FAR struct net_driver_s *dev = &priv->dev;
+  struct ipv4_hdr_s *ipv4_hdr = (struct ipv4_hdr_s *)&dev->d_buf[sizeof(struct eth_hdr_s)];
+
+  if (ipv4_hdr->proto == IP_PROTO_TCP)
+    {
+      tcp_hdr = (struct tcp_hdr_s *)((uint32_t)ipv4_hdr + sizeof(struct ipv4_hdr_s));
+      if (tcp_hdr->flags == TCP_ACK)
+        {
+          memcpy(priv->ackbuf, dev->d_buf, dev->d_len);
+          priv->ack_len = dev->d_len;
+          return 0;

Review comment:
       ```suggestion
             return OK;
   ```




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] donghengqaz commented on a change in pull request #2294: [WIP] xtensa/esp32: Refactor ESP32 Wi-Fi driver

Posted by GitBox <gi...@apache.org>.
donghengqaz commented on a change in pull request #2294:
URL: https://github.com/apache/incubator-nuttx/pull/2294#discussion_r523861678



##########
File path: arch/xtensa/src/esp32/Make.defs
##########
@@ -193,8 +193,7 @@ chip/$(WIRELESS_DRV_UNPACK): $(WIRELESS_DRV_ZIP)
 context:: chip/$(WIRELESS_DRV_UNPACK)
 
 clean_context::
-	$(call DELFILE, chip/$(WIRELESS_DRV_ZIP))

Review comment:
       Thanks for your reviewing, the MR is in developing and removing this just for easy to reconfig and compiling, when finish developing, I will recover this.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] ghn-certi commented on a change in pull request #2294: [WIP] xtensa/esp32: Refactor ESP32 Wi-Fi driver

Posted by GitBox <gi...@apache.org>.
ghn-certi commented on a change in pull request #2294:
URL: https://github.com/apache/incubator-nuttx/pull/2294#discussion_r522994905



##########
File path: arch/xtensa/src/esp32/esp32_wlan.c
##########
@@ -307,76 +361,204 @@ static inline bool esp_isfreebuffer(FAR struct esp_dev_s *priv)
  *
  ****************************************************************************/
 
-static int esp_transmit(FAR struct esp_dev_s *priv)
+static int wlan_transmit(FAR struct wlan_priv_s *priv)
 {
-  int ret = 0;
-  uint8_t *buffer;
-  uint32_t buffer_len;
-
-  /* Set up all but the last TX descriptor */
+  int ret;
+  struct net_driver_s *dev = &priv->dev;
+  void *buffer = dev->d_buf;
+  uint32_t len = dev->d_len;
 
-  buffer = priv->esp_dev.d_buf;
-  buffer_len = priv->esp_dev.d_len;
-  ret = esp_wifi_sta_send_data(buffer, buffer_len);
+  if (!wifi_tx_available(priv))
+    {
+      return -ENOBUFS;
+    }
 
-  if (ret != 0)
+  ret = esp_wifi_sta_send_data(buffer, len);
+  if (ret)
     {
-      wlerr("ERROR: Failed to transmit frame\n");
-      (void)wd_start(&priv->esp_txtimeout, ESP_TXTIMEOUT,
-                     esp_txtimeout_expiry, (uint32_t)priv);
+      priv->tx_rst = len;
+      if (buffer != priv->txbuf)
+        {
+          memcpy(priv->txbuf, buffer, len);
+        }
+
+      wd_start(&priv->txtimeout, WLAN_TXTIMEOUT,
+               wlan_txtimeout_expiry, (uint32_t)priv);
+
       return -EIO;
     }
+  else
+    {
+      priv->tx_rst = 0;
+    }
 
   return OK;
 }
 
 /****************************************************************************
- * Function: esp_recvframe
+ * Function: wlan_recvframe
  *
  * Description:
- *   It scans the RX descriptors of the received frame.
- *
- *   NOTE: This function will silently discard any packets containing errors.
+ *   Try to receive RX buffer from RX done buffer list.
  *
  * Input Parameters:
  *   priv  - Reference to the driver state structure
  *
  * Returned Value:
- *   OK if a packet was successfully returned; -EAGAIN if there are no
- *   further packets available
+ *   RX buffer if success or NULl if no buffer in list.
  *
  ****************************************************************************/
 
-static int esp_recvframe(FAR struct esp_dev_s *priv)
+static struct wlan_rxbuf *wlan_recvframe(FAR struct wlan_priv_s *priv)
 {
-  struct net_driver_s *dev = &priv->esp_dev;
-  uint8_t *buffer;
-  uint32_t buffer_len = 0;
-  buffer = dev->d_buf;
-  buffer_len = dev->d_len;
-
-  /* Check if there are free buffers.  We cannot receive new frames in this
-   * design unless there is at least one free buffer.
-   */
+  irqstate_t flags;
+  sq_entry_t *entry;
+  struct wlan_rxbuf *rxbuf;
+
+  flags = enter_critical_section();
 
-  if (!esp_isfreebuffer(priv))
+  entry = sq_remfirst(&priv->rxb);
+  if (entry)
+    {
+      rxbuf = container_of(entry, struct wlan_rxbuf, entry);
+    }
+  else
     {
-      wlerr("ERROR: No free buffers\n");
-      return -ENOMEM;
+      rxbuf = NULL;
     }
 
-  /* Check if any errors are reported in the frame */
+  leave_critical_section(flags);
+
+  return rxbuf;
+}
 
-  if (buffer == NULL || buffer_len == 0)
+/****************************************************************************
+ * Name: wlan_tx_done
+ *
+ * Description:
+ *   TxDone callback function type.
+ *
+ * Input Parameters:
+ *   ifidx  - The interface id that the tx callback has been triggered from.
+ *   data   - Pointer to the data transmitted.
+ *   len    - Length of the data transmitted.
+ *   status - True if data was transmitted sucessfully or false if failed.
+ *
+ * Returned Value:
+ *   None
+ *
+ ****************************************************************************/
+
+static void wlan_tx_done(uint8_t ifidx, uint8_t *data,
+                         uint16_t *len, bool status)
+{
+  FAR struct wlan_priv_s *priv = &g_wlan_priv; 
+
+  wd_cancel(&priv->txtimeout);
+
+  wlan_txavail(&priv->dev);
+}
+
+/****************************************************************************
+ * Function: wlan_rx_done
+ *
+ * Description:
+ *   This function should be called when a packet is ready to be read
+ *   from the interface. It uses the function low_level_input() that
+ *   should handle the actual reception of bytes from the network
+ *   interface. Then the type of the received packet is determined and
+ *   the appropriate input function is called.
+ *
+ * Input Parameters:
+ *   buffer - WiFi receive buffer
+ *   len    - Length of receive buffer
+ *   eb     - WiFi receive callback input eb pointer
+ *
+ * Returned Value:
+ *   OK on success; a negated errno on failure
+ *
+ ****************************************************************************/
+
+static int wlan_rx_done(void *buffer, uint16_t len, void *eb)
+{
+  struct wlan_rxbuf *rxbuf;
+  irqstate_t flags;
+  FAR struct wlan_priv_s *priv = &g_wlan_priv;
+
+  if (len > WLAN_BUF_SIZE)
     {
-      return -EAGAIN;
+      wlerr("ERROR: Wlan receive %d larger than %d\n",
+            len, WLAN_BUF_SIZE);
     }
 
-  return OK;
+  rxbuf = wlan_alloc_buffer(priv);
+  if (!rxbuf)
+    {
+      if (eb)
+        {
+          esp_wifi_free_eb(eb);
+        }
+  
+      return -ENOBUFS;
+    }
+
+  memcpy(rxbuf->buffer, buffer, len);
+  rxbuf->len = len;
+
+  if (eb)
+    {
+      esp_wifi_free_eb(eb);
+    }
+
+  flags = enter_critical_section();
+  sq_addlast(&rxbuf->entry, &priv->rxb);
+  leave_critical_section(flags);
+
+  if (work_available(&priv->rxwork))
+    {
+      work_queue(WLAN_WORK, &priv->rxwork, wlan_rxpoll, priv, 0);
+    }
+
+  return 0;
+}
+
+static int wlan_combine_ipv4ack(FAR struct wlan_priv_s *priv)
+{
+  struct tcp_hdr_s *tcp_hdr;
+  FAR struct net_driver_s *dev = &priv->dev;
+  struct ipv4_hdr_s *ipv4_hdr = (struct ipv4_hdr_s *)&dev->d_buf[sizeof(struct eth_hdr_s)];
+
+  if (ipv4_hdr->proto == IP_PROTO_TCP)
+    {
+      tcp_hdr = (struct tcp_hdr_s *)((uint32_t)ipv4_hdr + sizeof(struct ipv4_hdr_s));
+      if (tcp_hdr->flags == TCP_ACK)
+        {
+          memcpy(priv->ackbuf, dev->d_buf, dev->d_len);
+          priv->ack_len = dev->d_len;
+          return 0;
+        }
+    }
+
+  return -EINVAL;
+}
+
+static void wlan_send_ipv4ack(FAR struct wlan_priv_s *priv)
+{
+  FAR struct net_driver_s *dev = &priv->dev;
+
+  if (priv->ack_len)
+    {
+      dev->d_buf = priv->ackbuf;
+      dev->d_len = priv->ack_len;
+
+      wlan_transmit(priv);
+
+      priv->ack_len = 0;
+    }
 }
 
 /****************************************************************************
- * Function: esp_receive
+ * Function: wlan_receive

Review comment:
       Documentation not in sync with updated function




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] donghengqaz commented on a change in pull request #2294: [WIP] xtensa/esp32: Refactor ESP32 Wi-Fi driver

Posted by GitBox <gi...@apache.org>.
donghengqaz commented on a change in pull request #2294:
URL: https://github.com/apache/incubator-nuttx/pull/2294#discussion_r524912143



##########
File path: arch/xtensa/src/esp32/esp32_wlan.c
##########
@@ -307,76 +361,204 @@ static inline bool esp_isfreebuffer(FAR struct esp_dev_s *priv)
  *
  ****************************************************************************/
 
-static int esp_transmit(FAR struct esp_dev_s *priv)
+static int wlan_transmit(FAR struct wlan_priv_s *priv)
 {
-  int ret = 0;
-  uint8_t *buffer;
-  uint32_t buffer_len;
-
-  /* Set up all but the last TX descriptor */
+  int ret;
+  struct net_driver_s *dev = &priv->dev;
+  void *buffer = dev->d_buf;
+  uint32_t len = dev->d_len;
 
-  buffer = priv->esp_dev.d_buf;
-  buffer_len = priv->esp_dev.d_len;
-  ret = esp_wifi_sta_send_data(buffer, buffer_len);
+  if (!wifi_tx_available(priv))
+    {
+      return -ENOBUFS;
+    }
 
-  if (ret != 0)
+  ret = esp_wifi_sta_send_data(buffer, len);
+  if (ret)
     {
-      wlerr("ERROR: Failed to transmit frame\n");
-      (void)wd_start(&priv->esp_txtimeout, ESP_TXTIMEOUT,
-                     esp_txtimeout_expiry, (uint32_t)priv);
+      priv->tx_rst = len;
+      if (buffer != priv->txbuf)
+        {
+          memcpy(priv->txbuf, buffer, len);
+        }
+
+      wd_start(&priv->txtimeout, WLAN_TXTIMEOUT,
+               wlan_txtimeout_expiry, (uint32_t)priv);
+
       return -EIO;
     }
+  else
+    {
+      priv->tx_rst = 0;
+    }
 
   return OK;
 }
 
 /****************************************************************************
- * Function: esp_recvframe
+ * Function: wlan_recvframe
  *
  * Description:
- *   It scans the RX descriptors of the received frame.
- *
- *   NOTE: This function will silently discard any packets containing errors.
+ *   Try to receive RX buffer from RX done buffer list.
  *
  * Input Parameters:
  *   priv  - Reference to the driver state structure
  *
  * Returned Value:
- *   OK if a packet was successfully returned; -EAGAIN if there are no
- *   further packets available
+ *   RX buffer if success or NULl if no buffer in list.
  *
  ****************************************************************************/
 
-static int esp_recvframe(FAR struct esp_dev_s *priv)
+static struct wlan_rxbuf *wlan_recvframe(FAR struct wlan_priv_s *priv)
 {
-  struct net_driver_s *dev = &priv->esp_dev;
-  uint8_t *buffer;
-  uint32_t buffer_len = 0;
-  buffer = dev->d_buf;
-  buffer_len = dev->d_len;
-
-  /* Check if there are free buffers.  We cannot receive new frames in this
-   * design unless there is at least one free buffer.
-   */
+  irqstate_t flags;
+  sq_entry_t *entry;
+  struct wlan_rxbuf *rxbuf;
+
+  flags = enter_critical_section();
 
-  if (!esp_isfreebuffer(priv))
+  entry = sq_remfirst(&priv->rxb);
+  if (entry)
+    {
+      rxbuf = container_of(entry, struct wlan_rxbuf, entry);
+    }
+  else
     {
-      wlerr("ERROR: No free buffers\n");
-      return -ENOMEM;
+      rxbuf = NULL;
     }
 
-  /* Check if any errors are reported in the frame */
+  leave_critical_section(flags);
+
+  return rxbuf;
+}
 
-  if (buffer == NULL || buffer_len == 0)
+/****************************************************************************
+ * Name: wlan_tx_done
+ *
+ * Description:
+ *   TxDone callback function type.
+ *
+ * Input Parameters:
+ *   ifidx  - The interface id that the tx callback has been triggered from.
+ *   data   - Pointer to the data transmitted.
+ *   len    - Length of the data transmitted.
+ *   status - True if data was transmitted sucessfully or false if failed.
+ *
+ * Returned Value:
+ *   None
+ *
+ ****************************************************************************/
+
+static void wlan_tx_done(uint8_t ifidx, uint8_t *data,
+                         uint16_t *len, bool status)
+{
+  FAR struct wlan_priv_s *priv = &g_wlan_priv; 
+
+  wd_cancel(&priv->txtimeout);
+
+  wlan_txavail(&priv->dev);
+}
+
+/****************************************************************************
+ * Function: wlan_rx_done
+ *
+ * Description:
+ *   This function should be called when a packet is ready to be read
+ *   from the interface. It uses the function low_level_input() that
+ *   should handle the actual reception of bytes from the network
+ *   interface. Then the type of the received packet is determined and
+ *   the appropriate input function is called.
+ *
+ * Input Parameters:
+ *   buffer - WiFi receive buffer
+ *   len    - Length of receive buffer
+ *   eb     - WiFi receive callback input eb pointer
+ *
+ * Returned Value:
+ *   OK on success; a negated errno on failure
+ *
+ ****************************************************************************/
+
+static int wlan_rx_done(void *buffer, uint16_t len, void *eb)
+{
+  struct wlan_rxbuf *rxbuf;
+  irqstate_t flags;
+  FAR struct wlan_priv_s *priv = &g_wlan_priv;
+
+  if (len > WLAN_BUF_SIZE)
     {
-      return -EAGAIN;
+      wlerr("ERROR: Wlan receive %d larger than %d\n",
+            len, WLAN_BUF_SIZE);
     }
 
-  return OK;
+  rxbuf = wlan_alloc_buffer(priv);
+  if (!rxbuf)
+    {
+      if (eb)
+        {
+          esp_wifi_free_eb(eb);
+        }
+  
+      return -ENOBUFS;
+    }
+
+  memcpy(rxbuf->buffer, buffer, len);
+  rxbuf->len = len;
+
+  if (eb)
+    {
+      esp_wifi_free_eb(eb);
+    }
+
+  flags = enter_critical_section();
+  sq_addlast(&rxbuf->entry, &priv->rxb);
+  leave_critical_section(flags);
+
+  if (work_available(&priv->rxwork))
+    {
+      work_queue(WLAN_WORK, &priv->rxwork, wlan_rxpoll, priv, 0);
+    }
+
+  return 0;

Review comment:
       This is callback function and return code is passed to internal WiFi function, so I should keep 0 here.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] Ouss4 commented on pull request #2294: [WIP] xtensa/esp32: Refactor ESP32 Wi-Fi driver

Posted by GitBox <gi...@apache.org>.
Ouss4 commented on pull request #2294:
URL: https://github.com/apache/incubator-nuttx/pull/2294#issuecomment-726751988


   @donghengqaz I'm converting it to draft to avoid an accidental merge.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] donghengqaz commented on pull request #2294: xtensa/esp32: Refactor ESP32 Wi-Fi driver

Posted by GitBox <gi...@apache.org>.
donghengqaz commented on pull request #2294:
URL: https://github.com/apache/incubator-nuttx/pull/2294#issuecomment-738517194


   > Hi @donghengqaz
   > Is this PR ready to merge?
   
   Yes, I use this branch to test throughput and its performance is much better than old one. Although these are some functions which are not implemented, they are used by WiFi mesh or BT/BLE, these functions are not in our current plan. 


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] Ouss4 commented on a change in pull request #2294: xtensa/esp32: Refactor ESP32 Wi-Fi driver

Posted by GitBox <gi...@apache.org>.
Ouss4 commented on a change in pull request #2294:
URL: https://github.com/apache/incubator-nuttx/pull/2294#discussion_r530215630



##########
File path: arch/xtensa/src/esp32/esp32_wifi_adapter.c
##########
@@ -1854,6 +1937,58 @@ static void esp_evt_work_cb(FAR void *arg)
     }
 }
 
+/****************************************************************************
+ * Name: wifi_env_is_chip
+ *
+ * Description:
+ *   Config chip environment
+ *
+ * Returned Value:
+ *   True if on FPGA or false if not.
+ *
+ ****************************************************************************/
+
+static bool wifi_env_is_chip(void)
+{
+  return true;
+}

Review comment:
       Does this still need to be here?

##########
File path: arch/xtensa/src/esp32/esp32_wifi_adapter.c
##########
@@ -1854,6 +1937,58 @@ static void esp_evt_work_cb(FAR void *arg)
     }
 }
 
+/****************************************************************************
+ * Name: wifi_env_is_chip
+ *
+ * Description:
+ *   Config chip environment
+ *
+ * Returned Value:
+ *   True if on FPGA or false if not.
+ *
+ ****************************************************************************/
+
+static bool wifi_env_is_chip(void)
+{
+  return true;
+}
+
+/****************************************************************************
+ * Name: wifi_set_intr
+ *
+ * Description:
+ *   Do nothing
+ *
+ * Input Parameters:
+ *     cpu_no      - The CPU which the interrupt number belongs.
+ *     intr_source - The interrupt hardware source number.
+ *     intr_num    - The interrupt number CPU.
+ *     intr_prio   - The interrupt priority.
+ *
+ * Returned Value:
+ *     None
+ *
+ ****************************************************************************/
+
+static void wifi_set_intr(int32_t cpu_no, uint32_t intr_source,
+                             uint32_t intr_num, int32_t intr_prio)
+{
+  wlinfo("cpu_no=%d, intr_source=%u, intr_num=%u, intr_prio=%d");
+}
+
+/****************************************************************************
+ * Name: wifi_clear_intr
+ *
+ * Description:
+ *   Don't support
+ *
+ ****************************************************************************/
+
+static void IRAM_ATTR wifi_clear_intr(uint32_t intr_source,
+                                         uint32_t intr_num)
+{
+}
+

Review comment:
       Are these functions to be used later?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] acassis commented on pull request #2294: xtensa/esp32: Refactor ESP32 Wi-Fi driver

Posted by GitBox <gi...@apache.org>.
acassis commented on pull request #2294:
URL: https://github.com/apache/incubator-nuttx/pull/2294#issuecomment-737983140


   Hi @donghengqaz
   Is this PR ready to merge?


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] ghn-certi commented on a change in pull request #2294: [WIP] xtensa/esp32: Refactor ESP32 Wi-Fi driver

Posted by GitBox <gi...@apache.org>.
ghn-certi commented on a change in pull request #2294:
URL: https://github.com/apache/incubator-nuttx/pull/2294#discussion_r522995549



##########
File path: arch/xtensa/src/esp32/esp32_wlan.c
##########
@@ -389,149 +571,166 @@ static int esp_recvframe(FAR struct esp_dev_s *priv)
  *
  ****************************************************************************/
 
-static void esp_receive(FAR struct esp_dev_s *priv)
+static void wlan_rxpoll(FAR void *arg)
 {
-  struct net_driver_s *dev = &priv->esp_dev;
+  struct wlan_rxbuf *rxbuf;
+  uint32_t rbytes = 0;
+  FAR struct wlan_priv_s *priv = (FAR struct wlan_priv_s *)arg;
+  FAR struct net_driver_s *dev = &priv->dev;
+  struct eth_hdr_s *eth_hdr;
 
-  /* Loop while while esp_recvframe() successfully retrieves valid
+  /* Loop while while wlan_recvframe() successfully retrieves valid
    * Ethernet frames.
    */
 
-  while (esp_recvframe(priv) == OK)
+  net_lock();
+
+  while ((rxbuf = wlan_recvframe(priv)) != NULL)
     {
+
+      dev->d_buf = rxbuf->buffer;
+      dev->d_len = rxbuf->len;
+
+      rbytes += rxbuf->len;
+
 #ifdef CONFIG_NET_PKT
 
       /* When packet sockets are enabled,
        * feed the frame into the packet tap.
        */
 
-      pkt_input(&priv->esp_dev);
+      pkt_input(&priv->dev);
 #endif
 
       /* Check if the packet is a valid size for the network
        * buffer configuration (this should not happen)
        */
 
-      if (dev->d_len > CONFIG_NET_ETH_PKTSIZE)
+      if (dev->d_len > WLAN_BUF_SIZE)
         {
           wlwarn("WARNING: DROPPED Too big: %d\n", dev->d_len);
 
           /* Free dropped packet buffer */
 
           if (dev->d_buf)
             {
-              esp_freebuffer(priv, dev->d_buf);
+              wlan_free_buffer(priv, dev->d_buf);
               dev->d_buf = NULL;
               dev->d_len = 0;
             }
 
           continue;
         }
 
+      eth_hdr = (struct eth_hdr_s *)dev->d_buf;
+
       /* We only accept IP packets of the configured type and ARP packets */
 
 #ifdef CONFIG_NET_IPv4
-      if (BUF->type == HTONS(ETHTYPE_IP))
+      if (eth_hdr->type == HTONS(ETHTYPE_IP))
         {
           wlinfo("IPv4 frame\n");
 
           /* Handle ARP on input then give the IPv4 packet to the network
            * layer
            */
 
-          arp_ipin(&priv->esp_dev);
-          ipv4_input(&priv->esp_dev);
+          arp_ipin(&priv->dev);
+          ipv4_input(&priv->dev);
 
           /* If the above function invocation resulted in data
            * that should be sent out on the network,
            * the field  d_len will set to a value > 0.
            */
 
-          if (priv->esp_dev.d_len > 0)
+          if (priv->dev.d_len > 0)
             {
               /* Update the Ethernet header with the correct MAC address */
 
 #ifdef CONFIG_NET_IPv6
-              if (IFF_IS_IPv4(priv->esp_dev.d_flags))
+              if (IFF_IS_IPv4(priv->dev.d_flags))
 #endif
                 {
-                  arp_out(&priv->esp_dev);
+                  arp_out(&priv->dev);
                 }
 #ifdef CONFIG_NET_IPv6
               else
                 {
-                  neighbor_out(&priv->esp_dev);
+                  neighbor_out(&priv->dev);
                 }
 #endif
 
               /* And send the packet */
 
-              esp_transmit(priv);
+              if (wlan_combine_ipv4ack(priv))
+                {
+                  wlan_transmit(priv);
+                }
             }
         }
       else
 #endif
 #ifdef CONFIG_NET_IPv6
-      if (BUF->type == HTONS(ETHTYPE_IP6))
+      if (eth_hdr->type == HTONS(ETHTYPE_IP6))
         {
           wlinfo("Iv6 frame\n");

Review comment:
       ```suggestion
             wlinfo("IPv6 frame\n");
   ```




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] donghengqaz commented on a change in pull request #2294: xtensa/esp32: Refactor ESP32 Wi-Fi driver

Posted by GitBox <gi...@apache.org>.
donghengqaz commented on a change in pull request #2294:
URL: https://github.com/apache/incubator-nuttx/pull/2294#discussion_r530747149



##########
File path: arch/xtensa/src/esp32/esp32_wifi_adapter.c
##########
@@ -1854,6 +1937,58 @@ static void esp_evt_work_cb(FAR void *arg)
     }
 }
 
+/****************************************************************************
+ * Name: wifi_env_is_chip
+ *
+ * Description:
+ *   Config chip environment
+ *
+ * Returned Value:
+ *   True if on FPGA or false if not.
+ *
+ ****************************************************************************/
+
+static bool wifi_env_is_chip(void)
+{
+  return true;
+}
+
+/****************************************************************************
+ * Name: wifi_set_intr
+ *
+ * Description:
+ *   Do nothing
+ *
+ * Input Parameters:
+ *     cpu_no      - The CPU which the interrupt number belongs.
+ *     intr_source - The interrupt hardware source number.
+ *     intr_num    - The interrupt number CPU.
+ *     intr_prio   - The interrupt priority.
+ *
+ * Returned Value:
+ *     None
+ *
+ ****************************************************************************/
+
+static void wifi_set_intr(int32_t cpu_no, uint32_t intr_source,
+                             uint32_t intr_num, int32_t intr_prio)
+{
+  wlinfo("cpu_no=%d, intr_source=%u, intr_num=%u, intr_prio=%d");
+}
+
+/****************************************************************************
+ * Name: wifi_clear_intr
+ *
+ * Description:
+ *   Don't support
+ *
+ ****************************************************************************/
+
+static void IRAM_ATTR wifi_clear_intr(uint32_t intr_source,
+                                         uint32_t intr_num)
+{
+}
+

Review comment:
       These functions are members of WiFi adapter structure, so we should add these, although they do nothing. ESP32's some functions are empty in esp-idf, too.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] acassis commented on a change in pull request #2294: [WIP] xtensa/esp32: Refactor ESP32 Wi-Fi driver

Posted by GitBox <gi...@apache.org>.
acassis commented on a change in pull request #2294:
URL: https://github.com/apache/incubator-nuttx/pull/2294#discussion_r523040315



##########
File path: arch/xtensa/src/esp32/Make.defs
##########
@@ -193,8 +193,7 @@ chip/$(WIRELESS_DRV_UNPACK): $(WIRELESS_DRV_ZIP)
 context:: chip/$(WIRELESS_DRV_UNPACK)
 
 clean_context::
-	$(call DELFILE, chip/$(WIRELESS_DRV_ZIP))

Review comment:
       @donghengqaz why you are not removing the downloaded files?

##########
File path: arch/xtensa/src/esp32/esp32_wifi_adapter.c
##########
@@ -2210,6 +2300,19 @@ void esp_phy_disable_clock(void)
   leave_critical_section(flags);
 }
 
+/****************************************************************************
+ * Name: esp_phy_update_country_info
+ *
+ * Description:
+ *   Don't support
+ *
+ ****************************************************************************/
+
+static int32_t esp_phy_update_country_info(const char *country)
+{
+  return 0;

Review comment:
       Here too: return OK;

##########
File path: arch/xtensa/src/esp32/esp32_wifi_adapter.c
##########
@@ -2210,6 +2300,19 @@ void esp_phy_disable_clock(void)
   leave_critical_section(flags);
 }
 
+/****************************************************************************
+ * Name: esp_phy_update_country_info
+ *
+ * Description:
+ *   Don't support
+ *
+ ****************************************************************************/
+
+static int32_t esp_phy_update_country_info(const char *country)

Review comment:
       I think it could be "int" instead of "int32_t", like you changed for coex_init_wrapper()

##########
File path: arch/xtensa/src/esp32/esp32_wifi_adapter.c
##########
@@ -4385,3 +4487,42 @@ int esp_wifi_connect_internal(void)
 
   return 0;
 }
+
+/****************************************************************************
+ * Name: esp_wifi_sta_register_tx_done_cb
+ *
+ * Description:
+ *   Register the txDone callback function of type wifi_tx_done_cb_t
+ *
+ * Input Parameters:
+ *   callback - The callback function
+ *
+ * Returned Value:
+ *   0 if success or -1 if fail
+ *
+ ****************************************************************************/
+
+int esp_wifi_sta_register_tx_done_cb(void *callback)
+{
+  return esp_wifi_set_tx_done_cb((wifi_tx_done_cb_t)callback);
+}
+
+/****************************************************************************
+ * Name: esp_mesh_send_event_internal
+ *
+ * Description:
+ *   Don't support
+ *
+ ****************************************************************************/
+
+int esp_mesh_send_event_internal(int32_t event_id,
+                                 void *event_data,
+                                 size_t event_data_size)
+{
+  return 0;

Review comment:
       return OK;

##########
File path: arch/xtensa/src/esp32/esp32_wifi_adapter.c
##########
@@ -3413,261 +3534,240 @@ static void esp_wifi_delete_queue(void *queue)
 }
 
 /****************************************************************************
- * Name: esp_modem_enter_sleep
+ * Name: coex_init_wrapper
  *
  * Description:
- *   Let given module to enter sleep mode
- *
- * Input Parameters:
- *   module - hardware module ID
- *
- * Returned Value:
- *   0 if success or -1 if fail
+ *   Don't support
  *
  ****************************************************************************/
 
-static int32_t esp_modem_enter_sleep(uint32_t module)
+static int coex_init_wrapper(void)
 {
-  int ret = 0;
-  irqstate_t flags;
-  uint32_t bit;
-
-  if (module >= (uint32_t)MODEM_MODULE_COUNT)
-    {
-      return -1;
-    }
-
-  bit = 1 << module;
-
-  if (!(s_esp32_module_mask & bit))
-    {
-      return -1;
-    }
-
-  flags = enter_critical_section();
-
-  s_esp32_module_sleep |= bit;
-  if (!s_esp32_sleep && (s_esp32_module_sleep == s_esp32_module_mask))
-    {
-      ret = esp_phy_deinit_rf(PHY_MODEM_MODULE);
-      if (ret)
-        {
-          wlerr("ERROR: Failed to close RF\n");
-        }
-      else
-        {
-          s_esp32_sleep = true;
-        }
-    }
-
-  leave_critical_section(flags);
-
-  return ret;
+  return 0;
 }
 
 /****************************************************************************
- * Name: esp_modem_enter_sleep
+ * Name: coex_deinit_wrapper
  *
  * Description:
- *   Let given module to exit from sleep mode
- *
- * Input Parameters:
- *   module - hardware module ID
- *
- * Returned Value:
- *   0 if success or -1 if fail
+ *   Don't support
  *
  ****************************************************************************/
 
-static int32_t esp_modem_exit_sleep(uint32_t module)
+static void coex_deinit_wrapper(void)
 {
-  int ret = 0;
-  irqstate_t flags;
-  uint32_t bit;
-
-  if (module >= (uint32_t)MODEM_MODULE_COUNT)
-    {
-      return -1;
-    }
 
-  bit = 1 << module;
-
-  if (!(s_esp32_module_mask & bit))
-    {
-      return -1;
-    }
+}
 
-  flags = enter_critical_section();
+static int coex_enable_wrapper(void)
+{
+  return 0;
+}
 
-  s_esp32_module_sleep &= ~bit;
-  if (s_esp32_sleep)
-    {
-      ret = esp_phy_rf_init(NULL, PHY_RF_CAL_NONE,
-                            NULL, PHY_MODEM_MODULE);
-      if (ret)
-        {
-          wlerr("ERROR: Failed to open RF\n");
-        }
-      else
-        {
-          s_esp32_sleep = false;
-        }
-    }
+/****************************************************************************
+ * Name: coex_disable_wrapper
+ *
+ * Description:
+ *   Don't support
+ *
+ ****************************************************************************/
 
-  leave_critical_section(flags);
+static void coex_disable_wrapper(void)
+{
 
-  return ret;
 }
 
 /****************************************************************************
- * Name: esp_modem_register_sleep
+ * Name: esp_coex_status_get
  *
  * Description:
- *   Regitser given module so that it can enter sleep mode
- *
- * Input Parameters:
- *   module - hardware module ID
- *
- * Returned Value:
- *   0 if success or -1 if fail
+ *   Don't support
  *
  ****************************************************************************/
 
-static int32_t esp_modem_register_sleep(uint32_t module)
+static uint32_t esp_coex_status_get(void)
 {
-  irqstate_t flags;
-  uint32_t bit;
+  return 0;
+}
 
-  if (module >= (uint32_t)MODEM_MODULE_COUNT)
-    {
-      return -1;
-    }
+/****************************************************************************
+ * Name: esp_coex_condition_set
+ *
+ * Description:
+ *   Don't support
+ *
+ ****************************************************************************/
 
-  bit = 1 << module;
+static void esp_coex_condition_set(uint32_t type, bool dissatisfy)
+{
+}
 
-  flags = enter_critical_section();
+/****************************************************************************
+ * Name: esp_coex_wifi_request
+ *
+ * Description:
+ *   Don't support
+ *
+ ****************************************************************************/
 
-  if (s_esp32_module_mask & bit)
-    {
-      /* Has registered and return success */
+static int32_t esp_coex_wifi_request(uint32_t event, uint32_t latency,
+                                     uint32_t duration)
+{
+  return 0;
+}
 
-      return 0;
-    }
+/****************************************************************************
+ * Name: esp_coex_wifi_release
+ *
+ * Description:
+ *   Don't support
+ *
+ ****************************************************************************/
 
-  s_esp32_module_mask |= bit;
-  s_esp32_module_sleep |= bit;
+static int32_t esp_coex_wifi_release(uint32_t event)
+{
+  return 0;
+}
 
-  leave_critical_section(flags);
+/****************************************************************************
+ * Name: coex_wifi_channel_set_wrapper
+ *
+ * Description:
+ *   Don't support
+ *
+ ****************************************************************************/
 
+static int coex_wifi_channel_set_wrapper(uint8_t primary, uint8_t secondary)
+{
   return 0;
 }
 
 /****************************************************************************
- * Name: esp_modem_deregister_sleep
+ * Name: coex_event_duration_get_wrapper
  *
  * Description:
- *   Deregitser given module so that it can't enter sleep mode
+ *   Don't support
  *
- * Input Parameters:
- *   module - hardware module ID
+ ****************************************************************************/
+
+static IRAM_ATTR int coex_event_duration_get_wrapper(uint32_t event,
+                                                     uint32_t *duration)
+{
+  return 0;

Review comment:
       Return OK;




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org