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/nuttx.git
The following commit(s) were added to refs/heads/master by this push:
new af6db95fea tcp: fix tcp can not retransmit timely when ACK with
TCP_NEWDATA
af6db95fea is described below
commit af6db95fea661d79e831bd6ce984fa8fad0d741b
Author: zhanghongyu <[email protected]>
AuthorDate: Fri Nov 8 10:37:52 2024 +0800
tcp: fix tcp can not retransmit timely when ACK with TCP_NEWDATA
The current receive data needs to be handled by following
tcp_recvhandler or tcp_data_event. Notify driver to send the
message and marked as rexmit
Signed-off-by: zhanghongyu <[email protected]>
---
net/tcp/tcp_send_buffered.c | 22 +++++++++++++++-------
1 file changed, 15 insertions(+), 7 deletions(-)
diff --git a/net/tcp/tcp_send_buffered.c b/net/tcp/tcp_send_buffered.c
index 02281861b6..de2533110d 100644
--- a/net/tcp/tcp_send_buffered.c
+++ b/net/tcp/tcp_send_buffered.c
@@ -593,18 +593,26 @@ static uint16_t psock_send_eventhandler(FAR struct
net_driver_s *dev,
#ifdef CONFIG_NET_TCP_CC_NEWRENO
if (conn->dupacks >= TCP_FAST_RETRANSMISSION_THRESH)
#else
- /* Reset the duplicate ack counter */
-
- if ((flags & TCP_NEWDATA) != 0)
- {
- TCP_WBNACK(wrb) = 0;
- }
-
/* Duplicate ACK? Retransmit data if need */
if (++TCP_WBNACK(wrb) == TCP_FAST_RETRANSMISSION_THRESH)
#endif
{
+ /* Fast retransmission has been triggered */
+
+ if ((flags & TCP_NEWDATA) != 0)
+ {
+ /* The current receive data needs to be handled by
+ * following tcp_recvhandler or tcp_data_event. Notify
+ * driver to send the message and marked as rexmit
+ */
+
+ TCP_WBNACK(wrb) = 0;
+ conn->timeout = true;
+ netdev_txnotify_dev(conn->dev);
+ return flags;
+ }
+
#ifdef CONFIG_NET_TCP_SELECTIVE_ACK
if ((conn->flags & TCP_SACK) &&
(tcp->tcpoffset & 0xf0) > 0x50)