summaryrefslogtreecommitdiff
path: root/lib/ofp-parse.c
diff options
context:
space:
mode:
authorEthan Jackson <ethan@nicira.com>2011-08-10 13:05:17 -0700
committerEthan Jackson <ethan@nicira.com>2011-08-12 15:06:53 -0700
commitf694937d4ec5342b218b760cabbf7a48d19110e8 (patch)
treec71bb913743019f99a69a80d76c8574963e036f5 /lib/ofp-parse.c
parente7ba48c87d5b6441e2a3f07f3bc1a1f3633616c7 (diff)
downloadopenvswitch-f694937d4ec5342b218b760cabbf7a48d19110e8.tar.gz
nicra-ext: New action NXAST_OUTPUT_REG.
The NXAST_OUTPUT_REG action outputs to the OpenFlow port contained in a supplied NXM field.
Diffstat (limited to 'lib/ofp-parse.c')
-rw-r--r--lib/ofp-parse.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/lib/ofp-parse.c b/lib/ofp-parse.c
index 89620a61a..e352bd436 100644
--- a/lib/ofp-parse.c
+++ b/lib/ofp-parse.c
@@ -317,6 +317,27 @@ parse_port_name(const char *name, uint16_t *port)
}
static void
+parse_output(struct ofpbuf *b, char *arg)
+{
+ if (strchr(arg, '[')) {
+ struct nx_action_output_reg *naor;
+ int ofs, n_bits;
+ uint32_t src;
+
+ nxm_parse_field_bits(arg, &src, &ofs, &n_bits);
+
+ naor = put_action(b, sizeof *naor, OFPAT_VENDOR);
+ naor->vendor = htonl(NX_VENDOR_ID);
+ naor->subtype = htons(NXAST_OUTPUT_REG);
+ naor->ofs_nbits = nxm_encode_ofs_nbits(ofs, n_bits);
+ naor->src = htonl(src);
+ naor->max_len = htons(UINT16_MAX);
+ } else {
+ put_output_action(b, str_to_u32(arg));
+ }
+}
+
+static void
parse_resubmit(struct nx_action_resubmit *nar, char *arg)
{
char *in_port_s, *table_s;
@@ -541,7 +562,7 @@ str_to_action(char *str, struct ofpbuf *b)
} else if (!strcasecmp(act, "bundle_load")) {
bundle_parse_load(b, arg);
} else if (!strcasecmp(act, "output")) {
- put_output_action(b, str_to_u32(arg));
+ parse_output(b, arg);
} else if (!strcasecmp(act, "enqueue")) {
char *sp = NULL;
char *port_s = strtok_r(arg, ":q", &sp);