ofproto: Match on IP ToS/DSCP bits (OpenFlow 1.0)
[sliver-openvswitch.git] / include / openvswitch / datapath-protocol.h
index 4487588..c0d06e5 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009 Nicira Networks.
+ * Copyright (c) 2009, 2010 Nicira Networks.
  *
  * This file is offered under your choice of two licenses: Apache 2.0 or GNU
  * GPL 2.0 or later.  The permission statements for each of these licenses is
@@ -37,7 +37,7 @@
  * ----------------------------------------------------------------------
  */
 
-/* Protocol between secchan and datapath. */
+/* Protocol between userspace and kernel datapath. */
 
 #ifndef OPENVSWITCH_DATAPATH_PROTOCOL_H
 #define OPENVSWITCH_DATAPATH_PROTOCOL_H 1
@@ -151,24 +151,31 @@ struct odp_flow_stats {
 };
 
 struct odp_flow_key {
-       __be32 nw_src;               /* IP source address. */
-       __be32 nw_dst;               /* IP destination address. */
-       __u16  in_port;              /* Input switch port. */
-       __be16 dl_vlan;              /* Input VLAN. */
-       __be16 dl_type;              /* Ethernet frame type. */
-       __be16 tp_src;               /* TCP/UDP source port. */
-       __be16 tp_dst;               /* TCP/UDP destination port. */
-       __u8   dl_src[ETH_ALEN];     /* Ethernet source address. */
-       __u8   dl_dst[ETH_ALEN];     /* Ethernet destination address. */
-       __u8   nw_proto;             /* IP protocol. */
-       __u8   reserved;             /* Pad to 64 bits. */
+    __be32 nw_src;               /* IP source address. */
+    __be32 nw_dst;               /* IP destination address. */
+    __u16  in_port;              /* Input switch port. */
+    __be16 dl_vlan;              /* Input VLAN. */
+    __be16 dl_type;              /* Ethernet frame type. */
+    __be16 tp_src;               /* TCP/UDP source port. */
+    __be16 tp_dst;               /* TCP/UDP destination port. */
+    __u8   dl_src[ETH_ALEN];     /* Ethernet source address. */
+    __u8   dl_dst[ETH_ALEN];     /* Ethernet destination address. */
+    __u8   nw_proto;             /* IP protocol or lower 8 bits of 
+                                    ARP opcode. */
+    __u8   dl_vlan_pcp;          /* Input VLAN priority. */
+    __u8   nw_tos;               /* IP ToS (DSCP field, 6 bits). */
+    __u8   reserved[3];          /* Align to 32-bits...must be zeroed. */
 };
 
+/* Flags for ODP_FLOW. */
+#define ODPFF_ZERO_TCP_FLAGS (1 << 0) /* Zero the TCP flags. */
+
 struct odp_flow {
     struct odp_flow_stats stats;
     struct odp_flow_key key;
     union odp_action *actions;
     __u32 n_actions;
+    __u32 flags;
 };
 
 /* Flags for ODP_FLOW_PUT. */
@@ -203,9 +210,10 @@ struct odp_flowvec {
 #define ODPAT_SET_DL_DST        7    /* Ethernet destination address. */
 #define ODPAT_SET_NW_SRC        8    /* IP source address. */
 #define ODPAT_SET_NW_DST        9    /* IP destination address. */
-#define ODPAT_SET_TP_SRC        10   /* TCP/UDP source port. */
-#define ODPAT_SET_TP_DST        11   /* TCP/UDP destination port. */
-#define ODPAT_N_ACTIONS         12
+#define ODPAT_SET_NW_TOS        10   /* IP ToS/DSCP field (6 bits). */
+#define ODPAT_SET_TP_SRC        11   /* TCP/UDP source port. */
+#define ODPAT_SET_TP_DST        12   /* TCP/UDP destination port. */
+#define ODPAT_N_ACTIONS         13
 
 struct odp_action_output {
     __u16 type;                  /* ODPAT_OUTPUT. */
@@ -257,6 +265,14 @@ struct odp_action_nw_addr {
     __be32 nw_addr;             /* IP address. */
 };
 
+struct odp_action_nw_tos {
+    __u16 type;                  /* ODPAT_SET_NW_TOS. */
+    __u8 nw_tos;                 /* IP ToS/DSCP field (6 bits). */
+    __u8 reserved1;
+    __u16 reserved2;
+    __u16 reserved3;
+};
+
 /* Action structure for ODPAT_SET_TP_SRC/DST. */
 struct odp_action_tp_port {
     __u16 type;                  /* ODPAT_SET_TP_SRC/DST. */
@@ -274,6 +290,7 @@ union odp_action {
     struct odp_action_vlan_pcp vlan_pcp;
     struct odp_action_dl_addr dl_addr;
     struct odp_action_nw_addr nw_addr;
+    struct odp_action_nw_tos nw_tos;
     struct odp_action_tp_port tp_port;
 };