| 8 | #include "mlx5dr_buddy.h" |
| 9 | |
| 10 | static struct rte_bitmap *bitmap_alloc0(int s) |
| 11 | { |
| 12 | struct rte_bitmap *bitmap; |
| 13 | uint32_t bmp_size; |
| 14 | void *mem; |
| 15 | |
| 16 | bmp_size = rte_bitmap_get_memory_footprint(s); |
| 17 | mem = rte_zmalloc("create_bmap", bmp_size, RTE_CACHE_LINE_SIZE); |
| 18 | if (!mem) { |
| 19 | DR_LOG(ERR, "No mem for bitmap"); |
| 20 | rte_errno = ENOMEM; |
| 21 | return NULL; |
| 22 | } |
| 23 | |
| 24 | bitmap = rte_bitmap_init(s, mem, bmp_size); |
| 25 | if (!bitmap) { |
| 26 | DR_LOG(ERR, "%s Failed to initialize bitmap", __func__); |
| 27 | rte_errno = EINVAL; |
| 28 | goto err_mem_alloc; |
| 29 | } |
| 30 | |
| 31 | return bitmap; |
| 32 | |
| 33 | err_mem_alloc: |
| 34 | rte_free(mem); |
| 35 | return NULL; |
| 36 | } |
| 37 | |
| 38 | static void bitmap_set_bit(struct rte_bitmap *bmp, uint32_t pos) |
| 39 | { |
no test coverage detected