Commit graph

147 commits

Author SHA1 Message Date
Deomid Ryabkov cbff82cc44 Allow gw to be null
Allow interfaces to be configured without a default gateway, for
local-only communication.

In case of the AP interface, if gw is not set, do not offer it.
2016-12-14 19:34:04 +00:00
Angus Gratton 94d2f77643 build system: Remove FLAGS_XXX variable option, replace with per-target overrides
Use for targeted disabling of warnings in LWIP.
2016-12-07 13:49:09 -08:00
shangke e0040af7e5 ethernet: add first version of ethernet driver 2016-12-01 19:17:48 +08:00
Xia Xiaotian ad555d68d3 esp32/lwip: add check sleep
1. fix tw8911 sleep in scan leads to auth frame malloc fail.

2. fix tw8913 pm state transfer wrong leads to wdt.

3. make some comments for modem sleep and wpa2 enterprise.

4. removd duplicated debug option ESP_THREAD_SAFE_DEBUG
2016-12-01 13:34:36 +08:00
liuhan f9d2d63e75 lwip: update open socket number.
modify default number from 4 to 10
2016-11-29 16:25:17 +08:00
Liu Zhi Fu fc2883a59a lwip: modify according code review
1. Modify tcp window size/send buffer back to 4/2
2. Disable lwip statistics by default
2016-11-28 19:54:22 +08:00
Liu Zhi Fu 9a3f9af2db esp32/lwip: some misc changes
1. Update phy to fix HT40 rx issue
2. Add code about RX_DONE/TX_DONE/Lock-free optimization
3. Fix wifi ioctl return value error
4. Add lwip statistics debug code
5. Modify TCP window size to 10 and send buffer size to 5
2016-11-28 18:36:14 +08:00
Wu Jian Gang 7f2c6a9d80 Merge branch 'bugfix/tw8770_fix_socket_memory_leak' into 'master'
lwip: fix socket memory leak issue

1. Add socket memory leak debug counter
2. Fix TCP PCB leak issue
    Currently ESP32 support maximum 16 TCP PCBs and all TCP PCB are allocated from heap memory. In some scenario, we may
    have memory leak issue,  for example, the application already created 16 TCP PCB, then it close 5 of them, because the TCP
    state machine, the LWIP core may not free all the 5 TCP PCB immediately, maybe some is in TIME_WAIT status, some is in 
    FIN_WAIT_1 etc. Then the application try to malloc 17th TCP PCB (the application think they just create 12 because they already
    close 5), memp_malloc() will return true because the heap is not out of memory, but actually we got 17 TCP PCB. When the 
    scenario repeat again and again (in our Audio application, it repeat more than 10000 times), more and more TCP PCB will be
    created in the system, each TCP PCB require 200B, then memory leak happen (In Audio application, I saw more than 26 TCP PCB
    are created, and 10*200=2K memory are leaked).

See merge request !223
2016-11-25 13:44:02 +08:00
Wu Jian Gang e05fe28574 Merge branch 'bugfix/arp_queue_failed' into 'master'
report the arp queue fail result



See merge request !227
2016-11-22 14:45:44 +08:00
Wu Jian Gang 46c81ded73 Merge branch 'feature/tw8799_low_level_output_optimize' into 'master'
Feature/tw8799 low level output optimize

Fix a potential memory crash error in low_level_output

