From 3646e396e52dac9b3bc671518d5af7a0c2f89fee Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Sat, 18 Jul 2015 18:29:18 -0700 Subject: actions: Allow caller to specify output table. When an upcoming commit divides the pipeline up into ingress and egress pipeline, it will become necessary to resubmit to different tables from each of those pipelines to implement output. This commit makes that possible. Signed-off-by: Ben Pfaff Acked-by: Justin Pettit --- ovn/controller/lflow.c | 2 +- ovn/lib/actions.c | 16 +++++++++++----- ovn/lib/actions.h | 6 ++++-- 3 files changed, 16 insertions(+), 8 deletions(-) (limited to 'ovn') diff --git a/ovn/controller/lflow.c b/ovn/controller/lflow.c index bb2e7d1f0..2793293c5 100644 --- a/ovn/controller/lflow.c +++ b/ovn/controller/lflow.c @@ -283,7 +283,7 @@ lflow_run(struct controller_ctx *ctx, struct hmap *flow_table) ofpbuf_use_stub(&ofpacts, ofpacts_stub, sizeof ofpacts_stub); next_table_id = lflow->table_id < 31 ? lflow->table_id + 17 : 0; error = actions_parse_string(lflow->actions, &symtab, &ldp->ports, - next_table_id, &ofpacts, &prereqs); + next_table_id, 64, &ofpacts, &prereqs); if (error) { static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 1); VLOG_WARN_RL(&rl, "error parsing actions \"%s\": %s", diff --git a/ovn/lib/actions.c b/ovn/lib/actions.c index ea8dfc9e8..0a0158a50 100644 --- a/ovn/lib/actions.c +++ b/ovn/lib/actions.c @@ -31,6 +31,7 @@ struct action_context { struct lexer *lexer; /* Lexer for pulling more tokens. */ const struct shash *symtab; /* Symbol table. */ uint8_t next_table_id; /* OpenFlow table for 'next' to resubmit. */ + uint8_t output_table_id; /* OpenFlow table for 'output' to resubmit. */ const struct simap *ports; /* Map from port name to number. */ /* State. */ @@ -161,8 +162,7 @@ parse_actions(struct action_context *ctx) action_error(ctx, "\"next\" action not allowed here."); } } else if (lexer_match_id(ctx->lexer, "output")) { - /* Table 64 does logical-to-physical translation. */ - emit_resubmit(ctx, 64); + emit_resubmit(ctx, ctx->output_table_id); } else { action_syntax_error(ctx, "expecting action"); } @@ -189,6 +189,9 @@ parse_actions(struct action_context *ctx) * 'next_table_id' should be the OpenFlow table to which the "next" action will * resubmit, or 0 to disable "next". * + * 'output_table_id' should be the OpenFlow table to which the "output" action + * will resubmit + * * Some actions add extra requirements (prerequisites) to the flow's match. If * so, this function sets '*prereqsp' to the actions' prerequisites; otherwise, * it sets '*prereqsp' to NULL. The caller owns '*prereqsp' and must @@ -202,7 +205,8 @@ parse_actions(struct action_context *ctx) char * OVS_WARN_UNUSED_RESULT actions_parse(struct lexer *lexer, const struct shash *symtab, const struct simap *ports, uint8_t next_table_id, - struct ofpbuf *ofpacts, struct expr **prereqsp) + uint8_t output_table_id, struct ofpbuf *ofpacts, + struct expr **prereqsp) { size_t ofpacts_start = ofpacts->size; @@ -211,6 +215,7 @@ actions_parse(struct lexer *lexer, const struct shash *symtab, ctx.symtab = symtab; ctx.ports = ports; ctx.next_table_id = next_table_id; + ctx.output_table_id = output_table_id; ctx.error = NULL; ctx.ofpacts = ofpacts; ctx.prereqs = NULL; @@ -232,7 +237,8 @@ actions_parse(struct lexer *lexer, const struct shash *symtab, char * OVS_WARN_UNUSED_RESULT actions_parse_string(const char *s, const struct shash *symtab, const struct simap *ports, uint8_t next_table_id, - struct ofpbuf *ofpacts, struct expr **prereqsp) + uint8_t output_table_id, struct ofpbuf *ofpacts, + struct expr **prereqsp) { struct lexer lexer; char *error; @@ -240,7 +246,7 @@ actions_parse_string(const char *s, const struct shash *symtab, lexer_init(&lexer, s); lexer_get(&lexer); error = actions_parse(&lexer, symtab, ports, next_table_id, - ofpacts, prereqsp); + output_table_id, ofpacts, prereqsp); lexer_destroy(&lexer); return error; diff --git a/ovn/lib/actions.h b/ovn/lib/actions.h index b44206183..74cd18548 100644 --- a/ovn/lib/actions.h +++ b/ovn/lib/actions.h @@ -28,11 +28,13 @@ struct simap; char *actions_parse(struct lexer *, const struct shash *symtab, const struct simap *ports, uint8_t next_table_id, - struct ofpbuf *ofpacts, struct expr **prereqsp) + uint8_t output_table_id, struct ofpbuf *ofpacts, + struct expr **prereqsp) OVS_WARN_UNUSED_RESULT; char *actions_parse_string(const char *s, const struct shash *symtab, const struct simap *ports, uint8_t next_table_id, - struct ofpbuf *ofpacts, struct expr **prereqsp) + uint8_t output_table_id, struct ofpbuf *ofpacts, + struct expr **prereqsp) OVS_WARN_UNUSED_RESULT; #endif /* ovn/actions.h */ -- cgit v1.2.1