]> git.itanic.dy.fi Git - linux-stable/commit
net: hns3: fix error handling for desc filling
authorYunsheng Lin <linyunsheng@huawei.com>
Tue, 21 Jul 2020 11:03:53 +0000 (19:03 +0800)
committerDavid S. Miller <davem@davemloft.net>
Tue, 21 Jul 2020 22:49:17 +0000 (15:49 -0700)
commit8ceca59fb3ed48a693171bd571c4fcbd555b7f1f
tree330ef4e33d7ce6a0e9bb04316b32492597e09cd4
parent48ae74c9d89f827b39b5c07a1f02fc13637a3cd6
net: hns3: fix error handling for desc filling

The content of the TX desc is automatically cleared by the HW
when the HW has sent out the packet to the wire. When desc filling
fails in hns3_nic_net_xmit(), it will call hns3_clear_desc() to do
the error handling, which miss zeroing of the TX desc and the
checking if a unmapping is needed.

So add the zeroing and checking in hns3_clear_desc() to avoid the
above problem. Also add DESC_TYPE_UNKNOWN to indicate the info in
desc_cb is not valid, because hns3_nic_reclaim_desc() may treat
the desc_cb->type of zero as packet and add to the sent pkt
statistics accordingly.

Fixes: 76ad4f0ee747 ("net: hns3: Add support of HNS3 Ethernet Driver for hip08 SoC")
Signed-off-by: Yunsheng Lin <linyunsheng@huawei.com>
Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/hisilicon/hns3/hnae3.h
drivers/net/ethernet/hisilicon/hns3/hns3_enet.c