2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-31 14:25:26 +00:00

ofproto-dpif-xlate: Put recirc_state, not recirc_id_node, in xlate_in.

This will make it possible, in an upcoming commit, to construct a
recirc_state locally on the stack to pass to xlate_actions().  It would
also be possible to construct and pass a recirc_id_node on the stack, but
the translation process only uses the recirc_state anyway.  The alternative
here of having upcall_xlate() know that it can recover the recirc_id_node
from the recirc_state isn't great either; it's debatable which is the
better approach.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Jarno Rajahalme <jarno@ovn.org>
This commit is contained in:
Ben Pfaff
2016-01-20 16:53:01 -08:00
parent aa07423103
commit 29b1ea3f2e
4 changed files with 18 additions and 7 deletions

View File

@@ -184,6 +184,12 @@ void recirc_free_ofproto(struct ofproto_dpif *, const char *ofproto_name);
const struct recirc_id_node *recirc_id_node_find(uint32_t recirc_id);
static inline struct recirc_id_node *
recirc_id_node_from_state(const struct recirc_state *state)
{
return CONTAINER_OF(state, struct recirc_id_node, state);
}
static inline bool recirc_id_node_try_ref_rcu(const struct recirc_id_node *n_)
{
struct recirc_id_node *node = CONST_CAST(struct recirc_id_node *, n_);

View File

@@ -1074,8 +1074,8 @@ upcall_xlate(struct udpif *udpif, struct upcall *upcall,
* upcalls using recirculation ID for which no context can be
* found). We may still execute the flow's actions even if we
* don't install the flow. */
upcall->recirc = xin.recirc;
upcall->have_recirc_ref = recirc_id_node_try_ref_rcu(xin.recirc);
upcall->recirc = recirc_id_node_from_state(xin.recirc);
upcall->have_recirc_ref = recirc_id_node_try_ref_rcu(upcall->recirc);
}
} else {
/* For non-miss upcalls, we are either executing actions (one of which

View File

@@ -4828,9 +4828,14 @@ xlate_in_init(struct xlate_in *xin, struct ofproto_dpif *ofproto,
xin->odp_actions = odp_actions;
/* Do recirc lookup. */
xin->recirc = flow->recirc_id
? recirc_id_node_find(flow->recirc_id)
: NULL;
xin->recirc = NULL;
if (flow->recirc_id) {
const struct recirc_id_node *node
= recirc_id_node_find(flow->recirc_id);
if (node) {
xin->recirc = &node->state;
}
}
}
void
@@ -5138,7 +5143,7 @@ xlate_actions(struct xlate_in *xin, struct xlate_out *xout)
COVERAGE_INC(xlate_actions);
if (xin->recirc) {
const struct recirc_state *state = &xin->recirc->state;
const struct recirc_state *state = xin->recirc;
xlate_report(&ctx, "Restoring state post-recirculation:");

View File

@@ -142,7 +142,7 @@ struct xlate_in {
/* The recirculation context related to this translation, as returned by
* xlate_lookup. */
const struct recirc_id_node *recirc;
const struct recirc_state *recirc;
};
void xlate_ofproto_set(struct ofproto_dpif *, const char *name, struct dpif *,