From 56d7e426224f06945792dd870e1f744f0c00837d Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Wed, 18 Jun 2014 11:45:55 -0600 Subject: Networking: Move relevant parts of net/Kconfig to tcp/Kconfig, udp/Kconfig, and pkt/Kconfig --- nuttx/net/Kconfig | 252 +----------------------------------------- nuttx/net/net_send_buffered.c | 7 ++ nuttx/net/pkt/Kconfig | 27 +++++ nuttx/net/tcp/Kconfig | 193 ++++++++++++++++++++++++++++++++ nuttx/net/tcp/tcp_wrbuffer.c | 7 ++ nuttx/net/udp/Kconfig | 52 +++++++++ 6 files changed, 289 insertions(+), 249 deletions(-) create mode 100644 nuttx/net/pkt/Kconfig create mode 100644 nuttx/net/tcp/Kconfig create mode 100644 nuttx/net/udp/Kconfig diff --git a/nuttx/net/Kconfig b/nuttx/net/Kconfig index b251be951..6e3cde5a3 100644 --- a/nuttx/net/Kconfig +++ b/nuttx/net/Kconfig @@ -102,255 +102,9 @@ config NET_BUFSIZE IPv6 hosts are required to be able to handle an MSS of 1220 octets, resulting in a minimum buffer size of of 1220+20+40+14 = 1294 -config NET_TCPURGDATA - bool "Urgent data" - default n - ---help--- - Determines if support for TCP urgent data notification should be - compiled in. Urgent data (out-of-band data) is a rarely used TCP feature - that is very seldom would be required. - -menu "Raw Socket Support" - -config NET_PKT - bool "Socket packet socket support" - default n - ---help--- - Enable or disable support for packet sockets. - - Packet sockets allow receiving and transmitting frames without - a transport protocol in between. Frames received are copied into - a packet socket tap before they enter uIP. Data written into a - packet socket will bypass uIP altogether and be placed in the - transmission buffer of the network interface driver. - -if NET_PKT - -config NET_PKT_CONNS - int "Max packet sockets" - default 1 - -endif # NET_PKT -endmenu # Packet Sockets - -menu "TCP/IP Networking" - -config NET_TCP - bool "TCP/IP Networking" - default n - ---help--- - TCP support on or off - -if NET_TCP - -config NET_TCP_CONNS - int "Number of TCP/IP connections" - default 8 - ---help--- - Maximum number of TCP/IP connections (all tasks) - -config NET_MAX_LISTENPORTS - int "Number of listening ports" - default 20 - ---help--- - Maximum number of listening TCP/IP ports (all tasks). Default: 20 - -config NET_TCP_READAHEAD - bool "Enable TCP/IP read-ahead buffering" - default y - ---help--- - Read-ahead buffers allows buffering of TCP/IP packets when there is no - receive in place to catch the TCP packet. In that case, the packet - will be retained in the NuttX read-ahead buffers. - - You might want to disable TCP/IP read-ahead buffering on a highly - memory constrained system that does not have any TCP/IP packet rate - issues. - -if NET_TCP_READAHEAD - -config NET_TCP_READAHEAD_BUFSIZE - int "TCP/IP read-ahead buffer size" - default 1220 if !NET_SLIP && NET_IPv6 - default 536 if !NET_SLIP && !NET_IPv6 - default 256 if NET_SLIP && !NET_IPv6 - ---help--- - Read-ahead buffers allows buffering of TCP/IP packets when there is no - receive in place to catch the TCP packet. In that case, the packet - will be retained in the NuttX read-ahead buffers. - - This setting specifies the size of one TCP/IP read-ahead buffer. - This should best be a equal to the maximum packet payload size (MSS). - - Optimally, the size of the read-ahead buffer will should the maximum - size of an incoming TCP packet payload (MSS). This MSS value is - determined by NET_BUFSIZE minus the size of TCP, IP, and Ethernet - headers (assuming you are using the Ethernet transport). IPv4 hosts - are required to be able to handle an MSS of 536 octets and IPv6 hosts - are required to be able to handle an MSS of 1220 octets. - -config NET_NTCP_READAHEAD_BUFFERS - int "Number of TCP/IP read-ahead buffers" - default 8 - ---help--- - Read-ahead buffers allows buffering of TCP/IP packets when there is no - receive in place to catch the TCP packet. In that case, the packet - will be retained in the NuttX read-ahead buffers. - - This setting specifies the number of TCP/IP read-ahead buffers. - -endif # NET_TCP_READAHEAD - -config NET_TCP_WRITE_BUFFERS - bool "Enable TCP/IP write buffering" - default n - ---help--- - Write buffers allows buffering of ongoing TCP/IP packets, providing - for higher performance, streamed output. - - You might want to disable TCP/IP write buffering on a highly memory - memory constrained system where there are no performance issues. - -if NET_TCP_WRITE_BUFFERS - -config NET_TCP_WRITE_BUFSIZE - int "TCP/IP write buffer size" - default 1220 if !NET_SLIP && NET_IPv6 - default 536 if !NET_SLIP && !NET_IPv6 - default 256 if NET_SLIP && !NET_IPv6 - ---help--- - Write buffers allows buffering of ongoing TCP/IP packets, providing - for higher performance, streamed output. - - The size of the write buffer will determine the maximum size of an - outgoing TCP packet payload (MSS). This value should NOT exceed the - maximum MSS which is determined by NET_BUFSIZE minus the size of - TCP, IP, and Ethernet headers (assuming you are using the Ethernet - transport). IPv4 hosts are required to be able to handle an MSS - of 536 octets and IPv6 hosts are required to be able to handle an - MSS of 1220 octets. - - This setting specifies the size of one TCP/IP write buffer. This - should best be a equal to the maximum packet size (NET_BUFSIZE). - -config NET_NTCP_WRITE_BUFFERS - int "Number of TCP/IP write buffers" - default 8 - ---help--- - Write buffers allows buffering of ongoing TCP/IP packets, providing - for higher performance, streamed output. - - This setting specifies the number of TCP/IP write buffers. - -endif # NET_TCP_WRITE_BUFFERS - -config NET_TCP_RECVDELAY - int "TCP Rx delay" - default 0 - ---help--- - If NET_TCP_READAHEAD_BUFFERS is undefined, then there will be no buffering - of TCP/IP packets: Any TCP/IP packet received will be ACKed, but its contents - will be dropped in the bit-bucket. - - One low-performance option is delay for a short period of time after a - TCP/IP packet is received to see if another comes right behind it. Then - the packet data from both can be combined. This option only makes since - if performance is not an issue and you need to handle short bursts of - small, back-to-back packets. The delay is in units of deciseconds. - -config NET_TCPBACKLOG - bool "TCP/IP backlog support" - default n - ---help--- - Incoming connections pend in a backlog until accept() is called. - The size of the backlog is selected when listen() is called. - -config NET_TCP_SPLIT - bool "Enable packet splitting" - default n - depends on !NET_TCP_WRITE_BUFFERS - ---help--- - send() will not return until the transfer has been ACKed by the - recipient. But under RFC 1122, the host need not ACK each packet - immediately; the host may wait for 500 MS before ACKing. This - combination can cause very slow performance with small transfers are - made to an RFC 1122 client. However, the RFC 1122 must ACK at least - every second (odd) packet. - - This option enables logic to trick the RFC 1122 host be exploiting - this last RFC 1122 requirement: If an odd number of packets were to - be sent, then send() will split the last even packet to guarantee - that an even number of packets will be sent and the RFC 1122 host - will ACK the final packet immediately. - -if NET_TCP_SPLIT - -config NET_TCP_SPLIT_SIZE - int "Split size threshold" - default 40 - ---help--- - Packets of this size or smaller than this will not be split. - -endif # NET_TCP_SPLIT - -config NET_SENDFILE - bool "Optimized network sendfile()" - default n - ---help--- - Support larger, higher performance sendfile() for transferring - files out a TCP connection. - -endif # NET_TCP -endmenu # TCP/IP Networking - -menu "UDP Networking" - -config NET_UDP - bool "UDP Networking" - default n - depends on NET - ---help--- - Enable or disable UDP networking support. - -if NET_UDP - -config NET_UDP_CHECKSUMS - bool "UDP checksums" - default n - ---help--- - Enable/disable UDP checksum support - -config NET_UDP_CONNS - int "Number of UDP sockets" - default 8 - ---help--- - The maximum amount of open concurrent UDP sockets - -config NET_BROADCAST - bool "UDP broadcast Rx support" - default n - ---help--- - Incoming UDP broadcast support - -config NET_RXAVAIL - bool "Driver-based UDP backlog" - default n - ---help--- - One problem with UDP communications is that, unlike TCP/IP, there is - no backlog of UDP packets. So if you are listening at the precise - moment that the UDP packet is sent, it will not be received. This - is not incompatible with the properties of UDP, but can result in - bad performance if packets are missed, time out, and are resent. - - Some Ethernet controllers have built-in RAM and the drivers can - support retention of UDP packets in that RAM. If the drivers - supports such a capability, this option may be enabled to use it. - NOTE: If this option is enabled, the driver must support the - rxavail() method in the uip_driver_s structure. - -endif # NET_UDP -endmenu - +source "net/pkt/Kconfig" +source "net/tcp/Kconfig" +source "net/udp/Kconfig" source "net/icmp/Kconfig" source "net/igmp/Kconfig" diff --git a/nuttx/net/net_send_buffered.c b/nuttx/net/net_send_buffered.c index 5005e1a5f..60f2a6134 100644 --- a/nuttx/net/net_send_buffered.c +++ b/nuttx/net/net_send_buffered.c @@ -43,6 +43,13 @@ #if defined(CONFIG_NET) && defined(CONFIG_NET_TCP) && \ defined(CONFIG_NET_TCP_WRITE_BUFFERS) +#if defined(CONFIG_DEBUG) && defined(CONFIG_NET_TCP_WRBUFFER_DEBUG) +/* Force debug output (from this file only) */ + +# undef CONFIG_DEBUG_NET +# define CONFIG_DEBUG_NET 1 +#endif + #include #include diff --git a/nuttx/net/pkt/Kconfig b/nuttx/net/pkt/Kconfig new file mode 100644 index 000000000..a0299ad17 --- /dev/null +++ b/nuttx/net/pkt/Kconfig @@ -0,0 +1,27 @@ +# +# For a description of the syntax of this configuration file, +# see misc/tools/kconfig-language.txt. +# + +menu "Raw Socket Support" + +config NET_PKT + bool "Socket packet socket support" + default n + ---help--- + Enable or disable support for packet sockets. + + Packet sockets allow receiving and transmitting frames without + a transport protocol in between. Frames received are copied into + a packet socket tap before they enter uIP. Data written into a + packet socket will bypass uIP altogether and be placed in the + transmission buffer of the network interface driver. + +if NET_PKT + +config NET_PKT_CONNS + int "Max packet sockets" + default 1 + +endif # NET_PKT +endmenu # PRaw Socket Support diff --git a/nuttx/net/tcp/Kconfig b/nuttx/net/tcp/Kconfig new file mode 100644 index 000000000..1d41e762a --- /dev/null +++ b/nuttx/net/tcp/Kconfig @@ -0,0 +1,193 @@ +# +# For a description of the syntax of this configuration file, +# see misc/tools/kconfig-language.txt. +# + +menu "TCP/IP Networking" + +config NET_TCP + bool "TCP/IP Networking" + default n + ---help--- + TCP support on or off + +if NET_TCP + +config NET_TCPURGDATA + bool "Urgent data" + default n + ---help--- + Determines if support for TCP urgent data notification should be + compiled in. Urgent data (out-of-band data) is a rarely used TCP feature + that is very seldom would be required. + +config NET_TCP_CONNS + int "Number of TCP/IP connections" + default 8 + ---help--- + Maximum number of TCP/IP connections (all tasks) + +config NET_MAX_LISTENPORTS + int "Number of listening ports" + default 20 + ---help--- + Maximum number of listening TCP/IP ports (all tasks). Default: 20 + +config NET_TCP_READAHEAD + bool "Enable TCP/IP read-ahead buffering" + default y + ---help--- + Read-ahead buffers allows buffering of TCP/IP packets when there is no + receive in place to catch the TCP packet. In that case, the packet + will be retained in the NuttX read-ahead buffers. + + You might want to disable TCP/IP read-ahead buffering on a highly + memory constrained system that does not have any TCP/IP packet rate + issues. + +if NET_TCP_READAHEAD + +config NET_TCP_READAHEAD_BUFSIZE + int "TCP/IP read-ahead buffer size" + default 1220 if !NET_SLIP && NET_IPv6 + default 536 if !NET_SLIP && !NET_IPv6 + default 256 if NET_SLIP && !NET_IPv6 + ---help--- + Read-ahead buffers allows buffering of TCP/IP packets when there is no + receive in place to catch the TCP packet. In that case, the packet + will be retained in the NuttX read-ahead buffers. + + This setting specifies the size of one TCP/IP read-ahead buffer. + This should best be a equal to the maximum packet payload size (MSS). + + Optimally, the size of the read-ahead buffer will should the maximum + size of an incoming TCP packet payload (MSS). This MSS value is + determined by NET_BUFSIZE minus the size of TCP, IP, and Ethernet + headers (assuming you are using the Ethernet transport). IPv4 hosts + are required to be able to handle an MSS of 536 octets and IPv6 hosts + are required to be able to handle an MSS of 1220 octets. + +config NET_NTCP_READAHEAD_BUFFERS + int "Number of TCP/IP read-ahead buffers" + default 8 + ---help--- + Read-ahead buffers allows buffering of TCP/IP packets when there is no + receive in place to catch the TCP packet. In that case, the packet + will be retained in the NuttX read-ahead buffers. + + This setting specifies the number of TCP/IP read-ahead buffers. + +endif # NET_TCP_READAHEAD + +config NET_TCP_WRITE_BUFFERS + bool "Enable TCP/IP write buffering" + default n + ---help--- + Write buffers allows buffering of ongoing TCP/IP packets, providing + for higher performance, streamed output. + + You might want to disable TCP/IP write buffering on a highly memory + memory constrained system where there are no performance issues. + +if NET_TCP_WRITE_BUFFERS + +config NET_TCP_WRITE_BUFSIZE + int "TCP/IP write buffer size" + default 1220 if !NET_SLIP && NET_IPv6 + default 536 if !NET_SLIP && !NET_IPv6 + default 256 if NET_SLIP && !NET_IPv6 + ---help--- + Write buffers allows buffering of ongoing TCP/IP packets, providing + for higher performance, streamed output. + + The size of the write buffer will determine the maximum size of an + outgoing TCP packet payload (MSS). This value should NOT exceed the + maximum MSS which is determined by NET_BUFSIZE minus the size of + TCP, IP, and Ethernet headers (assuming you are using the Ethernet + transport). IPv4 hosts are required to be able to handle an MSS + of 536 octets and IPv6 hosts are required to be able to handle an + MSS of 1220 octets. + + This setting specifies the size of one TCP/IP write buffer. This + should best be a equal to the maximum packet size (NET_BUFSIZE). + +config NET_NTCP_WRITE_BUFFERS + int "Number of TCP/IP write buffers" + default 8 + ---help--- + Write buffers allows buffering of ongoing TCP/IP packets, providing + for higher performance, streamed output. + + This setting specifies the number of TCP/IP write buffers. + +config NET_TCP_WRBUFFER_DEBUG + bool "Force write buffer debug" + default n + depends on DEBUG + ---help--- + This option will force debug output from TCP write buffer logic, + even with network debug output. This is not normally something + that would want to do but is convenient if you are debugging the + write buffer logic and do not want to get overloaded with other + network-related debug output. + +endif # NET_TCP_WRITE_BUFFERS + +config NET_TCP_RECVDELAY + int "TCP Rx delay" + default 0 + ---help--- + If NET_TCP_READAHEAD_BUFFERS is undefined, then there will be no buffering + of TCP/IP packets: Any TCP/IP packet received will be ACKed, but its contents + will be dropped in the bit-bucket. + + One low-performance option is delay for a short period of time after a + TCP/IP packet is received to see if another comes right behind it. Then + the packet data from both can be combined. This option only makes since + if performance is not an issue and you need to handle short bursts of + small, back-to-back packets. The delay is in units of deciseconds. + +config NET_TCPBACKLOG + bool "TCP/IP backlog support" + default n + ---help--- + Incoming connections pend in a backlog until accept() is called. + The size of the backlog is selected when listen() is called. + +config NET_TCP_SPLIT + bool "Enable packet splitting" + default n + depends on !NET_TCP_WRITE_BUFFERS + ---help--- + send() will not return until the transfer has been ACKed by the + recipient. But under RFC 1122, the host need not ACK each packet + immediately; the host may wait for 500 MS before ACKing. This + combination can cause very slow performance with small transfers are + made to an RFC 1122 client. However, the RFC 1122 must ACK at least + every second (odd) packet. + + This option enables logic to trick the RFC 1122 host be exploiting + this last RFC 1122 requirement: If an odd number of packets were to + be sent, then send() will split the last even packet to guarantee + that an even number of packets will be sent and the RFC 1122 host + will ACK the final packet immediately. + +if NET_TCP_SPLIT + +config NET_TCP_SPLIT_SIZE + int "Split size threshold" + default 40 + ---help--- + Packets of this size or smaller than this will not be split. + +endif # NET_TCP_SPLIT + +config NET_SENDFILE + bool "Optimized network sendfile()" + default n + ---help--- + Support larger, higher performance sendfile() for transferring + files out a TCP connection. + +endif # NET_TCP +endmenu # TCP/IP Networking diff --git a/nuttx/net/tcp/tcp_wrbuffer.c b/nuttx/net/tcp/tcp_wrbuffer.c index 7211655a5..309ea18d7 100644 --- a/nuttx/net/tcp/tcp_wrbuffer.c +++ b/nuttx/net/tcp/tcp_wrbuffer.c @@ -41,6 +41,13 @@ #include #if defined(CONFIG_NET) && defined(CONFIG_NET_TCP) && defined(CONFIG_NET_TCP_WRITE_BUFFERS) +#if defined(CONFIG_DEBUG) && defined(CONFIG_NET_TCP_WRBUFFER_DEBUG) +/* Force debug output (from this file only) */ + +# undef CONFIG_DEBUG_NET +# define CONFIG_DEBUG_NET 1 +#endif + #include #include #include diff --git a/nuttx/net/udp/Kconfig b/nuttx/net/udp/Kconfig new file mode 100644 index 000000000..16b535c9c --- /dev/null +++ b/nuttx/net/udp/Kconfig @@ -0,0 +1,52 @@ +# +# For a description of the syntax of this configuration file, +# see misc/tools/kconfig-language.txt. +# + +menu "UDP Networking" + +config NET_UDP + bool "UDP Networking" + default n + depends on NET + ---help--- + Enable or disable UDP networking support. + +if NET_UDP + +config NET_UDP_CHECKSUMS + bool "UDP checksums" + default n + ---help--- + Enable/disable UDP checksum support + +config NET_UDP_CONNS + int "Number of UDP sockets" + default 8 + ---help--- + The maximum amount of open concurrent UDP sockets + +config NET_BROADCAST + bool "UDP broadcast Rx support" + default n + ---help--- + Incoming UDP broadcast support + +config NET_RXAVAIL + bool "Driver-based UDP backlog" + default n + ---help--- + One problem with UDP communications is that, unlike TCP/IP, there is + no backlog of UDP packets. So if you are listening at the precise + moment that the UDP packet is sent, it will not be received. This + is not incompatible with the properties of UDP, but can result in + bad performance if packets are missed, time out, and are resent. + + Some Ethernet controllers have built-in RAM and the drivers can + support retention of UDP packets in that RAM. If the drivers + supports such a capability, this option may be enabled to use it. + NOTE: If this option is enabled, the driver must support the + rxavail() method in the uip_driver_s structure. + +endif # NET_UDP +endmenu # UDP Networking -- cgit v1.2.3