mlx5en: Avoid SFENCe on x86

The IA32 memory model guarantees that all writes are seen in the program
order.  Also, any access to the uncacheable memory flushes the store
buffers.  As the consequence, SFENCE instruction is (almost) never needed,
in particular, it is not needed to ensure the correct order of updates as
seen by a PCIe device.

Use atomic_thread_fence_rel() instead of wb() to only emit compiler barriers
on x86 there.  Other architectures get the right barrier instruction as
well.

Reviewed by:	hselasky
Sponsored by:	Mellanox Technologies
MFC after:	1 week
This commit is contained in:
Konstantin Belousov 2017-12-19 14:11:41 +00:00
parent 200f8117ba
commit e44f4f3547
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=326977

View File

@ -90,7 +90,7 @@ mlx5e_post_rx_wqes(struct mlx5e_rq *rq)
}
/* ensure wqes are visible to device before updating doorbell record */
wmb();
atomic_thread_fence_rel();
mlx5_wq_ll_update_db_record(&rq->wq);
}
@ -436,7 +436,7 @@ mlx5e_poll_rx_cq(struct mlx5e_rq *rq, int budget)
mlx5_cqwq_update_db_record(&rq->cq.wq);
/* ensure cq space is freed before enabling more cqes */
wmb();
atomic_thread_fence_rel();
return (i);
}