From cb0a12311bc4ba12f49ce641b1380186e9930ba0 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Wed, 13 Mar 2024 14:50:20 +0100 Subject: [PATCH] net: tcp: Remove redundant debug logs Debug logs in helper functions like tcp_unsent_len() or tcp_window_full() are not very helpful and generate a heavy, unnecessary log output. Therefore, tcp_unsent_len() will no longer generate log, and tcp_window_full() will print out a log only when the window is actually full, which could be an useful information. Also, reduce the log load during TX, as currently redundant logs were printed in tcp_out_ext(), tcp_send_process_no_lock() and finally in tcp_send(). Signed-off-by: Robert Lubos --- subsys/net/ip/tcp.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/subsys/net/ip/tcp.c b/subsys/net/ip/tcp.c index 3c8f17bec7fb03..598af5050e6c19 100644 --- a/subsys/net/ip/tcp.c +++ b/subsys/net/ip/tcp.c @@ -324,8 +324,6 @@ static const char *tcp_th(struct net_pkt *pkt) static void tcp_send(struct net_pkt *pkt) { - NET_DBG("%s", tcp_th(pkt)); - tcp_pkt_ref(pkt); if (tcp_send_cb) { @@ -1463,6 +1461,8 @@ void net_tcp_reply_rst(struct net_pkt *pkt) goto err; } + NET_DBG("%s", tcp_th(rst)); + tcp_send(rst); return; @@ -1520,8 +1520,6 @@ static int tcp_out_ext(struct tcp *conn, uint8_t flags, struct net_pkt *data, goto out; } - NET_DBG("%s", tcp_th(pkt)); - if (tcp_send_cb) { ret = tcp_send_cb(pkt); goto out; @@ -1631,7 +1629,9 @@ static bool tcp_window_full(struct tcp *conn) window_full = window_full || (conn->send_data_total >= conn->ca.cwnd); #endif - NET_DBG("conn: %p window_full=%hu", conn, window_full); + if (window_full) { + NET_DBG("conn: %p TX window_full", conn); + } return window_full; } @@ -1662,8 +1662,6 @@ static int tcp_unsent_len(struct tcp *conn) #endif } out: - NET_DBG("unsent_len=%d", unsent_len); - return unsent_len; }