122e3880aSThomas Graf 222e3880aSThomas Graf /* 322e3880aSThomas Graf * Copyright (c) 2007-2011 Nicira Networks. 422e3880aSThomas Graf * 522e3880aSThomas Graf * This program is free software; you can redistribute it and/or 622e3880aSThomas Graf * modify it under the terms of version 2 of the GNU General Public 722e3880aSThomas Graf * License as published by the Free Software Foundation. 822e3880aSThomas Graf * 922e3880aSThomas Graf * This program is distributed in the hope that it will be useful, but 1022e3880aSThomas Graf * WITHOUT ANY WARRANTY; without even the implied warranty of 1122e3880aSThomas Graf * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 1222e3880aSThomas Graf * General Public License for more details. 1322e3880aSThomas Graf * 1422e3880aSThomas Graf * You should have received a copy of the GNU General Public License 1522e3880aSThomas Graf * along with this program; if not, write to the Free Software 1622e3880aSThomas Graf * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 1722e3880aSThomas Graf * 02110-1301, USA 1822e3880aSThomas Graf */ 1922e3880aSThomas Graf 2022e3880aSThomas Graf #ifndef _UAPI__LINUX_OPENVSWITCH_H 2122e3880aSThomas Graf #define _UAPI__LINUX_OPENVSWITCH_H 1 2222e3880aSThomas Graf 2322e3880aSThomas Graf #include <linux/types.h> 2422e3880aSThomas Graf #include <linux/if_ether.h> 2522e3880aSThomas Graf 2622e3880aSThomas Graf /** 2722e3880aSThomas Graf * struct ovs_header - header for OVS Generic Netlink messages. 2822e3880aSThomas Graf * @dp_ifindex: ifindex of local port for datapath (0 to make a request not 2922e3880aSThomas Graf * specific to a datapath). 3022e3880aSThomas Graf * 3122e3880aSThomas Graf * Attributes following the header are specific to a particular OVS Generic 3222e3880aSThomas Graf * Netlink family, but all of the OVS families use this header. 3322e3880aSThomas Graf */ 3422e3880aSThomas Graf 3522e3880aSThomas Graf struct ovs_header { 3622e3880aSThomas Graf int dp_ifindex; 3722e3880aSThomas Graf }; 3822e3880aSThomas Graf 3922e3880aSThomas Graf /* Datapaths. */ 4022e3880aSThomas Graf 4122e3880aSThomas Graf #define OVS_DATAPATH_FAMILY "ovs_datapath" 4222e3880aSThomas Graf #define OVS_DATAPATH_MCGROUP "ovs_datapath" 4322e3880aSThomas Graf #define OVS_DATAPATH_VERSION 0x1 4422e3880aSThomas Graf 4522e3880aSThomas Graf enum ovs_datapath_cmd { 4622e3880aSThomas Graf OVS_DP_CMD_UNSPEC, 4722e3880aSThomas Graf OVS_DP_CMD_NEW, 4822e3880aSThomas Graf OVS_DP_CMD_DEL, 4922e3880aSThomas Graf OVS_DP_CMD_GET, 5022e3880aSThomas Graf OVS_DP_CMD_SET 5122e3880aSThomas Graf }; 5222e3880aSThomas Graf 5322e3880aSThomas Graf /** 5422e3880aSThomas Graf * enum ovs_datapath_attr - attributes for %OVS_DP_* commands. 5522e3880aSThomas Graf * @OVS_DP_ATTR_NAME: Name of the network device that serves as the "local 5622e3880aSThomas Graf * port". This is the name of the network device whose dp_ifindex is given in 5722e3880aSThomas Graf * the &struct ovs_header. Always present in notifications. Required in 5822e3880aSThomas Graf * %OVS_DP_NEW requests. May be used as an alternative to specifying 5922e3880aSThomas Graf * dp_ifindex in other requests (with a dp_ifindex of 0). 6022e3880aSThomas Graf * @OVS_DP_ATTR_UPCALL_PID: The Netlink socket in userspace that is initially 6122e3880aSThomas Graf * set on the datapath port (for OVS_ACTION_ATTR_MISS). Only valid on 6222e3880aSThomas Graf * %OVS_DP_CMD_NEW requests. A value of zero indicates that upcalls should 6322e3880aSThomas Graf * not be sent. 6422e3880aSThomas Graf * @OVS_DP_ATTR_STATS: Statistics about packets that have passed through the 6522e3880aSThomas Graf * datapath. Always present in notifications. 6622e3880aSThomas Graf * 6722e3880aSThomas Graf * These attributes follow the &struct ovs_header within the Generic Netlink 6822e3880aSThomas Graf * payload for %OVS_DP_* commands. 6922e3880aSThomas Graf */ 7022e3880aSThomas Graf enum ovs_datapath_attr { 7122e3880aSThomas Graf OVS_DP_ATTR_UNSPEC, 7222e3880aSThomas Graf OVS_DP_ATTR_NAME, /* name of dp_ifindex netdev */ 7322e3880aSThomas Graf OVS_DP_ATTR_UPCALL_PID, /* Netlink PID to receive upcalls */ 7422e3880aSThomas Graf OVS_DP_ATTR_STATS, /* struct ovs_dp_stats */ 7522e3880aSThomas Graf __OVS_DP_ATTR_MAX 7622e3880aSThomas Graf }; 7722e3880aSThomas Graf 7822e3880aSThomas Graf #define OVS_DP_ATTR_MAX (__OVS_DP_ATTR_MAX - 1) 7922e3880aSThomas Graf 8022e3880aSThomas Graf struct ovs_dp_stats { 8122e3880aSThomas Graf __u64 n_hit; /* Number of flow table matches. */ 8222e3880aSThomas Graf __u64 n_missed; /* Number of flow table misses. */ 8322e3880aSThomas Graf __u64 n_lost; /* Number of misses not sent to userspace. */ 8422e3880aSThomas Graf __u64 n_flows; /* Number of flows present */ 8522e3880aSThomas Graf }; 8622e3880aSThomas Graf 8722e3880aSThomas Graf struct ovs_vport_stats { 8822e3880aSThomas Graf __u64 rx_packets; /* total packets received */ 8922e3880aSThomas Graf __u64 tx_packets; /* total packets transmitted */ 9022e3880aSThomas Graf __u64 rx_bytes; /* total bytes received */ 9122e3880aSThomas Graf __u64 tx_bytes; /* total bytes transmitted */ 9222e3880aSThomas Graf __u64 rx_errors; /* bad packets received */ 9322e3880aSThomas Graf __u64 tx_errors; /* packet transmit problems */ 9422e3880aSThomas Graf __u64 rx_dropped; /* no space in linux buffers */ 9522e3880aSThomas Graf __u64 tx_dropped; /* no space available in linux */ 9622e3880aSThomas Graf }; 9722e3880aSThomas Graf 9822e3880aSThomas Graf /* Fixed logical ports. */ 9922e3880aSThomas Graf #define OVSP_LOCAL ((__u32)0) 10022e3880aSThomas Graf 10122e3880aSThomas Graf /* Packet transfer. */ 10222e3880aSThomas Graf 10322e3880aSThomas Graf #define OVS_PACKET_FAMILY "ovs_packet" 10422e3880aSThomas Graf #define OVS_PACKET_VERSION 0x1 10522e3880aSThomas Graf 10622e3880aSThomas Graf enum ovs_packet_cmd { 10722e3880aSThomas Graf OVS_PACKET_CMD_UNSPEC, 10822e3880aSThomas Graf 10922e3880aSThomas Graf /* Kernel-to-user notifications. */ 11022e3880aSThomas Graf OVS_PACKET_CMD_MISS, /* Flow table miss. */ 11122e3880aSThomas Graf OVS_PACKET_CMD_ACTION, /* OVS_ACTION_ATTR_USERSPACE action. */ 11222e3880aSThomas Graf 11322e3880aSThomas Graf /* Userspace commands. */ 11422e3880aSThomas Graf OVS_PACKET_CMD_EXECUTE /* Apply actions to a packet. */ 11522e3880aSThomas Graf }; 11622e3880aSThomas Graf 11722e3880aSThomas Graf /** 11822e3880aSThomas Graf * enum ovs_packet_attr - attributes for %OVS_PACKET_* commands. 11922e3880aSThomas Graf * @OVS_PACKET_ATTR_PACKET: Present for all notifications. Contains the entire 12022e3880aSThomas Graf * packet as received, from the start of the Ethernet header onward. For 12122e3880aSThomas Graf * %OVS_PACKET_CMD_ACTION, %OVS_PACKET_ATTR_PACKET reflects changes made by 12222e3880aSThomas Graf * actions preceding %OVS_ACTION_ATTR_USERSPACE, but %OVS_PACKET_ATTR_KEY is 12322e3880aSThomas Graf * the flow key extracted from the packet as originally received. 12422e3880aSThomas Graf * @OVS_PACKET_ATTR_KEY: Present for all notifications. Contains the flow key 12522e3880aSThomas Graf * extracted from the packet as nested %OVS_KEY_ATTR_* attributes. This allows 12622e3880aSThomas Graf * userspace to adapt its flow setup strategy by comparing its notion of the 12722e3880aSThomas Graf * flow key against the kernel's. 12822e3880aSThomas Graf * @OVS_PACKET_ATTR_ACTIONS: Contains actions for the packet. Used 12922e3880aSThomas Graf * for %OVS_PACKET_CMD_EXECUTE. It has nested %OVS_ACTION_ATTR_* attributes. 13022e3880aSThomas Graf * @OVS_PACKET_ATTR_USERDATA: Present for an %OVS_PACKET_CMD_ACTION 13122e3880aSThomas Graf * notification if the %OVS_ACTION_ATTR_USERSPACE action specified an 13222e3880aSThomas Graf * %OVS_USERSPACE_ATTR_USERDATA attribute, with the same length and content 13322e3880aSThomas Graf * specified there. 13422e3880aSThomas Graf * 13522e3880aSThomas Graf * These attributes follow the &struct ovs_header within the Generic Netlink 13622e3880aSThomas Graf * payload for %OVS_PACKET_* commands. 13722e3880aSThomas Graf */ 13822e3880aSThomas Graf enum ovs_packet_attr { 13922e3880aSThomas Graf OVS_PACKET_ATTR_UNSPEC, 14022e3880aSThomas Graf OVS_PACKET_ATTR_PACKET, /* Packet data. */ 14122e3880aSThomas Graf OVS_PACKET_ATTR_KEY, /* Nested OVS_KEY_ATTR_* attributes. */ 14222e3880aSThomas Graf OVS_PACKET_ATTR_ACTIONS, /* Nested OVS_ACTION_ATTR_* attributes. */ 14322e3880aSThomas Graf OVS_PACKET_ATTR_USERDATA, /* OVS_ACTION_ATTR_USERSPACE arg. */ 14422e3880aSThomas Graf __OVS_PACKET_ATTR_MAX 14522e3880aSThomas Graf }; 14622e3880aSThomas Graf 14722e3880aSThomas Graf #define OVS_PACKET_ATTR_MAX (__OVS_PACKET_ATTR_MAX - 1) 14822e3880aSThomas Graf 14922e3880aSThomas Graf /* Virtual ports. */ 15022e3880aSThomas Graf 15122e3880aSThomas Graf #define OVS_VPORT_FAMILY "ovs_vport" 15222e3880aSThomas Graf #define OVS_VPORT_MCGROUP "ovs_vport" 15322e3880aSThomas Graf #define OVS_VPORT_VERSION 0x1 15422e3880aSThomas Graf 15522e3880aSThomas Graf enum ovs_vport_cmd { 15622e3880aSThomas Graf OVS_VPORT_CMD_UNSPEC, 15722e3880aSThomas Graf OVS_VPORT_CMD_NEW, 15822e3880aSThomas Graf OVS_VPORT_CMD_DEL, 15922e3880aSThomas Graf OVS_VPORT_CMD_GET, 16022e3880aSThomas Graf OVS_VPORT_CMD_SET 16122e3880aSThomas Graf }; 16222e3880aSThomas Graf 16322e3880aSThomas Graf enum ovs_vport_type { 16422e3880aSThomas Graf OVS_VPORT_TYPE_UNSPEC, 16522e3880aSThomas Graf OVS_VPORT_TYPE_NETDEV, /* network device */ 16622e3880aSThomas Graf OVS_VPORT_TYPE_INTERNAL, /* network device implemented by datapath */ 16722e3880aSThomas Graf __OVS_VPORT_TYPE_MAX 16822e3880aSThomas Graf }; 16922e3880aSThomas Graf 17022e3880aSThomas Graf #define OVS_VPORT_TYPE_MAX (__OVS_VPORT_TYPE_MAX - 1) 17122e3880aSThomas Graf 17222e3880aSThomas Graf /** 17322e3880aSThomas Graf * enum ovs_vport_attr - attributes for %OVS_VPORT_* commands. 17422e3880aSThomas Graf * @OVS_VPORT_ATTR_PORT_NO: 32-bit port number within datapath. 17522e3880aSThomas Graf * @OVS_VPORT_ATTR_TYPE: 32-bit %OVS_VPORT_TYPE_* constant describing the type 17622e3880aSThomas Graf * of vport. 17722e3880aSThomas Graf * @OVS_VPORT_ATTR_NAME: Name of vport. For a vport based on a network device 17822e3880aSThomas Graf * this is the name of the network device. Maximum length %IFNAMSIZ-1 bytes 17922e3880aSThomas Graf * plus a null terminator. 18022e3880aSThomas Graf * @OVS_VPORT_ATTR_OPTIONS: Vport-specific configuration information. 18122e3880aSThomas Graf * @OVS_VPORT_ATTR_UPCALL_PID: The Netlink socket in userspace that 18222e3880aSThomas Graf * OVS_PACKET_CMD_MISS upcalls will be directed to for packets received on 18322e3880aSThomas Graf * this port. A value of zero indicates that upcalls should not be sent. 18422e3880aSThomas Graf * @OVS_VPORT_ATTR_STATS: A &struct ovs_vport_stats giving statistics for 18522e3880aSThomas Graf * packets sent or received through the vport. 18622e3880aSThomas Graf * 18722e3880aSThomas Graf * These attributes follow the &struct ovs_header within the Generic Netlink 18822e3880aSThomas Graf * payload for %OVS_VPORT_* commands. 18922e3880aSThomas Graf * 19022e3880aSThomas Graf * For %OVS_VPORT_CMD_NEW requests, the %OVS_VPORT_ATTR_TYPE and 19122e3880aSThomas Graf * %OVS_VPORT_ATTR_NAME attributes are required. %OVS_VPORT_ATTR_PORT_NO is 19222e3880aSThomas Graf * optional; if not specified a free port number is automatically selected. 19322e3880aSThomas Graf * Whether %OVS_VPORT_ATTR_OPTIONS is required or optional depends on the type 19422e3880aSThomas Graf * of vport. 19522e3880aSThomas Graf * 19622e3880aSThomas Graf * For other requests, if %OVS_VPORT_ATTR_NAME is specified then it is used to 19722e3880aSThomas Graf * look up the vport to operate on; otherwise dp_idx from the &struct 19822e3880aSThomas Graf * ovs_header plus %OVS_VPORT_ATTR_PORT_NO determine the vport. 19922e3880aSThomas Graf */ 20022e3880aSThomas Graf enum ovs_vport_attr { 20122e3880aSThomas Graf OVS_VPORT_ATTR_UNSPEC, 20222e3880aSThomas Graf OVS_VPORT_ATTR_PORT_NO, /* u32 port number within datapath */ 20322e3880aSThomas Graf OVS_VPORT_ATTR_TYPE, /* u32 OVS_VPORT_TYPE_* constant. */ 20422e3880aSThomas Graf OVS_VPORT_ATTR_NAME, /* string name, up to IFNAMSIZ bytes long */ 20522e3880aSThomas Graf OVS_VPORT_ATTR_OPTIONS, /* nested attributes, varies by vport type */ 20622e3880aSThomas Graf OVS_VPORT_ATTR_UPCALL_PID, /* u32 Netlink PID to receive upcalls */ 20722e3880aSThomas Graf OVS_VPORT_ATTR_STATS, /* struct ovs_vport_stats */ 20822e3880aSThomas Graf __OVS_VPORT_ATTR_MAX 20922e3880aSThomas Graf }; 21022e3880aSThomas Graf 21122e3880aSThomas Graf #define OVS_VPORT_ATTR_MAX (__OVS_VPORT_ATTR_MAX - 1) 21222e3880aSThomas Graf 21322e3880aSThomas Graf /* Flows. */ 21422e3880aSThomas Graf 21522e3880aSThomas Graf #define OVS_FLOW_FAMILY "ovs_flow" 21622e3880aSThomas Graf #define OVS_FLOW_MCGROUP "ovs_flow" 21722e3880aSThomas Graf #define OVS_FLOW_VERSION 0x1 21822e3880aSThomas Graf 21922e3880aSThomas Graf enum ovs_flow_cmd { 22022e3880aSThomas Graf OVS_FLOW_CMD_UNSPEC, 22122e3880aSThomas Graf OVS_FLOW_CMD_NEW, 22222e3880aSThomas Graf OVS_FLOW_CMD_DEL, 22322e3880aSThomas Graf OVS_FLOW_CMD_GET, 22422e3880aSThomas Graf OVS_FLOW_CMD_SET 22522e3880aSThomas Graf }; 22622e3880aSThomas Graf 22722e3880aSThomas Graf struct ovs_flow_stats { 22822e3880aSThomas Graf __u64 n_packets; /* Number of matched packets. */ 22922e3880aSThomas Graf __u64 n_bytes; /* Number of matched bytes. */ 23022e3880aSThomas Graf }; 23122e3880aSThomas Graf 23222e3880aSThomas Graf enum ovs_key_attr { 23322e3880aSThomas Graf OVS_KEY_ATTR_UNSPEC, 23422e3880aSThomas Graf OVS_KEY_ATTR_ENCAP, /* Nested set of encapsulated attributes. */ 23522e3880aSThomas Graf OVS_KEY_ATTR_PRIORITY, /* u32 skb->priority */ 23622e3880aSThomas Graf OVS_KEY_ATTR_IN_PORT, /* u32 OVS dp port number */ 23722e3880aSThomas Graf OVS_KEY_ATTR_ETHERNET, /* struct ovs_key_ethernet */ 23822e3880aSThomas Graf OVS_KEY_ATTR_VLAN, /* be16 VLAN TCI */ 23922e3880aSThomas Graf OVS_KEY_ATTR_ETHERTYPE, /* be16 Ethernet type */ 24022e3880aSThomas Graf OVS_KEY_ATTR_IPV4, /* struct ovs_key_ipv4 */ 24122e3880aSThomas Graf OVS_KEY_ATTR_IPV6, /* struct ovs_key_ipv6 */ 24222e3880aSThomas Graf OVS_KEY_ATTR_TCP, /* struct ovs_key_tcp */ 24322e3880aSThomas Graf OVS_KEY_ATTR_UDP, /* struct ovs_key_udp */ 24422e3880aSThomas Graf OVS_KEY_ATTR_ICMP, /* struct ovs_key_icmp */ 24522e3880aSThomas Graf OVS_KEY_ATTR_ICMPV6, /* struct ovs_key_icmpv6 */ 24622e3880aSThomas Graf OVS_KEY_ATTR_ARP, /* struct ovs_key_arp */ 24722e3880aSThomas Graf OVS_KEY_ATTR_ND, /* struct ovs_key_nd */ 24822e3880aSThomas Graf OVS_KEY_ATTR_SKB_MARK, /* u32 skb mark */ 249*7d5437c7SPravin B Shelar OVS_KEY_ATTR_TUNNEL, /* Nested set of ovs_tunnel attributes */ 250*7d5437c7SPravin B Shelar 251*7d5437c7SPravin B Shelar #ifdef __KERNEL__ 252*7d5437c7SPravin B Shelar OVS_KEY_ATTR_IPV4_TUNNEL, /* struct ovs_key_ipv4_tunnel */ 253*7d5437c7SPravin B Shelar #endif 25422e3880aSThomas Graf __OVS_KEY_ATTR_MAX 25522e3880aSThomas Graf }; 25622e3880aSThomas Graf 25722e3880aSThomas Graf #define OVS_KEY_ATTR_MAX (__OVS_KEY_ATTR_MAX - 1) 25822e3880aSThomas Graf 259*7d5437c7SPravin B Shelar enum ovs_tunnel_key_attr { 260*7d5437c7SPravin B Shelar OVS_TUNNEL_KEY_ATTR_ID, /* be64 Tunnel ID */ 261*7d5437c7SPravin B Shelar OVS_TUNNEL_KEY_ATTR_IPV4_SRC, /* be32 src IP address. */ 262*7d5437c7SPravin B Shelar OVS_TUNNEL_KEY_ATTR_IPV4_DST, /* be32 dst IP address. */ 263*7d5437c7SPravin B Shelar OVS_TUNNEL_KEY_ATTR_TOS, /* u8 Tunnel IP ToS. */ 264*7d5437c7SPravin B Shelar OVS_TUNNEL_KEY_ATTR_TTL, /* u8 Tunnel IP TTL. */ 265*7d5437c7SPravin B Shelar OVS_TUNNEL_KEY_ATTR_DONT_FRAGMENT, /* No argument, set DF. */ 266*7d5437c7SPravin B Shelar OVS_TUNNEL_KEY_ATTR_CSUM, /* No argument. CSUM packet. */ 267*7d5437c7SPravin B Shelar __OVS_TUNNEL_KEY_ATTR_MAX 268*7d5437c7SPravin B Shelar }; 269*7d5437c7SPravin B Shelar 270*7d5437c7SPravin B Shelar #define OVS_TUNNEL_KEY_ATTR_MAX (__OVS_TUNNEL_KEY_ATTR_MAX - 1) 271*7d5437c7SPravin B Shelar 27222e3880aSThomas Graf /** 27322e3880aSThomas Graf * enum ovs_frag_type - IPv4 and IPv6 fragment type 27422e3880aSThomas Graf * @OVS_FRAG_TYPE_NONE: Packet is not a fragment. 27522e3880aSThomas Graf * @OVS_FRAG_TYPE_FIRST: Packet is a fragment with offset 0. 27622e3880aSThomas Graf * @OVS_FRAG_TYPE_LATER: Packet is a fragment with nonzero offset. 27722e3880aSThomas Graf * 27822e3880aSThomas Graf * Used as the @ipv4_frag in &struct ovs_key_ipv4 and as @ipv6_frag &struct 27922e3880aSThomas Graf * ovs_key_ipv6. 28022e3880aSThomas Graf */ 28122e3880aSThomas Graf enum ovs_frag_type { 28222e3880aSThomas Graf OVS_FRAG_TYPE_NONE, 28322e3880aSThomas Graf OVS_FRAG_TYPE_FIRST, 28422e3880aSThomas Graf OVS_FRAG_TYPE_LATER, 28522e3880aSThomas Graf __OVS_FRAG_TYPE_MAX 28622e3880aSThomas Graf }; 28722e3880aSThomas Graf 28822e3880aSThomas Graf #define OVS_FRAG_TYPE_MAX (__OVS_FRAG_TYPE_MAX - 1) 28922e3880aSThomas Graf 29022e3880aSThomas Graf struct ovs_key_ethernet { 29122e3880aSThomas Graf __u8 eth_src[ETH_ALEN]; 29222e3880aSThomas Graf __u8 eth_dst[ETH_ALEN]; 29322e3880aSThomas Graf }; 29422e3880aSThomas Graf 29522e3880aSThomas Graf struct ovs_key_ipv4 { 29622e3880aSThomas Graf __be32 ipv4_src; 29722e3880aSThomas Graf __be32 ipv4_dst; 29822e3880aSThomas Graf __u8 ipv4_proto; 29922e3880aSThomas Graf __u8 ipv4_tos; 30022e3880aSThomas Graf __u8 ipv4_ttl; 30122e3880aSThomas Graf __u8 ipv4_frag; /* One of OVS_FRAG_TYPE_*. */ 30222e3880aSThomas Graf }; 30322e3880aSThomas Graf 30422e3880aSThomas Graf struct ovs_key_ipv6 { 30522e3880aSThomas Graf __be32 ipv6_src[4]; 30622e3880aSThomas Graf __be32 ipv6_dst[4]; 30722e3880aSThomas Graf __be32 ipv6_label; /* 20-bits in least-significant bits. */ 30822e3880aSThomas Graf __u8 ipv6_proto; 30922e3880aSThomas Graf __u8 ipv6_tclass; 31022e3880aSThomas Graf __u8 ipv6_hlimit; 31122e3880aSThomas Graf __u8 ipv6_frag; /* One of OVS_FRAG_TYPE_*. */ 31222e3880aSThomas Graf }; 31322e3880aSThomas Graf 31422e3880aSThomas Graf struct ovs_key_tcp { 31522e3880aSThomas Graf __be16 tcp_src; 31622e3880aSThomas Graf __be16 tcp_dst; 31722e3880aSThomas Graf }; 31822e3880aSThomas Graf 31922e3880aSThomas Graf struct ovs_key_udp { 32022e3880aSThomas Graf __be16 udp_src; 32122e3880aSThomas Graf __be16 udp_dst; 32222e3880aSThomas Graf }; 32322e3880aSThomas Graf 32422e3880aSThomas Graf struct ovs_key_icmp { 32522e3880aSThomas Graf __u8 icmp_type; 32622e3880aSThomas Graf __u8 icmp_code; 32722e3880aSThomas Graf }; 32822e3880aSThomas Graf 32922e3880aSThomas Graf struct ovs_key_icmpv6 { 33022e3880aSThomas Graf __u8 icmpv6_type; 33122e3880aSThomas Graf __u8 icmpv6_code; 33222e3880aSThomas Graf }; 33322e3880aSThomas Graf 33422e3880aSThomas Graf struct ovs_key_arp { 33522e3880aSThomas Graf __be32 arp_sip; 33622e3880aSThomas Graf __be32 arp_tip; 33722e3880aSThomas Graf __be16 arp_op; 33822e3880aSThomas Graf __u8 arp_sha[ETH_ALEN]; 33922e3880aSThomas Graf __u8 arp_tha[ETH_ALEN]; 34022e3880aSThomas Graf }; 34122e3880aSThomas Graf 34222e3880aSThomas Graf struct ovs_key_nd { 34322e3880aSThomas Graf __u32 nd_target[4]; 34422e3880aSThomas Graf __u8 nd_sll[ETH_ALEN]; 34522e3880aSThomas Graf __u8 nd_tll[ETH_ALEN]; 34622e3880aSThomas Graf }; 34722e3880aSThomas Graf 34822e3880aSThomas Graf /** 34922e3880aSThomas Graf * enum ovs_flow_attr - attributes for %OVS_FLOW_* commands. 35022e3880aSThomas Graf * @OVS_FLOW_ATTR_KEY: Nested %OVS_KEY_ATTR_* attributes specifying the flow 35122e3880aSThomas Graf * key. Always present in notifications. Required for all requests (except 35222e3880aSThomas Graf * dumps). 35322e3880aSThomas Graf * @OVS_FLOW_ATTR_ACTIONS: Nested %OVS_ACTION_ATTR_* attributes specifying 35422e3880aSThomas Graf * the actions to take for packets that match the key. Always present in 35522e3880aSThomas Graf * notifications. Required for %OVS_FLOW_CMD_NEW requests, optional for 35622e3880aSThomas Graf * %OVS_FLOW_CMD_SET requests. 35722e3880aSThomas Graf * @OVS_FLOW_ATTR_STATS: &struct ovs_flow_stats giving statistics for this 35822e3880aSThomas Graf * flow. Present in notifications if the stats would be nonzero. Ignored in 35922e3880aSThomas Graf * requests. 36022e3880aSThomas Graf * @OVS_FLOW_ATTR_TCP_FLAGS: An 8-bit value giving the OR'd value of all of the 36122e3880aSThomas Graf * TCP flags seen on packets in this flow. Only present in notifications for 36222e3880aSThomas Graf * TCP flows, and only if it would be nonzero. Ignored in requests. 36322e3880aSThomas Graf * @OVS_FLOW_ATTR_USED: A 64-bit integer giving the time, in milliseconds on 36422e3880aSThomas Graf * the system monotonic clock, at which a packet was last processed for this 36522e3880aSThomas Graf * flow. Only present in notifications if a packet has been processed for this 36622e3880aSThomas Graf * flow. Ignored in requests. 36722e3880aSThomas Graf * @OVS_FLOW_ATTR_CLEAR: If present in a %OVS_FLOW_CMD_SET request, clears the 36822e3880aSThomas Graf * last-used time, accumulated TCP flags, and statistics for this flow. 36922e3880aSThomas Graf * Otherwise ignored in requests. Never present in notifications. 37022e3880aSThomas Graf * 37122e3880aSThomas Graf * These attributes follow the &struct ovs_header within the Generic Netlink 37222e3880aSThomas Graf * payload for %OVS_FLOW_* commands. 37322e3880aSThomas Graf */ 37422e3880aSThomas Graf enum ovs_flow_attr { 37522e3880aSThomas Graf OVS_FLOW_ATTR_UNSPEC, 37622e3880aSThomas Graf OVS_FLOW_ATTR_KEY, /* Sequence of OVS_KEY_ATTR_* attributes. */ 37722e3880aSThomas Graf OVS_FLOW_ATTR_ACTIONS, /* Nested OVS_ACTION_ATTR_* attributes. */ 37822e3880aSThomas Graf OVS_FLOW_ATTR_STATS, /* struct ovs_flow_stats. */ 37922e3880aSThomas Graf OVS_FLOW_ATTR_TCP_FLAGS, /* 8-bit OR'd TCP flags. */ 38022e3880aSThomas Graf OVS_FLOW_ATTR_USED, /* u64 msecs last used in monotonic time. */ 38122e3880aSThomas Graf OVS_FLOW_ATTR_CLEAR, /* Flag to clear stats, tcp_flags, used. */ 38222e3880aSThomas Graf __OVS_FLOW_ATTR_MAX 38322e3880aSThomas Graf }; 38422e3880aSThomas Graf 38522e3880aSThomas Graf #define OVS_FLOW_ATTR_MAX (__OVS_FLOW_ATTR_MAX - 1) 38622e3880aSThomas Graf 38722e3880aSThomas Graf /** 38822e3880aSThomas Graf * enum ovs_sample_attr - Attributes for %OVS_ACTION_ATTR_SAMPLE action. 38922e3880aSThomas Graf * @OVS_SAMPLE_ATTR_PROBABILITY: 32-bit fraction of packets to sample with 39022e3880aSThomas Graf * @OVS_ACTION_ATTR_SAMPLE. A value of 0 samples no packets, a value of 39122e3880aSThomas Graf * %UINT32_MAX samples all packets and intermediate values sample intermediate 39222e3880aSThomas Graf * fractions of packets. 39322e3880aSThomas Graf * @OVS_SAMPLE_ATTR_ACTIONS: Set of actions to execute in sampling event. 39422e3880aSThomas Graf * Actions are passed as nested attributes. 39522e3880aSThomas Graf * 39622e3880aSThomas Graf * Executes the specified actions with the given probability on a per-packet 39722e3880aSThomas Graf * basis. 39822e3880aSThomas Graf */ 39922e3880aSThomas Graf enum ovs_sample_attr { 40022e3880aSThomas Graf OVS_SAMPLE_ATTR_UNSPEC, 40122e3880aSThomas Graf OVS_SAMPLE_ATTR_PROBABILITY, /* u32 number */ 40222e3880aSThomas Graf OVS_SAMPLE_ATTR_ACTIONS, /* Nested OVS_ACTION_ATTR_* attributes. */ 40322e3880aSThomas Graf __OVS_SAMPLE_ATTR_MAX, 40422e3880aSThomas Graf }; 40522e3880aSThomas Graf 40622e3880aSThomas Graf #define OVS_SAMPLE_ATTR_MAX (__OVS_SAMPLE_ATTR_MAX - 1) 40722e3880aSThomas Graf 40822e3880aSThomas Graf /** 40922e3880aSThomas Graf * enum ovs_userspace_attr - Attributes for %OVS_ACTION_ATTR_USERSPACE action. 41022e3880aSThomas Graf * @OVS_USERSPACE_ATTR_PID: u32 Netlink PID to which the %OVS_PACKET_CMD_ACTION 41122e3880aSThomas Graf * message should be sent. Required. 41222e3880aSThomas Graf * @OVS_USERSPACE_ATTR_USERDATA: If present, its variable-length argument is 41322e3880aSThomas Graf * copied to the %OVS_PACKET_CMD_ACTION message as %OVS_PACKET_ATTR_USERDATA. 41422e3880aSThomas Graf */ 41522e3880aSThomas Graf enum ovs_userspace_attr { 41622e3880aSThomas Graf OVS_USERSPACE_ATTR_UNSPEC, 41722e3880aSThomas Graf OVS_USERSPACE_ATTR_PID, /* u32 Netlink PID to receive upcalls. */ 41822e3880aSThomas Graf OVS_USERSPACE_ATTR_USERDATA, /* Optional user-specified cookie. */ 41922e3880aSThomas Graf __OVS_USERSPACE_ATTR_MAX 42022e3880aSThomas Graf }; 42122e3880aSThomas Graf 42222e3880aSThomas Graf #define OVS_USERSPACE_ATTR_MAX (__OVS_USERSPACE_ATTR_MAX - 1) 42322e3880aSThomas Graf 42422e3880aSThomas Graf /** 42522e3880aSThomas Graf * struct ovs_action_push_vlan - %OVS_ACTION_ATTR_PUSH_VLAN action argument. 42622e3880aSThomas Graf * @vlan_tpid: Tag protocol identifier (TPID) to push. 42722e3880aSThomas Graf * @vlan_tci: Tag control identifier (TCI) to push. The CFI bit must be set 42822e3880aSThomas Graf * (but it will not be set in the 802.1Q header that is pushed). 42922e3880aSThomas Graf * 43022e3880aSThomas Graf * The @vlan_tpid value is typically %ETH_P_8021Q. The only acceptable TPID 43122e3880aSThomas Graf * values are those that the kernel module also parses as 802.1Q headers, to 43222e3880aSThomas Graf * prevent %OVS_ACTION_ATTR_PUSH_VLAN followed by %OVS_ACTION_ATTR_POP_VLAN 43322e3880aSThomas Graf * from having surprising results. 43422e3880aSThomas Graf */ 43522e3880aSThomas Graf struct ovs_action_push_vlan { 43622e3880aSThomas Graf __be16 vlan_tpid; /* 802.1Q TPID. */ 43722e3880aSThomas Graf __be16 vlan_tci; /* 802.1Q TCI (VLAN ID and priority). */ 43822e3880aSThomas Graf }; 43922e3880aSThomas Graf 44022e3880aSThomas Graf /** 44122e3880aSThomas Graf * enum ovs_action_attr - Action types. 44222e3880aSThomas Graf * 44322e3880aSThomas Graf * @OVS_ACTION_ATTR_OUTPUT: Output packet to port. 44422e3880aSThomas Graf * @OVS_ACTION_ATTR_USERSPACE: Send packet to userspace according to nested 44522e3880aSThomas Graf * %OVS_USERSPACE_ATTR_* attributes. 44622e3880aSThomas Graf * @OVS_ACTION_ATTR_SET: Replaces the contents of an existing header. The 44722e3880aSThomas Graf * single nested %OVS_KEY_ATTR_* attribute specifies a header to modify and its 44822e3880aSThomas Graf * value. 44922e3880aSThomas Graf * @OVS_ACTION_ATTR_PUSH_VLAN: Push a new outermost 802.1Q header onto the 45022e3880aSThomas Graf * packet. 45122e3880aSThomas Graf * @OVS_ACTION_ATTR_POP_VLAN: Pop the outermost 802.1Q header off the packet. 45222e3880aSThomas Graf * @OVS_ACTION_ATTR_SAMPLE: Probabilitically executes actions, as specified in 45322e3880aSThomas Graf * the nested %OVS_SAMPLE_ATTR_* attributes. 45422e3880aSThomas Graf * 45522e3880aSThomas Graf * Only a single header can be set with a single %OVS_ACTION_ATTR_SET. Not all 45622e3880aSThomas Graf * fields within a header are modifiable, e.g. the IPv4 protocol and fragment 45722e3880aSThomas Graf * type may not be changed. 45822e3880aSThomas Graf */ 45922e3880aSThomas Graf 46022e3880aSThomas Graf enum ovs_action_attr { 46122e3880aSThomas Graf OVS_ACTION_ATTR_UNSPEC, 46222e3880aSThomas Graf OVS_ACTION_ATTR_OUTPUT, /* u32 port number. */ 46322e3880aSThomas Graf OVS_ACTION_ATTR_USERSPACE, /* Nested OVS_USERSPACE_ATTR_*. */ 46422e3880aSThomas Graf OVS_ACTION_ATTR_SET, /* One nested OVS_KEY_ATTR_*. */ 46522e3880aSThomas Graf OVS_ACTION_ATTR_PUSH_VLAN, /* struct ovs_action_push_vlan. */ 46622e3880aSThomas Graf OVS_ACTION_ATTR_POP_VLAN, /* No argument. */ 46722e3880aSThomas Graf OVS_ACTION_ATTR_SAMPLE, /* Nested OVS_SAMPLE_ATTR_*. */ 46822e3880aSThomas Graf __OVS_ACTION_ATTR_MAX 46922e3880aSThomas Graf }; 47022e3880aSThomas Graf 47122e3880aSThomas Graf #define OVS_ACTION_ATTR_MAX (__OVS_ACTION_ATTR_MAX - 1) 47222e3880aSThomas Graf 47322e3880aSThomas Graf #endif /* _LINUX_OPENVSWITCH_H */ 474