Message ID | a88252b5c961ee28a98653751bae627ab3349668.1721910373.git.jerome.forissier@linaro.org |
---|---|
State | New |
Headers | show |
Series | Introduce the lwIP network stack | expand |
чт, 25 июл. 2024 г. в 15:58, Jerome Forissier <jerome.forissier@linaro.org>: > > Prepare the introduction of the lwIP (lightweight IP) TCP/IP stack by > adding a new net/lwip/ directory and the NET_LWIP symbol. Network > support is either NO_NET, NET (legacy stack) or NET_LWIP. Subsequent > commits will introduce the lwIP code, re-work the NETDEVICE integration > and port some of the NET commands and features to lwIP. > > SPL_NET cannot be enabled when NET_LWIP=y. SPL_NET pulls some symbols > that are part of NET (such as arp_init(), arp_timeout_check(), > arp_receive(), net_arp_wait_packet_ip()). lwIP support in SPL may be > added later. > > Similarly, DFU_TFTP and FASTBOOT are not compatible with NET_LWIP > because of dependencies on net_loop(), tftp_timeout_ms, > tftp_timeout_count_max and other NET things. Let's add a dependency on > !NET_LWIP for now. > > As for SANDBOX, NET_LWIP cannot be used either because of strong > assumptions on the network stack. Make NET_LWIP depend on !SANDBOX so > that the NET_LWIP alternative is not visible in make menuconfig when > sandbox_defconfig is used. > > Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> > --- > Kconfig | 26 ++++++++++++++++++++++++++ > common/Kconfig | 2 +- > common/spl/Kconfig | 1 + > drivers/dfu/Kconfig | 1 + > drivers/fastboot/Kconfig | 1 + > drivers/net/Kconfig | 1 + > drivers/net/phy/Kconfig | 2 +- > drivers/usb/gadget/Kconfig | 2 +- > net/Kconfig | 29 +++++++++++++++-------------- > net/Makefile | 4 ++++ > net/lwip/Kconfig | 36 ++++++++++++++++++++++++++++++++++++ > 11 files changed, 88 insertions(+), 17 deletions(-) > create mode 100644 net/lwip/Kconfig > > diff --git a/Kconfig b/Kconfig > index 82df59f176e..61bc6529617 100644 > --- a/Kconfig > +++ b/Kconfig > @@ -745,6 +745,32 @@ source "dts/Kconfig" > > source "env/Kconfig" > > +choice > + prompt "Networking stack" > + default NET > + > +config NO_NET > + bool "No networking support" > + > +config NET > + bool "Legacy U-Boot networking stack" > + imply NETDEVICES > + > +config NET_LWIP > + bool "Use lwIP for networking stack" > + imply NETDEVICES > + depends on !SANDBOX > + help > + Include networking support based on the lwIP (lightweight IP) > + TCP/IP stack (https://nongnu.org/lwip). This is a replacement for > + the default U-Boot network stack and applications located in net/ > + and enabled via CONFIG_NET as well as other pieces of code that > + depend on CONFIG_NET (such as cmd/net.c enabled via CONFIG_CMD_NET). > + Therefore the two symbols CONFIG_NET and CONFIG_NET_LWIP are mutually > + exclusive. > + > +endchoice > + > source "net/Kconfig" > > source "drivers/Kconfig" > diff --git a/common/Kconfig b/common/Kconfig > index 4bb9f08977a..1daa495080a 100644 > --- a/common/Kconfig > +++ b/common/Kconfig > @@ -424,7 +424,7 @@ config LOGF_FUNC_PAD > > config LOG_SYSLOG > bool "Log output to syslog server" > - depends on NET > + depends on NET || NET_LWIP > help > Enables a log driver which broadcasts log records via UDP port 514 > to syslog servers. > diff --git a/common/spl/Kconfig b/common/spl/Kconfig > index af43b5f5d3c..2731849841a 100644 > --- a/common/spl/Kconfig > +++ b/common/spl/Kconfig > @@ -1063,6 +1063,7 @@ config SPL_DM_SPI_FLASH > > config SPL_NET > bool "Support networking" > + depends on !NET_LWIP > help > Enable support for network devices (such as Ethernet) in SPL. > This permits SPL to load U-Boot over a network link rather than > diff --git a/drivers/dfu/Kconfig b/drivers/dfu/Kconfig > index 971204758aa..d034b501360 100644 > --- a/drivers/dfu/Kconfig > +++ b/drivers/dfu/Kconfig > @@ -20,6 +20,7 @@ config DFU_WRITE_ALT > config DFU_TFTP > bool "DFU via TFTP" > depends on NETDEVICES > + depends on !NET_LWIP > select UPDATE_COMMON > select DFU_OVER_TFTP > help > diff --git a/drivers/fastboot/Kconfig b/drivers/fastboot/Kconfig > index 70207573de2..1eb460f5a02 100644 > --- a/drivers/fastboot/Kconfig > +++ b/drivers/fastboot/Kconfig > @@ -1,5 +1,6 @@ > menu "Fastboot support" > depends on CMDLINE > + depends on !NET_LWIP > > config FASTBOOT > bool > diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig > index b4ff033afa9..d332f712a7c 100644 > --- a/drivers/net/Kconfig > +++ b/drivers/net/Kconfig > @@ -48,6 +48,7 @@ config DM_DSA > bool "Enable Driver Model for DSA switches" > depends on DM_MDIO > depends on PHY_FIXED > + depends on !NET_LWIP > help > Enable driver model for DSA switches > > diff --git a/drivers/net/phy/Kconfig b/drivers/net/phy/Kconfig > index 73064b2af68..75986162914 100644 > --- a/drivers/net/phy/Kconfig > +++ b/drivers/net/phy/Kconfig > @@ -11,7 +11,7 @@ config MV88E6352_SWITCH > > menuconfig PHYLIB > bool "Ethernet PHY (physical media interface) support" > - depends on NET > + depends on NET || NET_LWIP > help > Enable Ethernet PHY (physical media interface) support. > > diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig > index 4621a6fd5e6..03fe3bca197 100644 > --- a/drivers/usb/gadget/Kconfig > +++ b/drivers/usb/gadget/Kconfig > @@ -224,7 +224,7 @@ endif # USB_GADGET_DOWNLOAD > > config USB_ETHER > bool "USB Ethernet Gadget" > - depends on NET > + depends on NET || NET_LWIP > default y if ARCH_SUNXI && USB_MUSB_GADGET > help > Creates an Ethernet network device through a USB peripheral > diff --git a/net/Kconfig b/net/Kconfig > index 5dff6336293..952690d677d 100644 > --- a/net/Kconfig > +++ b/net/Kconfig > @@ -2,11 +2,6 @@ > # Network configuration > # > > -menuconfig NET > - bool "Networking support" > - default y > - imply NETDEVICES > - > if NET > > config ARP_TIMEOUT > @@ -26,15 +21,6 @@ config PROT_UDP > Enable a generic udp framework that allows defining a custom > handler for udp protocol. > > -config BOOTDEV_ETH > - bool "Enable bootdev for ethernet" > - depends on BOOTSTD > - default y > - help > - Provide a bootdev for ethernet so that is it possible to boot > - an operationg system over the network, using the PXE (Preboot > - Execution Environment) protocol. > - > config BOOTP_SEND_HOSTNAME > bool "Send hostname to DNS server" > help > @@ -255,6 +241,19 @@ config IPV6 > > endif # if NET > > +source "net/lwip/Kconfig" > + > +if NET || NET_LWIP > + > +config BOOTDEV_ETH > + bool "Enable bootdev for ethernet" > + depends on BOOTSTD > + default y > + help > + Provide a bootdev for ethernet so that is it possible to boot > + an operating system over the network, using the PXE (Preboot > + Execution Environment) protocol. > + > config SYS_RX_ETH_BUFFER > int "Number of receive packet buffers" > default 4 > @@ -263,3 +262,5 @@ config SYS_RX_ETH_BUFFER > controllers it is recommended to set this value to 8 or even higher, > since all buffers can be full shortly after enabling the interface on > high Ethernet traffic. > + > +endif # if NET || NET_LWIP > diff --git a/net/Makefile b/net/Makefile > index 64ab7ec740a..70eec8caf0d 100644 > --- a/net/Makefile > +++ b/net/Makefile > @@ -5,6 +5,8 @@ > > #ccflags-y += -DDEBUG > > +ifeq ($(CONFIG_NET),y) > + > obj-$(CONFIG_NET) += arp.o > obj-$(CONFIG_CMD_BOOTP) += bootp.o > obj-$(CONFIG_CMD_CDP) += cdp.o > @@ -38,3 +40,5 @@ obj-$(CONFIG_CMD_WGET) += wget.o > # sprintf(buf, index ? "foo%d" : "foo", index) > # and this is intentional usage. > CFLAGS_eth_common.o += -Wno-format-extra-args > + > +endif > diff --git a/net/lwip/Kconfig b/net/lwip/Kconfig > new file mode 100644 > index 00000000000..0a6bcb41369 > --- /dev/null > +++ b/net/lwip/Kconfig > @@ -0,0 +1,36 @@ > +# > +# Network configuration (with lwIP stack) > +# > + > +config LWIP_DEBUG > + bool "Enable debug traces in the lwIP library" > + > +config LWIP_ASSERT > + bool "Enable assertions in the lwIP library" > + > +config PROT_DHCP_LWIP > + bool "DHCP support in lwIP" > + depends on PROT_UDP_LWIP > + help > + Enable support for the DHCP protocol in lwIP. > + > +config PROT_DNS_LWIP > + bool > + depends on PROT_UDP_LWIP > + > +config PROT_RAW_LWIP > + bool > + > +config PROT_TCP_LWIP > + bool Hello Jerome, Not very critical, but it will be good to align options names. I think CONFIG_NET_LWIP_ is a good prefix. It will be easier to grep configuration from .config. BR, Maxim. > + > +config PROT_TCP_SACK_LWIP > + bool "TCP SACK support" > + depends on PROT_TCP_LWIP > + default y > + help > + TCP protocol with selective acknowledgements. Improves > + file transfer speed in wget. > + > +config PROT_UDP_LWIP > + bool > -- > 2.40.1 >
On Thu, Jul 25, 2024 at 02:57:23PM +0200, Jerome Forissier wrote: > Prepare the introduction of the lwIP (lightweight IP) TCP/IP stack by > adding a new net/lwip/ directory and the NET_LWIP symbol. Network > support is either NO_NET, NET (legacy stack) or NET_LWIP. Subsequent > commits will introduce the lwIP code, re-work the NETDEVICE integration > and port some of the NET commands and features to lwIP. > > SPL_NET cannot be enabled when NET_LWIP=y. SPL_NET pulls some symbols > that are part of NET (such as arp_init(), arp_timeout_check(), > arp_receive(), net_arp_wait_packet_ip()). lwIP support in SPL may be > added later. > > Similarly, DFU_TFTP and FASTBOOT are not compatible with NET_LWIP > because of dependencies on net_loop(), tftp_timeout_ms, > tftp_timeout_count_max and other NET things. Let's add a dependency on > !NET_LWIP for now. > > As for SANDBOX, NET_LWIP cannot be used either because of strong > assumptions on the network stack. Make NET_LWIP depend on !SANDBOX so > that the NET_LWIP alternative is not visible in make menuconfig when > sandbox_defconfig is used. > > Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> [snip] Here in net/Kconfig you do.. > +if NET || NET_LWIP > + > +config BOOTDEV_ETH > + bool "Enable bootdev for ethernet" > + depends on BOOTSTD > + default y > + help > + Provide a bootdev for ethernet so that is it possible to boot > + an operating system over the network, using the PXE (Preboot > + Execution Environment) protocol. > + > config SYS_RX_ETH_BUFFER > int "Number of receive packet buffers" > default 4 But we must have SYS_RX_ETH_BUFFER defined even in the NO_NET case as otherwise previously <net.h> and now <net-common.h> cannot be used, and untying that is another big mess. We include <net.h> in common areas for function prototypes where their usage is guarded. But we use PKTBUFSRX in some structs that aren't guarded. Trying to build for example for am62x_beagleplay_r5 with this series blows up in a lot of places.
čt 25. 7. 2024 v 15:28 odesílatel Jerome Forissier <jerome.forissier@linaro.org> napsal: > > Prepare the introduction of the lwIP (lightweight IP) TCP/IP stack by > adding a new net/lwip/ directory and the NET_LWIP symbol. Network > support is either NO_NET, NET (legacy stack) or NET_LWIP. Subsequent > commits will introduce the lwIP code, re-work the NETDEVICE integration > and port some of the NET commands and features to lwIP. > > SPL_NET cannot be enabled when NET_LWIP=y. SPL_NET pulls some symbols > that are part of NET (such as arp_init(), arp_timeout_check(), > arp_receive(), net_arp_wait_packet_ip()). lwIP support in SPL may be > added later. > > Similarly, DFU_TFTP and FASTBOOT are not compatible with NET_LWIP > because of dependencies on net_loop(), tftp_timeout_ms, > tftp_timeout_count_max and other NET things. Let's add a dependency on > !NET_LWIP for now. > > As for SANDBOX, NET_LWIP cannot be used either because of strong > assumptions on the network stack. Make NET_LWIP depend on !SANDBOX so > that the NET_LWIP alternative is not visible in make menuconfig when > sandbox_defconfig is used. > > Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> > --- > Kconfig | 26 ++++++++++++++++++++++++++ > common/Kconfig | 2 +- > common/spl/Kconfig | 1 + > drivers/dfu/Kconfig | 1 + > drivers/fastboot/Kconfig | 1 + > drivers/net/Kconfig | 1 + > drivers/net/phy/Kconfig | 2 +- > drivers/usb/gadget/Kconfig | 2 +- > net/Kconfig | 29 +++++++++++++++-------------- > net/Makefile | 4 ++++ > net/lwip/Kconfig | 36 ++++++++++++++++++++++++++++++++++++ > 11 files changed, 88 insertions(+), 17 deletions(-) > create mode 100644 net/lwip/Kconfig > > diff --git a/Kconfig b/Kconfig > index 82df59f176e..61bc6529617 100644 > --- a/Kconfig > +++ b/Kconfig > @@ -745,6 +745,32 @@ source "dts/Kconfig" > > source "env/Kconfig" > > +choice > + prompt "Networking stack" > + default NET > + > +config NO_NET > + bool "No networking support" > + > +config NET > + bool "Legacy U-Boot networking stack" > + imply NETDEVICES > + > +config NET_LWIP > + bool "Use lwIP for networking stack" > + imply NETDEVICES > + depends on !SANDBOX > + help > + Include networking support based on the lwIP (lightweight IP) > + TCP/IP stack (https://nongnu.org/lwip). This is a replacement for > + the default U-Boot network stack and applications located in net/ > + and enabled via CONFIG_NET as well as other pieces of code that > + depend on CONFIG_NET (such as cmd/net.c enabled via CONFIG_CMD_NET). > + Therefore the two symbols CONFIG_NET and CONFIG_NET_LWIP are mutually > + exclusive. > + > +endchoice > + > source "net/Kconfig" > > source "drivers/Kconfig" > diff --git a/common/Kconfig b/common/Kconfig > index 4bb9f08977a..1daa495080a 100644 > --- a/common/Kconfig > +++ b/common/Kconfig > @@ -424,7 +424,7 @@ config LOGF_FUNC_PAD > > config LOG_SYSLOG > bool "Log output to syslog server" > - depends on NET > + depends on NET || NET_LWIP > help > Enables a log driver which broadcasts log records via UDP port 514 > to syslog servers. > diff --git a/common/spl/Kconfig b/common/spl/Kconfig > index af43b5f5d3c..2731849841a 100644 > --- a/common/spl/Kconfig > +++ b/common/spl/Kconfig > @@ -1063,6 +1063,7 @@ config SPL_DM_SPI_FLASH > > config SPL_NET > bool "Support networking" > + depends on !NET_LWIP > help > Enable support for network devices (such as Ethernet) in SPL. > This permits SPL to load U-Boot over a network link rather than > diff --git a/drivers/dfu/Kconfig b/drivers/dfu/Kconfig > index 971204758aa..d034b501360 100644 > --- a/drivers/dfu/Kconfig > +++ b/drivers/dfu/Kconfig > @@ -20,6 +20,7 @@ config DFU_WRITE_ALT > config DFU_TFTP > bool "DFU via TFTP" > depends on NETDEVICES > + depends on !NET_LWIP > select UPDATE_COMMON > select DFU_OVER_TFTP > help > diff --git a/drivers/fastboot/Kconfig b/drivers/fastboot/Kconfig > index 70207573de2..1eb460f5a02 100644 > --- a/drivers/fastboot/Kconfig > +++ b/drivers/fastboot/Kconfig > @@ -1,5 +1,6 @@ > menu "Fastboot support" > depends on CMDLINE > + depends on !NET_LWIP > > config FASTBOOT > bool > diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig > index b4ff033afa9..d332f712a7c 100644 > --- a/drivers/net/Kconfig > +++ b/drivers/net/Kconfig > @@ -48,6 +48,7 @@ config DM_DSA > bool "Enable Driver Model for DSA switches" > depends on DM_MDIO > depends on PHY_FIXED > + depends on !NET_LWIP > help > Enable driver model for DSA switches > > diff --git a/drivers/net/phy/Kconfig b/drivers/net/phy/Kconfig > index 73064b2af68..75986162914 100644 > --- a/drivers/net/phy/Kconfig > +++ b/drivers/net/phy/Kconfig > @@ -11,7 +11,7 @@ config MV88E6352_SWITCH > > menuconfig PHYLIB > bool "Ethernet PHY (physical media interface) support" > - depends on NET > + depends on NET || NET_LWIP > help > Enable Ethernet PHY (physical media interface) support. > > diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig > index 4621a6fd5e6..03fe3bca197 100644 > --- a/drivers/usb/gadget/Kconfig > +++ b/drivers/usb/gadget/Kconfig > @@ -224,7 +224,7 @@ endif # USB_GADGET_DOWNLOAD > > config USB_ETHER > bool "USB Ethernet Gadget" > - depends on NET > + depends on NET || NET_LWIP > default y if ARCH_SUNXI && USB_MUSB_GADGET > help > Creates an Ethernet network device through a USB peripheral > diff --git a/net/Kconfig b/net/Kconfig > index 5dff6336293..952690d677d 100644 > --- a/net/Kconfig > +++ b/net/Kconfig > @@ -2,11 +2,6 @@ > # Network configuration > # > > -menuconfig NET > - bool "Networking support" > - default y > - imply NETDEVICES > - I looked at menuconfig and saw that so many network options are on the first screen. TBH It doesn't look nice and I think it should be hidden in any menu. │ │ Environment ---> │ │ │ │ Networking stack (Legacy U-Boot networking stack) ---> │ │ │ │ (5000) Milliseconds before trying ARP again │ │ │ │ (5) Number of timeouts before giving up │ │ │ │ [ ] Enable generic udp framework │ │ │ │ [ ] Send hostname to DNS server │ │ │ │ [*] Random ethaddr if unset │ │ │ │ [*] NetConsole support │ │ │ │ [ ] Support IP datagram reassembly │ │ │ │ [*] Echo the inverted Ethernet link state to the fault LED │ │ │ │ [ ] Set TFTP UDP source/destination ports via the environment │ │ │ │ (1) TFTP window size │ │ │ │ [ ] Track TFTP transfers based on file size option │ │ │ │ [ ] Get serverip value from Proxy DHCP response │ │ │ │ (100) # of additional milliseconds to wait for ProxyDHCP response │ │ │ │ [ ] Write the server's MAC address to 'serveraddr' │ │ │ │ [ ] Check the UDP checksum │ │ │ │ [ ] Use the 'serverip' env var for tftp, not bootp │ │ │ │ (64) Option 17 root path length │ │ │ │ [ ] Set a default 'gateway' value in the environment │ │ │ │ [ ] Set a default 'ipaddr' value in the environment │ │ │ │ [ ] Set a default 'netmask' value in the environment │ │ │ │ [ ] Set a default 'rootpath' value in the environment │ │ │ │ [ ] Set a default 'serverip' value in the environment │ │ │ │ -*- TCP stack │ │ │ │ [ ] TCP SACK support │ │ │ │ [ ] IPv6 support │ │ │ │ [ ] Enable debug traces in the lwIP library │ │ │ │ [ ] Enable assertions in the lwIP library │ │ │ │ [*] Enable bootdev for ethernet │ │ │ │ (4) Number of receive packet buffers │ │ │ │ (1468) TFTP block size │ │ │ │ Device Drivers ---> │ │ │ │ File systems ---> M
On 7/25/24 18:17, Tom Rini wrote: > On Thu, Jul 25, 2024 at 02:57:23PM +0200, Jerome Forissier wrote: > >> Prepare the introduction of the lwIP (lightweight IP) TCP/IP stack by >> adding a new net/lwip/ directory and the NET_LWIP symbol. Network >> support is either NO_NET, NET (legacy stack) or NET_LWIP. Subsequent >> commits will introduce the lwIP code, re-work the NETDEVICE integration >> and port some of the NET commands and features to lwIP. >> >> SPL_NET cannot be enabled when NET_LWIP=y. SPL_NET pulls some symbols >> that are part of NET (such as arp_init(), arp_timeout_check(), >> arp_receive(), net_arp_wait_packet_ip()). lwIP support in SPL may be >> added later. >> >> Similarly, DFU_TFTP and FASTBOOT are not compatible with NET_LWIP >> because of dependencies on net_loop(), tftp_timeout_ms, >> tftp_timeout_count_max and other NET things. Let's add a dependency on >> !NET_LWIP for now. >> >> As for SANDBOX, NET_LWIP cannot be used either because of strong >> assumptions on the network stack. Make NET_LWIP depend on !SANDBOX so >> that the NET_LWIP alternative is not visible in make menuconfig when >> sandbox_defconfig is used. >> >> Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> > [snip] > > Here in net/Kconfig you do.. >> +if NET || NET_LWIP >> + >> +config BOOTDEV_ETH >> + bool "Enable bootdev for ethernet" >> + depends on BOOTSTD >> + default y >> + help >> + Provide a bootdev for ethernet so that is it possible to boot >> + an operating system over the network, using the PXE (Preboot >> + Execution Environment) protocol. >> + >> config SYS_RX_ETH_BUFFER >> int "Number of receive packet buffers" >> default 4 > > But we must have SYS_RX_ETH_BUFFER defined even in the NO_NET case as > otherwise previously <net.h> and now <net-common.h> cannot be used, and > untying that is another big mess. We include <net.h> in common areas for > function prototypes where their usage is guarded. But we use PKTBUFSRX > in some structs that aren't guarded. Trying to build for example for > am62x_beagleplay_r5 with this series blows up in a lot of places. I have moved SYS_RX_ETH_BUFFER out of the 'if NET || NEW_LWIP' in v6. Thanks,
On 7/26/24 10:44, Michal Simek wrote: > čt 25. 7. 2024 v 15:28 odesílatel Jerome Forissier > <jerome.forissier@linaro.org> napsal: >> >> Prepare the introduction of the lwIP (lightweight IP) TCP/IP stack by >> adding a new net/lwip/ directory and the NET_LWIP symbol. Network >> support is either NO_NET, NET (legacy stack) or NET_LWIP. Subsequent >> commits will introduce the lwIP code, re-work the NETDEVICE integration >> and port some of the NET commands and features to lwIP. >> >> SPL_NET cannot be enabled when NET_LWIP=y. SPL_NET pulls some symbols >> that are part of NET (such as arp_init(), arp_timeout_check(), >> arp_receive(), net_arp_wait_packet_ip()). lwIP support in SPL may be >> added later. >> >> Similarly, DFU_TFTP and FASTBOOT are not compatible with NET_LWIP >> because of dependencies on net_loop(), tftp_timeout_ms, >> tftp_timeout_count_max and other NET things. Let's add a dependency on >> !NET_LWIP for now. >> >> As for SANDBOX, NET_LWIP cannot be used either because of strong >> assumptions on the network stack. Make NET_LWIP depend on !SANDBOX so >> that the NET_LWIP alternative is not visible in make menuconfig when >> sandbox_defconfig is used. >> >> Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> >> --- >> Kconfig | 26 ++++++++++++++++++++++++++ >> common/Kconfig | 2 +- >> common/spl/Kconfig | 1 + >> drivers/dfu/Kconfig | 1 + >> drivers/fastboot/Kconfig | 1 + >> drivers/net/Kconfig | 1 + >> drivers/net/phy/Kconfig | 2 +- >> drivers/usb/gadget/Kconfig | 2 +- >> net/Kconfig | 29 +++++++++++++++-------------- >> net/Makefile | 4 ++++ >> net/lwip/Kconfig | 36 ++++++++++++++++++++++++++++++++++++ >> 11 files changed, 88 insertions(+), 17 deletions(-) >> create mode 100644 net/lwip/Kconfig >> >> diff --git a/Kconfig b/Kconfig >> index 82df59f176e..61bc6529617 100644 >> --- a/Kconfig >> +++ b/Kconfig >> @@ -745,6 +745,32 @@ source "dts/Kconfig" >> >> source "env/Kconfig" >> >> +choice >> + prompt "Networking stack" >> + default NET >> + >> +config NO_NET >> + bool "No networking support" >> + >> +config NET >> + bool "Legacy U-Boot networking stack" >> + imply NETDEVICES >> + >> +config NET_LWIP >> + bool "Use lwIP for networking stack" >> + imply NETDEVICES >> + depends on !SANDBOX >> + help >> + Include networking support based on the lwIP (lightweight IP) >> + TCP/IP stack (https://nongnu.org/lwip). This is a replacement for >> + the default U-Boot network stack and applications located in net/ >> + and enabled via CONFIG_NET as well as other pieces of code that >> + depend on CONFIG_NET (such as cmd/net.c enabled via CONFIG_CMD_NET). >> + Therefore the two symbols CONFIG_NET and CONFIG_NET_LWIP are mutually >> + exclusive. >> + >> +endchoice >> + >> source "net/Kconfig" >> >> source "drivers/Kconfig" >> diff --git a/common/Kconfig b/common/Kconfig >> index 4bb9f08977a..1daa495080a 100644 >> --- a/common/Kconfig >> +++ b/common/Kconfig >> @@ -424,7 +424,7 @@ config LOGF_FUNC_PAD >> >> config LOG_SYSLOG >> bool "Log output to syslog server" >> - depends on NET >> + depends on NET || NET_LWIP >> help >> Enables a log driver which broadcasts log records via UDP port 514 >> to syslog servers. >> diff --git a/common/spl/Kconfig b/common/spl/Kconfig >> index af43b5f5d3c..2731849841a 100644 >> --- a/common/spl/Kconfig >> +++ b/common/spl/Kconfig >> @@ -1063,6 +1063,7 @@ config SPL_DM_SPI_FLASH >> >> config SPL_NET >> bool "Support networking" >> + depends on !NET_LWIP >> help >> Enable support for network devices (such as Ethernet) in SPL. >> This permits SPL to load U-Boot over a network link rather than >> diff --git a/drivers/dfu/Kconfig b/drivers/dfu/Kconfig >> index 971204758aa..d034b501360 100644 >> --- a/drivers/dfu/Kconfig >> +++ b/drivers/dfu/Kconfig >> @@ -20,6 +20,7 @@ config DFU_WRITE_ALT >> config DFU_TFTP >> bool "DFU via TFTP" >> depends on NETDEVICES >> + depends on !NET_LWIP >> select UPDATE_COMMON >> select DFU_OVER_TFTP >> help >> diff --git a/drivers/fastboot/Kconfig b/drivers/fastboot/Kconfig >> index 70207573de2..1eb460f5a02 100644 >> --- a/drivers/fastboot/Kconfig >> +++ b/drivers/fastboot/Kconfig >> @@ -1,5 +1,6 @@ >> menu "Fastboot support" >> depends on CMDLINE >> + depends on !NET_LWIP >> >> config FASTBOOT >> bool >> diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig >> index b4ff033afa9..d332f712a7c 100644 >> --- a/drivers/net/Kconfig >> +++ b/drivers/net/Kconfig >> @@ -48,6 +48,7 @@ config DM_DSA >> bool "Enable Driver Model for DSA switches" >> depends on DM_MDIO >> depends on PHY_FIXED >> + depends on !NET_LWIP >> help >> Enable driver model for DSA switches >> >> diff --git a/drivers/net/phy/Kconfig b/drivers/net/phy/Kconfig >> index 73064b2af68..75986162914 100644 >> --- a/drivers/net/phy/Kconfig >> +++ b/drivers/net/phy/Kconfig >> @@ -11,7 +11,7 @@ config MV88E6352_SWITCH >> >> menuconfig PHYLIB >> bool "Ethernet PHY (physical media interface) support" >> - depends on NET >> + depends on NET || NET_LWIP >> help >> Enable Ethernet PHY (physical media interface) support. >> >> diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig >> index 4621a6fd5e6..03fe3bca197 100644 >> --- a/drivers/usb/gadget/Kconfig >> +++ b/drivers/usb/gadget/Kconfig >> @@ -224,7 +224,7 @@ endif # USB_GADGET_DOWNLOAD >> >> config USB_ETHER >> bool "USB Ethernet Gadget" >> - depends on NET >> + depends on NET || NET_LWIP >> default y if ARCH_SUNXI && USB_MUSB_GADGET >> help >> Creates an Ethernet network device through a USB peripheral >> diff --git a/net/Kconfig b/net/Kconfig >> index 5dff6336293..952690d677d 100644 >> --- a/net/Kconfig >> +++ b/net/Kconfig >> @@ -2,11 +2,6 @@ >> # Network configuration >> # >> >> -menuconfig NET >> - bool "Networking support" >> - default y >> - imply NETDEVICES >> - > > I looked at menuconfig and saw that so many network options are on the > first screen. > TBH It doesn't look nice and I think it should be hidden in any menu. True. I have introduced a new "Networking" top-level menu in v6. Main page: Device Tree Control ---> Environment ---> Networking ---> Device Drivers ---> In "Networking" when legacy stack is selected: Networking stack (Legacy U-Boot networking stack) ---> (5000) Milliseconds before trying ARP again (5) Number of timeouts before giving up [ ] Enable generic udp framework [ ] Send hostname to DNS server [ ] Random ethaddr if unset ... or when lwIP is selected: Networking stack (Use lwIP for networking stack) ---> [ ] Enable debug traces in the lwIP library [ ] Enable assertions in the lwIP library -*- DHCP support in lwIP [*] TCP SACK support [*] Enable bootdev for ethernet (1468) TFTP block size (4) Number of receive packet buffers > > │ │ Environment ---> > │ │ > │ │ Networking stack (Legacy U-Boot networking stack) ---> > │ │ > │ │ (5000) Milliseconds before trying ARP again > │ │ > │ │ (5) Number of timeouts before giving up > │ │ > │ │ [ ] Enable generic udp framework > │ │ > │ │ [ ] Send hostname to DNS server > │ │ > │ │ [*] Random ethaddr if unset > │ │ > │ │ [*] NetConsole support > │ │ > │ │ [ ] Support IP datagram reassembly > │ │ > │ │ [*] Echo the inverted Ethernet link state to the fault LED > │ │ > │ │ [ ] Set TFTP UDP source/destination ports via the environment > │ │ > │ │ (1) TFTP window size > │ │ > │ │ [ ] Track TFTP transfers based on file size option > │ │ > │ │ [ ] Get serverip value from Proxy DHCP response > │ │ > │ │ (100) # of additional milliseconds to wait for ProxyDHCP > response │ │ > │ │ [ ] Write the server's MAC address to 'serveraddr' > │ │ > │ │ [ ] Check the UDP checksum > │ │ > │ │ [ ] Use the 'serverip' env var for tftp, not bootp > │ │ > │ │ (64) Option 17 root path length > │ │ > │ │ [ ] Set a default 'gateway' value in the environment > │ │ > │ │ [ ] Set a default 'ipaddr' value in the environment > │ │ > │ │ [ ] Set a default 'netmask' value in the environment > │ │ > │ │ [ ] Set a default 'rootpath' value in the environment > │ │ > │ │ [ ] Set a default 'serverip' value in the environment > │ │ > │ │ -*- TCP stack > │ │ > │ │ [ ] TCP SACK support > │ │ > │ │ [ ] IPv6 support > │ │ > │ │ [ ] Enable debug traces in the lwIP library > │ │ > │ │ [ ] Enable assertions in the lwIP library > │ │ > │ │ [*] Enable bootdev for ethernet > │ │ > │ │ (4) Number of receive packet buffers > │ │ > │ │ (1468) TFTP block size > │ │ > │ │ Device Drivers ---> > │ │ > │ │ File systems ---> > > M Thanks,
diff --git a/Kconfig b/Kconfig index 82df59f176e..61bc6529617 100644 --- a/Kconfig +++ b/Kconfig @@ -745,6 +745,32 @@ source "dts/Kconfig" source "env/Kconfig" +choice + prompt "Networking stack" + default NET + +config NO_NET + bool "No networking support" + +config NET + bool "Legacy U-Boot networking stack" + imply NETDEVICES + +config NET_LWIP + bool "Use lwIP for networking stack" + imply NETDEVICES + depends on !SANDBOX + help + Include networking support based on the lwIP (lightweight IP) + TCP/IP stack (https://nongnu.org/lwip). This is a replacement for + the default U-Boot network stack and applications located in net/ + and enabled via CONFIG_NET as well as other pieces of code that + depend on CONFIG_NET (such as cmd/net.c enabled via CONFIG_CMD_NET). + Therefore the two symbols CONFIG_NET and CONFIG_NET_LWIP are mutually + exclusive. + +endchoice + source "net/Kconfig" source "drivers/Kconfig" diff --git a/common/Kconfig b/common/Kconfig index 4bb9f08977a..1daa495080a 100644 --- a/common/Kconfig +++ b/common/Kconfig @@ -424,7 +424,7 @@ config LOGF_FUNC_PAD config LOG_SYSLOG bool "Log output to syslog server" - depends on NET + depends on NET || NET_LWIP help Enables a log driver which broadcasts log records via UDP port 514 to syslog servers. diff --git a/common/spl/Kconfig b/common/spl/Kconfig index af43b5f5d3c..2731849841a 100644 --- a/common/spl/Kconfig +++ b/common/spl/Kconfig @@ -1063,6 +1063,7 @@ config SPL_DM_SPI_FLASH config SPL_NET bool "Support networking" + depends on !NET_LWIP help Enable support for network devices (such as Ethernet) in SPL. This permits SPL to load U-Boot over a network link rather than diff --git a/drivers/dfu/Kconfig b/drivers/dfu/Kconfig index 971204758aa..d034b501360 100644 --- a/drivers/dfu/Kconfig +++ b/drivers/dfu/Kconfig @@ -20,6 +20,7 @@ config DFU_WRITE_ALT config DFU_TFTP bool "DFU via TFTP" depends on NETDEVICES + depends on !NET_LWIP select UPDATE_COMMON select DFU_OVER_TFTP help diff --git a/drivers/fastboot/Kconfig b/drivers/fastboot/Kconfig index 70207573de2..1eb460f5a02 100644 --- a/drivers/fastboot/Kconfig +++ b/drivers/fastboot/Kconfig @@ -1,5 +1,6 @@ menu "Fastboot support" depends on CMDLINE + depends on !NET_LWIP config FASTBOOT bool diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig index b4ff033afa9..d332f712a7c 100644 --- a/drivers/net/Kconfig +++ b/drivers/net/Kconfig @@ -48,6 +48,7 @@ config DM_DSA bool "Enable Driver Model for DSA switches" depends on DM_MDIO depends on PHY_FIXED + depends on !NET_LWIP help Enable driver model for DSA switches diff --git a/drivers/net/phy/Kconfig b/drivers/net/phy/Kconfig index 73064b2af68..75986162914 100644 --- a/drivers/net/phy/Kconfig +++ b/drivers/net/phy/Kconfig @@ -11,7 +11,7 @@ config MV88E6352_SWITCH menuconfig PHYLIB bool "Ethernet PHY (physical media interface) support" - depends on NET + depends on NET || NET_LWIP help Enable Ethernet PHY (physical media interface) support. diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig index 4621a6fd5e6..03fe3bca197 100644 --- a/drivers/usb/gadget/Kconfig +++ b/drivers/usb/gadget/Kconfig @@ -224,7 +224,7 @@ endif # USB_GADGET_DOWNLOAD config USB_ETHER bool "USB Ethernet Gadget" - depends on NET + depends on NET || NET_LWIP default y if ARCH_SUNXI && USB_MUSB_GADGET help Creates an Ethernet network device through a USB peripheral diff --git a/net/Kconfig b/net/Kconfig index 5dff6336293..952690d677d 100644 --- a/net/Kconfig +++ b/net/Kconfig @@ -2,11 +2,6 @@ # Network configuration # -menuconfig NET - bool "Networking support" - default y - imply NETDEVICES - if NET config ARP_TIMEOUT @@ -26,15 +21,6 @@ config PROT_UDP Enable a generic udp framework that allows defining a custom handler for udp protocol. -config BOOTDEV_ETH - bool "Enable bootdev for ethernet" - depends on BOOTSTD - default y - help - Provide a bootdev for ethernet so that is it possible to boot - an operationg system over the network, using the PXE (Preboot - Execution Environment) protocol. - config BOOTP_SEND_HOSTNAME bool "Send hostname to DNS server" help @@ -255,6 +241,19 @@ config IPV6 endif # if NET +source "net/lwip/Kconfig" + +if NET || NET_LWIP + +config BOOTDEV_ETH + bool "Enable bootdev for ethernet" + depends on BOOTSTD + default y + help + Provide a bootdev for ethernet so that is it possible to boot + an operating system over the network, using the PXE (Preboot + Execution Environment) protocol. + config SYS_RX_ETH_BUFFER int "Number of receive packet buffers" default 4 @@ -263,3 +262,5 @@ config SYS_RX_ETH_BUFFER controllers it is recommended to set this value to 8 or even higher, since all buffers can be full shortly after enabling the interface on high Ethernet traffic. + +endif # if NET || NET_LWIP diff --git a/net/Makefile b/net/Makefile index 64ab7ec740a..70eec8caf0d 100644 --- a/net/Makefile +++ b/net/Makefile @@ -5,6 +5,8 @@ #ccflags-y += -DDEBUG +ifeq ($(CONFIG_NET),y) + obj-$(CONFIG_NET) += arp.o obj-$(CONFIG_CMD_BOOTP) += bootp.o obj-$(CONFIG_CMD_CDP) += cdp.o @@ -38,3 +40,5 @@ obj-$(CONFIG_CMD_WGET) += wget.o # sprintf(buf, index ? "foo%d" : "foo", index) # and this is intentional usage. CFLAGS_eth_common.o += -Wno-format-extra-args + +endif diff --git a/net/lwip/Kconfig b/net/lwip/Kconfig new file mode 100644 index 00000000000..0a6bcb41369 --- /dev/null +++ b/net/lwip/Kconfig @@ -0,0 +1,36 @@ +# +# Network configuration (with lwIP stack) +# + +config LWIP_DEBUG + bool "Enable debug traces in the lwIP library" + +config LWIP_ASSERT + bool "Enable assertions in the lwIP library" + +config PROT_DHCP_LWIP + bool "DHCP support in lwIP" + depends on PROT_UDP_LWIP + help + Enable support for the DHCP protocol in lwIP. + +config PROT_DNS_LWIP + bool + depends on PROT_UDP_LWIP + +config PROT_RAW_LWIP + bool + +config PROT_TCP_LWIP + bool + +config PROT_TCP_SACK_LWIP + bool "TCP SACK support" + depends on PROT_TCP_LWIP + default y + help + TCP protocol with selective acknowledgements. Improves + file transfer speed in wget. + +config PROT_UDP_LWIP + bool
Prepare the introduction of the lwIP (lightweight IP) TCP/IP stack by adding a new net/lwip/ directory and the NET_LWIP symbol. Network support is either NO_NET, NET (legacy stack) or NET_LWIP. Subsequent commits will introduce the lwIP code, re-work the NETDEVICE integration and port some of the NET commands and features to lwIP. SPL_NET cannot be enabled when NET_LWIP=y. SPL_NET pulls some symbols that are part of NET (such as arp_init(), arp_timeout_check(), arp_receive(), net_arp_wait_packet_ip()). lwIP support in SPL may be added later. Similarly, DFU_TFTP and FASTBOOT are not compatible with NET_LWIP because of dependencies on net_loop(), tftp_timeout_ms, tftp_timeout_count_max and other NET things. Let's add a dependency on !NET_LWIP for now. As for SANDBOX, NET_LWIP cannot be used either because of strong assumptions on the network stack. Make NET_LWIP depend on !SANDBOX so that the NET_LWIP alternative is not visible in make menuconfig when sandbox_defconfig is used. Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> --- Kconfig | 26 ++++++++++++++++++++++++++ common/Kconfig | 2 +- common/spl/Kconfig | 1 + drivers/dfu/Kconfig | 1 + drivers/fastboot/Kconfig | 1 + drivers/net/Kconfig | 1 + drivers/net/phy/Kconfig | 2 +- drivers/usb/gadget/Kconfig | 2 +- net/Kconfig | 29 +++++++++++++++-------------- net/Makefile | 4 ++++ net/lwip/Kconfig | 36 ++++++++++++++++++++++++++++++++++++ 11 files changed, 88 insertions(+), 17 deletions(-) create mode 100644 net/lwip/Kconfig