net/tcp: move drop send source code to correct place

Merge conflicts lead to code being placed in thre wrong place
The debug code should placed in tcp_send() not tcp_synack()

Signed-off-by: chao an <anchao@xiaomi.com>
This commit is contained in:
chao an 2023-01-17 19:52:02 +08:00 committed by Xiang Xiao
parent 9ae7119a39
commit fa6ba05097
1 changed files with 28 additions and 28 deletions

View File

@ -279,6 +279,34 @@ void tcp_send(FAR struct net_driver_s *dev, FAR struct tcp_conn_s *conn,
dev->d_len = len;
tcp->tcpoffset = (TCP_HDRLEN / 4) << 4;
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);
ninfo("TCP DROP SNDPKT: "
"[%d][%" PRIu32 " : %" PRIu32 " : %d]\n",
g_netstats.tcp.sent, seq, TCP_SEQ_ADD(seq, dev->d_sndlen),
dev->d_sndlen);
dev->d_len = 0;
}
}
#endif
}
/****************************************************************************
@ -575,34 +603,6 @@ 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);
ninfo("TCP DROP SNDPKT: "
"[%d][%" PRIu32 " : %" PRIu32 " : %d]\n",
g_netstats.tcp.sent, seq, TCP_SEQ_ADD(seq, dev->d_sndlen),
dev->d_sndlen);
dev->d_len = 0;
}
}
#endif
}
/****************************************************************************