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

   *Note: Please adhere to [Contributing 
Guidelines](https://github.com/apache/nuttx/blob/master/CONTRIBUTING.md).*
   
   ## Summary
   
   Addresses this issue: https://github.com/apache/nuttx/issues/17299
   
   The Kconfig option CONFIG_IOB_THROTTLE is used to limit the amount allocated 
by TCP (and UDP) receives as to not starve sends. This distinction is made via 
a 'throttle' argument passed to the iob_*alloc functions, which are wrapped by 
net_iob*alloc. Previously the udp/tcp_wrbuffer_write functions incorrectly 
allocate with throttle=true, effectively making the IOB_THROTTLE option useless.
   
   This patch modifies the calls in udp/tcp_wrbuffer_write to allocate 
unthrottled, and fixes an unthrottled allocation in the TCP receive path.
   
   There were also several locations in the receive path that incorrectly 
allocated unthrottled.
   
   ## Impact
   
   This should not have an effect during normal operation. This change is only 
in effect when CONFIG_IOB_THROTTLE > 0 and there's high reception load. In that 
case the system should keep operating and not deadlock on a sendto() call on a 
blocking socket without timeout.
   
   ## Testing
   
   I ran `iperf -s -B 10.0.1.2 -u &` in the simulator target with the other end 
`iperf -c -b 100M ...` on the host machine while periodically executing `cat 
/proc/iobinfo` to check the state of the IOB MM. The sim target is compiled 
with CONFIG_IOB_THROTTLE=128
   
   When compiled from master, I get (worst-case):
   ```
   nsh> cat /proc/iobinfo   3.01-   6.02 sec   29767500 Bytes   79.12 Mbits/sec
   
       ntotal     nfree     nwait nthrottle
         1024         5         0         0
   nsh> cat /proc/iobinfo
       ntotal     nfree     nwait nthrottle
         1024         5         0         0
   nsh> cat /proc/iobinfo
       ntotal     nfree     nwait nthrottle
         1024         5         0         0
   nsh> cat /proc/iobinfo
       ntotal     nfree     nwait nthrottle
         1024         5         0         0
   ```
   Here you can see that nfree < CONFIG_IOB_THROTTLE(=128) even though only the 
receive path is exercised.
   
   After the changes the worst-case is:
   ```
   nsh> cat /proc/iobinfo
       ntotal     nfree     nwait nthrottle
         1024      1024         0       896
   nsh> cat /proc/iobinfo   3.01-   6.02 sec   26019000 Bytes   69.15 Mbits/sec
   
       ntotal     nfree     nwait nthrottle
         1024       134         0         6
   nsh> cat /proc/iobinfo
       ntotal     nfree     nwait nthrottle
         1024       134         0         6
   ```
   So nfree > CONFIG_IOB_THROTTLE.
   
   
   There are still several places in other drivers that don't respect the 
throttle parameter e.g. drivers/wireless/ieee802154/xbee/xbee.c:265
   


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