| 404 | |
| 405 | |
| 406 | static void * |
| 407 | _mlx5_ipool_malloc_cache(struct mlx5_indexed_pool *pool, int cidx, |
| 408 | uint32_t *idx) |
| 409 | { |
| 410 | if (unlikely(!pool->cache[cidx])) { |
| 411 | pool->cache[cidx] = pool->cfg.malloc(MLX5_MEM_ZERO, |
| 412 | sizeof(struct mlx5_ipool_per_lcore) + |
| 413 | (pool->cfg.per_core_cache * sizeof(uint32_t)), |
| 414 | RTE_CACHE_LINE_SIZE, SOCKET_ID_ANY); |
| 415 | if (!pool->cache[cidx]) { |
| 416 | DRV_LOG(ERR, "Ipool cache%d allocate failed\n", cidx); |
| 417 | return NULL; |
| 418 | } |
| 419 | } else if (pool->cache[cidx]->len) { |
| 420 | pool->cache[cidx]->len--; |
| 421 | *idx = pool->cache[cidx]->idx[pool->cache[cidx]->len]; |
| 422 | return _mlx5_ipool_get_cache(pool, cidx, *idx); |
| 423 | } |
| 424 | /* Not enough idx in global cache. Keep fetching from global. */ |
| 425 | *idx = mlx5_ipool_allocate_from_global(pool, cidx); |
| 426 | if (unlikely(!(*idx))) |
| 427 | return NULL; |
| 428 | return _mlx5_ipool_get_cache(pool, cidx, *idx); |
| 429 | } |
| 430 | |
| 431 | static void * |
| 432 | mlx5_ipool_malloc_cache(struct mlx5_indexed_pool *pool, uint32_t *idx) |
no test coverage detected