netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] cxgb4: fix throughput drop during Tx backpressure
@ 2020-03-19 17:38 Rahul Lakkireddy
  2020-03-19 17:38 ` [PATCH net] cxgb4: fix Txq restart check during backpressure Rahul Lakkireddy
  2020-03-20  4:29 ` [PATCH net] cxgb4: fix throughput drop during Tx backpressure David Miller
  0 siblings, 2 replies; 4+ messages in thread
From: Rahul Lakkireddy @ 2020-03-19 17:38 UTC (permalink / raw)
  To: netdev; +Cc: davem, nirranjan, vishal, dt

commit 7c3bebc3d868 ("cxgb4: request the TX CIDX updates to status page")
reverted back to getting Tx CIDX updates via DMA, instead of interrupts,
introduced by commit d429005fdf2c ("cxgb4/cxgb4vf: Add support for SGE
doorbell queue timer")

However, it missed reverting back several code changes where Tx CIDX
updates are not explicitly requested during backpressure when using
interrupt mode. These missed changes cause slow recovery during
backpressure because the corresponding interrupt no longer comes and
hence results in Tx throughput drop.

So, revert back these missed code changes, as well, which will allow
explicitly requesting Tx CIDX updates when backpressure happens.
This enables the corresponding interrupt with Tx CIDX update message
to get generated and hence speed up recovery and restore back
throughput.

Fixes: 7c3bebc3d868 ("cxgb4: request the TX CIDX updates to status page")
Fixes: d429005fdf2c ("cxgb4/cxgb4vf: Add support for SGE doorbell queue timer")
Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
---
 drivers/net/ethernet/chelsio/cxgb4/sge.c | 42 ++----------------------
 1 file changed, 2 insertions(+), 40 deletions(-)

diff --git a/drivers/net/ethernet/chelsio/cxgb4/sge.c b/drivers/net/ethernet/chelsio/cxgb4/sge.c
index 97cda501e7e8..c816837fbd85 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/sge.c
+++ b/drivers/net/ethernet/chelsio/cxgb4/sge.c
@@ -1486,16 +1486,7 @@ static netdev_tx_t cxgb4_eth_xmit(struct sk_buff *skb, struct net_device *dev)
 		 * has opened up.
 		 */
 		eth_txq_stop(q);
-
-		/* If we're using the SGE Doorbell Queue Timer facility, we
-		 * don't need to ask the Firmware to send us Egress Queue CIDX
-		 * Updates: the Hardware will do this automatically.  And
-		 * since we send the Ingress Queue CIDX Updates to the
-		 * corresponding Ethernet Response Queue, we'll get them very
-		 * quickly.
-		 */
-		if (!q->dbqt)
-			wr_mid |= FW_WR_EQUEQ_F | FW_WR_EQUIQ_F;
+		wr_mid |= FW_WR_EQUEQ_F | FW_WR_EQUIQ_F;
 	}
 
 	wr = (void *)&q->q.desc[q->q.pidx];
