MCPcopy Create free account
hub / github.com/F-Stack/f-stack / bitmap_alloc0

Function bitmap_alloc0

dpdk/drivers/net/mlx5/hws/mlx5dr_buddy.c:10–36  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8#include "mlx5dr_buddy.h"
9
10static 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
33err_mem_alloc:
34 rte_free(mem);
35 return NULL;
36}
37
38static void bitmap_set_bit(struct rte_bitmap *bmp, uint32_t pos)
39{

Callers 1

mlx5dr_buddy_initFunction · 0.85

Calls 4

rte_zmallocFunction · 0.85
rte_bitmap_initFunction · 0.85
rte_freeFunction · 0.85

Tested by

no test coverage detected