2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-31 14:25:26 +00:00

meta-flow: Add convenience members to union mf_subvalue.

This makes access to the least-significant bits more convenient.  This
commit simplifies a few existing cases; later commits will make more use
of this feature.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Russell Bryant <rbryant@redhat.com>
This commit is contained in:
Ben Pfaff
2015-02-25 09:33:54 -08:00
parent c1f4da6348
commit 5d867be038
2 changed files with 18 additions and 4 deletions

View File

@@ -148,8 +148,7 @@ learn_execute(const struct ofpact_learn *learn, const struct flow *flow,
case NX_LEARN_DST_OUTPUT:
if (spec->n_bits <= 16
|| is_all_zeros(value.u8, sizeof value - 2)) {
ovs_be16 *last_be16 = &value.be16[ARRAY_SIZE(value.be16) - 1];
ofp_port_t port = u16_to_ofp(ntohs(*last_be16));
ofp_port_t port = u16_to_ofp(ntohll(value.integer));
if (ofp_to_u16(port) < ofp_to_u16(OFPP_MAX)
|| port == OFPP_IN_PORT
@@ -211,8 +210,7 @@ learn_parse_load_immediate(const char *s, struct ofpact_learn_spec *spec)
}
s = arrow;
} else {
ovs_be64 *last_be64 = &imm.be64[ARRAY_SIZE(imm.be64) - 1];
*last_be64 = htonll(strtoull(s, (char **) &s, 0));
imm.integer = htonll(strtoull(s, (char **) &s, 0));
}
if (strncmp(s, "->", 2)) {