2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-31 06:15:47 +00:00

nicra-ext: New action NXAST_OUTPUT_REG.

The NXAST_OUTPUT_REG action outputs to the OpenFlow port contained
in a supplied NXM field.
This commit is contained in:
Ethan Jackson
2011-08-10 13:05:17 -07:00
parent e7ba48c87d
commit f694937d4e
10 changed files with 137 additions and 4 deletions

View File

@@ -316,6 +316,27 @@ parse_port_name(const char *name, uint16_t *port)
return false;
}
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)
{
@@ -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);