Acked-by: Jarno Rajahalme <jrajaha...@nicira.com> Jarno
> On Jun 24, 2015, at 10:57 AM, Ben Pfaff <b...@nicira.com> wrote: > > OpenFlow provides no means to change the importance of a flow after it is > added, so make it immutable so that it is reasonable to read it without > locking. > > Signed-off-by: Ben Pfaff <b...@nicira.com> > --- > ofproto/ofproto-provider.h | 2 +- > ofproto/ofproto.c | 5 ++--- > 2 files changed, 3 insertions(+), 4 deletions(-) > > diff --git a/ofproto/ofproto-provider.h b/ofproto/ofproto-provider.h > index 527823a..495f787 100644 > --- a/ofproto/ofproto-provider.h > +++ b/ofproto/ofproto-provider.h > @@ -354,7 +354,7 @@ struct rule { > uint16_t idle_timeout OVS_GUARDED; /* In seconds from ->used. */ > > /* Eviction precedence. */ > - uint16_t importance OVS_GUARDED; > + const uint16_t importance; > > /* Removal reason for sending flow removed message. > * Used only if 'flags' has OFPUTIL_FF_SEND_FLOW_REM set and if the > diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c > index 278c97f..d48c31c 100644 > --- a/ofproto/ofproto.c > +++ b/ofproto/ofproto.c > @@ -4633,7 +4633,7 @@ replace_rule_create(struct ofproto *ofproto, struct > ofputil_flow_mod *fm, > ovs_mutex_lock(&rule->mutex); > rule->idle_timeout = fm->idle_timeout; > rule->hard_timeout = fm->hard_timeout; > - rule->importance = fm->importance; > + *CONST_CAST(uint16_t *, &rule->importance) = fm->importance; > rule->removed_reason = OVS_OFPRR_NONE; > > *CONST_CAST(uint8_t *, &rule->table_id) = table_id; > @@ -4649,7 +4649,6 @@ replace_rule_create(struct ofproto *ofproto, struct > ofputil_flow_mod *fm, > > /* Copy values from old rule for modify semantics. */ > if (old_rule && fm->delete_reason != OFPRR_EVICTION) { > - /* 'fm' says that */ > bool change_cookie = (fm->modify_cookie > && fm->new_cookie != OVS_BE64_MAX > && fm->new_cookie != old_rule->flow_cookie); > @@ -4658,7 +4657,7 @@ replace_rule_create(struct ofproto *ofproto, struct > ofputil_flow_mod *fm, > if (fm->command != OFPFC_ADD) { > rule->idle_timeout = old_rule->idle_timeout; > rule->hard_timeout = old_rule->hard_timeout; > - rule->importance = old_rule->importance; > + *CONST_CAST(uint16_t *, &rule->importance) = > old_rule->importance; > rule->flags = old_rule->flags; > rule->created = old_rule->created; > } > -- > 2.1.3 > > _______________________________________________ > dev mailing list > dev@openvswitch.org > http://openvswitch.org/mailman/listinfo/dev _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev