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->queue_xmit

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
05e22e83 902053f1

+14 -6
+1 -5
include/net/ip.h
··· 231 231 struct ipcm_cookie *ipc, struct rtable **rtp, 232 232 struct inet_cork *cork, unsigned int flags); 233 233 234 - static inline int ip_queue_xmit(struct sock *sk, struct sk_buff *skb, 235 - struct flowi *fl) 236 - { 237 - return __ip_queue_xmit(sk, skb, fl, inet_sk(sk)->tos); 238 - } 234 + int ip_queue_xmit(struct sock *sk, struct sk_buff *skb, struct flowi *fl); 239 235 240 236 static inline struct sk_buff *ip_finish_skb(struct sock *sk, struct flowi4 *fl4) 241 237 {
+1
include/net/tcp.h
··· 25 25 #include <linux/skbuff.h> 26 26 #include <linux/kref.h> 27 27 #include <linux/ktime.h> 28 + #include <linux/indirect_call_wrapper.h> 28 29 29 30 #include <net/inet_connection_sock.h> 30 31 #include <net/inet_timewait_sock.h>
+6
net/ipv4/ip_output.c
··· 539 539 } 540 540 EXPORT_SYMBOL(__ip_queue_xmit); 541 541 542 + int ip_queue_xmit(struct sock *sk, struct sk_buff *skb, struct flowi *fl) 543 + { 544 + return __ip_queue_xmit(sk, skb, fl, inet_sk(sk)->tos); 545 + } 546 + EXPORT_SYMBOL(ip_queue_xmit); 547 + 542 548 static void ip_copy_metadata(struct sk_buff *to, struct sk_buff *from) 543 549 { 544 550 to->pkt_type = from->pkt_type;
+6 -1
net/ipv4/tcp_output.c
··· 1064 1064 list_move_tail(&skb->tcp_tsorted_anchor, &tp->tsorted_sent_queue); 1065 1065 } 1066 1066 1067 + INDIRECT_CALLABLE_DECLARE(int ip_queue_xmit(struct sock *sk, struct sk_buff *skb, struct flowi *fl)); 1068 + INDIRECT_CALLABLE_DECLARE(int inet6_csk_xmit(struct sock *sk, struct sk_buff *skb, struct flowi *fl)); 1069 + 1067 1070 /* This routine actually transmits TCP packets queued in by 1068 1071 * tcp_do_sendmsg(). This is used by both the initial 1069 1072 * transmission and possible later retransmissions. ··· 1238 1235 1239 1236 tcp_add_tx_delay(skb, tp); 1240 1237 1241 - err = icsk->icsk_af_ops->queue_xmit(sk, skb, &inet->cork.fl); 1238 + err = INDIRECT_CALL_INET(icsk->icsk_af_ops->queue_xmit, 1239 + inet6_csk_xmit, ip_queue_xmit, 1240 + sk, skb, &inet->cork.fl); 1242 1241 1243 1242 if (unlikely(err > 0)) { 1244 1243 tcp_enter_cwr(sk);