Commit 95a33208 authored by William Tu's avatar William Tu Committed by David S. Miller

Revert "openvswitch: Add erspan tunnel support."

This reverts commit ceaa001a.

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: default avatarWilliam Tu <u9012063@gmail.com>
Cc: Jiri Benc <jbenc@redhat.com>
Cc: Pravin Shelar <pshelar@ovn.org>
Acked-by: default avatarJiri Benc <jbenc@redhat.com>
Acked-by: default avatarPravin B Shelar <pshelar@ovn.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 30be8f8d
...@@ -363,7 +363,6 @@ enum ovs_tunnel_key_attr { ...@@ -363,7 +363,6 @@ enum ovs_tunnel_key_attr {
OVS_TUNNEL_KEY_ATTR_IPV6_SRC, /* struct in6_addr src IPv6 address. */ OVS_TUNNEL_KEY_ATTR_IPV6_SRC, /* struct in6_addr src IPv6 address. */
OVS_TUNNEL_KEY_ATTR_IPV6_DST, /* struct in6_addr dst IPv6 address. */ OVS_TUNNEL_KEY_ATTR_IPV6_DST, /* struct in6_addr dst IPv6 address. */
OVS_TUNNEL_KEY_ATTR_PAD, OVS_TUNNEL_KEY_ATTR_PAD,
OVS_TUNNEL_KEY_ATTR_ERSPAN_OPTS, /* be32 ERSPAN index. */
__OVS_TUNNEL_KEY_ATTR_MAX __OVS_TUNNEL_KEY_ATTR_MAX
}; };
......
...@@ -49,7 +49,6 @@ ...@@ -49,7 +49,6 @@
#include <net/mpls.h> #include <net/mpls.h>
#include <net/vxlan.h> #include <net/vxlan.h>
#include <net/tun_proto.h> #include <net/tun_proto.h>
#include <net/erspan.h>
#include "flow_netlink.h" #include "flow_netlink.h"
...@@ -334,8 +333,7 @@ size_t ovs_tun_key_attr_size(void) ...@@ -334,8 +333,7 @@ size_t ovs_tun_key_attr_size(void)
* OVS_TUNNEL_KEY_ATTR_GENEVE_OPTS and covered by it. * OVS_TUNNEL_KEY_ATTR_GENEVE_OPTS and covered by it.
*/ */
+ nla_total_size(2) /* OVS_TUNNEL_KEY_ATTR_TP_SRC */ + nla_total_size(2) /* OVS_TUNNEL_KEY_ATTR_TP_SRC */
+ nla_total_size(2) /* OVS_TUNNEL_KEY_ATTR_TP_DST */ + nla_total_size(2); /* OVS_TUNNEL_KEY_ATTR_TP_DST */
+ nla_total_size(4); /* OVS_TUNNEL_KEY_ATTR_ERSPAN_OPTS */
} }
static size_t ovs_nsh_key_attr_size(void) 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,7 +400,6 @@ static const struct ovs_len_tbl ovs_tunnel_key_lens[OVS_TUNNEL_KEY_ATTR_MAX + 1]
.next = ovs_vxlan_ext_key_lens }, .next = ovs_vxlan_ext_key_lens },
[OVS_TUNNEL_KEY_ATTR_IPV6_SRC] = { .len = sizeof(struct in6_addr) }, [OVS_TUNNEL_KEY_ATTR_IPV6_SRC] = { .len = sizeof(struct in6_addr) },
[OVS_TUNNEL_KEY_ATTR_IPV6_DST] = { .len = sizeof(struct in6_addr) }, [OVS_TUNNEL_KEY_ATTR_IPV6_DST] = { .len = sizeof(struct in6_addr) },
[OVS_TUNNEL_KEY_ATTR_ERSPAN_OPTS] = { .len = sizeof(u32) },
}; };
static const struct ovs_len_tbl static const struct ovs_len_tbl
...@@ -634,33 +631,6 @@ static int vxlan_tun_opt_from_nlattr(const struct nlattr *attr, ...@@ -634,33 +631,6 @@ static int vxlan_tun_opt_from_nlattr(const struct nlattr *attr,
return 0; return 0;
} }
static int erspan_tun_opt_from_nlattr(const struct nlattr *attr,
struct sw_flow_match *match, bool is_mask,
bool log)
{
unsigned long opt_key_offset;
struct erspan_metadata opts;
BUILD_BUG_ON(sizeof(opts) > sizeof(match->key->tun_opts));
memset(&opts, 0, sizeof(opts));
opts.index = nla_get_be32(attr);
/* Index has only 20-bit */
if (ntohl(opts.index) & ~INDEX_MASK) {
OVS_NLERR(log, "ERSPAN index number %x too large.",
ntohl(opts.index));
return -EINVAL;
}
SW_FLOW_KEY_PUT(match, tun_opts_len, sizeof(opts), is_mask);
opt_key_offset = TUN_METADATA_OFFSET(sizeof(opts));
SW_FLOW_KEY_MEMCPY_OFFSET(match, opt_key_offset, &opts, sizeof(opts),
is_mask);
return 0;
}
static int ip_tun_from_nlattr(const struct nlattr *attr, static int ip_tun_from_nlattr(const struct nlattr *attr,
struct sw_flow_match *match, bool is_mask, struct sw_flow_match *match, bool is_mask,
bool log) bool log)
...@@ -768,19 +738,6 @@ static int ip_tun_from_nlattr(const struct nlattr *attr, ...@@ -768,19 +738,6 @@ static int ip_tun_from_nlattr(const struct nlattr *attr,
break; break;
case OVS_TUNNEL_KEY_ATTR_PAD: case OVS_TUNNEL_KEY_ATTR_PAD:
break; break;
case OVS_TUNNEL_KEY_ATTR_ERSPAN_OPTS:
if (opts_type) {
OVS_NLERR(log, "Multiple metadata blocks provided");
return -EINVAL;
}
err = erspan_tun_opt_from_nlattr(a, match, is_mask, log);
if (err)
return err;
tun_flags |= TUNNEL_ERSPAN_OPT;
opts_type = type;
break;
default: default:
OVS_NLERR(log, "Unknown IP tunnel attribute %d", OVS_NLERR(log, "Unknown IP tunnel attribute %d",
type); type);
...@@ -905,10 +862,6 @@ static int __ip_tun_to_nlattr(struct sk_buff *skb, ...@@ -905,10 +862,6 @@ static int __ip_tun_to_nlattr(struct sk_buff *skb,
else if (output->tun_flags & TUNNEL_VXLAN_OPT && else if (output->tun_flags & TUNNEL_VXLAN_OPT &&
vxlan_opt_to_nlattr(skb, tun_opts, swkey_tun_opts_len)) vxlan_opt_to_nlattr(skb, tun_opts, swkey_tun_opts_len))
return -EMSGSIZE; return -EMSGSIZE;
else if (output->tun_flags & TUNNEL_ERSPAN_OPT &&
nla_put_be32(skb, OVS_TUNNEL_KEY_ATTR_ERSPAN_OPTS,
((struct erspan_metadata *)tun_opts)->index))
return -EMSGSIZE;
} }
return 0; return 0;
...@@ -2533,8 +2486,6 @@ static int validate_and_copy_set_tun(const struct nlattr *attr, ...@@ -2533,8 +2486,6 @@ static int validate_and_copy_set_tun(const struct nlattr *attr,
break; break;
case OVS_TUNNEL_KEY_ATTR_VXLAN_OPTS: case OVS_TUNNEL_KEY_ATTR_VXLAN_OPTS:
break; break;
case OVS_TUNNEL_KEY_ATTR_ERSPAN_OPTS:
break;
} }
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment