2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-22 09:58:01 +00:00
ovs/build-aux/extract-odp-netlink-h
Jan Scheurich 3d2fbd70bd 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-07 11:26:09 -07:00

68 lines
2.6 KiB
Plaintext
Executable File

# This is a "sed" script that transforms <linux/openvswitch.h> into a
# form that is suitable for inclusion within the Open vSwitch tree on
# both Linux and non-Linux systems.
# Add a header warning that this is a generated file. It might save somebody
# some frustration (maybe even me!).
1i\
/* -*- mode: c; buffer-read-only: t -*- */\
/* Generated automatically from <linux/openvswitch.h> -- do not modify! */\
\
\
# Avoid using reserved names in header guards.
s/_LINUX_OPENVSWITCH_H/ODP_NETLINK_H/
# Include platform extensions header file on Win32.
$i\
#ifdef _WIN32\
#include "OvsDpInterfaceExt.h"\
#include "OvsDpInterfaceCtExt.h"\
#endif\
\
/* IPCT_* enums may not be defined in all platforms, so do not use them. */\
#define OVS_CT_EVENT_NEW (1 << 0) /* 1 << IPCT_NEW */\
#define OVS_CT_EVENT_RELATED (1 << 1) /* 1 << IPCT_RELATED */\
#define OVS_CT_EVENT_DESTROY (1 << 2) /* 1 << IPCT_DESTROY */\
#define OVS_CT_EVENT_REPLY (1 << 3) /* 1 << IPCT_REPLY */\
#define OVS_CT_EVENT_ASSURED (1 << 4) /* 1 << IPCT_ASSURED */\
#define OVS_CT_EVENT_PROTOINFO (1 << 5) /* 1 << IPCT_PROTOINFO */\
#define OVS_CT_EVENT_HELPER (1 << 6) /* 1 << IPCT_HELPER */\
#define OVS_CT_EVENT_MARK (1 << 7) /* 1 << IPCT_MARK */\
#define OVS_CT_EVENT_SEQADJ (1 << 8) /* 1 << IPCT_SEQADJ */\
#define OVS_CT_EVENT_SECMARK (1 << 9) /* 1 << IPCT_SECMARK */\
#define OVS_CT_EVENT_LABEL (1 << 10) /* 1 << IPCT_LABEL */\
\
#define OVS_CT_EVENTMASK_DEFAULT \\\
(OVS_CT_EVENT_NEW | OVS_CT_EVENT_RELATED | OVS_CT_EVENT_DESTROY |\\\
OVS_CT_EVENT_MARK | OVS_CT_EVENT_LABEL)\
# Use OVS's own struct eth_addr instead of a 6-byte char array.
s,<linux/types\.h>,"openvswitch/types.h"\
#include <netinet/in.h>,
s,#.*<linux/if_ether\.h>,,
s/__u8[[:space:]]*\([a-zA-Z0-9_]*\)[[:space:]]*\[[[:space:]]*ETH_ALEN[[:space:]]*\]/struct eth_addr \1/
# Transform IPv6 addresses from an array to struct in6_addr
#
# As a very special case, only transform member names with more than
# one character because struct ovs_key_nsh has a member "__be32 c[4];"
# that is not an IPv6 address.
s/__be32[[:space:]]*\([a-zA-Z0-9_]\{2,\}\)[[:space:]]*\[[[:space:]]*4[[:space:]]*\]/struct in6_addr \1/
# Transform most Linux-specific __u<N> types into C99 uint<N>_t types,
# and most Linux-specific __be<N> into Open vSwitch ovs_be<N>,
# and use the appropriate userspace header.
s/__u32/uint32_t/g
s/__u16/uint16_t/g
s/__u8/uint8_t/g
s/__be32/ovs_be32/g
s/__be16/ovs_be16/g
# Transform 64-bit Linux-specific types into Open vSwitch specialized
# types for 64-bit numbers that might only be aligned on a 32-bit
# boundary.
s/__u64/ovs_32aligned_u64/g
s/__be64/ovs_32aligned_be64/g