aboutsummaryrefslogtreecommitdiffstats
path: root/net/openvswitch/flow_netlink.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2018-01-17 00:00:25 -0500
committerDavid S. Miller <davem@davemloft.net>2018-01-17 00:10:42 -0500
commitc02b3741eb99a1ec733e6134c53ba59e43e19e97 (patch)
treeff7dd96c32dec2abe530e7101378443dabcb8962 /net/openvswitch/flow_netlink.c
parent7018d1b3f20fb4308ed9bc577160cb8ffb79b62a (diff)
parent8cbab92dff778e516064c13113ca15d4869ec883 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Overlapping changes all over. The mini-qdisc bits were a little bit tricky, however. Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/openvswitch/flow_netlink.c')
-rw-r--r--net/openvswitch/flow_netlink.c51
1 files changed, 1 insertions, 50 deletions
diff --git a/net/openvswitch/flow_netlink.c b/net/openvswitch/flow_netlink.c
index bce1f78b0de5..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
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]
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_tbl 405static 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
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.u.index = nla_get_be32(attr);
648
649 /* Index has only 20-bit */
650 if (ntohl(opts.u.index) & ~INDEX_MASK) {
651 OVS_NLERR(log, "ERSPAN index number %x too large.",
652 ntohl(opts.u.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,
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)->u.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