openvswitch.h revision 7c0b639731767acd9b3788628d81174c641fa6b9
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. 156224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * @OVS_PACKET_ATTR_USERDATA: Present for an %OVS_PACKET_CMD_ACTION 157224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * notification if the %OVS_ACTION_ATTR_USERSPACE action specified an 158224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * %OVS_USERSPACE_ATTR_USERDATA attribute, with the same length and content 159224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * specified there. 160224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * 161224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * These attributes follow the &struct ovs_header within the Generic Netlink 162224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * payload for %OVS_PACKET_* commands. 163224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng */ 164224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Chengenum ovs_packet_attr { 165224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng OVS_PACKET_ATTR_UNSPEC, 166224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng OVS_PACKET_ATTR_PACKET, /* Packet data. */ 167224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng OVS_PACKET_ATTR_KEY, /* Nested OVS_KEY_ATTR_* attributes. */ 168224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng OVS_PACKET_ATTR_ACTIONS, /* Nested OVS_ACTION_ATTR_* attributes. */ 169224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng OVS_PACKET_ATTR_USERDATA, /* OVS_ACTION_ATTR_USERSPACE arg. */ 170224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng __OVS_PACKET_ATTR_MAX 171224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng}; 172224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng 173224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng#define OVS_PACKET_ATTR_MAX (__OVS_PACKET_ATTR_MAX - 1) 174224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng 175224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng/* Virtual ports. */ 176224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng 177224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng#define OVS_VPORT_FAMILY "ovs_vport" 178224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng#define OVS_VPORT_MCGROUP "ovs_vport" 179224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng#define OVS_VPORT_VERSION 0x1 180224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng 181224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Chengenum ovs_vport_cmd { 182224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng OVS_VPORT_CMD_UNSPEC, 183224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng OVS_VPORT_CMD_NEW, 184224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng OVS_VPORT_CMD_DEL, 185224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng OVS_VPORT_CMD_GET, 186224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng OVS_VPORT_CMD_SET 187224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng}; 188224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng 189224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Chengenum ovs_vport_type { 190224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng OVS_VPORT_TYPE_UNSPEC, 191224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng OVS_VPORT_TYPE_NETDEV, /* network device */ 192224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng OVS_VPORT_TYPE_INTERNAL, /* network device implemented by datapath */ 193e084501669a4e4931c9d648351ecd7d595b81b79Christopher Ferris OVS_VPORT_TYPE_GRE, /* GRE tunnel. */ 194e084501669a4e4931c9d648351ecd7d595b81b79Christopher Ferris OVS_VPORT_TYPE_VXLAN, /* VXLAN tunnel. */ 1957c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris OVS_VPORT_TYPE_GENEVE, /* Geneve tunnel. */ 196224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng __OVS_VPORT_TYPE_MAX 197224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng}; 198224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng 199224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng#define OVS_VPORT_TYPE_MAX (__OVS_VPORT_TYPE_MAX - 1) 200224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng 201224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng/** 202224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * enum ovs_vport_attr - attributes for %OVS_VPORT_* commands. 203224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * @OVS_VPORT_ATTR_PORT_NO: 32-bit port number within datapath. 204224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * @OVS_VPORT_ATTR_TYPE: 32-bit %OVS_VPORT_TYPE_* constant describing the type 205224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * of vport. 206224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * @OVS_VPORT_ATTR_NAME: Name of vport. For a vport based on a network device 207224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * this is the name of the network device. Maximum length %IFNAMSIZ-1 bytes 208224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * plus a null terminator. 209224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * @OVS_VPORT_ATTR_OPTIONS: Vport-specific configuration information. 2107c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris * @OVS_VPORT_ATTR_UPCALL_PID: The array of Netlink socket pids in userspace 2117c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris * among which OVS_PACKET_CMD_MISS upcalls will be distributed for packets 2127c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris * received on this port. If this is a single-element array of value 0, 2137c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris * upcalls should not be sent. 214224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * @OVS_VPORT_ATTR_STATS: A &struct ovs_vport_stats giving statistics for 215224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * packets sent or received through the vport. 216224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * 217224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * These attributes follow the &struct ovs_header within the Generic Netlink 218224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * payload for %OVS_VPORT_* commands. 219224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * 220224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * For %OVS_VPORT_CMD_NEW requests, the %OVS_VPORT_ATTR_TYPE and 221224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * %OVS_VPORT_ATTR_NAME attributes are required. %OVS_VPORT_ATTR_PORT_NO is 222224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * optional; if not specified a free port number is automatically selected. 223224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * Whether %OVS_VPORT_ATTR_OPTIONS is required or optional depends on the type 224224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * of vport. 225224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * 226224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * For other requests, if %OVS_VPORT_ATTR_NAME is specified then it is used to 227224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * look up the vport to operate on; otherwise dp_idx from the &struct 228224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * ovs_header plus %OVS_VPORT_ATTR_PORT_NO determine the vport. 229224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng */ 230224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Chengenum ovs_vport_attr { 231224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng OVS_VPORT_ATTR_UNSPEC, 232224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng OVS_VPORT_ATTR_PORT_NO, /* u32 port number within datapath */ 233224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng OVS_VPORT_ATTR_TYPE, /* u32 OVS_VPORT_TYPE_* constant. */ 234224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng OVS_VPORT_ATTR_NAME, /* string name, up to IFNAMSIZ bytes long */ 235224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng OVS_VPORT_ATTR_OPTIONS, /* nested attributes, varies by vport type */ 2367c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris OVS_VPORT_ATTR_UPCALL_PID, /* array of u32 Netlink socket PIDs for */ 2377c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris /* receiving upcalls */ 238224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng OVS_VPORT_ATTR_STATS, /* struct ovs_vport_stats */ 239224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng __OVS_VPORT_ATTR_MAX 240224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng}; 241224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng 242224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng#define OVS_VPORT_ATTR_MAX (__OVS_VPORT_ATTR_MAX - 1) 243224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng 244e084501669a4e4931c9d648351ecd7d595b81b79Christopher Ferris/* OVS_VPORT_ATTR_OPTIONS attributes for tunnels. 245e084501669a4e4931c9d648351ecd7d595b81b79Christopher Ferris */ 246e084501669a4e4931c9d648351ecd7d595b81b79Christopher Ferrisenum { 247e084501669a4e4931c9d648351ecd7d595b81b79Christopher Ferris OVS_TUNNEL_ATTR_UNSPEC, 248e084501669a4e4931c9d648351ecd7d595b81b79Christopher Ferris OVS_TUNNEL_ATTR_DST_PORT, /* 16-bit UDP port, used by L4 tunnels. */ 249e084501669a4e4931c9d648351ecd7d595b81b79Christopher Ferris __OVS_TUNNEL_ATTR_MAX 250e084501669a4e4931c9d648351ecd7d595b81b79Christopher Ferris}; 251e084501669a4e4931c9d648351ecd7d595b81b79Christopher Ferris 252e084501669a4e4931c9d648351ecd7d595b81b79Christopher Ferris#define OVS_TUNNEL_ATTR_MAX (__OVS_TUNNEL_ATTR_MAX - 1) 253e084501669a4e4931c9d648351ecd7d595b81b79Christopher Ferris 254224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng/* Flows. */ 255224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng 256224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng#define OVS_FLOW_FAMILY "ovs_flow" 257224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng#define OVS_FLOW_MCGROUP "ovs_flow" 258224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng#define OVS_FLOW_VERSION 0x1 259224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng 260224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Chengenum ovs_flow_cmd { 261224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng OVS_FLOW_CMD_UNSPEC, 262224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng OVS_FLOW_CMD_NEW, 263224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng OVS_FLOW_CMD_DEL, 264224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng OVS_FLOW_CMD_GET, 265224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng OVS_FLOW_CMD_SET 266224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng}; 267224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng 268224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Chengstruct ovs_flow_stats { 269224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng __u64 n_packets; /* Number of matched packets. */ 270224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng __u64 n_bytes; /* Number of matched bytes. */ 271224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng}; 272224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng 273224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Chengenum ovs_key_attr { 274224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng OVS_KEY_ATTR_UNSPEC, 275224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng OVS_KEY_ATTR_ENCAP, /* Nested set of encapsulated attributes. */ 276224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng OVS_KEY_ATTR_PRIORITY, /* u32 skb->priority */ 277224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng OVS_KEY_ATTR_IN_PORT, /* u32 OVS dp port number */ 278224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng OVS_KEY_ATTR_ETHERNET, /* struct ovs_key_ethernet */ 279224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng OVS_KEY_ATTR_VLAN, /* be16 VLAN TCI */ 280224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng OVS_KEY_ATTR_ETHERTYPE, /* be16 Ethernet type */ 281224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng OVS_KEY_ATTR_IPV4, /* struct ovs_key_ipv4 */ 282224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng OVS_KEY_ATTR_IPV6, /* struct ovs_key_ipv6 */ 283224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng OVS_KEY_ATTR_TCP, /* struct ovs_key_tcp */ 284224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng OVS_KEY_ATTR_UDP, /* struct ovs_key_udp */ 285224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng OVS_KEY_ATTR_ICMP, /* struct ovs_key_icmp */ 286224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng OVS_KEY_ATTR_ICMPV6, /* struct ovs_key_icmpv6 */ 287224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng OVS_KEY_ATTR_ARP, /* struct ovs_key_arp */ 288224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng OVS_KEY_ATTR_ND, /* struct ovs_key_nd */ 289224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng OVS_KEY_ATTR_SKB_MARK, /* u32 skb mark */ 290e084501669a4e4931c9d648351ecd7d595b81b79Christopher Ferris OVS_KEY_ATTR_TUNNEL, /* Nested set of ovs_tunnel attributes */ 291e084501669a4e4931c9d648351ecd7d595b81b79Christopher Ferris OVS_KEY_ATTR_SCTP, /* struct ovs_key_sctp */ 292e084501669a4e4931c9d648351ecd7d595b81b79Christopher Ferris OVS_KEY_ATTR_TCP_FLAGS, /* be16 TCP flags. */ 2937c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris OVS_KEY_ATTR_DP_HASH, /* u32 hash value. Value 0 indicates the hash 2947c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris is not computed by the datapath. */ 2957c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris OVS_KEY_ATTR_RECIRC_ID, /* u32 recirc id */ 296e084501669a4e4931c9d648351ecd7d595b81b79Christopher Ferris 297e084501669a4e4931c9d648351ecd7d595b81b79Christopher Ferris#ifdef __KERNEL__ 2987c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris OVS_KEY_ATTR_TUNNEL_INFO, /* struct ovs_tunnel_info */ 299e084501669a4e4931c9d648351ecd7d595b81b79Christopher Ferris#endif 300224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng __OVS_KEY_ATTR_MAX 301224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng}; 302224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng 303224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng#define OVS_KEY_ATTR_MAX (__OVS_KEY_ATTR_MAX - 1) 304224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng 305e084501669a4e4931c9d648351ecd7d595b81b79Christopher Ferrisenum ovs_tunnel_key_attr { 306e084501669a4e4931c9d648351ecd7d595b81b79Christopher Ferris OVS_TUNNEL_KEY_ATTR_ID, /* be64 Tunnel ID */ 307e084501669a4e4931c9d648351ecd7d595b81b79Christopher Ferris OVS_TUNNEL_KEY_ATTR_IPV4_SRC, /* be32 src IP address. */ 308e084501669a4e4931c9d648351ecd7d595b81b79Christopher Ferris OVS_TUNNEL_KEY_ATTR_IPV4_DST, /* be32 dst IP address. */ 309e084501669a4e4931c9d648351ecd7d595b81b79Christopher Ferris OVS_TUNNEL_KEY_ATTR_TOS, /* u8 Tunnel IP ToS. */ 310e084501669a4e4931c9d648351ecd7d595b81b79Christopher Ferris OVS_TUNNEL_KEY_ATTR_TTL, /* u8 Tunnel IP TTL. */ 311e084501669a4e4931c9d648351ecd7d595b81b79Christopher Ferris OVS_TUNNEL_KEY_ATTR_DONT_FRAGMENT, /* No argument, set DF. */ 312e084501669a4e4931c9d648351ecd7d595b81b79Christopher Ferris OVS_TUNNEL_KEY_ATTR_CSUM, /* No argument. CSUM packet. */ 3137c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris OVS_TUNNEL_KEY_ATTR_OAM, /* No argument. OAM frame. */ 3147c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris OVS_TUNNEL_KEY_ATTR_GENEVE_OPTS, /* Array of Geneve options. */ 315e084501669a4e4931c9d648351ecd7d595b81b79Christopher Ferris __OVS_TUNNEL_KEY_ATTR_MAX 316e084501669a4e4931c9d648351ecd7d595b81b79Christopher Ferris}; 317e084501669a4e4931c9d648351ecd7d595b81b79Christopher Ferris 318e084501669a4e4931c9d648351ecd7d595b81b79Christopher Ferris#define OVS_TUNNEL_KEY_ATTR_MAX (__OVS_TUNNEL_KEY_ATTR_MAX - 1) 319e084501669a4e4931c9d648351ecd7d595b81b79Christopher Ferris 320224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng/** 321224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * enum ovs_frag_type - IPv4 and IPv6 fragment type 322224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * @OVS_FRAG_TYPE_NONE: Packet is not a fragment. 323224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * @OVS_FRAG_TYPE_FIRST: Packet is a fragment with offset 0. 324224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * @OVS_FRAG_TYPE_LATER: Packet is a fragment with nonzero offset. 325224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * 326224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * Used as the @ipv4_frag in &struct ovs_key_ipv4 and as @ipv6_frag &struct 327224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * ovs_key_ipv6. 328224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng */ 329224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Chengenum ovs_frag_type { 330224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng OVS_FRAG_TYPE_NONE, 331224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng OVS_FRAG_TYPE_FIRST, 332224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng OVS_FRAG_TYPE_LATER, 333224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng __OVS_FRAG_TYPE_MAX 334224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng}; 335224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng 336224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng#define OVS_FRAG_TYPE_MAX (__OVS_FRAG_TYPE_MAX - 1) 337224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng 338224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Chengstruct ovs_key_ethernet { 339224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng __u8 eth_src[ETH_ALEN]; 340224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng __u8 eth_dst[ETH_ALEN]; 341224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng}; 342224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng 343224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Chengstruct ovs_key_ipv4 { 344224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng __be32 ipv4_src; 345224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng __be32 ipv4_dst; 346224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng __u8 ipv4_proto; 347224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng __u8 ipv4_tos; 348224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng __u8 ipv4_ttl; 349224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng __u8 ipv4_frag; /* One of OVS_FRAG_TYPE_*. */ 350224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng}; 351224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng 352224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Chengstruct ovs_key_ipv6 { 353224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng __be32 ipv6_src[4]; 354224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng __be32 ipv6_dst[4]; 355224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng __be32 ipv6_label; /* 20-bits in least-significant bits. */ 356224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng __u8 ipv6_proto; 357224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng __u8 ipv6_tclass; 358224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng __u8 ipv6_hlimit; 359224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng __u8 ipv6_frag; /* One of OVS_FRAG_TYPE_*. */ 360224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng}; 361224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng 362224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Chengstruct ovs_key_tcp { 363224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng __be16 tcp_src; 364224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng __be16 tcp_dst; 365224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng}; 366224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng 367224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Chengstruct ovs_key_udp { 368224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng __be16 udp_src; 369224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng __be16 udp_dst; 370224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng}; 371224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng 372e084501669a4e4931c9d648351ecd7d595b81b79Christopher Ferrisstruct ovs_key_sctp { 373e084501669a4e4931c9d648351ecd7d595b81b79Christopher Ferris __be16 sctp_src; 374e084501669a4e4931c9d648351ecd7d595b81b79Christopher Ferris __be16 sctp_dst; 375e084501669a4e4931c9d648351ecd7d595b81b79Christopher Ferris}; 376e084501669a4e4931c9d648351ecd7d595b81b79Christopher Ferris 377224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Chengstruct ovs_key_icmp { 378224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng __u8 icmp_type; 379224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng __u8 icmp_code; 380224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng}; 381224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng 382224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Chengstruct ovs_key_icmpv6 { 383224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng __u8 icmpv6_type; 384224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng __u8 icmpv6_code; 385224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng}; 386224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng 387224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Chengstruct ovs_key_arp { 388224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng __be32 arp_sip; 389224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng __be32 arp_tip; 390224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng __be16 arp_op; 391224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng __u8 arp_sha[ETH_ALEN]; 392224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng __u8 arp_tha[ETH_ALEN]; 393224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng}; 394224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng 395224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Chengstruct ovs_key_nd { 396224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng __u32 nd_target[4]; 397224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng __u8 nd_sll[ETH_ALEN]; 398224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng __u8 nd_tll[ETH_ALEN]; 399224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng}; 400224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng 401224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng/** 402224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * enum ovs_flow_attr - attributes for %OVS_FLOW_* commands. 403224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * @OVS_FLOW_ATTR_KEY: Nested %OVS_KEY_ATTR_* attributes specifying the flow 404224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * key. Always present in notifications. Required for all requests (except 405224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * dumps). 406224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * @OVS_FLOW_ATTR_ACTIONS: Nested %OVS_ACTION_ATTR_* attributes specifying 407224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * the actions to take for packets that match the key. Always present in 408224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * notifications. Required for %OVS_FLOW_CMD_NEW requests, optional for 409314752488cb92b9f86028836d0b8eabd8acb6a7cChristopher Ferris * %OVS_FLOW_CMD_SET requests. An %OVS_FLOW_CMD_SET without 410314752488cb92b9f86028836d0b8eabd8acb6a7cChristopher Ferris * %OVS_FLOW_ATTR_ACTIONS will not modify the actions. To clear the actions, 411314752488cb92b9f86028836d0b8eabd8acb6a7cChristopher Ferris * an %OVS_FLOW_ATTR_ACTIONS without any nested attributes must be given. 412224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * @OVS_FLOW_ATTR_STATS: &struct ovs_flow_stats giving statistics for this 413224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * flow. Present in notifications if the stats would be nonzero. Ignored in 414224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * requests. 415224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * @OVS_FLOW_ATTR_TCP_FLAGS: An 8-bit value giving the OR'd value of all of the 416224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * TCP flags seen on packets in this flow. Only present in notifications for 417224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * TCP flows, and only if it would be nonzero. Ignored in requests. 418224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * @OVS_FLOW_ATTR_USED: A 64-bit integer giving the time, in milliseconds on 419224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * the system monotonic clock, at which a packet was last processed for this 420224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * flow. Only present in notifications if a packet has been processed for this 421224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * flow. Ignored in requests. 422224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * @OVS_FLOW_ATTR_CLEAR: If present in a %OVS_FLOW_CMD_SET request, clears the 423224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * last-used time, accumulated TCP flags, and statistics for this flow. 424224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * Otherwise ignored in requests. Never present in notifications. 425e084501669a4e4931c9d648351ecd7d595b81b79Christopher Ferris * @OVS_FLOW_ATTR_MASK: Nested %OVS_KEY_ATTR_* attributes specifying the 426e084501669a4e4931c9d648351ecd7d595b81b79Christopher Ferris * mask bits for wildcarded flow match. Mask bit value '1' specifies exact 427e084501669a4e4931c9d648351ecd7d595b81b79Christopher Ferris * match with corresponding flow key bit, while mask bit value '0' specifies 428e084501669a4e4931c9d648351ecd7d595b81b79Christopher Ferris * a wildcarded match. Omitting attribute is treated as wildcarding all 429e084501669a4e4931c9d648351ecd7d595b81b79Christopher Ferris * corresponding fields. Optional for all requests. If not present, 430e084501669a4e4931c9d648351ecd7d595b81b79Christopher Ferris * all flow key bits are exact match bits. 431224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * 432224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * These attributes follow the &struct ovs_header within the Generic Netlink 433224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * payload for %OVS_FLOW_* commands. 434224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng */ 435224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Chengenum ovs_flow_attr { 436224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng OVS_FLOW_ATTR_UNSPEC, 437224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng OVS_FLOW_ATTR_KEY, /* Sequence of OVS_KEY_ATTR_* attributes. */ 438224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng OVS_FLOW_ATTR_ACTIONS, /* Nested OVS_ACTION_ATTR_* attributes. */ 439224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng OVS_FLOW_ATTR_STATS, /* struct ovs_flow_stats. */ 440224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng OVS_FLOW_ATTR_TCP_FLAGS, /* 8-bit OR'd TCP flags. */ 441224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng OVS_FLOW_ATTR_USED, /* u64 msecs last used in monotonic time. */ 442224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng OVS_FLOW_ATTR_CLEAR, /* Flag to clear stats, tcp_flags, used. */ 443e084501669a4e4931c9d648351ecd7d595b81b79Christopher Ferris OVS_FLOW_ATTR_MASK, /* Sequence of OVS_KEY_ATTR_* attributes. */ 444224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng __OVS_FLOW_ATTR_MAX 445224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng}; 446224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng 447224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng#define OVS_FLOW_ATTR_MAX (__OVS_FLOW_ATTR_MAX - 1) 448224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng 449224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng/** 450224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * enum ovs_sample_attr - Attributes for %OVS_ACTION_ATTR_SAMPLE action. 451224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * @OVS_SAMPLE_ATTR_PROBABILITY: 32-bit fraction of packets to sample with 452224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * @OVS_ACTION_ATTR_SAMPLE. A value of 0 samples no packets, a value of 453224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * %UINT32_MAX samples all packets and intermediate values sample intermediate 454224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * fractions of packets. 455224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * @OVS_SAMPLE_ATTR_ACTIONS: Set of actions to execute in sampling event. 456224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * Actions are passed as nested attributes. 457224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * 458224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * Executes the specified actions with the given probability on a per-packet 459224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * basis. 460224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng */ 461224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Chengenum ovs_sample_attr { 462224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng OVS_SAMPLE_ATTR_UNSPEC, 463224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng OVS_SAMPLE_ATTR_PROBABILITY, /* u32 number */ 464224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng OVS_SAMPLE_ATTR_ACTIONS, /* Nested OVS_ACTION_ATTR_* attributes. */ 465224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng __OVS_SAMPLE_ATTR_MAX, 466224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng}; 467224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng 468224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng#define OVS_SAMPLE_ATTR_MAX (__OVS_SAMPLE_ATTR_MAX - 1) 469224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng 470224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng/** 471224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * enum ovs_userspace_attr - Attributes for %OVS_ACTION_ATTR_USERSPACE action. 472224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * @OVS_USERSPACE_ATTR_PID: u32 Netlink PID to which the %OVS_PACKET_CMD_ACTION 473224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * message should be sent. Required. 474224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * @OVS_USERSPACE_ATTR_USERDATA: If present, its variable-length argument is 475224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * copied to the %OVS_PACKET_CMD_ACTION message as %OVS_PACKET_ATTR_USERDATA. 476224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng */ 477224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Chengenum ovs_userspace_attr { 478224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng OVS_USERSPACE_ATTR_UNSPEC, 479224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng OVS_USERSPACE_ATTR_PID, /* u32 Netlink PID to receive upcalls. */ 480224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng OVS_USERSPACE_ATTR_USERDATA, /* Optional user-specified cookie. */ 481224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng __OVS_USERSPACE_ATTR_MAX 482224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng}; 483224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng 484224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng#define OVS_USERSPACE_ATTR_MAX (__OVS_USERSPACE_ATTR_MAX - 1) 485224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng 486224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng/** 487224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * struct ovs_action_push_vlan - %OVS_ACTION_ATTR_PUSH_VLAN action argument. 488224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * @vlan_tpid: Tag protocol identifier (TPID) to push. 489224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * @vlan_tci: Tag control identifier (TCI) to push. The CFI bit must be set 490224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * (but it will not be set in the 802.1Q header that is pushed). 491224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * 492224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * The @vlan_tpid value is typically %ETH_P_8021Q. The only acceptable TPID 493224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * values are those that the kernel module also parses as 802.1Q headers, to 494224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * prevent %OVS_ACTION_ATTR_PUSH_VLAN followed by %OVS_ACTION_ATTR_POP_VLAN 495224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * from having surprising results. 496224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng */ 497224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Chengstruct ovs_action_push_vlan { 498224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng __be16 vlan_tpid; /* 802.1Q TPID. */ 499224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng __be16 vlan_tci; /* 802.1Q TCI (VLAN ID and priority). */ 500224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng}; 501224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng 5027c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris/* Data path hash algorithm for computing Datapath hash. 5037c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris * 5047c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris * The algorithm type only specifies the fields in a flow 5057c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris * will be used as part of the hash. Each datapath is free 5067c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris * to use its own hash algorithm. The hash value will be 5077c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris * opaque to the user space daemon. 5087c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris */ 5097c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferrisenum ovs_hash_alg { 5107c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris OVS_HASH_ALG_L4, 5117c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris}; 5127c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris 5137c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris/* 5147c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris * struct ovs_action_hash - %OVS_ACTION_ATTR_HASH action argument. 5157c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris * @hash_alg: Algorithm used to compute hash prior to recirculation. 5167c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris * @hash_basis: basis used for computing hash. 5177c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris */ 5187c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferrisstruct ovs_action_hash { 5197c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris uint32_t hash_alg; /* One of ovs_hash_alg. */ 5207c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris uint32_t hash_basis; 5217c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris}; 5227c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris 523224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng/** 524224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * enum ovs_action_attr - Action types. 525224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * 526224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * @OVS_ACTION_ATTR_OUTPUT: Output packet to port. 527224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * @OVS_ACTION_ATTR_USERSPACE: Send packet to userspace according to nested 528224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * %OVS_USERSPACE_ATTR_* attributes. 529224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * @OVS_ACTION_ATTR_SET: Replaces the contents of an existing header. The 530224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * single nested %OVS_KEY_ATTR_* attribute specifies a header to modify and its 531224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * value. 532224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * @OVS_ACTION_ATTR_PUSH_VLAN: Push a new outermost 802.1Q header onto the 533224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * packet. 534224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * @OVS_ACTION_ATTR_POP_VLAN: Pop the outermost 802.1Q header off the packet. 535224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * @OVS_ACTION_ATTR_SAMPLE: Probabilitically executes actions, as specified in 536224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * the nested %OVS_SAMPLE_ATTR_* attributes. 537224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * 538224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * Only a single header can be set with a single %OVS_ACTION_ATTR_SET. Not all 539224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * fields within a header are modifiable, e.g. the IPv4 protocol and fragment 540224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * type may not be changed. 541224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng */ 542224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng 543224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Chengenum ovs_action_attr { 544224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng OVS_ACTION_ATTR_UNSPEC, 545224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng OVS_ACTION_ATTR_OUTPUT, /* u32 port number. */ 546224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng OVS_ACTION_ATTR_USERSPACE, /* Nested OVS_USERSPACE_ATTR_*. */ 547224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng OVS_ACTION_ATTR_SET, /* One nested OVS_KEY_ATTR_*. */ 548224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng OVS_ACTION_ATTR_PUSH_VLAN, /* struct ovs_action_push_vlan. */ 549224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng OVS_ACTION_ATTR_POP_VLAN, /* No argument. */ 550224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng OVS_ACTION_ATTR_SAMPLE, /* Nested OVS_SAMPLE_ATTR_*. */ 5517c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris OVS_ACTION_ATTR_RECIRC, /* u32 recirc_id. */ 5527c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris OVS_ACTION_ATTR_HASH, /* struct ovs_action_hash. */ 553224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng __OVS_ACTION_ATTR_MAX 554224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng}; 555224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng 556224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng#define OVS_ACTION_ATTR_MAX (__OVS_ACTION_ATTR_MAX - 1) 557224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng 558224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng#endif /* _LINUX_OPENVSWITCH_H */ 559