aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/ip/ip4_mtrie.c
diff options
context:
space:
mode:
authorjaszha03 <jason.zhang2@arm.com>2019-09-27 15:42:02 -0500
committerNeale Ranns <nranns@cisco.com>2019-10-29 16:12:24 +0000
commit04c0130f588eb11114c17d925a7a928c8f900b9b (patch)
tree78fb7f7ccee99ba4c96943620c35cf77cdbe3b2e /src/vnet/ip/ip4_mtrie.c
parent73f725c63c4924b29ebd54a78208b93114183d06 (diff)
ip: refactor ip4_mtrie to atomically unset leaves
ip4_mtrie set leaves atomically in set_leaf () and set_root_leaf () but deleted leaves using regular stores in unset_leaf () and unset_root_leaf (). Changed leaf deletion to update mtrie using atomic store-release. Slight performance improvement was observed in benchmarking on Qualcomm and Xeon machines. Benchmarking involved running 'ip route add' and 'ip route del' on vpp instances. Below are the routes/second for adding and deleting 100k routes before and after the store-release changes: Xeon Add Routes Before: 1.140e6, 1.139e6, 1.148e6, 1.158e6, 1.155e6 Xeon Add Routes After: 1.167e6, 1.170e6, 1.174e6, 1.173e6, 1.169e6 Xeon Del Routes Before: 7.287e7, 8.089e7, 6.048e7, 7.171e7, 7.821e7 Xeon Del Routes After: 8.729e7, 7.353e7, 7.856e7, 8.209e7, 7.787e7 Qualcomm Add Routes Before: 3.709e5, 3.954e5, 3.739e5, 3.759e5, 3.671e5 Qualcomm Add Routes After: 3.879e5, 3.967e5, 3.936e5, 3.764e5, 3.817e5 Qualcomm Del Routes Before: 1.286e7, 1.379e7, 1.353e7, 1.230e7, 1.331e7 Qualcomm Del Routes After: 1.411e7, 1.355e7, 1.373e7, 1.394e7, 1.314e7 Type: refactor Change-Id: If3acd25a2fb87addd0eb13d82d3c8f46579e8060 Signed-off-by: Jason Zhang <jason.zhang2@arm.com> Reviewed-by: Lijian Zhang <Lijian.Zhang@arm.com> Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
Diffstat (limited to 'src/vnet/ip/ip4_mtrie.c')
-rwxr-xr-xsrc/vnet/ip/ip4_mtrie.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/vnet/ip/ip4_mtrie.c b/src/vnet/ip/ip4_mtrie.c
index ef6a033be7d..be79883dde0 100755
--- a/src/vnet/ip/ip4_mtrie.c
+++ b/src/vnet/ip/ip4_mtrie.c
@@ -549,8 +549,9 @@ unset_leaf (ip4_fib_mtrie_t * m,
old_ply->n_non_empty_leafs -=
ip4_fib_mtrie_leaf_is_non_empty (old_ply, i);
- old_ply->leaves[i] =
- ip4_fib_mtrie_leaf_set_adj_index (a->cover_adj_index);
+ clib_atomic_store_rel_n (&old_ply->leaves[i],
+ ip4_fib_mtrie_leaf_set_adj_index
+ (a->cover_adj_index));
old_ply->dst_address_bits_of_leaves[i] = a->cover_address_length;
old_ply->n_non_empty_leafs +=
@@ -620,8 +621,9 @@ unset_root_leaf (ip4_fib_mtrie_t * m,
|| (!old_leaf_is_terminal
&& unset_leaf (m, a, get_next_ply_for_leaf (m, old_leaf), 2)))
{
- old_ply->leaves[slot] =
- ip4_fib_mtrie_leaf_set_adj_index (a->cover_adj_index);
+ clib_atomic_store_rel_n (&old_ply->leaves[slot],
+ ip4_fib_mtrie_leaf_set_adj_index
+ (a->cover_adj_index));
old_ply->dst_address_bits_of_leaves[slot] = a->cover_address_length;
}
}