openvswitch.h: Change OVS_KEY_ATTR_TUN_ID from 100 to 63.
[sliver-openvswitch.git] / include / linux / openvswitch.h
index acc2769..966ef7a 100644 (file)
 
 #include <linux/types.h>
 
-/* datapaths. */
+/**
+ * struct ovs_header - header for OVS Generic Netlink messages.
+ * @dp_ifindex: ifindex of local port for datapath (0 to make a request not
+ * specific to a datapath).
+ *
+ * Attributes following the header are specific to a particular OVS Generic
+ * Netlink family, but all of the OVS families use this header.
+ */
+
+struct ovs_header {
+       int dp_ifindex;
+};
+
+/* Datapaths. */
 
 #define OVS_DATAPATH_FAMILY  "ovs_datapath"
 #define OVS_DATAPATH_MCGROUP "ovs_datapath"
+#define OVS_DATAPATH_VERSION 0x1
 
 enum ovs_datapath_cmd {
        OVS_DP_CMD_UNSPEC,
@@ -55,18 +69,6 @@ enum ovs_datapath_cmd {
        OVS_DP_CMD_SET
 };
 
-/**
- * struct ovs_header - header for OVS Generic Netlink messages.
- * @dp_ifindex: ifindex of local port for datapath (0 to make a request not
- * specific to a datapath).
- *
- * Attributes following the header are specific to a particular OVS Generic
- * Netlink family, but all of the OVS families use this header.
- */
-struct ovs_header {
-       int dp_ifindex;
-};
-\f
 /**
  * enum ovs_datapath_attr - attributes for %OVS_DP_* commands.
  * @OVS_DP_ATTR_NAME: Name of the network device that serves as the "local
@@ -80,9 +82,6 @@ struct ovs_header {
  * not be sent.
  * @OVS_DP_ATTR_STATS: Statistics about packets that have passed through the
  * datapath.  Always present in notifications.
- * @OVS_DP_ATTR_IPV4_FRAGS: One of %OVS_DP_FRAG_*.  Always present in
- * notifications.  May be included in %OVS_DP_NEW or %OVS_DP_SET requests to
- * change the fragment handling policy.
  *
  * These attributes follow the &struct ovs_header within the Generic Netlink
  * payload for %OVS_DP_* commands.
@@ -92,31 +91,16 @@ enum ovs_datapath_attr {
        OVS_DP_ATTR_NAME,       /* name of dp_ifindex netdev */
        OVS_DP_ATTR_UPCALL_PID, /* Netlink PID to receive upcalls */
        OVS_DP_ATTR_STATS,      /* struct ovs_dp_stats */
-       OVS_DP_ATTR_IPV4_FRAGS, /* 32-bit enum ovs_datapath_frag */
        __OVS_DP_ATTR_MAX
 };
 
 #define OVS_DP_ATTR_MAX (__OVS_DP_ATTR_MAX - 1)
 
-/**
- * enum ovs_datapath_frag - policy for handling received IPv4 fragments.
- * @OVS_DP_FRAG_ZERO: Treat IP fragments as IP protocol 0 and transport ports
- * zero.
- * @OVS_DP_FRAG_DROP: Drop IP fragments.  Do not pass them through the flow
- * table or up to userspace.
- */
-enum ovs_datapath_frag {
-       OVS_DP_FRAG_UNSPEC,
-       OVS_DP_FRAG_ZERO,       /* Treat IP fragments as transport port 0. */
-       OVS_DP_FRAG_DROP        /* Drop IP fragments. */
-};
-
 struct ovs_dp_stats {
-    __u64 n_frags;           /* Number of dropped IP fragments. */
-    __u64 n_hit;             /* Number of flow table matches. */
-    __u64 n_missed;          /* Number of flow table misses. */
-    __u64 n_lost;            /* Number of misses not sent to userspace. */
-    __u64 n_flows;           /* Number of flows present */
+       __u64 n_hit;             /* Number of flow table matches. */
+       __u64 n_missed;          /* Number of flow table misses. */
+       __u64 n_lost;            /* Number of misses not sent to userspace. */
+       __u64 n_flows;           /* Number of flows present */
 };
 
 struct ovs_vport_stats {
@@ -130,20 +114,23 @@ struct ovs_vport_stats {
        __u64   tx_dropped;             /* no space available in linux  */
 };
 
-/* Logical ports. */
+/* Fixed logical ports. */
 #define OVSP_LOCAL      ((__u16)0)
-\f
+
+/* Packet transfer. */
+
 #define OVS_PACKET_FAMILY "ovs_packet"
+#define OVS_PACKET_VERSION 0x1
 
 enum ovs_packet_cmd {
-        OVS_PACKET_CMD_UNSPEC,
+       OVS_PACKET_CMD_UNSPEC,
 
-        /* Kernel-to-user notifications. */
-        OVS_PACKET_CMD_MISS,    /* Flow table miss. */
-        OVS_PACKET_CMD_ACTION,  /* OVS_ACTION_ATTR_USERSPACE action. */
+       /* Kernel-to-user notifications. */
+       OVS_PACKET_CMD_MISS,    /* Flow table miss. */
+       OVS_PACKET_CMD_ACTION,  /* OVS_ACTION_ATTR_USERSPACE action. */
 
-        /* User commands. */
-        OVS_PACKET_CMD_EXECUTE  /* Apply actions to a packet. */
+       /* Userspace commands. */
+       OVS_PACKET_CMD_EXECUTE  /* Apply actions to a packet. */
 };
 
 /**
@@ -176,21 +163,12 @@ enum ovs_packet_attr {
 };
 
 #define OVS_PACKET_ATTR_MAX (__OVS_PACKET_ATTR_MAX - 1)
-\f
-enum ovs_vport_type {
-       OVS_VPORT_TYPE_UNSPEC,
-       OVS_VPORT_TYPE_NETDEV,   /* network device */
-       OVS_VPORT_TYPE_INTERNAL, /* network device implemented by datapath */
-       OVS_VPORT_TYPE_PATCH,    /* virtual tunnel connecting two vports */
-       OVS_VPORT_TYPE_GRE,      /* GRE tunnel */
-       OVS_VPORT_TYPE_CAPWAP,   /* CAPWAP tunnel */
-       __OVS_VPORT_TYPE_MAX
-};
 
