1224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng 2224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng/* 3e084501669a4e4931c9d648351ecd7d595b81b79Christopher Ferris * Copyright (c) 2007-2013 Nicira, Inc. 4224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * 5224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * This program is free software; you can redistribute it and/or 6224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * modify it under the terms of version 2 of the GNU General Public 7224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * License as published by the Free Software Foundation. 8224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * 9224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * This program is distributed in the hope that it will be useful, but 10224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * WITHOUT ANY WARRANTY; without even the implied warranty of 11224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * General Public License for more details. 13224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * 14224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * You should have received a copy of the GNU General Public License 15224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * along with this program; if not, write to the Free Software 16224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 17224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * 02110-1301, USA 18224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng */ 19224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng 20224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng#ifndef _UAPI__LINUX_OPENVSWITCH_H 21224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng#define _UAPI__LINUX_OPENVSWITCH_H 1 22224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng 23224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng#include <linux/types.h> 24224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng#include <linux/if_ether.h> 25224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng 26224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng/** 27224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * struct ovs_header - header for OVS Generic Netlink messages. 28224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * @dp_ifindex: ifindex of local port for datapath (0 to make a request not 29224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * specific to a datapath). 30224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * 31224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * Attributes following the header are specific to a particular OVS Generic 32224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * Netlink family, but all of the OVS families use this header. 33224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng */ 34224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng 35224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Chengstruct ovs_header { 36224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng int dp_ifindex; 37224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng}; 38224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng 39224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng/* Datapaths. */ 40224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng 41224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng#define OVS_DATAPATH_FAMILY "ovs_datapath" 42224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng#define OVS_DATAPATH_MCGROUP "ovs_datapath" 43e084501669a4e4931c9d648351ecd7d595b81b79Christopher Ferris 44e084501669a4e4931c9d648351ecd7d595b81b79Christopher Ferris/* V2: 45e084501669a4e4931c9d648351ecd7d595b81b79Christopher Ferris * - API users are expected to provide OVS_DP_ATTR_USER_FEATURES 46e084501669a4e4931c9d648351ecd7d595b81b79Christopher Ferris * when creating the datapath. 47e084501669a4e4931c9d648351ecd7d595b81b79Christopher Ferris */ 48e084501669a4e4931c9d648351ecd7d595b81b79Christopher Ferris#define OVS_DATAPATH_VERSION 2 49e084501669a4e4931c9d648351ecd7d595b81b79Christopher Ferris 50e084501669a4e4931c9d648351ecd7d595b81b79Christopher Ferris/* First OVS datapath version to support features */ 51e084501669a4e4931c9d648351ecd7d595b81b79Christopher Ferris#define OVS_DP_VER_FEATURES 2 52224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng 53224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Chengenum ovs_datapath_cmd { 54224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng OVS_DP_CMD_UNSPEC, 55224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng OVS_DP_CMD_NEW, 56224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng OVS_DP_CMD_DEL, 57224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng OVS_DP_CMD_GET, 58224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng OVS_DP_CMD_SET 59224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng}; 60224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng 61224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng/** 62224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * enum ovs_datapath_attr - attributes for %OVS_DP_* commands. 63224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * @OVS_DP_ATTR_NAME: Name of the network device that serves as the "local 64224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * port". This is the name of the network device whose dp_ifindex is given in 65224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * the &struct ovs_header. Always present in notifications. Required in 66224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * %OVS_DP_NEW requests. May be used as an alternative to specifying 67224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * dp_ifindex in other requests (with a dp_ifindex of 0). 68224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * @OVS_DP_ATTR_UPCALL_PID: The Netlink socket in userspace that is initially 69224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * set on the datapath port (for OVS_ACTION_ATTR_MISS). Only valid on 70224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * %OVS_DP_CMD_NEW requests. A value of zero indicates that upcalls should 71224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * not be sent. 72224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * @OVS_DP_ATTR_STATS: Statistics about packets that have passed through the 73224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * datapath. Always present in notifications. 74e084501669a4e4931c9d648351ecd7d595b81b79Christopher Ferris * @OVS_DP_ATTR_MEGAFLOW_STATS: Statistics about mega flow masks usage for the 75e084501669a4e4931c9d648351ecd7d595b81b79Christopher Ferris * datapath. Always present in notifications. 76224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * 77224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * These attributes follow the &struct ovs_header within the Generic Netlink 78224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * payload for %OVS_DP_* commands. 79224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng */ 80224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Chengenum ovs_datapath_attr { 81224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng OVS_DP_ATTR_UNSPEC, 82e084501669a4e4931c9d648351ecd7d595b81b79Christopher Ferris OVS_DP_ATTR_NAME, /* name of dp_ifindex netdev */ 83e084501669a4e4931c9d648351ecd7d595b81b79Christopher Ferris OVS_DP_ATTR_UPCALL_PID, /* Netlink PID to receive upcalls */ 84e084501669a4e4931c9d648351ecd7d595b81b79Christopher Ferris OVS_DP_ATTR_STATS, /* struct ovs_dp_stats */ 85e084501669a4e4931c9d648351ecd7d595b81b79Christopher Ferris OVS_DP_ATTR_MEGAFLOW_STATS, /* struct ovs_dp_megaflow_stats */ 86e084501669a4e4931c9d648351ecd7d595b81b79Christopher Ferris OVS_DP_ATTR_USER_FEATURES, /* OVS_DP_F_* */ 87224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng __OVS_DP_ATTR_MAX 88224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng}; 89224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng 90224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng#define OVS_DP_ATTR_MAX (__OVS_DP_ATTR_MAX - 1) 91224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng 92224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Chengstruct ovs_dp_stats { 93224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng __u64 n_hit; /* Number of flow table matches. */ 94224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng __u64 n_missed; /* Number of flow table misses. */ 95224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng __u64 n_lost; /* Number of misses not sent to userspace. */ 96224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng __u64 n_flows; /* Number of flows present */ 97224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng}; 98224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng 99e084501669a4e4931c9d648351ecd7d595b81b79Christopher Ferrisstruct ovs_dp_megaflow_stats { 100e084501669a4e4931c9d648351ecd7d595b81b79Christopher Ferris __u64 n_mask_hit; /* Number of masks used for flow lookups. */ 101e084501669a4e4931c9d648351ecd7d595b81b79Christopher Ferris __u32 n_masks; /* Number of masks for the datapath. */ 102e084501669a4e4931c9d648351ecd7d595b81b79Christopher Ferris __u32 pad0; /* Pad for future expension. */ 103e084501669a4e4931c9d648351ecd7d595b81b79Christopher Ferris __u64 pad1; /* Pad for future expension. */ 104e084501669a4e4931c9d648351ecd7d595b81b79Christopher Ferris __u64 pad2; /* Pad for future expension. */ 105e084501669a4e4931c9d648351ecd7d595b81b79Christopher Ferris}; 106e084501669a4e4931c9d648351ecd7d595b81b79Christopher Ferris 107224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Chengstruct ovs_vport_stats { 108224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng __u64 rx_packets; /* total packets received */ 109224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng __u64 tx_packets; /* total packets transmitted */ 110224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng __u64 rx_bytes; /* total bytes received */ 111224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng __u64 tx_bytes; /* total bytes transmitted */ 112224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng __u64 rx_errors; /* bad packets received */ 113224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng __u64 tx_errors; /* packet transmit problems */ 114224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng __u64 rx_dropped; /* no space in linux buffers */ 115224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng __u64 tx_dropped; /* no space available in linux */ 116224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng}; 117224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng 118e084501669a4e4931c9d648351ecd7d595b81b79Christopher Ferris/* Allow last Netlink attribute to be unaligned */ 119e084501669a4e4931c9d648351ecd7d595b81b79Christopher Ferris#define OVS_DP_F_UNALIGNED (1 << 0) 120e084501669a4e4931c9d648351ecd7d595b81b79Christopher Ferris 1217c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris/* Allow datapath to associate multiple Netlink PIDs to each vport */ 1227c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris#define OVS_DP_F_VPORT_PIDS (1 << 1) 1237c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris 124224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng/* Fixed logical ports. */ 125224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng#define OVSP_LOCAL ((__u32)0) 126224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng 127224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng/* Packet transfer. */ 128224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng 129224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng#define OVS_PACKET_FAMILY "ovs_packet" 130224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng#define OVS_PACKET_VERSION 0x1 131224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng 132224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Chengenum ovs_packet_cmd { 133224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng OVS_PACKET_CMD_UNSPEC, 134224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng 135224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng /* Kernel-to-user notifications. */ 136224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng OVS_PACKET_CMD_MISS, /* Flow table miss. */ 137224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng OVS_PACKET_CMD_ACTION, /* OVS_ACTION_ATTR_USERSPACE action. */ 138224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng 139224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng /* Userspace commands. */ 140224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng OVS_PACKET_CMD_EXECUTE /* Apply actions to a packet. */ 141224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng}; 142224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng 143224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng/** 144224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * enum ovs_packet_attr - attributes for %OVS_PACKET_* commands. 145224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * @OVS_PACKET_ATTR_PACKET: Present for all notifications. Contains the entire 146224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * packet as received, from the start of the Ethernet header onward. For 147224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * %OVS_PACKET_CMD_ACTION, %OVS_PACKET_ATTR_PACKET reflects changes made by 148224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * actions preceding %OVS_ACTION_ATTR_USERSPACE, but %OVS_PACKET_ATTR_KEY is 149224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * the flow key extracted from the packet as originally received. 150224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * @OVS_PACKET_ATTR_KEY: Present for all notifications. Contains the flow key 151224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * extracted from the packet as nested %OVS_KEY_ATTR_* attributes. This allows 152224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * userspace to adapt its flow setup strategy by comparing its notion of the 153224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * flow key against the kernel's. 154224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * @OVS_PACKET_ATTR_ACTIONS: Contains actions for the packet. Used 155224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * for %OVS_PACKET_CMD_EXECUTE. It has nested %OVS_ACTION_ATTR_* attributes. 15612e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris * Also used in upcall when %OVS_ACTION_ATTR_USERSPACE has optional 15712e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris * %OVS_USERSPACE_ATTR_ACTIONS attribute. 158224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * @OVS_PACKET_ATTR_USERDATA: Present for an %OVS_PACKET_CMD_ACTION 159224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * notification if the %OVS_ACTION_ATTR_USERSPACE action specified an 160224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * %OVS_USERSPACE_ATTR_USERDATA attribute, with the same length and content 161224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * specified there. 16212e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris * @OVS_PACKET_ATTR_EGRESS_TUN_KEY: Present for an %OVS_PACKET_CMD_ACTION 16312e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris * notification if the %OVS_ACTION_ATTR_USERSPACE action specified an 16412e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris * %OVS_USERSPACE_ATTR_EGRESS_TUN_PORT attribute, which is sent only if the 16512e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris * output port is actually a tunnel port. Contains the output tunnel key 16612e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris * extracted from the packet as nested %OVS_TUNNEL_KEY_ATTR_* attributes. 16712e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris * @OVS_PACKET_ATTR_MRU: Present for an %OVS_PACKET_CMD_ACTION and 16812e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris * %OVS_PACKET_ATTR_USERSPACE action specify the Maximum received fragment 16912e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris * size. 170224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * 171224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * These attributes follow the &struct ovs_header within the Generic Netlink 172224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * payload for %OVS_PACKET_* commands. 173224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng */ 174224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Chengenum ovs_packet_attr { 175224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng OVS_PACKET_ATTR_UNSPEC, 176224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng OVS_PACKET_ATTR_PACKET, /* Packet data. */ 177224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng OVS_PACKET_ATTR_KEY, /* Nested OVS_KEY_ATTR_* attributes. */ 178224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng OVS_PACKET_ATTR_ACTIONS, /* Nested OVS_ACTION_ATTR_* attributes. */ 179224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng OVS_PACKET_ATTR_USERDATA, /* OVS_ACTION_ATTR_USERSPACE arg. */ 18012e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris OVS_PACKET_ATTR_EGRESS_TUN_KEY, /* Nested OVS_TUNNEL_KEY_ATTR_* 18112e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris attributes. */ 18212e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris OVS_PACKET_ATTR_UNUSED1, 18312e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris OVS_PACKET_ATTR_UNUSED2, 18412e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris OVS_PACKET_ATTR_PROBE, /* Packet operation is a feature probe, 18512e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris error logging should be suppressed. */ 18612e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris OVS_PACKET_ATTR_MRU, /* Maximum received IP fragment size. */ 187224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng __OVS_PACKET_ATTR_MAX 188224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng}; 189224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng 190224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng#define OVS_PACKET_ATTR_MAX (__OVS_PACKET_ATTR_MAX - 1) 191224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng 192224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng/* Virtual ports. */ 193224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng 194224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng#define OVS_VPORT_FAMILY "ovs_vport" 195224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng#define OVS_VPORT_MCGROUP "ovs_vport" 196224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng#define OVS_VPORT_VERSION 0x1 197224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng 198224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Chengenum ovs_vport_cmd { 199224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng OVS_VPORT_CMD_UNSPEC, 200224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng OVS_VPORT_CMD_NEW, 201224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng OVS_VPORT_CMD_DEL, 202224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng OVS_VPORT_CMD_GET, 203224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng OVS_VPORT_CMD_SET 204224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng}; 205224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng 206224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Chengenum ovs_vport_type { 207224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng OVS_VPORT_TYPE_UNSPEC, 208224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng OVS_VPORT_TYPE_NETDEV, /* network device */ 209224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng OVS_VPORT_TYPE_INTERNAL, /* network device implemented by datapath */ 210e084501669a4e4931c9d648351ecd7d595b81b79Christopher Ferris OVS_VPORT_TYPE_GRE, /* GRE tunnel. */ 211e084501669a4e4931c9d648351ecd7d595b81b79Christopher Ferris OVS_VPORT_TYPE_VXLAN, /* VXLAN tunnel. */ 2127c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris OVS_VPORT_TYPE_GENEVE, /* Geneve tunnel. */ 213224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng __OVS_VPORT_TYPE_MAX 214224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng}; 215224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng 216224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng#define OVS_VPORT_TYPE_MAX (__OVS_VPORT_TYPE_MAX - 1) 217224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng 218224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng/** 219224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * enum ovs_vport_attr - attributes for %OVS_VPORT_* commands. 220224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * @OVS_VPORT_ATTR_PORT_NO: 32-bit port number within datapath. 221224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * @OVS_VPORT_ATTR_TYPE: 32-bit %OVS_VPORT_TYPE_* constant describing the type 222224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * of vport. 223224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * @OVS_VPORT_ATTR_NAME: Name of vport. For a vport based on a network device 224224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * this is the name of the network device. Maximum length %IFNAMSIZ-1 bytes 225224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * plus a null terminator. 226224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * @OVS_VPORT_ATTR_OPTIONS: Vport-specific configuration information. 2277c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris * @OVS_VPORT_ATTR_UPCALL_PID: The array of Netlink socket pids in userspace 2287c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris * among which OVS_PACKET_CMD_MISS upcalls will be distributed for packets 2297c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris * received on this port. If this is a single-element array of value 0, 2307c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris * upcalls should not be sent. 231224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * @OVS_VPORT_ATTR_STATS: A &struct ovs_vport_stats giving statistics for 232224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * packets sent or received through the vport. 233224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * 234224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * These attributes follow the &struct ovs_header within the Generic Netlink 235224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * payload for %OVS_VPORT_* commands. 236224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * 237224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * For %OVS_VPORT_CMD_NEW requests, the %OVS_VPORT_ATTR_TYPE and 238224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * %OVS_VPORT_ATTR_NAME attributes are required. %OVS_VPORT_ATTR_PORT_NO is 239224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * optional; if not specified a free port number is automatically selected. 240224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * Whether %OVS_VPORT_ATTR_OPTIONS is required or optional depends on the type 241224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * of vport. 242224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * 243224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * For other requests, if %OVS_VPORT_ATTR_NAME is specified then it is used to 244224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * look up the vport to operate on; otherwise dp_idx from the &struct 245224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * ovs_header plus %OVS_VPORT_ATTR_PORT_NO determine the vport. 246224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng */ 247224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Chengenum ovs_vport_attr { 248224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng OVS_VPORT_ATTR_UNSPEC, 249224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng OVS_VPORT_ATTR_PORT_NO, /* u32 port number within datapath */ 250224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng OVS_VPORT_ATTR_TYPE, /* u32 OVS_VPORT_TYPE_* constant. */ 251224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng OVS_VPORT_ATTR_NAME, /* string name, up to IFNAMSIZ bytes long */ 252224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng OVS_VPORT_ATTR_OPTIONS, /* nested attributes, varies by vport type */ 2537c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris OVS_VPORT_ATTR_UPCALL_PID, /* array of u32 Netlink socket PIDs for */ 2547c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris /* receiving upcalls */ 255224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng OVS_VPORT_ATTR_STATS, /* struct ovs_vport_stats */ 256224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng __OVS_VPORT_ATTR_MAX 257224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng}; 258224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng 259224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng#define OVS_VPORT_ATTR_MAX (__OVS_VPORT_ATTR_MAX - 1) 260224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng 26112e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferrisenum { 26212e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris OVS_VXLAN_EXT_UNSPEC, 26312e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris OVS_VXLAN_EXT_GBP, /* Flag or __u32 */ 26412e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris __OVS_VXLAN_EXT_MAX, 26512e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris}; 26612e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris 26712e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris#define OVS_VXLAN_EXT_MAX (__OVS_VXLAN_EXT_MAX - 1) 26812e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris 26912e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris 270e084501669a4e4931c9d648351ecd7d595b81b79Christopher Ferris/* OVS_VPORT_ATTR_OPTIONS attributes for tunnels. 271e084501669a4e4931c9d648351ecd7d595b81b79Christopher Ferris */ 272e084501669a4e4931c9d648351ecd7d595b81b79Christopher Ferrisenum { 273e084501669a4e4931c9d648351ecd7d595b81b79Christopher Ferris OVS_TUNNEL_ATTR_UNSPEC, 274e084501669a4e4931c9d648351ecd7d595b81b79Christopher Ferris OVS_TUNNEL_ATTR_DST_PORT, /* 16-bit UDP port, used by L4 tunnels. */ 27512e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris OVS_TUNNEL_ATTR_EXTENSION, 276e084501669a4e4931c9d648351ecd7d595b81b79Christopher Ferris __OVS_TUNNEL_ATTR_MAX 277e084501669a4e4931c9d648351ecd7d595b81b79Christopher Ferris}; 278e084501669a4e4931c9d648351ecd7d595b81b79Christopher Ferris 279e084501669a4e4931c9d648351ecd7d595b81b79Christopher Ferris#define OVS_TUNNEL_ATTR_MAX (__OVS_TUNNEL_ATTR_MAX - 1) 280e084501669a4e4931c9d648351ecd7d595b81b79Christopher Ferris 281224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng/* Flows. */ 282224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng 283224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng#define OVS_FLOW_FAMILY "ovs_flow" 284224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng#define OVS_FLOW_MCGROUP "ovs_flow" 285224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng#define OVS_FLOW_VERSION 0x1 286224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng 287224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Chengenum ovs_flow_cmd { 288224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng OVS_FLOW_CMD_UNSPEC, 289224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng OVS_FLOW_CMD_NEW, 290224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng OVS_FLOW_CMD_DEL, 291224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng OVS_FLOW_CMD_GET, 292224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng OVS_FLOW_CMD_SET 293224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng}; 294224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng 295224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Chengstruct ovs_flow_stats { 296224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng __u64 n_packets; /* Number of matched packets. */ 297224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng __u64 n_bytes; /* Number of matched bytes. */ 298224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng}; 299224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng 300224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Chengenum ovs_key_attr { 301224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng OVS_KEY_ATTR_UNSPEC, 302224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng OVS_KEY_ATTR_ENCAP, /* Nested set of encapsulated attributes. */ 303224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng OVS_KEY_ATTR_PRIORITY, /* u32 skb->priority */ 304224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng OVS_KEY_ATTR_IN_PORT, /* u32 OVS dp port number */ 305224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng OVS_KEY_ATTR_ETHERNET, /* struct ovs_key_ethernet */ 306224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng OVS_KEY_ATTR_VLAN, /* be16 VLAN TCI */ 307224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng OVS_KEY_ATTR_ETHERTYPE, /* be16 Ethernet type */ 308224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng OVS_KEY_ATTR_IPV4, /* struct ovs_key_ipv4 */ 309224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng OVS_KEY_ATTR_IPV6, /* struct ovs_key_ipv6 */ 310224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng OVS_KEY_ATTR_TCP, /* struct ovs_key_tcp */ 311224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng OVS_KEY_ATTR_UDP, /* struct ovs_key_udp */ 312224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng OVS_KEY_ATTR_ICMP, /* struct ovs_key_icmp */ 313224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng OVS_KEY_ATTR_ICMPV6, /* struct ovs_key_icmpv6 */ 314224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng OVS_KEY_ATTR_ARP, /* struct ovs_key_arp */ 315224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng OVS_KEY_ATTR_ND, /* struct ovs_key_nd */ 316224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng OVS_KEY_ATTR_SKB_MARK, /* u32 skb mark */ 317e084501669a4e4931c9d648351ecd7d595b81b79Christopher Ferris OVS_KEY_ATTR_TUNNEL, /* Nested set of ovs_tunnel attributes */ 318e084501669a4e4931c9d648351ecd7d595b81b79Christopher Ferris OVS_KEY_ATTR_SCTP, /* struct ovs_key_sctp */ 319e084501669a4e4931c9d648351ecd7d595b81b79Christopher Ferris OVS_KEY_ATTR_TCP_FLAGS, /* be16 TCP flags. */ 3207c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris OVS_KEY_ATTR_DP_HASH, /* u32 hash value. Value 0 indicates the hash 3217c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris is not computed by the datapath. */ 3227c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris OVS_KEY_ATTR_RECIRC_ID, /* u32 recirc id */ 32312e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris OVS_KEY_ATTR_MPLS, /* array of struct ovs_key_mpls. 32412e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris * The implementation may restrict 32512e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris * the accepted length of the array. */ 32612e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris OVS_KEY_ATTR_CT_STATE, /* u32 bitmask of OVS_CS_F_* */ 32712e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris OVS_KEY_ATTR_CT_ZONE, /* u16 connection tracking zone. */ 32812e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris OVS_KEY_ATTR_CT_MARK, /* u32 connection tracking mark */ 32912e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris OVS_KEY_ATTR_CT_LABELS, /* 16-octet connection tracking label */ 330e084501669a4e4931c9d648351ecd7d595b81b79Christopher Ferris 331e084501669a4e4931c9d648351ecd7d595b81b79Christopher Ferris#ifdef __KERNEL__ 33212e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris OVS_KEY_ATTR_TUNNEL_INFO, /* struct ip_tunnel_info */ 333e084501669a4e4931c9d648351ecd7d595b81b79Christopher Ferris#endif 334224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng __OVS_KEY_ATTR_MAX 335224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng}; 336224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng 337224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng#define OVS_KEY_ATTR_MAX (__OVS_KEY_ATTR_MAX - 1) 338224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng 339e084501669a4e4931c9d648351ecd7d595b81b79Christopher Ferrisenum ovs_tunnel_key_attr { 340e084501669a4e4931c9d648351ecd7d595b81b79Christopher Ferris OVS_TUNNEL_KEY_ATTR_ID, /* be64 Tunnel ID */ 341e084501669a4e4931c9d648351ecd7d595b81b79Christopher Ferris OVS_TUNNEL_KEY_ATTR_IPV4_SRC, /* be32 src IP address. */ 342e084501669a4e4931c9d648351ecd7d595b81b79Christopher Ferris OVS_TUNNEL_KEY_ATTR_IPV4_DST, /* be32 dst IP address. */ 343e084501669a4e4931c9d648351ecd7d595b81b79Christopher Ferris OVS_TUNNEL_KEY_ATTR_TOS, /* u8 Tunnel IP ToS. */ 344e084501669a4e4931c9d648351ecd7d595b81b79Christopher Ferris OVS_TUNNEL_KEY_ATTR_TTL, /* u8 Tunnel IP TTL. */ 345e084501669a4e4931c9d648351ecd7d595b81b79Christopher Ferris OVS_TUNNEL_KEY_ATTR_DONT_FRAGMENT, /* No argument, set DF. */ 346e084501669a4e4931c9d648351ecd7d595b81b79Christopher Ferris OVS_TUNNEL_KEY_ATTR_CSUM, /* No argument. CSUM packet. */ 3477c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris OVS_TUNNEL_KEY_ATTR_OAM, /* No argument. OAM frame. */ 3487c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris OVS_TUNNEL_KEY_ATTR_GENEVE_OPTS, /* Array of Geneve options. */ 34912e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris OVS_TUNNEL_KEY_ATTR_TP_SRC, /* be16 src Transport Port. */ 35012e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris OVS_TUNNEL_KEY_ATTR_TP_DST, /* be16 dst Transport Port. */ 35112e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris OVS_TUNNEL_KEY_ATTR_VXLAN_OPTS, /* Nested OVS_VXLAN_EXT_* */ 35212e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris OVS_TUNNEL_KEY_ATTR_IPV6_SRC, /* struct in6_addr src IPv6 address. */ 35312e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris OVS_TUNNEL_KEY_ATTR_IPV6_DST, /* struct in6_addr dst IPv6 address. */ 354e084501669a4e4931c9d648351ecd7d595b81b79Christopher Ferris __OVS_TUNNEL_KEY_ATTR_MAX 355e084501669a4e4931c9d648351ecd7d595b81b79Christopher Ferris}; 356e084501669a4e4931c9d648351ecd7d595b81b79Christopher Ferris 357e084501669a4e4931c9d648351ecd7d595b81b79Christopher Ferris#define OVS_TUNNEL_KEY_ATTR_MAX (__OVS_TUNNEL_KEY_ATTR_MAX - 1) 358e084501669a4e4931c9d648351ecd7d595b81b79Christopher Ferris 359224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng/** 360224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * enum ovs_frag_type - IPv4 and IPv6 fragment type 361224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * @OVS_FRAG_TYPE_NONE: Packet is not a fragment. 362224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * @OVS_FRAG_TYPE_FIRST: Packet is a fragment with offset 0. 363224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * @OVS_FRAG_TYPE_LATER: Packet is a fragment with nonzero offset. 364224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * 365224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * Used as the @ipv4_frag in &struct ovs_key_ipv4 and as @ipv6_frag &struct 366224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * ovs_key_ipv6. 367224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng */ 368224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Chengenum ovs_frag_type { 369224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng OVS_FRAG_TYPE_NONE, 370224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng OVS_FRAG_TYPE_FIRST, 371224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng OVS_FRAG_TYPE_LATER, 372224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng __OVS_FRAG_TYPE_MAX 373224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng}; 374224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng 375224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng#define OVS_FRAG_TYPE_MAX (__OVS_FRAG_TYPE_MAX - 1) 376224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng 377224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Chengstruct ovs_key_ethernet { 378224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng __u8 eth_src[ETH_ALEN]; 379224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng __u8 eth_dst[ETH_ALEN]; 380224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng}; 381224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng 38212e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferrisstruct ovs_key_mpls { 38312e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris __be32 mpls_lse; 38412e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris}; 38512e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris 386224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Chengstruct ovs_key_ipv4 { 387224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng __be32 ipv4_src; 388224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng __be32 ipv4_dst; 389224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng __u8 ipv4_proto; 390224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng __u8 ipv4_tos; 391224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng __u8 ipv4_ttl; 392224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng __u8 ipv4_frag; /* One of OVS_FRAG_TYPE_*. */ 393224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng}; 394224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng 395224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Chengstruct ovs_key_ipv6 { 396224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng __be32 ipv6_src[4]; 397224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng __be32 ipv6_dst[4]; 398224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng __be32 ipv6_label; /* 20-bits in least-significant bits. */ 399224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng __u8 ipv6_proto; 400224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng __u8 ipv6_tclass; 401224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng __u8 ipv6_hlimit; 402224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng __u8 ipv6_frag; /* One of OVS_FRAG_TYPE_*. */ 403224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng}; 404224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng 405224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Chengstruct ovs_key_tcp { 406224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng __be16 tcp_src; 407224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng __be16 tcp_dst; 408224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng}; 409224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng 410224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Chengstruct ovs_key_udp { 411224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng __be16 udp_src; 412224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng __be16 udp_dst; 413224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng}; 414224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng 415e084501669a4e4931c9d648351ecd7d595b81b79Christopher Ferrisstruct ovs_key_sctp { 416e084501669a4e4931c9d648351ecd7d595b81b79Christopher Ferris __be16 sctp_src; 417e084501669a4e4931c9d648351ecd7d595b81b79Christopher Ferris __be16 sctp_dst; 418e084501669a4e4931c9d648351ecd7d595b81b79Christopher Ferris}; 419e084501669a4e4931c9d648351ecd7d595b81b79Christopher Ferris 420224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Chengstruct ovs_key_icmp { 421224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng __u8 icmp_type; 422224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng __u8 icmp_code; 423224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng}; 424224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng 425224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Chengstruct ovs_key_icmpv6 { 426224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng __u8 icmpv6_type; 427224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng __u8 icmpv6_code; 428224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng}; 429224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng 430224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Chengstruct ovs_key_arp { 431224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng __be32 arp_sip; 432224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng __be32 arp_tip; 433224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng __be16 arp_op; 434224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng __u8 arp_sha[ETH_ALEN]; 435224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng __u8 arp_tha[ETH_ALEN]; 436224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng}; 437224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng 438224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Chengstruct ovs_key_nd { 43912e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris __be32 nd_target[4]; 44012e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris __u8 nd_sll[ETH_ALEN]; 44112e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris __u8 nd_tll[ETH_ALEN]; 442224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng}; 443224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng 44412e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris#define OVS_CT_LABELS_LEN 16 44512e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferrisstruct ovs_key_ct_labels { 44612e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris __u8 ct_labels[OVS_CT_LABELS_LEN]; 44712e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris}; 44812e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris 44912e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris/* OVS_KEY_ATTR_CT_STATE flags */ 45012e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris#define OVS_CS_F_NEW 0x01 /* Beginning of a new connection. */ 45112e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris#define OVS_CS_F_ESTABLISHED 0x02 /* Part of an existing connection. */ 45212e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris#define OVS_CS_F_RELATED 0x04 /* Related to an established 45312e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris * connection. */ 45412e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris#define OVS_CS_F_REPLY_DIR 0x08 /* Flow is in the reply direction. */ 45512e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris#define OVS_CS_F_INVALID 0x10 /* Could not track connection. */ 45612e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris#define OVS_CS_F_TRACKED 0x20 /* Conntrack has occurred. */ 45712e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris 458224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng/** 459224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * enum ovs_flow_attr - attributes for %OVS_FLOW_* commands. 460224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * @OVS_FLOW_ATTR_KEY: Nested %OVS_KEY_ATTR_* attributes specifying the flow 461224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * key. Always present in notifications. Required for all requests (except 462224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * dumps). 463224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * @OVS_FLOW_ATTR_ACTIONS: Nested %OVS_ACTION_ATTR_* attributes specifying 464224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * the actions to take for packets that match the key. Always present in 465224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * notifications. Required for %OVS_FLOW_CMD_NEW requests, optional for 466314752488cb92b9f86028836d0b8eabd8acb6a7cChristopher Ferris * %OVS_FLOW_CMD_SET requests. An %OVS_FLOW_CMD_SET without 467314752488cb92b9f86028836d0b8eabd8acb6a7cChristopher Ferris * %OVS_FLOW_ATTR_ACTIONS will not modify the actions. To clear the actions, 468314752488cb92b9f86028836d0b8eabd8acb6a7cChristopher Ferris * an %OVS_FLOW_ATTR_ACTIONS without any nested attributes must be given. 469224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * @OVS_FLOW_ATTR_STATS: &struct ovs_flow_stats giving statistics for this 470224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * flow. Present in notifications if the stats would be nonzero. Ignored in 471224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * requests. 472224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * @OVS_FLOW_ATTR_TCP_FLAGS: An 8-bit value giving the OR'd value of all of the 473224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * TCP flags seen on packets in this flow. Only present in notifications for 474224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * TCP flows, and only if it would be nonzero. Ignored in requests. 475224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * @OVS_FLOW_ATTR_USED: A 64-bit integer giving the time, in milliseconds on 476224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * the system monotonic clock, at which a packet was last processed for this 477224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * flow. Only present in notifications if a packet has been processed for this 478224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * flow. Ignored in requests. 479224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * @OVS_FLOW_ATTR_CLEAR: If present in a %OVS_FLOW_CMD_SET request, clears the 480224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * last-used time, accumulated TCP flags, and statistics for this flow. 481224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * Otherwise ignored in requests. Never present in notifications. 482e084501669a4e4931c9d648351ecd7d595b81b79Christopher Ferris * @OVS_FLOW_ATTR_MASK: Nested %OVS_KEY_ATTR_* attributes specifying the 483e084501669a4e4931c9d648351ecd7d595b81b79Christopher Ferris * mask bits for wildcarded flow match. Mask bit value '1' specifies exact 484e084501669a4e4931c9d648351ecd7d595b81b79Christopher Ferris * match with corresponding flow key bit, while mask bit value '0' specifies 485e084501669a4e4931c9d648351ecd7d595b81b79Christopher Ferris * a wildcarded match. Omitting attribute is treated as wildcarding all 486e084501669a4e4931c9d648351ecd7d595b81b79Christopher Ferris * corresponding fields. Optional for all requests. If not present, 487e084501669a4e4931c9d648351ecd7d595b81b79Christopher Ferris * all flow key bits are exact match bits. 48812e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris * @OVS_FLOW_ATTR_UFID: A value between 1-16 octets specifying a unique 48912e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris * identifier for the flow. Causes the flow to be indexed by this value rather 49012e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris * than the value of the %OVS_FLOW_ATTR_KEY attribute. Optional for all 49112e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris * requests. Present in notifications if the flow was created with this 49212e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris * attribute. 49312e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris * @OVS_FLOW_ATTR_UFID_FLAGS: A 32-bit value of OR'd %OVS_UFID_F_* 49412e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris * flags that provide alternative semantics for flow installation and 49512e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris * retrieval. Optional for all requests. 496224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * 497224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * These attributes follow the &struct ovs_header within the Generic Netlink 498224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * payload for %OVS_FLOW_* commands. 499224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng */ 500224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Chengenum ovs_flow_attr { 501224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng OVS_FLOW_ATTR_UNSPEC, 502224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng OVS_FLOW_ATTR_KEY, /* Sequence of OVS_KEY_ATTR_* attributes. */ 503224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng OVS_FLOW_ATTR_ACTIONS, /* Nested OVS_ACTION_ATTR_* attributes. */ 504224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng OVS_FLOW_ATTR_STATS, /* struct ovs_flow_stats. */ 505224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng OVS_FLOW_ATTR_TCP_FLAGS, /* 8-bit OR'd TCP flags. */ 506224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng OVS_FLOW_ATTR_USED, /* u64 msecs last used in monotonic time. */ 507224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng OVS_FLOW_ATTR_CLEAR, /* Flag to clear stats, tcp_flags, used. */ 508e084501669a4e4931c9d648351ecd7d595b81b79Christopher Ferris OVS_FLOW_ATTR_MASK, /* Sequence of OVS_KEY_ATTR_* attributes. */ 50912e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris OVS_FLOW_ATTR_PROBE, /* Flow operation is a feature probe, error 51012e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris * logging should be suppressed. */ 51112e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris OVS_FLOW_ATTR_UFID, /* Variable length unique flow identifier. */ 51212e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris OVS_FLOW_ATTR_UFID_FLAGS,/* u32 of OVS_UFID_F_*. */ 513224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng __OVS_FLOW_ATTR_MAX 514224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng}; 515224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng 516224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng#define OVS_FLOW_ATTR_MAX (__OVS_FLOW_ATTR_MAX - 1) 517224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng 518224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng/** 51912e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris * Omit attributes for notifications. 52012e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris * 52112e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris * If a datapath request contains an %OVS_UFID_F_OMIT_* flag, then the datapath 52212e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris * may omit the corresponding %OVS_FLOW_ATTR_* from the response. 52312e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris */ 52412e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris#define OVS_UFID_F_OMIT_KEY (1 << 0) 52512e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris#define OVS_UFID_F_OMIT_MASK (1 << 1) 52612e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris#define OVS_UFID_F_OMIT_ACTIONS (1 << 2) 52712e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris 52812e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris/** 529224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * enum ovs_sample_attr - Attributes for %OVS_ACTION_ATTR_SAMPLE action. 530224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * @OVS_SAMPLE_ATTR_PROBABILITY: 32-bit fraction of packets to sample with 531224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * @OVS_ACTION_ATTR_SAMPLE. A value of 0 samples no packets, a value of 532224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * %UINT32_MAX samples all packets and intermediate values sample intermediate 533224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * fractions of packets. 534224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * @OVS_SAMPLE_ATTR_ACTIONS: Set of actions to execute in sampling event. 535224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * Actions are passed as nested attributes. 536224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * 537224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * Executes the specified actions with the given probability on a per-packet 538224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * basis. 539224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng */ 540224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Chengenum ovs_sample_attr { 541224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng OVS_SAMPLE_ATTR_UNSPEC, 542224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng OVS_SAMPLE_ATTR_PROBABILITY, /* u32 number */ 543224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng OVS_SAMPLE_ATTR_ACTIONS, /* Nested OVS_ACTION_ATTR_* attributes. */ 544224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng __OVS_SAMPLE_ATTR_MAX, 545224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng}; 546224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng 547224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng#define OVS_SAMPLE_ATTR_MAX (__OVS_SAMPLE_ATTR_MAX - 1) 548224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng 549224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng/** 550224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * enum ovs_userspace_attr - Attributes for %OVS_ACTION_ATTR_USERSPACE action. 551224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * @OVS_USERSPACE_ATTR_PID: u32 Netlink PID to which the %OVS_PACKET_CMD_ACTION 552224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * message should be sent. Required. 553224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * @OVS_USERSPACE_ATTR_USERDATA: If present, its variable-length argument is 554224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * copied to the %OVS_PACKET_CMD_ACTION message as %OVS_PACKET_ATTR_USERDATA. 55512e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris * @OVS_USERSPACE_ATTR_EGRESS_TUN_PORT: If present, u32 output port to get 55612e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris * tunnel info. 55712e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris * @OVS_USERSPACE_ATTR_ACTIONS: If present, send actions with upcall. 558224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng */ 559224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Chengenum ovs_userspace_attr { 560224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng OVS_USERSPACE_ATTR_UNSPEC, 561224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng OVS_USERSPACE_ATTR_PID, /* u32 Netlink PID to receive upcalls. */ 562224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng OVS_USERSPACE_ATTR_USERDATA, /* Optional user-specified cookie. */ 56312e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris OVS_USERSPACE_ATTR_EGRESS_TUN_PORT, /* Optional, u32 output port 56412e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris * to get tunnel info. */ 56512e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris OVS_USERSPACE_ATTR_ACTIONS, /* Optional flag to get actions. */ 566224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng __OVS_USERSPACE_ATTR_MAX 567224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng}; 568224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng 569224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng#define OVS_USERSPACE_ATTR_MAX (__OVS_USERSPACE_ATTR_MAX - 1) 570224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng 571224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng/** 57212e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris * struct ovs_action_push_mpls - %OVS_ACTION_ATTR_PUSH_MPLS action argument. 57312e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris * @mpls_lse: MPLS label stack entry to push. 57412e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris * @mpls_ethertype: Ethertype to set in the encapsulating ethernet frame. 57512e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris * 57612e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris * The only values @mpls_ethertype should ever be given are %ETH_P_MPLS_UC and 57712e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris * %ETH_P_MPLS_MC, indicating MPLS unicast or multicast. Other are rejected. 57812e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris */ 57912e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferrisstruct ovs_action_push_mpls { 58012e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris __be32 mpls_lse; 58112e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris __be16 mpls_ethertype; /* Either %ETH_P_MPLS_UC or %ETH_P_MPLS_MC */ 58212e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris}; 58312e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris 58412e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris/** 585224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * struct ovs_action_push_vlan - %OVS_ACTION_ATTR_PUSH_VLAN action argument. 586224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * @vlan_tpid: Tag protocol identifier (TPID) to push. 587224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * @vlan_tci: Tag control identifier (TCI) to push. The CFI bit must be set 588224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * (but it will not be set in the 802.1Q header that is pushed). 589224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * 590224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * The @vlan_tpid value is typically %ETH_P_8021Q. The only acceptable TPID 591224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * values are those that the kernel module also parses as 802.1Q headers, to 592224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * prevent %OVS_ACTION_ATTR_PUSH_VLAN followed by %OVS_ACTION_ATTR_POP_VLAN 593224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * from having surprising results. 594224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng */ 595224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Chengstruct ovs_action_push_vlan { 596224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng __be16 vlan_tpid; /* 802.1Q TPID. */ 597224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng __be16 vlan_tci; /* 802.1Q TCI (VLAN ID and priority). */ 598224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng}; 599224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng 6007c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris/* Data path hash algorithm for computing Datapath hash. 6017c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris * 6027c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris * The algorithm type only specifies the fields in a flow 6037c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris * will be used as part of the hash. Each datapath is free 6047c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris * to use its own hash algorithm. The hash value will be 6057c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris * opaque to the user space daemon. 6067c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris */ 6077c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferrisenum ovs_hash_alg { 6087c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris OVS_HASH_ALG_L4, 6097c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris}; 6107c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris 6117c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris/* 6127c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris * struct ovs_action_hash - %OVS_ACTION_ATTR_HASH action argument. 6137c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris * @hash_alg: Algorithm used to compute hash prior to recirculation. 6147c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris * @hash_basis: basis used for computing hash. 6157c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris */ 6167c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferrisstruct ovs_action_hash { 6177c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris uint32_t hash_alg; /* One of ovs_hash_alg. */ 6187c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris uint32_t hash_basis; 6197c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris}; 6207c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris 621224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng/** 62212e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris * enum ovs_ct_attr - Attributes for %OVS_ACTION_ATTR_CT action. 62312e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris * @OVS_CT_ATTR_COMMIT: If present, commits the connection to the conntrack 62412e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris * table. This allows future packets for the same connection to be identified 62512e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris * as 'established' or 'related'. The flow key for the current packet will 62612e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris * retain the pre-commit connection state. 62712e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris * @OVS_CT_ATTR_ZONE: u16 connection tracking zone. 62812e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris * @OVS_CT_ATTR_MARK: u32 value followed by u32 mask. For each bit set in the 62912e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris * mask, the corresponding bit in the value is copied to the connection 63012e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris * tracking mark field in the connection. 63112e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris * @OVS_CT_ATTR_LABELS: %OVS_CT_LABELS_LEN value followed by %OVS_CT_LABELS_LEN 63212e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris * mask. For each bit set in the mask, the corresponding bit in the value is 63312e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris * copied to the connection tracking label field in the connection. 63412e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris * @OVS_CT_ATTR_HELPER: variable length string defining conntrack ALG. 63512e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris */ 63612e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferrisenum ovs_ct_attr { 63712e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris OVS_CT_ATTR_UNSPEC, 63812e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris OVS_CT_ATTR_COMMIT, /* No argument, commits connection. */ 63912e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris OVS_CT_ATTR_ZONE, /* u16 zone id. */ 64012e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris OVS_CT_ATTR_MARK, /* mark to associate with this connection. */ 64112e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris OVS_CT_ATTR_LABELS, /* labels to associate with this connection. */ 64212e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris OVS_CT_ATTR_HELPER, /* netlink helper to assist detection of 64312e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris related connections. */ 64412e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris __OVS_CT_ATTR_MAX 64512e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris}; 64612e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris 64712e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris#define OVS_CT_ATTR_MAX (__OVS_CT_ATTR_MAX - 1) 64812e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris 64912e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris/** 650224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * enum ovs_action_attr - Action types. 651224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * 652224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * @OVS_ACTION_ATTR_OUTPUT: Output packet to port. 653224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * @OVS_ACTION_ATTR_USERSPACE: Send packet to userspace according to nested 654224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * %OVS_USERSPACE_ATTR_* attributes. 655224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * @OVS_ACTION_ATTR_SET: Replaces the contents of an existing header. The 656224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * single nested %OVS_KEY_ATTR_* attribute specifies a header to modify and its 657224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * value. 65812e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris * @OVS_ACTION_ATTR_SET_MASKED: Replaces the contents of an existing header. A 65912e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris * nested %OVS_KEY_ATTR_* attribute specifies a header to modify, its value, 66012e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris * and a mask. For every bit set in the mask, the corresponding bit value 66112e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris * is copied from the value to the packet header field, rest of the bits are 66212e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris * left unchanged. The non-masked value bits must be passed in as zeroes. 66312e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris * Masking is not supported for the %OVS_KEY_ATTR_TUNNEL attribute. 664224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * @OVS_ACTION_ATTR_PUSH_VLAN: Push a new outermost 802.1Q header onto the 665224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * packet. 666224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * @OVS_ACTION_ATTR_POP_VLAN: Pop the outermost 802.1Q header off the packet. 667224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * @OVS_ACTION_ATTR_SAMPLE: Probabilitically executes actions, as specified in 668224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * the nested %OVS_SAMPLE_ATTR_* attributes. 66912e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris * @OVS_ACTION_ATTR_PUSH_MPLS: Push a new MPLS label stack entry onto the 67012e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris * top of the packets MPLS label stack. Set the ethertype of the 67112e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris * encapsulating frame to either %ETH_P_MPLS_UC or %ETH_P_MPLS_MC to 67212e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris * indicate the new packet contents. 67312e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris * @OVS_ACTION_ATTR_POP_MPLS: Pop an MPLS label stack entry off of the 67412e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris * packet's MPLS label stack. Set the encapsulating frame's ethertype to 67512e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris * indicate the new packet contents. This could potentially still be 67612e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris * %ETH_P_MPLS if the resulting MPLS label stack is not empty. If there 67712e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris * is no MPLS label stack, as determined by ethertype, no action is taken. 67812e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris * @OVS_ACTION_ATTR_CT: Track the connection. Populate the conntrack-related 67912e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris * entries in the flow key. 680224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * 681224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * Only a single header can be set with a single %OVS_ACTION_ATTR_SET. Not all 682224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * fields within a header are modifiable, e.g. the IPv4 protocol and fragment 683224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * type may not be changed. 68412e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris * 68512e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris * @OVS_ACTION_ATTR_SET_TO_MASKED: Kernel internal masked set action translated 68612e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris * from the @OVS_ACTION_ATTR_SET. 687224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng */ 688224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng 689224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Chengenum ovs_action_attr { 690224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng OVS_ACTION_ATTR_UNSPEC, 691224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng OVS_ACTION_ATTR_OUTPUT, /* u32 port number. */ 692224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng OVS_ACTION_ATTR_USERSPACE, /* Nested OVS_USERSPACE_ATTR_*. */ 693224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng OVS_ACTION_ATTR_SET, /* One nested OVS_KEY_ATTR_*. */ 694224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng OVS_ACTION_ATTR_PUSH_VLAN, /* struct ovs_action_push_vlan. */ 695224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng OVS_ACTION_ATTR_POP_VLAN, /* No argument. */ 696224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng OVS_ACTION_ATTR_SAMPLE, /* Nested OVS_SAMPLE_ATTR_*. */ 6977c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris OVS_ACTION_ATTR_RECIRC, /* u32 recirc_id. */ 6987c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris OVS_ACTION_ATTR_HASH, /* struct ovs_action_hash. */ 69912e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris OVS_ACTION_ATTR_PUSH_MPLS, /* struct ovs_action_push_mpls. */ 70012e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris OVS_ACTION_ATTR_POP_MPLS, /* __be16 ethertype. */ 70112e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris OVS_ACTION_ATTR_SET_MASKED, /* One nested OVS_KEY_ATTR_* including 70212e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris * data immediately followed by a mask. 70312e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris * The data must be zero for the unmasked 70412e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris * bits. */ 70512e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris OVS_ACTION_ATTR_CT, /* Nested OVS_CT_ATTR_* . */ 70612e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris 70712e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris __OVS_ACTION_ATTR_MAX, /* Nothing past this will be accepted 70812e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris * from userspace. */ 70912e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris 71012e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris#ifdef __KERNEL__ 71112e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris OVS_ACTION_ATTR_SET_TO_MASKED, /* Kernel module internal masked 71212e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris * set action converted from 71312e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris * OVS_ACTION_ATTR_SET. */ 71412e1f28cce28271eb109a5bae818a804f0c3bb27Christopher Ferris#endif 715224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng}; 716224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng 717224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng#define OVS_ACTION_ATTR_MAX (__OVS_ACTION_ATTR_MAX - 1) 718224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng 719224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng#endif /* _LINUX_OPENVSWITCH_H */ 720