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

Function rte_bitmap_init

dpdk/lib/eal/include/rte_bitmap.h:169–203  ·  view source on GitHub ↗

* Bitmap initialization * * @param n_bits * Number of pre-allocated bits in array2. * @param mem * Base address of array1 and array2. * @param mem_size * Minimum expected size of bitmap. * @return * Handle to bitmap instance. */

Source from the content-addressed store, hash-verified

167 * Handle to bitmap instance.
168 */
169static inline struct rte_bitmap *
170rte_bitmap_init(uint32_t n_bits, uint8_t *mem, uint32_t mem_size)
171{
172 struct rte_bitmap *bmp;
173 uint32_t array1_byte_offset, array1_slabs, array2_byte_offset, array2_slabs;
174 uint32_t size;
175
176 /* Check input arguments */
177 if (n_bits == 0) {
178 return NULL;
179 }
180
181 if ((mem == NULL) || (((uintptr_t) mem) & RTE_CACHE_LINE_MASK)) {
182 return NULL;
183 }
184
185 size = __rte_bitmap_get_memory_footprint(n_bits,
186 &array1_byte_offset, &array1_slabs,
187 &array2_byte_offset, &array2_slabs);
188 if (size > mem_size)
189 return NULL;
190
191 /* Setup bitmap */
192 memset(mem, 0, size);
193 bmp = (struct rte_bitmap *) mem;
194
195 bmp->array1 = (uint64_t *) &mem[array1_byte_offset];
196 bmp->array1_size = array1_slabs;
197 bmp->array2 = (uint64_t *) &mem[array2_byte_offset];
198 bmp->array2_size = array2_slabs;
199
200 __rte_bitmap_scan_init(bmp);
201
202 return bmp;
203}
204
205/**
206 * Bitmap clear slab overhead bits.

Callers 15

rte_sched_subport_configFunction · 0.85
pdcp_cnt_bitmap_createFunction · 0.85
bcmfs_qp_setupFunction · 0.85
mlx4_mr_create_primaryFunction · 0.85
bitmap_alloc0Function · 0.85
tid_initFunction · 0.85
bond_allocFunction · 0.85
hn_chim_initFunction · 0.85
bnxt_alloc_ringsFunction · 0.85
mlx5_mr_create_primaryFunction · 0.85

Calls 3

memsetFunction · 0.85
__rte_bitmap_scan_initFunction · 0.85

Tested by 1

test_bitmap_all_clearFunction · 0.68