mirror of
https://github.com/openvswitch/ovs
synced 2025-10-29 15:28:56 +00:00
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>
80 lines
3.2 KiB
C
80 lines
3.2 KiB
C
/*
|
|
* Copyright (c) 2015 Nicira, Inc.
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at:
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
|
|
#ifndef TUN_METADATA_H
|
|
#define TUN_METADATA_H 1
|
|
|
|
#include <stdint.h>
|
|
|
|
#include "openvswitch/dynamic-string.h"
|
|
#include "netlink.h"
|
|
#include "openvswitch/ofpbuf.h"
|
|
#include "openflow/openflow.h"
|
|
#include "openvswitch/tun-metadata.h"
|
|
|
|
struct flow_tnl;
|
|
struct match;
|
|
struct mf_field;
|
|
union mf_value;
|
|
struct ofputil_tlv_table_mod;
|
|
struct ofputil_tlv_table_reply;
|
|
struct tun_table;
|
|
|
|
struct tun_table *tun_metadata_alloc(const struct tun_table *old_map);
|
|
void tun_metadata_free(struct tun_table *);
|
|
void tun_metadata_postpone_free(struct tun_table *);
|
|
|
|
enum ofperr tun_metadata_table_mod(struct ofputil_tlv_table_mod *,
|
|
const struct tun_table *old_tab,
|
|
struct tun_table **new_tab);
|
|
void tun_metadata_table_request(const struct tun_table *,
|
|
struct ofputil_tlv_table_reply *);
|
|
|
|
void tun_metadata_read(const struct flow_tnl *,
|
|
const struct mf_field *, union mf_value *);
|
|
void tun_metadata_write(struct flow_tnl *,
|
|
const struct mf_field *, const union mf_value *);
|
|
void tun_metadata_set_match(const struct mf_field *,
|
|
const union mf_value *value,
|
|
const union mf_value *mask, struct match *,
|
|
char **err_str);
|
|
void tun_metadata_get_fmd(const struct flow_tnl *, struct match *flow_metadata);
|
|
|
|
void tun_metadata_from_geneve_nlattr(const struct nlattr *attr, bool is_mask,
|
|
struct flow_tnl *tun);
|
|
void tun_metadata_to_geneve_nlattr(const struct flow_tnl *tun,
|
|
const struct flow_tnl *flow,
|
|
const struct ofpbuf *key,
|
|
struct ofpbuf *);
|
|
|
|
int tun_metadata_from_geneve_udpif(const struct tun_table *,
|
|
const struct flow_tnl *flow,
|
|
const struct flow_tnl *src,
|
|
struct flow_tnl *dst);
|
|
void tun_metadata_to_geneve_udpif_mask(const struct flow_tnl *flow_src,
|
|
const struct flow_tnl *mask_src,
|
|
const struct geneve_opt *flow_src_opt,
|
|
int opts_len, struct geneve_opt *dst);
|
|
|
|
int tun_metadata_to_geneve_header(const struct flow_tnl *flow,
|
|
struct geneve_opt *, bool *crit_opt);
|
|
|
|
void tun_metadata_to_nx_match(struct ofpbuf *b, enum ofp_version oxm,
|
|
const struct match *);
|
|
void tun_metadata_match_format(struct ds *, const struct match *);
|
|
|
|
#endif /* tun-metadata.h */
|