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

gre_offload: statically build GRE offloading support

GRO/GSO layers can be enabled on a node, even if said
node is only forwarding packets.

This patch permits GSO (and upcoming GRO) support for GRE
encapsulated packets, even if the host has no GRE tunnel setup.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: H.K. Jerry Chu <hkchu@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Eric Dumazet and committed by
David S. Miller
438e38fa 0e595934

+7 -16
-3
include/net/gre.h
··· 33 33 int gre_cisco_register(struct gre_cisco_protocol *proto); 34 34 int gre_cisco_unregister(struct gre_cisco_protocol *proto); 35 35 36 - int gre_offload_init(void); 37 - void gre_offload_exit(void); 38 - 39 36 void gre_build_header(struct sk_buff *skb, const struct tnl_ptk_info *tpi, 40 37 int hdr_len); 41 38
+2 -2
net/ipv4/Makefile
··· 11 11 tcp_offload.o datagram.o raw.o udp.o udplite.o \ 12 12 udp_offload.o arp.o icmp.o devinet.o af_inet.o igmp.o \ 13 13 fib_frontend.o fib_semantics.o fib_trie.o \ 14 - inet_fragment.o ping.o ip_tunnel_core.o 14 + inet_fragment.o ping.o ip_tunnel_core.o gre_offload.o 15 15 16 16 obj-$(CONFIG_NET_IP_TUNNEL) += ip_tunnel.o 17 17 obj-$(CONFIG_SYSCTL) += sysctl_net_ipv4.o ··· 19 19 obj-$(CONFIG_IP_MULTIPLE_TABLES) += fib_rules.o 20 20 obj-$(CONFIG_IP_MROUTE) += ipmr.o 21 21 obj-$(CONFIG_NET_IPIP) += ipip.o 22 - gre-y := gre_demux.o gre_offload.o 22 + gre-y := gre_demux.o 23 23 obj-$(CONFIG_NET_IPGRE_DEMUX) += gre.o 24 24 obj-$(CONFIG_NET_IPGRE) += ip_gre.o 25 25 obj-$(CONFIG_NET_IPVTI) += ip_vti.o
-9
net/ipv4/gre_demux.c
··· 355 355 goto err_gre; 356 356 } 357 357 358 - if (gre_offload_init()) { 359 - pr_err("can't add protocol offload\n"); 360 - goto err_gso; 361 - } 362 - 363 358 return 0; 364 - err_gso: 365 - gre_del_protocol(&ipgre_protocol, GREPROTO_CISCO); 366 359 err_gre: 367 360 inet_del_protocol(&net_gre_protocol, IPPROTO_GRE); 368 361 err: ··· 364 371 365 372 static void __exit gre_exit(void) 366 373 { 367 - gre_offload_exit(); 368 - 369 374 gre_del_protocol(&ipgre_protocol, GREPROTO_CISCO); 370 375 inet_del_protocol(&net_gre_protocol, IPPROTO_GRE); 371 376 }
+5 -2
net/ipv4/gre_offload.c
··· 123 123 }, 124 124 }; 125 125 126 - int __init gre_offload_init(void) 126 + static int __init gre_offload_init(void) 127 127 { 128 128 return inet_add_offload(&gre_offload, IPPROTO_GRE); 129 129 } 130 130 131 - void __exit gre_offload_exit(void) 131 + static void __exit gre_offload_exit(void) 132 132 { 133 133 inet_del_offload(&gre_offload, IPPROTO_GRE); 134 134 } 135 + 136 + module_init(gre_offload_init); 137 + module_exit(gre_offload_exit);