[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID:
<DS0PR10MB6056248B2DFFC393E31B4A1B8FE62@DS0PR10MB6056.namprd10.prod.outlook.com>
Date: Thu, 9 May 2024 17:29:52 +0000
From: Mohith Kumar Thummaluru <mohith.k.kumar.thummaluru@...cle.com>
To: Yuan Fang <yf768672249@...il.com>,
"edumazet@...gle.com"
<edumazet@...gle.com>
CC: "davem@...emloft.net" <davem@...emloft.net>,
"netdev@...r.kernel.org"
<netdev@...r.kernel.org>,
"linux-kernel@...r.kernel.org"
<linux-kernel@...r.kernel.org>
Subject: RE: [External] : [PATCH 1/2] tcp: fix get_tcp4_sock() output error
info
Good catch! Thanks for this fix.
LGTM.
Reviewed-by : Mohith Kumar Thummaluru <mohith.k.kumar.thummaluru@...cle.com>
Tested-by: Mohith Kumar Thummaluru <mohith.k.kumar.thummaluru@...cle.com>
Regards,
Mohith
-----Original Message-----
From: Yuan Fang <yf768672249@...il.com>
Sent: 09 May 2024 10:13
To: edumazet@...gle.com
Cc: davem@...emloft.net; netdev@...r.kernel.org; linux-kernel@...r.kernel.org; Yuan Fang <yf768672249@...il.com>
Subject: [External] : [PATCH 1/2] tcp: fix get_tcp4_sock() output error info
When in the TCP_LISTEN state, using netstat,the Send-Q is always 0.
Modify tx_queue to the value of sk->sk_max_ack_backlog.
Signed-off-by: Yuan Fang <yf768672249@...il.com>
---
net/ipv4/tcp_ipv4.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c index a22ee5838751..70416ba902b9 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -2867,7 +2867,7 @@ static void get_tcp4_sock(struct sock *sk, struct seq_file *f, int i)
__be32 src = inet->inet_rcv_saddr;
__u16 destp = ntohs(inet->inet_dport);
__u16 srcp = ntohs(inet->inet_sport);
- int rx_queue;
+ int rx_queue, tx_queue;
int state;
if (icsk->icsk_pending == ICSK_TIME_RETRANS || @@ -2887,19 +2887,22 @@ static void get_tcp4_sock(struct sock *sk, struct seq_file *f, int i)
}
state = inet_sk_state_load(sk);
- if (state == TCP_LISTEN)
+ if (state == TCP_LISTEN) {
rx_queue = READ_ONCE(sk->sk_ack_backlog);
- else
+ tx_queue = READ_ONCE(sk->sk_max_ack_backlog);
+ } else {
/* Because we don't lock the socket,
* we might find a transient negative value.
*/
rx_queue = max_t(int, READ_ONCE(tp->rcv_nxt) -
READ_ONCE(tp->copied_seq), 0);
+ tx_queue = READ_ONCE(tp->write_seq) - tp->snd_una;
+ }
seq_printf(f, "%4d: %08X:%04X %08X:%04X %02X %08X:%08X %02X:%08lX "
"%08X %5u %8d %lu %d %pK %lu %lu %u %u %d",
i, src, srcp, dest, destp, state,
- READ_ONCE(tp->write_seq) - tp->snd_una,
+ tx_queue,
rx_queue,
timer_active,
jiffies_delta_to_clock_t(timer_expires - jiffies),
--
2.45.0
Powered by blists - more mailing lists