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.
Unified · Split
| @@ -363,7 +363,6 @@ enum ovs_tunnel_key_attr { · 362 unmodified lines | ||
| 363 | 363 | OVS_TUNNEL_KEY_ATTR_IPV6_SRC, /* struct in6_addr src IPv6 address. */ |
| 364 | 364 | OVS_TUNNEL_KEY_ATTR_IPV6_DST, /* struct in6_addr dst IPv6 address. */ |
| 365 | 365 | OVS_TUNNEL_KEY_ATTR_PAD, |
| 366 | − OVS_TUNNEL_KEY_ATTR_ERSPAN_OPTS, /* be32 ERSPAN index. */ | |
| 367 | 366 | __OVS_TUNNEL_KEY_ATTR_MAX |
| 368 | 367 | }; |
| 369 | 368 | |
| @@ -49,7 +49,6 @@ · 48 unmodified lines | ||
| 49 | 49 | #include <net/mpls.h> |
| 50 | 50 | #include <net/vxlan.h> |
| 51 | 51 | #include <net/tun_proto.h> |
| 52 | −#include <net/erspan.h> | |
| 53 | 52 | |
| 54 | 53 | #include "flow_netlink.h" |
| 55 | 54 | |
| @@ -334,8 +333,7 @@ size_t ovs_tun_key_attr_size(void) · 278 unmodified lines | ||
| 334 | 333 | * OVS_TUNNEL_KEY_ATTR_GENEVE_OPTS and covered by it. |
| 335 | 334 | */ |
| 336 | 335 | + nla_total_size(2) /* OVS_TUNNEL_KEY_ATTR_TP_SRC */ |
| 337 | − + nla_total_size(2) /* OVS_TUNNEL_KEY_ATTR_TP_DST */ | |
| 338 | − + nla_total_size(4); /* OVS_TUNNEL_KEY_ATTR_ERSPAN_OPTS */ | |
| 336 | + + nla_total_size(2); /* OVS_TUNNEL_KEY_ATTR_TP_DST */ | |
| 339 | 337 | } |
| 340 | 338 | |
| 341 | 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] · 60 unmodified lines | ||
| 402 | 400 | .next = ovs_vxlan_ext_key_lens }, |
| 403 | 401 | [OVS_TUNNEL_KEY_ATTR_IPV6_SRC] = { .len = sizeof(struct in6_addr) }, |
| 404 | 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 | 405 | static const struct ovs_len_tbl |
| @@ -634,33 +631,6 @@ static int vxlan_tun_opt_from_nlattr(const struct nlattr *attr, · 225 unmodified lines | ||
| 634 | 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 | 634 | static int ip_tun_from_nlattr(const struct nlattr *attr, |
| 665 | 635 | struct sw_flow_match *match, bool is_mask, |
| 666 | 636 | bool log) |
| @@ -768,19 +738,6 @@ static int ip_tun_from_nlattr(const struct nlattr *attr, · 101 unmodified lines | ||
| 768 | 738 | break; |
| 769 | 739 | case OVS_TUNNEL_KEY_ATTR_PAD: |
| 770 | 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 | 741 | default: |
| 785 | 742 | OVS_NLERR(log, "Unknown IP tunnel attribute %d", |
| 786 | 743 | type); |
| @@ -905,10 +862,6 @@ static int __ip_tun_to_nlattr(struct sk_buff *skb, · 118 unmodified lines | ||
| 905 | 862 | else if (output->tun_flags & TUNNEL_VXLAN_OPT && |
| 906 | 863 | vxlan_opt_to_nlattr(skb, tun_opts, swkey_tun_opts_len)) |
| 907 | 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 | 867 | return 0; |
| @@ -2533,8 +2486,6 @@ static int validate_and_copy_set_tun(const struct nlattr *attr, · 1618 unmodified lines | ||
| 2533 | 2486 | break; |
| 2534 | 2487 | case OVS_TUNNEL_KEY_ATTR_VXLAN_OPTS: |
| 2535 | 2488 | break; |
| 2536 | − case OVS_TUNNEL_KEY_ATTR_ERSPAN_OPTS: | |
| 2537 | − break; | |
| 2538 | 2489 | } |
| 2539 | 2490 | }; |
| 2540 | 2491 | |