aboutsummaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorKonstantin Belousov <kib@FreeBSD.org>2017-12-19 14:11:41 +0000
committerKonstantin Belousov <kib@FreeBSD.org>2017-12-19 14:11:41 +0000
commite44f4f3547612b57227c366bd57b02f0be7b5001 (patch)
tree0c20fe6d6593ae958ee0d14ba1bde992b0e3f1d1 /sys
parent200f8117ba72b9c4e93dd3491f322f0012634309 (diff)
downloadsrc-e44f4f3547612b57227c366bd57b02f0be7b5001.tar.gz
src-e44f4f3547612b57227c366bd57b02f0be7b5001.zip
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
Notes
Notes: svn path=/head/; revision=326977
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/mlx5/mlx5_en/mlx5_en_rx.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c b/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c
index 77f674af35f7..fb14be43b32e 100644
--- a/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c
+++ b/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c
@@ -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 @@ wq_ll_pop:
mlx5_cqwq_update_db_record(&rq->cq.wq);
/* ensure cq space is freed before enabling more cqes */
- wmb();
+ atomic_thread_fence_rel();
return (i);
}