Commit Graph

40 Commits

Author SHA1 Message Date
Xiang Xiao
7ec6b4c7dd Change dpends on SCHED_[L|H]PWORK to SCHED_WORKQUEUE
since the code could map the unsupported work to the
supported one and remove select SCHED_WORKQUEUE from
Kconfig since SCHED_[L|H]PWORK already do the selection

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-05-28 18:41:51 +03:00
zhanghongyu
3f8b71924f tcp: move wd_timer from wifi driver to tcp stack
Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2022-05-28 16:29:51 +08:00
Alexander Lunev
2a6de301ee net/tcp: transformed NET_TCP_FAST_RETRANSMIT_WATERMARK option to boolean.
According to RFC 5681 (3.2) the TCP Fast Retransmit algorithm should start
if the threshold of 3 duplicate ACKs is reached.
Thus the threshold should be a constant, not an integer option.
2022-01-26 11:50:48 +08:00
YAMAMOTO Takashi
ecd6a3572b net/tcp/Kconfig: Remove NET_TCP_SPLIT
While it's a neat idea, it doesn't work well in reality.

* Many of modern tcp stacks don't obey the "ack every other packet"
  rule these days. (Linux, macOS, ...)

* Even if a traditional TCP implementation is assumed, we can't
  predict/control which packets are acked reliably. For example,
  window updates can easily mess up our strategy.
2021-11-04 13:32:57 -05:00
chao.an
aab03ef86d net/tcp: add window scale support
Reference here:
https://tools.ietf.org/html/rfc1323

Signed-off-by: chao.an <anchao@xiaomi.com>
2021-07-07 03:55:41 -05:00
chao.an
c2b0006dcd net/tcp: implement the fast retransmit
RFC2001: TCP Slow Start, Congestion Avoidance, Fast Retransmit,
         and Fast Recovery Algorithms

...

3.  Fast Retransmit
  Modifications to the congestion avoidance algorithm were proposed in
  1990 [3].  Before describing the change, realize that TCP may
  generate an immediate acknowledgment (a duplicate ACK) when an out-
  of-order segment is received (Section 4.2.2.21 of [1], with a note
  that one reason for doing so was for the experimental fast-
  retransmit algorithm).  This duplicate ACK should not be delayed.
  The purpose of this duplicate ACK is to let the other end know that a
  segment was received out of order, and to tell it what sequence
  number is expected.

  Since TCP does not know whether a duplicate ACK is caused by a lost
  segment or just a reordering of segments, it waits for a small number
  of duplicate ACKs to be received.  It is assumed that if there is
  just a reordering of the segments, there will be only one or two
  duplicate ACKs before the reordered segment is processed, which will
  then generate a new ACK.  If three or more duplicate ACKs are
  received in a row, it is a strong indication that a segment has been
  lost.  TCP then performs a retransmission of what appears to be the
  missing segment, without waiting for a retransmission timer to
  expire.

Change-Id: Ie2cbcecab507c3d831f74390a6a85e0c5c8e0652
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-12-01 11:36:10 -06:00
Xiang Xiao
346336bb9e Make the read ahead buffer unselectable
Here is the email loop talk about why it is better to remove the option:
https://groups.google.com/forum/#!topic/nuttx/AaNkS7oU6R0

Change-Id: Ib66c037752149ad4b2787ef447f966c77aa12aad
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-01-11 08:24:49 -06:00
Xiang Xiao
90c52e6f8f Squashed commit of the following:
Author: Gregory Nutt <gnutt@nuttx.org>

    Run all .h and .c files modified in last PR through nxstyle.

