You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2022/01/04 06:46:30 UTC

[GitHub] [incubator-nuttx-apps] a-lunev opened a new pull request #952: netutils/netcat: implemented NETUTILS_NETCAT_SENDFILE option.

a-lunev opened a new pull request #952:
URL: https://github.com/apache/incubator-nuttx-apps/pull/952


   ## Summary
   
   This option enables using sendfile() in netcat client mode if a normal file (not stdin) is sent.
   If the option is enabled but stdin is sent rather than a normal file, netcat falls back to the combination of read() and write().
   Using sendfile() provides a higher performance compared to the combination of read() and write().
   
   Also this option is useful for testing / debugging tcp_sendfile() functionality of NuttX TCP/IP stack.
   
   ## Impact
   
   netutils/netcat
   
   ## Testing
   
   Build NuttX:
   ```
   $ ./tools/configure.sh -l sim:tcpblaster
   $ make menuconfig (enable CONFIG_NETUTILS_NETCAT_SENDFILE, enable / disable CONFIG_NET_TCP_WRITE_BUFFERS)
   $ make
   ```
   Enable TUN/TAP on Linux host:
   ```
   $ sudo setcap cap_net_admin+ep ./nuttx
   $ sudo ./tools/simhostroute.sh wlan0 on
   ```
   Run netcat server on Linux host:
   `$ netcat -l -p 31337`
   
   Run NuttX on Linux host:
   ```
   $ ./nuttx
   NuttShell (NSH) NuttX-10.2.0
   nsh> ifconfig eth0 10.0.1.2
   nsh> ifup eth0
   ifup eth0...OK
   ```
   Start Wireshark (or tcpdump) and capture appeared tap0 interface.
   
   Run in NuttX:
   ```
   nsh> dd if=/dev/zero of=/tmp/test.bin count=1000
   nsh> netcat LINUX_HOST_IP_ADDRESS 31337 /tmp/test.bin
   ```
   Observe TCP dump.
   
   Shutdown NuttX:
   `nsh> poweroff`
   
   Disable TUN/TAP on Linux host:
   `$ sudo ./tools/simhostroute.sh wlan0 off`


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



[GitHub] [incubator-nuttx-apps] xiaoxiang781216 commented on a change in pull request #952: netutils/netcat: implemented NETUTILS_NETCAT_SENDFILE option.

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on a change in pull request #952:
URL: https://github.com/apache/incubator-nuttx-apps/pull/952#discussion_r777975346



##########
File path: netutils/netcat/Kconfig
##########
@@ -47,4 +47,16 @@ config NETUTILS_NETCAT_STACKSIZE
 	int "netcat stack size"
 	default DEFAULT_TASK_STACKSIZE
 
+config NETUTILS_NETCAT_SENDFILE
+	bool "Use sendfile() in netcat when possible"
+	default n

Review comment:
       should we turn on this by default?




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



[GitHub] [incubator-nuttx-apps] a-lunev edited a comment on pull request #952: netutils/netcat: implemented NETUTILS_NETCAT_SENDFILE option.

Posted by GitBox <gi...@apache.org>.
a-lunev edited a comment on pull request #952:
URL: https://github.com/apache/incubator-nuttx-apps/pull/952#issuecomment-1005114071


   > @a-lunev do you have any perf number with/without this feature?
   
   Based on the current state of sim:tcpblaster config, the results are as follow:
   
   1. CONFIG_NET_TCP_WRITE_BUFFERS=n, CONFIG_NETUTILS_NETCAT_SENDFILE=n, file size is 500 KB, the payload throughput is 205 Kbit/s.
   
   2.a. CONFIG_NET_TCP_WRITE_BUFFERS=n, CONFIG_NETUTILS_NETCAT_SENDFILE=y, file size is 500 KB, the payload throughput is 4.1 Mbit/s.
   
   2.b. CONFIG_NET_TCP_WRITE_BUFFERS=n, CONFIG_NETUTILS_NETCAT_SENDFILE=y, file size is 1000 KB, the payload throughput is 8.19 Mbit/s.
   
   3. CONFIG_NET_TCP_WRITE_BUFFERS=y, CONFIG_NETUTILS_NETCAT_SENDFILE=n, file size is 500 KB, the payload throughput is 36.7 Kbit/s.
   
   4. CONFIG_NET_TCP_WRITE_BUFFERS=y, CONFIG_NETUTILS_NETCAT_SENDFILE=y, file size is 500 KB, the payload throughput is 4.1 Mbit/s.
   
   If CONFIG_NETUTILS_NETCAT_SENDFILE=y is enabled, the larger file size, the higher speed.


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



[GitHub] [incubator-nuttx-apps] xiaoxiang781216 commented on pull request #952: netutils/netcat: implemented NETUTILS_NETCAT_SENDFILE option.

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on pull request #952:
URL: https://github.com/apache/incubator-nuttx-apps/pull/952#issuecomment-1005394912


   The performance improvement is amazing!


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



[GitHub] [incubator-nuttx-apps] xiaoxiang781216 commented on pull request #952: netutils/netcat: implemented NETUTILS_NETCAT_SENDFILE option.

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on pull request #952:
URL: https://github.com/apache/incubator-nuttx-apps/pull/952#issuecomment-1004693194


   @a-lunev do you have any perf number with/without this feature?


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



