On Tue, Sep 10, 2013 at 09:17:10AM -0700, Andy Zhou wrote: > I don't think OFPTC11_TABLE_MISS_MASK is a possible value. It is there to > simply indicate there are 2 bits used for miss configuration. May be it > should be outside of the enum definition?
I agree that OFPTC11_TABLE_MISS_MASK isn't a possible value. I would be quite happy for it to move outside the enum. I would also not be terribly upset if my patch was just dropped as to some extent it does make sense for OFPTC11_TABLE_MISS_MASK to be inside the enum and for the reason you point out that somewhat diminishes the value of my change. > > > On Sun, Sep 8, 2013 at 6:28 PM, Simon Horman <ho...@verge.net.au> wrote: > > > It seems convenient and in keeping with other Open vSwtich code to use enum > > ofp11_table_config as the type of the config field in struct > > ofputil_table_mod. > > > > Although the presence of OFPTC11_TABLE_MISS_MASK and need to use it as a > > mask seems to make things a little untidy. And there only seems to be one > > location the enum is currently useful. None the less this ought to help the > > compiler to help us to make sure all cases continue to be covered in > > future. > > > > Signed-off-by: Simon Horman <ho...@verge.net.au> > > --- > > lib/ofp-print.c | 7 +++++-- > > lib/ofp-util.h | 2 +- > > 2 files changed, 6 insertions(+), 3 deletions(-) > > > > diff --git a/lib/ofp-print.c b/lib/ofp-print.c > > index c0553af..0bc44a3 100644 > > --- a/lib/ofp-print.c > > +++ b/lib/ofp-print.c > > @@ -965,9 +965,11 @@ ofp_print_port_mod(struct ds *string, const struct > > ofp_header *oh) > > } > > > > static void > > -ofp_print_table_miss_config(struct ds *string, const uint32_t config) > > +ofp_print_table_miss_config(struct ds *string, > > + const enum ofp11_table_config config) > > { > > - uint32_t table_miss_config = config & OFPTC11_TABLE_MISS_MASK; > > + enum ofp11_table_config table_miss_config = > > + config & OFPTC11_TABLE_MISS_MASK; > > > > switch (table_miss_config) { > > case OFPTC11_TABLE_MISS_CONTROLLER: > > @@ -979,6 +981,7 @@ ofp_print_table_miss_config(struct ds *string, const > > uint32_t config) > > case OFPTC11_TABLE_MISS_DROP: > > ds_put_cstr(string, "drop\n"); > > break; > > + case OFPTC11_TABLE_MISS_MASK: > > default: > > ds_put_cstr(string, "Unknown\n"); > > break; > > diff --git a/lib/ofp-util.h b/lib/ofp-util.h > > index 0ca483c..4d7f2d5 100644 > > --- a/lib/ofp-util.h > > +++ b/lib/ofp-util.h > > @@ -568,7 +568,7 @@ struct ofpbuf *ofputil_encode_port_mod(const struct > > ofputil_port_mod *, > > /* Abstract ofp_table_mod. */ > > struct ofputil_table_mod { > > uint8_t table_id; /* ID of the table, 0xff indicates all > > tables. */ > > - uint32_t config; > > + enum ofp11_table_config config; > > }; > > > > enum ofperr ofputil_decode_table_mod(const struct ofp_header *, > > -- > > 1.8.4 > > > > _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev