net: hns3: add dma_rmb() for rx description
authorJian Shen <shenjian15@huawei.com>
Wed, 6 Mar 2019 03:26:37 +0000 (11:26 +0800)
committerDavid S. Miller <davem@davemloft.net>
Fri, 8 Mar 2019 22:42:37 +0000 (14:42 -0800)
HW can not guarantee complete write desc->rx.size, even though
HNS3_RXD_VLD_B has been set. Driver needs to add dma_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>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/hisilicon/hns3/hns3_enet.c

index 1e4efc47c7a50f296d670c8191b960ebf5705eb8..0d1ae15a5927d707b6de3938472db180b0ff4ee6 100644 (file)
@@ -2472,6 +2472,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 */
+               dma_rmb();
                if (!(bd_base_info & BIT(HNS3_RXD_VLD_B)))
                        return -ENXIO;