Commit 632be194 authored by Hariprasad Shenai's avatar Hariprasad Shenai Committed by David S. Miller

cxgb4: Use ACCES_ONCE macro to read queue's consumer index

Use helper macro ACCESS_ONCE() to load from the SGE status page
to prevent the compiler loading multiple times.

Based on original work by Mike Werner <werner@chelsio.com>
Signed-off-by: default avatarHariprasad Shenai <hariprasad@chelsio.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent b8759e91
...@@ -406,7 +406,7 @@ static void free_tx_desc(struct adapter *adap, struct sge_txq *q, ...@@ -406,7 +406,7 @@ static void free_tx_desc(struct adapter *adap, struct sge_txq *q,
*/ */
static inline int reclaimable(const struct sge_txq *q) static inline int reclaimable(const struct sge_txq *q)
{ {
int hw_cidx = ntohs(q->stat->cidx); int hw_cidx = ntohs(ACCESS_ONCE(q->stat->cidx));
hw_cidx -= q->cidx; hw_cidx -= q->cidx;
return hw_cidx < 0 ? hw_cidx + q->size : hw_cidx; return hw_cidx < 0 ? hw_cidx + q->size : hw_cidx;
} }
...@@ -1320,7 +1320,7 @@ out_free: dev_kfree_skb_any(skb); ...@@ -1320,7 +1320,7 @@ out_free: dev_kfree_skb_any(skb);
*/ */
static inline void reclaim_completed_tx_imm(struct sge_txq *q) static inline void reclaim_completed_tx_imm(struct sge_txq *q)
{ {
int hw_cidx = ntohs(q->stat->cidx); int hw_cidx = ntohs(ACCESS_ONCE(q->stat->cidx));
int reclaim = hw_cidx - q->cidx; int reclaim = hw_cidx - q->cidx;
if (reclaim < 0) if (reclaim < 0)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment