summaryrefslogtreecommitdiff
path: root/ovn
diff options
context:
space:
mode:
authorBen Pfaff <blp@nicira.com>2015-07-18 18:29:18 -0700
committerBen Pfaff <blp@nicira.com>2015-08-03 11:38:36 -0700
commit3646e396e52dac9b3bc671518d5af7a0c2f89fee (patch)
tree766828c976ab3daa5c92e71dcd3e211d8351029f /ovn
parent48605550374524082dbee1f59b5e368f5c788a89 (diff)
downloadopenvswitch-3646e396e52dac9b3bc671518d5af7a0c2f89fee.tar.gz
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 <blp@nicira.com> Acked-by: Justin Pettit <jpettit@nicira.com>
Diffstat (limited to 'ovn')
-rw-r--r--ovn/controller/lflow.c2
-rw-r--r--ovn/lib/actions.c16
-rw-r--r--ovn/lib/actions.h6
3 files changed, 16 insertions, 8 deletions
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 */