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

Function _mlx5_ipool_get_cache

dpdk/drivers/net/mlx5/mlx5_utils.c:359–386  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

357}
358
359static void *
360_mlx5_ipool_get_cache(struct mlx5_indexed_pool *pool, int cidx, uint32_t idx)
361{
362 struct mlx5_indexed_trunk *trunk;
363 struct mlx5_indexed_cache *lc;
364 uint32_t trunk_idx;
365 uint32_t entry_idx;
366
367 MLX5_ASSERT(idx);
368 if (unlikely(!pool->cache[cidx])) {
369 pool->cache[cidx] = pool->cfg.malloc(MLX5_MEM_ZERO,
370 sizeof(struct mlx5_ipool_per_lcore) +
371 (pool->cfg.per_core_cache * sizeof(uint32_t)),
372 RTE_CACHE_LINE_SIZE, SOCKET_ID_ANY);
373 if (!pool->cache[cidx]) {
374 DRV_LOG(ERR, "Ipool cache%d allocate failed\n", cidx);
375 return NULL;
376 }
377 }
378 lc = mlx5_ipool_update_global_cache(pool, cidx);
379 idx -= 1;
380 trunk_idx = mlx5_trunk_idx_get(pool, idx);
381 trunk = lc->trunks[trunk_idx];
382 if (!trunk)
383 return NULL;
384 entry_idx = idx - mlx5_trunk_idx_offset_get(pool, trunk_idx);
385 return &trunk->data[entry_idx * pool->cfg.size];
386}
387
388static void *
389mlx5_ipool_get_cache(struct mlx5_indexed_pool *pool, uint32_t idx)

Callers 2

mlx5_ipool_get_cacheFunction · 0.85
_mlx5_ipool_malloc_cacheFunction · 0.85

Calls 3

mlx5_trunk_idx_getFunction · 0.85

Tested by

no test coverage detected