ixgbe: reorder Tx cleanup so that if adapter will reset we don't rearm
authorAlexander Duyck <alexander.h.duyck@intel.com>
Wed, 17 Nov 2010 03:26:58 +0000 (19:26 -0800)
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>
Wed, 17 Nov 2010 03:26:58 +0000 (19:26 -0800)
The code as it existed could re-arm the queues when it was requesting a HW
reset due to a TX hang. Instead of doing that this change makes it so that
we will just exit if the hardware is believed to be hung.

Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
Tested-by: Ross Brattain <ross.b.brattain@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
drivers/net/ixgbe/ixgbe_main.c

index 0128fe666f0be9384586cab4e2176bb3c81088d2..1d78b554b0eaf572ab680d99712af8c86e267d68 100644 (file)
@@ -735,8 +735,8 @@ static bool ixgbe_clean_tx_irq(struct ixgbe_q_vector *q_vector,
        struct ixgbe_adapter *adapter = q_vector->adapter;
        union ixgbe_adv_tx_desc *tx_desc, *eop_desc;
        struct ixgbe_tx_buffer *tx_buffer_info;
-       unsigned int i, eop, count = 0;
        unsigned int total_bytes = 0, total_packets = 0;
+       u16 i, eop, count = 0;
 
        i = tx_ring->next_to_clean;
        eop = tx_ring->tx_buffer_info[i].next_to_watch;
@@ -771,6 +771,23 @@ static bool ixgbe_clean_tx_irq(struct ixgbe_q_vector *q_vector,
        }
 
        tx_ring->next_to_clean = i;
+       tx_ring->total_bytes += total_bytes;
+       tx_ring->total_packets += total_packets;
+       u64_stats_update_begin(&tx_ring->syncp);
+       tx_ring->stats.packets += total_packets;
+       tx_ring->stats.bytes += total_bytes;
+       u64_stats_update_end(&tx_ring->syncp);
+
+       if (check_for_tx_hang(tx_ring) &&
+           ixgbe_check_tx_hang(adapter, tx_ring, i)) {
+               /* schedule immediate reset if we believe we hung */
+               e_info(probe, "tx hang %d detected, resetting "
+                      "adapter\n", adapter->tx_timeout_count + 1);
+               ixgbe_tx_timeout(adapter->netdev);
+
+               /* the adapter is about to reset, no point in enabling stuff */
+               return true;
+       }
 
 #define TX_WAKE_THRESHOLD (DESC_NEEDED * 2)
        if (unlikely(count && netif_carrier_ok(tx_ring->netdev) &&
@@ -786,24 +803,6 @@ static bool ixgbe_clean_tx_irq(struct ixgbe_q_vector *q_vector,
                }
        }
 
-       if (check_for_tx_hang(tx_ring) &&
-           ixgbe_check_tx_hang(adapter, tx_ring, i)) {
-               /* schedule immediate reset if we believe we hung */
-               e_info(probe, "tx hang %d detected, resetting "
-                      "adapter\n", adapter->tx_timeout_count + 1);
-               ixgbe_tx_timeout(adapter->netdev);
-       }
-
-       /* re-arm the interrupt */
-       if (count >= tx_ring->work_limit)
-               ixgbe_irq_rearm_queues(adapter, ((u64)1 << q_vector->v_idx));
-
-       tx_ring->total_bytes += total_bytes;
-       tx_ring->total_packets += total_packets;
-       u64_stats_update_begin(&tx_ring->syncp);
-       tx_ring->stats.packets += total_packets;
-       tx_ring->stats.bytes += total_bytes;
-       u64_stats_update_end(&tx_ring->syncp);
        return count < tx_ring->work_limit;
 }