RDMA/core: Add an rb_tree that stores cm_ids sorted by ifindex and remote IP
authorPatrisious Haddad <phaddad@nvidia.com>
Tue, 7 Jun 2022 11:32:43 +0000 (14:32 +0300)
committerLeon Romanovsky <leonro@nvidia.com>
Thu, 16 Jun 2022 06:54:35 +0000 (09:54 +0300)
commitfc008bdbf1cd02e36bbfe53ea006b258335d908e
tree4f55c1946cd4639dbd3f59021fdfb906ecb5bbcf
parent158e71bb69e368b8b33e8b7c4ac8c111da0c1ae2
RDMA/core: Add an rb_tree that stores cm_ids sorted by ifindex and remote IP

Add to the cma, a tree that keeps track of all rdma_id_private channels
that were created while in RoCE mode.

The IDs are sorted first according to their netdevice ifindex then their
destination IP. And for IDs with matching IP they would be at the same node
in the tree, since the tree data is a list of all ids with matching destination IP.

The tree allows fast and efficient lookup of ids using an ifindex and
IP address which is useful for identifying relevant net_events promptly.

Link: https://lore.kernel.org/r/2fac52c86cc918c634ab24b3867d4aed992f54ec.1654601342.git.leonro@nvidia.com
Signed-off-by: Patrisious Haddad <phaddad@nvidia.com>
Reviewed-by: Mark Zhang <markzhang@nvidia.com>
Signed-off-by: Leon Romanovsky <leon@kernel.org>
drivers/infiniband/core/cma.c
drivers/infiniband/core/cma_priv.h