2016-04-04 21:32:02 -04:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014, 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 OPENVSWITCH_PACKETS_H
|
|
|
|
#define OPENVSWITCH_PACKETS_H 1
|
|
|
|
|
2017-11-06 14:42:32 -08:00
|
|
|
#include <sys/types.h>
|
2016-04-04 21:32:02 -04:00
|
|
|
#include <netinet/in.h>
|
|
|
|
#include "openvswitch/tun-metadata.h"
|
|
|
|
|
2017-07-30 18:03:24 -07:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2016-04-04 21:32:02 -04:00
|
|
|
/* Tunnel information used in flow key and metadata. */
|
|
|
|
struct flow_tnl {
|
|
|
|
ovs_be32 ip_dst;
|
|
|
|
struct in6_addr ipv6_dst;
|
|
|
|
ovs_be32 ip_src;
|
|
|
|
struct in6_addr ipv6_src;
|
|
|
|
ovs_be64 tun_id;
|
|
|
|
uint16_t flags;
|
|
|
|
uint8_t ip_tos;
|
|
|
|
uint8_t ip_ttl;
|
|
|
|
ovs_be16 tp_src;
|
|
|
|
ovs_be16 tp_dst;
|
|
|
|
ovs_be16 gbp_id;
|
|
|
|
uint8_t gbp_flags;
|
2018-05-15 16:10:48 -04:00
|
|
|
uint8_t erspan_ver;
|
|
|
|
uint32_t erspan_idx;
|
|
|
|
uint8_t erspan_dir;
|
|
|
|
uint8_t erspan_hwid;
|
2019-11-25 11:19:23 -08:00
|
|
|
uint8_t gtpu_flags;
|
|
|
|
uint8_t gtpu_msgtype;
|
|
|
|
uint8_t pad1[4]; /* Pad to 64 bits. */
|
2016-04-04 21:32:02 -04:00
|
|
|
struct tun_metadata metadata;
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Some flags are exposed through OpenFlow while others are used only
|
|
|
|
* internally. */
|
|
|
|
|
|
|
|
/* Public flags */
|
|
|
|
#define FLOW_TNL_F_OAM (1 << 0)
|
|
|
|
|
|
|
|
#define FLOW_TNL_PUB_F_MASK ((1 << 1) - 1)
|
|
|
|
|
|
|
|
/* Private flags */
|
|
|
|
#define FLOW_TNL_F_DONT_FRAGMENT (1 << 1)
|
|
|
|
#define FLOW_TNL_F_CSUM (1 << 2)
|
|
|
|
#define FLOW_TNL_F_KEY (1 << 3)
|
|
|
|
|
|
|
|
#define FLOW_TNL_F_MASK ((1 << 4) - 1)
|
|
|
|
|
|
|
|
/* Unfortunately, a "struct flow" sometimes has to handle OpenFlow port
|
|
|
|
* numbers and other times datapath (dpif) port numbers. This union allows
|
|
|
|
* access to both. */
|
|
|
|
union flow_in_port {
|
|
|
|
odp_port_t odp_port;
|
|
|
|
ofp_port_t ofp_port;
|
|
|
|
};
|
|
|
|
|
2017-03-01 17:47:59 -05:00
|
|
|
union flow_vlan_hdr {
|
|
|
|
ovs_be32 qtag;
|
|
|
|
struct {
|
|
|
|
ovs_be16 tpid; /* ETH_TYPE_VLAN_DOT1Q or ETH_TYPE_DOT1AD */
|
|
|
|
ovs_be16 tci;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2018-01-06 13:47:51 +08:00
|
|
|
struct ovs_key_nsh {
|
|
|
|
uint8_t flags;
|
2018-01-11 13:24:01 +08:00
|
|
|
uint8_t ttl;
|
2018-01-06 13:47:51 +08:00
|
|
|
uint8_t mdtype;
|
|
|
|
uint8_t np;
|
|
|
|
ovs_be32 path_hdr;
|
|
|
|
ovs_be32 context[4];
|
userspace: Add support for NSH MD1 match fields
This patch adds support for NSH packet header fields to the OVS
control plane and the userspace datapath. Initially we support the
fields of the NSH base header as defined in
https://www.ietf.org/id/draft-ietf-sfc-nsh-13.txt
and the fixed context headers specified for metadata format MD1.
The variable length MD2 format is parsed but the TLV context headers
are not yet available for matching.
The NSH fields are modelled as experimenter fields with the dedicated
experimenter class 0x005ad650 proposed for NSH in ONF. The following
fields are defined:
NXOXM code ofctl name Size Comment
=====================================================================
NXOXM_NSH_FLAGS nsh_flags 8 Bits 2-9 of 1st NSH word
(0x005ad650,1)
NXOXM_NSH_MDTYPE nsh_mdtype 8 Bits 16-23
(0x005ad650,2)
NXOXM_NSH_NEXTPROTO nsh_np 8 Bits 24-31
(0x005ad650,3)
NXOXM_NSH_SPI nsh_spi 24 Bits 0-23 of 2nd NSH word
(0x005ad650,4)
NXOXM_NSH_SI nsh_si 8 Bits 24-31
(0x005ad650,5)
NXOXM_NSH_C1 nsh_c1 32 Maskable, nsh_mdtype==1
(0x005ad650,6)
NXOXM_NSH_C2 nsh_c2 32 Maskable, nsh_mdtype==1
(0x005ad650,7)
NXOXM_NSH_C3 nsh_c3 32 Maskable, nsh_mdtype==1
(0x005ad650,8)
NXOXM_NSH_C4 nsh_c4 32 Maskable, nsh_mdtype==1
(0x005ad650,9)
Co-authored-by: Johnson Li <johnson.li@intel.com>
Signed-off-by: Yi Yang <yi.y.yang@intel.com>
Signed-off-by: Jan Scheurich <jan.scheurich@ericsson.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2017-08-05 13:41:08 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
/* NSH flags */
|
|
|
|
#define FLOW_NSH_F_OAM (1 << 0)
|
|
|
|
#define FLOW_NSH_F_CTX (1 << 1)
|
|
|
|
|
|
|
|
#define FLOW_NSH_F_MASK ((1 << 2) - 1)
|
|
|
|
|
2017-11-06 14:06:12 +08:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2016-04-04 21:32:02 -04:00
|
|
|
#endif /* packets.h */
|