-#define OVS_VPORT_TYPE_MAX (__OVS_VPORT_TYPE_MAX - 1)
-\f
+/* Virtual ports. */
+
 #define OVS_VPORT_FAMILY  "ovs_vport"
 #define OVS_VPORT_MCGROUP "ovs_vport"
+#define OVS_VPORT_VERSION 0x1
 
 enum ovs_vport_cmd {
        OVS_VPORT_CMD_UNSPEC,
@@ -200,6 +178,18 @@ enum ovs_vport_cmd {
        OVS_VPORT_CMD_SET
 };
 
+enum ovs_vport_type {
+       OVS_VPORT_TYPE_UNSPEC,
+       OVS_VPORT_TYPE_NETDEV,   /* network device */
+       OVS_VPORT_TYPE_INTERNAL, /* network device implemented by datapath */
+       OVS_VPORT_TYPE_PATCH = 100, /* virtual tunnel connecting two vports */
+       OVS_VPORT_TYPE_GRE,      /* GRE tunnel */
+       OVS_VPORT_TYPE_CAPWAP,   /* CAPWAP tunnel */
+       __OVS_VPORT_TYPE_MAX
+};
+
+#define OVS_VPORT_TYPE_MAX (__OVS_VPORT_TYPE_MAX - 1)
+
 /**
  * enum ovs_vport_attr - attributes for %OVS_VPORT_* commands.
  * @OVS_VPORT_ATTR_PORT_NO: 32-bit port number within datapath.
@@ -208,6 +198,7 @@ enum ovs_vport_cmd {
  * @OVS_VPORT_ATTR_NAME: Name of vport.  For a vport based on a network device
  * this is the name of the network device.  Maximum length %IFNAMSIZ-1 bytes
  * plus a null terminator.
+ * @OVS_VPORT_ATTR_OPTIONS: Vport-specific configuration information.
  * @OVS_VPORT_ATTR_UPCALL_PID: The Netlink socket in userspace that
  * OVS_PACKET_CMD_MISS upcalls will be directed to for packets received on
  * this port.  A value of zero indicates that upcalls should not be sent.
@@ -231,13 +222,13 @@ enum ovs_vport_cmd {
  */
 enum ovs_vport_attr {
        OVS_VPORT_ATTR_UNSPEC,
-       OVS_VPORT_ATTR_PORT_NO, /* port number within datapath */
-       OVS_VPORT_ATTR_TYPE,    /* 32-bit OVS_VPORT_TYPE_* constant. */
+       OVS_VPORT_ATTR_PORT_NO, /* u32 port number within datapath */
+       OVS_VPORT_ATTR_TYPE,    /* u32 OVS_VPORT_TYPE_* constant. */
        OVS_VPORT_ATTR_NAME,    /* string name, up to IFNAMSIZ bytes long */
-       OVS_VPORT_ATTR_UPCALL_PID, /* Netlink PID to receive upcalls */
-       OVS_VPORT_ATTR_STATS,   /* struct ovs_vport_stats */
-       OVS_VPORT_ATTR_ADDRESS, /* hardware address */
        OVS_VPORT_ATTR_OPTIONS, /* nested attributes, varies by vport type */
+       OVS_VPORT_ATTR_UPCALL_PID, /* u32 Netlink PID to receive upcalls */
+       OVS_VPORT_ATTR_STATS,   /* struct ovs_vport_stats */
+       OVS_VPORT_ATTR_ADDRESS = 100, /* hardware address */
        __OVS_VPORT_ATTR_MAX
 };
 
@@ -251,11 +242,12 @@ enum {
 };
 
 #define OVS_PATCH_ATTR_MAX (__OVS_PATCH_ATTR_MAX - 1)
-\f
+
 /* Flows. */
 
 #define OVS_FLOW_FAMILY  "ovs_flow"
 #define OVS_FLOW_MCGROUP "ovs_flow"
+#define OVS_FLOW_VERSION 0x1
 
 enum ovs_flow_cmd {
        OVS_FLOW_CMD_UNSPEC,
@@ -266,17 +258,17 @@ enum ovs_flow_cmd {
 };
 
 struct ovs_flow_stats {
-    __u64 n_packets;         /* Number of matched packets. */
-    __u64 n_bytes;           /* Number of matched bytes. */
+       __u64 n_packets;         /* Number of matched packets. */
+       __u64 n_bytes;           /* Number of matched bytes. */
 };
 
 enum ovs_key_attr {
        OVS_KEY_ATTR_UNSPEC,
-       OVS_KEY_ATTR_TUN_ID,    /* 64-bit tunnel ID */
-       OVS_KEY_ATTR_IN_PORT,   /* 32-bit OVS dp port number */
+       OVS_KEY_ATTR_PRIORITY,  /* u32 skb->priority */
+       OVS_KEY_ATTR_IN_PORT,   /* u32 OVS dp port number */
        OVS_KEY_ATTR_ETHERNET,  /* struct ovs_key_ethernet */
        OVS_KEY_ATTR_8021Q,     /* struct ovs_key_8021q */
-       OVS_KEY_ATTR_ETHERTYPE, /* 16-bit Ethernet type */
+       OVS_KEY_ATTR_ETHERTYPE, /* be16 Ethernet type */
        OVS_KEY_ATTR_IPV4,      /* struct ovs_key_ipv4 */
        OVS_KEY_ATTR_IPV6,      /* struct ovs_key_ipv6 */
        OVS_KEY_ATTR_TCP,       /* struct ovs_key_tcp */
@@ -285,11 +277,30 @@ enum ovs_key_attr {
        OVS_KEY_ATTR_ICMPV6,    /* struct ovs_key_icmpv6 */
        OVS_KEY_ATTR_ARP,       /* struct ovs_key_arp */
        OVS_KEY_ATTR_ND,        /* struct ovs_key_nd */
+       OVS_KEY_ATTR_TUN_ID = 63, /* be64 tunnel ID */
        __OVS_KEY_ATTR_MAX
 };
 
 #define OVS_KEY_ATTR_MAX (__OVS_KEY_ATTR_MAX - 1)
 
+/**
+ * enum ovs_frag_type - IPv4 and IPv6 fragment type
+ * @OVS_FRAG_TYPE_NONE: Packet is not a fragment.
+ * @OVS_FRAG_TYPE_FIRST: Packet is a fragment with offset 0.
+ * @OVS_FRAG_TYPE_LATER: Packet is a fragment with nonzero offset.
+ *
+ * Used as the @ipv4_frag in &struct ovs_key_ipv4 and as @ipv6_frag &struct
+ * ovs_key_ipv6.
+ */
+enum ovs_frag_type {
+       OVS_FRAG_TYPE_NONE,
+       OVS_FRAG_TYPE_FIRST,
+       OVS_FRAG_TYPE_LATER,
+       __OVS_FRAG_TYPE_MAX
+};
+
+#define OVS_FRAG_TYPE_MAX (__OVS_FRAG_TYPE_MAX - 1)
+
 struct ovs_key_ethernet {
        __u8     eth_src[6];
        __u8     eth_dst[6];
@@ -305,13 +316,18 @@ struct ovs_key_ipv4 {
        __be32 ipv4_dst;
        __u8   ipv4_proto;
        __u8   ipv4_tos;
+       __u8   ipv4_ttl;
+       __u8   ipv4_frag;       /* One of OVS_FRAG_TYPE_*. */
 };
 
 struct ovs_key_ipv6 {
        __be32 ipv6_src[4];
        __be32 ipv6_dst[4];
+       __be32 ipv6_label;      /* 20-bits in least-significant bits. */
        __u8   ipv6_proto;
-       __u8   ipv6_tos;
+       __u8   ipv6_tclass;
+       __u8   ipv6_hlimit;
+       __u8   ipv6_frag;       /* One of OVS_FRAG_TYPE_*. */
 };
 
 struct ovs_key_tcp {
@@ -355,7 +371,8 @@ struct ovs_key_nd {
  * dumps).
  * @OVS_FLOW_ATTR_ACTIONS: Nested %OVS_ACTION_ATTR_* attributes specifying
  * the actions to take for packets that match the key.  Always present in
- * notifications.  Required for %OVS_FLOW_CMD_NEW requests, optional
+ * notifications.  Required for %OVS_FLOW_CMD_NEW requests, optional for
+ * %OVS_FLOW_CMD_SET requests.
  * @OVS_FLOW_ATTR_STATS: &struct ovs_flow_stats giving statistics for this
  * flow.  Present in notifications if the stats would be nonzero.  Ignored in
  * requests.
@@ -424,38 +441,34 @@ enum ovs_userspace_attr {
 #define OVS_USERSPACE_ATTR_MAX (__OVS_USERSPACE_ATTR_MAX - 1)
 
 /**
- * enum ovs_action_attr -  Action types.
+ * enum ovs_action_attr - Action types.
  *
- * @OVS_ACTION_ATTR_OUTPUT: Output packet to port passed as NLA data.
- * @OVS_ACTION_ATTR_USERSPACE: Nested %OVS_USERSPACE_ATTR_ attributes specifying
- * PID.
- * @OVS_ACTION_ATTR_PUSH: Nested %OVS_KEY_ATTR_* attribute specifying header to
- * push to given packet.
- * E.g. Push vlan tag action would be NLA of %OVS_ACTION_ATTR_PUSH type with
- * nested attribute of type %OVS_KEY_ATTR_8021Q with struct ovs_key_8021q
- * as NLA data.
+ * @OVS_ACTION_ATTR_OUTPUT: Output packet to port.
+ * @OVS_ACTION_ATTR_USERSPACE: Send packet to userspace according to nested
+ * %OVS_USERSPACE_ATTR_* attributes.
+ * @OVS_ACTION_ATTR_PUSH: Push header onto head of packet.  The single nested
+ * %OVS_KEY_ATTR_* attribute specifies a header to push and its value, e.g.  a
+ * nested attribute of type %OVS_KEY_ATTR_8021Q, with struct ovs_key_8021q as
+ * argument, would push a VLAN header on the front of the packet.
  * @OVS_ACTION_ATTR_POP: Pop header according to %OVS_KEY_ATTR_ sent as
- * attribute data.
- * @OVS_ACTION_ATTR_SET: Nested %OVS_KEY_ATTR_* attribute specifying the
- * field to set to given packet.
- * @OVS_ACTION_ATTR_SET_PRIORITY: A set skb->priority to 32-bit number passed
- * as NLA data.
- * @OVS_ACTION_ATTR_POP_PRIORITY: Restore skb->priority to original value.
- * @OVS_ACTION_ATTR_SAMPLE: Execute set of actions according to probability
- * %OVS_SAMPLE_ATTR_PROBABILITY.
+ * attribute data, e.g. %OVS_KEY_ATTR_8021Q as argument pops an outer VLAN
+ * header.
+ * @OVS_ACTION_ATTR_SET: Replaces the contents of an existing header.
+ * The argument takes the same form as %OVS_ACTION_ATTR_PUSH.
+ * @OVS_ACTION_ATTR_SAMPLE: Probabilitically executes actions, as specified in
+ * the nested %OVS_SAMPLE_ATTR_* attributes.
  *
  * Only a single field can be set with a single %OVS_ACTION_ATTR_{SET,PUSH}.
+ * Not all fields are modifiable.
  */
 
 enum ovs_action_attr {
        OVS_ACTION_ATTR_UNSPEC,
-       OVS_ACTION_ATTR_OUTPUT,       /* Output to switch port. */
+       OVS_ACTION_ATTR_OUTPUT,       /* u32 port number. */
        OVS_ACTION_ATTR_USERSPACE,    /* Nested OVS_USERSPACE_ATTR_*. */
-       OVS_ACTION_ATTR_PUSH,         /* Push packet header. */
-       OVS_ACTION_ATTR_POP,          /* Pop packet header. */
-       OVS_ACTION_ATTR_SET,          /* Set packet field(s). */
-       OVS_ACTION_ATTR_SET_PRIORITY, /* Set skb->priority. */
-       OVS_ACTION_ATTR_POP_PRIORITY, /* Restore original skb->priority. */
+       OVS_ACTION_ATTR_PUSH,         /* One nested OVS_KEY_ATTR_*. */
+       OVS_ACTION_ATTR_POP,          /* u16 OVS_KEY_ATTR_*. */
+       OVS_ACTION_ATTR_SET,          /* One nested OVS_KEY_ATTR_*. */
        OVS_ACTION_ATTR_SAMPLE,       /* Nested OVS_SAMPLE_ATTR_*. */
        __OVS_ACTION_ATTR_MAX
 };