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:
[email protected]