Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

William Tu and committed by
David S. Miller
95a33208 30be8f8d

+1 -51
-1
include/uapi/linux/openvswitch.h
··· 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
+1 -50
net/openvswitch/flow_netlink.c
··· 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 ··· 333 334 * OVS_TUNNEL_KEY_ATTR_GENEVE_OPTS and covered by it. 334 335 */ 335 336 + nla_total_size(2) /* OVS_TUNNEL_KEY_ATTR_TP_SRC */ 336 - + nla_total_size(2) /* OVS_TUNNEL_KEY_ATTR_TP_DST */ 337 - + nla_total_size(4); /* OVS_TUNNEL_KEY_ATTR_ERSPAN_OPTS */ 337 + + nla_total_size(2); /* OVS_TUNNEL_KEY_ATTR_TP_DST */ 338 338 } 339 339 340 340 static size_t ovs_nsh_key_attr_size(void) ··· 400 402 .next = ovs_vxlan_ext_key_lens }, 401 403 [OVS_TUNNEL_KEY_ATTR_IPV6_SRC] = { .len = sizeof(struct in6_addr) }, 402 404 [OVS_TUNNEL_KEY_ATTR_IPV6_DST] = { .len = sizeof(struct in6_addr) }, 403 - [OVS_TUNNEL_KEY_ATTR_ERSPAN_OPTS] = { .len = sizeof(u32) }, 404 405 }; 405 406 406 407 static const struct ovs_len_tbl ··· 631 634 return 0; 632 635 } 633 636 634 - static int erspan_tun_opt_from_nlattr(const struct nlattr *attr, 635 - struct sw_flow_match *match, bool is_mask, 636 - bool log) 637 - { 638 - unsigned long opt_key_offset; 639 - struct erspan_metadata opts; 640 - 641 - BUILD_BUG_ON(sizeof(opts) > sizeof(match->key->tun_opts)); 642 - 643 - memset(&opts, 0, sizeof(opts)); 644 - opts.index = nla_get_be32(attr); 645 - 646 - /* Index has only 20-bit */ 647 - if (ntohl(opts.index) & ~INDEX_MASK) { 648 - OVS_NLERR(log, "ERSPAN index number %x too large.", 649 - ntohl(opts.index)); 650 - return -EINVAL; 651 - } 652 - 653 - SW_FLOW_KEY_PUT(match, tun_opts_len, sizeof(opts), is_mask); 654 - opt_key_offset = TUN_METADATA_OFFSET(sizeof(opts)); 655 - SW_FLOW_KEY_MEMCPY_OFFSET(match, opt_key_offset, &opts, sizeof(opts), 656 - is_mask); 657 - 658 - return 0; 659 - } 660 - 661 637 static int ip_tun_from_nlattr(const struct nlattr *attr, 662 638 struct sw_flow_match *match, bool is_mask, 663 639 bool log) ··· 737 767 opts_type = type; 738 768 break; 739 769 case OVS_TUNNEL_KEY_ATTR_PAD: 740 - break; 741 - case OVS_TUNNEL_KEY_ATTR_ERSPAN_OPTS: 742 - if (opts_type) { 743 - OVS_NLERR(log, "Multiple metadata blocks provided"); 744 - return -EINVAL; 745 - } 746 - 747 - err = erspan_tun_opt_from_nlattr(a, match, is_mask, log); 748 - if (err) 749 - return err; 750 - 751 - tun_flags |= TUNNEL_ERSPAN_OPT; 752 - opts_type = type; 753 770 break; 754 771 default: 755 772 OVS_NLERR(log, "Unknown IP tunnel attribute %d", ··· 861 904 return -EMSGSIZE; 862 905 else if (output->tun_flags & TUNNEL_VXLAN_OPT && 863 906 vxlan_opt_to_nlattr(skb, tun_opts, swkey_tun_opts_len)) 864 - return -EMSGSIZE; 865 - else if (output->tun_flags & TUNNEL_ERSPAN_OPT && 866 - nla_put_be32(skb, OVS_TUNNEL_KEY_ATTR_ERSPAN_OPTS, 867 - ((struct erspan_metadata *)tun_opts)->index)) 868 907 return -EMSGSIZE; 869 908 } 870 909 ··· 2485 2532 return err; 2486 2533 break; 2487 2534 case OVS_TUNNEL_KEY_ATTR_VXLAN_OPTS: 2488 - break; 2489 - case OVS_TUNNEL_KEY_ATTR_ERSPAN_OPTS: 2490 2535 break; 2491 2536 } 2492 2537 };