[ovs-dev] [PATCH v2 1/2] lib/classifier: Simplify subtable array.
Ben Pfaff
blp at nicira.com
Thu May 22 16:58:51 UTC 2014
On Mon, May 19, 2014 at 12:35:45PM -0700, Jarno Rajahalme wrote:
> Do not cache the 'tag' and 'max_priority' in the subtable array. This
> makes later changes to classifier easier.
>
> Change CLS_SUBTABLES_FOR_EACH to iterate with a regular array index.
>
> Also makes the 'cls_subtables*' functions to always leave the
> subtables array in a consistent state. This includes the new
> cls_subtables_insert() function and removal of the old
> cls_subtables_push_back() function.
>
> Signed-off-by: Jarno Rajahalme <jrajahalme at nicira.com>
The casts to int in CLS_SUBTABLES_FOR_EACH_REVERSE are not so great.
One might avoid them with something like this:
#define CLS_SUBTABLES_FOR_EACH_REVERSE(SUBTABLE, INDEX, SUBTABLES) \
for ((INDEX) = (SUBTABLES)->count; \
(INDEX)-- > 0 && ((SUBTABLE) = (SUBTABLES)->array[INDEX], true); \
)
or alternatively one could use a predecrement on the [INDEX] instead
of a postdecrement on the > test.
That covers my comments from the previous revision. I didn't look at
the other code because I assumed that it didn't change much. Let me
know if I should look again.
Thanks,
Ben.
More information about the dev
mailing list