netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next 0/2] drivers: net: intel: update i40e and ice to use txqueue parameter from tx_timeout.
@ 2019-12-18 18:38 Julio Faracco
  2019-12-18 18:38 ` [PATCH net-next 1/2] drivers: net: i40e: Removing hung_queue variable to use txqueue function parameter Julio Faracco
  2019-12-18 18:38 ` [PATCH net-next 2/2] drivers: net: ice: " Julio Faracco
  0 siblings, 2 replies; 5+ messages in thread
From: Julio Faracco @ 2019-12-18 18:38 UTC (permalink / raw)
  To: netdev; +Cc: jeffrey.t.kirsher, davem, intel-wired-lan

The scope of function .ndo_tx_timeout is passing the hung queue now
using a parameter called `txqueue`. Some drivers are still using a loop
structure to identify what is the stopped queue inside that function
above. This is a redundant code. So, this series removes some unnecessary
code to make advantage of that new parameter. We don't need rework now.
For further details see: commit 0290bd291cc0 ("netdev: pass the stuck
queue to the timeout handler").

Julio Faracco (2):
  drivers: net: i40e: Removing hung_queue variable to use txqueue
    function parameter
  drivers: net: ice: Removing hung_queue variable to use txqueue
    function parameter

 drivers/net/ethernet/intel/i40e/i40e_main.c | 41 ++++++---------------
 drivers/net/ethernet/intel/ice/ice_main.c   | 41 ++++++---------------
 2 files changed, 22 insertions(+), 60 deletions(-)

-- 
2.17.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH net-next 1/2] drivers: net: i40e: Removing hung_queue variable to use txqueue function parameter
  2019-12-18 18:38 [PATCH net-next 0/2] drivers: net: intel: update i40e and ice to use txqueue parameter from tx_timeout Julio Faracco
@ 2019-12-18 18:38 ` Julio Faracco
  2019-12-20 20:21   ` [Intel-wired-lan] " Bowers, AndrewX
  2019-12-18 18:38 ` [PATCH net-next 2/2] drivers: net: ice: " Julio Faracco
  1 sibling, 1 reply; 5+ messages in thread
From: Julio Faracco @ 2019-12-18 18:38 UTC (permalink / raw)
  To: netdev; +Cc: jeffrey.t.kirsher, davem, intel-wired-lan

The scope of function .ndo_tx_timeout was changed to include the hang
queue when a TX timeout event occurs. See commit 0290bd291cc0
("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 bt 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: Julio Faracco <jcfaracco@gmail.com>
---
 drivers/net/ethernet/intel/i40e/i40e_main.c | 41 ++++++---------------
 1 file changed, 11 insertions(+), 30 deletions(-)

diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
index 4c9ac6c80eb8..71fedee21488 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_main.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
@@ -307,37 +307,18 @@ static void i40e_tx_timeout(struct net_device *netdev, unsigned int txqueue)
 	struct i40e_vsi *vsi = np->vsi;
 	struct i40e_pf *pf = vsi->back;
 	struct i40e_ring *tx_ring = NULL;
-	unsigned int i, hung_queue = 0;
+	unsigned int i;
 	u32 head, val;
 
 	pf->tx_timeout_count++;
 
-	/* find the stopped queue the same way the stack does */
-	for (i = 0; i < netdev->num_tx_queues; i++) {
-		struct netdev_queue *q;
-		unsigned long trans_start;
-
-		q = netdev_get_tx_queue(netdev, i);
-		trans_start = q->trans_start;
-		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;
-				}
+	/* with txqueue 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 (txqueue ==
+			    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)
 			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",
-			    vsi->seid, hung_queue, tx_ring->next_to_clean,
+			    vsi->seid, txqueue, tx_ring->next_to_clean,
 			    head, tx_ring->next_to_use,
 			    readl(tx_ring->tail), val);
 	}
 
 	pf->tx_timeout_last_recovery = jiffies;
-	netdev_info(netdev, "tx_timeout recovery level %d, hung_queue %d\n",
-		    pf->tx_timeout_recovery_level, hung_queue);
+	netdev_info(netdev, "tx_timeout recovery level %d, txqueue %d\n",
+		    pf->tx_timeout_recovery_level, txqueue);
 
 	switch (pf->tx_timeout_recovery_level) {
 	case 1:
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH net-next 2/2] drivers: net: ice: Removing hung_queue variable to use txqueue function parameter
  2019-12-18 18:38 [PATCH net-next 0/2] drivers: net: intel: update i40e and ice to use txqueue parameter from tx_timeout Julio Faracco
  2019-12-18 18:38 ` [PATCH net-next 1/2] drivers: net: i40e: Removing hung_queue variable to use txqueue function parameter Julio Faracco
