Skip to content

Commit

Permalink
ofproto: Fix remaining incorrect users of OVSP_LOCAL.
Browse files Browse the repository at this point in the history
In the switch to a single datapath, the simple mapping between
OFPP_LOCAL and OVSP_LOCAL was broken.  Unfortunately, a couple of
translations were missed, so this commit fixes them.

Reported-by: Jesse Gross <[email protected]>
Signed-off-by: Justin Pettit <[email protected]>
  • Loading branch information
Justin Pettit committed Jan 9, 2013
1 parent ffcb9f6 commit ee382d8
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 5 deletions.
4 changes: 3 additions & 1 deletion ofproto/connmgr.c
Original file line number Diff line number Diff line change
Expand Up @@ -1638,10 +1638,12 @@ connmgr_msg_in_hook(struct connmgr *mgr, const struct flow *flow,

bool
connmgr_may_set_up_flow(struct connmgr *mgr, const struct flow *flow,
uint32_t local_odp_port,
const struct nlattr *odp_actions,
size_t actions_len)
{
return !mgr->in_band || in_band_rule_check(flow, odp_actions, actions_len);
return !mgr->in_band || in_band_rule_check(flow, local_odp_port,
odp_actions, actions_len);
}

/* Fail-open and in-band implementation. */
Expand Down
1 change: 1 addition & 0 deletions ofproto/connmgr.h
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ void connmgr_set_in_band_queue(struct connmgr *, int queue_id);
bool connmgr_msg_in_hook(struct connmgr *, const struct flow *,
const struct ofpbuf *packet);
bool connmgr_may_set_up_flow(struct connmgr *, const struct flow *,
uint32_t local_odp_port,
const struct nlattr *odp_actions,
size_t actions_len);

Expand Down
4 changes: 2 additions & 2 deletions ofproto/in-band.c
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ in_band_msg_in_hook(struct in_band *in_band, const struct flow *flow,
/* Returns true if the rule that would match 'flow' with 'actions' is
* allowed to be set up in the datapath. */
bool
in_band_rule_check(const struct flow *flow,
in_band_rule_check(const struct flow *flow, uint32_t local_odp_port,
const struct nlattr *actions, size_t actions_len)
{
/* Don't allow flows that would prevent DHCP replies from being seen
Expand All @@ -270,7 +270,7 @@ in_band_rule_check(const struct flow *flow,

NL_ATTR_FOR_EACH_UNSAFE (a, left, actions, actions_len) {
if (nl_attr_type(a) == OVS_ACTION_ATTR_OUTPUT
&& nl_attr_get_u32(a) == OVSP_LOCAL) {
&& nl_attr_get_u32(a) == local_odp_port) {
return true;
}
}
Expand Down
2 changes: 1 addition & 1 deletion ofproto/in-band.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ void in_band_wait(struct in_band *);

bool in_band_msg_in_hook(struct in_band *, const struct flow *,
const struct ofpbuf *packet);
bool in_band_rule_check(const struct flow *,
bool in_band_rule_check(const struct flow *, uint32_t local_odp_port,
const struct nlattr *odp_actions, size_t actions_len);

#endif /* in-band.h */
5 changes: 4 additions & 1 deletion ofproto/ofproto-dpif.c
Original file line number Diff line number Diff line change
Expand Up @@ -2930,7 +2930,7 @@ port_get_stats(const struct ofport *ofport_, struct netdev_stats *stats)

error = netdev_get_stats(ofport->up.netdev, stats);

if (!error && ofport->odp_port == OVSP_LOCAL) {
if (!error && ofport_->ofp_port == OFPP_LOCAL) {
struct ofproto_dpif *ofproto = ofproto_dpif_cast(ofport->up.ofproto);

/* ofproto->stats.tx_packets represents packets that we created
Expand Down Expand Up @@ -6180,6 +6180,7 @@ xlate_actions(struct action_xlate_ctx *ctx,
} else {
static struct vlog_rate_limit trace_rl = VLOG_RATE_LIMIT_INIT(1, 1);
ovs_be16 initial_tci = ctx->base_flow.vlan_tci;
uint32_t local_odp_port;

add_sflow_action(ctx);
do_xlate_actions(ofpacts, ofpacts_len, ctx);
Expand All @@ -6200,7 +6201,9 @@ xlate_actions(struct action_xlate_ctx *ctx,
}
}

local_odp_port = ofp_port_to_odp_port(ctx->ofproto, OFPP_LOCAL);
if (!connmgr_may_set_up_flow(ctx->ofproto->up.connmgr, &ctx->flow,
local_odp_port,
ctx->odp_actions->data,
ctx->odp_actions->size)) {
ctx->slow |= SLOW_IN_BAND;
Expand Down

0 comments on commit ee382d8

Please sign in to comment.