mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-24 00:37:13 +07:00
6dcdd884e2
Based on review, `lock' is only acquired in hwbm_pool_add() which is invoked via ->probe(), ->resume() and ->ndo_change_mtu(). Based on this the lock can become a mutex and there is no need to disable interrupts during the procedure. Now that the lock is a mutex, hwbm_pool_add() no longer invokes hwbm_pool_refill() in an atomic context so we can pass GFP_KERNEL to hwbm_pool_refill() and remove the `gfp' argument from hwbm_pool_add(). Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: David S. Miller <davem@davemloft.net>
30 lines
921 B
C
30 lines
921 B
C
/* 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
|
|
void hwbm_buf_free(struct hwbm_pool *bm_pool, void *buf) {}
|
|
int hwbm_pool_refill(struct hwbm_pool *bm_pool, gfp_t gfp) { return 0; }
|
|
int hwbm_pool_add(struct hwbm_pool *bm_pool, unsigned int buf_num)
|
|
{ return 0; }
|
|
#endif /* CONFIG_HWBM */
|
|
#endif /* _HWBM_H */
|