@ 2019-12-18 18:38 ` Julio Faracco
  2019-12-20 20:24   ` [Intel-wired-lan] " Bowers, AndrewX
  1 sibling, 1 reply; 5+ messages in thread
From: Julio Faracco @ 2019-12-18 18:38 UTC (permalink / raw)
  To: netdev; +Cc: jeffrey.t.kirsher, davem, intel-wired-lan

The scope of function .ndo_tx_timeout was changed to include the hang
queue when a TX timeout event occurs. See commit 0290bd291cc0
("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 bt dev_watchdog and
execute all actions needed to restore network traffic. This commit do
some cleanups into Intel ice driver to remove a redundant loop to find
stopped queue.

Signed-off-by: Julio Faracco <jcfaracco@gmail.com>
---
 drivers/net/ethernet/intel/ice/ice_main.c | 41 ++++++-----------------
 1 file changed, 11 insertions(+), 30 deletions(-)

diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c
index 4d5220c9c721..2d7ecdc157be 100644
--- a/drivers/net/ethernet/intel/ice/ice_main.c
+++ b/drivers/net/ethernet/intel/ice/ice_main.c
@@ -5066,36 +5066,17 @@ static void ice_tx_timeout(struct net_device *netdev, unsigned int txqueue)
 	struct ice_ring *tx_ring = NULL;
 	struct ice_vsi *vsi = np->vsi;
 	struct ice_pf *pf = vsi->back;
-	int hung_queue = -1;
 	u32 i;
 
 	pf->tx_timeout_count++;
 
-	/* find the stopped queue the same way dev_watchdog() does */
-	for (i = 0; i < netdev->num_tx_queues; i++) {
-		unsigned long trans_start;
-		struct netdev_queue *q;
-
-		q = netdev_get_tx_queue(netdev, i);
-		trans_start = q->trans_start;
-		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_txq; i++)
-			if (vsi->tx_rings[i] && vsi->tx_rings[i]->desc)
-				if (hung_queue == vsi->tx_rings[i]->q_index) {
-					tx_ring = vsi->tx_rings[i];
-					break;
-				}
+	/* now that we have an index, find the tx_ring struct */
+	for (i = 0; i < vsi->num_txq; i++)
+		if (vsi->tx_rings[i] && vsi->tx_rings[i]->desc)
+			if (txqueue == vsi->tx_rings[i]->q_index) {
+				tx_ring = vsi->tx_rings[i];
+				break;
+			}
 
 	/* Reset recovery level if enough time has elapsed after last timeout.
 	 * Also ensure no new reset action happens before next timeout period.
@@ -5110,19 +5091,19 @@ static void ice_tx_timeout(struct net_device *netdev, unsigned int txqueue)
 		struct ice_hw *hw = &pf->hw;
 		u32 head, val = 0;
 
-		head = (rd32(hw, QTX_COMM_HEAD(vsi->txq_map[hung_queue])) &
+		head = (rd32(hw, QTX_COMM_HEAD(vsi->txq_map[txqueue])) &
 			QTX_COMM_HEAD_HEAD_M) >> QTX_COMM_HEAD_HEAD_S;
 		/* Read interrupt register */
 		val = rd32(hw, GLINT_DYN_CTL(tx_ring->q_vector->reg_idx));
 
 		netdev_info(netdev, "tx_timeout: VSI_num: %d, Q %d, NTC: 0x%x, HW_HEAD: 0x%x, NTU: 0x%x, INT: 0x%x\n",
-			    vsi->vsi_num, hung_queue, tx_ring->next_to_clean,
+			    vsi->vsi_num, txqueue, tx_ring->next_to_clean,
 			    head, tx_ring->next_to_use, val);
 	}
 
 	pf->tx_timeout_last_recovery = jiffies;
