History

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.

William Tu committed 8 years ago

Commit 95a33201 parent 30be8f82 files · +1 −51Browse files

Unified · Split

2 files
  1. include/uapi/linux/openvswitch.h +0 −1
  2. net/openvswitch/flow_netlink.c +1 −50
include/uapi/linux/openvswitch.h+0−1
@@ -363,7 +363,6 @@ enum ovs_tunnel_key_attr { · 362 unmodified lines
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_MAX366 __OVS_TUNNEL_KEY_ATTR_MAX
368};367};
369 368
net/openvswitch/flow_netlink.c+1−50
@@ -49,7 +49,6 @@ · 48 unmodified lines
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) · 278 unmodified lines
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
341static size_t ovs_nsh_key_attr_size(void)339static 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 .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
408static const struct ovs_len_tbl405static const struct ovs_len_tbl
@@ -634,33 +631,6 @@ static int vxlan_tun_opt_from_nlattr(const struct nlattr *attr, · 225 unmodified lines
634 return 0;631 return 0;
635}632}
636 633
637static 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
664static int ip_tun_from_nlattr(const struct nlattr *attr,634static 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, · 101 unmodified lines
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, · 118 unmodified lines
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, · 1618 unmodified lines
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

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t