On 10-09-2018 19:15, Neil Armstrong wrote:
>
> RX is still ok but now TX fails almost immediately...
>
> With 100ms report :
>
> $ iperf3 -c 192.168.1.47 -t 0 -p 5202 -R -i 0.1
> Connecting to host 192.168.1.47, port 5202
> Reverse mode, remote host 192.168.1.47 is sending
> [  4] local 192.168.1.45 port 45900 connected to 192.168.1.47 port 5202
> [ ID] Interval           Transfer     Bandwidth
> [  4]   0.00-0.10   sec  10.9 MBytes   913 Mbits/sec
> [  4]   0.10-0.20   sec  11.0 MBytes   923 Mbits/sec
> [  4]   0.20-0.30   sec  6.34 MBytes   532 Mbits/sec
> [  4]   0.30-0.40   sec  0.00 Bytes  0.00 bits/sec
> [  4]   0.40-0.50   sec  0.00 Bytes  0.00 bits/sec
> [  4]   0.50-0.60   sec  0.00 Bytes  0.00 bits/sec
> [  4]   0.60-0.70   sec  0.00 Bytes  0.00 bits/sec
> [  4]   0.70-0.80   sec  0.00 Bytes  0.00 bits/sec
> [  4]   0.80-0.90   sec  0.00 Bytes  0.00 bits/sec
> [  4]   0.90-1.00   sec  0.00 Bytes  0.00 bits/sec
> [  4]   1.00-1.10   sec  0.00 Bytes  0.00 bits/sec
> ^C[  4]   1.10-1.10   sec  0.00 Bytes  0.00 bits/sec
> - - - - - - - - - - - - - - - - - - - - - - - - -
> [ ID] Interval           Transfer     Bandwidth
> [  4]   0.00-1.10   sec  0.00 Bytes  0.00 bits/sec                  sender
> [  4]   0.00-1.10   sec  28.2 MBytes   214 Mbits/sec                  receiver
> iperf3: interrupt - the client has terminated
>
> Neil

Ok, here goes another incremental patch. If this doesn't work can
you please send me a link to the spec of the board you are using ?

Thanks and Best Regards,
Jose Miguel Abreu

>From d6c3bc9c282eadfa754bd78e7c7447a200dd1737 Mon Sep 17 00:00:00 2001
Message-Id: <d6c3bc9c282eadfa754bd78e7c7447a200dd1737.1536653739.git.joab...@synopsys.com>
From: Jose Abreu <joab...@synopsys.com>
Date: Tue, 11 Sep 2018 10:15:31 +0200
Subject: [PATCH] fixup_coalesce_4

Signed-off-by: Jose Abreu <joab...@synopsys.com>
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 31 ++++++++++-------------
 1 file changed, 13 insertions(+), 18 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index f6587ee372ab..b6d661f17bd7 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -1857,17 +1857,14 @@ static void stmmac_dma_operation_mode(struct stmmac_priv *priv)
  * @queue: TX queue index
  * Description: it reclaims the transmit resources after transmission completes.
  */
-static int stmmac_tx_clean(struct stmmac_priv *priv, int limit, u32 queue,
-			   bool *more)
+static bool stmmac_tx_clean(struct stmmac_priv *priv, u32 queue)
 {
 	struct stmmac_tx_queue *tx_q = &priv->tx_queue[queue];
 	unsigned int bytes_compl = 0, pkts_compl = 0;
+	bool has_more = false;
 	unsigned int entry;
 
-	netif_tx_lock(priv->dev);
-
-	if (more)
-		*more = false;
+	netif_tx_lock_bh(priv->dev);
 
 	priv->xstats.tx_clean++;
 
@@ -1956,12 +1953,12 @@ static int stmmac_tx_clean(struct stmmac_priv *priv, int limit, u32 queue,
 		mod_timer(&priv->eee_ctrl_timer, STMMAC_LPI_T(eee_timer));
 	}
 
-	if (more && (tx_q->dirty_tx != tx_q->cur_tx))
-		*more = true;
+	if (tx_q->dirty_tx != tx_q->cur_tx)
+		has_more = true;
 
-	netif_tx_unlock(priv->dev);
+	netif_tx_unlock_bh(priv->dev);
 
-	return pkts_compl;
+	return has_more;
 }
 
 /**
@@ -2257,10 +2254,9 @@ static void stmmac_tx_timer_arm(struct stmmac_priv *priv, u32 queue)
 static void stmmac_tx_timer(struct timer_list *t)
 {
 	struct stmmac_tx_queue *tx_q = from_timer(tx_q, t, txtimer);
-	struct stmmac_priv *priv = tx_q->priv_data;
-	bool more;
 
-	stmmac_tx_clean(priv, ~0, tx_q->queue_index, &more);
+	if (likely(napi_schedule_prep(&tx_q->napi)))
+		__napi_schedule(&tx_q->napi);
 }
 
 /**
@@ -3562,15 +3558,14 @@ static int stmmac_tx_poll(struct napi_struct *napi, int budget)
 		container_of(napi, struct stmmac_tx_queue, napi);
 	struct stmmac_priv *priv = tx_q->priv_data;
 	u32 chan = tx_q->queue_index;
-	int work_done = 0;
 
 	priv->xstats.napi_poll++;
 
-	work_done = stmmac_tx_clean(priv, budget, chan, NULL);
-	if (work_done < budget)
-		napi_complete_done(napi, work_done);
+	if (stmmac_tx_clean(priv, chan))
+		return budget;
 
-	return min(work_done, budget);
+	napi_complete_done(napi, 0);
+	return 0;
 }
 
 /**
-- 
2.7.4

Reply via email to