net/bnxt: enforce IO barrier for doorbell command
authorGavin Hu <gavin.hu@arm.com>
Mon, 16 Sep 2019 11:27:18 +0000 (19:27 +0800)
committerFerruh Yigit <ferruh.yigit@intel.com>
Tue, 8 Oct 2019 10:14:30 +0000 (12:14 +0200)
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@dpdk.org
Signed-off-by: Gavin Hu <gavin.hu@arm.com>
Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
drivers/net/bnxt/bnxt_hwrm.c

index d7c33d2..cdb6fa4 100644 (file)
@@ -146,6 +146,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 < timeout; i++) {