Skip to content

Commit

Permalink
ofproto-dpif-xlate: Move 'nf_output_iface' from xlate_out to xlate_ctx.
Browse files Browse the repository at this point in the history
This member is used internally during translation but none of the callers
used as an output of translation.

Signed-off-by: Ben Pfaff <[email protected]>
Acked-by: Jarno Rajahalme <[email protected]>
  • Loading branch information
blp committed Jul 31, 2015
1 parent 939ba4d commit 2031ef9
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
35 changes: 18 additions & 17 deletions ofproto/ofproto-dpif-xlate.c
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ struct xlate_ctx {
uint32_t orig_skb_priority; /* Priority when packet arrived. */
uint32_t sflow_n_outputs; /* Number of output ports. */
odp_port_t sflow_odp_port; /* Output port for composing sFlow action. */
ofp_port_t nf_output_iface; /* Output interface index for NetFlow. */
bool exit; /* No further actions should be processed. */
mirror_mask_t mirrors; /* Bitmap of associated mirrors. */

Expand Down Expand Up @@ -2245,7 +2246,7 @@ xlate_normal_flood(struct xlate_ctx *ctx, struct xbundle *in_xbundle,
output_normal(ctx, xbundle, vlan);
}
}
ctx->xout->nf_output_iface = NF_OUT_FLOOD;
ctx->nf_output_iface = NF_OUT_FLOOD;
}

static void
Expand Down Expand Up @@ -3040,7 +3041,7 @@ compose_output_action__(struct xlate_ctx *ctx, ofp_port_t ofp_port,

ctx->sflow_odp_port = odp_port;
ctx->sflow_n_outputs++;
ctx->xout->nf_output_iface = ofp_port;
ctx->nf_output_iface = ofp_port;
}

out:
Expand Down Expand Up @@ -3427,7 +3428,7 @@ flood_packets(struct xlate_ctx *ctx, bool all)
}
}

ctx->xout->nf_output_iface = NF_OUT_FLOOD;
ctx->nf_output_iface = NF_OUT_FLOOD;
}

static void
Expand Down Expand Up @@ -3667,9 +3668,9 @@ static void
xlate_output_action(struct xlate_ctx *ctx,
ofp_port_t port, uint16_t max_len, bool may_packet_in)
{
ofp_port_t prev_nf_output_iface = ctx->xout->nf_output_iface;
ofp_port_t prev_nf_output_iface = ctx->nf_output_iface;

ctx->xout->nf_output_iface = NF_OUT_DROP;
ctx->nf_output_iface = NF_OUT_DROP;

switch (port) {
case OFPP_IN_PORT:
Expand Down Expand Up @@ -3708,12 +3709,12 @@ xlate_output_action(struct xlate_ctx *ctx,
}

if (prev_nf_output_iface == NF_OUT_FLOOD) {
ctx->xout->nf_output_iface = NF_OUT_FLOOD;
} else if (ctx->xout->nf_output_iface == NF_OUT_DROP) {
ctx->xout->nf_output_iface = prev_nf_output_iface;
ctx->nf_output_iface = NF_OUT_FLOOD;
} else if (ctx->nf_output_iface == NF_OUT_DROP) {
ctx->nf_output_iface = prev_nf_output_iface;
} else if (prev_nf_output_iface != NF_OUT_DROP &&
ctx->xout->nf_output_iface != NF_OUT_FLOOD) {
ctx->xout->nf_output_iface = NF_OUT_MULTI;
ctx->nf_output_iface != NF_OUT_FLOOD) {
ctx->nf_output_iface = NF_OUT_MULTI;
}
}

Expand Down Expand Up @@ -3763,10 +3764,10 @@ xlate_enqueue_action(struct xlate_ctx *ctx,
ctx->xin->flow.skb_priority = flow_priority;

/* Update NetFlow output port. */
if (ctx->xout->nf_output_iface == NF_OUT_DROP) {
ctx->xout->nf_output_iface = ofp_port;
} else if (ctx->xout->nf_output_iface != NF_OUT_FLOOD) {
ctx->xout->nf_output_iface = NF_OUT_MULTI;
if (ctx->nf_output_iface == NF_OUT_DROP) {
ctx->nf_output_iface = ofp_port;
} else if (ctx->nf_output_iface != NF_OUT_FLOOD) {
ctx->nf_output_iface = NF_OUT_MULTI;
}
}

Expand Down Expand Up @@ -4715,7 +4716,6 @@ xlate_actions(struct xlate_in *xin, struct xlate_out *xout)
*xout = (struct xlate_out) {
.slow = 0,
.fail_open = false,
.nf_output_iface = NF_OUT_DROP,
.n_recircs = 0,
};

Expand Down Expand Up @@ -4753,6 +4753,7 @@ xlate_actions(struct xlate_in *xin, struct xlate_out *xout)
.orig_skb_priority = flow->skb_priority,
.sflow_n_outputs = 0,
.sflow_odp_port = 0,
.nf_output_iface = NF_OUT_DROP,
.exit = false,
.mirrors = 0,

Expand Down Expand Up @@ -5027,7 +5028,7 @@ xlate_actions(struct xlate_in *xin, struct xlate_out *xout)
if (!xin->recirc && xbridge->netflow && !(xout->slow & SLOW_CONTROLLER)) {
if (ctx.xin->resubmit_stats) {
netflow_flow_update(xbridge->netflow, flow,
xout->nf_output_iface,
ctx.nf_output_iface,
ctx.xin->resubmit_stats);
}
if (ctx.xin->xcache) {
Expand All @@ -5036,7 +5037,7 @@ xlate_actions(struct xlate_in *xin, struct xlate_out *xout)
entry = xlate_cache_add_entry(ctx.xin->xcache, XC_NETFLOW);
entry->u.nf.netflow = netflow_ref(xbridge->netflow);
entry->u.nf.flow = xmemdup(flow, sizeof *flow);
entry->u.nf.iface = xout->nf_output_iface;
entry->u.nf.iface = ctx.nf_output_iface;
}
}

Expand Down
1 change: 0 additions & 1 deletion ofproto/ofproto-dpif-xlate.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ struct xlate_cache;
struct xlate_out {
enum slow_path_reason slow; /* 0 if fast path may be used. */
bool fail_open; /* Initial rule is fail open? */
ofp_port_t nf_output_iface; /* Output interface index for NetFlow. */

/* Recirculation IDs on which references are held. */
unsigned n_recircs;
Expand Down

0 comments on commit 2031ef9

Please sign in to comment.