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

tcp: rework {__,}tcp_ecn_check_ce() -> tcp_data_ecn_check()

Rename tcp_ecn_check_ce to tcp_data_ecn_check as it is
called only for data segments, not for ACKs (with AccECN,
also ACKs may get ECN bits).

The extra "layer" in tcp_ecn_check_ce() function just
checks for ECN being enabled, that can be moved into
tcp_ecn_field_check rather than having the __ variant.

No functional changes.

Signed-off-by: Ilpo Järvinen <ij@kernel.org>
Signed-off-by: Chia-Yu Chang <chia-yu.chang@nokia-bell-labs.com>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Ilpo Järvinen and committed by
David S. Miller
f0db2bca 2c2f08d3

+6 -9
+6 -9
net/ipv4/tcp_input.c
··· 365 365 tp->ecn_flags &= ~TCP_ECN_QUEUE_CWR; 366 366 } 367 367 368 - static void __tcp_ecn_check_ce(struct sock *sk, const struct sk_buff *skb) 368 + static void tcp_data_ecn_check(struct sock *sk, const struct sk_buff *skb) 369 369 { 370 370 struct tcp_sock *tp = tcp_sk(sk); 371 + 372 + if (!(tcp_sk(sk)->ecn_flags & TCP_ECN_OK)) 373 + return; 371 374 372 375 switch (TCP_SKB_CB(skb)->ip_dsfield & INET_ECN_MASK) { 373 376 case INET_ECN_NOT_ECT: ··· 398 395 tp->ecn_flags |= TCP_ECN_SEEN; 399 396 break; 400 397 } 401 - } 402 - 403 - static void tcp_ecn_check_ce(struct sock *sk, const struct sk_buff *skb) 404 - { 405 - if (tcp_sk(sk)->ecn_flags & TCP_ECN_OK) 406 - __tcp_ecn_check_ce(sk, skb); 407 398 } 408 399 409 400 static void tcp_ecn_rcv_synack(struct tcp_sock *tp, const struct tcphdr *th) ··· 871 874 icsk->icsk_ack.lrcvtime = now; 872 875 tcp_save_lrcv_flowlabel(sk, skb); 873 876 874 - tcp_ecn_check_ce(sk, skb); 877 + tcp_data_ecn_check(sk, skb); 875 878 876 879 if (skb->len >= 128) 877 880 tcp_grow_window(sk, skb, true); ··· 5038 5041 bool fragstolen; 5039 5042 5040 5043 tcp_save_lrcv_flowlabel(sk, skb); 5041 - tcp_ecn_check_ce(sk, skb); 5044 + tcp_data_ecn_check(sk, skb); 5042 5045 5043 5046 if (unlikely(tcp_try_rmem_schedule(sk, skb, skb->truesize))) { 5044 5047 NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPOFODROP);