[ovs-dev] [ext-244 3/4] Remove assumption that there are 64 or fewer fields.
Ben Pfaff
blp at nicira.com
Sat Jul 26 19:16:06 UTC 2014
On Sat, Jul 26, 2014 at 11:11:26AM -0700, Jarno Rajahalme wrote:
>
> On Jul 26, 2014, at 10:58 AM, Ben Pfaff <blp at nicira.com> wrote:
>
> > On Sat, Jul 26, 2014 at 10:41:34AM -0700, Jarno Rajahalme wrote:
> >>> On Jul 26, 2014, at 10:37 AM, Ben Pfaff <blp at nicira.com> wrote:
> >>> On Sat, Jul 26, 2014 at 08:47:56AM -0700, Jarno Rajahalme wrote:
> >>>>> - enum ofputil_protocol usable_protocols_bitwise;
> >>>>> + uint32_t usable_protocols_bitwise;
> >>>>
> >>>> These seem unrelated changes?
> >>>
> >>> This is actually a sticky point. Before this commit, meta-flow.h
> >>> includes ofp-util.h, to get "enum ofputil_protocol" for these two
> >>> members. After this commit, ofp-util.h includes meta-flow.h, to get
> >>> struct mf_bitmap. The circular dependency causes a problem. The best
> >>> solution I came up with was to change the "enum ofputil_protocol"
> >>> members to uint32_t. It's not a great solution. Do you have a good
> >>> idea?
> >>
> >> Can the enum be forward declared here instead?
> >
> > Standard C doesn't have incomplete enums. GNU C has them as an
> > extension, but they are not useful. From the GCC manual:
[...]
> Moving the definition of the enum to a third header file could be an
> option, but I think your compromise is a good one as well, especially
> if you add a comment near the supported protocols members explaining
> the relation to the enum.
Thanks. That is a good idea. I updated this code to:
/* Usable protocols.
*
* NXM and OXM are extensible, allowing later extensions to be sent in
* earlier protocol versions, so this does not necessarily correspond to
* the OpenFlow protocol version the field was introduced in.
* Also, some field types are tranparently mapped to each other via the
* struct flow (like vlan and dscp/tos fields), so each variant supports
* all protocols.
*
* These are combinations of OFPUTIL_P_*. (They are not declared as type
* enum ofputil_protocol because that would give meta-flow.h and ofp-util.h
* a circular dependency.) */
uint32_t usable_protocols; /* If fully/CIDR masked. */
uint32_t usable_protocols_bitwise; /* If partially/non-CIDR masked. */
More information about the dev
mailing list