net/bnxt: enforce IO barrier for doorbell command

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: ca241d9a09 ("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>
This commit is contained in:
Gavin Hu 2019-09-16 19:27:18 +08:00 committed by Ferruh Yigit
parent 21ecbde99b
commit dda8e0e487

View 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++) {