wenquan2015 commented on code in PR #22000:
URL: https://github.com/apache/nuttx/pull/22000#discussion_r4628010670


##########
net/tcp/tcp_callback.c:
##########
@@ -386,6 +386,15 @@ uint16_t tcp_datahandler(FAR struct net_driver_s *dev,
   FAR struct iob_s *iob = dev->d_iob;
   uint16_t buflen;
 
+#if CONFIG_IOB_THROTTLE > 0

Review Comment:
     The throttle check in tcp_datahandler() assumes that the send callback has 
already processed the ACK and freed the acknowledged write buffers before this 
point. However, the callback execution order in devif_conn_event() depends on 
the registration order in conn->sconn.s_list,
     and the recv callback can run before the send callback.
   
     When a segment carries both ACK and DATA and the recv callback fires first:
   
     1. tcp_data_event() → tcp_datahandler() runs the throttle check
     2. iob_navail(false) < CONFIG_IOB_THROTTLE → data is dropped
     3. The send callback runs later → frees ACKed write buffers → IOBs return 
to the pool
   
     The IOBs that would have been released by the ACK are still held at the 
time of the throttle check, causing unnecessary data drops and retransmissions.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to