net: hns3: fix a bug when alloc new buffer
authorLipeng <lipeng321@huawei.com>
Mon, 23 Oct 2017 11:51:01 +0000 (19:51 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 20 Dec 2017 09:10:33 +0000 (10:10 +0100)
[ Upstream commit b9077428ec5569aacb2952d8a2ffb51c8988d3c2 ]

When alloce new buffer to HW, should unmap the old buffer first.
This old code map the old buffer but not unmap the old buffer,
this patch fixes it.

Fixes: 76ad4f0 (net: hns3: Add support of HNS3 Ethernet Driver for hip08 SoC)

Signed-off-by: Lipeng <lipeng321@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_enet.c

index ea121b0b16ac9c78d47676dba31bf7be9ff5fa6b..186772493711e2e7a567079cf9d8c31ff0e605da 100644 (file)
@@ -1586,7 +1586,7 @@ out_buffer_fail:
 static void hns3_replace_buffer(struct hns3_enet_ring *ring, int i,
                                struct hns3_desc_cb *res_cb)
 {
-       hns3_map_buffer(ring, &ring->desc_cb[i]);
+       hns3_unmap_buffer(ring, &ring->desc_cb[i]);
        ring->desc_cb[i] = *res_cb;
        ring->desc[i].addr = cpu_to_le64(ring->desc_cb[i].dma);
 }