See merge request !224
2016-11-22 11:56:35 +08:00
tianzhongxing cc39b7b286 components/lwip/arp: change the arp dropping packet function
LWIP will drop the oldest package at the arp packet cache queue and return "ERR_OK"
We change it that ARP level will drop the current packet and return "ERR_MEM" to tell user that you should send the packet again latter.
2016-11-22 10:11:52 +08:00
Liu Zhi Fu 586c17f831 lwip: remove useless printf info 2016-11-21 16:08:39 +08:00
Liu Zhi Fu 9cc9710a27 lwip: update according to review comments
1. Define memp_malloc/memp_free as static inline function
2. When TCP pcb is out of memory, try to kill PCB in FIN_WAIT_1 when necessary
2016-11-21 15:02:36 +08:00
tzx a8fb9f2b84 ipv6 interface: add branch for ipv6 interface 2016-11-21 11:06:51 +08:00
Liu Zhi Fu 8cd48d9f9c lwip: rework for low_level_output 2016-11-20 17:05:44 +08:00
Liu Zhi Fu fa57720cdf lwip: optimize low_level_output
When the parameter pbuf for low_level_output is a list, malloc a new pbuf of
which the length equals to the total length of pbuf and send the new pbuf to L2
2016-11-19 22:25:30 +08:00
Liu Zhi Fu b08113d2b4 lwip: fix CI build issue 2016-11-19 15:14:37 +08:00
Liu Zhi Fu ab92d43bc6 lwip: fix socket memory leak issue
1. Add socket memory leak debug counter
2. Fix TCP PCB leak issue
2016-11-19 14:57:42 +08:00
Liu Zhi Fu 5e428f21b6 lwip: default ESP_L2_TO_L3_COPY to 0 2016-11-17 10:53:00 +08:00
Liu Zhi Fu ceea97495f lwip:refractor to the description about this menuconfig option 2016-11-17 10:22:20 +08:00
Liu Zhi Fu 0b2cea6e9f lwip: modify menuconfig comments according to review 2016-11-16 21:11:17 +08:00
Liu Zhi Fu 69dbc36a1c lwip: add option to memcopy packet from L2 to L3
Menuconfig add an option to copy the packet from layer2 (WIFI driver) to layer3 (LWIP), default not copy
2016-11-16 16:24:41 +08:00
Angus Gratton 208e83def7 build system: Refactor component.mk to not need component_common.mk
New makefile component_wrapper.mk allows some variables to be set
before component.mk is evaluated. This properly fixes problems with
sdkconfig being hard to access in all phases of the build.

Including component_common.mk is no longer necessary and will print a
deprecation warning for components which use it.
2016-11-10 15:52:22 +11:00
Ivan Grokhotkov 3f8d9d71e2 lwip: fix duplicate definition of O_NONBLOCK
LwIP will define O_NONBLOCK in sockets.h if it isn't defined yet.
If sys/fcntl.h is included after socket.h, there will be duplicate definition.
Work around by including sys/fcntl.h into lwipopts.h.

https://github.com/espressif/esp-idf/issues/75
2016-11-08 20:17:08 +08:00
Ivan Grokhotkov eb2c633cbf newlib: implement settimeofday, integrate LwIP SNTP, add SNTP example 2016-11-03 12:46:46 +08:00
Liu Zhi Fu f0cd38a079 lwip: remove tx flow control code 2016-11-01 15:25:46 +08:00
Liu Zhi Fu 92b663d9f2 lwip: optimize tx flow control
1. Remove tx flow control for TCP
2. Remove tx flow control for UDP temporary
3. Return the error code when call esp_wifi_internal_tx()
2016-10-31 21:26:33 +08:00
Liu Zhi Fu 2b722ea468 turn on per socket tcp window by default 2016-10-31 19:43:18 +08:00
Liu Zhi Fu 19f61332a9 make build pass when disable per soc tcp window 2016-10-31 19:38:47 +08:00
Liu Zhi Fu a5552b1e21 lwip: fix tcp rx abnormal issue(tw8242)
In tcp_alloc(), initialize per_soc_tcp_wnd before initializing recv_wnd because recv_wnd depends on per_soc_tcp_wnd.
2016-10-31 17:50:09 +08:00
Liu Zhi Fu 9e7bc900c5 lwip: rework comments according to review 2016-10-28 13:35:06 +08:00
Liu Zhi Fu 38ff616e4a lwip: add prompt when configure max sockets number in menuconfig 2016-10-28 12:29:26 +08:00
Liu Zhi Fu 305b63209e lwip: support max 16 sockets
Since the customers need more sockets in their application, support max 16 sockets,
in other words, the total socket number of UDP/TCP/RAW sockets should not exceed 16.
2016-10-28 12:03:51 +08:00
Liu Zhi Fu 6e6e51426f lwip: refractor for lwip
1. All espressif specific code are prefix with ESP_
2. Define all ESP_ options in lwipopts.h
3. Remove useless code added in 8266
2016-10-27 14:11:01 +08:00
Jeroen Domburg 5642a8061e Merge branch 'feature/add_per_socket_tcp_window' into 'master'
components/lwip - add per socket tcp window

Add code to support per socket tcp window and tcp send buffer size configuration.

