![]() |
|
|||
0001 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ 0002 0003 /* 0004 * Copyright (c) 2007-2017 Nicira, Inc. 0005 * 0006 * This program is free software; you can redistribute it and/or 0007 * modify it under the terms of version 2 of the GNU General Public 0008 * License as published by the Free Software Foundation. 0009 * 0010 * This program is distributed in the hope that it will be useful, but 0011 * WITHOUT ANY WARRANTY; without even the implied warranty of 0012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0013 * General Public License for more details. 0014 * 0015 * You should have received a copy of the GNU General Public License 0016 * along with this program; if not, write to the Free Software 0017 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 0018 * 02110-1301, USA 0019 */ 0020 0021 #ifndef _UAPI__LINUX_OPENVSWITCH_H 0022 #define _UAPI__LINUX_OPENVSWITCH_H 1 0023 0024 #include <linux/types.h> 0025 #include <linux/if_ether.h> 0026 0027 /** 0028 * struct ovs_header - header for OVS Generic Netlink messages. 0029 * @dp_ifindex: ifindex of local port for datapath (0 to make a request not 0030 * specific to a datapath). 0031 * 0032 * Attributes following the header are specific to a particular OVS Generic 0033 * Netlink family, but all of the OVS families use this header. 0034 */ 0035 0036 struct ovs_header { 0037 int dp_ifindex; 0038 }; 0039 0040 /* Datapaths. */ 0041 0042 #define OVS_DATAPATH_FAMILY "ovs_datapath" 0043 #define OVS_DATAPATH_MCGROUP "ovs_datapath" 0044 0045 /* V2: 0046 * - API users are expected to provide OVS_DP_ATTR_USER_FEATURES 0047 * when creating the datapath. 0048 */ 0049 #define OVS_DATAPATH_VERSION 2 0050 0051 /* First OVS datapath version to support features */ 0052 #define OVS_DP_VER_FEATURES 2 0053 0054 enum ovs_datapath_cmd { 0055 OVS_DP_CMD_UNSPEC, 0056 OVS_DP_CMD_NEW, 0057 OVS_DP_CMD_DEL, 0058 OVS_DP_CMD_GET, 0059 OVS_DP_CMD_SET 0060 }; 0061 0062 /** 0063 * enum ovs_datapath_attr - attributes for %OVS_DP_* commands. 0064 * @OVS_DP_ATTR_NAME: Name of the network device that serves as the "local 0065 * port". This is the name of the network device whose dp_ifindex is given in 0066 * the &struct ovs_header. Always present in notifications. Required in 0067 * %OVS_DP_NEW requests. May be used as an alternative to specifying 0068 * dp_ifindex in other requests (with a dp_ifindex of 0). 0069 * @OVS_DP_ATTR_UPCALL_PID: The Netlink socket in userspace that is initially 0070 * set on the datapath port (for OVS_ACTION_ATTR_MISS). Only valid on 0071 * %OVS_DP_CMD_NEW requests. A value of zero indicates that upcalls should 0072 * not be sent. 0073 * @OVS_DP_ATTR_PER_CPU_PIDS: Per-cpu array of PIDs for upcalls when 0074 * OVS_DP_F_DISPATCH_UPCALL_PER_CPU feature is set. 0075 * @OVS_DP_ATTR_STATS: Statistics about packets that have passed through the 0076 * datapath. Always present in notifications. 0077 * @OVS_DP_ATTR_MEGAFLOW_STATS: Statistics about mega flow masks usage for the 0078 * datapath. Always present in notifications. 0079 * 0080 * These attributes follow the &struct ovs_header within the Generic Netlink 0081 * payload for %OVS_DP_* commands. 0082 */ 0083 enum ovs_datapath_attr { 0084 OVS_DP_ATTR_UNSPEC, 0085 OVS_DP_ATTR_NAME, /* name of dp_ifindex netdev */ 0086 OVS_DP_ATTR_UPCALL_PID, /* Netlink PID to receive upcalls */ 0087 OVS_DP_ATTR_STATS, /* struct ovs_dp_stats */ 0088 OVS_DP_ATTR_MEGAFLOW_STATS, /* struct ovs_dp_megaflow_stats */ 0089 OVS_DP_ATTR_USER_FEATURES, /* OVS_DP_F_* */ 0090 OVS_DP_ATTR_PAD, 0091 OVS_DP_ATTR_MASKS_CACHE_SIZE, 0092 OVS_DP_ATTR_PER_CPU_PIDS, /* Netlink PIDS to receive upcalls in 0093 * per-cpu dispatch mode 0094 */ 0095 __OVS_DP_ATTR_MAX 0096 }; 0097 0098 #define OVS_DP_ATTR_MAX (__OVS_DP_ATTR_MAX - 1) 0099 0100 struct ovs_dp_stats { 0101 __u64 n_hit; /* Number of flow table matches. */ 0102 __u64 n_missed; /* Number of flow table misses. */ 0103 __u64 n_lost; /* Number of misses not sent to userspace. */ 0104 __u64 n_flows; /* Number of flows present */ 0105 }; 0106 0107 struct ovs_dp_megaflow_stats { 0108 __u64 n_mask_hit; /* Number of masks used for flow lookups. */ 0109 __u32 n_masks; /* Number of masks for the datapath. */ 0110 __u32 pad0; /* Pad for future expension. */ 0111 __u64 n_cache_hit; /* Number of cache matches for flow lookups. */ 0112 __u64 pad1; /* Pad for future expension. */ 0113 }; 0114 0115 struct ovs_vport_stats { 0116 __u64 rx_packets; /* total packets received */ 0117 __u64 tx_packets; /* total packets transmitted */ 0118 __u64 rx_bytes; /* total bytes received */ 0119 __u64 tx_bytes; /* total bytes transmitted */ 0120 __u64 rx_errors; /* bad packets received */ 0121 __u64 tx_errors; /* packet transmit problems */ 0122 __u64 rx_dropped; /* no space in linux buffers */ 0123 __u64 tx_dropped; /* no space available in linux */ 0124 }; 0125 0126 /* Allow last Netlink attribute to be unaligned */ 0127 #define OVS_DP_F_UNALIGNED (1 << 0) 0128 0129 /* Allow datapath to associate multiple Netlink PIDs to each vport */ 0130 #define OVS_DP_F_VPORT_PIDS (1 << 1) 0131 0132 /* Allow tc offload recirc sharing */ 0133 #define OVS_DP_F_TC_RECIRC_SHARING (1 << 2) 0134 0135 /* Allow per-cpu dispatch of upcalls */ 0136 #define OVS_DP_F_DISPATCH_UPCALL_PER_CPU (1 << 3) 0137 0138 /* Fixed logical ports. */ 0139 #define OVSP_LOCAL ((__u32)0) 0140 0141 /* Packet transfer. */ 0142 0143 #define OVS_PACKET_FAMILY "ovs_packet" 0144 #define OVS_PACKET_VERSION 0x1 0145 0146 enum ovs_packet_cmd { 0147 OVS_PACKET_CMD_UNSPEC, 0148 0149 /* Kernel-to-user notifications. */ 0150 OVS_PACKET_CMD_MISS, /* Flow table miss. */ 0151 OVS_PACKET_CMD_ACTION, /* OVS_ACTION_ATTR_USERSPACE action. */ 0152 0153 /* Userspace commands. */ 0154 OVS_PACKET_CMD_EXECUTE /* Apply actions to a packet. */ 0155 }; 0156 0157 /** 0158 * enum ovs_packet_attr - attributes for %OVS_PACKET_* commands. 0159 * @OVS_PACKET_ATTR_PACKET: Present for all notifications. Contains the entire 0160 * packet as received, from the start of the Ethernet header onward. For 0161 * %OVS_PACKET_CMD_ACTION, %OVS_PACKET_ATTR_PACKET reflects changes made by 0162 * actions preceding %OVS_ACTION_ATTR_USERSPACE, but %OVS_PACKET_ATTR_KEY is 0163 * the flow key extracted from the packet as originally received. 0164 * @OVS_PACKET_ATTR_KEY: Present for all notifications. Contains the flow key 0165 * extracted from the packet as nested %OVS_KEY_ATTR_* attributes. This allows 0166 * userspace to adapt its flow setup strategy by comparing its notion of the 0167 * flow key against the kernel's. 0168 * @OVS_PACKET_ATTR_ACTIONS: Contains actions for the packet. Used 0169 * for %OVS_PACKET_CMD_EXECUTE. It has nested %OVS_ACTION_ATTR_* attributes. 0170 * Also used in upcall when %OVS_ACTION_ATTR_USERSPACE has optional 0171 * %OVS_USERSPACE_ATTR_ACTIONS attribute. 0172 * @OVS_PACKET_ATTR_USERDATA: Present for an %OVS_PACKET_CMD_ACTION 0173 * notification if the %OVS_ACTION_ATTR_USERSPACE action specified an 0174 * %OVS_USERSPACE_ATTR_USERDATA attribute, with the same length and content 0175 * specified there. 0176 * @OVS_PACKET_ATTR_EGRESS_TUN_KEY: Present for an %OVS_PACKET_CMD_ACTION 0177 * notification if the %OVS_ACTION_ATTR_USERSPACE action specified an 0178 * %OVS_USERSPACE_ATTR_EGRESS_TUN_PORT attribute, which is sent only if the 0179 * output port is actually a tunnel port. Contains the output tunnel key 0180 * extracted from the packet as nested %OVS_TUNNEL_KEY_ATTR_* attributes. 0181 * @OVS_PACKET_ATTR_MRU: Present for an %OVS_PACKET_CMD_ACTION and 0182 * @OVS_PACKET_ATTR_LEN: Packet size before truncation. 0183 * %OVS_PACKET_ATTR_USERSPACE action specify the Maximum received fragment 0184 * size. 0185 * @OVS_PACKET_ATTR_HASH: Packet hash info (e.g. hash, sw_hash and l4_hash in skb). 0186 * 0187 * These attributes follow the &struct ovs_header within the Generic Netlink 0188 * payload for %OVS_PACKET_* commands. 0189 */ 0190 enum ovs_packet_attr { 0191 OVS_PACKET_ATTR_UNSPEC, 0192 OVS_PACKET_ATTR_PACKET, /* Packet data. */ 0193 OVS_PACKET_ATTR_KEY, /* Nested OVS_KEY_ATTR_* attributes. */ 0194 OVS_PACKET_ATTR_ACTIONS, /* Nested OVS_ACTION_ATTR_* attributes. */ 0195 OVS_PACKET_ATTR_USERDATA, /* OVS_ACTION_ATTR_USERSPACE arg. */ 0196 OVS_PACKET_ATTR_EGRESS_TUN_KEY, /* Nested OVS_TUNNEL_KEY_ATTR_* 0197 attributes. */ 0198 OVS_PACKET_ATTR_UNUSED1, 0199 OVS_PACKET_ATTR_UNUSED2, 0200 OVS_PACKET_ATTR_PROBE, /* Packet operation is a feature probe, 0201 error logging should be suppressed. */ 0202 OVS_PACKET_ATTR_MRU, /* Maximum received IP fragment size. */ 0203 OVS_PACKET_ATTR_LEN, /* Packet size before truncation. */ 0204 OVS_PACKET_ATTR_HASH, /* Packet hash. */ 0205 __OVS_PACKET_ATTR_MAX 0206 }; 0207 0208 #define OVS_PACKET_ATTR_MAX (__OVS_PACKET_ATTR_MAX - 1) 0209 0210 /* Virtual ports. */ 0211 0212 #define OVS_VPORT_FAMILY "ovs_vport" 0213 #define OVS_VPORT_MCGROUP "ovs_vport" 0214 #define OVS_VPORT_VERSION 0x1 0215 0216 enum ovs_vport_cmd { 0217 OVS_VPORT_CMD_UNSPEC, 0218 OVS_VPORT_CMD_NEW, 0219 OVS_VPORT_CMD_DEL, 0220 OVS_VPORT_CMD_GET, 0221 OVS_VPORT_CMD_SET 0222 }; 0223 0224 enum ovs_vport_type { 0225 OVS_VPORT_TYPE_UNSPEC, 0226 OVS_VPORT_TYPE_NETDEV, /* network device */ 0227 OVS_VPORT_TYPE_INTERNAL, /* network device implemented by datapath */ 0228 OVS_VPORT_TYPE_GRE, /* GRE tunnel. */ 0229 OVS_VPORT_TYPE_VXLAN, /* VXLAN tunnel. */ 0230 OVS_VPORT_TYPE_GENEVE, /* Geneve tunnel. */ 0231 __OVS_VPORT_TYPE_MAX 0232 }; 0233 0234 #define OVS_VPORT_TYPE_MAX (__OVS_VPORT_TYPE_MAX - 1) 0235 0236 /** 0237 * enum ovs_vport_attr - attributes for %OVS_VPORT_* commands. 0238 * @OVS_VPORT_ATTR_PORT_NO: 32-bit port number within datapath. 0239 * @OVS_VPORT_ATTR_TYPE: 32-bit %OVS_VPORT_TYPE_* constant describing the type 0240 * of vport. 0241 * @OVS_VPORT_ATTR_NAME: Name of vport. For a vport based on a network device 0242 * this is the name of the network device. Maximum length %IFNAMSIZ-1 bytes 0243 * plus a null terminator. 0244 * @OVS_VPORT_ATTR_OPTIONS: Vport-specific configuration information. 0245 * @OVS_VPORT_ATTR_UPCALL_PID: The array of Netlink socket pids in userspace 0246 * among which OVS_PACKET_CMD_MISS upcalls will be distributed for packets 0247 * received on this port. If this is a single-element array of value 0, 0248 * upcalls should not be sent. 0249 * @OVS_VPORT_ATTR_STATS: A &struct ovs_vport_stats giving statistics for 0250 * packets sent or received through the vport. 0251 * 0252 * These attributes follow the &struct ovs_header within the Generic Netlink 0253 * payload for %OVS_VPORT_* commands. 0254 * 0255 * For %OVS_VPORT_CMD_NEW requests, the %OVS_VPORT_ATTR_TYPE and 0256 * %OVS_VPORT_ATTR_NAME attributes are required. %OVS_VPORT_ATTR_PORT_NO is 0257 * optional; if not specified a free port number is automatically selected. 0258 * Whether %OVS_VPORT_ATTR_OPTIONS is required or optional depends on the type 0259 * of vport. 0260 * 0261 * For other requests, if %OVS_VPORT_ATTR_NAME is specified then it is used to 0262 * look up the vport to operate on; otherwise dp_idx from the &struct 0263 * ovs_header plus %OVS_VPORT_ATTR_PORT_NO determine the vport. 0264 */ 0265 enum ovs_vport_attr { 0266 OVS_VPORT_ATTR_UNSPEC, 0267 OVS_VPORT_ATTR_PORT_NO, /* u32 port number within datapath */ 0268 OVS_VPORT_ATTR_TYPE, /* u32 OVS_VPORT_TYPE_* constant. */ 0269 OVS_VPORT_ATTR_NAME, /* string name, up to IFNAMSIZ bytes long */ 0270 OVS_VPORT_ATTR_OPTIONS, /* nested attributes, varies by vport type */ 0271 OVS_VPORT_ATTR_UPCALL_PID, /* array of u32 Netlink socket PIDs for */ 0272 /* receiving upcalls */ 0273 OVS_VPORT_ATTR_STATS, /* struct ovs_vport_stats */ 0274 OVS_VPORT_ATTR_PAD, 0275 OVS_VPORT_ATTR_IFINDEX, 0276 OVS_VPORT_ATTR_NETNSID, 0277 __OVS_VPORT_ATTR_MAX 0278 }; 0279 0280 #define OVS_VPORT_ATTR_MAX (__OVS_VPORT_ATTR_MAX - 1) 0281 0282 enum { 0283 OVS_VXLAN_EXT_UNSPEC, 0284 OVS_VXLAN_EXT_GBP, /* Flag or __u32 */ 0285 __OVS_VXLAN_EXT_MAX, 0286 }; 0287 0288 #define OVS_VXLAN_EXT_MAX (__OVS_VXLAN_EXT_MAX - 1) 0289 0290 0291 /* OVS_VPORT_ATTR_OPTIONS attributes for tunnels. 0292 */ 0293 enum { 0294 OVS_TUNNEL_ATTR_UNSPEC, 0295 OVS_TUNNEL_ATTR_DST_PORT, /* 16-bit UDP port, used by L4 tunnels. */ 0296 OVS_TUNNEL_ATTR_EXTENSION, 0297 __OVS_TUNNEL_ATTR_MAX 0298 }; 0299 0300 #define OVS_TUNNEL_ATTR_MAX (__OVS_TUNNEL_ATTR_MAX - 1) 0301 0302 /* Flows. */ 0303 0304 #define OVS_FLOW_FAMILY "ovs_flow" 0305 #define OVS_FLOW_MCGROUP "ovs_flow" 0306 #define OVS_FLOW_VERSION 0x1 0307 0308 enum ovs_flow_cmd { 0309 OVS_FLOW_CMD_UNSPEC, 0310 OVS_FLOW_CMD_NEW, 0311 OVS_FLOW_CMD_DEL, 0312 OVS_FLOW_CMD_GET, 0313 OVS_FLOW_CMD_SET 0314 }; 0315 0316 struct ovs_flow_stats { 0317 __u64 n_packets; /* Number of matched packets. */ 0318 __u64 n_bytes; /* Number of matched bytes. */ 0319 }; 0320 0321 enum ovs_key_attr { 0322 OVS_KEY_ATTR_UNSPEC, 0323 OVS_KEY_ATTR_ENCAP, /* Nested set of encapsulated attributes. */ 0324 OVS_KEY_ATTR_PRIORITY, /* u32 skb->priority */ 0325 OVS_KEY_ATTR_IN_PORT, /* u32 OVS dp port number */ 0326 OVS_KEY_ATTR_ETHERNET, /* struct ovs_key_ethernet */ 0327 OVS_KEY_ATTR_VLAN, /* be16 VLAN TCI */ 0328 OVS_KEY_ATTR_ETHERTYPE, /* be16 Ethernet type */ 0329 OVS_KEY_ATTR_IPV4, /* struct ovs_key_ipv4 */ 0330 OVS_KEY_ATTR_IPV6, /* struct ovs_key_ipv6 */ 0331 OVS_KEY_ATTR_TCP, /* struct ovs_key_tcp */ 0332 OVS_KEY_ATTR_UDP, /* struct ovs_key_udp */ 0333 OVS_KEY_ATTR_ICMP, /* struct ovs_key_icmp */ 0334 OVS_KEY_ATTR_ICMPV6, /* struct ovs_key_icmpv6 */ 0335 OVS_KEY_ATTR_ARP, /* struct ovs_key_arp */ 0336 OVS_KEY_ATTR_ND, /* struct ovs_key_nd */ 0337 OVS_KEY_ATTR_SKB_MARK, /* u32 skb mark */ 0338 OVS_KEY_ATTR_TUNNEL, /* Nested set of ovs_tunnel attributes */ 0339 OVS_KEY_ATTR_SCTP, /* struct ovs_key_sctp */ 0340 OVS_KEY_ATTR_TCP_FLAGS, /* be16 TCP flags. */ 0341 OVS_KEY_ATTR_DP_HASH, /* u32 hash value. Value 0 indicates the hash 0342 is not computed by the datapath. */ 0343 OVS_KEY_ATTR_RECIRC_ID, /* u32 recirc id */ 0344 OVS_KEY_ATTR_MPLS, /* array of struct ovs_key_mpls. 0345 * The implementation may restrict 0346 * the accepted length of the array. */ 0347 OVS_KEY_ATTR_CT_STATE, /* u32 bitmask of OVS_CS_F_* */ 0348 OVS_KEY_ATTR_CT_ZONE, /* u16 connection tracking zone. */ 0349 OVS_KEY_ATTR_CT_MARK, /* u32 connection tracking mark */ 0350 OVS_KEY_ATTR_CT_LABELS, /* 16-octet connection tracking label */ 0351 OVS_KEY_ATTR_CT_ORIG_TUPLE_IPV4, /* struct ovs_key_ct_tuple_ipv4 */ 0352 OVS_KEY_ATTR_CT_ORIG_TUPLE_IPV6, /* struct ovs_key_ct_tuple_ipv6 */ 0353 OVS_KEY_ATTR_NSH, /* Nested set of ovs_nsh_key_* */ 0354 0355 /* User space decided to squat on types 29 and 30. They are defined 0356 * below, but should not be sent to the kernel. 0357 * 0358 * WARNING: No new types should be added unless they are defined 0359 * for both kernel and user space (no 'ifdef's). It's hard 0360 * to keep compatibility otherwise. 0361 */ 0362 OVS_KEY_ATTR_PACKET_TYPE, /* be32 packet type */ 0363 OVS_KEY_ATTR_ND_EXTENSIONS, /* IPv6 Neighbor Discovery extensions */ 0364 0365 OVS_KEY_ATTR_TUNNEL_INFO, /* struct ip_tunnel_info. 0366 * For in-kernel use only. 0367 */ 0368 OVS_KEY_ATTR_IPV6_EXTHDRS, /* struct ovs_key_ipv6_exthdr */ 0369 __OVS_KEY_ATTR_MAX 0370 }; 0371 0372 #define OVS_KEY_ATTR_MAX (__OVS_KEY_ATTR_MAX - 1) 0373 0374 enum ovs_tunnel_key_attr { 0375 /* OVS_TUNNEL_KEY_ATTR_NONE, standard nl API requires this attribute! */ 0376 OVS_TUNNEL_KEY_ATTR_ID, /* be64 Tunnel ID */ 0377 OVS_TUNNEL_KEY_ATTR_IPV4_SRC, /* be32 src IP address. */ 0378 OVS_TUNNEL_KEY_ATTR_IPV4_DST, /* be32 dst IP address. */ 0379 OVS_TUNNEL_KEY_ATTR_TOS, /* u8 Tunnel IP ToS. */ 0380 OVS_TUNNEL_KEY_ATTR_TTL, /* u8 Tunnel IP TTL. */ 0381 OVS_TUNNEL_KEY_ATTR_DONT_FRAGMENT, /* No argument, set DF. */ 0382 OVS_TUNNEL_KEY_ATTR_CSUM, /* No argument. CSUM packet. */ 0383 OVS_TUNNEL_KEY_ATTR_OAM, /* No argument. OAM frame. */ 0384 OVS_TUNNEL_KEY_ATTR_GENEVE_OPTS, /* Array of Geneve options. */ 0385 OVS_TUNNEL_KEY_ATTR_TP_SRC, /* be16 src Transport Port. */ 0386 OVS_TUNNEL_KEY_ATTR_TP_DST, /* be16 dst Transport Port. */ 0387 OVS_TUNNEL_KEY_ATTR_VXLAN_OPTS, /* Nested OVS_VXLAN_EXT_* */ 0388 OVS_TUNNEL_KEY_ATTR_IPV6_SRC, /* struct in6_addr src IPv6 address. */ 0389 OVS_TUNNEL_KEY_ATTR_IPV6_DST, /* struct in6_addr dst IPv6 address. */ 0390 OVS_TUNNEL_KEY_ATTR_PAD, 0391 OVS_TUNNEL_KEY_ATTR_ERSPAN_OPTS, /* struct erspan_metadata */ 0392 OVS_TUNNEL_KEY_ATTR_IPV4_INFO_BRIDGE, /* No argument. IPV4_INFO_BRIDGE mode.*/ 0393 __OVS_TUNNEL_KEY_ATTR_MAX 0394 }; 0395 0396 #define OVS_TUNNEL_KEY_ATTR_MAX (__OVS_TUNNEL_KEY_ATTR_MAX - 1) 0397 0398 /** 0399 * enum ovs_frag_type - IPv4 and IPv6 fragment type 0400 * @OVS_FRAG_TYPE_NONE: Packet is not a fragment. 0401 * @OVS_FRAG_TYPE_FIRST: Packet is a fragment with offset 0. 0402 * @OVS_FRAG_TYPE_LATER: Packet is a fragment with nonzero offset. 0403 * 0404 * Used as the @ipv4_frag in &struct ovs_key_ipv4 and as @ipv6_frag &struct 0405 * ovs_key_ipv6. 0406 */ 0407 enum ovs_frag_type { 0408 OVS_FRAG_TYPE_NONE, 0409 OVS_FRAG_TYPE_FIRST, 0410 OVS_FRAG_TYPE_LATER, 0411 __OVS_FRAG_TYPE_MAX 0412 }; 0413 0414 #define OVS_FRAG_TYPE_MAX (__OVS_FRAG_TYPE_MAX - 1) 0415 0416 struct ovs_key_ethernet { 0417 __u8 eth_src[ETH_ALEN]; 0418 __u8 eth_dst[ETH_ALEN]; 0419 }; 0420 0421 struct ovs_key_mpls { 0422 __be32 mpls_lse; 0423 }; 0424 0425 struct ovs_key_ipv4 { 0426 __be32 ipv4_src; 0427 __be32 ipv4_dst; 0428 __u8 ipv4_proto; 0429 __u8 ipv4_tos; 0430 __u8 ipv4_ttl; 0431 __u8 ipv4_frag; /* One of OVS_FRAG_TYPE_*. */ 0432 }; 0433 0434 struct ovs_key_ipv6 { 0435 __be32 ipv6_src[4]; 0436 __be32 ipv6_dst[4]; 0437 __be32 ipv6_label; /* 20-bits in least-significant bits. */ 0438 __u8 ipv6_proto; 0439 __u8 ipv6_tclass; 0440 __u8 ipv6_hlimit; 0441 __u8 ipv6_frag; /* One of OVS_FRAG_TYPE_*. */ 0442 }; 0443 0444 /* separate structure to support backward compatibility with older user space */ 0445 struct ovs_key_ipv6_exthdrs { 0446 __u16 hdrs; 0447 }; 0448 0449 struct ovs_key_tcp { 0450 __be16 tcp_src; 0451 __be16 tcp_dst; 0452 }; 0453 0454 struct ovs_key_udp { 0455 __be16 udp_src; 0456 __be16 udp_dst; 0457 }; 0458 0459 struct ovs_key_sctp { 0460 __be16 sctp_src; 0461 __be16 sctp_dst; 0462 }; 0463 0464 struct ovs_key_icmp { 0465 __u8 icmp_type; 0466 __u8 icmp_code; 0467 }; 0468 0469 struct ovs_key_icmpv6 { 0470 __u8 icmpv6_type; 0471 __u8 icmpv6_code; 0472 }; 0473 0474 struct ovs_key_arp { 0475 __be32 arp_sip; 0476 __be32 arp_tip; 0477 __be16 arp_op; 0478 __u8 arp_sha[ETH_ALEN]; 0479 __u8 arp_tha[ETH_ALEN]; 0480 }; 0481 0482 struct ovs_key_nd { 0483 __be32 nd_target[4]; 0484 __u8 nd_sll[ETH_ALEN]; 0485 __u8 nd_tll[ETH_ALEN]; 0486 }; 0487 0488 #define OVS_CT_LABELS_LEN_32 4 0489 #define OVS_CT_LABELS_LEN (OVS_CT_LABELS_LEN_32 * sizeof(__u32)) 0490 struct ovs_key_ct_labels { 0491 union { 0492 __u8 ct_labels[OVS_CT_LABELS_LEN]; 0493 __u32 ct_labels_32[OVS_CT_LABELS_LEN_32]; 0494 }; 0495 }; 0496 0497 /* OVS_KEY_ATTR_CT_STATE flags */ 0498 #define OVS_CS_F_NEW 0x01 /* Beginning of a new connection. */ 0499 #define OVS_CS_F_ESTABLISHED 0x02 /* Part of an existing connection. */ 0500 #define OVS_CS_F_RELATED 0x04 /* Related to an established 0501 * connection. */ 0502 #define OVS_CS_F_REPLY_DIR 0x08 /* Flow is in the reply direction. */ 0503 #define OVS_CS_F_INVALID 0x10 /* Could not track connection. */ 0504 #define OVS_CS_F_TRACKED 0x20 /* Conntrack has occurred. */ 0505 #define OVS_CS_F_SRC_NAT 0x40 /* Packet's source address/port was 0506 * mangled by NAT. 0507 */ 0508 #define OVS_CS_F_DST_NAT 0x80 /* Packet's destination address/port 0509 * was mangled by NAT. 0510 */ 0511 0512 #define OVS_CS_F_NAT_MASK (OVS_CS_F_SRC_NAT | OVS_CS_F_DST_NAT) 0513 0514 struct ovs_key_ct_tuple_ipv4 { 0515 __be32 ipv4_src; 0516 __be32 ipv4_dst; 0517 __be16 src_port; 0518 __be16 dst_port; 0519 __u8 ipv4_proto; 0520 }; 0521 0522 struct ovs_key_ct_tuple_ipv6 { 0523 __be32 ipv6_src[4]; 0524 __be32 ipv6_dst[4]; 0525 __be16 src_port; 0526 __be16 dst_port; 0527 __u8 ipv6_proto; 0528 }; 0529 0530 enum ovs_nsh_key_attr { 0531 OVS_NSH_KEY_ATTR_UNSPEC, 0532 OVS_NSH_KEY_ATTR_BASE, /* struct ovs_nsh_key_base. */ 0533 OVS_NSH_KEY_ATTR_MD1, /* struct ovs_nsh_key_md1. */ 0534 OVS_NSH_KEY_ATTR_MD2, /* variable-length octets for MD type 2. */ 0535 __OVS_NSH_KEY_ATTR_MAX 0536 }; 0537 0538 #define OVS_NSH_KEY_ATTR_MAX (__OVS_NSH_KEY_ATTR_MAX - 1) 0539 0540 struct ovs_nsh_key_base { 0541 __u8 flags; 0542 __u8 ttl; 0543 __u8 mdtype; 0544 __u8 np; 0545 __be32 path_hdr; 0546 }; 0547 0548 #define NSH_MD1_CONTEXT_SIZE 4 0549 0550 struct ovs_nsh_key_md1 { 0551 __be32 context[NSH_MD1_CONTEXT_SIZE]; 0552 }; 0553 0554 /** 0555 * enum ovs_flow_attr - attributes for %OVS_FLOW_* commands. 0556 * @OVS_FLOW_ATTR_KEY: Nested %OVS_KEY_ATTR_* attributes specifying the flow 0557 * key. Always present in notifications. Required for all requests (except 0558 * dumps). 0559 * @OVS_FLOW_ATTR_ACTIONS: Nested %OVS_ACTION_ATTR_* attributes specifying 0560 * the actions to take for packets that match the key. Always present in 0561 * notifications. Required for %OVS_FLOW_CMD_NEW requests, optional for 0562 * %OVS_FLOW_CMD_SET requests. An %OVS_FLOW_CMD_SET without 0563 * %OVS_FLOW_ATTR_ACTIONS will not modify the actions. To clear the actions, 0564 * an %OVS_FLOW_ATTR_ACTIONS without any nested attributes must be given. 0565 * @OVS_FLOW_ATTR_STATS: &struct ovs_flow_stats giving statistics for this 0566 * flow. Present in notifications if the stats would be nonzero. Ignored in 0567 * requests. 0568 * @OVS_FLOW_ATTR_TCP_FLAGS: An 8-bit value giving the OR'd value of all of the 0569 * TCP flags seen on packets in this flow. Only present in notifications for 0570 * TCP flows, and only if it would be nonzero. Ignored in requests. 0571 * @OVS_FLOW_ATTR_USED: A 64-bit integer giving the time, in milliseconds on 0572 * the system monotonic clock, at which a packet was last processed for this 0573 * flow. Only present in notifications if a packet has been processed for this 0574 * flow. Ignored in requests. 0575 * @OVS_FLOW_ATTR_CLEAR: If present in a %OVS_FLOW_CMD_SET request, clears the 0576 * last-used time, accumulated TCP flags, and statistics for this flow. 0577 * Otherwise ignored in requests. Never present in notifications. 0578 * @OVS_FLOW_ATTR_MASK: Nested %OVS_KEY_ATTR_* attributes specifying the 0579 * mask bits for wildcarded flow match. Mask bit value '1' specifies exact 0580 * match with corresponding flow key bit, while mask bit value '0' specifies 0581 * a wildcarded match. Omitting attribute is treated as wildcarding all 0582 * corresponding fields. Optional for all requests. If not present, 0583 * all flow key bits are exact match bits. 0584 * @OVS_FLOW_ATTR_UFID: A value between 1-16 octets specifying a unique 0585 * identifier for the flow. Causes the flow to be indexed by this value rather 0586 * than the value of the %OVS_FLOW_ATTR_KEY attribute. Optional for all 0587 * requests. Present in notifications if the flow was created with this 0588 * attribute. 0589 * @OVS_FLOW_ATTR_UFID_FLAGS: A 32-bit value of OR'd %OVS_UFID_F_* 0590 * flags that provide alternative semantics for flow installation and 0591 * retrieval. Optional for all requests. 0592 * 0593 * These attributes follow the &struct ovs_header within the Generic Netlink 0594 * payload for %OVS_FLOW_* commands. 0595 */ 0596 enum ovs_flow_attr { 0597 OVS_FLOW_ATTR_UNSPEC, 0598 OVS_FLOW_ATTR_KEY, /* Sequence of OVS_KEY_ATTR_* attributes. */ 0599 OVS_FLOW_ATTR_ACTIONS, /* Nested OVS_ACTION_ATTR_* attributes. */ 0600 OVS_FLOW_ATTR_STATS, /* struct ovs_flow_stats. */ 0601 OVS_FLOW_ATTR_TCP_FLAGS, /* 8-bit OR'd TCP flags. */ 0602 OVS_FLOW_ATTR_USED, /* u64 msecs last used in monotonic time. */ 0603 OVS_FLOW_ATTR_CLEAR, /* Flag to clear stats, tcp_flags, used. */ 0604 OVS_FLOW_ATTR_MASK, /* Sequence of OVS_KEY_ATTR_* attributes. */ 0605 OVS_FLOW_ATTR_PROBE, /* Flow operation is a feature probe, error 0606 * logging should be suppressed. */ 0607 OVS_FLOW_ATTR_UFID, /* Variable length unique flow identifier. */ 0608 OVS_FLOW_ATTR_UFID_FLAGS,/* u32 of OVS_UFID_F_*. */ 0609 OVS_FLOW_ATTR_PAD, 0610 __OVS_FLOW_ATTR_MAX 0611 }; 0612 0613 #define OVS_FLOW_ATTR_MAX (__OVS_FLOW_ATTR_MAX - 1) 0614 0615 /** 0616 * Omit attributes for notifications. 0617 * 0618 * If a datapath request contains an %OVS_UFID_F_OMIT_* flag, then the datapath 0619 * may omit the corresponding %OVS_FLOW_ATTR_* from the response. 0620 */ 0621 #define OVS_UFID_F_OMIT_KEY (1 << 0) 0622 #define OVS_UFID_F_OMIT_MASK (1 << 1) 0623 #define OVS_UFID_F_OMIT_ACTIONS (1 << 2) 0624 0625 /** 0626 * enum ovs_sample_attr - Attributes for %OVS_ACTION_ATTR_SAMPLE action. 0627 * @OVS_SAMPLE_ATTR_PROBABILITY: 32-bit fraction of packets to sample with 0628 * @OVS_ACTION_ATTR_SAMPLE. A value of 0 samples no packets, a value of 0629 * %UINT32_MAX samples all packets and intermediate values sample intermediate 0630 * fractions of packets. 0631 * @OVS_SAMPLE_ATTR_ACTIONS: Set of actions to execute in sampling event. 0632 * Actions are passed as nested attributes. 0633 * 0634 * Executes the specified actions with the given probability on a per-packet 0635 * basis. 0636 */ 0637 enum ovs_sample_attr { 0638 OVS_SAMPLE_ATTR_UNSPEC, 0639 OVS_SAMPLE_ATTR_PROBABILITY, /* u32 number */ 0640 OVS_SAMPLE_ATTR_ACTIONS, /* Nested OVS_ACTION_ATTR_* attributes. */ 0641 __OVS_SAMPLE_ATTR_MAX, 0642 0643 #ifdef __KERNEL__ 0644 OVS_SAMPLE_ATTR_ARG /* struct sample_arg */ 0645 #endif 0646 }; 0647 0648 #define OVS_SAMPLE_ATTR_MAX (__OVS_SAMPLE_ATTR_MAX - 1) 0649 0650 #ifdef __KERNEL__ 0651 struct sample_arg { 0652 bool exec; /* When true, actions in sample will not 0653 * change flow keys. False otherwise. 0654 */ 0655 u32 probability; /* Same value as 0656 * 'OVS_SAMPLE_ATTR_PROBABILITY'. 0657 */ 0658 }; 0659 #endif 0660 0661 /** 0662 * enum ovs_userspace_attr - Attributes for %OVS_ACTION_ATTR_USERSPACE action. 0663 * @OVS_USERSPACE_ATTR_PID: u32 Netlink PID to which the %OVS_PACKET_CMD_ACTION 0664 * message should be sent. Required. 0665 * @OVS_USERSPACE_ATTR_USERDATA: If present, its variable-length argument is 0666 * copied to the %OVS_PACKET_CMD_ACTION message as %OVS_PACKET_ATTR_USERDATA. 0667 * @OVS_USERSPACE_ATTR_EGRESS_TUN_PORT: If present, u32 output port to get 0668 * tunnel info. 0669 * @OVS_USERSPACE_ATTR_ACTIONS: If present, send actions with upcall. 0670 */ 0671 enum ovs_userspace_attr { 0672 OVS_USERSPACE_ATTR_UNSPEC, 0673 OVS_USERSPACE_ATTR_PID, /* u32 Netlink PID to receive upcalls. */ 0674 OVS_USERSPACE_ATTR_USERDATA, /* Optional user-specified cookie. */ 0675 OVS_USERSPACE_ATTR_EGRESS_TUN_PORT, /* Optional, u32 output port 0676 * to get tunnel info. */ 0677 OVS_USERSPACE_ATTR_ACTIONS, /* Optional flag to get actions. */ 0678 __OVS_USERSPACE_ATTR_MAX 0679 }; 0680 0681 #define OVS_USERSPACE_ATTR_MAX (__OVS_USERSPACE_ATTR_MAX - 1) 0682 0683 struct ovs_action_trunc { 0684 __u32 max_len; /* Max packet size in bytes. */ 0685 }; 0686 0687 /** 0688 * struct ovs_action_push_mpls - %OVS_ACTION_ATTR_PUSH_MPLS action argument. 0689 * @mpls_lse: MPLS label stack entry to push. 0690 * @mpls_ethertype: Ethertype to set in the encapsulating ethernet frame. 0691 * 0692 * The only values @mpls_ethertype should ever be given are %ETH_P_MPLS_UC and 0693 * %ETH_P_MPLS_MC, indicating MPLS unicast or multicast. Other are rejected. 0694 */ 0695 struct ovs_action_push_mpls { 0696 __be32 mpls_lse; 0697 __be16 mpls_ethertype; /* Either %ETH_P_MPLS_UC or %ETH_P_MPLS_MC */ 0698 }; 0699 0700 /** 0701 * struct ovs_action_add_mpls - %OVS_ACTION_ATTR_ADD_MPLS action 0702 * argument. 0703 * @mpls_lse: MPLS label stack entry to push. 0704 * @mpls_ethertype: Ethertype to set in the encapsulating ethernet frame. 0705 * @tun_flags: MPLS tunnel attributes. 0706 * 0707 * The only values @mpls_ethertype should ever be given are %ETH_P_MPLS_UC and 0708 * %ETH_P_MPLS_MC, indicating MPLS unicast or multicast. Other are rejected. 0709 */ 0710 struct ovs_action_add_mpls { 0711 __be32 mpls_lse; 0712 __be16 mpls_ethertype; /* Either %ETH_P_MPLS_UC or %ETH_P_MPLS_MC */ 0713 __u16 tun_flags; 0714 }; 0715 0716 #define OVS_MPLS_L3_TUNNEL_FLAG_MASK (1 << 0) /* Flag to specify the place of 0717 * insertion of MPLS header. 0718 * When false, the MPLS header 0719 * will be inserted at the start 0720 * of the packet. 0721 * When true, the MPLS header 0722 * will be inserted at the start 0723 * of the l3 header. 0724 */ 0725 0726 /** 0727 * struct ovs_action_push_vlan - %OVS_ACTION_ATTR_PUSH_VLAN action argument. 0728 * @vlan_tpid: Tag protocol identifier (TPID) to push. 0729 * @vlan_tci: Tag control identifier (TCI) to push. The CFI bit must be set 0730 * (but it will not be set in the 802.1Q header that is pushed). 0731 * 0732 * The @vlan_tpid value is typically %ETH_P_8021Q or %ETH_P_8021AD. 0733 * The only acceptable TPID values are those that the kernel module also parses 0734 * as 802.1Q or 802.1AD headers, to prevent %OVS_ACTION_ATTR_PUSH_VLAN followed 0735 * by %OVS_ACTION_ATTR_POP_VLAN from having surprising results. 0736 */ 0737 struct ovs_action_push_vlan { 0738 __be16 vlan_tpid; /* 802.1Q or 802.1ad TPID. */ 0739 __be16 vlan_tci; /* 802.1Q TCI (VLAN ID and priority). */ 0740 }; 0741 0742 /* Data path hash algorithm for computing Datapath hash. 0743 * 0744 * The algorithm type only specifies the fields in a flow 0745 * will be used as part of the hash. Each datapath is free 0746 * to use its own hash algorithm. The hash value will be 0747 * opaque to the user space daemon. 0748 */ 0749 enum ovs_hash_alg { 0750 OVS_HASH_ALG_L4, 0751 }; 0752 0753 /* 0754 * struct ovs_action_hash - %OVS_ACTION_ATTR_HASH action argument. 0755 * @hash_alg: Algorithm used to compute hash prior to recirculation. 0756 * @hash_basis: basis used for computing hash. 0757 */ 0758 struct ovs_action_hash { 0759 __u32 hash_alg; /* One of ovs_hash_alg. */ 0760 __u32 hash_basis; 0761 }; 0762 0763 /** 0764 * enum ovs_ct_attr - Attributes for %OVS_ACTION_ATTR_CT action. 0765 * @OVS_CT_ATTR_COMMIT: If present, commits the connection to the conntrack 0766 * table. This allows future packets for the same connection to be identified 0767 * as 'established' or 'related'. The flow key for the current packet will 0768 * retain the pre-commit connection state. 0769 * @OVS_CT_ATTR_ZONE: u16 connection tracking zone. 0770 * @OVS_CT_ATTR_MARK: u32 value followed by u32 mask. For each bit set in the 0771 * mask, the corresponding bit in the value is copied to the connection 0772 * tracking mark field in the connection. 0773 * @OVS_CT_ATTR_LABELS: %OVS_CT_LABELS_LEN value followed by %OVS_CT_LABELS_LEN 0774 * mask. For each bit set in the mask, the corresponding bit in the value is 0775 * copied to the connection tracking label field in the connection. 0776 * @OVS_CT_ATTR_HELPER: variable length string defining conntrack ALG. 0777 * @OVS_CT_ATTR_NAT: Nested OVS_NAT_ATTR_* for performing L3 network address 0778 * translation (NAT) on the packet. 0779 * @OVS_CT_ATTR_FORCE_COMMIT: Like %OVS_CT_ATTR_COMMIT, but instead of doing 0780 * nothing if the connection is already committed will check that the current 0781 * packet is in conntrack entry's original direction. If directionality does 0782 * not match, will delete the existing conntrack entry and commit a new one. 0783 * @OVS_CT_ATTR_EVENTMASK: Mask of bits indicating which conntrack event types 0784 * (enum ip_conntrack_events IPCT_*) should be reported. For any bit set to 0785 * zero, the corresponding event type is not generated. Default behavior 0786 * depends on system configuration, but typically all event types are 0787 * generated, hence listening on NFNLGRP_CONNTRACK_UPDATE events may get a lot 0788 * of events. Explicitly passing this attribute allows limiting the updates 0789 * received to the events of interest. The bit 1 << IPCT_NEW, 1 << 0790 * IPCT_RELATED, and 1 << IPCT_DESTROY must be set to ones for those events to 0791 * be received on NFNLGRP_CONNTRACK_NEW and NFNLGRP_CONNTRACK_DESTROY groups, 0792 * respectively. Remaining bits control the changes for which an event is 0793 * delivered on the NFNLGRP_CONNTRACK_UPDATE group. 0794 * @OVS_CT_ATTR_TIMEOUT: Variable length string defining conntrack timeout. 0795 */ 0796 enum ovs_ct_attr { 0797 OVS_CT_ATTR_UNSPEC, 0798 OVS_CT_ATTR_COMMIT, /* No argument, commits connection. */ 0799 OVS_CT_ATTR_ZONE, /* u16 zone id. */ 0800 OVS_CT_ATTR_MARK, /* mark to associate with this connection. */ 0801 OVS_CT_ATTR_LABELS, /* labels to associate with this connection. */ 0802 OVS_CT_ATTR_HELPER, /* netlink helper to assist detection of 0803 related connections. */ 0804 OVS_CT_ATTR_NAT, /* Nested OVS_NAT_ATTR_* */ 0805 OVS_CT_ATTR_FORCE_COMMIT, /* No argument */ 0806 OVS_CT_ATTR_EVENTMASK, /* u32 mask of IPCT_* events. */ 0807 OVS_CT_ATTR_TIMEOUT, /* Associate timeout with this connection for 0808 * fine-grain timeout tuning. */ 0809 __OVS_CT_ATTR_MAX 0810 }; 0811 0812 #define OVS_CT_ATTR_MAX (__OVS_CT_ATTR_MAX - 1) 0813 0814 /** 0815 * enum ovs_nat_attr - Attributes for %OVS_CT_ATTR_NAT. 0816 * 0817 * @OVS_NAT_ATTR_SRC: Flag for Source NAT (mangle source address/port). 0818 * @OVS_NAT_ATTR_DST: Flag for Destination NAT (mangle destination 0819 * address/port). Only one of (@OVS_NAT_ATTR_SRC, @OVS_NAT_ATTR_DST) may be 0820 * specified. Effective only for packets for ct_state NEW connections. 0821 * Packets of committed connections are mangled by the NAT action according to 0822 * the committed NAT type regardless of the flags specified. As a corollary, a 0823 * NAT action without a NAT type flag will only mangle packets of committed 0824 * connections. The following NAT attributes only apply for NEW 0825 * (non-committed) connections, and they may be included only when the CT 0826 * action has the @OVS_CT_ATTR_COMMIT flag and either @OVS_NAT_ATTR_SRC or 0827 * @OVS_NAT_ATTR_DST is also included. 0828 * @OVS_NAT_ATTR_IP_MIN: struct in_addr or struct in6_addr 0829 * @OVS_NAT_ATTR_IP_MAX: struct in_addr or struct in6_addr 0830 * @OVS_NAT_ATTR_PROTO_MIN: u16 L4 protocol specific lower boundary (port) 0831 * @OVS_NAT_ATTR_PROTO_MAX: u16 L4 protocol specific upper boundary (port) 0832 * @OVS_NAT_ATTR_PERSISTENT: Flag for persistent IP mapping across reboots 0833 * @OVS_NAT_ATTR_PROTO_HASH: Flag for pseudo random L4 port mapping (MD5) 0834 * @OVS_NAT_ATTR_PROTO_RANDOM: Flag for fully randomized L4 port mapping 0835 */ 0836 enum ovs_nat_attr { 0837 OVS_NAT_ATTR_UNSPEC, 0838 OVS_NAT_ATTR_SRC, 0839 OVS_NAT_ATTR_DST, 0840 OVS_NAT_ATTR_IP_MIN, 0841 OVS_NAT_ATTR_IP_MAX, 0842 OVS_NAT_ATTR_PROTO_MIN, 0843 OVS_NAT_ATTR_PROTO_MAX, 0844 OVS_NAT_ATTR_PERSISTENT, 0845 OVS_NAT_ATTR_PROTO_HASH, 0846 OVS_NAT_ATTR_PROTO_RANDOM, 0847 __OVS_NAT_ATTR_MAX, 0848 }; 0849 0850 #define OVS_NAT_ATTR_MAX (__OVS_NAT_ATTR_MAX - 1) 0851 0852 /* 0853 * struct ovs_action_push_eth - %OVS_ACTION_ATTR_PUSH_ETH action argument. 0854 * @addresses: Source and destination MAC addresses. 0855 * @eth_type: Ethernet type 0856 */ 0857 struct ovs_action_push_eth { 0858 struct ovs_key_ethernet addresses; 0859 }; 0860 0861 /* 0862 * enum ovs_check_pkt_len_attr - Attributes for %OVS_ACTION_ATTR_CHECK_PKT_LEN. 0863 * 0864 * @OVS_CHECK_PKT_LEN_ATTR_PKT_LEN: u16 Packet length to check for. 0865 * @OVS_CHECK_PKT_LEN_ATTR_ACTIONS_IF_GREATER: Nested OVS_ACTION_ATTR_* 0866 * actions to apply if the packer length is greater than the specified 0867 * length in the attr - OVS_CHECK_PKT_LEN_ATTR_PKT_LEN. 0868 * @OVS_CHECK_PKT_LEN_ATTR_ACTIONS_IF_LESS_EQUAL - Nested OVS_ACTION_ATTR_* 0869 * actions to apply if the packer length is lesser or equal to the specified 0870 * length in the attr - OVS_CHECK_PKT_LEN_ATTR_PKT_LEN. 0871 */ 0872 enum ovs_check_pkt_len_attr { 0873 OVS_CHECK_PKT_LEN_ATTR_UNSPEC, 0874 OVS_CHECK_PKT_LEN_ATTR_PKT_LEN, 0875 OVS_CHECK_PKT_LEN_ATTR_ACTIONS_IF_GREATER, 0876 OVS_CHECK_PKT_LEN_ATTR_ACTIONS_IF_LESS_EQUAL, 0877 __OVS_CHECK_PKT_LEN_ATTR_MAX, 0878 0879 #ifdef __KERNEL__ 0880 OVS_CHECK_PKT_LEN_ATTR_ARG /* struct check_pkt_len_arg */ 0881 #endif 0882 }; 0883 0884 #define OVS_CHECK_PKT_LEN_ATTR_MAX (__OVS_CHECK_PKT_LEN_ATTR_MAX - 1) 0885 0886 #ifdef __KERNEL__ 0887 struct check_pkt_len_arg { 0888 u16 pkt_len; /* Same value as OVS_CHECK_PKT_LEN_ATTR_PKT_LEN'. */ 0889 bool exec_for_greater; /* When true, actions in IF_GREATER will 0890 * not change flow keys. False otherwise. 0891 */ 0892 bool exec_for_lesser_equal; /* When true, actions in IF_LESS_EQUAL 0893 * will not change flow keys. False 0894 * otherwise. 0895 */ 0896 }; 0897 #endif 0898 0899 /** 0900 * enum ovs_action_attr - Action types. 0901 * 0902 * @OVS_ACTION_ATTR_OUTPUT: Output packet to port. 0903 * @OVS_ACTION_ATTR_TRUNC: Output packet to port with truncated packet size. 0904 * @OVS_ACTION_ATTR_USERSPACE: Send packet to userspace according to nested 0905 * %OVS_USERSPACE_ATTR_* attributes. 0906 * @OVS_ACTION_ATTR_SET: Replaces the contents of an existing header. The 0907 * single nested %OVS_KEY_ATTR_* attribute specifies a header to modify and its 0908 * value. 0909 * @OVS_ACTION_ATTR_SET_MASKED: Replaces the contents of an existing header. A 0910 * nested %OVS_KEY_ATTR_* attribute specifies a header to modify, its value, 0911 * and a mask. For every bit set in the mask, the corresponding bit value 0912 * is copied from the value to the packet header field, rest of the bits are 0913 * left unchanged. The non-masked value bits must be passed in as zeroes. 0914 * Masking is not supported for the %OVS_KEY_ATTR_TUNNEL attribute. 0915 * @OVS_ACTION_ATTR_PUSH_VLAN: Push a new outermost 802.1Q or 802.1ad header 0916 * onto the packet. 0917 * @OVS_ACTION_ATTR_POP_VLAN: Pop the outermost 802.1Q or 802.1ad header 0918 * from the packet. 0919 * @OVS_ACTION_ATTR_SAMPLE: Probabilitically executes actions, as specified in 0920 * the nested %OVS_SAMPLE_ATTR_* attributes. 0921 * @OVS_ACTION_ATTR_PUSH_MPLS: Push a new MPLS label stack entry onto the 0922 * top of the packets MPLS label stack. Set the ethertype of the 0923 * encapsulating frame to either %ETH_P_MPLS_UC or %ETH_P_MPLS_MC to 0924 * indicate the new packet contents. 0925 * @OVS_ACTION_ATTR_POP_MPLS: Pop an MPLS label stack entry off of the 0926 * packet's MPLS label stack. Set the encapsulating frame's ethertype to 0927 * indicate the new packet contents. This could potentially still be 0928 * %ETH_P_MPLS if the resulting MPLS label stack is not empty. If there 0929 * is no MPLS label stack, as determined by ethertype, no action is taken. 0930 * @OVS_ACTION_ATTR_CT: Track the connection. Populate the conntrack-related 0931 * entries in the flow key. 0932 * @OVS_ACTION_ATTR_PUSH_ETH: Push a new outermost Ethernet header onto the 0933 * packet. 0934 * @OVS_ACTION_ATTR_POP_ETH: Pop the outermost Ethernet header off the 0935 * packet. 0936 * @OVS_ACTION_ATTR_CT_CLEAR: Clear conntrack state from the packet. 0937 * @OVS_ACTION_ATTR_PUSH_NSH: push NSH header to the packet. 0938 * @OVS_ACTION_ATTR_POP_NSH: pop the outermost NSH header off the packet. 0939 * @OVS_ACTION_ATTR_METER: Run packet through a meter, which may drop the 0940 * packet, or modify the packet (e.g., change the DSCP field). 0941 * @OVS_ACTION_ATTR_CLONE: make a copy of the packet and execute a list of 0942 * actions without affecting the original packet and key. 0943 * @OVS_ACTION_ATTR_CHECK_PKT_LEN: Check the packet length and execute a set 0944 * of actions if greater than the specified packet length, else execute 0945 * another set of actions. 0946 * @OVS_ACTION_ATTR_ADD_MPLS: Push a new MPLS label stack entry at the 0947 * start of the packet or at the start of the l3 header depending on the value 0948 * of l3 tunnel flag in the tun_flags field of OVS_ACTION_ATTR_ADD_MPLS 0949 * argument. 0950 * 0951 * Only a single header can be set with a single %OVS_ACTION_ATTR_SET. Not all 0952 * fields within a header are modifiable, e.g. the IPv4 protocol and fragment 0953 * type may not be changed. 0954 * 0955 * @OVS_ACTION_ATTR_SET_TO_MASKED: Kernel internal masked set action translated 0956 * from the @OVS_ACTION_ATTR_SET. 0957 */ 0958 0959 enum ovs_action_attr { 0960 OVS_ACTION_ATTR_UNSPEC, 0961 OVS_ACTION_ATTR_OUTPUT, /* u32 port number. */ 0962 OVS_ACTION_ATTR_USERSPACE, /* Nested OVS_USERSPACE_ATTR_*. */ 0963 OVS_ACTION_ATTR_SET, /* One nested OVS_KEY_ATTR_*. */ 0964 OVS_ACTION_ATTR_PUSH_VLAN, /* struct ovs_action_push_vlan. */ 0965 OVS_ACTION_ATTR_POP_VLAN, /* No argument. */ 0966 OVS_ACTION_ATTR_SAMPLE, /* Nested OVS_SAMPLE_ATTR_*. */ 0967 OVS_ACTION_ATTR_RECIRC, /* u32 recirc_id. */ 0968 OVS_ACTION_ATTR_HASH, /* struct ovs_action_hash. */ 0969 OVS_ACTION_ATTR_PUSH_MPLS, /* struct ovs_action_push_mpls. */ 0970 OVS_ACTION_ATTR_POP_MPLS, /* __be16 ethertype. */ 0971 OVS_ACTION_ATTR_SET_MASKED, /* One nested OVS_KEY_ATTR_* including 0972 * data immediately followed by a mask. 0973 * The data must be zero for the unmasked 0974 * bits. */ 0975 OVS_ACTION_ATTR_CT, /* Nested OVS_CT_ATTR_* . */ 0976 OVS_ACTION_ATTR_TRUNC, /* u32 struct ovs_action_trunc. */ 0977 OVS_ACTION_ATTR_PUSH_ETH, /* struct ovs_action_push_eth. */ 0978 OVS_ACTION_ATTR_POP_ETH, /* No argument. */ 0979 OVS_ACTION_ATTR_CT_CLEAR, /* No argument. */ 0980 OVS_ACTION_ATTR_PUSH_NSH, /* Nested OVS_NSH_KEY_ATTR_*. */ 0981 OVS_ACTION_ATTR_POP_NSH, /* No argument. */ 0982 OVS_ACTION_ATTR_METER, /* u32 meter ID. */ 0983 OVS_ACTION_ATTR_CLONE, /* Nested OVS_CLONE_ATTR_*. */ 0984 OVS_ACTION_ATTR_CHECK_PKT_LEN, /* Nested OVS_CHECK_PKT_LEN_ATTR_*. */ 0985 OVS_ACTION_ATTR_ADD_MPLS, /* struct ovs_action_add_mpls. */ 0986 OVS_ACTION_ATTR_DEC_TTL, /* Nested OVS_DEC_TTL_ATTR_*. */ 0987 0988 __OVS_ACTION_ATTR_MAX, /* Nothing past this will be accepted 0989 * from userspace. */ 0990 0991 #ifdef __KERNEL__ 0992 OVS_ACTION_ATTR_SET_TO_MASKED, /* Kernel module internal masked 0993 * set action converted from 0994 * OVS_ACTION_ATTR_SET. */ 0995 #endif 0996 }; 0997 0998 #define OVS_ACTION_ATTR_MAX (__OVS_ACTION_ATTR_MAX - 1) 0999 1000 /* Meters. */ 1001 #define OVS_METER_FAMILY "ovs_meter" 1002 #define OVS_METER_MCGROUP "ovs_meter" 1003 #define OVS_METER_VERSION 0x1 1004 1005 enum ovs_meter_cmd { 1006 OVS_METER_CMD_UNSPEC, 1007 OVS_METER_CMD_FEATURES, /* Get features supported by the datapath. */ 1008 OVS_METER_CMD_SET, /* Add or modify a meter. */ 1009 OVS_METER_CMD_DEL, /* Delete a meter. */ 1010 OVS_METER_CMD_GET /* Get meter stats. */ 1011 }; 1012 1013 enum ovs_meter_attr { 1014 OVS_METER_ATTR_UNSPEC, 1015 OVS_METER_ATTR_ID, /* u32 meter ID within datapath. */ 1016 OVS_METER_ATTR_KBPS, /* No argument. If set, units in kilobits 1017 * per second. Otherwise, units in 1018 * packets per second. 1019 */ 1020 OVS_METER_ATTR_STATS, /* struct ovs_flow_stats for the meter. */ 1021 OVS_METER_ATTR_BANDS, /* Nested attributes for meter bands. */ 1022 OVS_METER_ATTR_USED, /* u64 msecs last used in monotonic time. */ 1023 OVS_METER_ATTR_CLEAR, /* Flag to clear stats, used. */ 1024 OVS_METER_ATTR_MAX_METERS, /* u32 number of meters supported. */ 1025 OVS_METER_ATTR_MAX_BANDS, /* u32 max number of bands per meter. */ 1026 OVS_METER_ATTR_PAD, 1027 __OVS_METER_ATTR_MAX 1028 }; 1029 1030 #define OVS_METER_ATTR_MAX (__OVS_METER_ATTR_MAX - 1) 1031 1032 enum ovs_band_attr { 1033 OVS_BAND_ATTR_UNSPEC, 1034 OVS_BAND_ATTR_TYPE, /* u32 OVS_METER_BAND_TYPE_* constant. */ 1035 OVS_BAND_ATTR_RATE, /* u32 band rate in meter units (see above). */ 1036 OVS_BAND_ATTR_BURST, /* u32 burst size in meter units. */ 1037 OVS_BAND_ATTR_STATS, /* struct ovs_flow_stats for the band. */ 1038 __OVS_BAND_ATTR_MAX 1039 }; 1040 1041 #define OVS_BAND_ATTR_MAX (__OVS_BAND_ATTR_MAX - 1) 1042 1043 enum ovs_meter_band_type { 1044 OVS_METER_BAND_TYPE_UNSPEC, 1045 OVS_METER_BAND_TYPE_DROP, /* Drop exceeding packets. */ 1046 __OVS_METER_BAND_TYPE_MAX 1047 }; 1048 1049 #define OVS_METER_BAND_TYPE_MAX (__OVS_METER_BAND_TYPE_MAX - 1) 1050 1051 /* Conntrack limit */ 1052 #define OVS_CT_LIMIT_FAMILY "ovs_ct_limit" 1053 #define OVS_CT_LIMIT_MCGROUP "ovs_ct_limit" 1054 #define OVS_CT_LIMIT_VERSION 0x1 1055 1056 enum ovs_ct_limit_cmd { 1057 OVS_CT_LIMIT_CMD_UNSPEC, 1058 OVS_CT_LIMIT_CMD_SET, /* Add or modify ct limit. */ 1059 OVS_CT_LIMIT_CMD_DEL, /* Delete ct limit. */ 1060 OVS_CT_LIMIT_CMD_GET /* Get ct limit. */ 1061 }; 1062 1063 enum ovs_ct_limit_attr { 1064 OVS_CT_LIMIT_ATTR_UNSPEC, 1065 OVS_CT_LIMIT_ATTR_ZONE_LIMIT, /* Nested struct ovs_zone_limit. */ 1066 __OVS_CT_LIMIT_ATTR_MAX 1067 }; 1068 1069 #define OVS_CT_LIMIT_ATTR_MAX (__OVS_CT_LIMIT_ATTR_MAX - 1) 1070 1071 #define OVS_ZONE_LIMIT_DEFAULT_ZONE -1 1072 1073 struct ovs_zone_limit { 1074 int zone_id; 1075 __u32 limit; 1076 __u32 count; 1077 }; 1078 1079 enum ovs_dec_ttl_attr { 1080 OVS_DEC_TTL_ATTR_UNSPEC, 1081 OVS_DEC_TTL_ATTR_ACTION, /* Nested struct nlattr */ 1082 __OVS_DEC_TTL_ATTR_MAX 1083 }; 1084 1085 #define OVS_DEC_TTL_ATTR_MAX (__OVS_DEC_TTL_ATTR_MAX - 1) 1086 1087 #endif /* _LINUX_OPENVSWITCH_H */
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.1.0 LXR engine. The LXR team |
![]() ![]() |