Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fd141fa4 authored by Sinan Kaya's avatar Sinan Kaya Committed by David S. Miller
Browse files

bnxt_en: Eliminate duplicate barriers on weakly-ordered archs



Code includes wmb() followed by writel(). writel() already has a barrier on
some architectures like arm64.

This ends up CPU observing two barriers back to back before executing the
register write.

Create a new wrapper function with relaxed write operator. Use the new
wrapper when a write is following a wmb().

Since code already has an explicit barrier call, changing writel() to
writel_relaxed().

Also add mmiowb() so that write code doesn't move outside of scope.

Signed-off-by: default avatarSinan Kaya <okaya@codeaurora.org>
Acked-by: default avatarMichael Chan <michael.chan@broadcom.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent e42d8cee
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1922,7 +1922,7 @@ static int bnxt_poll_work(struct bnxt *bp, struct bnxt_napi *bnapi, int budget)
		/* Sync BD data before updating doorbell */
		wmb();

		bnxt_db_write(bp, db, DB_KEY_TX | prod);
		bnxt_db_write_relaxed(bp, db, DB_KEY_TX | prod);
	}

	cpr->cp_raw_cons = raw_cons;
+9 −0
Original line number Diff line number Diff line
@@ -1402,6 +1402,15 @@ static inline u32 bnxt_tx_avail(struct bnxt *bp, struct bnxt_tx_ring_info *txr)
		((txr->tx_prod - txr->tx_cons) & bp->tx_ring_mask);
}

/* For TX and RX ring doorbells with no ordering guarantee*/
static inline void bnxt_db_write_relaxed(struct bnxt *bp, void __iomem *db,
					 u32 val)
{
	writel_relaxed(val, db);
	if (bp->flags & BNXT_FLAG_DOUBLE_DB)
		writel_relaxed(val, db);
}

/* For TX and RX ring doorbells */
static inline void bnxt_db_write(struct bnxt *bp, void __iomem *db, u32 val)
{