netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 net] lan743x: Fix TX Stall Issue
@ 2019-03-13 19:55 Bryan Whitehead
  2019-03-13 20:43 ` David Miller
  0 siblings, 1 reply; 4+ messages in thread
From: Bryan Whitehead @ 2019-03-13 19:55 UTC (permalink / raw)
  To: davem; +Cc: netdev, UNGLinuxDriver

It has been observed that tx queue may stall while downloading
from certain web sites (example www.speedtest.net)

The cause has been tracked down to a corner case where
the tx interrupt vector was disabled automatically, but
was not re enabled later.

The lan743x has two mechanisms to enable/disable individual
interrupts. Interrupts can be enabled/disabled by individual
source, and they can also be enabled/disabled by individual
vector which has been mapped to the source. Both must be
enabled for interrupts to work properly.

The TX code path, primarily uses the interrupt enable/disable of
the TX source bit, while leaving the vector enabled all the time.

However, while investigating this issue it was noticed that
the driver requested the use of the vector auto clear feature.

The test above revealed a case where the vector enable was
cleared unintentionally.

This patch fixes the issue by deleting the lines that request
the vector auto clear feature to be used.

Fixes: 23f0703c125b ("lan743x: Add main source files for new lan743x driver")
Signed-off-by: Bryan Whitehead <Bryan.Whitehead@microchip.com>
---
 drivers/net/ethernet/microchip/lan743x_main.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/drivers/net/ethernet/microchip/lan743x_main.c b/drivers/net/ethernet/microchip/lan743x_main.c
index 2876bab..13e6bf1 100644
--- a/drivers/net/ethernet/microchip/lan743x_main.c
+++ b/drivers/net/ethernet/microchip/lan743x_main.c
@@ -585,8 +585,7 @@ static int lan743x_intr_open(struct lan743x_adapter *adapter)
 
 		if (adapter->csr.flags &
 		   LAN743X_CSR_FLAG_SUPPORTS_INTR_AUTO_SET_CLR) {
-			flags = LAN743X_VECTOR_FLAG_VECTOR_ENABLE_AUTO_CLEAR |
-				LAN743X_VECTOR_FLAG_VECTOR_ENABLE_AUTO_SET |
+			flags = LAN743X_VECTOR_FLAG_VECTOR_ENABLE_AUTO_SET |
 				LAN743X_VECTOR_FLAG_SOURCE_ENABLE_AUTO_SET |
 				LAN743X_VECTOR_FLAG_SOURCE_ENABLE_AUTO_CLEAR |
 				LAN743X_VECTOR_FLAG_SOURCE_STATUS_AUTO_CLEAR;
@@ -599,12 +598,6 @@ static int lan743x_intr_open(struct lan743x_adapter *adapter)
 			/* map TX interrupt to vector */
 			int_vec_map1 |= INT_VEC_MAP1_TX_VEC_(index, vector);
 			lan743x_csr_write(adapter, INT_VEC_MAP1, int_vec_map1);
-			if (flags &
-			    LAN743X_VECTOR_FLAG_VECTOR_ENABLE_AUTO_CLEAR) {
-				int_vec_en_auto_clr |= INT_VEC_EN_(vector);
-				lan743x_csr_write(adapter, INT_VEC_EN_AUTO_CLR,
-						  int_vec_en_auto_clr);
-			}
 
 			/* Remove TX interrupt from shared mask */
 			intr->vector_list[0].int_mask &= ~int_bit;
-- 
2.7.4


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

* Re: [PATCH v1 net] lan743x: Fix TX Stall Issue
  2019-03-13 19:55 [PATCH v1 net] lan743x: Fix TX Stall Issue Bryan Whitehead
@ 2019-03-13 20:43 ` David Miller
  0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2019-03-13 20:43 UTC (permalink / raw)
  To: Bryan.Whitehead; +Cc: netdev, UNGLinuxDriver

From: Bryan Whitehead <Bryan.Whitehead@microchip.com>
Date: Wed, 13 Mar 2019 15:55:48 -0400

> It has been observed that tx queue may stall while downloading
> from certain web sites (example www.speedtest.net)
> 
> The cause has been tracked down to a corner case where
> the tx interrupt vector was disabled automatically, but
> was not re enabled later.
> 
> The lan743x has two mechanisms to enable/disable individual
> interrupts. Interrupts can be enabled/disabled by individual
> source, and they can also be enabled/disabled by individual
> vector which has been mapped to the source. Both must be
> enabled for interrupts to work properly.
> 
> The TX code path, primarily uses the interrupt enable/disable of
> the TX source bit, while leaving the vector enabled all the time.
> 
> However, while investigating this issue it was noticed that
> the driver requested the use of the vector auto clear feature.
> 
> The test above revealed a case where the vector enable was
> cleared unintentionally.
> 
> This patch fixes the issue by deleting the lines that request
> the vector auto clear feature to be used.
> 
> Fixes: 23f0703c125b ("lan743x: Add main source files for new lan743x driver")
> Signed-off-by: Bryan Whitehead <Bryan.Whitehead@microchip.com>

