aboutsummaryrefslogtreecommitdiff
path: root/ofproto
diff options
context:
space:
mode:
authorJustin Pettit <jpettit@nicira.com>2012-01-02 16:06:48 -0800
committerJustin Pettit <jpettit@nicira.com>2012-01-04 16:17:48 -0800
commita64d0f34a1adf9d586a64a5fecf829d3f473c4c7 (patch)
tree7b0f7d764a2a4bdea08658b98788955b057e99f7 /ofproto
parent9cc966d077d1904fa27919694eb55331e6bf391e (diff)
ofproto-dpif: Have lookup_input_bundle() return a bundle.
Previously, the function returned an "ofport_dpif", but it makes more sense to return an "ofbundle". This will also be helpful in a forthcoming commit. Signed-off-by: Justin Pettit <jpettit@nicira.com>
Diffstat (limited to 'ofproto')
-rw-r--r--ofproto/ofproto-dpif.c30
1 files changed, 12 insertions, 18 deletions
diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c
index aa845814..3fe9af02 100644
--- a/ofproto/ofproto-dpif.c
+++ b/ofproto/ofproto-dpif.c
@@ -176,8 +176,8 @@ static void bundle_destroy(struct ofbundle *);
static void bundle_del_port(struct ofport_dpif *);
static void bundle_run(struct ofbundle *);
static void bundle_wait(struct ofbundle *);
-static struct ofport_dpif *lookup_input_bundle(struct ofproto_dpif *,
- uint16_t in_port, bool warn);
+static struct ofbundle *lookup_input_bundle(struct ofproto_dpif *,
+ uint16_t in_port, bool warn);
static void stp_run(struct ofproto_dpif *ofproto);
static void stp_wait(struct ofproto_dpif *ofproto);
@@ -4974,22 +4974,17 @@ add_mirror_actions(struct action_xlate_ctx *ctx, const struct flow *orig_flow)
{
struct ofproto_dpif *ofproto = ctx->ofproto;
mirror_mask_t mirrors;
- struct ofport_dpif *in_port;
struct ofbundle *in_bundle;
uint16_t vlan;
uint16_t vid;
const struct nlattr *a;
size_t left;
- /* Obtain in_port from orig_flow.in_port.
- *
- * lookup_input_bundle() also ensures that in_port belongs to a bundle. */
- in_port = lookup_input_bundle(ctx->ofproto, orig_flow->in_port,
- ctx->packet != NULL);
- if (!in_port) {
+ in_bundle = lookup_input_bundle(ctx->ofproto, orig_flow->in_port,
+ ctx->packet != NULL);
+ if (!in_bundle) {
return;
}
- in_bundle = in_port->bundle;
mirrors = in_bundle->src_mirrors;
/* Drop frames on bundles reserved for mirroring. */
@@ -5140,7 +5135,7 @@ update_learning_table(struct ofproto_dpif *ofproto,
}
}
-static struct ofport_dpif *
+static struct ofbundle *
lookup_input_bundle(struct ofproto_dpif *ofproto, uint16_t in_port, bool warn)
{
struct ofport_dpif *ofport;
@@ -5148,7 +5143,7 @@ lookup_input_bundle(struct ofproto_dpif *ofproto, uint16_t in_port, bool warn)
/* Find the port and bundle for the received packet. */
ofport = get_ofp_port(ofproto, in_port);
if (ofport && ofport->bundle) {
- return ofport;
+ return ofport->bundle;
}
/* Odd. A few possible reasons here:
@@ -5232,15 +5227,14 @@ xlate_normal(struct action_xlate_ctx *ctx)
ctx->has_normal = true;
- /* Obtain in_port from ctx->flow.in_port.
- *
- * lookup_input_bundle() also ensures that in_port belongs to a bundle. */
- in_port = lookup_input_bundle(ctx->ofproto, ctx->flow.in_port,
+ in_bundle = lookup_input_bundle(ctx->ofproto, ctx->flow.in_port,
ctx->packet != NULL);
- if (!in_port) {
+ if (!in_bundle) {
return;
}
- in_bundle = in_port->bundle;
+
+ /* We know 'in_port' exists, since lookup_input_bundle() succeeded. */
+ in_port = get_ofp_port(ctx->ofproto, ctx->flow.in_port);
/* Drop malformed frames. */
if (ctx->flow.dl_type == htons(ETH_TYPE_VLAN) &&