| 198 | } |
| 199 | |
| 200 | static inline struct mlx5_indexed_cache * |
| 201 | mlx5_ipool_update_global_cache(struct mlx5_indexed_pool *pool, int cidx) |
| 202 | { |
| 203 | struct mlx5_indexed_cache *gc, *lc, *olc = NULL; |
| 204 | |
| 205 | lc = pool->cache[cidx]->lc; |
| 206 | gc = __atomic_load_n(&pool->gc, __ATOMIC_RELAXED); |
| 207 | if (gc && lc != gc) { |
| 208 | mlx5_ipool_lock(pool); |
| 209 | if (lc && !(--lc->ref_cnt)) |
| 210 | olc = lc; |
| 211 | lc = pool->gc; |
| 212 | lc->ref_cnt++; |
| 213 | pool->cache[cidx]->lc = lc; |
| 214 | mlx5_ipool_unlock(pool); |
| 215 | if (olc) |
| 216 | pool->cfg.free(olc); |
| 217 | } |
| 218 | return lc; |
| 219 | } |
| 220 | |
| 221 | static uint32_t |
| 222 | mlx5_ipool_allocate_from_global(struct mlx5_indexed_pool *pool, int cidx) |
no test coverage detected