summaryrefslogtreecommitdiff
path: root/drivers/net/ethernet/amazon/ena/ena_eth_com.h
diff options
context:
space:
mode:
authorSinan Kaya <okaya@codeaurora.org>2018-03-25 10:39:21 -0400
committerDavid S. Miller <davem@davemloft.net>2018-03-26 12:47:56 -0400
commit6d2e1a8d5e25e5f4563f5ea24bcb5da1ae261b26 (patch)
treedd2b5acaa6a1c2a12456ffc5aa546f707f1a91ee /drivers/net/ethernet/amazon/ena/ena_eth_com.h
parentfd141fa47c03018aa1f77c335b0f444493e145d5 (diff)
net: ena: Eliminate duplicate barriers on weakly-ordered archs
Code includes barrier() 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 barrier(). Since code already has an explicit barrier call, changing writel() to writel_relaxed() and adding mmiowb() for ordering protection. Signed-off-by: Sinan Kaya <okaya@codeaurora.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/amazon/ena/ena_eth_com.h')
-rw-r--r--drivers/net/ethernet/amazon/ena/ena_eth_com.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/net/ethernet/amazon/ena/ena_eth_com.h b/drivers/net/ethernet/amazon/ena/ena_eth_com.h
index 2f7657227cfe..6fdc753d9483 100644
--- a/drivers/net/ethernet/amazon/ena/ena_eth_com.h
+++ b/drivers/net/ethernet/amazon/ena/ena_eth_com.h
@@ -107,7 +107,8 @@ static inline int ena_com_sq_empty_space(struct ena_com_io_sq *io_sq)
return io_sq->q_depth - 1 - cnt;
}
-static inline int ena_com_write_sq_doorbell(struct ena_com_io_sq *io_sq)
+static inline int ena_com_write_sq_doorbell(struct ena_com_io_sq *io_sq,
+ bool relaxed)
{
u16 tail;
@@ -116,7 +117,10 @@ static inline int ena_com_write_sq_doorbell(struct ena_com_io_sq *io_sq)
pr_debug("write submission queue doorbell for queue: %d tail: %d\n",
io_sq->qid, tail);
- writel(tail, io_sq->db_addr);
+ if (relaxed)
+ writel_relaxed(tail, io_sq->db_addr);
+ else
+ writel(tail, io_sq->db_addr);
return 0;
}