Skip to content

Commit 5588796

Browse files
solbjorndavem330
authored andcommitted
ethernet: avoid retpoline overhead on TEB (GENEVE, NvGRE, VxLAN) GRO
The two most popular headers going after Ethernet are IPv4 and IPv6. Retpoline overhead for them is addressed only in dev_gro_receive(), when they lie right after the outermost Ethernet header. Use the indirect call wrappers in TEB (Transparent Ethernet Bridging, such as GENEVE, NvGRE, VxLAN etc.) GRO receive code to reduce the penalty when processing the inner headers. Signed-off-by: Alexander Lobakin <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 4a6e7ec commit 5588796

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

net/ethernet/eth.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@
5858
#include <net/ip.h>
5959
#include <net/dsa.h>
6060
#include <net/flow_dissector.h>
61+
#include <net/gro.h>
6162
#include <linux/uaccess.h>
6263
#include <net/pkt_sched.h>
6364

@@ -449,7 +450,10 @@ struct sk_buff *eth_gro_receive(struct list_head *head, struct sk_buff *skb)
449450

450451
skb_gro_pull(skb, sizeof(*eh));
451452
skb_gro_postpull_rcsum(skb, eh, sizeof(*eh));
452-
pp = call_gro_receive(ptype->callbacks.gro_receive, head, skb);
453+
454+
pp = indirect_call_gro_receive_inet(ptype->callbacks.gro_receive,
455+
ipv6_gro_receive, inet_gro_receive,
456+
head, skb);
453457

454458
out_unlock:
455459
rcu_read_unlock();
@@ -473,8 +477,9 @@ int eth_gro_complete(struct sk_buff *skb, int nhoff)
473477
rcu_read_lock();
474478
ptype = gro_find_complete_by_type(type);
475479
if (ptype != NULL)
476-
err = ptype->callbacks.gro_complete(skb, nhoff +
477-
sizeof(struct ethhdr));
480+
err = INDIRECT_CALL_INET(ptype->callbacks.gro_complete,
481+
ipv6_gro_complete, inet_gro_complete,
482+
skb, nhoff + sizeof(*eh));
478483

479484
rcu_read_unlock();
480485
return err;

0 commit comments

Comments
 (0)