Commit 799997a3 authored by Peng Li's avatar Peng Li Committed by David S. Miller

net: hns3: Remove tx budget to clean more TX descriptors in a napi

The the actual Tx work is minimal, driver can clean up as more
Tx descriptors as possible in a irq.
Signed-off-by: default avatarPeng Li <lipeng321@huawei.com>
Signed-off-by: default avatarSalil Mehta <salil.mehta@huawei.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 932d1252
...@@ -1955,7 +1955,7 @@ static int is_valid_clean_head(struct hns3_enet_ring *ring, int h) ...@@ -1955,7 +1955,7 @@ static int is_valid_clean_head(struct hns3_enet_ring *ring, int h)
return u > c ? (h > c && h <= u) : (h > c || h <= u); return u > c ? (h > c && h <= u) : (h > c || h <= u);
} }
bool hns3_clean_tx_ring(struct hns3_enet_ring *ring, int budget) void hns3_clean_tx_ring(struct hns3_enet_ring *ring)
{ {
struct net_device *netdev = ring->tqp->handle->kinfo.netdev; struct net_device *netdev = ring->tqp->handle->kinfo.netdev;
struct netdev_queue *dev_queue; struct netdev_queue *dev_queue;
...@@ -1966,7 +1966,7 @@ bool hns3_clean_tx_ring(struct hns3_enet_ring *ring, int budget) ...@@ -1966,7 +1966,7 @@ bool hns3_clean_tx_ring(struct hns3_enet_ring *ring, int budget)
rmb(); /* Make sure head is ready before touch any data */ rmb(); /* Make sure head is ready before touch any data */
if (is_ring_empty(ring) || head == ring->next_to_clean) if (is_ring_empty(ring) || head == ring->next_to_clean)
return true; /* no data to poll */ return; /* no data to poll */
if (unlikely(!is_valid_clean_head(ring, head))) { if (unlikely(!is_valid_clean_head(ring, head))) {
netdev_err(netdev, "wrong head (%d, %d-%d)\n", head, netdev_err(netdev, "wrong head (%d, %d-%d)\n", head,
...@@ -1975,16 +1975,15 @@ bool hns3_clean_tx_ring(struct hns3_enet_ring *ring, int budget) ...@@ -1975,16 +1975,15 @@ bool hns3_clean_tx_ring(struct hns3_enet_ring *ring, int budget)
u64_stats_update_begin(&ring->syncp); u64_stats_update_begin(&ring->syncp);
ring->stats.io_err_cnt++; ring->stats.io_err_cnt++;
u64_stats_update_end(&ring->syncp); u64_stats_update_end(&ring->syncp);
return true; return;
} }
bytes = 0; bytes = 0;
pkts = 0; pkts = 0;
while (head != ring->next_to_clean && budget) { while (head != ring->next_to_clean) {
hns3_nic_reclaim_one_desc(ring, &bytes, &pkts); hns3_nic_reclaim_one_desc(ring, &bytes, &pkts);
/* Issue prefetch for next Tx descriptor */ /* Issue prefetch for next Tx descriptor */
prefetch(&ring->desc_cb[ring->next_to_clean]); prefetch(&ring->desc_cb[ring->next_to_clean]);
budget--;
} }
ring->tqp_vector->tx_group.total_bytes += bytes; ring->tqp_vector->tx_group.total_bytes += bytes;
...@@ -2009,8 +2008,6 @@ bool hns3_clean_tx_ring(struct hns3_enet_ring *ring, int budget) ...@@ -2009,8 +2008,6 @@ bool hns3_clean_tx_ring(struct hns3_enet_ring *ring, int budget)
ring->stats.restart_queue++; ring->stats.restart_queue++;
} }
} }
return !!budget;
} }
static int hns3_desc_unused(struct hns3_enet_ring *ring) static int hns3_desc_unused(struct hns3_enet_ring *ring)
...@@ -2544,10 +2541,8 @@ static int hns3_nic_common_poll(struct napi_struct *napi, int budget) ...@@ -2544,10 +2541,8 @@ static int hns3_nic_common_poll(struct napi_struct *napi, int budget)
/* Since the actual Tx work is minimal, we can give the Tx a larger /* Since the actual Tx work is minimal, we can give the Tx a larger
* budget and be more aggressive about cleaning up the Tx descriptors. * budget and be more aggressive about cleaning up the Tx descriptors.
*/ */
hns3_for_each_ring(ring, tqp_vector->tx_group) { hns3_for_each_ring(ring, tqp_vector->tx_group)
if (!hns3_clean_tx_ring(ring, budget)) hns3_clean_tx_ring(ring);
clean_complete = false;
}
/* make sure rx ring budget not smaller than 1 */ /* make sure rx ring budget not smaller than 1 */
rx_budget = max(budget / tqp_vector->num_tqps, 1); rx_budget = max(budget / tqp_vector->num_tqps, 1);
......
...@@ -617,7 +617,7 @@ void hns3_ethtool_set_ops(struct net_device *netdev); ...@@ -617,7 +617,7 @@ void hns3_ethtool_set_ops(struct net_device *netdev);
int hns3_set_channels(struct net_device *netdev, int hns3_set_channels(struct net_device *netdev,
struct ethtool_channels *ch); struct ethtool_channels *ch);
bool hns3_clean_tx_ring(struct hns3_enet_ring *ring, int budget); void hns3_clean_tx_ring(struct hns3_enet_ring *ring);
int hns3_init_all_ring(struct hns3_nic_priv *priv); int hns3_init_all_ring(struct hns3_nic_priv *priv);
int hns3_uninit_all_ring(struct hns3_nic_priv *priv); int hns3_uninit_all_ring(struct hns3_nic_priv *priv);
int hns3_nic_reset_all_ring(struct hnae3_handle *h); int hns3_nic_reset_all_ring(struct hnae3_handle *h);
......
...@@ -200,7 +200,7 @@ static void hns3_lb_clear_tx_ring(struct hns3_nic_priv *priv, u32 start_ringid, ...@@ -200,7 +200,7 @@ static void hns3_lb_clear_tx_ring(struct hns3_nic_priv *priv, u32 start_ringid,
for (i = start_ringid; i <= end_ringid; i++) { for (i = start_ringid; i <= end_ringid; i++) {
struct hns3_enet_ring *ring = priv->ring_data[i].ring; struct hns3_enet_ring *ring = priv->ring_data[i].ring;
hns3_clean_tx_ring(ring, budget); hns3_clean_tx_ring(ring);
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment