aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6/exthdrs.c
diff options
context:
space:
mode:
authorVlad Yasevich <vyasevic@redhat.com>2012-11-15 03:49:19 -0500
committerDavid S. Miller <davem@davemloft.net>2012-11-15 17:36:18 -0500
commit2207afc8bfd80d596b524d4feb6b27f5ce359d59 (patch)
treed49e698603a536b4b88ec6482eecd15e01ef2533 /net/ipv6/exthdrs.c
parent5edbb07dc9474b7d4cd4391a2e6551ad067a0f96 (diff)
ipv6: Move exthdr offload support into separate file
Move the exthdr offload functionality into a separeate file in preparate for moving it out of the module Signed-off-by: Vlad Yasevich <vyasevic@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6/exthdrs.c')
-rw-r--r--net/ipv6/exthdrs.c40
1 files changed, 4 insertions, 36 deletions
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);