[GitHub] [incubator-nuttx-apps] a-lunev edited a comment on pull request #952: netutils/netcat: implemented NETUTILS_NETCAT_SENDFILE option.

Posted by GitBox <gi...@apache.org>.
a-lunev edited a comment on pull request #952:
URL: https://github.com/apache/incubator-nuttx-apps/pull/952#issuecomment-1005114071


   > @a-lunev do you have any perf number with/without this feature?
   
   1. CONFIG_NET_TCP_WRITE_BUFFERS=n, CONFIG_NETUTILS_NETCAT_SENDFILE=n, file size is 500 KB, the payload throughput is 205 Kbit/s.
   
   2.a. CONFIG_NET_TCP_WRITE_BUFFERS=n, CONFIG_NETUTILS_NETCAT_SENDFILE=y, file size is 500 KB, the payload throughput is 4.1 Mbit/s.
   
   2.b. CONFIG_NET_TCP_WRITE_BUFFERS=n, CONFIG_NETUTILS_NETCAT_SENDFILE=y, file size is 1000 KB, the payload throughput is 8.19 Mbit/s.
   
   3. CONFIG_NET_TCP_WRITE_BUFFERS=y, CONFIG_NETUTILS_NETCAT_SENDFILE=n, file size is 500 KB, the payload throughput is 36.7 Kbit/s.
   
   4. CONFIG_NET_TCP_WRITE_BUFFERS=y, CONFIG_NETUTILS_NETCAT_SENDFILE=y, file size is 500 KB, the payload throughput is 4.1 Mbit/s.
   
   If CONFIG_NETUTILS_NETCAT_SENDFILE=y is enabled, the larger file size, the higher speed.


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



[GitHub] [incubator-nuttx-apps] a-lunev commented on a change in pull request #952: netutils/netcat: implemented NETUTILS_NETCAT_SENDFILE option.

Posted by GitBox <gi...@apache.org>.
a-lunev commented on a change in pull request #952:
URL: https://github.com/apache/incubator-nuttx-apps/pull/952#discussion_r778423033



##########
File path: netutils/netcat/Kconfig
##########
@@ -47,4 +47,16 @@ config NETUTILS_NETCAT_STACKSIZE
 	int "netcat stack size"
 	default DEFAULT_TASK_STACKSIZE
 
+config NETUTILS_NETCAT_SENDFILE
+	bool "Use sendfile() in netcat when possible"
+	default n

Review comment:
       Good. Let's turn it on by default (I have changed it).




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



[GitHub] [incubator-nuttx-apps] a-lunev commented on pull request #952: netutils/netcat: implemented NETUTILS_NETCAT_SENDFILE option.

Posted by GitBox <gi...@apache.org>.
a-lunev commented on pull request #952:
URL: https://github.com/apache/incubator-nuttx-apps/pull/952#issuecomment-1005114071


   > @a-lunev do you have any perf number with/without this feature?
   
   1. CONFIG_NET_TCP_WRITE_BUFFERS=n, CONFIG_NETUTILS_NETCAT_SENDFILE=n, transmitted file size is 500 KB, the payload throughput is 205 Kbit/s.
   
   2.a. CONFIG_NET_TCP_WRITE_BUFFERS=n, CONFIG_NETUTILS_NETCAT_SENDFILE=y, transmitted file size is 500 KB, the payload throughput is 4.1 Mbit/s.
   
   2.b. CONFIG_NET_TCP_WRITE_BUFFERS=n, CONFIG_NETUTILS_NETCAT_SENDFILE=y, transmitted file size is 1000 KB, the payload throughput is 8.19 Mbit/s.
   
   3. CONFIG_NET_TCP_WRITE_BUFFERS=y, CONFIG_NETUTILS_NETCAT_SENDFILE=n, transmitted file size is 500 KB, the payload throughput is 36.7 Kbit/s.
   
   4. CONFIG_NET_TCP_WRITE_BUFFERS=y, CONFIG_NETUTILS_NETCAT_SENDFILE=y, transmitted file size is 500 KB, the payload throughput is 4.1 Mbit/s.
   
   If CONFIG_NETUTILS_NETCAT_SENDFILE=y is enabled, the larger file size, the higher speed.


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



[GitHub] [incubator-nuttx-apps] xiaoxiang781216 merged pull request #952: netutils/netcat: implemented NETUTILS_NETCAT_SENDFILE option.

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 merged pull request #952:
URL: https://github.com/apache/incubator-nuttx-apps/pull/952


   


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



[GitHub] [incubator-nuttx-apps] a-lunev commented on a change in pull request #952: netutils/netcat: implemented NETUTILS_NETCAT_SENDFILE option.

Posted by GitBox <gi...@apache.org>.
a-lunev commented on a change in pull request #952:
URL: https://github.com/apache/incubator-nuttx-apps/pull/952#discussion_r778423033



##########
File path: netutils/netcat/Kconfig
##########
@@ -47,4 +47,16 @@ config NETUTILS_NETCAT_STACKSIZE
 	int "netcat stack size"
 	default DEFAULT_TASK_STACKSIZE
 
+config NETUTILS_NETCAT_SENDFILE
+	bool "Use sendfile() in netcat when possible"
+	default n

Review comment:
       Good. Let's turn it on by default.




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