diff options
author | David S. Miller <davem@davemloft.net> | 2019-05-05 19:38:04 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2019-05-05 19:38:04 +0200 |
commit | c90d1e4b6be6fc531ee076e26e4e5bf058925ac3 (patch) | |
tree | 7df6f2b6631f9396a0a159df594fc02de434f387 /net/ipv4 | |
parent | net: ll_temac: remove an unnecessary condition (diff) | |
parent | net: use indirect calls helpers at the socket layer (diff) | |
download | linux-c90d1e4b6be6fc531ee076e26e4e5bf058925ac3.tar.xz linux-c90d1e4b6be6fc531ee076e26e4e5bf058925ac3.zip |
Merge branch 'net-extend-indirect-calls-helper-usage'
Paolo Abeni says:
====================
net: extend indirect calls helper usage
This series applies the indirect calls helper introduced with commit
283c16a2dfd3 ("indirect call wrappers: helpers to speed-up indirect
calls of builtin") to more hooks inside the network stack.
Overall this avoids up to 4 indirect calls for each RX packets,
giving small but measurable gain TCP_RR workloads and 5% under UDP
flood.
====================
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4')
-rw-r--r-- | net/ipv4/ip_input.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/net/ipv4/ip_input.c b/net/ipv4/ip_input.c index 1132d6d1796a..ed97724c5e33 100644 --- a/net/ipv4/ip_input.c +++ b/net/ipv4/ip_input.c @@ -130,6 +130,7 @@ #include <linux/inetdevice.h> #include <linux/netdevice.h> #include <linux/etherdevice.h> +#include <linux/indirect_call_wrapper.h> #include <net/snmp.h> #include <net/ip.h> @@ -188,6 +189,8 @@ bool ip_call_ra_chain(struct sk_buff *skb) return false; } +INDIRECT_CALLABLE_DECLARE(int udp_rcv(struct sk_buff *)); +INDIRECT_CALLABLE_DECLARE(int tcp_v4_rcv(struct sk_buff *)); void ip_protocol_deliver_rcu(struct net *net, struct sk_buff *skb, int protocol) { const struct net_protocol *ipprot; @@ -205,7 +208,8 @@ resubmit: } nf_reset(skb); } - ret = ipprot->handler(skb); + ret = INDIRECT_CALL_2(ipprot->handler, tcp_v4_rcv, udp_rcv, + skb); if (ret < 0) { protocol = -ret; goto resubmit; @@ -305,6 +309,8 @@ drop: return true; } +INDIRECT_CALLABLE_DECLARE(int udp_v4_early_demux(struct sk_buff *)); +INDIRECT_CALLABLE_DECLARE(int tcp_v4_early_demux(struct sk_buff *)); static int ip_rcv_finish_core(struct net *net, struct sock *sk, struct sk_buff *skb, struct net_device *dev) { @@ -322,7 +328,8 @@ static int ip_rcv_finish_core(struct net *net, struct sock *sk, ipprot = rcu_dereference(inet_protos[protocol]); if (ipprot && (edemux = READ_ONCE(ipprot->early_demux))) { - err = edemux(skb); + err = INDIRECT_CALL_2(edemux, tcp_v4_early_demux, + udp_v4_early_demux, skb); if (unlikely(err)) goto drop_error; /* must reload iph, skb->head might have changed */ |