summaryrefslogtreecommitdiff
path: root/ofproto/ofproto-dpif-rid.h
diff options
context:
space:
mode:
authorBen Pfaff <blp@nicira.com>2015-07-29 20:32:12 -0700
committerBen Pfaff <blp@nicira.com>2015-07-31 15:15:15 -0700
commit2082425c2c95431a2f8f5d3f6b1d0ef8f242c186 (patch)
treec0249ff37796c51e1245a8d6206d2f7de12e987b /ofproto/ofproto-dpif-rid.h
parent7efbc3b7c4006caed79cc9afa799cd0f9b8f5d38 (diff)
downloadopenvswitch-2082425c2c95431a2f8f5d3f6b1d0ef8f242c186.tar.gz
ofproto-dpif-rid: Factor recirculation state out as new structure.
This greatly reduces the number of arguments to many of the functions involved in recirculation, which to my eye makes the code clearer. It will also make it easier to add new recirculation state in an upcoming commit. Signed-off-by: Ben Pfaff <blp@nicira.com> Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
Diffstat (limited to 'ofproto/ofproto-dpif-rid.h')
-rw-r--r--ofproto/ofproto-dpif-rid.h43
1 files changed, 24 insertions, 19 deletions
diff --git a/ofproto/ofproto-dpif-rid.h b/ofproto/ofproto-dpif-rid.h
index a614a4d46..9caa662ca 100644
--- a/ofproto/ofproto-dpif-rid.h
+++ b/ofproto/ofproto-dpif-rid.h
@@ -125,16 +125,9 @@ recirc_metadata_to_flow(const struct recirc_metadata *md,
flow->actset_output = md->actset_output;
}
-/* Pool node fields should NOT be modified after placing the node in the pool.
- */
-struct recirc_id_node {
- struct ovs_list exp_node OVS_GUARDED;
- struct cmap_node id_node;
- struct cmap_node metadata_node;
- uint32_t id;
- uint32_t hash;
- struct ovs_refcount refcount;
-
+/* State that flow translation can save, to restore when recirculation
+ * occurs. */
+struct recirc_state {
/* Initial table for post-recirculation processing. */
uint8_t table_id;
@@ -147,7 +140,25 @@ struct recirc_id_node {
uint32_t action_set_len; /* How much of 'ofpacts' consists of an
* action set? */
uint32_t ofpacts_len; /* Size of 'ofpacts', in bytes. */
- struct ofpact ofpacts[]; /* Sequence of "struct ofpacts". */
+ struct ofpact *ofpacts; /* Sequence of "struct ofpacts". */
+};
+
+/* This maps a recirculation ID to saved state that flow translation can
+ * restore when recirculation occurs. */
+struct recirc_id_node {
+ /* Index data. */
+ struct ovs_list exp_node OVS_GUARDED;
+ struct cmap_node id_node;
+ struct cmap_node metadata_node;
+ uint32_t id;
+ uint32_t hash;
+ struct ovs_refcount refcount;
+
+ /* Saved state.
+ *
+ * This state should not be modified after inserting a node in the pool,
+ * hence the 'const' to emphasize that. */
+ const struct recirc_state state;
};
void recirc_init(void);
@@ -156,14 +167,8 @@ void recirc_init(void);
* updated to use this mechanism instead of internal rules. */
uint32_t recirc_alloc_id(struct ofproto_dpif *);
-uint32_t recirc_alloc_id_ctx(struct ofproto_dpif *, uint8_t table_id,
- struct recirc_metadata *, struct ofpbuf *stack,
- uint32_t action_set_len, uint32_t ofpacts_len,
- const struct ofpact *);
-uint32_t recirc_find_id(struct ofproto_dpif *, uint8_t table_id,
- struct recirc_metadata *, struct ofpbuf *stack,
- uint32_t action_set_len, uint32_t ofpacts_len,
- const struct ofpact *);
+uint32_t recirc_alloc_id_ctx(const struct recirc_state *);
+uint32_t recirc_find_id(const struct recirc_state *);
void recirc_free_id(uint32_t recirc_id);
void recirc_free_ofproto(struct ofproto_dpif *, const char *ofproto_name);