See merge request !145
2016-10-26 23:39:36 +08:00
liuzhifu a90217e201 components esp32/lwip: modify code according to review comments
1. Modify comments for esp_wifi_internal_tx
2. Fix delay time error in esp32_tx_flow_ctrl which is found in code review,
   modify _wait_delay init value from 0 to 1
2016-10-26 14:09:54 +08:00
liuzhifu 612aaa69e4 lwip/esp32: move the extern wifi calls into esp_wifi_internal.h
1. Add esp_wifi_internal.h
2. Rename system_pp_recycle_rx_pkt to esp_wifi_internal_free_rx_buffer
3. rename esp_wifi_tx_is_stop to esp_wifi_internal_tx_is_stop
4. rename ieee80211_output to esp_wifi_internal_tx
2016-10-26 13:23:35 +08:00
liuzhifu 60fb9a8c81 components/lwip - add per socket tcp window
Add code to support per socket tcp window and tcp send buffer size configuration.
2016-10-23 00:49:41 +08:00
liuzhifu d71894bf99 lwip/esp32: support iperf
1. Add _exit() definition in syscalls.c
2. Fix a bug in sockets.c on which iperf depends
2016-10-09 15:45:25 +08:00
Wu Jian Gang ed0a85ab4d Kconfig: use 4 spaces to instead 1 tab
In some Kconfig file, both 4 spaces and 1 tab are used mix, let's just
use 4 space, it will be clean in some editor.
2016-09-28 13:24:58 +08:00
Ivan Grokhotkov b190dc3e9f components/lwip,esp32: fixes for C++
- put contents of a few headers into c++ guard blocks
- fix off-by-one error in do_global_ctors
- remove system_init from startup code (should be called from main)
2016-09-26 03:05:25 +08:00
Ivan Grokhotkov cc8dd46da2 clean up warnings
For third party components (lwip and expat), compilation flags are adjusted to silence existing warnings (i have manually checked that all warnings are benign).
In components/esp32, replaced use of WIFI_DEBUG with ESP_LOG functions.
Only remaining warning is in FreeRTOS queue.c, and it may be a useful one.
2016-09-26 00:52:32 +08:00
Ivan Grokhotkov 9a1bf32274 Merge branch 'feature/lwip_add_debug_code' into 'master'
lwip: add debug code to show udp/tcp pcbs

Add code to show all tcp/udp pcbs, these kind of debug info is helpful for lwip issue debugging.

See merge request !98
2016-09-20 17:22:22 +08:00
Ivan Grokhotkov 3b22173a93 components/lwip: fix grammar 2016-09-20 16:53:56 +08:00
Ivan Grokhotkov 316d3f9c4a components/lwip: make SO_REUSE configurable via menuconfig
Not all environments need or can work with SO_REUSE enabled, so making this option configurable.
2016-09-20 15:36:55 +08:00
liuzhifu f64e1c54b7 lwip: add license and add lwip_debug.h 2016-09-20 15:36:49 +08:00
liuzhifu 50c7583f4d lwip: add debug code to show udp/tcp pcbs 2016-09-20 14:51:03 +08:00
Jeroen Domburg 4d4c6a3694 Enable SO_REUSEADDR in LWIP 2016-09-18 16:43:48 +08:00
Wu Jian Gang 2efaf42253 Merge remote-tracking branch 'origin/feature/mbedtls' 2016-09-14 18:05:56 +08:00
Xu Chun Guang 064d2b4ecb dhcpserver: Fix crash when switching wifi mode
See Teamwork 7058.
2016-09-14 16:14:50 +08:00
liuzhifu d2d231de29 define lwip task priority in esp_task.h 2016-09-14 12:00:46 +08:00
liuzhifu 4a98027242 components: lwip - Modify lwip task priority and stack definition method
lwip task priority and stack size defintion should not depends on esp_task.h, define it
in lwipopts.h directly
2016-09-14 12:00:46 +08:00
liuzhifu 9cf997a6fc components: esp32/lwip
Add esp_task.h for placing all task priority/stack size macro definition
2016-09-14 12:00:46 +08:00
liuzhifu 56a684d9eb task priority: modify lwip/wifi/event task priority
1. Modify lwip core task priority to configMAX_PRIORITIES-7
2. Modify wifi startup task priority to configMAX_PRIORITIES-7
3. Modify event task priority to configMAX_PRIORITIES-4
2016-09-14 11:59:25 +08:00
Wu Jian Gang 058a411786 Merge branch 'feature/add_wifi_api_comments' into 'master'
Feature/add wifi api comments

