| 1 |
/* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */ |
| 2 |
/* Copyright (c) 2024 NVIDIA Corporation & Affiliates */ |
| 3 |
|
| 4 |
#ifndef HWS_BUDDY_H_ |
| 5 |
#define HWS_BUDDY_H_ |
| 6 |
|
| 7 |
struct mlx5hws_buddy_mem { |
| 8 |
unsigned long **bitmap; |
| 9 |
unsigned int *num_free; |
| 10 |
u32 max_order; |
| 11 |
}; |
| 12 |
|
| 13 |
struct mlx5hws_buddy_mem *mlx5hws_buddy_create(u32 max_order); |
| 14 |
|
| 15 |
void mlx5hws_buddy_cleanup(struct mlx5hws_buddy_mem *buddy); |
| 16 |
|
| 17 |
int mlx5hws_buddy_alloc_mem(struct mlx5hws_buddy_mem *buddy, u32 order); |
| 18 |
|
| 19 |
void mlx5hws_buddy_free_mem(struct mlx5hws_buddy_mem *buddy, u32 seg, u32 order); |
| 20 |
|
| 21 |
#endif /* HWS_BUDDY_H_ */ |