mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
lwip/freertos/esp32: add throughput optimization related code
1. Update wifi lib which contains ampdu and other optimizations 2. Add throughput code debug code 3. Other misc modification about throughput optimization
This commit is contained in:
parent
370cf5493f
commit
0fb2ab9f5c
@ -121,7 +121,7 @@ typedef enum {
|
||||
#define WIFI_PROTOCOL_11N 4
|
||||
|
||||
typedef enum {
|
||||
WIFI_BW_HT20 = 0, /* Bandwidth is HT20 */
|
||||
WIFI_BW_HT20 = 1, /* Bandwidth is HT20 */
|
||||
WIFI_BW_HT40, /* Bandwidth is HT40 */
|
||||
} wifi_bandwidth_t;
|
||||
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 02232f974b0ff1568ddd6d7015a41fb4f4870994
|
||||
Subproject commit 074303d74fc9c68823adee0a38fc1e8de42943b6
|
@ -187,6 +187,7 @@ config FREERTOS_PORTMUX_DEBUG
|
||||
If enabled, debug information (including integrity checks) will be printed
|
||||
to UART for the port-specific MUX implementation.
|
||||
|
||||
if !FREERTOS_UNICORE
|
||||
config FREERTOS_PORTMUX_DEBUG_RECURSIVE
|
||||
bool "Debug portMUX Recursion"
|
||||
depends on FREERTOS_PORTMUX_DEBUG
|
||||
@ -194,6 +195,7 @@ config FREERTOS_PORTMUX_DEBUG_RECURSIVE
|
||||
help
|
||||
If enabled, additional debug information will be printed for recursive
|
||||
portMUX usage.
|
||||
endif #FREERTOS_UNICORE
|
||||
|
||||
endif # FREERTOS_DEBUG_INTERNALS
|
||||
|
||||
|
@ -282,6 +282,7 @@ void vPortCPUAcquireMutex(portMUX_TYPE *mux, const char *fnName, int line) {
|
||||
#else
|
||||
void vPortCPUAcquireMutex(portMUX_TYPE *mux) {
|
||||
#endif
|
||||
#if !CONFIG_FREERTOS_UNICORE
|
||||
uint32_t res;
|
||||
uint32_t recCnt;
|
||||
unsigned int irqStatus;
|
||||
@ -324,6 +325,7 @@ void vPortCPUAcquireMutex(portMUX_TYPE *mux) {
|
||||
}
|
||||
#endif
|
||||
portEXIT_CRITICAL_NESTED(irqStatus);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
@ -335,6 +337,7 @@ portBASE_TYPE vPortCPUReleaseMutex(portMUX_TYPE *mux, const char *fnName, int li
|
||||
#else
|
||||
portBASE_TYPE vPortCPUReleaseMutex(portMUX_TYPE *mux) {
|
||||
#endif
|
||||
#if !CONFIG_FREERTOS_UNICORE
|
||||
uint32_t res=0;
|
||||
uint32_t recCnt;
|
||||
unsigned int irqStatus;
|
||||
@ -379,6 +382,9 @@ portBASE_TYPE vPortCPUReleaseMutex(portMUX_TYPE *mux) {
|
||||
}
|
||||
portEXIT_CRITICAL_NESTED(irqStatus);
|
||||
return ret;
|
||||
#else //!CONFIG_FREERTOS_UNICORE
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
#if CONFIG_FREERTOS_BREAK_ON_SCHEDULER_START_JTAG
|
||||
|
@ -508,6 +508,10 @@ netconn_recv_data(struct netconn *conn, void **new_buf)
|
||||
}
|
||||
#endif /* (LWIP_UDP || LWIP_RAW) */
|
||||
|
||||
#ifdef ESP_PERF
|
||||
if (len > DBG_PERF_FILTER_LEN) { DBG_PERF_PATH_SET(DBG_PERF_DIR_RX, DBG_PERF_POINT_SOC_IN); }
|
||||
#endif
|
||||
|
||||
#if LWIP_SO_RCVBUF
|
||||
SYS_ARCH_DEC(conn->recv_avail, len);
|
||||
#endif /* LWIP_SO_RCVBUF */
|
||||
|
@ -202,6 +202,10 @@ recv_udp(void *arg, struct udp_pcb *pcb, struct pbuf *p,
|
||||
#endif /* LWIP_NETBUF_RECVINFO */
|
||||
}
|
||||
|
||||
#ifdef ESP_PERF
|
||||
if (p->len > DBG_PERF_FILTER_LEN) DBG_PERF_PATH_SET(DBG_PERF_DIR_RX, DBG_PERF_POINT_LWIP_OUT);
|
||||
#endif
|
||||
|
||||
len = p->tot_len;
|
||||
if (sys_mbox_trypost(&conn->recvmbox, buf) != ERR_OK) {
|
||||
ESP_STATS_INC(esp.rx_udpmbox_post_fail);
|
||||
|
@ -1438,6 +1438,7 @@ lwip_sendto(int s, const void *data, size_t size, int flags,
|
||||
err = netbuf_ref(&buf, data, short_size);
|
||||
#endif /* LWIP_NETIF_TX_SINGLE_PBUF */
|
||||
if (err == ERR_OK) {
|
||||
DBG_PERF_PATH_SET(DBG_PERF_DIR_TX, DBG_PERF_POINT_SOC_OUT);
|
||||
/* send the data */
|
||||
err = netconn_send(sock->conn, &buf);
|
||||
}
|
||||
|
@ -219,6 +219,12 @@ tcpip_inpkt(struct pbuf *p, struct netif *inp, netif_input_fn input_fn)
|
||||
msg->msg.inp.p = p;
|
||||
msg->msg.inp.netif = inp;
|
||||
msg->msg.inp.input_fn = input_fn;
|
||||
#ifdef ESP_PERF
|
||||
if (p->len > DBG_PERF_FILTER_LEN) {
|
||||
DBG_PERF_PATH_SET(DBG_PERF_DIR_RX, DBG_PERF_POINT_WIFI_OUT);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (sys_mbox_trypost(&mbox, msg) != ERR_OK) {
|
||||
ESP_STATS_INC(esp.tcpip_inpkt_post_fail);
|
||||
memp_free(MEMP_TCPIP_MSG_INPKT, msg);
|
||||
@ -492,20 +498,11 @@ tcpip_init(tcpip_init_done_fn initfunc, void *arg)
|
||||
#endif /* LWIP_TCPIP_CORE_LOCKING */
|
||||
|
||||
|
||||
#if ESP_LWIP
|
||||
#if ESP_DUAL_CORE
|
||||
sys_thread_t xLwipTaskHandle = 0;
|
||||
xTaskCreatePinnedToCore(tcpip_thread, TCPIP_THREAD_NAME, TCPIP_THREAD_STACKSIZE, NULL, TCPIP_THREAD_PRIO, NULL, 1);
|
||||
#else
|
||||
sys_thread_t xLwipTaskHandle = sys_thread_new(TCPIP_THREAD_NAME
|
||||
, tcpip_thread, NULL, TCPIP_THREAD_STACKSIZE, TCPIP_THREAD_PRIO);
|
||||
#endif
|
||||
|
||||
printf("tcpip_task_hdlxxx : %x, prio:%d,stack:%d\n",
|
||||
(u32_t)xLwipTaskHandle,TCPIP_THREAD_PRIO,TCPIP_THREAD_STACKSIZE);
|
||||
#else
|
||||
sys_thread_new(TCPIP_THREAD_NAME, tcpip_thread, NULL, TCPIP_THREAD_STACKSIZE, TCPIP_THREAD_PRIO);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
|
@ -1665,7 +1665,7 @@
|
||||
* LWIP_STATS==1: Enable statistics collection in lwip_stats.
|
||||
*/
|
||||
#ifndef LWIP_STATS
|
||||
#define LWIP_STATS 1
|
||||
#define LWIP_STATS 0
|
||||
#endif
|
||||
|
||||
#if LWIP_STATS
|
||||
|
@ -572,21 +572,37 @@
|
||||
#define ESP_LIGHT_SLEEP 1
|
||||
#define ESP_L2_TO_L3_COPY CONFIG_L2_TO_L3_COPY
|
||||
#define ESP_CNT_DEBUG 0
|
||||
#define ESP_DUAL_CORE 0
|
||||
|
||||
#define TCP_WND_DEFAULT (4*TCP_MSS)
|
||||
#define TCP_SND_BUF_DEFAULT (2*TCP_MSS)
|
||||
#define TCP_WND_DEFAULT (4*TCP_MSS)
|
||||
#define TCP_SND_BUF_DEFAULT (2*TCP_MSS)
|
||||
|
||||
#if ESP_PERF
|
||||
#define DBG_PERF_PATH_SET(dir, point)
|
||||
#define DBG_PERF_FILTER_LEN 1000
|
||||
|
||||
enum {
|
||||
DBG_PERF_DIR_RX = 0,
|
||||
DBG_PERF_DIR_TX,
|
||||
};
|
||||
|
||||
enum {
|
||||
DBG_PERF_POINT_INT = 0,
|
||||
DBG_PERF_POINT_WIFI_IN = 1,
|
||||
DBG_PERF_POINT_WIFI_OUT = 2,
|
||||
DBG_PERF_POINT_LWIP_IN = 3,
|
||||
DBG_PERF_POINT_LWIP_OUT = 4,
|
||||
DBG_PERF_POINT_SOC_IN = 5,
|
||||
DBG_PERF_POINT_SOC_OUT = 6,
|
||||
};
|
||||
|
||||
#else
|
||||
#define DBG_PERF_PATH_SET(dir, point)
|
||||
#define DBG_PERF_FILTER_LEN 1000
|
||||
#endif
|
||||
|
||||
#if ESP_PER_SOC_TCP_WND
|
||||
#define TCP_WND(pcb) (pcb->per_soc_tcp_wnd)
|
||||
#define TCP_SND_BUF(pcb) (pcb->per_soc_tcp_snd_buf)
|
||||
#else
|
||||
#if ESP_PERF
|
||||
extern unsigned char misc_prof_get_tcpw(void);
|
||||
extern unsigned char misc_prof_get_tcp_snd_buf(void);
|
||||
#define TCP_WND(pcb) (misc_prof_get_tcpw()*TCP_MSS)
|
||||
#define TCP_SND_BUF(pcb) (misc_prof_get_tcp_snd_buf()*TCP_MSS)
|
||||
#endif
|
||||
#define TCP_WND(pcb) (pcb->per_soc_tcp_wnd)
|
||||
#define TCP_SND_BUF(pcb) (pcb->per_soc_tcp_snd_buf)
|
||||
#endif
|
||||
|
||||
/**
|
||||
@ -595,6 +611,7 @@ extern unsigned char misc_prof_get_tcp_snd_buf(void);
|
||||
#define DHCP_DEBUG LWIP_DBG_OFF
|
||||
#define LWIP_DEBUG LWIP_DBG_OFF
|
||||
#define TCP_DEBUG LWIP_DBG_OFF
|
||||
#define ESP_STATS 0
|
||||
|
||||
#define CHECKSUM_CHECK_UDP 0
|
||||
#define CHECKSUM_CHECK_IP 0
|
||||
|
@ -72,6 +72,10 @@ ethernet_input(struct pbuf *p, struct netif *netif)
|
||||
s16_t ip_hdr_offset = SIZEOF_ETH_HDR;
|
||||
#endif /* LWIP_ARP || ETHARP_SUPPORT_VLAN */
|
||||
|
||||
#ifdef ESP_PERF
|
||||
if (p->len > DBG_PERF_FILTER_LEN) DBG_PERF_PATH_SET(DBG_PERF_DIR_RX, DBG_PERF_POINT_LWIP_IN);
|
||||
#endif
|
||||
|
||||
if (p->len <= SIZEOF_ETH_HDR) {
|
||||
/* a packet with only an ethernet header (or less) is not valid for us */
|
||||
ETHARP_STATS_INC(etharp.proterr);
|
||||
|
@ -56,9 +56,6 @@
|
||||
#define IFNAME1 'n'
|
||||
|
||||
static char hostname[16];
|
||||
#if ESP_PERF
|
||||
uint32_t g_rx_alloc_pbuf_fail_cnt = 0;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* In this function, the hardware should be initialized.
|
||||
@ -163,7 +160,6 @@ ethernetif_input(struct netif *netif, void *buffer, uint16_t len)
|
||||
#if CONFIG_EMAC_L2_TO_L3_RX_BUF_MODE
|
||||
p = pbuf_alloc(PBUF_RAW, len, PBUF_RAM);
|
||||
if (p == NULL) {
|
||||
//g_rx_alloc_pbuf_fail_cnt++;
|
||||
return;
|
||||
}
|
||||
memcpy(p->payload, buffer, len);
|
||||
|
@ -57,9 +57,6 @@
|
||||
#define IFNAME1 'n'
|
||||
|
||||
static char hostname[16];
|
||||
#if ESP_PERF
|
||||
uint32_t g_rx_alloc_pbuf_fail_cnt = 0;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* In this function, the hardware should be initialized.
|
||||
|
Loading…
x
Reference in New Issue
Block a user