| 357 | } |
| 358 | |
| 359 | static 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 | |
| 388 | static void * |
| 389 | mlx5_ipool_get_cache(struct mlx5_indexed_pool *pool, uint32_t idx) |
no test coverage detected