Commit 88cc77eb authored by Bob Pearson's avatar Bob Pearson Committed by Jason Gunthorpe

RDMA/rxe: Fix misleading comments and names

The names and comments of the 'unlocked' pool APIs are very misleading and
not what was intended. This patch replaces 'rxe_xxx_nl' with
'rxe_xxx_locked' with comments indicating that the caller is expected to
hold the rxe pool lock.

Link: https://lore.kernel.org/r/20210125211641.2694-3-rpearson@hpe.comReported-by: default avatarHillf Danton <hdanton@sina.com>
Suggested-by: default avatarJason Gunthorpe <jgg@nvidia.com>
Signed-off-by: default avatarBob Pearson <rpearson@hpe.com>
Signed-off-by: default avatarJason Gunthorpe <jgg@nvidia.com>
parent c4369575
......@@ -15,18 +15,18 @@ static struct rxe_mc_grp *create_grp(struct rxe_dev *rxe,
int err;
struct rxe_mc_grp *grp;
grp = rxe_alloc_nl(&rxe->mc_grp_pool);
grp = rxe_alloc_locked(&rxe->mc_grp_pool);
if (!grp)
return ERR_PTR(-ENOMEM);
INIT_LIST_HEAD(&grp->qp_list);
spin_lock_init(&grp->mcg_lock);
grp->rxe = rxe;
rxe_add_key_nl(grp, mgid);
rxe_add_key_locked(grp, mgid);
err = rxe_mcast_add(rxe, mgid);
if (unlikely(err)) {
rxe_drop_key_nl(grp);
rxe_drop_key_locked(grp);
rxe_drop_ref(grp);
return ERR_PTR(err);
}
......@@ -47,7 +47,7 @@ int rxe_mcast_get_grp(struct rxe_dev *rxe, union ib_gid *mgid,
write_lock_irqsave(&pool->pool_lock, flags);
grp = rxe_pool_get_key_nl(pool, mgid);
grp = rxe_pool_get_key_locked(pool, mgid);
if (grp)
goto done;
......
......@@ -266,7 +266,7 @@ static void insert_key(struct rxe_pool *pool, struct rxe_pool_entry *new)
return;
}
void __rxe_add_key_nl(struct rxe_pool_entry *elem, void *key)
void __rxe_add_key_locked(struct rxe_pool_entry *elem, void *key)
{
struct rxe_pool *pool = elem->pool;
......@@ -280,11 +280,11 @@ void __rxe_add_key(struct rxe_pool_entry *elem, void *key)
unsigned long flags;
write_lock_irqsave(&pool->pool_lock, flags);
__rxe_add_key_nl(elem, key);
__rxe_add_key_locked(elem, key);
write_unlock_irqrestore(&pool->pool_lock, flags);
}
void __rxe_drop_key_nl(struct rxe_pool_entry *elem)
void __rxe_drop_key_locked(struct rxe_pool_entry *elem)
{
struct rxe_pool *pool = elem->pool;
......@@ -297,11 +297,11 @@ void __rxe_drop_key(struct rxe_pool_entry *elem)
unsigned long flags;
write_lock_irqsave(&pool->pool_lock, flags);
__rxe_drop_key_nl(elem);
__rxe_drop_key_locked(elem);
write_unlock_irqrestore(&pool->pool_lock, flags);
}
void __rxe_add_index_nl(struct rxe_pool_entry *elem)
void __rxe_add_index_locked(struct rxe_pool_entry *elem)
{
struct rxe_pool *pool = elem->pool;
......@@ -315,11 +315,11 @@ void __rxe_add_index(struct rxe_pool_entry *elem)
unsigned long flags;
write_lock_irqsave(&pool->pool_lock, flags);
__rxe_add_index_nl(elem);
__rxe_add_index_locked(elem);
write_unlock_irqrestore(&pool->pool_lock, flags);
}
void __rxe_drop_index_nl(struct rxe_pool_entry *elem)
void __rxe_drop_index_locked(struct rxe_pool_entry *elem)
{
struct rxe_pool *pool = elem->pool;
......@@ -333,11 +333,11 @@ void __rxe_drop_index(struct rxe_pool_entry *elem)
unsigned long flags;
write_lock_irqsave(&pool->pool_lock, flags);
__rxe_drop_index_nl(elem);
__rxe_drop_index_locked(elem);
write_unlock_irqrestore(&pool->pool_lock, flags);
}
void *rxe_alloc_nl(struct rxe_pool *pool)
void *rxe_alloc_locked(struct rxe_pool *pool)
{
struct rxe_type_info *info = &rxe_type_info[pool->type];
struct rxe_pool_entry *elem;
......@@ -507,7 +507,7 @@ void *rxe_pool_get_index(struct rxe_pool *pool, u32 index)
return obj;
}
void *rxe_pool_get_key_nl(struct rxe_pool *pool, void *key)
void *rxe_pool_get_key_locked(struct rxe_pool *pool, void *key)
{
struct rxe_type_info *info = &rxe_type_info[pool->type];
struct rb_node *node;
......@@ -551,7 +551,7 @@ void *rxe_pool_get_key(struct rxe_pool *pool, void *key)
unsigned long flags;
read_lock_irqsave(&pool->pool_lock, flags);
obj = rxe_pool_get_key_nl(pool, key);
obj = rxe_pool_get_key_locked(pool, key);
read_unlock_irqrestore(&pool->pool_lock, flags);
return obj;
......
......@@ -106,11 +106,10 @@ int rxe_pool_init(struct rxe_dev *rxe, struct rxe_pool *pool,
/* free resources from object pool */
void rxe_pool_cleanup(struct rxe_pool *pool);
/* allocate an object from pool */
void *rxe_alloc(struct rxe_pool *pool);
/* allocate an object from pool holding and not holding the pool lock */
void *rxe_alloc_locked(struct rxe_pool *pool);
/* allocate an object from pool - no lock */
void *rxe_alloc_nl(struct rxe_pool *pool);
void *rxe_alloc(struct rxe_pool *pool);
/* connect already allocated object to pool */
int __rxe_add_to_pool(struct rxe_pool *pool, struct rxe_pool_entry *elem);
......@@ -118,60 +117,60 @@ int __rxe_add_to_pool(struct rxe_pool *pool, struct rxe_pool_entry *elem);
#define rxe_add_to_pool(pool, obj) __rxe_add_to_pool(pool, &(obj)->pelem)
/* assign an index to an indexed object and insert object into
* pool's rb tree with and without holding the pool_lock
* pool's rb tree holding and not holding the pool_lock
*/
void __rxe_add_index(struct rxe_pool_entry *elem);
void __rxe_add_index_locked(struct rxe_pool_entry *elem);
#define rxe_add_index(obj) __rxe_add_index(&(obj)->pelem)
#define rxe_add_index_locked(obj) __rxe_add_index_locked(&(obj)->pelem)
void __rxe_add_index_nl(struct rxe_pool_entry *elem);
void __rxe_add_index(struct rxe_pool_entry *elem);
#define rxe_add_index_nl(obj) __rxe_add_index_nl(&(obj)->pelem)
#define rxe_add_index(obj) __rxe_add_index(&(obj)->pelem)
/* drop an index and remove object from rb tree
* with and without holding the pool_lock
* holding and not holding the pool_lock
*/
void __rxe_drop_index(struct rxe_pool_entry *elem);
void __rxe_drop_index_locked(struct rxe_pool_entry *elem);
#define rxe_drop_index(obj) __rxe_drop_index(&(obj)->pelem)
#define rxe_drop_index_locked(obj) __rxe_drop_index_locked(&(obj)->pelem)
void __rxe_drop_index_nl(struct rxe_pool_entry *elem);
void __rxe_drop_index(struct rxe_pool_entry *elem);
#define rxe_drop_index_nl(obj) __rxe_drop_index_nl(&(obj)->pelem)
#define rxe_drop_index(obj) __rxe_drop_index(&(obj)->pelem)
/* assign a key to a keyed object and insert object into
* pool's rb tree with and without holding pool_lock
* pool's rb tree holding and not holding pool_lock
*/
void __rxe_add_key_locked(struct rxe_pool_entry *elem, void *key);
#define rxe_add_key_locked(obj, key) __rxe_add_key_locked(&(obj)->pelem, key)
void __rxe_add_key(struct rxe_pool_entry *elem, void *key);
#define rxe_add_key(obj, key) __rxe_add_key(&(obj)->pelem, key)
void __rxe_add_key_nl(struct rxe_pool_entry *elem, void *key);
/* remove elem from rb tree holding and not holding the pool_lock */
void __rxe_drop_key_locked(struct rxe_pool_entry *elem);
#define rxe_add_key_nl(obj, key) __rxe_add_key_nl(&(obj)->pelem, key)
#define rxe_drop_key_locked(obj) __rxe_drop_key_locked(&(obj)->pelem)
/* remove elem from rb tree with and without holding pool_lock */
void __rxe_drop_key(struct rxe_pool_entry *elem);
#define rxe_drop_key(obj) __rxe_drop_key(&(obj)->pelem)
void __rxe_drop_key_nl(struct rxe_pool_entry *elem);
#define rxe_drop_key_nl(obj) __rxe_drop_key_nl(&(obj)->pelem)
/* lookup an indexed object from index with and without holding pool_lock.
/* lookup an indexed object from index holding and not holding the pool_lock.
* takes a reference on object
*/
void *rxe_pool_get_index(struct rxe_pool *pool, u32 index);
void *rxe_pool_get_index_locked(struct rxe_pool *pool, u32 index);
void *rxe_pool_get_index_nl(struct rxe_pool *pool, u32 index);
void *rxe_pool_get_index(struct rxe_pool *pool, u32 index);
/* lookup keyed object from key with and without holding pool_lock.
/* lookup keyed object from key holding and not holding the pool_lock.
* takes a reference on the objecti
*/
void *rxe_pool_get_key(struct rxe_pool *pool, void *key);
void *rxe_pool_get_key_locked(struct rxe_pool *pool, void *key);
void *rxe_pool_get_key_nl(struct rxe_pool *pool, void *key);
void *rxe_pool_get_key(struct rxe_pool *pool, void *key);
/* cleanup an object when all references are dropped */
void rxe_elem_release(struct kref *kref);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment