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

Configure Feed

Select the types of activity you want to include in your feed.

tcp: change tcp_filter() to return the reason by value

sk_filter_trim_cap() will soon return the reason by value,
do the same for tcp_filter().

Note:

tcp_filter() is no longer inlined. Following patch will inline it again.

$ scripts/bloat-o-meter -t vmlinux.4 vmlinux.5
add/remove: 2/0 grow/shrink: 0/2 up/down: 186/-43 (143)
Function old new delta
tcp_filter - 154 +154
__pfx_tcp_filter - 32 +32
tcp_v4_rcv 3152 3143 -9
tcp_v6_rcv 3169 3135 -34
Total: Before=29722640, After=29722783, chg +0.00%

Signed-off-by: Eric Dumazet <edumazet@google.com>
Link: https://patch.msgid.link/20260409145625.2306224-5-edumazet@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Eric Dumazet and committed by
Jakub Kicinski
97449a5f c78bcbd5

+13 -7
+5 -3
include/net/tcp.h
··· 1683 1683 bool tcp_add_backlog(struct sock *sk, struct sk_buff *skb, 1684 1684 enum skb_drop_reason *reason); 1685 1685 1686 - static inline int tcp_filter(struct sock *sk, struct sk_buff *skb, 1687 - enum skb_drop_reason *reason) 1686 + static inline enum skb_drop_reason 1687 + tcp_filter(struct sock *sk, struct sk_buff *skb) 1688 1688 { 1689 1689 const struct tcphdr *th = (const struct tcphdr *)skb->data; 1690 + enum skb_drop_reason reason; 1690 1691 1691 - return sk_filter_trim_cap(sk, skb, __tcp_hdrlen(th), reason); 1692 + sk_filter_trim_cap(sk, skb, __tcp_hdrlen(th), &reason); 1693 + return reason; 1692 1694 } 1693 1695 1694 1696 void tcp_set_state(struct sock *sk, int state);
+4 -2
net/ipv4/tcp_ipv4.c
··· 2164 2164 } 2165 2165 refcounted = true; 2166 2166 nsk = NULL; 2167 - if (!tcp_filter(sk, skb, &drop_reason)) { 2167 + drop_reason = tcp_filter(sk, skb); 2168 + if (!drop_reason) { 2168 2169 th = (const struct tcphdr *)skb->data; 2169 2170 iph = ip_hdr(skb); 2170 2171 tcp_v4_fill_cb(skb, iph, th); ··· 2226 2225 2227 2226 nf_reset_ct(skb); 2228 2227 2229 - if (tcp_filter(sk, skb, &drop_reason)) 2228 + drop_reason = tcp_filter(sk, skb); 2229 + if (drop_reason) 2230 2230 goto discard_and_relse; 2231 2231 2232 2232 th = (const struct tcphdr *)skb->data;
+4 -2
net/ipv6/tcp_ipv6.c
··· 1794 1794 } 1795 1795 refcounted = true; 1796 1796 nsk = NULL; 1797 - if (!tcp_filter(sk, skb, &drop_reason)) { 1797 + drop_reason = tcp_filter(sk, skb); 1798 + if (!drop_reason) { 1798 1799 th = (const struct tcphdr *)skb->data; 1799 1800 hdr = ipv6_hdr(skb); 1800 1801 tcp_v6_fill_cb(skb, hdr, th); ··· 1856 1855 1857 1856 nf_reset_ct(skb); 1858 1857 1859 - if (tcp_filter(sk, skb, &drop_reason)) 1858 + drop_reason = tcp_filter(sk, skb); 1859 + if (drop_reason) 1860 1860 goto discard_and_relse; 1861 1861 1862 1862 th = (const struct tcphdr *)skb->data;