menu "LWIP"
+config L2_TO_L3_COPY
+ bool "Enable copy between Layer2 and Layer3 packets"
+ default 0
+ help
+ If this feature is enabled, then all traffic from layer2(WIFI Driver)
+ to layer3(LWIP stack) will make a copy, the layer2 buffer will be
+ freed and the copy will be sent to layer3. Please make sure you fully
+ understand this feature before you enable this feature.
+
+
config LWIP_MAX_SOCKETS
int "Max number of open sockets"
range 1 16
* @param netif the lwip network interface structure for this ethernetif
*/
void
-#if ESP_LWIP
wlanif_input(struct netif *netif, void *buffer, u16_t len, void* eb)
-#else
-wlanif_input(struct netif *netif, void *buffer, uint16 len)
-#endif
{
struct pbuf *p;
-#if ESP_LWIP
- if(buffer== NULL)
- goto _exit;
- if(netif == NULL)
+ if(!buffer || !netif)
goto _exit;
-#endif
-#if ESP_LWIP
+#if (ESP_L2_TO_L3_COPY == 1)
+ //p = pbuf_alloc(PBUF_IP, len, PBUF_POOL);
+ p = pbuf_alloc(PBUF_RAW, len, PBUF_RAM);
+ if (p == NULL) {
+ #if ESP_PERF
+ g_rx_alloc_pbuf_fail_cnt++;
+ #endif
+ esp_wifi_internal_free_rx_buffer(eb);
+ return;
+ }
+ memcpy(p->payload, buffer, len);
+ esp_wifi_internal_free_rx_buffer(eb);
+#else
p = pbuf_alloc(PBUF_RAW, len, PBUF_REF);
if (p == NULL){
-#if ESP_PERF
- g_rx_alloc_pbuf_fail_cnt++;
-#endif
- return;
+ #if ESP_PERF
+ g_rx_alloc_pbuf_fail_cnt++;
+ #endif
+ return;
}
p->payload = buffer;
p->eb = eb;
-#else
- p = pbuf_alloc(PBUF_IP, len, PBUF_POOL);
- if (p == NULL) {
- return;
- }
- memcpy(p->payload, buffer, len);
#endif
-
/* full packet send to tcpip_thread to process */
if (netif->input(p, netif) != ERR_OK) {
LWIP_DEBUGF(NETIF_DEBUG, ("ethernetif_input: IP input error\n"));