When enqueueing a buffer the PMD check if there is room
in its send queue (SQ).
The current implementation did not take into account that
queue indices are wrapping around, which may result in
consumer index (sq->ci) can have bigger value than than
the producer index (sq->pi).
Fixes:
4d4e245ad637 ("regex/mlx5: support enqueue")
Signed-off-by: Yuval Avnery <yuvalav@mellanox.com>
Acked-by: Ori Kam <orika@mellanox.com>
static inline int
can_send(struct mlx5_regex_sq *sq) {
- return unlikely(sq->ci > sq->pi) ?
- MLX5_REGEX_MAX_WQE_INDEX + sq->pi - sq->ci <
- sq_size_get(sq) :
- sq->pi - sq->ci < sq_size_get(sq);
+ return ((uint16_t)(sq->pi - sq->ci) < sq_size_get(sq));
}
static inline uint32_t