Commit 4f24ed77 authored by Paolo Abeni's avatar Paolo Abeni Committed by David S. Miller

udp: use indirect call wrappers for GRO socket lookup

This avoids another indirect call for UDP GRO. Again, the test
for the IPv6 variant is performed first.

v1 -> v2:
 - adapted to INDIRECT_CALL_ changes
Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 028e0a47
...@@ -392,6 +392,8 @@ static struct sk_buff *udp_gro_receive_segment(struct list_head *head, ...@@ -392,6 +392,8 @@ static struct sk_buff *udp_gro_receive_segment(struct list_head *head,
return NULL; return NULL;
} }
INDIRECT_CALLABLE_DECLARE(struct sock *udp6_lib_lookup_skb(struct sk_buff *skb,
__be16 sport, __be16 dport));
struct sk_buff *udp_gro_receive(struct list_head *head, struct sk_buff *skb, struct sk_buff *udp_gro_receive(struct list_head *head, struct sk_buff *skb,
struct udphdr *uh, udp_lookup_t lookup) struct udphdr *uh, udp_lookup_t lookup)
{ {
...@@ -403,7 +405,8 @@ struct sk_buff *udp_gro_receive(struct list_head *head, struct sk_buff *skb, ...@@ -403,7 +405,8 @@ struct sk_buff *udp_gro_receive(struct list_head *head, struct sk_buff *skb,
struct sock *sk; struct sock *sk;
rcu_read_lock(); rcu_read_lock();
sk = (*lookup)(skb, uh->source, uh->dest); sk = INDIRECT_CALL_INET(lookup, udp6_lib_lookup_skb,
udp4_lib_lookup_skb, skb, uh->source, uh->dest);
if (!sk) if (!sk)
goto out_unlock; goto out_unlock;
...@@ -503,7 +506,8 @@ int udp_gro_complete(struct sk_buff *skb, int nhoff, ...@@ -503,7 +506,8 @@ int udp_gro_complete(struct sk_buff *skb, int nhoff,
uh->len = newlen; uh->len = newlen;
rcu_read_lock(); rcu_read_lock();
sk = (*lookup)(skb, uh->source, uh->dest); sk = INDIRECT_CALL_INET(lookup, udp6_lib_lookup_skb,
udp4_lib_lookup_skb, skb, uh->source, uh->dest);
if (sk && udp_sk(sk)->gro_enabled) { if (sk && udp_sk(sk)->gro_enabled) {
err = udp_gro_complete_segment(skb); err = udp_gro_complete_segment(skb);
} else if (sk && udp_sk(sk)->gro_complete) { } else if (sk && udp_sk(sk)->gro_complete) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment