[ovs-dev] [PATCH] ofp-util: Update OpenFlow 1.6 port support to track latest proposal.

Ben Pfaff blp at ovn.org
Tue Oct 24 22:17:25 UTC 2017


This patch, from July, still applies and still needs a review.

On Fri, Jul 14, 2017 at 12:51:43PM -0700, Ben Pfaff wrote:
> 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 at ovn.org>
> ---
>  include/openflow/openflow-1.6.h | 13 +++----------
>  lib/ofp-util.c                  | 35 +++++++----------------------------
>  2 files changed, 10 insertions(+), 38 deletions(-)
> 
> diff --git a/include/openflow/openflow-1.6.h b/include/openflow/openflow-1.6.h
> index 1ba3cbd6fb3d..13c0b7bd5037 100644
> --- a/include/openflow/openflow-1.6.h
> +++ b/include/openflow/openflow-1.6.h
> @@ -55,18 +55,12 @@
>  
>  #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 {
>      ovs_be32 port_no;
>      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. */
> +    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 */
>      char name[OFP16_MAX_PORT_NAME_LEN]; /* Null-terminated */
>  
> @@ -80,8 +74,7 @@ OFP_ASSERT(sizeof(struct ofp16_port) == 96);
>  
>  struct ofp16_port_mod {
>      ovs_be32 port_no;
> -    ovs_be16 hw_addr_type;       /* Zero or more OFPPHAT16_*. */
> -    uint8_t pad[2];              /* Align to 64 bits. */
> +    uint8_t pad[4];              /* Align to 64 bits. */
>      struct eth_addr hw_addr;
>      uint8_t pad2[2];
>      struct eth_addr64 hw_addr64; /* EUI-64 hardware address */
> diff --git a/lib/ofp-util.c b/lib/ofp-util.c
> index 6052d3cc5f56..3e1ace1314c1 100644
> --- a/lib/ofp-util.c
> +++ b/lib/ofp-util.c
> @@ -4517,12 +4517,8 @@ ofputil_pull_ofp16_port(struct ofputil_phy_port *pp, struct ofpbuf *msg)
>      if (error) {
>          return error;
>      }
> -    if (op->hw_addr_type & htons(OFPPHAT16_EUI48)) {
> -        pp->hw_addr = op->hw_addr;
> -    }
> -    if (op->hw_addr_type & htons(OFPPHAT16_EUI64)) {
> -        pp->hw_addr64 = op->hw_addr64;
> -    }
> +    pp->hw_addr = op->hw_addr;
> +    pp->hw_addr64 = op->hw_addr64;
>      ovs_strlcpy_arrays(pp->name, op->name);
>  
>      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->port_no = ofputil_port_to_ofp11(pp->port_no);
>      op->length = htons(sizeof *op + sizeof *eth);
> -    if (!eth_addr_is_zero(pp->hw_addr)) {
> -        op->hw_addr_type |= htons(OFPPHAT16_EUI48);
> -        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;
> -    }
> +    op->hw_addr = pp->hw_addr;
> +    op->hw_addr64 = pp->hw_addr64;
>      ovs_strlcpy_arrays(op->name, pp->name);
>      op->config = htonl(pp->config & OFPPC11_ALL);
>      op->state = htonl(pp->state & OFPPS11_ALL);
> @@ -5180,13 +5170,8 @@ ofputil_decode_ofp16_port_mod(struct ofpbuf *b, bool loose,
>          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_addr64 = opm->hw_addr64;
>      pm->config = ntohl(opm->config) & 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);
>          opm = ofpbuf_put_zeros(b, sizeof *opm);
>          opm->port_no = ofputil_port_to_ofp11(pm->port_no);
> -        if (!eth_addr_is_zero(pm->hw_addr)) {
> -            opm->hw_addr_type |= htons(OFPPHAT16_EUI48);
> -            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->hw_addr = pm->hw_addr;
> +        opm->hw_addr64 = pm->hw_addr64;
>          opm->config = htonl(pm->config & OFPPC11_ALL);
>          opm->mask = htonl(pm->mask & OFPPC11_ALL);
>  
> -- 
> 2.10.2
> 


More information about the dev mailing list