[dpdk-stable] [PATCH v2 5/5] net/bnxt: enforce io barrier for doorbell command
Gavin Hu
gavin.hu at arm.com
Mon Sep 16 13:27:18 CEST 2019
The doorbell ringing operation requires a rte_io_mb immediately to make
the command complete and visible to the device before reading the
response, otherwise it may read stale or invalid responses.
Fixes: ca241d9a0952 ("net/bnxt: use I/O device memory read/write API")
Cc: stable at dpdk.org
Signed-off-by: Gavin Hu <gavin.hu at arm.com>
---
drivers/net/bnxt/bnxt_hwrm.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
index 2d5dc00..7d192e3 100644
--- a/drivers/net/bnxt/bnxt_hwrm.c
+++ b/drivers/net/bnxt/bnxt_hwrm.c
@@ -134,6 +134,12 @@ static int bnxt_hwrm_send_message(struct bnxt *bp, void *msg,
/* Ring channel doorbell */
bar = (uint8_t *)bp->bar0 + mb_trigger_offset;
rte_write32(1, bar);
+ /*
+ * Make sure the channel doorbell ring command complete before
+ * reading the response to avoid getting stale or invalid
+ * responses.
+ */
+ rte_io_mb();
/* Poll for the valid bit */
for (i = 0; i < HWRM_CMD_TIMEOUT; i++) {
--
2.7.4
More information about the stable
mailing list