aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLipeng <lipeng321@huawei.com>2017-10-23 07:51:07 -0400
committerDavid S. Miller <davem@davemloft.net>2017-10-23 20:16:42 -0400
commit24e750c410ae046d1236af50014cbc697bb375d7 (patch)
tree6e51b577618ddc2b30c6c94f8692ad244daff9eb
parent51145dae2748233315a7a411cd97f4bedf8cc22f (diff)
net: hns3: fix a bug about hns3_clean_tx_ring
The return value of hns3_clean_tx_ring means tx ring clean result. Return true means clean complete and there is no more pakcet need clean. Retrun false means there is packets need clean and napi need poll again. The last return of hns3_clean_tx_ring is "return !!budget" as budget will decrease when clean a buffer. If there is no valid BD in TX ring, return 0 for hns3_clean_tx_ring will cause napi poll again and never complete the napi poll. This patch fixes the bug. 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>
-rw-r--r--drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_enet.c6
-rw-r--r--drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_enet.h2
2 files changed, 4 insertions, 4 deletions
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_enet.c
index 06af3c86b60c..537f6c3babb7 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_enet.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_enet.c
@@ -1629,7 +1629,7 @@ static int is_valid_clean_head(struct hns3_enet_ring *ring, int h)
1629 return u > c ? (h > c && h <= u) : (h > c || h <= u); 1629 return u > c ? (h > c && h <= u) : (h > c || h <= u);
1630} 1630}
1631 1631
1632int hns3_clean_tx_ring(struct hns3_enet_ring *ring, int budget) 1632bool hns3_clean_tx_ring(struct hns3_enet_ring *ring, int budget)
1633{ 1633{
1634 struct net_device *netdev = ring->tqp->handle->kinfo.netdev; 1634 struct net_device *netdev = ring->tqp->handle->kinfo.netdev;
1635 struct netdev_queue *dev_queue; 1635 struct netdev_queue *dev_queue;
@@ -1640,7 +1640,7 @@ int hns3_clean_tx_ring(struct hns3_enet_ring *ring, int budget)
1640 rmb(); /* Make sure head is ready before touch any data */ 1640 rmb(); /* Make sure head is ready before touch any data */
1641 1641
1642 if (is_ring_empty(ring) || head == ring->next_to_clean) 1642 if (is_ring_empty(ring) || head == ring->next_to_clean)
1643 return 0; /* no data to poll */ 1643 return true; /* no data to poll */
1644 1644
1645 if (!is_valid_clean_head(ring, head)) { 1645 if (!is_valid_clean_head(ring, head)) {
1646 netdev_err(netdev, "wrong head (%d, %d-%d)\n", head, 1646 netdev_err(netdev, "wrong head (%d, %d-%d)\n", head,
@@ -1649,7 +1649,7 @@ int hns3_clean_tx_ring(struct hns3_enet_ring *ring, int budget)
1649 u64_stats_update_begin(&ring->syncp); 1649 u64_stats_update_begin(&ring->syncp);
1650 ring->stats.io_err_cnt++; 1650 ring->stats.io_err_cnt++;
1651 u64_stats_update_end(&ring->syncp); 1651 u64_stats_update_end(&ring->syncp);
1652 return -EIO; 1652 return true;
1653 } 1653 }
1654 1654
1655 bytes = 0; 1655 bytes = 0;
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_enet.h b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_enet.h
index 6228b2603d93..58dc30bf893c 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_enet.h
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_enet.h
@@ -594,7 +594,7 @@ static inline void hns3_write_reg(void __iomem *base, u32 reg, u32 value)
594 594
595void hns3_ethtool_set_ops(struct net_device *netdev); 595void hns3_ethtool_set_ops(struct net_device *netdev);
596 596
597int hns3_clean_tx_ring(struct hns3_enet_ring *ring, int budget); 597bool hns3_clean_tx_ring(struct hns3_enet_ring *ring, int budget);
598int hns3_init_all_ring(struct hns3_nic_priv *priv); 598int hns3_init_all_ring(struct hns3_nic_priv *priv);
599int hns3_uninit_all_ring(struct hns3_nic_priv *priv); 599int hns3_uninit_all_ring(struct hns3_nic_priv *priv);
600netdev_tx_t hns3_nic_net_xmit(struct sk_buff *skb, struct net_device *netdev); 600netdev_tx_t hns3_nic_net_xmit(struct sk_buff *skb, struct net_device *netdev);