Commit 8220bbc1 authored by Alexander Duyck's avatar Alexander Duyck Committed by Jeff Kirsher

ixgbe/ixgbevf: Add support for bulk free in Tx cleanup & cleanup boolean logic

This patch enables bulk free in Tx cleanup for ixgbevf and cleans up the
boolean logic in the polling routines for ixgbe and ixgbevf in the hopes of
avoiding any mix-ups similar to what occurred with i40e and i40evf.
Signed-off-by: default avatarAlexander Duyck <aduyck@mirantis.com>
Tested-by: default avatarAndrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
parent af741901
...@@ -1111,6 +1111,7 @@ static int ixgbe_tx_maxrate(struct net_device *netdev, ...@@ -1111,6 +1111,7 @@ static int ixgbe_tx_maxrate(struct net_device *netdev,
* ixgbe_clean_tx_irq - Reclaim resources after transmit completes * ixgbe_clean_tx_irq - Reclaim resources after transmit completes
* @q_vector: structure containing interrupt and ring information * @q_vector: structure containing interrupt and ring information
* @tx_ring: tx ring to clean * @tx_ring: tx ring to clean
* @napi_budget: Used to determine if we are in netpoll
**/ **/
static bool ixgbe_clean_tx_irq(struct ixgbe_q_vector *q_vector, static bool ixgbe_clean_tx_irq(struct ixgbe_q_vector *q_vector,
struct ixgbe_ring *tx_ring, int napi_budget) struct ixgbe_ring *tx_ring, int napi_budget)
...@@ -2807,8 +2808,10 @@ int ixgbe_poll(struct napi_struct *napi, int budget) ...@@ -2807,8 +2808,10 @@ int ixgbe_poll(struct napi_struct *napi, int budget)
ixgbe_update_dca(q_vector); ixgbe_update_dca(q_vector);
#endif #endif
ixgbe_for_each_ring(ring, q_vector->tx) ixgbe_for_each_ring(ring, q_vector->tx) {
clean_complete &= !!ixgbe_clean_tx_irq(q_vector, ring, budget); if (!ixgbe_clean_tx_irq(q_vector, ring, budget))
clean_complete = false;
}
/* Exit if we are called by netpoll or busy polling is active */ /* Exit if we are called by netpoll or busy polling is active */
if ((budget <= 0) || !ixgbe_qv_lock_napi(q_vector)) if ((budget <= 0) || !ixgbe_qv_lock_napi(q_vector))
...@@ -2826,7 +2829,8 @@ int ixgbe_poll(struct napi_struct *napi, int budget) ...@@ -2826,7 +2829,8 @@ int ixgbe_poll(struct napi_struct *napi, int budget)
per_ring_budget); per_ring_budget);
work_done += cleaned; work_done += cleaned;
clean_complete &= (cleaned < per_ring_budget); if (cleaned >= per_ring_budget)
clean_complete = false;
} }
ixgbe_qv_unlock_napi(q_vector); ixgbe_qv_unlock_napi(q_vector);
......
...@@ -288,9 +288,10 @@ static void ixgbevf_tx_timeout(struct net_device *netdev) ...@@ -288,9 +288,10 @@ static void ixgbevf_tx_timeout(struct net_device *netdev)
* ixgbevf_clean_tx_irq - Reclaim resources after transmit completes * ixgbevf_clean_tx_irq - Reclaim resources after transmit completes
* @q_vector: board private structure * @q_vector: board private structure
* @tx_ring: tx ring to clean * @tx_ring: tx ring to clean
* @napi_budget: Used to determine if we are in netpoll
**/ **/
static bool ixgbevf_clean_tx_irq(struct ixgbevf_q_vector *q_vector, static bool ixgbevf_clean_tx_irq(struct ixgbevf_q_vector *q_vector,
struct ixgbevf_ring *tx_ring) struct ixgbevf_ring *tx_ring, int napi_budget)
{ {
struct ixgbevf_adapter *adapter = q_vector->adapter; struct ixgbevf_adapter *adapter = q_vector->adapter;
struct ixgbevf_tx_buffer *tx_buffer; struct ixgbevf_tx_buffer *tx_buffer;
...@@ -328,7 +329,7 @@ static bool ixgbevf_clean_tx_irq(struct ixgbevf_q_vector *q_vector, ...@@ -328,7 +329,7 @@ static bool ixgbevf_clean_tx_irq(struct ixgbevf_q_vector *q_vector,
total_packets += tx_buffer->gso_segs; total_packets += tx_buffer->gso_segs;
/* free the skb */ /* free the skb */
dev_kfree_skb_any(tx_buffer->skb); napi_consume_skb(tx_buffer->skb, napi_budget);
/* unmap skb header data */ /* unmap skb header data */
dma_unmap_single(tx_ring->dev, dma_unmap_single(tx_ring->dev,
...@@ -1013,8 +1014,10 @@ static int ixgbevf_poll(struct napi_struct *napi, int budget) ...@@ -1013,8 +1014,10 @@ static int ixgbevf_poll(struct napi_struct *napi, int budget)
int per_ring_budget, work_done = 0; int per_ring_budget, work_done = 0;
bool clean_complete = true; bool clean_complete = true;
ixgbevf_for_each_ring(ring, q_vector->tx) ixgbevf_for_each_ring(ring, q_vector->tx) {
clean_complete &= ixgbevf_clean_tx_irq(q_vector, ring); if (!ixgbevf_clean_tx_irq(q_vector, ring, budget))
clean_complete = false;
}
if (budget <= 0) if (budget <= 0)
return budget; return budget;
...@@ -1035,7 +1038,8 @@ static int ixgbevf_poll(struct napi_struct *napi, int budget) ...@@ -1035,7 +1038,8 @@ static int ixgbevf_poll(struct napi_struct *napi, int budget)
int cleaned = ixgbevf_clean_rx_irq(q_vector, ring, int cleaned = ixgbevf_clean_rx_irq(q_vector, ring,
per_ring_budget); per_ring_budget);
work_done += cleaned; work_done += cleaned;
clean_complete &= (cleaned < per_ring_budget); if (cleaned >= per_ring_budget)
clean_complete = false;
} }
#ifdef CONFIG_NET_RX_BUSY_POLL #ifdef CONFIG_NET_RX_BUSY_POLL
......
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