diff options
author | William Tu <u9012063@gmail.com> | 2018-01-12 15:29:22 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-01-15 14:33:16 -0500 |
commit | 95a332088ecb113c2e8753fa3f1df9b0dda9beec (patch) | |
tree | 6506e29c2c4408299d414a7b9cde7e830e4dd8f9 | |
parent | 30be8f8dba1bd2aff73e8447d59228471233a3d4 (diff) |
Revert "openvswitch: Add erspan tunnel support."
This reverts commit ceaa001a170e43608854d5290a48064f57b565ed.
The OVS_TUNNEL_KEY_ATTR_ERSPAN_OPTS attr should be designed
as a nested attribute to support all ERSPAN v1 and v2's fields.
The current attr is a be32 supporting only one field. Thus, this
patch reverts it and later patch will redo it using nested attr.
Signed-off-by: William Tu <u9012063@gmail.com>
Cc: Jiri Benc <jbenc@redhat.com>
Cc: Pravin Shelar <pshelar@ovn.org>
Acked-by: Jiri Benc <jbenc@redhat.com>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | include/uapi/linux/openvswitch.h | 1 | ||||
-rw-r--r-- | net/openvswitch/flow_netlink.c | 51 |
2 files changed, 1 insertions, 51 deletions
diff --git a/include/uapi/linux/openvswitch.h b/include/uapi/linux/openvswitch.h index 4265d7f9e1f2..dcfab5e3b55c 100644 --- a/include/uapi/linux/openvswitch.h +++ b/include/uapi/linux/openvswitch.h | |||
@@ -363,7 +363,6 @@ enum ovs_tunnel_key_attr { | |||
363 | OVS_TUNNEL_KEY_ATTR_IPV6_SRC, /* struct in6_addr src IPv6 address. */ | 363 | OVS_TUNNEL_KEY_ATTR_IPV6_SRC, /* struct in6_addr src IPv6 address. */ |
364 | OVS_TUNNEL_KEY_ATTR_IPV6_DST, /* struct in6_addr dst IPv6 address. */ | 364 | OVS_TUNNEL_KEY_ATTR_IPV6_DST, /* struct in6_addr dst IPv6 address. */ |
365 | OVS_TUNNEL_KEY_ATTR_PAD, | 365 | OVS_TUNNEL_KEY_ATTR_PAD, |
366 | OVS_TUNNEL_KEY_ATTR_ERSPAN_OPTS, /* be32 ERSPAN index. */ | ||
367 | __OVS_TUNNEL_KEY_ATTR_MAX | 366 | __OVS_TUNNEL_KEY_ATTR_MAX |
368 | }; | 367 | }; |
369 | 368 | ||
diff --git a/net/openvswitch/flow_netlink.c b/net/openvswitch/flow_netlink.c index 624ea74353dd..f143908b651d 100644 --- a/net/openvswitch/flow_netlink.c +++ b/net/openvswitch/flow_netlink.c | |||
@@ -49,7 +49,6 @@ | |||
49 | #include <net/mpls.h> | 49 | #include <net/mpls.h> |
50 | #include <net/vxlan.h> | 50 | #include <net/vxlan.h> |
51 | #include <net/tun_proto.h> | 51 | #include <net/tun_proto.h> |
52 | #include <net/erspan.h> | ||
53 | 52 | ||
54 | #include "flow_netlink.h" | 53 | #include "flow_netlink.h" |
55 | 54 | ||
@@ -334,8 +333,7 @@ size_t ovs_tun_key_attr_size(void) | |||
334 | * OVS_TUNNEL_KEY_ATTR_GENEVE_OPTS and covered by it. | 333 | * OVS_TUNNEL_KEY_ATTR_GENEVE_OPTS and covered by it. |
335 | */ | 334 | */ |
336 | + nla_total_size(2) /* OVS_TUNNEL_KEY_ATTR_TP_SRC */ | 335 | + nla_total_size(2) /* OVS_TUNNEL_KEY_ATTR_TP_SRC */ |
337 | + nla_total_size(2) /* OVS_TUNNEL_KEY_ATTR_TP_DST */ | 336 | + nla_total_size(2); /* OVS_TUNNEL_KEY_ATTR_TP_DST */ |
338 | + nla_total_size(4); /* OVS_TUNNEL_KEY_ATTR_ERSPAN_OPTS */ | ||
339 | } | 337 | } |
340 | 338 | ||
341 | static size_t ovs_nsh_key_attr_size(void) | 339 | static size_t ovs_nsh_key_attr_size(void) |
@@ -402,7 +400,6 @@ static const struct ovs_len_tbl ovs_tunnel_key_lens[OVS_TUNNEL_KEY_ATTR_MAX + 1] | |||
402 | .next = ovs_vxlan_ext_key_lens }, | 400 | .next = ovs_vxlan_ext_key_lens }, |
403 | [OVS_TUNNEL_KEY_ATTR_IPV6_SRC] = { .len = sizeof(struct in6_addr) }, | 401 | [OVS_TUNNEL_KEY_ATTR_IPV6_SRC] = { .len = sizeof(struct in6_addr) }, |
404 | [OVS_TUNNEL_KEY_ATTR_IPV6_DST] = { .len = sizeof(struct in6_addr) }, | 402 | [OVS_TUNNEL_KEY_ATTR_IPV6_DST] = { .len = sizeof(struct in6_addr) }, |
405 | [OVS_TUNNEL_KEY_ATTR_ERSPAN_OPTS] = { .len = sizeof(u32) }, | ||
406 | }; | 403 | }; |
407 | 404 | ||
408 | static const struct ovs_len_tbl | 405 | static const struct ovs_len_tbl |
@@ -634,33 +631,6 @@ static int vxlan_tun_opt_from_nlattr(const struct nlattr *attr, | |||
634 | return 0; | 631 | return 0; |
635 | } | 632 | } |
636 | 633 | ||
637 | static int erspan_tun_opt_from_nlattr(const struct nlattr *attr, | ||
638 | struct sw_flow_match *match, bool is_mask, | ||
639 | bool log) | ||
640 | { | ||
641 | unsigned long opt_key_offset; | ||
642 | struct erspan_metadata opts; | ||
643 | |||
644 | BUILD_BUG_ON(sizeof(opts) > sizeof(match->key->tun_opts)); | ||
645 | |||
646 | memset(&opts, 0, sizeof(opts)); | ||
647 | opts.index = nla_get_be32(attr); | ||
648 | |||
649 | /* Index has only 20-bit */ | ||
650 | if (ntohl(opts.index) & ~INDEX_MASK) { | ||
651 | OVS_NLERR(log, "ERSPAN index number %x too large.", | ||
652 | ntohl(opts.index)); | ||
653 | return -EINVAL; | ||
654 | } | ||
655 | |||
656 | SW_FLOW_KEY_PUT(match, tun_opts_len, sizeof(opts), is_mask); | ||
657 | opt_key_offset = TUN_METADATA_OFFSET(sizeof(opts)); | ||
658 | SW_FLOW_KEY_MEMCPY_OFFSET(match, opt_key_offset, &opts, sizeof(opts), | ||
659 | is_mask); | ||
660 | |||
661 | return 0; | ||
662 | } | ||
663 | |||
664 | static int ip_tun_from_nlattr(const struct nlattr *attr, | 634 | static int ip_tun_from_nlattr(const struct nlattr *attr, |
665 | struct sw_flow_match *match, bool is_mask, | 635 | struct sw_flow_match *match, bool is_mask, |
666 | bool log) | 636 | bool log) |
@@ -768,19 +738,6 @@ static int ip_tun_from_nlattr(const struct nlattr *attr, | |||
768 | break; | 738 | break; |
769 | case OVS_TUNNEL_KEY_ATTR_PAD: | 739 | case OVS_TUNNEL_KEY_ATTR_PAD: |
770 | break; | 740 | break; |
771 | case OVS_TUNNEL_KEY_ATTR_ERSPAN_OPTS: | ||
772 | if (opts_type) { | ||
773 | OVS_NLERR(log, "Multiple metadata blocks provided"); | ||
774 | return -EINVAL; | ||
775 | } | ||
776 | |||
777 | err = erspan_tun_opt_from_nlattr(a, match, is_mask, log); | ||
778 | if (err) | ||
779 | return err; | ||
780 | |||
781 | tun_flags |= TUNNEL_ERSPAN_OPT; | ||
782 | opts_type = type; | ||
783 | break; | ||
784 | default: | 741 | default: |
785 | OVS_NLERR(log, "Unknown IP tunnel attribute %d", | 742 | OVS_NLERR(log, "Unknown IP tunnel attribute %d", |
786 | type); | 743 | type); |
@@ -905,10 +862,6 @@ static int __ip_tun_to_nlattr(struct sk_buff *skb, | |||
905 | else if (output->tun_flags & TUNNEL_VXLAN_OPT && | 862 | else if (output->tun_flags & TUNNEL_VXLAN_OPT && |
906 | vxlan_opt_to_nlattr(skb, tun_opts, swkey_tun_opts_len)) | 863 | vxlan_opt_to_nlattr(skb, tun_opts, swkey_tun_opts_len)) |
907 | return -EMSGSIZE; | 864 | return -EMSGSIZE; |
908 | else if (output->tun_flags & TUNNEL_ERSPAN_OPT && | ||
909 | nla_put_be32(skb, OVS_TUNNEL_KEY_ATTR_ERSPAN_OPTS, | ||
910 | ((struct erspan_metadata *)tun_opts)->index)) | ||
911 | return -EMSGSIZE; | ||
912 | } | 865 | } |
913 | 866 | ||
914 | return 0; | 867 | return 0; |
@@ -2533,8 +2486,6 @@ static int validate_and_copy_set_tun(const struct nlattr *attr, | |||
2533 | break; | 2486 | break; |
2534 | case OVS_TUNNEL_KEY_ATTR_VXLAN_OPTS: | 2487 | case OVS_TUNNEL_KEY_ATTR_VXLAN_OPTS: |
2535 | break; | 2488 | break; |
2536 | case OVS_TUNNEL_KEY_ATTR_ERSPAN_OPTS: | ||
2537 | break; | ||
2538 | } | 2489 | } |
2539 | }; | 2490 | }; |
2540 | 2491 | ||