Merge tag 'kvm-s390-next-6.4-2' of https://git.kernel.org/pub/scm/linux/kernel/git...
[linux-block.git] / include / net / hwbm.h
CommitLineData
b2441318 1/* SPDX-License-Identifier: GPL-2.0 */
8cb2d8bf
GC
2#ifndef _HWBM_H
3#define _HWBM_H
4
949d6b40
JK
5#include <linux/mutex.h>
6
8cb2d8bf
GC
7struct hwbm_pool {
8 /* Capacity of the pool */
9 int size;
10 /* Size of the buffers managed */
11 int frag_size;
12 /* Number of buffers currently used by this pool */
13 int buf_num;
14 /* constructor called during alocation */
15 int (*construct)(struct hwbm_pool *bm_pool, void *buf);
16 /* protect acces to the buffer counter*/
6dcdd884 17 struct mutex buf_lock;
8cb2d8bf
GC
18 /* private data */
19 void *priv;
20};
21#ifdef CONFIG_HWBM
22void hwbm_buf_free(struct hwbm_pool *bm_pool, void *buf);
23int hwbm_pool_refill(struct hwbm_pool *bm_pool, gfp_t gfp);
6dcdd884 24int hwbm_pool_add(struct hwbm_pool *bm_pool, unsigned int buf_num);
8cb2d8bf 25#else
91e2e576
BDC
26static inline void hwbm_buf_free(struct hwbm_pool *bm_pool, void *buf) {}
27
28static inline int hwbm_pool_refill(struct hwbm_pool *bm_pool, gfp_t gfp)
29{ return 0; }
30
31static inline int hwbm_pool_add(struct hwbm_pool *bm_pool,
32 unsigned int buf_num)
8cb2d8bf
GC
33{ return 0; }
34#endif /* CONFIG_HWBM */
35#endif /* _HWBM_H */