You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by "PetteriAimonen (via GitHub)" <gi...@apache.org> on 2023/12/15 19:19:17 UTC

[PR] tcp: Recover from iob shortage with TCP_WRITE_BUFFERS [nuttx]

PetteriAimonen opened a new pull request, #11406:
URL: https://github.com/apache/nuttx/pull/11406

   ## Summary
   
   When `CONFIG_NET_TCP_WRITE_BUFFERS` is enabled, iobs are used for both queuing data from application, and for assembling packets for sending. If there is a system-wide shortage of iobs, it could happen that there is not enough free space to form any packets to send. The buffers allocated for TCP data also can't be released until the packet is sent.
   
   Normally this should be avoided by setting suitable values for `CONFIG_IOB_NBUFFERS` and `CONFIG_IOB_THROTTLE`. The default values are ok for light usage, but can run out when using multiple simultaneous TCP streams.
   
   Before this commit, iob shortage would cause TCP connections to get stuck and eventually timeout. With this change, TCP stack sends smaller packets, eventually freeing some buffers from the write queue.
   
   ## Impact
   
   In normal usage no effect. If system is running out of io buffers, TCP packet sizes will be smaller than maximum but will be sent sooner. If network warnings are enabled, notice is printed about this.
   
   ## Testing
   
   Problem first noticed on custom STM32F417 board when network performance testing with the default configuration:
   
       CONFIG_IOB_NBUFFERS=36
       CONFIG_IOB_THROTTLE=8
       CONFIG_IOB_BUFSIZE=196
       CONFIG_NET_SEND_BUFSIZE=3000
   
   Originally the TCP connection stopped transferring after a few tens of megabytes. Closing and reopening a new connection still worked. Debugger showed that there were 7 free buffers (1372 bytes), while `psock_send_eventhandler()` was trying to send the MSS of 1440 bytes. `devif_iob_send()` then returned `ENOMEM` and same thing repeated next time around.
   
   With this change the connection recovered from buffer shortage and continued transferring.


-- 
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


Re: [PR] tcp: Recover from iob shortage with TCP_WRITE_BUFFERS [nuttx]

Posted by "xiaoxiang781216 (via GitHub)" <gi...@apache.org>.
xiaoxiang781216 merged PR #11406:
URL: https://github.com/apache/nuttx/pull/11406


-- 
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