+/* Fields in a rule. */
+#define CLS_FIELDS \
+ /* struct flow all-caps */ \
+ /* wildcard bit(s) member name name */ \
+ /* ----------------- ----------- -------- */ \
+ CLS_FIELD(NXFW_TUN_ID, tun_id, TUN_ID) \
+ CLS_FIELD(OFPFW_NW_SRC_MASK, nw_src, NW_SRC) \
+ CLS_FIELD(OFPFW_NW_DST_MASK, nw_dst, NW_DST) \
+ CLS_FIELD(OFPFW_IN_PORT, in_port, IN_PORT) \
+ CLS_FIELD(OFPFW_DL_VLAN, dl_vlan, DL_VLAN) \
+ CLS_FIELD(OFPFW_DL_TYPE, dl_type, DL_TYPE) \
+ CLS_FIELD(OFPFW_TP_SRC, tp_src, TP_SRC) \
+ CLS_FIELD(OFPFW_TP_DST, tp_dst, TP_DST) \
+ CLS_FIELD(OFPFW_DL_SRC, dl_src, DL_SRC) \
+ CLS_FIELD(OFPFW_DL_DST, dl_dst, DL_DST) \
+ CLS_FIELD(OFPFW_NW_PROTO, nw_proto, NW_PROTO) \
+ CLS_FIELD(OFPFW_DL_VLAN_PCP, dl_vlan_pcp, DL_VLAN_PCP) \
+ CLS_FIELD(OFPFW_NW_TOS, nw_tos, NW_TOS)
+
+/* Field indexes.
+ *
+ * (These are also indexed into struct classifier's 'tables' array.) */
+enum {
+#define CLS_FIELD(WILDCARDS, MEMBER, NAME) CLS_F_IDX_##NAME,
+ CLS_FIELDS
+#undef CLS_FIELD
+ CLS_N_FIELDS
+};
+
+/* Field information. */
+struct cls_field {
+ int ofs; /* Offset in struct flow. */
+ int len; /* Length in bytes. */
+ uint32_t wildcards; /* OFPFW_* bit or bits for this field. */
+ const char *name; /* Name (for debugging). */
+};
+
+static const struct cls_field cls_fields[CLS_N_FIELDS] = {
+#define CLS_FIELD(WILDCARDS, MEMBER, NAME) \
+ { offsetof(struct flow, MEMBER), \
+ sizeof ((struct flow *)0)->MEMBER, \
+ WILDCARDS, \
+ #NAME },
+ CLS_FIELDS
+#undef CLS_FIELD
+};
+