@@ -1805,16 +1796,7 @@ static netdev_tx_t cxgb4_vf_eth_xmit(struct sk_buff *skb,
 		 * has opened up.
 		 */
 		eth_txq_stop(txq);
-
-		/* If we're using the SGE Doorbell Queue Timer facility, we
-		 * don't need to ask the Firmware to send us Egress Queue CIDX
-		 * Updates: the Hardware will do this automatically.  And
-		 * since we send the Ingress Queue CIDX Updates to the
-		 * corresponding Ethernet Response Queue, we'll get them very
-		 * quickly.
-		 */
-		if (!txq->dbqt)
-			wr_mid |= FW_WR_EQUEQ_F | FW_WR_EQUIQ_F;
+		wr_mid |= FW_WR_EQUEQ_F | FW_WR_EQUIQ_F;
 	}
 
 	/* Start filling in our Work Request.  Note that we do _not_ handle
@@ -3370,26 +3352,6 @@ static void t4_tx_completion_handler(struct sge_rspq *rspq,
 	}
 
 	txq = &s->ethtxq[pi->first_qset + rspq->idx];
-
-	/* We've got the Hardware Consumer Index Update in the Egress Update
-	 * message.  If we're using the SGE Doorbell Queue Timer mechanism,
-	 * these Egress Update messages will be our sole CIDX Updates we get
-	 * since we don't want to chew up PCIe bandwidth for both Ingress
-	 * Messages and Status Page writes.  However, The code which manages
-	 * reclaiming successfully DMA'ed TX Work Requests uses the CIDX value
-	 * stored in the Status Page at the end of the TX Queue.  It's easiest
-	 * to simply copy the CIDX Update value from the Egress Update message
-	 * to the Status Page.  Also note that no Endian issues need to be
-	 * considered here since both are Big Endian and we're just copying
-	 * bytes consistently ...
-	 */
-	if (txq->dbqt) {
-		struct cpl_sge_egr_update *egr;
-
-		egr = (struct cpl_sge_egr_update *)rsp;
-		WRITE_ONCE(txq->q.stat->cidx, egr->cidx);
-	}
-
 	t4_sge_eth_txq_egress_update(adapter, txq, -1);
 }
 
-- 
2.24.0


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

* [PATCH net] cxgb4: fix Txq restart check during backpressure
  2020-03-19 17:38 [PATCH net] cxgb4: fix throughput drop during Tx backpressure Rahul Lakkireddy
@ 2020-03-19 17:38 ` Rahul Lakkireddy
  2020-03-20  4:30   ` David Miller
  2020-03-20  4:29 ` [PATCH net] cxgb4: fix throughput drop during Tx backpressure David Miller
  1 sibling, 1 reply; 4+ messages in thread
From: Rahul Lakkireddy @ 2020-03-19 17:38 UTC (permalink / raw)
  To: netdev; +Cc: davem, nirranjan, vishal, dt

Driver reclaims descriptors in much smaller batches, even if hardware
indicates more to reclaim, during backpressure. So, fix the check to
restart the Txq during backpressure, by looking at how many
descriptors hardware had indicated to reclaim, and not on how many
descriptors that driver had actually reclaimed. Once the Txq is
restarted, driver will reclaim even more descriptors when Tx path
is entered again.

Fixes: d429005fdf2c ("cxgb4/cxgb4vf: Add support for SGE doorbell queue timer")
Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
---
 drivers/net/ethernet/chelsio/cxgb4/sge.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/chelsio/cxgb4/sge.c b/drivers/net/ethernet/chelsio/cxgb4/sge.c
index c816837fbd85..cab3d17e0e1a 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/sge.c
+++ b/drivers/net/ethernet/chelsio/cxgb4/sge.c
@@ -1307,8 +1307,9 @@ static inline void *write_tso_wr(struct adapter *adap, struct sk_buff *skb,
 int t4_sge_eth_txq_egress_update(struct adapter *adap, struct sge_eth_txq *eq,
 				 int maxreclaim)
 {
+	unsigned int reclaimed, hw_cidx;
 	struct sge_txq *q = &eq->q;
-	unsigned int reclaimed;
+	int hw_in_use;
 
 	if (!q->in_use || !__netif_tx_trylock(eq->txq))
 		return 0;
@@ -1316,12 +1317,17 @@ int t4_sge_eth_txq_egress_update(struct adapter *adap, struct sge_eth_txq *eq,
 	/* Reclaim pending completed TX Descriptors. */
 	reclaimed = reclaim_completed_tx(adap, &eq->q, maxreclaim, true);
 
+	hw_cidx = ntohs(READ_ONCE(q->stat->cidx));
+	hw_in_use = q->pidx - hw_cidx;
+	if (hw_in_use < 0)
+		hw_in_use += q->size;
+
 	/* If the TX Queue is currently stopped and there's now more than half
 	 * the queue available, restart it.  Otherwise bail out since the rest
 	 * of what we want do here is with the possibility of shipping any
 	 * currently buffered Coalesced TX Work Request.
 	 */
-	if (netif_tx_queue_stopped(eq->txq) && txq_avail(q) > (q->size / 2)) {
+	if (netif_tx_queue_stopped(eq->txq) && hw_in_use < (q->size / 2)) {
 		netif_tx_wake_queue(eq->txq);
 		eq->q.restarts++;
 	}
-- 
2.24.0


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

* Re: [PATCH net] cxgb4: fix throughput drop during Tx backpressure
  2020-03-19 17:38 [PATCH net] cxgb4: fix throughput drop during Tx backpressure Rahul Lakkireddy
  2020-03-19 17:38 ` [PATCH net] cxgb4: fix Txq restart check during backpressure Rahul Lakkireddy
