| 25 | } |
| 26 | |
| 27 | static inline uint32_t |
| 28 | mlx5_trunk_idx_get(struct mlx5_indexed_pool *pool, uint32_t entry_idx) |
| 29 | { |
| 30 | struct mlx5_indexed_pool_config *cfg = &pool->cfg; |
| 31 | uint32_t trunk_idx = 0; |
| 32 | uint32_t i; |
| 33 | |
| 34 | if (!cfg->grow_trunk) |
| 35 | return entry_idx / cfg->trunk_size; |
| 36 | if (entry_idx >= pool->grow_tbl[cfg->grow_trunk - 1]) { |
| 37 | trunk_idx = (entry_idx - pool->grow_tbl[cfg->grow_trunk - 1]) / |
| 38 | (cfg->trunk_size << (cfg->grow_shift * |
| 39 | cfg->grow_trunk)) + cfg->grow_trunk; |
| 40 | } else { |
| 41 | for (i = 0; i < cfg->grow_trunk; i++) { |
| 42 | if (entry_idx < pool->grow_tbl[i]) |
| 43 | break; |
| 44 | } |
| 45 | trunk_idx = i; |
| 46 | } |
| 47 | return trunk_idx; |
| 48 | } |
| 49 | |
| 50 | static inline uint32_t |
| 51 | mlx5_trunk_size_get(struct mlx5_indexed_pool *pool, uint32_t trunk_idx) |
no outgoing calls
no test coverage detected