igb: Add support for bulk Tx cleanup & cleanup boolean logic
authorAlexander Duyck <aduyck@mirantis.com>
Mon, 7 Mar 2016 17:30:21 +0000 (09:30 -0800)
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>
Wed, 6 Apr 2016 19:26:36 +0000 (12:26 -0700)
This patch enables bulk free in Tx cleanup for igb and cleans up the
boolean logic in the polling routines for igb in the hopes of avoiding
any mix-ups similar to what occurred with i40e and i40evf.

Signed-off-by: Alexander Duyck <aduyck@mirantis.com>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
drivers/net/ethernet/intel/igb/igb_main.c

index 36814a2e326dad6955beab0bb34c883590700ab2..e40983ca35b4664a301053362b837c654e764cc8 100644 (file)
@@ -150,7 +150,7 @@ static void igb_update_dca(struct igb_q_vector *);
 static void igb_setup_dca(struct igb_adapter *);
 #endif /* CONFIG_IGB_DCA */
 static int igb_poll(struct napi_struct *, int);
-static bool igb_clean_tx_irq(struct igb_q_vector *);
+static bool igb_clean_tx_irq(struct igb_q_vector *, int);
 static int igb_clean_rx_irq(struct igb_q_vector *, int);
 static int igb_ioctl(struct net_device *, struct ifreq *, int cmd);
 static void igb_tx_timeout(struct net_device *);
@@ -6522,13 +6522,14 @@ static int igb_poll(struct napi_struct *napi, int budget)
                igb_update_dca(q_vector);
 #endif
        if (q_vector->tx.ring)
-               clean_complete = igb_clean_tx_irq(q_vector);
+               clean_complete = igb_clean_tx_irq(q_vector, budget);
 
        if (q_vector->rx.ring) {
                int cleaned = igb_clean_rx_irq(q_vector, budget);
 
                work_done += cleaned;
-               clean_complete &= (cleaned < budget);
+               if (cleaned >= budget)
+                       clean_complete = false;
        }
 
        /* If all work not completed, return budget and keep polling */
@@ -6545,10 +6546,11 @@ static int igb_poll(struct napi_struct *napi, int budget)
 /**
  *  igb_clean_tx_irq - Reclaim resources after transmit completes
  *  @q_vector: pointer to q_vector containing needed info
+ *  @napi_budget: Used to determine if we are in netpoll
  *
  *  returns true if ring is completely cleaned
  **/
-static bool igb_clean_tx_irq(struct igb_q_vector *q_vector)
+static bool igb_clean_tx_irq(struct igb_q_vector *q_vector, int napi_budget)
 {
        struct igb_adapter *adapter = q_vector->adapter;
        struct igb_ring *tx_ring = q_vector->tx.ring;
@@ -6587,7 +6589,7 @@ static bool igb_clean_tx_irq(struct igb_q_vector *q_vector)
                total_packets += tx_buffer->gso_segs;
 
                /* free the skb */
-               dev_consume_skb_any(tx_buffer->skb);
+               napi_consume_skb(tx_buffer->skb, napi_budget);
 
                /* unmap skb header data */
                dma_unmap_single(tx_ring->dev,