/*
- * Copyright (c) 2012, 2013, 2014 Nicira, Inc.
+ * Copyright (c) 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.
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") \
/* Flow table interaction. */ \
OFPACT(RESUBMIT, ofpact_resubmit, ofpact, "resubmit") \
OFPACT(LEARN, ofpact_learn, specs, "learn") \
+ OFPACT(CONJUNCTION, ofpact_conjunction, ofpact, "conjunction") \
\
/* Arithmetic. */ \
OFPACT(MULTIPATH, ofpact_multipath, ofpact, "multipath") \
OFPACT(NOTE, ofpact_note, data, "note") \
OFPACT(EXIT, ofpact_null, ofpact, "exit") \
OFPACT(SAMPLE, ofpact_sample, ofpact, "sample") \
+ OFPACT(UNROLL_XLATE, ofpact_unroll_xlate, ofpact, "unroll_xlate") \
\
/* Instructions. */ \
OFPACT(METER, ofpact_meter, ofpact, "meter") \
* 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
NX_MP_ALG_ITER_HASH = 3,
};
+/* OFPACT_CONJUNCTION.
+ *
+ * Used for NXAST_CONJUNCTION. */
+struct ofpact_conjunction {
+ struct ofpact ofpact;
+ uint8_t clause;
+ uint8_t n_clauses;
+ uint32_t id;
+};
+
/* OFPACT_MULTIPATH.
*
* Used for NXAST_MULTIPATH. */
uint32_t group_id;
};
+/* OFPACT_UNROLL_XLATE.
+ *
+ * Used only internally. */
+struct ofpact_unroll_xlate {
+ struct ofpact ofpact;
+
+ /* Metadata in xlate context, visible to controller via PACKET_INs. */
+ uint8_t rule_table_id; /* 0xFF if none. */
+ ovs_be64 rule_cookie; /* OVS_BE64_MAX if none. */
+};
+
/* Converting OpenFlow to ofpacts. */
enum ofperr ofpacts_pull_openflow_actions(struct ofpbuf *openflow,
unsigned int actions_len,
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.