diff options
author | Tom Herbert <tom@herbertland.com> | 2016-04-05 11:22:51 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-04-07 16:53:29 -0400 |
commit | a6024562ffd7e0f31bc6671817840ad1e91de7b4 (patch) | |
tree | 6d5ea1150eb18e8a3b0626913034b162cdf9d74d /net/ipv6 | |
parent | 63058308cd55182bbfd7a87970bd57883fcfbd2e (diff) |
udp: Add GRO functions to UDP socket
This patch adds GRO functions (gro_receive and gro_complete) to UDP
sockets. udp_gro_receive is changed to perform socket lookup on a
packet. If a socket is found the related GRO functions are called.
This features obsoletes using UDP offload infrastructure for GRO
(udp_offload). This has the advantage of not being limited to provide
offload on a per port basis, GRO is now applied to whatever individual
UDP sockets are bound to. This also allows the possbility of
"application defined GRO"-- that is we can attach something like
a BPF program to a UDP socket to perfrom GRO on an application
layer protocol.
Signed-off-by: Tom Herbert <tom@herbertland.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6')
-rw-r--r-- | net/ipv6/Makefile | 5 | ||||
-rw-r--r-- | net/ipv6/af_inet6.c | 8 | ||||
-rw-r--r-- | net/ipv6/ip6_offload.c | 2 | ||||
-rw-r--r-- | net/ipv6/ip6_offload.h | 3 | ||||
-rw-r--r-- | net/ipv6/udp_offload.c | 11 |
5 files changed, 21 insertions, 8 deletions
diff --git a/net/ipv6/Makefile b/net/ipv6/Makefile index 2fbd90bf8d33..5e9d6bf4aaca 100644 --- a/net/ipv6/Makefile +++ b/net/ipv6/Makefile | |||
@@ -8,9 +8,10 @@ ipv6-objs := af_inet6.o anycast.o ip6_output.o ip6_input.o addrconf.o \ | |||
8 | addrlabel.o \ | 8 | addrlabel.o \ |
9 | route.o ip6_fib.o ipv6_sockglue.o ndisc.o udp.o udplite.o \ | 9 | route.o ip6_fib.o ipv6_sockglue.o ndisc.o udp.o udplite.o \ |
10 | raw.o icmp.o mcast.o reassembly.o tcp_ipv6.o ping.o \ | 10 | raw.o icmp.o mcast.o reassembly.o tcp_ipv6.o ping.o \ |
11 | exthdrs.o datagram.o ip6_flowlabel.o inet6_connection_sock.o | 11 | exthdrs.o datagram.o ip6_flowlabel.o inet6_connection_sock.o \ |
12 | udp_offload.o | ||
12 | 13 | ||
13 | ipv6-offload := ip6_offload.o tcpv6_offload.o udp_offload.o exthdrs_offload.o | 14 | ipv6-offload := ip6_offload.o tcpv6_offload.o exthdrs_offload.o |
14 | 15 | ||
15 | ipv6-$(CONFIG_SYSCTL) = sysctl_net_ipv6.o | 16 | ipv6-$(CONFIG_SYSCTL) = sysctl_net_ipv6.o |
16 | ipv6-$(CONFIG_IPV6_MROUTE) += ip6mr.o | 17 | ipv6-$(CONFIG_IPV6_MROUTE) += ip6mr.o |
diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c index 2b78aad0d52f..bfa86f040c16 100644 --- a/net/ipv6/af_inet6.c +++ b/net/ipv6/af_inet6.c | |||
@@ -64,6 +64,8 @@ | |||
64 | #include <asm/uaccess.h> | 64 | #include <asm/uaccess.h> |
65 | #include <linux/mroute6.h> | 65 | #include <linux/mroute6.h> |
66 | 66 | ||
67 | #include "ip6_offload.h" | ||
68 | |||
67 | MODULE_AUTHOR("Cast of dozens"); | 69 | MODULE_AUTHOR("Cast of dozens"); |
68 | MODULE_DESCRIPTION("IPv6 protocol stack for Linux"); | 70 | MODULE_DESCRIPTION("IPv6 protocol stack for Linux"); |
69 | MODULE_LICENSE("GPL"); | 71 | MODULE_LICENSE("GPL"); |
@@ -959,6 +961,10 @@ static int __init inet6_init(void) | |||
959 | if (err) | 961 | if (err) |
960 | goto udplitev6_fail; | 962 | goto udplitev6_fail; |
961 | 963 | ||
964 | err = udpv6_offload_init(); | ||
965 | if (err) | ||
966 | goto udpv6_offload_fail; | ||
967 | |||
962 | err = tcpv6_init(); | 968 | err = tcpv6_init(); |
963 | if (err) | 969 | if (err) |
964 | goto tcpv6_fail; | 970 | goto tcpv6_fail; |
@@ -988,6 +994,8 @@ pingv6_fail: | |||
988 | ipv6_packet_fail: | 994 | ipv6_packet_fail: |
989 | tcpv6_exit(); | 995 | tcpv6_exit(); |
990 | tcpv6_fail: | 996 | tcpv6_fail: |
997 | udpv6_offload_exit(); | ||
998 | udpv6_offload_fail: | ||
991 | udplitev6_exit(); | 999 | udplitev6_exit(); |
992 | udplitev6_fail: | 1000 | udplitev6_fail: |
993 | udpv6_exit(); | 1001 | udpv6_exit(); |
diff --git a/net/ipv6/ip6_offload.c b/net/ipv6/ip6_offload.c index 82e9f3076028..204af2219471 100644 --- a/net/ipv6/ip6_offload.c +++ b/net/ipv6/ip6_offload.c | |||
@@ -325,8 +325,6 @@ static int __init ipv6_offload_init(void) | |||
325 | 325 | ||
326 | if (tcpv6_offload_init() < 0) | 326 | if (tcpv6_offload_init() < 0) |
327 | pr_crit("%s: Cannot add TCP protocol offload\n", __func__); | 327 | pr_crit("%s: Cannot add TCP protocol offload\n", __func__); |
328 | if (udp_offload_init() < 0) | ||
329 | pr_crit("%s: Cannot add UDP protocol offload\n", __func__); | ||
330 | if (ipv6_exthdrs_offload_init() < 0) | 328 | if (ipv6_exthdrs_offload_init() < 0) |
331 | pr_crit("%s: Cannot add EXTHDRS protocol offload\n", __func__); | 329 | pr_crit("%s: Cannot add EXTHDRS protocol offload\n", __func__); |
332 | 330 | ||
diff --git a/net/ipv6/ip6_offload.h b/net/ipv6/ip6_offload.h index 2e155c651b35..96b40e41ac53 100644 --- a/net/ipv6/ip6_offload.h +++ b/net/ipv6/ip6_offload.h | |||
@@ -12,7 +12,8 @@ | |||
12 | #define __ip6_offload_h | 12 | #define __ip6_offload_h |
13 | 13 | ||
14 | int ipv6_exthdrs_offload_init(void); | 14 | int ipv6_exthdrs_offload_init(void); |
15 | int udp_offload_init(void); | 15 | int udpv6_offload_init(void); |
16 | int udpv6_offload_exit(void); | ||
16 | int tcpv6_offload_init(void); | 17 | int tcpv6_offload_init(void); |
17 | 18 | ||
18 | #endif | 19 | #endif |
diff --git a/net/ipv6/udp_offload.c b/net/ipv6/udp_offload.c index 2b0fbe6929e8..5429f6bcf047 100644 --- a/net/ipv6/udp_offload.c +++ b/net/ipv6/udp_offload.c | |||
@@ -153,7 +153,7 @@ static struct sk_buff **udp6_gro_receive(struct sk_buff **head, | |||
153 | 153 | ||
154 | skip: | 154 | skip: |
155 | NAPI_GRO_CB(skb)->is_ipv6 = 1; | 155 | NAPI_GRO_CB(skb)->is_ipv6 = 1; |
156 | return udp_gro_receive(head, skb, uh); | 156 | return udp_gro_receive(head, skb, uh, udp6_lib_lookup_skb); |
157 | 157 | ||
158 | flush: | 158 | flush: |
159 | NAPI_GRO_CB(skb)->flush = 1; | 159 | NAPI_GRO_CB(skb)->flush = 1; |
@@ -173,7 +173,7 @@ static int udp6_gro_complete(struct sk_buff *skb, int nhoff) | |||
173 | skb_shinfo(skb)->gso_type |= SKB_GSO_UDP_TUNNEL; | 173 | skb_shinfo(skb)->gso_type |= SKB_GSO_UDP_TUNNEL; |
174 | } | 174 | } |
175 | 175 | ||
176 | return udp_gro_complete(skb, nhoff); | 176 | return udp_gro_complete(skb, nhoff, udp6_lib_lookup_skb); |
177 | } | 177 | } |
178 | 178 | ||
179 | static const struct net_offload udpv6_offload = { | 179 | static const struct net_offload udpv6_offload = { |
@@ -184,7 +184,12 @@ static const struct net_offload udpv6_offload = { | |||
184 | }, | 184 | }, |
185 | }; | 185 | }; |
186 | 186 | ||
187 | int __init udp_offload_init(void) | 187 | int udpv6_offload_init(void) |
188 | { | 188 | { |
189 | return inet6_add_offload(&udpv6_offload, IPPROTO_UDP); | 189 | return inet6_add_offload(&udpv6_offload, IPPROTO_UDP); |
190 | } | 190 | } |
191 | |||
192 | int udpv6_offload_exit(void) | ||
193 | { | ||
194 | return inet6_del_offload(&udpv6_offload, IPPROTO_UDP); | ||
195 | } | ||