Author: Xiang Xiao <xiaoxiang@xiaomi.com>

    Net cleanup (#17)

    * Fix the semaphore usage issue found in tcp/udp

    1. The count semaphore need disable priority inheritance
    2. Loop again if net_lockedwait return -EINTR
    3. Call nxsem_trywait to avoid the race condition
    4. Call nxsem_post instead of sem_post

    * Put the work notifier into free list to avoid the heap fragment in the long run.  Since the allocation strategy is encapsulated internally, we can even refine the implementation later.

    * Network stack shouldn't allocate memory in the poll implementation to avoid the heap fragment in the long run, other modification include:

    1. Select MM_IOB automatically since ICMP[v6] socket can't work without the read ahead buffer
    2. Remove the net lock since xxx_callback_free already do the same thing
    3. TCP/UDP poll should work even the read ahead buffer isn't enabled at all

    * Add NET_ prefix for UDP_NOTIFIER and TCP_NOTIFIER option to align with other UDP/TCP option convention

    * Remove the unused _SF_[IDLE|ACCEPT|SEND|RECV|MASK] flags since there are code to set/clear these flags, but nobody check them.
2019-12-31 09:26:14 -06:00
Gregory Nutt
66ef6d143a This commit adds an initial implemented of TCP delayed ACKs as specified in RFC 1122.
Squashed commit of the following:

    net/tmp:  Rename the unacked field of the tcp connection structure to tx_unacked.  Too confusing with the implementation of delayed RX ACKs.

    net/tcp:  Initial implementation of TCP delayed ACKs.

    net/tcp:  Add delayed ACK configuration selection.  Rename tcp_ack() to tcp_synack().  It may or may not send a ACK.  It will always send SYN or SYN/ACK.
2019-12-08 13:13:51 -06:00
Gregory Nutt
9efadaefc1 net/tcp: Be consistent with units of TIME_WAIT. Units were unspecified in tcp/Kconfig, but assumed to be in units of half seconds in tcp/timer.h. include/nuttx/netconfig does not indicate the units but is apparently assuming seconds. This commit unifies all delays to clearly specified units of seconds. 2019-11-24 09:19:54 -06:00
zhangyuan7
ba598841e5 net/tcp/Kconfig, include/nuttx/net/netconfig.h: Make RTO and WAIT_TIME configurable. This fix is not really correct: TCP RTO really should be calculated dynamically for each TCP connection: http://sgros.blogspot.com/2012/02/calculating-tcp-rto.html. 2019-08-26 11:03:27 -06:00
Xiang Xiao
fe421022e2 sched/wqueue/kwork_notifier.c and several Kconfig files: Notifier should work with either lpwork or hpwork and other minor typo fix. 2019-01-27 11:02:56 -06:00
zhangyuan7
f036e2a32a net/tcp/tcp_backlog.c: Add SOMAXCONN definition and implementaton per OpenGroup.org. 2018-11-09 11:20:33 -06:00
Gregory Nutt
af0ee3c8f7 sched/wqueue: Add an option to work queue notifier so that the notification can occur on different work queues. 2018-09-11 07:22:23 -06:00
Gregory Nutt
09d5d05b95 net/TCP: Extend the TCP notification logic logic so that it will also report loss of connection events. 2018-09-09 17:32:10 -06:00
Gregory Nutt
9d3148406c Signals were not a good choice of IPC to implement the poll function for several reasons: In order to handle the asynchrnous poll-related event, a substantial amount of state information is needed. Signals are only capable of passing minimal amounts of data. There are also complexities with performing kernel space signal handlers in kernel space code that is better to avoid. So, instead of signals, the equivalent logic was converted to run via a callback that executes on the high-priority work queue.
Squashed commit of the following:

    Fix up some final compile isses.

    net/netdev:  Convert the network down notification logic to use the new wqueue-based notification factility.

    net/udp:  Convert the UDP readahead notification logic to use the new wqueue-based notification factility.

    net/tcp:  Convert the TCP readahead notification logic to use the new wqueue-based notification factility.

    mm/iob:  Convert the IOB notification logic to use the new wqueue-based notification factility.

    sched/wqueue:  Signals are not good IPCs to support the target poll functionality for several reasons including the amount of data that can be passed with a signal and in the fact that in protected and kernel modes, user threads executing signal handlers in protected, kernel memory is problematic.  Instead, convert the same logic to perform the notifications via function callback on the high priority work queue.
2018-09-09 15:01:44 -06:00
Gregory Nutt
32e3e51678 net/netdev: Add signal notification for the case where the network goes down. 2018-09-09 10:39:25 -06:00
Gregory Nutt
28f73bd928 net/tcp and udp: Add logic to signal events when TCP or UDP read-ahead data is buffered.
Squashed commit of the following:

    net/tcp:  Add signal notification for the case when UDP read-ahead data is buffered.  This is basically of clone of the TCP notification logic with naming adapted for UDP.

    net/tcp:  Add signal notification for the case when TCP read-ahead data is buffered.
2018-09-09 09:21:39 -06:00
Gregory Nutt
e59b26370d Squashed commit of the following:
Fix a few typo/compilation problems.
    net/:  Remove all CONFIG_NET_xxx_TCP_RECVWNDO configuration variables.  They were used only to initialize the d_recwndo of the network device structure which no longer exists.
    net/:  Remove the device TCP receive window field (d_recvwndo) from the device structure.  That value is no longer retained, but is calculated dynamically.
    Remove some dangling references to CONFIG_NET_TCP_RWND_CONTROL.
    net/tcp:  Take read-ahead throttling into account when calculating the TCP receive window size.
    net/tcp: tcp_get_recvwindow() now returns the receive window size directly (vs. indirectly via the device structure).
    net/tcp:  Remove CONFIG_NET_TCP_RWND_CONTROL.  TCP window algorithm is now trigged only by CONFIG_NET_TCP_READAHEAD.
2018-07-01 07:59:33 -06:00
Gregory Nutt
0786b5d053 net/tcp: Re-think CONFIG_NET_TCP_RWND_CONTROL TCP windowing controls. 2018-06-24 14:46:12 -06:00
Gregory Nutt
433f29eea2 net/: Rename CONFIG_TCP_REASSEMBLY to CONFIG_IPv4_REASSEMBLY. Add some fixes to get a clen compile with CONFIG_IPv4_REASSEMBLY enabled. There are several problems with the current implementation: It is untested (and depends on CONFIG_EXPERMIMENTAL). It uses some Ethernet specific definitions (and depends on CONFIG_NET_ETHERNET). There is only a single reassembly buffer. The last two issues prevent use of this feature in any context where IPv4 packets may be reassembled for multiple network devices concurrently). 2018-06-24 12:06:12 -06:00
Gregory Nutt
668df010ec Committed defconfigs for working configurations should never have CONFIG_EXPERIMENTAL set because the opens the doors for untested and incomplete configurations. Conversely, if there are released configurations that use features with dependencies on CONFIG_EXPERIMENTAL, then those configurations are in use and those dependencies should be removed:
graphics/vnc/server/Kconfig:  Remove a dependency on CONFIG_EXPERIMENTAL
net/tcp/Kconfig:  Remove a dependency on CONFIG_EXPERIMENTAL
wireless/bluetooth/Kconfig:  Remove a dependency on CONFIG_EXPERIMENTAL

