You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2022/01/21 23:24:50 UTC

[GitHub] [incubator-nuttx] pkarashchenko commented on a change in pull request #5311: net/tcp/sendfile: fast retransmit on duplicate acknowledgments (RFC 5681)

pkarashchenko commented on a change in pull request #5311:
URL: https://github.com/apache/incubator-nuttx/pull/5311#discussion_r790054971



##########
File path: net/tcp/tcp_sendfile.c
##########
@@ -242,13 +252,14 @@ static uint16_t sendfile_eventhandler(FAR struct net_driver_s *dev,
         }
 #endif /* CONFIG_NET_IPv4 */
 
-      /* The current acknowledgement number number is the (relative) offset
+      /* The current acknowledgement number is the (relative) offset
        * of the of the next byte needed by the receiver.  The snd_isn is the
        * offset of the first byte to send to the receiver.  The difference
        * is the number of bytes to be acknowledged.
        */
 
-      pstate->snd_acked = TCP_SEQ_SUB(tcp_getsequence(tcp->ackno),
+      ackno = tcp_getsequence(tcp->ackno);
+      pstate->snd_acked = TCP_SEQ_SUB(ackno,

Review comment:
       can we combine to a singe line now?

##########
File path: net/tcp/tcp_sendfile.c
##########
@@ -264,15 +275,42 @@ static uint16_t sendfile_eventhandler(FAR struct net_driver_s *dev,
           goto end_wait;
         }
 
-      /* No. Fall through to send more data if necessary */
+      /* Fast Retransmit (RFC 5681): an acknowledgment is considered a
+       * "duplicate" when (a) the receiver of the ACK has outstanding data,
+       * (b) the incoming acknowledgment carries no data, (c) the SYN and
+       * FIN bits are both off, (d) the acknowledgment number is equal to
+       * the greatest acknowledgment received on the given connection
+       * and (e) the advertised window in the incoming acknowledgment equals
+       * the advertised window in the last incoming acknowledgment.
+       */
+
+      if (pstate->snd_acked < pstate->snd_sent &&
+          (flags & TCP_NEWDATA) == 0 &&
+          (tcp->flags & (TCP_SYN | TCP_FIN)) == 0 &&
+          ackno == pstate->snd_prev_ack &&
+          conn->snd_wnd == pstate->snd_prev_wnd)
+        {
+          if (++pstate->snd_dup_acks >=

Review comment:
       Should we carry for rollover here?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org