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/20 21:49:34 UTC

[GitHub] [incubator-nuttx] a-lunev opened a new pull request #5297: net/tcp/sendfile: removed excessive overwrites of conn->sndseq

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


   ## Summary
   
   conn->sndseq was updated in multiple places that was unreasonable and complicated.
   This RP is similar to the corresponding PR for tcp_send_unbuffered (#5102)
   
   ## Impact
   
   TCP
   
   ## Testing
   
   Build NuttX:
   ```
   $ ./tools/configure.sh -l sim:tcpblaster
   $ make menuconfig
   (enable/disable 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] a-lunev commented on pull request #5297: net/tcp/sendfile: removed excessive overwrites of conn->sndseq

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


   Force-pushed to restart as ci issue is fixed.


-- 
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] a-lunev commented on a change in pull request #5297: net/tcp/sendfile: removed excessive overwrites of conn->sndseq

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



##########
File path: net/tcp/tcp_input.c
##########
@@ -739,19 +737,24 @@ static void tcp_input(FAR struct net_driver_s *dev, uint8_t domain,
         }
 
 #ifdef CONFIG_NET_TCP_WRITE_BUFFERS
-      /* Update sequence number to the unacknowledge sequence number.  If
-       * there is still outstanding, unacknowledged data, then this will
-       * be beyond ackseq.
-       */
-
-      sndseq = tcp_getsequence(conn->sndseq);
-      if (TCP_SEQ_LT(sndseq, ackseq))
+#ifdef CONFIG_NET_SENDFILE
+      if (!conn->sendfile)
+#endif
         {
-          ninfo("sndseq: %08" PRIx32 "->%08" PRIx32
-                " unackseq: %08" PRIx32 " new tx_unacked: %" PRId32 "\n",
-                tcp_getsequence(conn->sndseq), ackseq, unackseq,
-                (uint32_t)conn->tx_unacked);
-          tcp_setsequence(conn->sndseq, ackseq);
+          /* Update sequence number to the unacknowledge sequence number. If
+           * there is still outstanding, unacknowledged data, then this will
+           * be beyond ackseq.
+           */
+
+          uint32_t sndseq = tcp_getsequence(conn->sndseq);
+          if (TCP_SEQ_LT(sndseq, ackseq))
+            {
+              ninfo("sndseq: %08" PRIx32 "->%08" PRIx32
+                    " unackseq: %08" PRIx32 " new tx_unacked: %" PRId32 "\n",

Review comment:
       Done.




-- 
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] pkarashchenko commented on a change in pull request #5297: net/tcp/sendfile: removed excessive overwrites of conn->sndseq

Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on a change in pull request #5297:
URL: https://github.com/apache/incubator-nuttx/pull/5297#discussion_r789445933



##########
File path: net/tcp/tcp_input.c
##########
@@ -739,19 +737,24 @@ static void tcp_input(FAR struct net_driver_s *dev, uint8_t domain,
         }
 
 #ifdef CONFIG_NET_TCP_WRITE_BUFFERS
-      /* Update sequence number to the unacknowledge sequence number.  If
-       * there is still outstanding, unacknowledged data, then this will
-       * be beyond ackseq.
-       */
-
-      sndseq = tcp_getsequence(conn->sndseq);
-      if (TCP_SEQ_LT(sndseq, ackseq))
+#ifdef CONFIG_NET_SENDFILE
+      if (!conn->sendfile)
+#endif
         {
-          ninfo("sndseq: %08" PRIx32 "->%08" PRIx32
-                " unackseq: %08" PRIx32 " new tx_unacked: %" PRId32 "\n",
-                tcp_getsequence(conn->sndseq), ackseq, unackseq,
-                (uint32_t)conn->tx_unacked);
-          tcp_setsequence(conn->sndseq, ackseq);
+          /* Update sequence number to the unacknowledge sequence number. If
+           * there is still outstanding, unacknowledged data, then this will
+           * be beyond ackseq.
+           */
+
+          uint32_t sndseq = tcp_getsequence(conn->sndseq);
+          if (TCP_SEQ_LT(sndseq, ackseq))
+            {
+              ninfo("sndseq: %08" PRIx32 "->%08" PRIx32
+                    " unackseq: %08" PRIx32 " new tx_unacked: %" PRId32 "\n",

Review comment:
       ```suggestion
                       " unackseq: %08" PRIx32 " new tx_unacked: %" PRIu32 "\n",
   ```




-- 
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] xiaoxiang781216 merged pull request #5297: net/tcp/sendfile: removed excessive overwrites of conn->sndseq

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


   


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