@ 2020-03-20  4:29 ` David Miller
  1 sibling, 0 replies; 4+ messages in thread
From: David Miller @ 2020-03-20  4:29 UTC (permalink / raw)
  To: rahul.lakkireddy; +Cc: netdev, nirranjan, vishal, dt

From: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
Date: Thu, 19 Mar 2020 23:08:09 +0530

> commit 7c3bebc3d868 ("cxgb4: request the TX CIDX updates to status page")
> reverted back to getting Tx CIDX updates via DMA, instead of interrupts,
> introduced by commit d429005fdf2c ("cxgb4/cxgb4vf: Add support for SGE
> doorbell queue timer")
> 
> However, it missed reverting back several code changes where Tx CIDX
> updates are not explicitly requested during backpressure when using
> interrupt mode. These missed changes cause slow recovery during
> backpressure because the corresponding interrupt no longer comes and
> hence results in Tx throughput drop.
> 
> So, revert back these missed code changes, as well, which will allow
> explicitly requesting Tx CIDX updates when backpressure happens.
> This enables the corresponding interrupt with Tx CIDX update message
> to get generated and hence speed up recovery and restore back
> throughput.
> 
> Fixes: 7c3bebc3d868 ("cxgb4: request the TX CIDX updates to status page")
> Fixes: d429005fdf2c ("cxgb4/cxgb4vf: Add support for SGE doorbell queue timer")
> Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>

Applied and queued up for -stable.

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

* Re: [PATCH net] cxgb4: fix Txq restart check during backpressure
  2020-03-19 17:38 ` [PATCH net] cxgb4: fix Txq restart check during backpressure Rahul Lakkireddy
@ 2020-03-20  4:30   ` David Miller
  0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2020-03-20  4:30 UTC (permalink / raw)
  To: rahul.lakkireddy; +Cc: netdev, nirranjan, vishal, dt

From: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
Date: Thu, 19 Mar 2020 23:08:10 +0530

> Driver reclaims descriptors in much smaller batches, even if hardware
> indicates more to reclaim, during backpressure. So, fix the check to
> restart the Txq during backpressure, by looking at how many
> descriptors hardware had indicated to reclaim, and not on how many
> descriptors that driver had actually reclaimed. Once the Txq is
> restarted, driver will reclaim even more descriptors when Tx path
> is entered again.
> 
> Fixes: d429005fdf2c ("cxgb4/cxgb4vf: Add support for SGE doorbell queue timer")
> Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>

Applied, thanks.

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

end of thread, other threads:[~2020-03-20  4:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-19 17:38 [PATCH net] cxgb4: fix throughput drop during Tx backpressure Rahul Lakkireddy
2020-03-19 17:38 ` [PATCH net] cxgb4: fix Txq restart check during backpressure Rahul Lakkireddy
2020-03-20  4:30   ` David Miller
2020-03-20  4:29 ` [PATCH net] cxgb4: fix throughput drop during Tx backpressure David Miller

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).