Thanks. I don't think this one is useful on its own, so I'll maintain it in this series for now.
On Thu, Oct 30, 2014 at 04:35:25PM -0700, Jarno Rajahalme wrote: > Acked-by: Jarno Rajahalme <jrajaha...@nicira.com> > > On Oct 30, 2014, at 3:36 PM, Ben Pfaff <b...@nicira.com> wrote: > > > An upcoming commit will make classifier_lookup() sometimes modify its > > 'flow' argument temporarily during the lookup. > > > > Signed-off-by: Ben Pfaff <b...@nicira.com> > > --- > > v2: New patch. > > --- > > lib/classifier.c | 7 +++++-- > > lib/classifier.h | 3 +-- > > ofproto/ofproto-dpif.c | 15 ++++++++++----- > > ofproto/ofproto-dpif.h | 2 +- > > 4 files changed, 17 insertions(+), 10 deletions(-) > > > > diff --git a/lib/classifier.c b/lib/classifier.c > > index dab43ec..589d969 100644 > > --- a/lib/classifier.c > > +++ b/lib/classifier.c > > @@ -659,9 +659,12 @@ trie_ctx_init(struct trie_ctx *ctx, const struct > > cls_trie *trie) > > * If a rule is found and 'wc' is non-null, bitwise-OR's 'wc' with the > > * set of bits that were significant in the lookup. At some point > > * earlier, 'wc' should have been initialized (e.g., by > > - * flow_wildcards_init_catchall()). */ > > + * flow_wildcards_init_catchall()). > > + * > > + * 'flow' is non-const to allow for temporary modifications during the > > lookup. > > + * Any changes are restored before returning. */ > > struct cls_rule * > > -classifier_lookup(const struct classifier *cls, const struct flow *flow, > > +classifier_lookup(const struct classifier *cls, struct flow *flow, > > struct flow_wildcards *wc) > > { > > const struct cls_partition *partition; > > diff --git a/lib/classifier.h b/lib/classifier.h > > index 92be5bf..9ce2b83 100644 > > --- a/lib/classifier.h > > +++ b/lib/classifier.h > > @@ -292,8 +292,7 @@ struct cls_rule *classifier_replace(struct classifier > > *, struct cls_rule *); > > > > struct cls_rule *classifier_remove(struct classifier *, struct cls_rule *); > > struct cls_rule *classifier_lookup(const struct classifier *, > > - const struct flow *, > > - struct flow_wildcards *); > > + struct flow *, struct flow_wildcards *); > > bool classifier_rule_overlaps(const struct classifier *, > > const struct cls_rule *); > > > > diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c > > index d965d38..8e3500f 100644 > > --- a/ofproto/ofproto-dpif.c > > +++ b/ofproto/ofproto-dpif.c > > @@ -3644,10 +3644,13 @@ rule_dpif_lookup(struct ofproto_dpif *ofproto, > > struct flow *flow, > > > > /* The returned rule is valid at least until the next RCU quiescent period. > > * If the '*rule' needs to stay around longer, a non-zero 'take_ref' must be > > - * passed in to cause a reference to be taken on it before this returns. */ > > + * passed in to cause a reference to be taken on it before this returns. > > + * > > + * 'flow' is non-const to allow for temporary modifications during the > > lookup. > > + * Any changes are restored before returning. */ > > static struct rule_dpif * > > rule_dpif_lookup_in_table(struct ofproto_dpif *ofproto, uint8_t table_id, > > - const struct flow *flow, struct flow_wildcards > > *wc, > > + struct flow *flow, struct flow_wildcards *wc, > > bool take_ref) > > { > > struct classifier *cls = &ofproto->up.tables[table_id].cls; > > @@ -3724,11 +3727,13 @@ rule_dpif_lookup_in_table(struct ofproto_dpif > > *ofproto, uint8_t table_id, > > * The rule is returned in '*rule', which is valid at least until the next > > * RCU quiescent period. If the '*rule' needs to stay around longer, > > * a non-zero 'take_ref' must be passed in to cause a reference to be taken > > - * on it before this returns. */ > > + * on it before this returns. > > + * > > + * 'flow' is non-const to allow for temporary modifications during the > > lookup. > > + * Any changes are restored before returning. */ > > enum rule_dpif_lookup_verdict > > rule_dpif_lookup_from_table(struct ofproto_dpif *ofproto, > > - const struct flow *flow, > > - struct flow_wildcards *wc, > > + struct flow *flow, struct flow_wildcards *wc, > > bool honor_table_miss, > > uint8_t *table_id, struct rule_dpif **rule, > > bool take_ref, const struct dpif_flow_stats > > *stats) > > diff --git a/ofproto/ofproto-dpif.h b/ofproto/ofproto-dpif.h > > index a8c5d48..ba153fe 100644 > > --- a/ofproto/ofproto-dpif.h > > +++ b/ofproto/ofproto-dpif.h > > @@ -93,7 +93,7 @@ uint8_t rule_dpif_lookup(struct ofproto_dpif *, struct > > flow *, > > bool take_ref, const struct dpif_flow_stats *); > > > > enum rule_dpif_lookup_verdict rule_dpif_lookup_from_table(struct > > ofproto_dpif *, > > - const struct > > flow *, > > + struct flow *, > > struct > > flow_wildcards *, > > bool > > force_controller_on_miss, > > uint8_t *table_id, > > -- > > 1.7.10.4 > > > > _______________________________________________ > > dev mailing list > > dev@openvswitch.org > > http://openvswitch.org/mailman/listinfo/dev > _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev