[dpdk-dev] [PATCH] lib/librte_table: Fix table array lookup

Thomas Monjalon thomas.monjalon at 6wind.com
Tue Dec 16 18:59:27 CET 2014


Cristian, this patch is about packet framework.
Could you review it please?

2014-12-12 17:06, Mark Wunderlich:
> The existing lookup function was returning an unmodified
> pkts_mask bitmask into lookup_hit_mask.  This effectively
> assumes that all packets would index correctly into one
> of the array table entries.
> 
> Also, there was no check that the metadata provided index
> value was within range of the table max entries.  By using
> using table index bitmask on the metadata provided index
> the resulting entry position may falsely indicate a hit
> for index values provided that happen to be greter than
> the number of table entries.
> 
> Like other table type lookup functions it would seem that
> the possibility exists that some of the packets provided
> to the function would not result in a hit.  It is assumed
> that the metadata provided should be a direct index into
> the array table.  So, code was added to build and return
> a bitmask for only those packets that correctly index
> directly into the table array.
> 
> If the original intent for this table type was to accept
> any 32-bit value, then by applying the table index bitmask
> as a modulo index for distribution across table entries,
> then this patch would be invalid and should be rejected.
> 
> Signed-off-by: Mark Wunderlich <mark.w.wunderlich at intel.com>
> ---
>  lib/librte_table/rte_table_array.c |   25 +++++++++++++++----------
>  1 file changed, 15 insertions(+), 10 deletions(-)



More information about the dev mailing list