summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorJesse Gross <jesse@kernel.org>2016-04-19 18:36:04 -0700
committerJesse Gross <jesse@kernel.org>2016-09-19 09:52:22 -0700
commit8d8ab6c2d5743eb229a5e7c27ccd963a2c103adb (patch)
treed198a78ddf968ab119e029ca998eba2337812cd8 /include
parent56fb20c4a1622c0f19bd2865c6688bdc78d5b40f (diff)
downloadopenvswitch-8d8ab6c2d5743eb229a5e7c27ccd963a2c103adb.tar.gz
tun-metadata: Manage tunnel TLV mapping table on a per-bridge basis.
When using tunnel TLVs (at the moment, this means Geneve options), a controller must first map the class and type onto an appropriate OXM field so that it can be used in OVS flow operations. This table is managed using OpenFlow extensions. The original code that added support for TLVs made the mapping table global as a simplification. However, this is not really logically correct as the OpenFlow management commands are operating on a per-bridge basis. This removes the original limitation to make the table per-bridge. One nice result of this change is that it is generally clearer whether the tunnel metadata is in datapath or OpenFlow format. Rather than allowing ad-hoc format changes and trying to handle both formats in the tunnel metadata functions, the format is more clearly separated by function. Datapaths (both kernel and userspace) use datapath format and it is not changed during the upcall process. At the beginning of action translation, tunnel metadata is converted to OpenFlow format and flows and wildcards are translated back at the end of the process. As an additional benefit, this change improves performance in some flow setup situations by keeping the tunnel metadata in the original packet format in more cases. This helps when copies need to be made as the amount of data touched is only what is present in the packet rather than the maximum amount of metadata supported. Co-authored-by: Madhu Challa <challa@noironetworks.com> Signed-off-by: Madhu Challa <challa@noironetworks.com> Signed-off-by: Jesse Gross <jesse@kernel.org> Acked-by: Ben Pfaff <blp@ovn.org>
Diffstat (limited to 'include')
-rw-r--r--include/openvswitch/match.h3
-rw-r--r--include/openvswitch/ofp-parse.h3
-rw-r--r--include/openvswitch/ofp-util.h12
-rw-r--r--include/openvswitch/tun-metadata.h4
4 files changed, 15 insertions, 7 deletions
diff --git a/include/openvswitch/match.h b/include/openvswitch/match.h
index 3b7f32fdf..0b5f05052 100644
--- a/include/openvswitch/match.h
+++ b/include/openvswitch/match.h
@@ -211,7 +211,8 @@ bool minimatch_equal(const struct minimatch *a, const struct minimatch *b);
bool minimatch_matches_flow(const struct minimatch *, const struct flow *);
-void minimatch_format(const struct minimatch *, struct ds *, int priority);
+void minimatch_format(const struct minimatch *, const struct tun_table *,
+ struct ds *, int priority);
char *minimatch_to_string(const struct minimatch *, int priority);
#endif /* match.h */
diff --git a/include/openvswitch/ofp-parse.h b/include/openvswitch/ofp-parse.h
index e68e57b00..ed7a09c90 100644
--- a/include/openvswitch/ofp-parse.h
+++ b/include/openvswitch/ofp-parse.h
@@ -68,7 +68,8 @@ char *parse_ofp_flow_stats_request_str(struct ofputil_flow_stats_request *,
OVS_WARN_UNUSED_RESULT;
char *parse_ofp_exact_flow(struct flow *flow, struct flow_wildcards *wc,
- const char *s, const struct simap *portno_names);
+ const struct tun_table *tun_table, const char *s,
+ const struct simap *portno_names);
char *parse_ofp_meter_mod_str(struct ofputil_meter_mod *, const char *string,
int command,
diff --git a/include/openvswitch/ofp-util.h b/include/openvswitch/ofp-util.h
index da0aa0108..f3cb62445 100644
--- a/include/openvswitch/ofp-util.h
+++ b/include/openvswitch/ofp-util.h
@@ -220,7 +220,8 @@ void ofputil_normalize_match_quiet(struct match *);
void ofputil_match_to_ofp10_match(const struct match *, struct ofp10_match *);
/* Work with ofp11_match. */
-enum ofperr ofputil_pull_ofp11_match(struct ofpbuf *, struct match *,
+enum ofperr ofputil_pull_ofp11_match(struct ofpbuf *, const struct tun_table *,
+ struct match *,
uint16_t *padded_match_len);
enum ofperr ofputil_pull_ofp11_mask(struct ofpbuf *, struct match *,
struct mf_bitmap *bm);
@@ -329,6 +330,7 @@ struct ofputil_flow_mod {
enum ofperr ofputil_decode_flow_mod(struct ofputil_flow_mod *,
const struct ofp_header *,
enum ofputil_protocol,
+ const struct tun_table *,
struct ofpbuf *ofpacts,
ofp_port_t max_port,
uint8_t max_table);
@@ -347,7 +349,8 @@ struct ofputil_flow_stats_request {
};
enum ofperr ofputil_decode_flow_stats_request(
- struct ofputil_flow_stats_request *, const struct ofp_header *);
+ struct ofputil_flow_stats_request *, const struct ofp_header *,
+ const struct tun_table *);
struct ofpbuf *ofputil_encode_flow_stats_request(
const struct ofputil_flow_stats_request *, enum ofputil_protocol);
@@ -376,7 +379,8 @@ int ofputil_decode_flow_stats_reply(struct ofputil_flow_stats *,
bool flow_age_extension,
struct ofpbuf *ofpacts);
void ofputil_append_flow_stats_reply(const struct ofputil_flow_stats *,
- struct ovs_list *replies);
+ struct ovs_list *replies,
+ const struct tun_table *);
/* Aggregate stats reply, independent of protocol. */
struct ofputil_aggregate_stats {
@@ -450,6 +454,7 @@ struct ofputil_packet_in {
void ofputil_packet_in_destroy(struct ofputil_packet_in *);
enum ofperr ofputil_decode_packet_in(const struct ofp_header *, bool loose,
+ const struct tun_table *,
struct ofputil_packet_in *,
size_t *total_len, uint32_t *buffer_id,
struct ofpbuf *continuation);
@@ -501,6 +506,7 @@ struct ofpbuf *ofputil_encode_packet_in_private(
enum ofperr ofputil_decode_packet_in_private(
const struct ofp_header *, bool loose,
+ const struct tun_table *,
struct ofputil_packet_in_private *,
size_t *total_len, uint32_t *buffer_id);
diff --git a/include/openvswitch/tun-metadata.h b/include/openvswitch/tun-metadata.h
index 8e3a13f8c..1d6b73757 100644
--- a/include/openvswitch/tun-metadata.h
+++ b/include/openvswitch/tun-metadata.h
@@ -48,7 +48,7 @@ struct tun_metadata {
uint64_t map; /* 1-bit for each present TLV. */
uint8_t len; /* Length of data in 'opts'. */
} present;
- struct tun_table *tab; /* Types & lengths for 'opts' and 'opt_map'. */
+ const struct tun_table *tab; /* Types & lengths for 'opts' and 'opt_map'. */
#if UINTPTR_MAX == UINT32_MAX
uint8_t pad[4]; /* Pad to 64-bit boundary. */
@@ -87,7 +87,7 @@ struct tun_metadata_match_entry {
};
/* Allocation of options inside struct match. This is important if we don't
- * have access to a global allocation table - either because there isn't one
+ * have access to an allocation table - either because there isn't one
* (ovs-ofctl) or if we need to keep the allocation outside of packet
* processing context (Packet-In). These structures never have dynamically
* allocated memory because the address space is never fragmented. */