Commit 65279bee authored by Julio Faracco's avatar Julio Faracco Committed by Jeff Kirsher

i40e: Removing hung_queue variable to use txqueue function parameter

The scope of function .ndo_tx_timeout was changed to include the hang
queue when a TX timeout event occurs. See commit 0290bd29
("netdev: pass the stuck queue to the timeout handler") for more
details. Now, drivers don't need to identify which queue is stopped.
Drivers can simply use the queue index provided by dev_watchdog and
execute all actions needed to restore network traffic. This commit do
some cleanups into Intel i40e driver to remove a redundant loop to find
stopped queue.
Signed-off-by: default avatarJulio Faracco <jcfaracco@gmail.com>
Tested-by: default avatarAndrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
parent 2da259c5
...@@ -307,37 +307,18 @@ static void i40e_tx_timeout(struct net_device *netdev, unsigned int txqueue) ...@@ -307,37 +307,18 @@ static void i40e_tx_timeout(struct net_device *netdev, unsigned int txqueue)
struct i40e_vsi *vsi = np->vsi; struct i40e_vsi *vsi = np->vsi;
struct i40e_pf *pf = vsi->back; struct i40e_pf *pf = vsi->back;
struct i40e_ring *tx_ring = NULL; struct i40e_ring *tx_ring = NULL;
unsigned int i, hung_queue = 0; unsigned int i;
u32 head, val; u32 head, val;
pf->tx_timeout_count++; pf->tx_timeout_count++;
/* find the stopped queue the same way the stack does */ /* with txqueue index, find the tx_ring struct */
for (i = 0; i < netdev->num_tx_queues; i++) { for (i = 0; i < vsi->num_queue_pairs; i++) {
struct netdev_queue *q; if (vsi->tx_rings[i] && vsi->tx_rings[i]->desc) {
unsigned long trans_start; if (txqueue ==
vsi->tx_rings[i]->queue_index) {
q = netdev_get_tx_queue(netdev, i); tx_ring = vsi->tx_rings[i];
trans_start = q->trans_start; break;
if (netif_xmit_stopped(q) &&
time_after(jiffies,
(trans_start + netdev->watchdog_timeo))) {
hung_queue = i;
break;
}
}
if (i == netdev->num_tx_queues) {
netdev_info(netdev, "tx_timeout: no netdev hung queue found\n");
} else {
/* now that we have an index, find the tx_ring struct */
for (i = 0; i < vsi->num_queue_pairs; i++) {
if (vsi->tx_rings[i] && vsi->tx_rings[i]->desc) {
if (hung_queue ==
vsi->tx_rings[i]->queue_index) {
tx_ring = vsi->tx_rings[i];
break;
}
} }
} }
} }
...@@ -363,14 +344,14 @@ static void i40e_tx_timeout(struct net_device *netdev, unsigned int txqueue) ...@@ -363,14 +344,14 @@ static void i40e_tx_timeout(struct net_device *netdev, unsigned int txqueue)
val = rd32(&pf->hw, I40E_PFINT_DYN_CTL0); val = rd32(&pf->hw, I40E_PFINT_DYN_CTL0);
netdev_info(netdev, "tx_timeout: VSI_seid: %d, Q %d, NTC: 0x%x, HWB: 0x%x, NTU: 0x%x, TAIL: 0x%x, INT: 0x%x\n", netdev_info(netdev, "tx_timeout: VSI_seid: %d, Q %d, NTC: 0x%x, HWB: 0x%x, NTU: 0x%x, TAIL: 0x%x, INT: 0x%x\n",
vsi->seid, hung_queue, tx_ring->next_to_clean, vsi->seid, txqueue, tx_ring->next_to_clean,
head, tx_ring->next_to_use, head, tx_ring->next_to_use,
readl(tx_ring->tail), val); readl(tx_ring->tail), val);
} }
pf->tx_timeout_last_recovery = jiffies; pf->tx_timeout_last_recovery = jiffies;
netdev_info(netdev, "tx_timeout recovery level %d, hung_queue %d\n", netdev_info(netdev, "tx_timeout recovery level %d, txqueue %d\n",
pf->tx_timeout_recovery_level, hung_queue); pf->tx_timeout_recovery_level, txqueue);
switch (pf->tx_timeout_recovery_level) { switch (pf->tx_timeout_recovery_level) {
case 1: case 1:
......
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