2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-29 13:27:59 +00:00

ofp-util: Update OpenFlow 1.6 port support to track latest proposal.

The latest updates to the OpenFlow 1.6 proposal removes the hw_addr_type
fields from ofp_port and ofp_port_mod.  This commit updates the OVS
prototype to match the updated proposal.

ONF-JIRA: EXT-566
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Yi-Hung Wei <yihung.wei@gmail.com>
This commit is contained in:
Ben Pfaff 2017-07-14 12:51:43 -07:00
parent 25d6792997
commit cd738eefbf
2 changed files with 10 additions and 38 deletions

View File

@ -55,18 +55,12 @@
#define OFP16_MAX_PORT_NAME_LEN 64 #define OFP16_MAX_PORT_NAME_LEN 64
/* Bitmap of hardware address types supported by an OpenFlow port. */
enum ofp16_hardware_address_type {
OFPPHAT16_EUI48 = 1 << 0, /* 48-bit Ethernet address. */
OFPPHAT16_EUI64 = 1 << 1, /* 64-bit Ethernet address. */
};
struct ofp16_port { struct ofp16_port {
ovs_be32 port_no; ovs_be32 port_no;
ovs_be16 length; ovs_be16 length;
ovs_be16 hw_addr_type; /* Zero or more OFPPHAT16_*. */
struct eth_addr hw_addr; /* EUI-48 hardware address. */
uint8_t pad[2]; /* Align to 64 bits. */ uint8_t pad[2]; /* Align to 64 bits. */
struct eth_addr hw_addr; /* EUI-48 hardware address. */
uint8_t pad2[2]; /* Align to 64 bits. */
struct eth_addr64 hw_addr64; /* EUI-64 hardware address */ struct eth_addr64 hw_addr64; /* EUI-64 hardware address */
char name[OFP16_MAX_PORT_NAME_LEN]; /* Null-terminated */ char name[OFP16_MAX_PORT_NAME_LEN]; /* Null-terminated */
@ -80,8 +74,7 @@ OFP_ASSERT(sizeof(struct ofp16_port) == 96);
struct ofp16_port_mod { struct ofp16_port_mod {
ovs_be32 port_no; ovs_be32 port_no;
ovs_be16 hw_addr_type; /* Zero or more OFPPHAT16_*. */ uint8_t pad[4]; /* Align to 64 bits. */
uint8_t pad[2]; /* Align to 64 bits. */
struct eth_addr hw_addr; struct eth_addr hw_addr;
uint8_t pad2[2]; uint8_t pad2[2];
struct eth_addr64 hw_addr64; /* EUI-64 hardware address */ struct eth_addr64 hw_addr64; /* EUI-64 hardware address */

View File

@ -4517,12 +4517,8 @@ ofputil_pull_ofp16_port(struct ofputil_phy_port *pp, struct ofpbuf *msg)
if (error) { if (error) {
return error; return error;
} }
if (op->hw_addr_type & htons(OFPPHAT16_EUI48)) { pp->hw_addr = op->hw_addr;
pp->hw_addr = op->hw_addr; pp->hw_addr64 = op->hw_addr64;
}
if (op->hw_addr_type & htons(OFPPHAT16_EUI64)) {
pp->hw_addr64 = op->hw_addr64;
}
ovs_strlcpy_arrays(pp->name, op->name); ovs_strlcpy_arrays(pp->name, op->name);
pp->config = ntohl(op->config) & OFPPC11_ALL; pp->config = ntohl(op->config) & OFPPC11_ALL;
@ -4616,14 +4612,8 @@ ofputil_put_ofp16_port(const struct ofputil_phy_port *pp, struct ofpbuf *b)
op = ofpbuf_put_zeros(b, sizeof *op); op = ofpbuf_put_zeros(b, sizeof *op);
op->port_no = ofputil_port_to_ofp11(pp->port_no); op->port_no = ofputil_port_to_ofp11(pp->port_no);
op->length = htons(sizeof *op + sizeof *eth); op->length = htons(sizeof *op + sizeof *eth);
if (!eth_addr_is_zero(pp->hw_addr)) { op->hw_addr = pp->hw_addr;
op->hw_addr_type |= htons(OFPPHAT16_EUI48); op->hw_addr64 = pp->hw_addr64;
op->hw_addr = pp->hw_addr;
}
if (!eth_addr64_is_zero(pp->hw_addr64)) {
op->hw_addr_type |= htons(OFPPHAT16_EUI64);
op->hw_addr64 = pp->hw_addr64;
}
ovs_strlcpy_arrays(op->name, pp->name); ovs_strlcpy_arrays(op->name, pp->name);
op->config = htonl(pp->config & OFPPC11_ALL); op->config = htonl(pp->config & OFPPC11_ALL);
op->state = htonl(pp->state & OFPPS11_ALL); op->state = htonl(pp->state & OFPPS11_ALL);
@ -5180,13 +5170,8 @@ ofputil_decode_ofp16_port_mod(struct ofpbuf *b, bool loose,
return error; return error;
} }
if (opm->hw_addr_type & htons(OFPPHAT16_EUI48)) {
pm->hw_addr = opm->hw_addr;
}
if (opm->hw_addr_type & htons(OFPPHAT16_EUI64)) {
pm->hw_addr64 = opm->hw_addr64;
}
pm->hw_addr = opm->hw_addr; pm->hw_addr = opm->hw_addr;
pm->hw_addr64 = opm->hw_addr64;
pm->config = ntohl(opm->config) & OFPPC11_ALL; pm->config = ntohl(opm->config) & OFPPC11_ALL;
pm->mask = ntohl(opm->mask) & OFPPC11_ALL; pm->mask = ntohl(opm->mask) & OFPPC11_ALL;
@ -5282,14 +5267,8 @@ ofputil_encode_port_mod(const struct ofputil_port_mod *pm,
b = ofpraw_alloc(OFPRAW_OFPT16_PORT_MOD, ofp_version, 0); b = ofpraw_alloc(OFPRAW_OFPT16_PORT_MOD, ofp_version, 0);
opm = ofpbuf_put_zeros(b, sizeof *opm); opm = ofpbuf_put_zeros(b, sizeof *opm);
opm->port_no = ofputil_port_to_ofp11(pm->port_no); opm->port_no = ofputil_port_to_ofp11(pm->port_no);
if (!eth_addr_is_zero(pm->hw_addr)) { opm->hw_addr = pm->hw_addr;
opm->hw_addr_type |= htons(OFPPHAT16_EUI48); opm->hw_addr64 = pm->hw_addr64;
opm->hw_addr = pm->hw_addr;
}
if (!eth_addr64_is_zero(pm->hw_addr64)) {
opm->hw_addr_type |= htons(OFPPHAT16_EUI64);
opm->hw_addr64 = pm->hw_addr64;
}
opm->config = htonl(pm->config & OFPPC11_ALL); opm->config = htonl(pm->config & OFPPC11_ALL);
opm->mask = htonl(pm->mask & OFPPC11_ALL); opm->mask = htonl(pm->mask & OFPPC11_ALL);