Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'tcp-warn-once'

Jason Xing says:

====================
tcp: add tcp_warn_once() common helper

Paolo Abeni suggested we can introduce a new helper to cover more cases
in the future for better debug.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>

+16 -14
+15 -11
include/net/tcp.h
··· 2430 2430 void tcp_plb_check_rehash(struct sock *sk, struct tcp_plb_state *plb); 2431 2431 void tcp_plb_update_state_upon_rto(struct sock *sk, struct tcp_plb_state *plb); 2432 2432 2433 + static inline void tcp_warn_once(const struct sock *sk, bool cond, const char *str) 2434 + { 2435 + WARN_ONCE(cond, 2436 + "%scwn:%u out:%u sacked:%u lost:%u retrans:%u tlp_high_seq:%u sk_state:%u ca_state:%u advmss:%u mss_cache:%u pmtu:%u\n", 2437 + str, 2438 + tcp_snd_cwnd(tcp_sk(sk)), 2439 + tcp_sk(sk)->packets_out, tcp_sk(sk)->sacked_out, 2440 + tcp_sk(sk)->lost_out, tcp_sk(sk)->retrans_out, 2441 + tcp_sk(sk)->tlp_high_seq, sk->sk_state, 2442 + inet_csk(sk)->icsk_ca_state, 2443 + tcp_sk(sk)->advmss, tcp_sk(sk)->mss_cache, 2444 + inet_csk(sk)->icsk_pmtu_cookie); 2445 + } 2446 + 2433 2447 /* At how many usecs into the future should the RTO fire? */ 2434 2448 static inline s64 tcp_rto_delta_us(const struct sock *sk) 2435 2449 { ··· 2455 2441 2456 2442 return rto_time_stamp_us - tcp_sk(sk)->tcp_mstamp; 2457 2443 } else { 2458 - WARN_ONCE(1, 2459 - "rtx queue empty: " 2460 - "out:%u sacked:%u lost:%u retrans:%u " 2461 - "tlp_high_seq:%u sk_state:%u ca_state:%u " 2462 - "advmss:%u mss_cache:%u pmtu:%u\n", 2463 - tcp_sk(sk)->packets_out, tcp_sk(sk)->sacked_out, 2464 - tcp_sk(sk)->lost_out, tcp_sk(sk)->retrans_out, 2465 - tcp_sk(sk)->tlp_high_seq, sk->sk_state, 2466 - inet_csk(sk)->icsk_ca_state, 2467 - tcp_sk(sk)->advmss, tcp_sk(sk)->mss_cache, 2468 - inet_csk(sk)->icsk_pmtu_cookie); 2444 + tcp_warn_once(sk, 1, "rtx queue empty: "); 2469 2445 return jiffies_to_usecs(rto); 2470 2446 } 2471 2447
+1 -3
net/ipv4/tcp_output.c
··· 2954 2954 } 2955 2955 skb = skb_rb_last(&sk->tcp_rtx_queue); 2956 2956 if (unlikely(!skb)) { 2957 - WARN_ONCE(tp->packets_out, 2958 - "invalid inflight: %u state %u cwnd %u mss %d\n", 2959 - tp->packets_out, sk->sk_state, tcp_snd_cwnd(tp), mss); 2957 + tcp_warn_once(sk, tp->packets_out, "invalid inflight: "); 2960 2958 smp_store_release(&inet_csk(sk)->icsk_pending, 0); 2961 2959 return; 2962 2960 }