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

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

commit ea5d2c9ae49b3179c39ea91da4f3c40f4e30f158
Author: raiden00pl <[email protected]>
AuthorDate: Tue Nov 17 20:38:26 2026 +0100

    net/tcp: keep the throttled IOBs out of the read-ahead buffer.
    
    Since 34d2cde8a8f the read-ahead buffer keeps the IOBs of the received
    packet without IOB_THROTTLE, so received data can take the whole pool
    and no IOB is left to send or to refill a driver RX ring.  Drop the
    data while fewer than IOB_THROTTLE IOBs are free.
    
    Assisted-by: Claude Code:claude-opus-5-5
    Signed-off-by: raiden00pl <[email protected]>
---
 net/tcp/tcp_callback.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/net/tcp/tcp_callback.c b/net/tcp/tcp_callback.c
index 7f1303809a3..15e460a6d0a 100644
--- a/net/tcp/tcp_callback.c
+++ b/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
+  /* Keep the throttled IOBs for sending */
+
+  if (iob_navail(false) < CONFIG_IOB_THROTTLE)
+    {
+      return 0;
+    }
+#endif
+
   if (offset > 0)
     {
       /* Remove 'bufoff' bytes from the beginning of the input I/O chain */

Reply via email to