mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
lwip: Move wifi's custom pbuf alloc/free to IRAM if config
This commit is contained in:
parent
0e71a325de
commit
8b40579aa4
@ -61,6 +61,8 @@ entries:
|
||||
pbuf:pbuf_header_impl (noflash_text)
|
||||
pbuf:pbuf_header (noflash_text)
|
||||
pbuf:pbuf_free (noflash_text)
|
||||
pbuf:pbuf_alloced_custom (noflash_text)
|
||||
pbuf:pbuf_init_alloced_pbuf (noflash_text)
|
||||
udp:udp_input_local_match (noflash_text)
|
||||
udp:udp_input (noflash_text)
|
||||
udp:udp_send (noflash_text)
|
||||
@ -82,6 +84,7 @@ entries:
|
||||
wlanif:ap_output (noflash_text)
|
||||
wlanif:wifi_rxcb_sta (noflash_text)
|
||||
wlanif:wifi_rxcb_ap (noflash_text)
|
||||
wlanif:wifi_pbuf_free (noflash_text)
|
||||
lwip_default_hooks:ip4_route_src_hook (noflash_text)
|
||||
|
||||
if ESP_ALLOW_BSS_SEG_EXTERNAL_MEMORY = y:
|
||||
|
@ -14,7 +14,7 @@
|
||||
#include "lwip/opt.h"
|
||||
|
||||
#include "lwip/def.h"
|
||||
#include "lwip/memp.h"
|
||||
#include "lwip/mem.h"
|
||||
#include "lwip/pbuf.h"
|
||||
#include "lwip/stats.h"
|
||||
#include "lwip/snmp.h"
|
||||
@ -38,9 +38,6 @@ typedef struct wifi_custom_pbuf
|
||||
void* l2_buf;
|
||||
} wifi_custom_pbuf_t;
|
||||
|
||||
#define ESP_PBUF_POOL_SIZE 16
|
||||
LWIP_MEMPOOL_DECLARE(ESP_PBUF_POOL, ESP_PBUF_POOL_SIZE, sizeof(wifi_custom_pbuf_t), "WIFI_CUSTOM_PBUF");
|
||||
|
||||
static struct netif *s_wifi_netifs[2] = { NULL };
|
||||
|
||||
|
||||
@ -88,27 +85,27 @@ void set_wifi_netif(int wifi_inx, void* netif)
|
||||
}
|
||||
|
||||
|
||||
static void esp_pbuf_free_l2_buff(struct pbuf *p)
|
||||
static void wifi_pbuf_free(struct pbuf *p)
|
||||
{
|
||||
wifi_custom_pbuf_t* wifi_pbuf = (wifi_custom_pbuf_t*)p;
|
||||
esp_wifi_internal_free_rx_buffer(wifi_pbuf->l2_buf);
|
||||
LWIP_MEMPOOL_FREE(ESP_PBUF_POOL, wifi_pbuf);
|
||||
mem_free(wifi_pbuf);
|
||||
}
|
||||
|
||||
static inline struct pbuf* pbuf_allocate(struct netif *netif, void *buffer, size_t len, void *l2_buff)
|
||||
static inline struct pbuf* wifi_pbuf_allocate(struct netif *netif, void *buffer, size_t len, void *l2_buff)
|
||||
{
|
||||
struct pbuf *p;
|
||||
|
||||
wifi_custom_pbuf_t* esp_pbuf = (wifi_custom_pbuf_t*)LWIP_MEMPOOL_ALLOC(ESP_PBUF_POOL);
|
||||
wifi_custom_pbuf_t* esp_pbuf = mem_malloc(sizeof(wifi_custom_pbuf_t));
|
||||
|
||||
if (esp_pbuf == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
esp_pbuf->p.custom_free_function = esp_pbuf_free_l2_buff;
|
||||
esp_pbuf->p.custom_free_function = wifi_pbuf_free;
|
||||
esp_pbuf->l2_buf = l2_buff;
|
||||
p = pbuf_alloced_custom(PBUF_RAW, len, PBUF_REF, &esp_pbuf->p, buffer, len);
|
||||
if (p == NULL) {
|
||||
LWIP_MEMPOOL_FREE(ESP_PBUF_POOL, esp_pbuf);
|
||||
mem_free(esp_pbuf);
|
||||
return NULL;
|
||||
}
|
||||
return p;
|
||||
@ -126,7 +123,7 @@ esp_err_t wifi_rxcb_sta(void *buffer, uint16_t len, void *l2_buff)
|
||||
return ESP_FAIL;
|
||||
}
|
||||
|
||||
p = pbuf_allocate(netif, buffer, len, l2_buff);
|
||||
p = wifi_pbuf_allocate(netif, buffer, len, l2_buff);
|
||||
if (p == NULL) {
|
||||
esp_wifi_internal_free_rx_buffer(l2_buff);
|
||||
return ESP_FAIL;
|
||||
@ -152,7 +149,7 @@ esp_err_t wifi_rxcb_ap(void *buffer, uint16_t len, void *l2_buff)
|
||||
return ESP_FAIL;
|
||||
}
|
||||
|
||||
p = pbuf_allocate(netif, buffer, len, l2_buff);
|
||||
p = wifi_pbuf_allocate(netif, buffer, len, l2_buff);
|
||||
if (p == NULL) {
|
||||
esp_wifi_internal_free_rx_buffer(l2_buff);
|
||||
return ESP_FAIL;
|
||||
|
Loading…
Reference in New Issue
Block a user