* [PATCH net] net: hns3: add rmb() for rx description
@ 2019-03-02 8:49 Huazhong Tan
2019-03-04 5:15 ` David Miller
0 siblings, 1 reply; 3+ messages in thread
From: Huazhong Tan @ 2019-03-02 8:49 UTC (permalink / raw)
To: davem
Cc: netdev, linux-kernel, salil.mehta, yisen.zhuang, linuxarm,
Jian Shen, Huazhong Tan
From: Jian Shen <shenjian15@huawei.com>
HW can not guarantee complete write desc->rx.size, even though
HNS3_RXD_VLD_B has been set. Driver needs to add rmb() instruction
to make sure desc->rx.size is always valid.
Fixes: e55970950556 ("net: hns3: Add handling of GRO Pkts not fully RX'ed in NAPI poll")
Signed-off-by: Jian Shen <shenjian15@huawei.com>
Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
---
drivers/net/ethernet/hisilicon/hns3/hns3_enet.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
index 1bf7a5f..26d3bf4 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
@@ -2476,6 +2476,8 @@ static int hns3_add_frag(struct hns3_enet_ring *ring, struct hns3_desc *desc,
desc = &ring->desc[ring->next_to_clean];
desc_cb = &ring->desc_cb[ring->next_to_clean];
bd_base_info = le32_to_cpu(desc->rx.bd_base_info);
+ /* make sure HW write desc complete */
+ rmb();
if (!hnae3_get_bit(bd_base_info, HNS3_RXD_VLD_B))
return -ENXIO;
--
2.7.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH net] net: hns3: add rmb() for rx description
2019-03-02 8:49 [PATCH net] net: hns3: add rmb() for rx description Huazhong Tan
@ 2019-03-04 5:15 ` David Miller
2019-03-05 1:04 ` tanhuazhong
0 siblings, 1 reply; 3+ messages in thread
From: David Miller @ 2019-03-04 5:15 UTC (permalink / raw)
To: tanhuazhong
Cc: netdev, linux-kernel, salil.mehta, yisen.zhuang, linuxarm, shenjian15
From: Huazhong Tan <tanhuazhong@huawei.com>
Date: Sat, 2 Mar 2019 16:49:30 +0800
> From: Jian Shen <shenjian15@huawei.com>
>
> HW can not guarantee complete write desc->rx.size, even though
> HNS3_RXD_VLD_B has been set. Driver needs to add rmb() instruction
> to make sure desc->rx.size is always valid.
>
> Fixes: e55970950556 ("net: hns3: Add handling of GRO Pkts not fully RX'ed in NAPI poll")
> Signed-off-by: Jian Shen <shenjian15@huawei.com>
> Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
dma_rmb() is more appropriate here and more efficient.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net] net: hns3: add rmb() for rx description
2019-03-04 5:15 ` David Miller
@ 2019-03-05 1:04 ` tanhuazhong
0 siblings, 0 replies; 3+ messages in thread
From: tanhuazhong @ 2019-03-05 1:04 UTC (permalink / raw)
To: David Miller
Cc: netdev, linux-kernel, salil.mehta, yisen.zhuang, linuxarm, shenjian15
On 2019/3/4 13:15, David Miller wrote:
> From: Huazhong Tan <tanhuazhong@huawei.com>
> Date: Sat, 2 Mar 2019 16:49:30 +0800
>
>> From: Jian Shen <shenjian15@huawei.com>
>>
>> HW can not guarantee complete write desc->rx.size, even though
>> HNS3_RXD_VLD_B has been set. Driver needs to add rmb() instruction
>> to make sure desc->rx.size is always valid.
>>
>> Fixes: e55970950556 ("net: hns3: Add handling of GRO Pkts not fully RX'ed in NAPI poll")
>> Signed-off-by: Jian Shen <shenjian15@huawei.com>
>> Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
>
> dma_rmb() is more appropriate here and more efficient.
>
Thanks, will send V2 to fix it.
> .
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-03-05 1:04 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-02 8:49 [PATCH net] net: hns3: add rmb() for rx description Huazhong Tan
2019-03-04 5:15 ` David Miller
2019-03-05 1:04 ` tanhuazhong
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).