summaryrefslogtreecommitdiff
path: root/ofproto/ofproto-provider.h
diff options
context:
space:
mode:
authorYi-Hung Wei <yihung.wei@gmail.com>2017-01-20 15:12:21 -0800
committerJoe Stringer <joe@ovn.org>2017-02-01 13:05:34 -0800
commit04f48a68c42851348ad0ff6105c79b32f26c050a (patch)
treecc0d424c83e34a3bc66b5d8ea8acfc5780b4b011 /ofproto/ofproto-provider.h
parentdc2dab6e6de50a6b6ef25eb2cf761fae3a3a33a7 (diff)
downloadopenvswitch-04f48a68c42851348ad0ff6105c79b32f26c050a.tar.gz
ofp-actions: Fix variable length meta-flow OXMs.
Previously, if a flow action that involves a tunnel metadata meta-flow field is dumped from vswitchd, the replied field length in the OXM header is filled with the maximum possible field length, instead of the length configured in the tunnel TLV mapping table. To solve this issue, this patch introduces the following changes. In order to maintain the correct length of variable length mf_fields (i.e. tun_metadata), this patch creates a per-switch based map (struct vl_mff_map) that hosts the variable length mf_fields. This map is updated when a controller adds/deletes tlv-mapping entries to/from a switch. Although the per-swtch based vl_mff_map only hosts tun_metadata for now, it is able to support new variable length mf_fields in the future. With this commit, when a switch decodes a flow action with mf_field, the switch firstly looks up the global mf_fields map to identify the mf_field type. For the variable length mf_fields, the switch uses the vl_mff_map to get the configured mf_field entries. By lookig up vl_mff_map, the switch can check if the added flow action access beyond the configured size of a variable length mf_field, and the switch reports an ofperr if the controller adds a flow with unmapped variable length mf_field. Later on, when a controller request flows from the switch, with the per-switch based mf_fields, the switch will encode the OXM header with correct length for variable length mf_fields. To use the vl_mff_map for decoding flow actions, extract-ofp-actions is updated to pass the vl_mff_map to the required action decoding functions. Also, a new error code is introduced to identify a flow with an invalid variable length mf_field. Moreover, a testcase is added to prevent future regressions. Committer notes: - Factor out common code - Style fixups - Rename OFPERR_NXFMFC_INVALID_VL_MFF -> OFPERR_NXFMFC_INVALID_TLV_FIELD VMWare-BZ: #1768370 Reported-by: Harold Lim <haroldl@vmware.com> Suggested-by: Joe Stringer <joe@ovn.org> Suggested-by: Jarno Rajahalme <jarno@ovn.org> Signed-off-by: Yi-Hung Wei <yihung.wei@gmail.com> Signed-off-by: Joe Stringer <joe@ovn.org>
Diffstat (limited to 'ofproto/ofproto-provider.h')
-rw-r--r--ofproto/ofproto-provider.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/ofproto/ofproto-provider.h b/ofproto/ofproto-provider.h
index 3739ebce7..eb3237568 100644
--- a/ofproto/ofproto-provider.h
+++ b/ofproto/ofproto-provider.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016 Nicira, Inc.
+ * Copyright (c) 2009-2017 Nicira, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -59,6 +59,7 @@ struct bfd_cfg;
struct meter;
struct ofoperation;
struct ofproto_packet_out;
+struct vl_mff_map;
extern struct ovs_mutex ofproto_mutex;
@@ -126,6 +127,10 @@ struct ofproto {
/* Tunnel TLV mapping table. */
OVSRCU_TYPE(struct tun_table *) metadata_tab;
+
+ /* Variable length mf_field mapping. Stores all configured variable length
+ * meta-flow fields (struct mf_field) in a switch. */
+ struct vl_mff_map vl_mff_map;
};
void ofproto_init_tables(struct ofproto *, int n_tables);