“4c476d8cff48853645abc822154aaad208faebcc”上不存在“git@gitcode.net:openeuler/kernel.git”
提交 84596451 编写于 作者: S Scott Feldman 提交者: David S. Miller

enic: move wmb closer to where needed: before writing posted_index to hw

Signed-off-by: NScott Feldman <scofeldm@cisco.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 cb3c7669
无相关合并请求
...@@ -58,8 +58,6 @@ static inline void enic_queue_wq_desc_ex(struct vnic_wq *wq, ...@@ -58,8 +58,6 @@ static inline void enic_queue_wq_desc_ex(struct vnic_wq *wq,
(u16)vlan_tag, (u16)vlan_tag,
0 /* loopback */); 0 /* loopback */);
wmb();
vnic_wq_post(wq, os_buf, dma_addr, len, sop, eop); vnic_wq_post(wq, os_buf, dma_addr, len, sop, eop);
} }
...@@ -127,8 +125,6 @@ static inline void enic_queue_rq_desc(struct vnic_rq *rq, ...@@ -127,8 +125,6 @@ static inline void enic_queue_rq_desc(struct vnic_rq *rq,
(u64)dma_addr | VNIC_PADDR_TARGET, (u64)dma_addr | VNIC_PADDR_TARGET,
type, (u16)len); type, (u16)len);
wmb();
vnic_rq_post(rq, os_buf, os_buf_index, dma_addr, len); vnic_rq_post(rq, os_buf, os_buf_index, dma_addr, len);
} }
......
...@@ -132,8 +132,15 @@ static inline void vnic_rq_post(struct vnic_rq *rq, ...@@ -132,8 +132,15 @@ static inline void vnic_rq_post(struct vnic_rq *rq,
#define VNIC_RQ_RETURN_RATE 0xf /* keep 2^n - 1 */ #define VNIC_RQ_RETURN_RATE 0xf /* keep 2^n - 1 */
#endif #endif
if ((buf->index & VNIC_RQ_RETURN_RATE) == 0) if ((buf->index & VNIC_RQ_RETURN_RATE) == 0) {
/* Adding write memory barrier prevents compiler and/or CPU
* reordering, thus avoiding descriptor posting before
* descriptor is initialized. Otherwise, hardware can read
* stale descriptor fields.
*/
wmb();
iowrite32(buf->index, &rq->ctrl->posted_index); iowrite32(buf->index, &rq->ctrl->posted_index);
}
} }
static inline void vnic_rq_return_descs(struct vnic_rq *rq, unsigned int count) static inline void vnic_rq_return_descs(struct vnic_rq *rq, unsigned int count)
......
...@@ -108,8 +108,15 @@ static inline void vnic_wq_post(struct vnic_wq *wq, ...@@ -108,8 +108,15 @@ static inline void vnic_wq_post(struct vnic_wq *wq,
buf->len = len; buf->len = len;
buf = buf->next; buf = buf->next;
if (eop) if (eop) {
/* Adding write memory barrier prevents compiler and/or CPU
* reordering, thus avoiding descriptor posting before
* descriptor is initialized. Otherwise, hardware can read
* stale descriptor fields.
*/
wmb();
iowrite32(buf->index, &wq->ctrl->posted_index); iowrite32(buf->index, &wq->ctrl->posted_index);
}
wq->to_use = buf; wq->to_use = buf;
wq->ring.desc_avail--; wq->ring.desc_avail--;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册
反馈
建议
客服 返回
顶部