You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2021/11/04 18:33:08 UTC

[incubator-nuttx] 01/04: tcp_send_unbuffered.c: unifdef -UCONFIG_NET_TCP_SPLIT

This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit 1550a525e9659ef6b504b17675f6b0c1227dd36b
Author: YAMAMOTO Takashi <ya...@midokura.com>
AuthorDate: Wed Oct 13 10:47:03 2021 +0900

    tcp_send_unbuffered.c: unifdef -UCONFIG_NET_TCP_SPLIT
---
 net/tcp/tcp_send_unbuffered.c | 93 -------------------------------------------
 1 file changed, 93 deletions(-)

diff --git a/net/tcp/tcp_send_unbuffered.c b/net/tcp/tcp_send_unbuffered.c
index d487318..359da8c 100644
--- a/net/tcp/tcp_send_unbuffered.c
+++ b/net/tcp/tcp_send_unbuffered.c
@@ -67,9 +67,6 @@
 #  define NEED_IPDOMAIN_SUPPORT 1
 #endif
 
-#if defined(CONFIG_NET_TCP_SPLIT) && !defined(CONFIG_NET_TCP_SPLIT_SIZE)
-#  define CONFIG_NET_TCP_SPLIT_SIZE 40
-#endif
 
 #define TCPIPv4BUF ((struct tcp_hdr_s *)&dev->d_buf[NET_LL_HDRLEN(dev) + IPv4_HDRLEN])
 #define TCPIPv6BUF ((struct tcp_hdr_s *)&dev->d_buf[NET_LL_HDRLEN(dev) + IPv6_HDRLEN])
@@ -92,9 +89,6 @@ struct send_s
   ssize_t                 snd_sent;    /* The number of bytes sent */
   uint32_t                snd_isn;     /* Initial sequence number */
   uint32_t                snd_acked;   /* The number of bytes acked */
-#if defined(CONFIG_NET_TCP_SPLIT)
-  bool                    snd_odd;     /* True: Odd packet in pair transaction */
-#endif
 };
 
 /****************************************************************************
@@ -249,13 +243,6 @@ static uint16_t tcpsend_eventhandler(FAR struct net_driver_s *dev,
 
       pstate->snd_sent = pstate->snd_acked;
 
-#if defined(CONFIG_NET_TCP_SPLIT)
-      /* Reset the even/odd indicator to even since we need to
-       * retransmit.
-       */
-
-      pstate->snd_odd = false;
-#endif
 
       /* Fall through to re-send data from the last that was ACKed */
     }
@@ -314,86 +301,6 @@ static uint16_t tcpsend_eventhandler(FAR struct net_driver_s *dev,
 
       uint32_t sndlen = pstate->snd_buflen - pstate->snd_sent;
 
-#if defined(CONFIG_NET_TCP_SPLIT)
-
-      /* RFC 1122 states that a host may delay ACKing for up to 500ms but
-       * must respond to every second  segment).  This logic here will trick
-       * the RFC 1122 recipient into responding sooner.  This logic will be
-       * activated if:
-       *
-       *   1. An even number of packets has been send (where zero is an even
-       *      number),
-       *   2. There is more data be sent (more than or equal to
-       *      CONFIG_NET_TCP_SPLIT_SIZE), but
-       *   3. Not enough data for two packets.
-       *
-       * Then we will split the remaining, single packet into two partial
-       * packets.  This will stimulate the RFC 1122 peer to ACK sooner.
-       *
-       * Don't try to split very small packets (less than
-       * CONFIG_NET_TCP_SPLIT_SIZE).  Only the first even packet and the
-       * last odd packets could have sndlen less than
-       * CONFIG_NET_TCP_SPLIT_SIZE.  The value of sndlen on the last even
-       * packet is guaranteed to be at least MSS / 2 by the logic below.
-       */
-
-      if (sndlen >= CONFIG_NET_TCP_SPLIT_SIZE)
-        {
-          /* sndlen is the number of bytes remaining to be sent.
-           * conn->mss will provide the number of bytes that can sent
-           * in one packet.  The difference, then, is the number of bytes
-           * that would be sent in the next packet after this one.
-           */
-
-          int32_t next_sndlen = sndlen - conn->mss;
-
-          /*  Is this the even packet in the packet pair transaction? */
-
-          if (!pstate->snd_odd)
-            {
-              /* next_sndlen <= 0 means that the entire remaining data
-               * could fit into this single packet.  This is condition
-               * in which we must do the split.
-               */
-
-              if (next_sndlen <= 0)
-                {
-                  /* Split so that there will be an odd packet.  Here
-                   * we know that 0 < sndlen <= MSS
-                   */
-
-                  sndlen = (sndlen / 2) + 1;
-                }
-            }
-
-          /* No... this is the odd packet in the packet pair transaction */
-
-          else
-            {
-              /* Will there be another (even) packet after this one?
-               * (next_sndlen > 0)  Will the split condition occur on that
-               * next, even packet? ((next_sndlen - conn->mss) < 0) If
-               * so, then perform the split now to avoid the case where the
-               * byte count is less than CONFIG_NET_TCP_SPLIT_SIZE on the
-               * next pair.
-               */
-
-              if (next_sndlen > 0 && (next_sndlen - conn->mss) < 0)
-                {
-                  /* Here, we know that sndlen must be MSS < sndlen <= 2*MSS
-                   * and so (sndlen / 2) is <= MSS.
-                   */
-
-                  sndlen /= 2;
-                }
-            }
-        }
-
-      /* Toggle the even/odd indicator */
-
-      pstate->snd_odd ^= true;
-
-#endif /* CONFIG_NET_TCP_SPLIT */
 
       if (sndlen > conn->mss)
         {