Applied and queued up for -stable.

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

* Re: [PATCH v1 net] lan743x: Fix TX Stall Issue
  2019-02-26 19:06 Bryan Whitehead
@ 2019-03-01 19:34 ` David Miller
  0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2019-03-01 19:34 UTC (permalink / raw)
  To: Bryan.Whitehead; +Cc: netdev, UNGLinuxDriver

From: Bryan Whitehead <Bryan.Whitehead@microchip.com>
Date: Tue, 26 Feb 2019 14:06:26 -0500

> It has been observed that tx queue stalls while downloading
> from certain web sites (example www.speedtest.net)
> 
> The cause has been tracked down to a corner case where
> dma descriptors where not setup properly. And there for a tx
> completion interrupt was not signaled.
> 
> This fix corrects the problem by properly marking the end of
> a multi descriptor transmission.
> 
> fixes: 23f0703c125b ("lan743x: Add main source files for new lan743x driver")

"Fixes:" should be capitalized.

> Signed-off-by: Bryan Whitehead <Bryan.Whitehead@microchip.com>

Applied, and queued up for -stable, thanks.

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

* [PATCH v1 net] lan743x: Fix TX Stall Issue
@ 2019-02-26 19:06 Bryan Whitehead
  2019-03-01 19:34 ` David Miller
  0 siblings, 1 reply; 4+ messages in thread
From: Bryan Whitehead @ 2019-02-26 19:06 UTC (permalink / raw)
  To: davem; +Cc: netdev, UNGLinuxDriver

It has been observed that tx queue stalls while downloading
from certain web sites (example www.speedtest.net)

The cause has been tracked down to a corner case where
dma descriptors where not setup properly. And there for a tx
completion interrupt was not signaled.

This fix corrects the problem by properly marking the end of
a multi descriptor transmission.

fixes: 23f0703c125b ("lan743x: Add main source files for new lan743x driver")
Signed-off-by: Bryan Whitehead <Bryan.Whitehead@microchip.com>
---
 drivers/net/ethernet/microchip/lan743x_main.c | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/microchip/lan743x_main.c b/drivers/net/ethernet/microchip/lan743x_main.c
index 310807e..4d1b4a2 100644
--- a/drivers/net/ethernet/microchip/lan743x_main.c
+++ b/drivers/net/ethernet/microchip/lan743x_main.c
@@ -1400,7 +1400,8 @@ static int lan743x_tx_frame_start(struct lan743x_tx *tx,
 }
 
 static void lan743x_tx_frame_add_lso(struct lan743x_tx *tx,
-				     unsigned int frame_length)
+				     unsigned int frame_length,
+				     int nr_frags)
 {
 	/* called only from within lan743x_tx_xmit_frame.
 	 * assuming tx->ring_lock has already been acquired.
@@ -1410,6 +1411,10 @@ static void lan743x_tx_frame_add_lso(struct lan743x_tx *tx,
 
 	/* wrap up previous descriptor */
 	tx->frame_data0 |= TX_DESC_DATA0_EXT_;
+	if (nr_frags <= 0) {
+		tx->frame_data0 |= TX_DESC_DATA0_LS_;
+		tx->frame_data0 |= TX_DESC_DATA0_IOC_;
+	}
 	tx_descriptor = &tx->ring_cpu_ptr[tx->frame_tail];
 	tx_descriptor->data0 = tx->frame_data0;
 
@@ -1514,8 +1519,11 @@ static void lan743x_tx_frame_end(struct lan743x_tx *tx,
 	u32 tx_tail_flags = 0;
 
 	/* wrap up previous descriptor */
-	tx->frame_data0 |= TX_DESC_DATA0_LS_;
-	tx->frame_data0 |= TX_DESC_DATA0_IOC_;
+	if ((tx->frame_data0 & TX_DESC_DATA0_DTYPE_MASK_) ==
+	    TX_DESC_DATA0_DTYPE_DATA_) {
+		tx->frame_data0 |= TX_DESC_DATA0_LS_;
+		tx->frame_data0 |= TX_DESC_DATA0_IOC_;
+	}
 
 	tx_descriptor = &tx->ring_cpu_ptr[tx->frame_tail];
 	buffer_info = &tx->buffer_info[tx->frame_tail];
@@ -1600,7 +1608,7 @@ static netdev_tx_t lan743x_tx_xmit_frame(struct lan743x_tx *tx,
 	}
 
 	if (gso)
-		lan743x_tx_frame_add_lso(tx, frame_length);
+		lan743x_tx_frame_add_lso(tx, frame_length, nr_frags);
 
 	if (nr_frags <= 0)
 		goto finish;
-- 
2.7.4


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

end of thread, other threads:[~2019-03-13 20:43 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-13 19:55 [PATCH v1 net] lan743x: Fix TX Stall Issue Bryan Whitehead
2019-03-13 20:43 ` David Miller
  -- strict thread matches above, loose matches on Subject: below --
2019-02-26 19:06 Bryan Whitehead
2019-03-01 19:34 ` 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).