Pushed to master with changes as suggested.

Defined inline functions shown below, be32 variants were obsolete by earlier 
changes, so did not add them now.

+static inline uint32_t flow_u32_value(const struct flow *flow, size_t index)
+{
+    return ((uint32_t *)(flow))[index];
+}
+
+static inline uint32_t *flow_u32_lvalue(struct flow *flow, size_t index)
+{
+    return &((uint32_t *)(flow))[index];
+}
+

  Jarno

On Jun 13, 2014, at 10:26 AM, Ben Pfaff <b...@nicira.com> wrote:

> On Mon, Jun 09, 2014 at 11:53:52AM -0700, Jarno Rajahalme wrote:
>> When, during a classifier lookup, we narrow down to a single potential
>> rule, it is enough to match on ("unwildcard") one bit that differs
>> between the packet and the rule.
>> 
>> This is a special case of the more general algorithm, where it is
>> sufficient to match on enough bits that separates the packet from all
>> higher priority rules than the matched rule.  For a miss that would be
>> all the rules.  Implementing this is expensive for a more than a few
>> rules.  This patch starts by doing this for a single rule when we
>> already have it, also reducing the lookup cost by finishing the lookup
>> earlier than before.
>> 
>> Signed-off-by: Jarno Rajahalme <jrajaha...@nicira.com>
> 
> FLOW_U32_VALUE and FLOW_BE32_VALUE are not type-safe, since they are
> willing to cast absolutely anything to uint32_t * or ovs_be32 *.  If
> you made them inline functions that take a "struct flow *", then they
> could return a pointer to uint32_t or ovs_be32 for the caller to
> dereference and have some type safety.
> 
> Acked-by: Ben Pfaff <b...@nicira.com>
> 

_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to