Skip to content

Commit 7e87254

Browse files
committed
Merge branch 'fix/esp_netif_docs' into 'master'
fix(esp_netif): Fix ESP-NETIF user documentation Closes IDF-9946, DOC-1229, and DOC-6162 See merge request espressif/esp-idf!31777
2 parents 8935ff4 + 25d0d9c commit 7e87254

File tree

9 files changed

+712
-657
lines changed

9 files changed

+712
-657
lines changed

components/esp_netif/include/esp_netif.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -595,12 +595,16 @@ esp_err_t esp_netif_napt_disable(esp_netif_t *esp_netif);
595595
* @brief Set or Get DHCP server option
596596
*
597597
* @note Please note that not all combinations of identifiers and options are supported.
598+
*
598599
* Get operations:
600+
*
599601
* * IP_ADDRESS_LEASE_TIME
600602
* * ESP_NETIF_SUBNET_MASK/REQUESTED_IP_ADDRESS (both options do the same, they reflect dhcps_lease_t)
601603
* * ROUTER_SOLICITATION_ADDRESS
602604
* * DOMAIN_NAME_SERVER
605+
*
603606
* Set operations:
607+
*
604608
* * IP_ADDRESS_LEASE_TIME
605609
* * ESP_NETIF_SUBNET_MASK -- set operation is allowed only if the configured mask corresponds to the settings,
606610
* if not, please use esp_netif_set_ip_info() to prevent misconfiguration of DHCPS.
@@ -631,10 +635,14 @@ esp_netif_dhcps_option(esp_netif_t *esp_netif, esp_netif_dhcp_option_mode_t opt_
631635
* @brief Set or Get DHCP client option
632636
*
633637
* @note Please note that not all combinations of identifiers and options are supported.
638+
*
634639
* Get operations:
640+
*
635641
* * ESP_NETIF_IP_REQUEST_RETRY_TIME
636642
* * ESP_NETIF_VENDOR_SPECIFIC_INFO -- only available if ESP_DHCP_DISABLE_VENDOR_CLASS_IDENTIFIER=n
643+
*
637644
* Set operations:
645+
*
638646
* * ESP_NETIF_IP_REQUEST_RETRY_TIME
639647
* * ESP_NETIF_VENDOR_SPECIFIC_INFO -- only available if ESP_DHCP_DISABLE_VENDOR_CLASS_IDENTIFIER=n
640648
* lwip layer creates its own copy of the supplied identifier.

docs/en/api-reference/network/esp_netif.rst

Lines changed: 177 additions & 321 deletions
Large diffs are not rendered by default.

docs/en/api-reference/network/esp_netif_driver.rst

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,16 @@
1-
ESP-NETIF Custom I/O Driver
2-
===========================
1+
ESP-NETIF Developer's manual
2+
============================
33

44
:link_to_translation:`zh_CN:[中文]`
55

6+
As shown in the :ref:`esp-netif structure` diagram, ESP-NETIF is in fact an intermediary between the I/O driver and the TCP/IP stack. This manual describes customization of these two sides, that is if you need to implement :ref:`esp_netif_custom_driver` or if you need to employ :ref:`esp_netif_tcpip_stack`.
7+
8+
9+
.. _esp_netif_custom_driver:
10+
11+
ESP-NETIF Custom I/O Driver
12+
---------------------------
13+
614
This section outlines implementing a new I/O driver with ESP-NETIF connection capabilities.
715

816
By convention, the I/O driver has to register itself as an ESP-NETIF driver, and thus holds a dependency on ESP-NETIF component and is responsible for providing data path functions, post-attach callback and in most cases, also default event handlers to define network interface actions based on driver's lifecycle transitions.
@@ -88,7 +96,24 @@ Network Stack Connection
8896

8997
The packet data path functions for transmitting and freeing the rx buffer (defined in the I/O driver) are called from the ESP-NETIF, specifically from its TCP/IP stack connecting layer.
9098

91-
Note that ESP-IDF provides several network stack configurations for the most common network interfaces, such as for the Wi-Fi station or Ethernet. These configurations are defined in :component_file:`esp_netif/include/esp_netif_defaults.h` and should be sufficient for most network drivers. In rare cases, expert users might want to define custom lwIP based interface layers; it is possible, but an explicit dependency to lwIP needs to be set.
99+
Note that ESP-IDF provides several network stack configurations for the most common network interfaces, such as for the Wi-Fi station or Ethernet. These configurations are defined in :component_file:`esp_netif/include/esp_netif_defaults.h` and should be sufficient for most network drivers.
100+
101+
In some cases, you might want to define a custom lwIP based interface, for example if you need to update :component_file:`esp_netif/lwip/netif/wlanif.c` with a specific packet pool. In that case, you would have to define an explicit dependency to lwIP and include :component_file:`esp_netif/include/lwip/esp_netif_net_stack.h` for the relevant lwIP configuration structures.
102+
103+
104+
.. _esp_netif_tcpip_stack:
105+
106+
ESP-NETIF Custom TCP/IP Stack
107+
-----------------------------
108+
109+
It is possible to use a custom TCP/IP stack with ESP-IDF, provided it implements BSD API. You can add support for your own TCP/IP stack, while using the generic ESP-NETIF functionality, so the application code can stay the same as with the lwIP.
110+
111+
In this case, please choose ``ESP_NETIF_PROVIDE_CUSTOM_IMPLEMENTATION`` in the ESP-NETIF component configuration menu. This option will disable lwIP implementation of the ESP-NETIF functions and provide only header files with declarations of types and API. You will have to supply the necessary implementation in your custom component. You can refer to the :component_file:`esp_netif/loopback/esp_netif_loopback.c` for example of dummy implementations of these functions.
112+
113+
It is also possible to build ESP-IDF without lwIP, please refer to :idf_file:`components/esp_netif_stack/README.md`.
114+
115+
API Reference
116+
-------------
92117

93118
The following API reference outlines these network stack interaction with the ESP-NETIF:
94119

0 commit comments

Comments
 (0)