tcp: wrap mptcp and decrypted checks into tcp_skb_can_collapse_rx()
authorJakub Kicinski <kuba@kernel.org>
Thu, 30 May 2024 23:36:14 +0000 (16:36 -0700)
committerPaolo Abeni <pabeni@redhat.com>
Tue, 4 Jun 2024 11:23:30 +0000 (13:23 +0200)
commit071115301838c6c265065dd5d6bf43a9a987a550
tree97fe4923f77da41d591b368206bd8448d42e869c
parent2589d668e1a6ebe85329f1054cdad13647deac06
tcp: wrap mptcp and decrypted checks into tcp_skb_can_collapse_rx()

tcp_skb_can_collapse() checks for conditions which don't make
sense on input. Because of this we ended up sprinkling a few
pairs of mptcp_skb_can_collapse() and skb_cmp_decrypted() calls
on the input path. Group them in a new helper. This should make
it less likely that someone will check mptcp and not decrypted
or vice versa when adding new code.

This implicitly adds a decrypted check early in tcp_collapse().
AFAIU this will very slightly increase our ability to collapse
packets under memory pressure, not a real bug.

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Reviewed-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Reviewed-by: Willem de Bruijn <willemb@google.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
include/net/tcp.h
net/ipv4/tcp_input.c
net/ipv4/tcp_ipv4.c