[ovs-dev] [xlate v1 13/18] ofproto-dpif: Move tag_the_flow() to ofproto-dpif.c
Ethan Jackson
ethan at nicira.com
Tue Jun 25 01:59:27 UTC 2013
This will help disentangle ofproto-dpif and ofproto-dpif-xlate.
Signed-off-by: Ethan Jackson <ethan at nicira.com>
---
ofproto/ofproto-dpif-xlate.c | 24 ++++--------------------
ofproto/ofproto-dpif.c | 17 +++++++++++++++++
ofproto/ofproto-dpif.h | 3 ++-
3 files changed, 23 insertions(+), 21 deletions(-)
diff --git a/ofproto/ofproto-dpif-xlate.c b/ofproto/ofproto-dpif-xlate.c
index 852052a..df3e4b6 100644
--- a/ofproto/ofproto-dpif-xlate.c
+++ b/ofproto/ofproto-dpif-xlate.c
@@ -963,24 +963,6 @@ compose_output_action(struct xlate_ctx *ctx, ofp_port_t ofp_port)
compose_output_action__(ctx, ofp_port, true);
}
-static void
-tag_the_flow(struct xlate_ctx *ctx, struct rule_dpif *rule)
-{
- struct ofproto_dpif *ofproto = ctx->ofproto;
- uint8_t table_id = ctx->table_id;
-
- if (table_id > 0 && table_id < N_TABLES) {
- struct table_dpif *table = &ofproto->tables[table_id];
- if (table->other_table) {
- ctx->xout->tags |= (rule && rule->tag
- ? rule->tag
- : rule_calculate_tag(&ctx->xin->flow,
- &table->other_table->mask,
- table->basis));
- }
- }
-}
-
/* Common rule processing in one place to avoid duplicating code. */
static struct rule_dpif *
ctx_rule_hooks(struct xlate_ctx *ctx, struct rule_dpif *rule,
@@ -1021,7 +1003,8 @@ xlate_table_action(struct xlate_ctx *ctx,
rule = rule_dpif_lookup_in_table(ctx->ofproto, &ctx->xin->flow,
&ctx->xout->wc, table_id);
- tag_the_flow(ctx, rule);
+ ctx->xout->tags |= calculate_flow_tag(ctx->ofproto, &ctx->xin->flow,
+ ctx->table_id, rule);
/* Restore the original input port. Otherwise OFPP_NORMAL and
* OFPP_IN_PORT will have surprising behavior. */
@@ -1744,7 +1727,8 @@ do_xlate_actions(const struct ofpact *ofpacts, size_t ofpacts_len,
rule = rule_dpif_lookup_in_table(ctx->ofproto, flow, wc,
ctx->table_id);
- tag_the_flow(ctx, rule);
+ ctx->xout->tags = calculate_flow_tag(ctx->ofproto, &ctx->xin->flow,
+ ctx->table_id, rule);
rule = ctx_rule_hooks(ctx, rule, true);
diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c
index 77b9adf..06de3c6 100644
--- a/ofproto/ofproto-dpif.c
+++ b/ofproto/ofproto-dpif.c
@@ -5231,6 +5231,23 @@ put_userspace_action(const struct ofproto_dpif *ofproto,
return odp_put_userspace_action(pid, cookie, cookie_size, odp_actions);
}
+
+tag_type
+calculate_flow_tag(struct ofproto_dpif *ofproto, const struct flow *flow,
+ uint8_t table_id, struct rule_dpif *rule)
+{
+ if (table_id > 0 && table_id < N_TABLES) {
+ struct table_dpif *table = &ofproto->tables[table_id];
+ if (table->other_table) {
+ return (rule && rule->tag
+ ? rule->tag
+ : rule_calculate_tag(flow, &table->other_table->mask,
+ table->basis));
+ }
+ }
+
+ return 0;
+}
/* Optimized flow revalidation.
*
diff --git a/ofproto/ofproto-dpif.h b/ofproto/ofproto-dpif.h
index 952f3a2..421b77d 100644
--- a/ofproto/ofproto-dpif.h
+++ b/ofproto/ofproto-dpif.h
@@ -228,6 +228,7 @@ bool ofproto_dpif_dscp_from_priority(const struct ofport_dpif *,
uint32_t priority, uint8_t *dscp);
int ofproto_dpif_queue_to_priority(const struct ofproto_dpif *,
uint32_t queue_id, uint32_t *priority);
-
+tag_type calculate_flow_tag(struct ofproto_dpif *, const struct flow *,
+ uint8_t table_id, struct rule_dpif *);
#endif /* ofproto-dpif.h */
--
1.7.9.5
More information about the dev
mailing list