aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
Diffstat (limited to 'net')
-rw-r--r--net/ipv6/Makefile2
-rw-r--r--net/ipv6/exthdrs.c40
-rw-r--r--net/ipv6/exthdrs_offload.c47
-rw-r--r--net/ipv6/ip6_offload.h3
4 files changed, 55 insertions, 37 deletions
diff --git a/net/ipv6/Makefile b/net/ipv6/Makefile
index 04b5c9657f83..7f250773ecc9 100644
--- a/net/ipv6/Makefile
+++ b/net/ipv6/Makefile
@@ -10,7 +10,7 @@ ipv6-objs := af_inet6.o anycast.o ip6_output.o ip6_input.o addrconf.o \
10 raw.o protocol.o icmp.o mcast.o reassembly.o tcp_ipv6.o \ 10 raw.o protocol.o icmp.o mcast.o reassembly.o tcp_ipv6.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 12
13ipv6-offload := ip6_offload.o tcpv6_offload.o udp_offload.o 13ipv6-offload := ip6_offload.o tcpv6_offload.o udp_offload.o exthdrs_offload.o
14 14
15ipv6-$(CONFIG_SYSCTL) = sysctl_net_ipv6.o 15ipv6-$(CONFIG_SYSCTL) = sysctl_net_ipv6.o
16ipv6-$(CONFIG_IPV6_MROUTE) += ip6mr.o 16ipv6-$(CONFIG_IPV6_MROUTE) += ip6mr.o
diff --git a/net/ipv6/exthdrs.c b/net/ipv6/exthdrs.c
index de6559e3aa0a..70fbf6bc5a87 100644
--- a/net/ipv6/exthdrs.c
+++ b/net/ipv6/exthdrs.c
@@ -48,6 +48,7 @@
48#endif 48#endif
49 49
50#include <asm/uaccess.h> 50#include <asm/uaccess.h>
51#include "ip6_offload.h"
51 52
52int ipv6_find_tlv(struct sk_buff *skb, int offset, int type) 53int ipv6_find_tlv(struct sk_buff *skb, int offset, int type)
53{ 54{
@@ -528,20 +529,12 @@ unknown_rh:
528 529
529static const struct inet6_protocol rthdr_protocol = { 530static const struct inet6_protocol rthdr_protocol = {
530 .handler = ipv6_rthdr_rcv, 531 .handler = ipv6_rthdr_rcv,
531 .flags = INET6_PROTO_NOPOLICY | INET6_PROTO_GSO_EXTHDR, 532 .flags = INET6_PROTO_NOPOLICY,
532};
533
534static const struct net_offload rthdr_offload = {
535 .flags = INET6_PROTO_GSO_EXTHDR,
536}; 533};
537 534
538static const struct inet6_protocol destopt_protocol = { 535static const struct inet6_protocol destopt_protocol = {
539 .handler = ipv6_destopt_rcv, 536 .handler = ipv6_destopt_rcv,
540 .flags = INET6_PROTO_NOPOLICY | INET6_PROTO_GSO_EXTHDR, 537 .flags = INET6_PROTO_NOPOLICY,
541};
542
543static const struct net_offload dstopt_offload = {
544 .flags = INET6_PROTO_GSO_EXTHDR,
545}; 538};
546 539
547static const struct inet6_protocol nodata_protocol = { 540static const struct inet6_protocol nodata_protocol = {
@@ -549,32 +542,6 @@ static const struct inet6_protocol nodata_protocol = {
549 .flags = INET6_PROTO_NOPOLICY, 542 .flags = INET6_PROTO_NOPOLICY,
550}; 543};
551 544
552static int ipv6_exthdrs_offload_init(void)
553{
554 int ret;
555
556 ret = inet6_add_offload(&rthdr_offload, IPPROTO_ROUTING);
557 if (!ret)
558 goto out;
559
560 ret = inet6_add_offload(&dstopt_offload, IPPROTO_DSTOPTS);
561 if (!ret)
562 goto out_rt;
563
564out:
565 return ret;
566
567out_rt:
568 inet_del_offload(&rthdr_offload, IPPROTO_ROUTING);
569 goto out;
570}
571
572static void ipv6_exthdrs_offload_exit(void)
573{
574 inet_del_offload(&rthdr_offload, IPPROTO_ROUTING);
575 inet_del_offload(&rthdr_offload, IPPROTO_DSTOPTS);
576}
577
578int __init ipv6_exthdrs_init(void) 545int __init ipv6_exthdrs_init(void)
579{ 546{
580 int ret; 547 int ret;
@@ -608,6 +575,7 @@ out_offload:
608 575
609void ipv6_exthdrs_exit(void) 576void ipv6_exthdrs_exit(void)
610{ 577{
578 ipv6_exthdrs_offload_exit();
611 inet6_del_protocol(&nodata_protocol, IPPROTO_NONE); 579 inet6_del_protocol(&nodata_protocol, IPPROTO_NONE);
612 inet6_del_protocol(&destopt_protocol, IPPROTO_DSTOPTS); 580 inet6_del_protocol(&destopt_protocol, IPPROTO_DSTOPTS);
613 inet6_del_protocol(&rthdr_protocol, IPPROTO_ROUTING); 581 inet6_del_protocol(&rthdr_protocol, IPPROTO_ROUTING);
diff --git a/net/ipv6/exthdrs_offload.c b/net/ipv6/exthdrs_offload.c
new file mode 100644
index 000000000000..271bf4a97023
--- /dev/null
+++ b/net/ipv6/exthdrs_offload.c
@@ -0,0 +1,47 @@
1/*
2 * IPV6 GSO/GRO offload support
3 * Linux INET6 implementation
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version
8 * 2 of the License, or (at your option) any later version.
9 *
10 * IPV6 Extension Header GSO/GRO support
11 */
12#include <net/protocol.h>
13#include "ip6_offload.h"
14
15static const struct net_offload rthdr_offload = {
16 .flags = INET6_PROTO_GSO_EXTHDR,
17};
18
19static const struct net_offload dstopt_offload = {
20 .flags = INET6_PROTO_GSO_EXTHDR,
21};
22
23int __init ipv6_exthdrs_offload_init(void)
24{
25 int ret;
26
27 ret = inet6_add_offload(&rthdr_offload, IPPROTO_ROUTING);
28 if (!ret)
29 goto out;
30
31 ret = inet6_add_offload(&dstopt_offload, IPPROTO_DSTOPTS);
32 if (!ret)
33 goto out_rt;
34
35out:
36 return ret;
37
38out_rt:
39 inet_del_offload(&rthdr_offload, IPPROTO_ROUTING);
40 goto out;
41}
42
43void ipv6_exthdrs_offload_exit(void)
44{
45 inet_del_offload(&rthdr_offload, IPPROTO_ROUTING);
46 inet_del_offload(&rthdr_offload, IPPROTO_DSTOPTS);
47}
diff --git a/net/ipv6/ip6_offload.h b/net/ipv6/ip6_offload.h
index dff79362ad04..4e88ddb52a2c 100644
--- a/net/ipv6/ip6_offload.h
+++ b/net/ipv6/ip6_offload.h
@@ -11,6 +11,9 @@
11#ifndef __ip6_offload_h 11#ifndef __ip6_offload_h
12#define __ip6_offload_h 12#define __ip6_offload_h
13 13
14int ipv6_exthdrs_offload_init(void);
15void ipv6_exthdrs_offload_exit(void);
16
14int udp_offload_init(void); 17int udp_offload_init(void);
15void udp_offload_cleanup(void); 18void udp_offload_cleanup(void);
16 19