Skip to content

Commit 24e750c

Browse files
321lipengdavem330
authored andcommitted
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>
1 parent 51145da commit 24e750c

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_enet.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1629,7 +1629,7 @@ static int is_valid_clean_head(struct hns3_enet_ring *ring, int h)
16291629
return u > c ? (h > c && h <= u) : (h > c || h <= u);
16301630
}
16311631

1632-
int hns3_clean_tx_ring(struct hns3_enet_ring *ring, int budget)
1632+
bool hns3_clean_tx_ring(struct hns3_enet_ring *ring, int budget)
16331633
{
16341634
struct net_device *netdev = ring->tqp->handle->kinfo.netdev;
16351635
struct netdev_queue *dev_queue;
@@ -1640,7 +1640,7 @@ int hns3_clean_tx_ring(struct hns3_enet_ring *ring, int budget)
16401640
rmb(); /* Make sure head is ready before touch any data */
16411641

16421642
if (is_ring_empty(ring) || head == ring->next_to_clean)
1643-
return 0; /* no data to poll */
1643+
return true; /* no data to poll */
16441644

16451645
if (!is_valid_clean_head(ring, head)) {
16461646
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)
16491649
u64_stats_update_begin(&ring->syncp);
16501650
ring->stats.io_err_cnt++;
16511651
u64_stats_update_end(&ring->syncp);
1652-
return -EIO;
1652+
return true;
16531653
}
16541654

16551655
bytes = 0;

drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_enet.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -594,7 +594,7 @@ static inline void hns3_write_reg(void __iomem *base, u32 reg, u32 value)
594594

595595
void hns3_ethtool_set_ops(struct net_device *netdev);
596596

597-
int hns3_clean_tx_ring(struct hns3_enet_ring *ring, int budget);
597+
bool hns3_clean_tx_ring(struct hns3_enet_ring *ring, int budget);
598598
int hns3_init_all_ring(struct hns3_nic_priv *priv);
599599
int hns3_uninit_all_ring(struct hns3_nic_priv *priv);
600600
netdev_tx_t hns3_nic_net_xmit(struct sk_buff *skb, struct net_device *netdev);

0 commit comments

Comments
 (0)