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 09:06:04 UTC

[GitHub] [nuttx] pkarashchenko commented on a diff in pull request #8102: net/tcp: debug feature to drop the tx/rx packet

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