configs/lc823450-xgevk/audio/defconfig:  Remove CONFIG_EXPERIMENTAL=y
configs/lc823450-xgevk/bt/defconfig:  Remove CONFIG_EXPERIMENTAL=y
configs/lc823450-xgevk/ipl2/defconfig:  Remove CONFIG_EXPERIMENTAL=y
configs/lc823450-xgevk/nsh/defconfig:  Remove CONFIG_EXPERIMENTAL=y
configs/lc823450-xgevk/rndis/defconfig:  Remove CONFIG_EXPERIMENTAL=y
configs/lc823450-xgevk/usb/defconfig:  Remove CONFIG_EXPERIMENTAL=y
configs/lpcxpresso-lpc54628/netnsh/defconfig:  Remove CONFIG_EXPERIMENTAL=y
configs/moxa/nsh/defconfig:  Remove CONFIG_EXPERIMENTAL=y
configs/olimex-stm32-p407/module/defconfig:  Remove CONFIG_EXPERIMENTAL=y
configs/photon/wlan/defconfig:  Remove CONFIG_EXPERIMENTAL=y
configs/sabre-6quad/smp/defconfig:  Remove CONFIG_EXPERIMENTAL=y
configs/sam4cmp-db/nsh/defconfig:  Remove CONFIG_EXPERIMENTAL=y
configs/sama5d4-ek/elf/defconfig:  Remove CONFIG_EXPERIMENTAL=y
configs/sama5d4-ek/knsh/defconfig:  Remove CONFIG_EXPERIMENTAL=y
configs/samv71-xult/module/defconfig:  Remove CONFIG_EXPERIMENTAL=y
configs/samv71-xult/vnc/defconfig:  Remove CONFIG_EXPERIMENTAL=y
configs/samv71-xult/vnxwm/defconfig:  Remove CONFIG_EXPERIMENTAL=y
configs/sim/bluetooth/defconfig:  Remove CONFIG_EXPERIMENTAL=y
configs/sim/pf_ieee802154/defconfig:  Remove CONFIG_EXPERIMENTAL=y
configs/sim/pktradio/defconfig:  Remove CONFIG_EXPERIMENTAL=y
configs/sim/sixlowpan/defconfig:  Remove CONFIG_EXPERIMENTAL=y
configs/sim/traveler/defconfig:  Remove CONFIG_EXPERIMENTAL=y
configs/sim/userfs/defconfig:  Remove CONFIG_EXPERIMENTAL=y
configs/stm32f4discovery/hciuart/defconfig:  Remove CONFIG_EXPERIMENTAL=y
configs/stm32f4discovery/pseudoterm/defconfig:  Remove CONFIG_EXPERIMENTAL=y
configs/teensy-3.x/usbnsh/defconfig:  Remove CONFIG_EXPERIMENTAL=y
2018-06-17 10:30:01 -06:00
Gregory Nutt
251924a734 Squashed commit of the following:
net/tcp:  Add logic to send probes when SO_KEEPALIVE is enabled.
    net/tcp:  TCP socket should not have to be connected to configure KeepAlive.
    net/: Add a separate configuration to enable/disable KEEPALIVE socket options.
    net/tcp: Arguments to TCP keep-alive timing functions probably should be struct timeval as are the times for other time-related socket options.
    net/tcp:  Fix a backward conditional
    net/tcp:  Add some more checks and debug output to TCP-protocol socket options.
    net/tcp:  Cosmetic changes to some alignment.
    net/:  Adds socket options needed to manage TCP-keepalive and TCP state machine logic to detect if that the remote peer is alive.  Still missing the timer poll logic to send the keep-alive probes and the state machine logic to respond to probes.