-	netdev_info(netdev, "tx_timeout recovery level %d, hung_queue %d\n",
-		    pf->tx_timeout_recovery_level, hung_queue);
+	netdev_info(netdev, "tx_timeout recovery level %d, txqueue %d\n",
+		    pf->tx_timeout_recovery_level, txqueue);
 
 	switch (pf->tx_timeout_recovery_level) {
 	case 1:
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* RE: [Intel-wired-lan] [PATCH net-next 1/2] drivers: net: i40e: Removing hung_queue variable to use txqueue function parameter
  2019-12-18 18:38 ` [PATCH net-next 1/2] drivers: net: i40e: Removing hung_queue variable to use txqueue function parameter Julio Faracco
@ 2019-12-20 20:21   ` Bowers, AndrewX
  0 siblings, 0 replies; 5+ messages in thread
From: Bowers, AndrewX @ 2019-12-20 20:21 UTC (permalink / raw)
  To: netdev; +Cc: intel-wired-lan

> -----Original Message-----
> From: Intel-wired-lan [mailto:intel-wired-lan-bounces@osuosl.org] On
> Behalf Of Julio Faracco
> Sent: Wednesday, December 18, 2019 10:39 AM
> To: netdev@vger.kernel.org
> Cc: intel-wired-lan@lists.osuosl.org; davem@davemloft.net
> Subject: [Intel-wired-lan] [PATCH net-next 1/2] drivers: net: 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 0290bd291cc0
> ("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 bt 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: Julio Faracco <jcfaracco@gmail.com>
> ---
>  drivers/net/ethernet/intel/i40e/i40e_main.c | 41 ++++++---------------
>  1 file changed, 11 insertions(+), 30 deletions(-)

Tested-by: Andrew Bowers <andrewx.bowers@intel.com>



^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: [Intel-wired-lan] [PATCH net-next 2/2] drivers: net: ice: Removing hung_queue variable to use txqueue function parameter
  2019-12-18 18:38 ` [PATCH net-next 2/2] drivers: net: ice: " Julio Faracco
@ 2019-12-20 20:24   ` Bowers, AndrewX
  0 siblings, 0 replies; 5+ messages in thread
From: Bowers, AndrewX @ 2019-12-20 20:24 UTC (permalink / raw)
  To: netdev; +Cc: intel-wired-lan

> -----Original Message-----
> From: Intel-wired-lan [mailto:intel-wired-lan-bounces@osuosl.org] On
> Behalf Of Julio Faracco
> Sent: Wednesday, December 18, 2019 10:39 AM
> To: netdev@vger.kernel.org
> Cc: intel-wired-lan@lists.osuosl.org; davem@davemloft.net
> Subject: [Intel-wired-lan] [PATCH net-next 2/2] drivers: net: ice: 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 0290bd291cc0
> ("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 bt dev_watchdog and
> execute all actions needed to restore network traffic. This commit do some
> cleanups into Intel ice driver to remove a redundant loop to find stopped
> queue.
> 
> Signed-off-by: Julio Faracco <jcfaracco@gmail.com>
> ---
>  drivers/net/ethernet/intel/ice/ice_main.c | 41 ++++++-----------------
>  1 file changed, 11 insertions(+), 30 deletions(-)

Tested-by: Andrew Bowers <andrewx.bowers@intel.com>

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-12-20 20:24 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-18 18:38 [PATCH net-next 0/2] drivers: net: intel: update i40e and ice to use txqueue parameter from tx_timeout Julio Faracco
2019-12-18 18:38 ` [PATCH net-next 1/2] drivers: net: i40e: Removing hung_queue variable to use txqueue function parameter Julio Faracco
2019-12-20 20:21   ` [Intel-wired-lan] " Bowers, AndrewX
2019-12-18 18:38 ` [PATCH net-next 2/2] drivers: net: ice: " Julio Faracco
2019-12-20 20:24   ` [Intel-wired-lan] " Bowers, AndrewX

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).