flow: Add mf_is_l3_or_higher()
[sliver-openvswitch.git] / lib / meta-flow.h
index c2b0bbc..d02d320 100644 (file)
@@ -33,6 +33,8 @@ struct match;
  * to represent its value. */
 enum OVS_PACKED_ENUM mf_field_id {
     /* Metadata. */
+    MFF_DP_HASH,                /* be32 */
+    MFF_RECIRC_ID,              /* be32 */
     MFF_TUN_ID,                 /* be64 */
     MFF_TUN_SRC,                /* be32 */
     MFF_TUN_DST,                /* be32 */
@@ -87,6 +89,8 @@ enum OVS_PACKED_ENUM mf_field_id {
     MFF_MPLS_BOS,               /* u8 */
 
     /* L3. */
+    /* Update mf_is_l3_or_higher() if MFF_IPV4_SRC is
+     * no longer the first element for a field of layer 3 or higher */
     MFF_IPV4_SRC,               /* be32 */
     MFF_IPV4_DST,               /* be32 */
 
@@ -232,6 +236,7 @@ enum OVS_PACKED_ENUM mf_string {
     MFS_OFP_PORT_OXM,           /* An OpenFlow port number or name (32-bit). */
     MFS_FRAG,                   /* no, yes, first, later, not_later */
     MFS_TNL_FLAGS,              /* FLOW_TNL_F_* flags */
+    MFS_TCP_FLAGS,              /* TCP_* flags */
 };
 
 struct mf_field {
@@ -296,6 +301,9 @@ struct mf_field {
     enum ofputil_protocol usable_protocols; /* If fully/cidr masked. */
     /* If partially/non-cidr masked. */
     enum ofputil_protocol usable_protocols_bitwise;
+
+    int flow_be32ofs;  /* Field's be32 offset in "struct flow", if prefix tree
+                        * lookup is supported for the field, or -1. */
 };
 
 /* The representation of a field's value. */
@@ -355,6 +363,12 @@ void mf_get_mask(const struct mf_field *, const struct flow_wildcards *,
 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);
 
+static inline bool
+mf_is_l3_or_higher(const struct mf_field *mf)
+{
+    return mf->id >= MFF_IPV4_SRC;
+}
+
 /* Field values. */
 bool mf_is_value_valid(const struct mf_field *, const union mf_value *value);
 
@@ -378,8 +392,6 @@ enum ofputil_protocol mf_set(const struct mf_field *,
 
 void mf_set_wild(const struct mf_field *, struct match *);
 
-void mf_random_value(const struct mf_field *, union mf_value *value);
-
 /* Subfields. */
 void mf_write_subfield_flow(const struct mf_subfield *,
                             const union mf_subvalue *, struct flow *);