| 57 | } |
| 58 | |
| 59 | static inline uint32_t |
| 60 | mlx5_trunk_idx_offset_get(struct mlx5_indexed_pool *pool, uint32_t trunk_idx) |
| 61 | { |
| 62 | struct mlx5_indexed_pool_config *cfg = &pool->cfg; |
| 63 | uint32_t offset = 0; |
| 64 | |
| 65 | if (!trunk_idx) |
| 66 | return 0; |
| 67 | if (!cfg->grow_trunk) |
| 68 | return cfg->trunk_size * trunk_idx; |
| 69 | if (trunk_idx < cfg->grow_trunk) |
| 70 | offset = pool->grow_tbl[trunk_idx - 1]; |
| 71 | else |
| 72 | offset = pool->grow_tbl[cfg->grow_trunk - 1] + |
| 73 | (cfg->trunk_size << (cfg->grow_shift * |
| 74 | cfg->grow_trunk)) * (trunk_idx - cfg->grow_trunk); |
| 75 | return offset; |
| 76 | } |
| 77 | |
| 78 | struct mlx5_indexed_pool * |
| 79 | mlx5_ipool_create(struct mlx5_indexed_pool_config *cfg) |
no outgoing calls
no test coverage detected