Add wifi API comments


See merge request !63
2016-09-14 11:17:29 +08:00
Wu Jian Gang ed8e8848e3 fix typos 2016-09-13 20:54:20 +08:00
Angus Gratton 9c51f8a7a3 Merge branch 'master' into feature/mbedtls 2016-09-12 17:30:11 +10:00
liuzhifu 32f01c61a2 add comments about current tx flow control 2016-09-09 17:58:21 +08:00
liuzhifu e38c4b0365 modify esp32_tx_flow_ctrl to static function and move extern api to header file 2016-09-09 17:58:21 +08:00
liuzhifu 19c8476344 modify macro ESP32_TX_FLOW_CTRL to inline function 2016-09-09 17:58:21 +08:00
liuzhifu a28ef1776e lwip: add socket tx flow control 2016-09-09 17:58:21 +08:00
Angus Gratton 1d355b93df lwip: Define LWIP_ESP8266 in port lwipopts.h not gcc command line 2016-09-09 13:53:38 +10:00
Angus Gratton 7c58c1e06b Build system: Allow components to add to the global CFLAGS via Makefile.projbuild
Used by mbedTLS to set MBEDTLS_CONFIG_FILE in all components.

This change sets CFLAGS/etc at the project level and then exports those
variables for components, rather than setting them independently each time
a component Makefile is invoked.
2016-09-09 11:08:19 +10:00
Angus Gratton 31e6b2cdb4 Merge branch 'master' into feature/mbedtls 2016-09-09 10:29:19 +10:00
Angus Gratton 09aa6ebc85 lwip Makefile: Add POSIX headers to include path to #include <sys/sockets.h>, etc, works. 2016-09-08 16:45:57 +08:00
Angus Gratton 3b1c3dab4b Name component makefiles component.mk instead of Makefile
Fixes problems with Eclipse trying to build in directories it shouldn't.

