linux/drivers/infiniband/sw/rxe/rxe_pool.h

/* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */
/*
 * Copyright (c) 2016 Mellanox Technologies Ltd. All rights reserved.
 * Copyright (c) 2015 System Fabric Works, Inc. All rights reserved.
 */

#ifndef RXE_POOL_H
#define RXE_POOL_H

enum rxe_elem_type {};

struct rxe_pool_elem {};

struct rxe_pool {};

/* initialize a pool of objects with given limit on
 * number of elements. gets parameters from rxe_type_info
 * pool elements will be allocated out of a slab cache
 */
void rxe_pool_init(struct rxe_dev *rxe, struct rxe_pool *pool,
		  enum rxe_elem_type type);

/* free resources from object pool */
void rxe_pool_cleanup(struct rxe_pool *pool);

/* connect already allocated object to pool */
int __rxe_add_to_pool(struct rxe_pool *pool, struct rxe_pool_elem *elem,
				bool sleepable);
#define rxe_add_to_pool(pool, obj)
#define rxe_add_to_pool_ah(pool, obj, sleepable)

/* lookup an indexed object from index. takes a reference on object */
void *rxe_pool_get_index(struct rxe_pool *pool, u32 index);

int __rxe_get(struct rxe_pool_elem *elem);
#define rxe_get(obj)

int __rxe_put(struct rxe_pool_elem *elem);
#define rxe_put(obj)

int __rxe_cleanup(struct rxe_pool_elem *elem, bool sleepable);
#define rxe_cleanup(obj)
#define rxe_cleanup_ah(obj, sleepable)

#define rxe_read(obj)

void __rxe_finalize(struct rxe_pool_elem *elem);
#define rxe_finalize(obj)

#endif /* RXE_POOL_H */