What if we just make ofp_port_t 32 bits? That has to be the long-term trend anyway because OpenFlow 1.1+ uses a 32-bit port number. The following passes all the unit tests on i386 (though I haven't carefully looked at all the uses of ofp_port_t), what about big-endian systems?
diff --git a/include/openvswitch/flow.h b/include/openvswitch/flow.h index 6f08f3a..03d406b 100644 --- a/include/openvswitch/flow.h +++ b/include/openvswitch/flow.h @@ -92,7 +92,6 @@ struct flow { ovs_u128 ct_label; /* Connection label. */ uint32_t conj_id; /* Conjunction ID. */ ofp_port_t actset_output; /* Output port in action set. */ - uint8_t pad2[2]; /* Pad to 64 bits. */ /* L2, Order the same as in the Ethernet header! (64-bit aligned) */ struct eth_addr dl_dst; /* Ethernet destination address. */ diff --git a/include/openvswitch/types.h b/include/openvswitch/types.h index 5f3347d..3f1dc8e 100644 --- a/include/openvswitch/types.h +++ b/include/openvswitch/types.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2011, 2013, 2014 Nicira, Inc. + * Copyright (c) 2010, 2011, 2013, 2014, 2016 Nicira, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -117,7 +117,7 @@ typedef struct { /* ofp_port_t represents the port number of a OpenFlow switch. * odp_port_t represents the port number on the datapath. * ofp11_port_t represents the OpenFlow-1.1 port number. */ -typedef uint16_t OVS_BITWISE ofp_port_t; +typedef uint32_t OVS_BITWISE ofp_port_t; typedef uint32_t OVS_BITWISE odp_port_t; typedef uint32_t OVS_BITWISE ofp11_port_t; diff --git a/lib/ofp-actions.c b/lib/ofp-actions.c index 10ef3ea..d17c55b 100644 --- a/lib/ofp-actions.c +++ b/lib/ofp-actions.c @@ -1257,7 +1257,7 @@ decode_bundle(bool load, const struct nx_action_bundle *nab, } for (i = 0; i < bundle->n_slaves; i++) { - uint16_t ofp_port = ntohs(((ovs_be16 *)(nab + 1))[i]); + ofp_port_t ofp_port = ntohs(((ovs_be16 *)(nab + 1))[i]); ofpbuf_put(ofpacts, &ofp_port, sizeof ofp_port); bundle = ofpacts->header; } diff --git a/utilities/ovs-ofctl.c b/utilities/ovs-ofctl.c index a8116d9..207588b 100644 --- a/utilities/ovs-ofctl.c +++ b/utilities/ovs-ofctl.c @@ -3723,7 +3723,7 @@ ofctl_parse_pcap(struct ovs_cmdl_context *ctx) ovs_error(error, "%s: read failed", filename); } - pkt_metadata_init(&packet->md, ODPP_NONE); + pkt_metadata_init(&packet->md, u32_to_odp(ofp_to_u16(OFPP_ANY))); flow_extract(packet, &flow); flow_print(stdout, &flow); putchar('\n'); _______________________________________________ discuss mailing list discuss@openvswitch.org http://openvswitch.org/mailman/listinfo/discuss