aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/mlx5
diff options
context:
space:
mode:
authorVlad Buslov <vladbu@mellanox.com>2018-07-24 16:37:40 +0300
committerSaeed Mahameed <saeedm@mellanox.com>2018-09-05 21:14:57 -0700
commit12d6066c3b29c5606c4a2466f964fbd9ede803c5 (patch)
treee59bff5027755fb2007712819af7837da8b69b88 /include/linux/mlx5
parentnet/mlx5: Store flow counters in a list (diff)
downloadlinux-dev-12d6066c3b29c5606c4a2466f964fbd9ede803c5.tar.xz
linux-dev-12d6066c3b29c5606c4a2466f964fbd9ede803c5.zip
net/mlx5: Add flow counters idr
Previous patch in series changed flow counter storage structure from rb_tree to linked list in order to improve flow counter traversal performance. The drawback of such solution is that flow counter lookup by id becomes linear in complexity. Store pointers to flow counters in idr in order to improve lookup performance to logarithmic again. Idr is non-intrusive data structure and doesn't require extending flow counter struct with new elements. This means that idr can be used for lookup, while linked list from previous patch is used for traversal, and struct mlx5_fc size is <= 2 cache lines. Signed-off-by: Vlad Buslov <vladbu@mellanox.com> Acked-by: Amir Vadai <amir@vadai.me> Reviewed-by: Paul Blakey <paulb@mellanox.com> Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
Diffstat (limited to 'include/linux/mlx5')
-rw-r--r--include/linux/mlx5/driver.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/include/linux/mlx5/driver.h b/include/linux/mlx5/driver.h
index 61bed33e6675..2a0c845f6bdb 100644
--- a/include/linux/mlx5/driver.h
+++ b/include/linux/mlx5/driver.h
@@ -583,6 +583,8 @@ struct mlx5_irq_info {
};
struct mlx5_fc_stats {
+ spinlock_t counters_idr_lock; /* protects counters_idr */
+ struct idr counters_idr;
struct list_head counters;
struct llist_head addlist;
struct llist_head dellist;