This is a breaking change for existing repositories, they need to rename
any component Makefiles to component.mk and rename their references to
$(IDF_PATH)/make/component.mk to $(IDF_PATH)/make/component_common.mk
2016-09-08 13:41:19 +10:00
Wu Jian Gang df53d1588a tcpip_adapter: typedef clean up 2016-09-06 19:36:03 +08:00
Wu Jian Gang 3cf377b06e dhcp: add dhcp callback
The callback has no parameter now.
TODO: add a parameter to show dhcp status if needed.
2016-09-06 19:32:33 +08:00
Wu Jian Gang ef23607a67 lwip: remove netif_reg_addr_change_cb 2016-09-06 19:32:33 +08:00
Angus Gratton fe53b96634 Merge feature/lwip_sntp into feature/lwip_sntp_master 2016-09-06 11:49:06 +10:00
Angus Gratton 587f90929c Minor comment cleanup 2016-09-05 11:50:53 +10:00
Angus Gratton cb6bd109f2 Merge wifi commit '87977b92f3e12cfca74cf2e4dea87dc8d60b26fc' into feature/wifi-stage-two 2016-09-05 10:42:17 +10:00
Wu Jian Gang 25e1a7bf1a sntp: fix author name 2016-09-02 16:26:06 +08:00
Angus Gratton 314dbc0b61 Minor comment cleanup
Remove old commented code, etc.
2016-09-02 11:33:53 +10:00
liuhan 37d817b6f9 components/lwip: modify sntp function
delete sntp_time.c file, move sntp head file.
2016-09-01 19:56:51 +08:00
liuhan 1e3f9fbda3 components/lwip/apps/sntp: modify SNTP function feature
modify makefile for compile SNTP function in lwip, see sntp file.
2016-09-01 19:22:36 +08:00
liuhan 380f5635b6 components/lwip: add SNTP function feature
Develop and Compile SNTP function based on LWIP core code, see lwip/apps/sntp file.
2016-09-01 19:22:36 +08:00
Wu Jian Gang 87977b92f3 lwip: format dhcpserver.c 2016-09-01 19:05:50 +08:00
liuhan f5df40e2d1 lwip: fix a mistake in parse_msg of dhcpserver.c
TW6872
2016-09-01 18:13:58 +08:00
liuzhifu 1e9fc9f8f1 components: lwip - modify HEAP_HIGHWAT from 6K to 20K
Since esp32 has much more memory than esp31B, modify the HEAP_HIGHWAT from
6K to 20K.
Notes: HEAP_HIGHWAT is used for tcp/udp tx flow control, if socket task detects
that the free heap memory is less than HEAP_HIGHWAT, it stops to trasmitting until
the free heap memory is greater than HEAP_HIGHWAT
2016-09-01 15:17:50 +08:00
liuzhifu 77caf256c6 components: lwip - enable PERF macro for debug reason 2016-08-30 18:06:37 +08:00
liuzhifu c144feb2dd remove unnecessary print in sys_arch.c 2016-08-30 09:48:08 +08:00
Wu Jian Gang 23cc3c0f90 components/lwip: use newlib errno 2016-08-29 15:35:44 +08:00
liuzhifu bae976ae0e components:lwip
disable debug info of lwip
2016-08-29 14:32:38 +08:00
liuhan 62c891735b recompile DHCP server function
modify DHCP data parameter type in calling DHCP interface.
2016-08-26 19:06:38 +08:00
liuhan aec816520c TW6738: fix DHCP -L issue
recompile DHCP server function, only support start, stop and option interface.
2016-08-26 19:06:38 +08:00
liuzhifu 65cccfe89f components: lwip
Implement lwip per-thread-sem with:
vTaskSetThreadLocalStoragePointerAndDelCallback/pvTaskGetThreadLocalStoragePointer
register sys_thread_tls_free to free per-thread-sem when the thread is terminated.
Also let lwip use index CONFIG_LWIP_THREAD_LOCAL_STORAGE_INDEX
2016-08-26 19:06:38 +08:00
liuzhifu dcc998c92f components: lwip/tcpip_adapter/freertos/esp32
Replace os_printf with printf
2016-08-26 19:03:51 +08:00
liuzhifu cb3d46786d enable sys_arch_protect/sys_arch_unprotect with portENTER_CRITICAL/portEXIT_CRITICAL 2016-08-26 19:03:51 +08:00
liuzhifu 52953851f4 component: lwip
1. add lock version print for lwip (workaround)
2. add debug info into sys_arch.c to debug xQueueReceive issue
2016-08-26 19:03:51 +08:00
xiaxiaotian ef0cd1cde3 1. Remove ip member of struct station_info
2. Add struct station_list into tcpip_adapter layer
3. When ap -L cmd is received, get mac address from mac layer first and then search ip address based on mac address on dhcp layer.
2016-08-26 19:03:50 +08:00
liuzhifu 91135da190 impact components: lwip/freertos
1. Remove xTaskGetPerTaskData
2. Implement lwip per thread semaphore with vTaskSetThreadLocalStoragePointer
   and pvTaskGetThreadLocalStoragePointer
3. Add sys_thread_sem_get/sys_thread_sem_init/sys_thread_sem_deinit
2016-08-26 19:03:50 +08:00
liuzhifu 6f122928f0 fix socket compile error 2016-08-26 19:03:50 +08:00
Jeroen Domburg 29c2e58c75 'Merge branch 'thread_local_storage_delete_callbacks' into 'master'
The thread-local-storage feature in FreeRTOS attaches an application-usable array of pointers to a thread control block. These pointers usually point to a structure the thread allocates. When a thread gets (voluntarily or involuntarily) destroyed, this memory can leak. This merge adds a matching second array of user-settable pointers to destructor routines. As soon as the task gets cleaned up (which happens in the idle thread), the destructors get called and the memory can be freed.

See merge request !19
2016-08-24 13:30:30 +08:00
Angus Gratton f853f94335 Use IDF_PATH instead of SDK_PATH for the environment variable pointing to esp-idf
This will require a matching change in all projects using ESP-IDF.
2016-08-19 15:01:49 +08:00
Angus Gratton 9ec0e1545d Standardise remaining uses of SDK to ESP-IDF 2016-08-19 15:01:15 +08:00
Ivan Grokhotkov bd6ea4393c Initial public version 2016-08-17 23:08:22 +08:00