提交 9a1a69ad 编写于 作者: J Jesse Brandeburg 提交者: David S. Miller

ixgbe: Fix the Tx clean logic to return proper status

The Tx accounting when cleaning during NAPI was not completely properly.
We should use the work_limit to determine when to finish cleaning, and
use the same to return the cleaned status.  The impact of running like this
causes the NAPI clean for this Tx to get stuck in a scheduling loop, and
can result in Tx not getting cleaned, ending with a Tx hang and device
reset.
Signed-off-by: NJesse Brandeburg <jesse.brandeburg@intel.com>
Signed-off-by: NPeter P Waskiewicz Jr <peter.p.waskiewicz.jr@intel.com>
Signed-off-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 4dd64df8
...@@ -251,6 +251,8 @@ static void ixgbe_tx_timeout(struct net_device *netdev); ...@@ -251,6 +251,8 @@ static void ixgbe_tx_timeout(struct net_device *netdev);
* ixgbe_clean_tx_irq - Reclaim resources after transmit completes * ixgbe_clean_tx_irq - Reclaim resources after transmit completes
* @adapter: board private structure * @adapter: board private structure
* @tx_ring: tx ring to clean * @tx_ring: tx ring to clean
*
* returns true if transmit work is done
**/ **/
static bool ixgbe_clean_tx_irq(struct ixgbe_adapter *adapter, static bool ixgbe_clean_tx_irq(struct ixgbe_adapter *adapter,
struct ixgbe_ring *tx_ring) struct ixgbe_ring *tx_ring)
...@@ -266,7 +268,7 @@ static bool ixgbe_clean_tx_irq(struct ixgbe_adapter *adapter, ...@@ -266,7 +268,7 @@ static bool ixgbe_clean_tx_irq(struct ixgbe_adapter *adapter,
eop_desc = IXGBE_TX_DESC_ADV(*tx_ring, eop); eop_desc = IXGBE_TX_DESC_ADV(*tx_ring, eop);
while ((eop_desc->wb.status & cpu_to_le32(IXGBE_TXD_STAT_DD)) && while ((eop_desc->wb.status & cpu_to_le32(IXGBE_TXD_STAT_DD)) &&
(count < tx_ring->count)) { (count < tx_ring->work_limit)) {
bool cleaned = false; bool cleaned = false;
for ( ; !cleaned; count++) { for ( ; !cleaned; count++) {
struct sk_buff *skb; struct sk_buff *skb;
...@@ -328,8 +330,7 @@ static bool ixgbe_clean_tx_irq(struct ixgbe_adapter *adapter, ...@@ -328,8 +330,7 @@ static bool ixgbe_clean_tx_irq(struct ixgbe_adapter *adapter,
} }
/* re-arm the interrupt */ /* re-arm the interrupt */
if ((total_packets >= tx_ring->work_limit) || if (count >= tx_ring->work_limit)
(count == tx_ring->count))
IXGBE_WRITE_REG(&adapter->hw, IXGBE_EICS, tx_ring->v_idx); IXGBE_WRITE_REG(&adapter->hw, IXGBE_EICS, tx_ring->v_idx);
tx_ring->total_bytes += total_bytes; tx_ring->total_bytes += total_bytes;
...@@ -338,7 +339,7 @@ static bool ixgbe_clean_tx_irq(struct ixgbe_adapter *adapter, ...@@ -338,7 +339,7 @@ static bool ixgbe_clean_tx_irq(struct ixgbe_adapter *adapter,
tx_ring->stats.bytes += total_bytes; tx_ring->stats.bytes += total_bytes;
adapter->net_stats.tx_bytes += total_bytes; adapter->net_stats.tx_bytes += total_bytes;
adapter->net_stats.tx_packets += total_packets; adapter->net_stats.tx_packets += total_packets;
return (total_packets ? true : false); return (count < tx_ring->work_limit);
} }
#ifdef CONFIG_IXGBE_DCA #ifdef CONFIG_IXGBE_DCA
...@@ -2590,10 +2591,10 @@ void ixgbe_down(struct ixgbe_adapter *adapter) ...@@ -2590,10 +2591,10 @@ void ixgbe_down(struct ixgbe_adapter *adapter)
**/ **/
static int ixgbe_poll(struct napi_struct *napi, int budget) static int ixgbe_poll(struct napi_struct *napi, int budget)
{ {
struct ixgbe_q_vector *q_vector = container_of(napi, struct ixgbe_q_vector *q_vector =
struct ixgbe_q_vector, napi); container_of(napi, struct ixgbe_q_vector, napi);
struct ixgbe_adapter *adapter = q_vector->adapter; struct ixgbe_adapter *adapter = q_vector->adapter;
int tx_cleaned, work_done = 0; int tx_clean_complete, work_done = 0;
#ifdef CONFIG_IXGBE_DCA #ifdef CONFIG_IXGBE_DCA
if (adapter->flags & IXGBE_FLAG_DCA_ENABLED) { if (adapter->flags & IXGBE_FLAG_DCA_ENABLED) {
...@@ -2602,10 +2603,10 @@ static int ixgbe_poll(struct napi_struct *napi, int budget) ...@@ -2602,10 +2603,10 @@ static int ixgbe_poll(struct napi_struct *napi, int budget)
} }
#endif #endif
tx_cleaned = ixgbe_clean_tx_irq(adapter, adapter->tx_ring); tx_clean_complete = ixgbe_clean_tx_irq(adapter, adapter->tx_ring);
ixgbe_clean_rx_irq(q_vector, adapter->rx_ring, &work_done, budget); ixgbe_clean_rx_irq(q_vector, adapter->rx_ring, &work_done, budget);
if (tx_cleaned) if (!tx_clean_complete)
work_done = budget; work_done = budget;
/* If budget not fully consumed, exit the polling mode */ /* If budget not fully consumed, exit the polling mode */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册