static struct rule_dpif *rule_dpif_lookup(struct ofproto_dpif *,
const struct flow *, uint8_t table);
-static void flow_push_stats(const struct rule_dpif *, const struct flow *,
+static void flow_push_stats(struct rule_dpif *, const struct flow *,
uint64_t packets, uint64_t bytes,
long long int used);
* we are just revalidating. */
bool may_learn;
- /* Cookie of the currently matching rule, or 0. */
- ovs_be64 cookie;
+ /* The rule that we are currently translating, or NULL. */
+ struct rule_dpif *rule;
/* If nonnull, called just before executing a resubmit action.
*
static void action_xlate_ctx_init(struct action_xlate_ctx *,
struct ofproto_dpif *, const struct flow *,
- ovs_be16 initial_tci, ovs_be64 cookie,
+ ovs_be16 initial_tci, struct rule_dpif *,
const struct ofpbuf *);
static struct ofpbuf *xlate_actions(struct action_xlate_ctx *,
const union ofp_action *in, size_t n_in);
action_xlate_ctx_init(&ctx, ofproto, &facet->flow,
facet->flow.vlan_tci,
- facet->rule->up.flow_cookie, NULL);
+ facet->rule, NULL);
ctx.may_learn = true;
ofpbuf_delete(xlate_actions(&ctx, facet->rule->up.actions,
facet->rule->up.n_actions));
bool should_install;
action_xlate_ctx_init(&ctx, ofproto, &facet->flow,
- subfacet->initial_tci, rule->up.flow_cookie,
- NULL);
+ subfacet->initial_tci, rule, NULL);
odp_actions = xlate_actions(&ctx, rule->up.actions,
rule->up.n_actions);
bool should_install;
action_xlate_ctx_init(&ctx, ofproto, &facet->flow,
- subfacet->initial_tci, new_rule->up.flow_cookie,
- NULL);
+ subfacet->initial_tci, new_rule, NULL);
odp_actions = xlate_actions(&ctx, new_rule->up.actions,
new_rule->up.n_actions);
actions_changed = (subfacet->actions_len != odp_actions->size
/* Pushes flow statistics to the rules which 'flow' resubmits into given
* 'rule''s actions and mirrors. */
static void
-flow_push_stats(const struct rule_dpif *rule,
+flow_push_stats(struct rule_dpif *rule,
const struct flow *flow, uint64_t packets, uint64_t bytes,
long long int used)
{
push.bytes = bytes;
push.used = used;
- action_xlate_ctx_init(&push.ctx, ofproto, flow, flow->vlan_tci,
- rule->up.flow_cookie, NULL);
+ action_xlate_ctx_init(&push.ctx, ofproto, flow, flow->vlan_tci, rule,
+ NULL);
push.ctx.resubmit_hook = push_resubmit;
ofpbuf_delete(xlate_actions(&push.ctx,
rule->up.actions, rule->up.n_actions));
subfacet_make_actions(struct subfacet *subfacet, const struct ofpbuf *packet)
{
struct facet *facet = subfacet->facet;
- const struct rule_dpif *rule = facet->rule;
+ struct rule_dpif *rule = facet->rule;
struct ofproto_dpif *ofproto = ofproto_dpif_cast(rule->up.ofproto);
struct ofpbuf *odp_actions;
struct action_xlate_ctx ctx;
action_xlate_ctx_init(&ctx, ofproto, &facet->flow, subfacet->initial_tci,
- rule->up.flow_cookie, packet);
+ rule, packet);
odp_actions = xlate_actions(&ctx, rule->up.actions, rule->up.n_actions);
facet->tags = ctx.tags;
facet->may_install = ctx.may_set_up_flow;
size_t size;
action_xlate_ctx_init(&ctx, ofproto, flow, flow->vlan_tci,
- rule->up.flow_cookie, packet);
+ rule, packet);
odp_actions = xlate_actions(&ctx, rule->up.actions, rule->up.n_actions);
size = packet->size;
if (execute_odp_actions(ofproto, flow, odp_actions->data,
}
if (rule) {
- ovs_be64 old_cookie = ctx->cookie;
+ struct rule_dpif *old_rule = ctx->rule;
ctx->recurse++;
- ctx->cookie = rule->up.flow_cookie;
+ ctx->rule = rule;
do_xlate_actions(rule->up.actions, rule->up.n_actions, ctx);
- ctx->cookie = old_cookie;
+ ctx->rule = old_rule;
ctx->recurse--;
}
pin.packet_len = packet->size;
pin.reason = reason;
pin.table_id = ctx->table_id;
- pin.cookie = ctx->cookie;
+ pin.cookie = ctx->rule ? ctx->rule->up.flow_cookie : 0;
pin.buffer_id = 0;
pin.send_len = len;
static void
action_xlate_ctx_init(struct action_xlate_ctx *ctx,
struct ofproto_dpif *ofproto, const struct flow *flow,
- ovs_be16 initial_tci, ovs_be64 cookie,
+ ovs_be16 initial_tci, struct rule_dpif *rule,
const struct ofpbuf *packet)
{
ctx->ofproto = ofproto;
ctx->base_flow = ctx->flow;
ctx->base_flow.tun_id = 0;
ctx->base_flow.vlan_tci = initial_tci;
- ctx->cookie = cookie;
+ ctx->rule = rule;
ctx->packet = packet;
ctx->may_learn = packet != NULL;
ctx->resubmit_hook = NULL;
ofpbuf_use_stack(&key, &keybuf, sizeof keybuf);
odp_flow_key_from_flow(&key, flow);
- action_xlate_ctx_init(&push.ctx, ofproto, flow, flow->vlan_tci, 0,
+ action_xlate_ctx_init(&push.ctx, ofproto, flow, flow->vlan_tci, NULL,
packet);
/* Ensure that resubmits in 'ofp_actions' get accounted to their
trace.result = &result;
trace.flow = flow;
action_xlate_ctx_init(&trace.ctx, ofproto, &flow, initial_tci,
- rule->up.flow_cookie, packet);
+ rule, packet);
trace.ctx.resubmit_hook = trace_resubmit;
odp_actions = xlate_actions(&trace.ctx,
rule->up.actions, rule->up.n_actions);