OFPACT(SET_L4_SRC_PORT, ofpact_l4_port, ofpact, "mod_tp_src") \
OFPACT(SET_L4_DST_PORT, ofpact_l4_port, ofpact, "mod_tp_dst") \
OFPACT(REG_MOVE, ofpact_reg_move, ofpact, "move") \
- OFPACT(REG_LOAD, ofpact_reg_load, ofpact, "load") \
OFPACT(STACK_PUSH, ofpact_stack, ofpact, "push") \
OFPACT(STACK_POP, ofpact_stack, ofpact, "pop") \
OFPACT(DEC_TTL, ofpact_cnt_ids, cnt_ids, "dec_ttl") \
* code to translate the ofpact to OpenFlow must tolerate this case.)
*/
struct ofpact {
+ /* We want the space advantage of an 8-bit type here on every
+ * implementation, without giving up the advantage of having a useful type
+ * on implementations that support packed enums. */
+#ifdef HAVE_PACKED_ENUM
enum ofpact_type type; /* OFPACT_*. */
+#else
+ uint8_t type; /* OFPACT_* */
+#endif
+
uint8_t raw; /* Original type when added, if any. */
uint16_t len; /* Length of the action, in bytes, including
* struct ofpact, excluding padding. */
};
-
-#ifdef __GNUC__
-/* Make sure that OVS_PACKED_ENUM really worked. */
BUILD_ASSERT_DECL(sizeof(struct ofpact) == 4);
-#endif
/* Alignment. */
#define OFPACT_ALIGNTO 8
struct mf_subfield subfield;
};
-/* OFPACT_REG_LOAD.
- *
- * Used for NXAST_REG_LOAD. */
-struct ofpact_reg_load {
- struct ofpact ofpact;
- struct mf_subfield dst;
- union mf_subvalue subvalue; /* Least-significant bits are used. */
-};
-
/* OFPACT_SET_FIELD.
*
- * Used for OFPAT12_SET_FIELD. */
+ * Used for NXAST_REG_LOAD and OFPAT12_SET_FIELD. */
struct ofpact_set_field {
struct ofpact ofpact;
const struct mf_field *field;
bool flow_has_vlan; /* VLAN present at action validation time. */
union mf_value value;
+ union mf_value mask;
};
/* OFPACT_PUSH_VLAN/MPLS/PBB
void ofpacts_format(const struct ofpact[], size_t ofpacts_len, struct ds *);
char *ofpacts_parse_actions(const char *, struct ofpbuf *ofpacts,
enum ofputil_protocol *usable_protocols)
- WARN_UNUSED_RESULT;
+ OVS_WARN_UNUSED_RESULT;
char *ofpacts_parse_instructions(const char *, struct ofpbuf *ofpacts,
enum ofputil_protocol *usable_protocols)
- WARN_UNUSED_RESULT;
+ OVS_WARN_UNUSED_RESULT;
const char *ofpact_name(enum ofpact_type);
/* Internal use by the helpers below. */
void ofpact_update_len(struct ofpbuf *, struct ofpact *);
void ofpact_pad(struct ofpbuf *);
+/* Additional functions for composing ofpacts. */
+struct ofpact_set_field *ofpact_put_reg_load(struct ofpbuf *ofpacts);
+
/* OpenFlow 1.1 instructions.
* The order is sorted in execution order. Not in the value of OFPIT11_xxx.
* It is enforced on parser from text string.