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

tcp: remove indirect calls for icsk->icsk_af_ops->send_check

Mitigate RETPOLINE costs in __tcp_transmit_skb()
by using INDIRECT_CALL_INET() wrapper.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Eric Dumazet and committed by
David S. Miller
dd2e0b86 05e22e83

+14 -10
-9
include/net/ip6_checksum.h
··· 85 85 th->check = ~tcp_v6_check(0, &ipv6h->saddr, &ipv6h->daddr, 0); 86 86 } 87 87 88 - #if IS_ENABLED(CONFIG_IPV6) 89 - static inline void tcp_v6_send_check(struct sock *sk, struct sk_buff *skb) 90 - { 91 - struct ipv6_pinfo *np = inet6_sk(sk); 92 - 93 - __tcp_v6_send_check(skb, &np->saddr, &sk->sk_v6_daddr); 94 - } 95 - #endif 96 - 97 88 static inline __sum16 udp_v6_check(int len, 98 89 const struct in6_addr *saddr, 99 90 const struct in6_addr *daddr,
+3
include/net/tcp.h
··· 932 932 #endif 933 933 return 0; 934 934 } 935 + 936 + INDIRECT_CALLABLE_DECLARE(void tcp_v6_send_check(struct sock *sk, struct sk_buff *skb)); 937 + 935 938 #endif 936 939 937 940 static inline bool inet_exact_dif_match(struct net *net, struct sk_buff *skb)
+4 -1
net/ipv4/tcp_output.c
··· 1066 1066 1067 1067 INDIRECT_CALLABLE_DECLARE(int ip_queue_xmit(struct sock *sk, struct sk_buff *skb, struct flowi *fl)); 1068 1068 INDIRECT_CALLABLE_DECLARE(int inet6_csk_xmit(struct sock *sk, struct sk_buff *skb, struct flowi *fl)); 1069 + INDIRECT_CALLABLE_DECLARE(void tcp_v4_send_check(struct sock *sk, struct sk_buff *skb)); 1069 1070 1070 1071 /* This routine actually transmits TCP packets queued in by 1071 1072 * tcp_do_sendmsg(). This is used by both the initial ··· 1211 1210 } 1212 1211 #endif 1213 1212 1214 - icsk->icsk_af_ops->send_check(sk, skb); 1213 + INDIRECT_CALL_INET(icsk->icsk_af_ops->send_check, 1214 + tcp_v6_send_check, tcp_v4_send_check, 1215 + sk, skb); 1215 1216 1216 1217 if (likely(tcb->tcp_flags & TCPHDR_ACK)) 1217 1218 tcp_event_ack_sent(sk, tcp_skb_pcount(skb), rcv_nxt);
+7
net/ipv6/tcp_ipv6.c
··· 1811 1811 .twsk_destructor = tcp_twsk_destructor, 1812 1812 }; 1813 1813 1814 + INDIRECT_CALLABLE_SCOPE void tcp_v6_send_check(struct sock *sk, struct sk_buff *skb) 1815 + { 1816 + struct ipv6_pinfo *np = inet6_sk(sk); 1817 + 1818 + __tcp_v6_send_check(skb, &np->saddr, &sk->sk_v6_daddr); 1819 + } 1820 + 1814 1821 const struct inet_connection_sock_af_ops ipv6_specific = { 1815 1822 .queue_xmit = inet6_csk_xmit, 1816 1823 .send_check = tcp_v6_send_check,