lpm: avoid race conditions for v1604
authorRuifeng Wang <ruifeng.wang@arm.com>
Thu, 18 Jul 2019 06:22:28 +0000 (14:22 +0800)
committerThomas Monjalon <thomas@monjalon.net>
Fri, 19 Jul 2019 10:37:03 +0000 (12:37 +0200)
commitdd728f9fe1ddb9aa80c26f8afc1dd641e0710618
tree8eb7ef9d15550779fe427d45bb18cd8bbad09c5a
parentc63d004bdd377717fc6a30c6ee9dc8bbd3ec2905
lpm: avoid race conditions for v1604

When a tbl8 group is getting attached to a tbl24 entry, lookup
might fail even though the entry is configured in the table.

For ex: consider a LPM table configured with 10.10.10.1/24.
When a new entry 10.10.10.32/28 is being added, a new tbl8
group is allocated and tbl24 entry is changed to point to
the tbl8 group. If the tbl24 entry is written without the tbl8
group entries updated, a lookup on 10.10.10.9 will return
failure.

Correct memory orderings are required to ensure that the
store to tbl24 does not happen before the stores to tbl8 group
entries complete.

The ordering patches in general have no notable impact on LPM
performance test on both Arm A72 platform and x86 E5 platform.

Signed-off-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
Signed-off-by: Ruifeng Wang <ruifeng.wang@arm.com>
Reviewed-by: Gavin Hu <gavin.hu@arm.com>
Acked-by: Vladimir Medvedkin <vladimir.medvedkin@intel.com>
lib/librte_lpm/rte_lpm.c
lib/librte_lpm/rte_lpm.h