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 2023/01/13 05:50:45 UTC

[GitHub] [nuttx] anchao opened a new pull request, #8102: net/tcp: debug feature to drop the tx/rx packet

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

   
   ## Summary
   
   net/tcp: debug feature to drop the tx/rx packet
   
   Add 2 configurations
   1. Config to drop recived packet
   ```
   CONFIG_NET_TCP_DEBUG_DROP_RECV=y
   CONFIG_NET_TCP_DEBUG_DROP_RECV_PROBABILITY=50 /* Default drop probability is 1/50 */
   ```
   
   2. Config to drop sent packet
    
   ```
   CONFIG_NET_TCP_DEBUG_DROP_SEND=y
   CONFIG_NET_TCP_DEBUG_DROP_SEND_PROBABILITY=50 /* Default drop probability is 1/50 */
   ```
   
   Iperf2 client/server test on esp32c3:
   
   ```
   ---------------------------------------------------------
   |  TCP Config            | Server | Client |            |
   |-------------------------------------------------------|
   |  Original              |   12   |     9  |  Mbits/sec |
   |  Drop(1/50)            |  0.6   |   0.3  |  Mbits/sec |
   |  Drop(1/50) + OFO/SACK |    8   |     8  |  Mbits/sec | 
   ---------------------------------------------------------
   ```
   OFO/SACK depends on https://github.com/apache/nuttx/pull/8062
   
   Signed-off-by: chao an <an...@xiaomi.com>
   
   
   ## Impact
   
   N/A
   
   ## Testing
   
   


-- 
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] [nuttx] pkarashchenko commented on a diff in pull request #8102: net/tcp: debug feature to drop the tx/rx packet

Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on code in PR #8102:
URL: https://github.com/apache/nuttx/pull/8102#discussion_r1069115656


##########
net/tcp/tcp_input.c:
##########
@@ -628,6 +628,37 @@ static void tcp_input(FAR struct net_driver_s *dev, uint8_t domain,
 
   dev->d_len -= (len + iplen);
 
+#if defined(CONFIG_NET_STATISTICS) && \
+    defined(CONFIG_NET_TCP_DEBUG_DROP_RECV)
+
+#pragma message \
+  "CONFIG_NET_TCP_DEBUG_DROP_RECV is selected, this is debug " \
+  "feature to drop the tcp received packet on the floor, " \
+  "please confirm the configuration again if you do not want " \
+  "debug the TCP stack."
+
+  /* Debug feature to drop the tcp received packet on the floor */
+
+  if (dev->d_len > 0)
+    {
+      if ((g_netstats.tcp.recv %
+          CONFIG_NET_TCP_DEBUG_DROP_RECV_PROBABILITY) == 0)

Review Comment:
   It is not a probability :) but dropping each `CONFIG_NET_TCP_DEBUG_DROP_RECV_PROBABILITY`s packet.
   Maybe we can implement probability function as an improvement



-- 
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] [nuttx] anchao commented on a diff in pull request #8102: net/tcp: debug feature to drop the tx/rx packet

Posted by GitBox <gi...@apache.org>.
anchao commented on code in PR #8102:
URL: https://github.com/apache/nuttx/pull/8102#discussion_r1069297970


