Enforce reading the consumer and producer counters once to ensure

consistent return values from the mlx5e_sq_has_room_for()
function. The two counters are incremented by different threads under
different locks.

MFC after:		1 week
Sponsored by:		Mellanox Technologies
This commit is contained in:
Hans Petter Selasky 2017-01-27 08:32:50 +00:00
parent e831795b8a
commit 5e6a76be8a

View File

@ -546,8 +546,10 @@ struct mlx5e_sq {
static inline bool
mlx5e_sq_has_room_for(struct mlx5e_sq *sq, u16 n)
{
return ((sq->wq.sz_m1 & (sq->cc - sq->pc)) >= n ||
sq->cc == sq->pc);
u16 cc = sq->cc;
u16 pc = sq->pc;
return ((sq->wq.sz_m1 & (cc - pc)) >= n || cc == pc);
}
struct mlx5e_channel {