Merge remote-tracking branch 'origin/master' into ovn
[cascardo/ovs.git] / lib / meta-flow.h
index 9518ba0..78e34c5 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, 2013, 2014 Nicira, Inc.
+ * Copyright (c) 2011, 2012, 2013, 2014, 2015 Nicira, Inc.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -299,6 +299,20 @@ enum OVS_PACKED_ENUM mf_field_id {
      */
     MFF_RECIRC_ID,
 
+    /* "conj_id".
+     *
+     * ID for "conjunction" actions.  Please refer to ovs-ofctl(8)
+     * documentation of "conjunction" for details.
+     *
+     * Type: be32.
+     * Maskable: no.
+     * Formatting: decimal.
+     * Prerequisites: none.
+     * Access: read-only.
+     * NXM: NXM_NX_CONJ_ID(37) since v2.4.
+     * OXM: none. */
+    MFF_CONJ_ID,
+
     /* "tun_id" (aka "tunnel_id").
      *
      * The "key" or "tunnel ID" or "VNI" in a packet received via a keyed
@@ -401,6 +415,34 @@ enum OVS_PACKED_ENUM mf_field_id {
      */
     MFF_TUN_TOS,
 
+    /* "tun_gbp_id".
+     *
+     * VXLAN Group Policy ID
+     *
+     * Type: be16.
+     * Maskable: bitwise.
+     * Formatting: decimal.
+     * Prerequisites: none.
+     * Access: read/write.
+     * NXM: NXM_NX_TUN_GBP_ID(38) since v2.4.
+     * OXM: none.
+     */
+    MFF_TUN_GBP_ID,
+
+    /* "tun_gbp_flags".
+     *
+     * VXLAN Group Policy flags
+     *
+     * Type: u8.
+     * Maskable: bitwise.
+     * Formatting: hexadecimal.
+     * Prerequisites: none.
+     * Access: read/write.
+     * NXM: NXM_NX_TUN_GBP_FLAGS(39) since v2.4.
+     * OXM: none.
+     */
+    MFF_TUN_GBP_FLAGS,
+
     /* "metadata".
      *
      * A scratch pad value standardized in OpenFlow 1.1+.  Initially zero, at
@@ -450,6 +492,19 @@ enum OVS_PACKED_ENUM mf_field_id {
      */
     MFF_IN_PORT_OXM,
 
+    /* "actset_output".
+     *
+     * Type: be32.
+     * Maskable: no.
+     * Formatting: OpenFlow 1.1+ port.
+     * Prerequisites: none.
+     * Access: read-only.
+     * NXM: none.
+     * OXM: ONFOXM_ET_ACTSET_OUTPUT(43) since OF1.3 and v2.4,
+     *      OXM_OF_ACTSET_OUTPUT(43) since OF1.5 and v2.4.
+     */
+    MFF_ACTSET_OUTPUT,
+
     /* "skb_priority".
      *
      * Designates the queue to which output will be directed.  The value in
@@ -522,19 +577,23 @@ enum OVS_PACKED_ENUM mf_field_id {
 #if FLOW_N_XREGS == 4
     /* "xreg<N>".
      *
-     * OpenFlow 1.5 (draft) ``extended register".  Each extended register
+     * OpenFlow 1.5 ``extended register".  Each extended register
      * overlays two of the Nicira extension 32-bit registers: xreg0 overlays
      * reg0 and reg1, with reg0 supplying the most-significant bits of xreg0
      * and reg1 the least-significant.  xreg1 similarly overlays reg2 and reg3,
      * and so on.
      *
+     * These registers were introduced in OpenFlow 1.5, but EXT-244 in the ONF
+     * JIRA also publishes them as a (draft) OpenFlow extension to OpenFlow
+     * 1.3.
+     *
      * Type: be64.
      * Maskable: bitwise.
      * Formatting: hexadecimal.
      * Prerequisites: none.
      * Access: read/write.
      * NXM: none.
-     * OXM: OXM_OF_PKT_REG<N>(<N>) since OF1.5 and v2.4.
+     * OXM: OXM_OF_PKT_REG<N>(<N>) since OF1.3 and v2.4.
      */
     MFF_XREG0,
     MFF_XREG1,
@@ -873,7 +932,7 @@ enum OVS_PACKED_ENUM mf_field_id {
      * Maskable: bitwise.
      * Formatting: hexadecimal.
      * Prerequisites: IPv6.
-     * Access: read-only.
+     * Access: read/write.
      * NXM: NXM_NX_IPV6_LABEL(27) since v1.4.
      * OXM: OXM_OF_IPV6_FLABEL(28) since OF1.2 and v1.7.
      */
@@ -1159,7 +1218,8 @@ enum OVS_PACKED_ENUM mf_field_id {
      * Prerequisites: TCP.
      * Access: read-only.
      * NXM: NXM_NX_TCP_FLAGS(34) since v2.1.
-     * OXM: OXM_OF_TCP_FLAGS(42) since OF1.5 and v2.3.
+     * OXM: ONFOXM_ET_TCP_FLAGS(42) since OF1.3 and v2.4,
+     *      OXM_OF_TCP_FLAGS(42) since OF1.5 and v2.3.
      */
     MFF_TCP_FLAGS,
 
@@ -1311,7 +1371,7 @@ enum OVS_PACKED_ENUM mf_field_id {
      * Maskable: bitwise.
      * Formatting: IPv6.
      * Prerequisites: ND.
-     * Access: read-only.
+     * Access: read/write.
      * NXM: NXM_NX_ND_TARGET(23) since v1.1.
      * OXM: OXM_OF_IPV6_ND_TARGET(31) since OF1.2 and v1.7.
      */
@@ -1325,7 +1385,7 @@ enum OVS_PACKED_ENUM mf_field_id {
      * Maskable: bitwise.
      * Formatting: Ethernet.
      * Prerequisites: ND solicit.
-     * Access: read-only.
+     * Access: read/write.
      * NXM: NXM_NX_ND_SLL(24) since v1.1.
      * OXM: OXM_OF_IPV6_ND_SLL(32) since OF1.2 and v1.7.
      */
@@ -1339,7 +1399,7 @@ enum OVS_PACKED_ENUM mf_field_id {
      * Maskable: bitwise.
      * Formatting: Ethernet.
      * Prerequisites: ND advert.
-     * Access: read-only.
+     * Access: read/write.
      * NXM: NXM_NX_ND_TLL(25) since v1.1.
      * OXM: OXM_OF_IPV6_ND_TLL(33) since OF1.2 and v1.7.
      */
@@ -1490,7 +1550,9 @@ union mf_value {
 };
 BUILD_ASSERT_DECL(sizeof(union mf_value) == 16);
 
+/* An all-1-bits mf_value.  Needs to be updated if struct mf_value grows.*/
 #define MF_EXACT_MASK_INITIALIZER { IN6ADDR_EXACT_INIT }
+BUILD_ASSERT_DECL(sizeof(union mf_value) == sizeof(struct in6_addr));
 
 /* Part of a field. */
 struct mf_subfield {
@@ -1505,13 +1567,35 @@ struct mf_subfield {
  * value" contains NXM_OF_VLAN_TCI[0..11], then one could access the
  * corresponding data in value.be16[7] as the bits in the mask htons(0xfff). */
 union mf_subvalue {
+    /* Access to full data. */
     uint8_t u8[16];
     ovs_be16 be16[8];
     ovs_be32 be32[4];
     ovs_be64 be64[2];
+
+    /* Convenient access to just least-significant bits in various forms. */
+    struct {
+        ovs_be64 dummy_integer;
+        ovs_be64 integer;
+    };
+    struct {
+        uint8_t dummy_mac[10];
+        uint8_t mac[6];
+    };
+    struct {
+        ovs_be32 dummy_ipv4[3];
+        ovs_be32 ipv4;
+    };
+    struct in6_addr ipv6;
 };
 BUILD_ASSERT_DECL(sizeof(union mf_value) == sizeof (union mf_subvalue));
 
+/* An array of fields with values */
+struct field_array {
+    struct mf_bitmap used;
+    union mf_value value[MFF_N_IDS];
+};
+
 /* Finding mf_fields. */
 const struct mf_field *mf_from_name(const char *name);
 
@@ -1533,6 +1617,8 @@ void mf_get_mask(const struct mf_field *, const struct flow_wildcards *,
 /* Prerequisites. */
 bool mf_are_prereqs_ok(const struct mf_field *, const struct flow *);
 void mf_mask_field_and_prereqs(const struct mf_field *, struct flow *mask);
+void mf_bitmap_set_field_and_prereqs(const struct mf_field *mf, struct
+                                     mf_bitmap *bm);
 
 static inline bool
 mf_is_l3_or_higher(const struct mf_field *mf)
@@ -1590,4 +1676,8 @@ void mf_format(const struct mf_field *,
                struct ds *);
 void mf_format_subvalue(const union mf_subvalue *subvalue, struct ds *s);
 
+/* Field Arrays. */
+void field_array_set(enum mf_field_id id, const union mf_value *,
+                     struct field_array *);
+
 #endif /* meta-flow.h */