swh:1:snp:173f8deb0c56c557784b4fd217e7608ac6197844
Raw File
Tip revision: a9c9a6f741cdaa2fa9ba24a790db8d07295761e3 authored by Linus Torvalds on 02 September 2021, 22:09:46 UTC
Merge tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi
Tip revision: a9c9a6f
hwbm.h
/* SPDX-License-Identifier: GPL-2.0 */
#ifndef _HWBM_H
#define _HWBM_H

struct hwbm_pool {
	/* Capacity of the pool */
	int size;
	/* Size of the buffers managed */
	int frag_size;
	/* Number of buffers currently used by this pool */
	int buf_num;
	/* constructor called during alocation */
	int (*construct)(struct hwbm_pool *bm_pool, void *buf);
	/* protect acces to the buffer counter*/
	struct mutex buf_lock;
	/* private data */
	void *priv;
};
#ifdef CONFIG_HWBM
void hwbm_buf_free(struct hwbm_pool *bm_pool, void *buf);
int hwbm_pool_refill(struct hwbm_pool *bm_pool, gfp_t gfp);
int hwbm_pool_add(struct hwbm_pool *bm_pool, unsigned int buf_num);
#else
static inline void hwbm_buf_free(struct hwbm_pool *bm_pool, void *buf) {}

static inline int hwbm_pool_refill(struct hwbm_pool *bm_pool, gfp_t gfp)
{ return 0; }

static inline int hwbm_pool_add(struct hwbm_pool *bm_pool,
				unsigned int buf_num)
{ return 0; }
#endif /* CONFIG_HWBM */
#endif /* _HWBM_H */
back to top