2018-03-12 10:59:46 -06:00
Gregory Nutt
fef255e5be This commit adds an as-of-yet untested implemented of UDP write buffering.
Squashed commit of the following:

    net/udp:  Address most of the issues with UDP write buffering.  There is a remaining issue with handling one network going down in a multi-network environment.  None of this has been test but it is certainly ready for test.  Hence, the feature is marked EXPERIMENTAL.
    net/udp:  Some baby steps toward a corrected write buffering design.
    net/udp:  Remove pesky write buffer macros.
    Eliminate trailing space at the end of lines.
    net/udp:  A little more UDP write buffering logic.  Still at least on big gaping hole in the design.
    net/udp:  Undefined CONFIG_NET_SENDTO_TIMEOUT.
    net/udp:  Crude, naive port of the TCP write buffering logic into UDP.  This commit is certainly non-functional and is simply a starting point for the implementatin of UDP write buffering.
    net/udp:  Rename udp/udp_psock_sendto.c udp/udp_psock_sendto_unbuffered.c.
2018-01-22 18:32:02 -06:00
Masayuki Ishikawa
30070b06df Merged in masayuki2009/nuttx.nuttx/tcp_rcvwnd_control (pull request #555)
net/tcp: Introduce tcp receive window control based on I/O buffer

NOTE: The algorithm is still experimental but useful for http streaming.

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>

Approved-by: Gregory Nutt <gnutt@nuttx.org>
2017-12-18 12:11:52 +00:00
Gregory Nutt
2043e1a114 IOBs: Move from driver/iob to a better location in mm/iob 2017-05-09 07:35:30 -06:00
Gregory Nutt
bcc6b61fc1 Move include/nuttx/net/iob.h to include/drivers/iob.h; rename CONFIG_NET_IOB to CONFIG_DRIVERS_IOB 2017-04-20 14:53:30 -06:00
Jussi Kivilinna
cd3c9634c8 Add user-space networking stack API (usrsock)
User-space networking stack API allows user-space daemon to
provide TCP/IP stack implementation for NuttX network.

Main use for this is to allow use and seamless integration of
HW-provided TCP/IP stacks to NuttX.

For example, user-space daemon can translate /dev/usrsock
API requests to HW TCP/IP API requests while rest of the
user-space can access standard socket API, with socket
descriptors that can be used with NuttX system calls.
2017-03-31 08:58:14 -06:00
Gregory Nutt
1cdc746726 Rename CONFIG_DEBUG to CONFIG_DEBUG_FEATURES 2016-06-11 14:14:08 -06:00
Gregory Nutt
342f5fe33d Fix references to the no-longer-existent misc/ directory in comments, README files, and documentation 2015-06-28 08:08:57 -06:00
Gregory Nutt
859748a94e Completes conversion of CONFIG_NET_BUFIZE to CONFIG_NET_ETH/SLIP_MTU 2014-11-16 09:22:38 -06:00
Gregory Nutt
1f11a452dd NET: Add a few missing configuration options to the Kconfig files 2014-07-06 13:04:27 -06:00
Gregory Nutt
579ee6f573 Clean-up packet socket naming 2014-06-25 10:34:52 -06:00
Gregory Nutt
fabcb6d37e TCP Read-Ahead: Convert to use I/O buffer chains 2014-06-24 15:38:00 -06:00
Gregory Nutt
e9a588c398 Add throttle support to the I/O buffer logic 2014-06-24 11:53:19 -06:00
Gregory Nutt
7330704d36 CONFIG_NET_PKT is compatible with current TCP writebuffering logic because the share too much code; move sending of packet socket data from net_send_unbufferer.c to a new uip/uip_pktsend.c file for consistency 2014-06-23 19:25:16 -06:00
Gregory Nutt
6f1651d5f2 TCP write buffering: Extend and fix some buffer dumping logic 2014-06-22 18:53:18 -06:00
Gregory Nutt
d642616c5b TCP write buffering: Fix an error in the trim logic 2014-06-22 16:25:26 -06:00
Gregory Nutt
356d25b503 First cut at conversion of write-buffering to use I/O buffer chaings (IOBs) 2014-06-22 11:27:57 -06:00
Gregory Nutt
b9c6b9b425 Networking: Move relevant parts of net/Kconfig to tcp/Kconfig, udp/Kconfig, and pkt/Kconfig 2014-06-18 11:45:55 -06:00