##########
net/tcp/tcp_input.c:
##########
@@ -628,6 +628,37 @@ static void tcp_input(FAR struct net_driver_s *dev, uint8_t domain,
 
   dev->d_len -= (len + iplen);
 
+#if defined(CONFIG_NET_STATISTICS) && \
+    defined(CONFIG_NET_TCP_DEBUG_DROP_RECV)
+
+#pragma message \
+  "CONFIG_NET_TCP_DEBUG_DROP_RECV is selected, this is debug " \
+  "feature to drop the tcp received packet on the floor, " \
+  "please confirm the configuration again if you do not want " \
+  "debug the TCP stack."
+
+  /* Debug feature to drop the tcp received packet on the floor */
+
+  if (dev->d_len > 0)
+    {
+      if ((g_netstats.tcp.recv %
+          CONFIG_NET_TCP_DEBUG_DROP_RECV_PROBABILITY) == 0)

Review Comment:
   Got!



-- 
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] [nuttx] xiaoxiang781216 commented on a diff in pull request #8102: net/tcp: debug feature to drop the tx/rx packet

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #8102:
URL: https://github.com/apache/nuttx/pull/8102#discussion_r1069092153


##########
net/tcp/tcp_send.c:
##########
@@ -575,6 +575,34 @@ void tcp_synack(FAR struct net_driver_s *dev, FAR struct tcp_conn_s *conn,
   /* Complete the common portions of the TCP message */
 
   tcp_sendcommon(dev, conn, tcp);
+
+#if defined(CONFIG_NET_STATISTICS) && \
+    defined(CONFIG_NET_TCP_DEBUG_DROP_SEND)
+
+#pragma message \
+  "CONFIG_NET_TCP_DEBUG_DROP_SEND is selected, this is debug " \
+  "feature to drop the tcp send packet on the floor, " \
+  "please confirm the configuration again if you do not want " \
+  "debug the TCP stack."
+
+  /* Debug feature to drop the tcp received packet on the floor */
+
+  if ((flags & TCP_PSH) != 0)
+    {
+      if ((g_netstats.tcp.sent %
+          CONFIG_NET_TCP_DEBUG_DROP_SEND_PROBABILITY) == 0)
+        {
+          uint32_t seq = tcp_getsequence(tcp->seqno);
+
+          syslog(1, "TCP DROP SNDPKT: "

Review Comment:
   ninfo



-- 
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] [nuttx] pkarashchenko commented on a diff in pull request #8102: net/tcp: debug feature to drop the tx/rx packet

Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on code in PR #8102:
URL: https://github.com/apache/nuttx/pull/8102#discussion_r1069113806


##########
net/tcp/tcp_input.c:
##########
@@ -628,6 +628,37 @@ static void tcp_input(FAR struct net_driver_s *dev, uint8_t domain,
 
   dev->d_len -= (len + iplen);
 
+#if defined(CONFIG_NET_STATISTICS) && \
+    defined(CONFIG_NET_TCP_DEBUG_DROP_RECV)
+
+#pragma message \
+  "CONFIG_NET_TCP_DEBUG_DROP_RECV is selected, this is debug " \
+  "feature to drop the tcp received packet on the floor, " \
+  "please confirm the configuration again if you do not want " \
+  "debug the TCP stack."
+
+  /* Debug feature to drop the tcp received packet on the floor */
+
+  if (dev->d_len > 0)
+    {
+      if ((g_netstats.tcp.recv %
+          CONFIG_NET_TCP_DEBUG_DROP_RECV_PROBABILITY) == 0)
+        {
+          uint32_t seq = tcp_getsequence(tcp->seqno);
+
+          g_netstats.tcp.drop++;
+
+          ninfo("TCP DROP RCVPKT: "
+                 "[%d][%" PRIu32 " : %" PRIu32 " : %d]\n",
+                 g_netstats.tcp.drop, seq, TCP_SEQ_ADD(seq, dev->d_len),
+                 dev->d_len);

Review Comment:
   ```suggestion
             ninfo("TCP DROP RCVPKT: "
                   "[%d][%" PRIu32 " : %" PRIu32 " : %d]\n",
                   g_netstats.tcp.drop, seq, TCP_SEQ_ADD(seq, dev->d_len),
                   dev->d_len);
   ```



##########
net/tcp/tcp_input.c:
##########
@@ -628,6 +628,37 @@ static void tcp_input(FAR struct net_driver_s *dev, uint8_t domain,
 
   dev->d_len -= (len + iplen);
 
+#if defined(CONFIG_NET_STATISTICS) && \
+    defined(CONFIG_NET_TCP_DEBUG_DROP_RECV)
+
+#pragma message \

Review Comment:
   Maybe better change to `#warning`? I mean, do all compilers support pragma message?



-- 
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] [nuttx] anchao commented on pull request #8102: net/tcp: debug feature to drop the tx/rx packet

Posted by GitBox <gi...@apache.org>.
anchao commented on PR #8102:
URL: https://github.com/apache/nuttx/pull/8102#issuecomment-1381355411

   The detailed test results as below: (config esp32c3-devkit/wapi)
   
   TCP server:
   Original:
   ```
   $ iperf -c 192.168.31.197 -i 1
   ------------------------------------------------------------
   Client connecting to 192.168.31.197, TCP port 5001
   TCP window size:  102 KByte (default)
   ------------------------------------------------------------
   [  3] local 192.168.31.180 port 52172 connected with 192.168.31.197 port 5001
   [ ID] Interval       Transfer     Bandwidth
   [  3]  0.0- 1.0 sec  1.75 MBytes  14.7 Mbits/sec
   [  3]  1.0- 2.0 sec  1.38 MBytes  11.5 Mbits/sec
   [  3]  2.0- 3.0 sec  1.38 MBytes  11.5 Mbits/sec
   [  3]  3.0- 4.0 sec  1.38 MBytes  11.5 Mbits/sec
   [  3]  4.0- 5.0 sec  1.62 MBytes  13.6 Mbits/sec
   [  3]  5.0- 6.0 sec  1.38 MBytes  11.5 Mbits/sec
   [  3]  6.0- 7.0 sec  1.50 MBytes  12.6 Mbits/sec
   [  3]  7.0- 8.0 sec  1.38 MBytes  11.5 Mbits/sec
   [  3]  8.0- 9.0 sec  1.50 MBytes  12.6 Mbits/sec
   [  3]  9.0-10.0 sec  1.38 MBytes  11.5 Mbits/sec
   [  3]  0.0-10.0 sec  14.6 MBytes  12.3 Mbits/sec
   ```
   Drop(1/50):
   ```
   CONFIG_NET_TCP_DEBUG_DROP_RECV=y
   CONFIG_NET_TCP_DEBUG_DROP_RECV_PROBABILITY=50  // Drop probability: 1/50
   ```
   ```
   $ iperf -c 192.168.31.197 -i 1
   ------------------------------------------------------------
   Client connecting to 192.168.31.197, TCP port 5001
   TCP window size:  102 KByte (default)
   ------------------------------------------------------------
   [  3] local 192.168.31.180 port 47072 connected with 192.168.31.197 port 5001
   [ ID] Interval       Transfer     Bandwidth
   [  3]  0.0- 1.0 sec   442 KBytes  3.62 Mbits/sec
   [  3]  1.0- 2.0 sec   128 KBytes  1.05 Mbits/sec
   [  3]  2.0- 3.0 sec  17.1 KBytes   140 Kbits/sec
   [  3]  3.0- 4.0 sec  0.00 Bytes  0.00 bits/sec
   [  3]  4.0- 5.0 sec  59.9 KBytes   491 Kbits/sec
   [  3]  5.0- 6.0 sec  85.5 KBytes   701 Kbits/sec
   [  3]  6.0- 7.0 sec  0.00 Bytes  0.00 bits/sec
   [  3]  7.0- 8.0 sec  77.0 KBytes   631 Kbits/sec
   [  3]  8.0- 9.0 sec  68.4 KBytes   561 Kbits/sec
   [  3]  9.0-10.0 sec   103 KBytes   841 Kbits/sec
   [  3]  0.0-10.0 sec   981 KBytes   802 Kbits/sec
   ```
   
   Drop(1/50) + OFO/SACK:
   ```
   CONFIG_NET_TCP_DEBUG_DROP_RECV=y
   CONFIG_NET_TCP_DEBUG_DROP_RECV_PROBABILITY=50  // Drop probability: 1/50
   
   CONFIG_NET_TCP_OUT_OF_ORDER=y
   CONFIG_NET_TCP_SELECTIVE_ACK=y
   ```
   ```
   $ iperf -c 192.168.31.197 -i 1
   ------------------------------------------------------------
   Client connecting to 192.168.31.197, TCP port 5001
   TCP window size:  102 KByte (default)
   ------------------------------------------------------------
   [  3] local 192.168.31.180 port 59374 connected with 192.168.31.197 port 5001
   [ ID] Interval       Transfer     Bandwidth
   [  3]  0.0- 1.0 sec   896 KBytes  7.34 Mbits/sec
   [  3]  1.0- 2.0 sec   896 KBytes  7.34 Mbits/sec
   [  3]  2.0- 3.0 sec   896 KBytes  7.34 Mbits/sec
   [  3]  3.0- 4.0 sec   768 KBytes  6.29 Mbits/sec
   [  3]  4.0- 5.0 sec   896 KBytes  7.34 Mbits/sec
   [  3]  5.0- 6.0 sec   896 KBytes  7.34 Mbits/sec
   [  3]  6.0- 7.0 sec   768 KBytes  6.29 Mbits/sec
   [  3]  7.0- 8.0 sec   896 KBytes  7.34 Mbits/sec
   [  3]  8.0- 9.0 sec  1.00 MBytes  8.39 Mbits/sec
   [  3]  9.0-10.0 sec   896 KBytes  7.34 Mbits/sec
   [  3]  0.0-10.2 sec  8.62 MBytes  7.11 Mbits/sec
   ```
   
   
   
   
   
   
   
   TCP client:
   Original:
   ```
   $ iperf -s -i 1
   ------------------------------------------------------------
   Server listening on TCP port 5001
   TCP window size:  128 KByte (default)
   ------------------------------------------------------------
   [  4] local 192.168.31.180 port 5001 connected with 192.168.31.197 port 5974
   [ ID] Interval       Transfer     Bandwidth
   [  4]  0.0- 1.0 sec  1.14 MBytes  9.60 Mbits/sec
   [  4]  1.0- 2.0 sec   981 KBytes  8.04 Mbits/sec
   [  4]  2.0- 3.0 sec   930 KBytes  7.62 Mbits/sec
   [  4]  3.0- 4.0 sec  1.20 MBytes  10.0 Mbits/sec
   [  4]  4.0- 5.0 sec  1.05 MBytes  8.79 Mbits/sec
   [  4]  5.0- 6.0 sec  1.04 MBytes  8.71 Mbits/sec
   [  4]  6.0- 7.0 sec  1.07 MBytes  8.96 Mbits/sec
   [  4]  7.0- 8.0 sec  1.04 MBytes  8.75 Mbits/sec
   [  4]  8.0- 9.0 sec  1.10 MBytes  9.20 Mbits/sec
   [  4]  9.0-10.0 sec   992 KBytes  8.13 Mbits/sec
   ```
   
   Drop(1/50):
   ```
   CONFIG_NET_TCP_DEBUG_DROP_SEND=y
   CONFIG_NET_TCP_DEBUG_DROP_SEND_PROBABILITY=50  // Drop probability: 1/50
   ```
   ```
   $ iperf -s -i 1
   ------------------------------------------------------------
   Server listening on TCP port 5001
   TCP window size:  128 KByte (default)
   ------------------------------------------------------------
   [  4] local 192.168.31.180 port 5001 connected with 192.168.31.197 port 13006
   [ ID] Interval       Transfer     Bandwidth
   [  4]  0.0- 1.0 sec  50.9 KBytes   417 Kbits/sec
   [  4]  1.0- 2.0 sec  31.8 KBytes   260 Kbits/sec
   [  4]  2.0- 3.0 sec  0.00 Bytes  0.00 bits/sec
   [  4]  3.0- 4.0 sec  36.0 KBytes   295 Kbits/sec
   [  4]  4.0- 5.0 sec  34.7 KBytes   285 Kbits/sec
   [  4]  5.0- 6.0 sec  23.1 KBytes   189 Kbits/sec
   [  4]  6.0- 7.0 sec  4.47 KBytes  36.6 Kbits/sec
   [  4]  7.0- 8.0 sec  36.0 KBytes   295 Kbits/sec
   [  4]  8.0- 9.0 sec  26.2 KBytes   214 Kbits/sec
   [  4]  9.0-10.0 sec  4.28 KBytes  35.0 Kbits/sec
   [  4] 10.0-11.0 sec  84.1 KBytes   689 Kbits/sec
   ```
   
   Drop(1/50) + OFO/SACK:
   ```
   CONFIG_NET_TCP_DEBUG_DROP_SEND=y
   CONFIG_NET_TCP_DEBUG_DROP_SEND_PROBABILITY=50  // Drop probability: 1/50
   
   CONFIG_NET_TCP_OUT_OF_ORDER=y
   CONFIG_NET_TCP_SELECTIVE_ACK=y
   ```
   
   ```
   $ iperf -s -i 1
   ------------------------------------------------------------
   Server listening on TCP port 5001
   TCP window size:  128 KByte (default)
   ------------------------------------------------------------
   [  4] local 192.168.31.180 port 5001 connected with 192.168.31.197 port 5446
   [ ID] Interval       Transfer     Bandwidth
   [  4]  0.0- 1.0 sec  1.02 MBytes  8.57 Mbits/sec
   [  4]  1.0- 2.0 sec   916 KBytes  7.51 Mbits/sec
   [  4]  2.0- 3.0 sec   770 KBytes  6.31 Mbits/sec
   [  4]  3.0- 4.0 sec   979 KBytes  8.02 Mbits/sec
   [  4]  4.0- 5.0 sec   929 KBytes  7.61 Mbits/sec
   [  4]  5.0- 6.0 sec  1.02 MBytes  8.58 Mbits/sec
   [  4]  6.0- 7.0 sec   989 KBytes  8.10 Mbits/sec
   [  4]  7.0- 8.0 sec  1006 KBytes  8.24 Mbits/sec
   [  4]  8.0- 9.0 sec   919 KBytes  7.53 Mbits/sec
   [  4]  9.0-10.0 sec  1022 KBytes  8.37 Mbits/sec
   [  4] 10.0-11.0 sec   998 KBytes  8.18 Mbits/sec
   ```


-- 
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] [nuttx] pkarashchenko commented on a diff in pull request #8102: net/tcp: debug feature to drop the tx/rx packet

Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on code in PR #8102:
URL: https://github.com/apache/nuttx/pull/8102#discussion_r1069149548


##########
net/tcp/tcp_input.c:
##########
@@ -628,6 +628,37 @@ static void tcp_input(FAR struct net_driver_s *dev, uint8_t domain,
 
   dev->d_len -= (len + iplen);
 
+#if defined(CONFIG_NET_STATISTICS) && \
+    defined(CONFIG_NET_TCP_DEBUG_DROP_RECV)
+
+#pragma message \

Review Comment:
   I think `#warning` are not treated as errors. What about SDCC and pragma?



-- 
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] [nuttx] anchao commented on a diff in pull request #8102: net/tcp: debug feature to drop the tx/rx packet

Posted by GitBox <gi...@apache.org>.
anchao commented on code in PR #8102:
URL: https://github.com/apache/nuttx/pull/8102#discussion_r1069297329


##########
net/tcp/tcp_input.c:
##########
@@ -628,6 +628,37 @@ static void tcp_input(FAR struct net_driver_s *dev, uint8_t domain,
 
   dev->d_len -= (len + iplen);
 
+#if defined(CONFIG_NET_STATISTICS) && \
+    defined(CONFIG_NET_TCP_DEBUG_DROP_RECV)
+
+#pragma message \

Review Comment:
   Build break if enable -Werror
   
   ```
   tcp/tcp_input.c: In function ‘tcp_input’:
   tcp/tcp_input.c:634:2: error: #warning "CONFIG_NET_TCP_DEBUG_DROP_RECV is selected, this is debug " "feature to drop the tcp received packet on the floor, " "please confirm the configuration again if you do not want " "debug the TCP stack." [-Werror=cpp]
     634 | #warning \
         |  ^~~~~~~
   ```
   I haven't tested SDCC, but #warning will bring errors when -Werror is enabled, which is wrong, and visual studio (MSVC) does not support #warning, I am considering whether it is possible replace all #warnings with #pragma message



-- 
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] [nuttx] anchao commented on a diff in pull request #8102: net/tcp: debug feature to drop the tx/rx packet

Posted by GitBox <gi...@apache.org>.
anchao commented on code in PR #8102:
URL: https://github.com/apache/nuttx/pull/8102#discussion_r1069135446


##########
net/tcp/tcp_input.c:
##########
@@ -628,6 +628,37 @@ static void tcp_input(FAR struct net_driver_s *dev, uint8_t domain,
 
   dev->d_len -= (len + iplen);
 
+#if defined(CONFIG_NET_STATISTICS) && \
+    defined(CONFIG_NET_TCP_DEBUG_DROP_RECV)
+
+#pragma message \
+  "CONFIG_NET_TCP_DEBUG_DROP_RECV is selected, this is debug " \
+  "feature to drop the tcp received packet on the floor, " \
+  "please confirm the configuration again if you do not want " \
+  "debug the TCP stack."
+
+  /* Debug feature to drop the tcp received packet on the floor */
+
+  if (dev->d_len > 0)
+    {
+      if ((g_netstats.tcp.recv %
+          CONFIG_NET_TCP_DEBUG_DROP_RECV_PROBABILITY) == 0)
+        {
+          uint32_t seq = tcp_getsequence(tcp->seqno);
+
+          g_netstats.tcp.drop++;
+
+          ninfo("TCP DROP RCVPKT: "
+                 "[%d][%" PRIu32 " : %" PRIu32 " : %d]\n",
+                 g_netstats.tcp.drop, seq, TCP_SEQ_ADD(seq, dev->d_len),
+                 dev->d_len);

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] [nuttx] anchao commented on a diff in pull request #8102: net/tcp: debug feature to drop the tx/rx packet

Posted by GitBox <gi...@apache.org>.
anchao commented on code in PR #8102:
URL: https://github.com/apache/nuttx/pull/8102#discussion_r1069093965


##########
net/tcp/tcp_send.c:
##########
@@ -575,6 +575,34 @@ void tcp_synack(FAR struct net_driver_s *dev, FAR struct tcp_conn_s *conn,
   /* Complete the common portions of the TCP message */
 
   tcp_sendcommon(dev, conn, tcp);
+
+#if defined(CONFIG_NET_STATISTICS) && \
+    defined(CONFIG_NET_TCP_DEBUG_DROP_SEND)
+
+#pragma message \
+  "CONFIG_NET_TCP_DEBUG_DROP_SEND is selected, this is debug " \
+  "feature to drop the tcp send packet on the floor, " \
+  "please confirm the configuration again if you do not want " \
+  "debug the TCP stack."
+
+  /* Debug feature to drop the tcp received packet on the floor */
+
+  if ((flags & TCP_PSH) != 0)
+    {
+      if ((g_netstats.tcp.sent %
+          CONFIG_NET_TCP_DEBUG_DROP_SEND_PROBABILITY) == 0)
+        {
+          uint32_t seq = tcp_getsequence(tcp->seqno);
+
+          syslog(1, "TCP DROP SNDPKT: "

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] [nuttx] anchao commented on a diff in pull request #8102: net/tcp: debug feature to drop the tx/rx packet

Posted by GitBox <gi...@apache.org>.
anchao commented on code in PR #8102:
URL: https://github.com/apache/nuttx/pull/8102#discussion_r1069134854


##########
net/tcp/tcp_input.c:
##########
@@ -628,6 +628,37 @@ static void tcp_input(FAR struct net_driver_s *dev, uint8_t domain,
 
   dev->d_len -= (len + iplen);
 
+#if defined(CONFIG_NET_STATISTICS) && \
+    defined(CONFIG_NET_TCP_DEBUG_DROP_RECV)
+
+#pragma message \

Review Comment:
   some boards treat warning as error, but the compilers do not provide other lower-level prints,
   
   ```
   boards/risc-v/esp32c3/esp32c3-devkit/scripts/Make.defs:46:
   CFLAGS := ... -Werror=return-type -Werror
   ```
   vs(MSVC) and GCC support "pragma" expressions.



-- 
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] [nuttx] anchao commented on a diff in pull request #8102: net/tcp: debug feature to drop the tx/rx packet

Posted by GitBox <gi...@apache.org>.
anchao commented on code in PR #8102:
URL: https://github.com/apache/nuttx/pull/8102#discussion_r1069143883


##########
net/tcp/tcp_input.c:
##########
@@ -628,6 +628,37 @@ static void tcp_input(FAR struct net_driver_s *dev, uint8_t domain,
 
   dev->d_len -= (len + iplen);
 
+#if defined(CONFIG_NET_STATISTICS) && \
+    defined(CONFIG_NET_TCP_DEBUG_DROP_RECV)
+
+#pragma message \
+  "CONFIG_NET_TCP_DEBUG_DROP_RECV is selected, this is debug " \
+  "feature to drop the tcp received packet on the floor, " \
+  "please confirm the configuration again if you do not want " \
+  "debug the TCP stack."
+
+  /* Debug feature to drop the tcp received packet on the floor */
+
+  if (dev->d_len > 0)
+    {
+      if ((g_netstats.tcp.recv %
+          CONFIG_NET_TCP_DEBUG_DROP_RECV_PROBABILITY) == 0)

Review Comment:
   emm... the packet drop rate is controlled within the define of probabillity, if it is set to 50, every 50 packets will be drop one, I do not free there is anything wrong with _PROBABILITY, or maybe we need change the config name _PROBABILITY to _INTERVAL ?  



-- 
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] [nuttx] pkarashchenko commented on a diff in pull request #8102: net/tcp: debug feature to drop the tx/rx packet

Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on code in PR #8102:
URL: https://github.com/apache/nuttx/pull/8102#discussion_r1069152064


##########
net/tcp/tcp_input.c:
##########
@@ -628,6 +628,37 @@ static void tcp_input(FAR struct net_driver_s *dev, uint8_t domain,
 
   dev->d_len -= (len + iplen);
 
+#if defined(CONFIG_NET_STATISTICS) && \
+    defined(CONFIG_NET_TCP_DEBUG_DROP_RECV)
+
+#pragma message \
+  "CONFIG_NET_TCP_DEBUG_DROP_RECV is selected, this is debug " \
+  "feature to drop the tcp received packet on the floor, " \
+  "please confirm the configuration again if you do not want " \
+  "debug the TCP stack."
+
+  /* Debug feature to drop the tcp received packet on the floor */
+
+  if (dev->d_len > 0)
+    {
+      if ((g_netstats.tcp.recv %
+          CONFIG_NET_TCP_DEBUG_DROP_RECV_PROBABILITY) == 0)

Review Comment:
   We can keep "probability", but keep in mind that it is "interval". When I read "probability" I was expecting to see probability function based on `rand` and not `a % b`. We can change condition later.



-- 
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] [nuttx] xiaoxiang781216 merged pull request #8102: net/tcp: debug feature to drop the tx/rx packet

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 merged PR #8102:
URL: https://github.com/apache/nuttx/pull/8102


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