linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] net: macb: Reset TX when TX halt times out
@ 2023-03-16  8:35 Harini Katakam
  2023-03-16 10:54 ` Michal Swiatkowski
  0 siblings, 1 reply; 3+ messages in thread
From: Harini Katakam @ 2023-03-16  8:35 UTC (permalink / raw)
  To: nicolas.ferre, davem, claudiu.beznea, kuba, edumazet, pabeni
  Cc: netdev, linux-kernel, michal.simek, harinikatakamlinux, harini.katakam

From: Harini Katakam <harini.katakam@xilinx.com>

Reset TX when halt times out i.e. disable TX, clean up TX BDs,
interrupts (already done) and enable TX.
This addresses the issue observed when iperf is run at 10Mps Half
duplex where, after multiple collisions and retries, TX halts.

Signed-off-by: Harini Katakam <harini.katakam@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Signed-off-by: Radhey Shyam Pandey <radhey.shyam.pandey@xilinx.com>
---
 drivers/net/ethernet/cadence/macb_main.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c
index 96fd2aa9ee90..473c2d0174ad 100644
--- a/drivers/net/ethernet/cadence/macb_main.c
+++ b/drivers/net/ethernet/cadence/macb_main.c
@@ -1021,6 +1021,7 @@ static void macb_tx_error_task(struct work_struct *work)
 	struct sk_buff		*skb;
 	unsigned int		tail;
 	unsigned long		flags;
+	bool			halt_timeout = false;
 
 	netdev_vdbg(bp->dev, "macb_tx_error_task: q = %u, t = %u, h = %u\n",
 		    (unsigned int)(queue - bp->queues),
@@ -1042,9 +1043,11 @@ static void macb_tx_error_task(struct work_struct *work)
 	 * (in case we have just queued new packets)
 	 * macb/gem must be halted to write TBQP register
 	 */
-	if (macb_halt_tx(bp))
-		/* Just complain for now, reinitializing TX path can be good */
+	if (macb_halt_tx(bp)) {
 		netdev_err(bp->dev, "BUG: halt tx timed out\n");
+		macb_writel(bp, NCR, macb_readl(bp, NCR) & (~MACB_BIT(TE)));
+		halt_timeout = true;
+	}
 
 	/* Treat frames in TX queue including the ones that caused the error.
 	 * Free transmit buffers in upper layer.
@@ -1115,6 +1118,9 @@ static void macb_tx_error_task(struct work_struct *work)
 	macb_writel(bp, TSR, macb_readl(bp, TSR));
 	queue_writel(queue, IER, MACB_TX_INT_FLAGS);
 
+	if (halt_timeout)
+		macb_writel(bp, NCR, macb_readl(bp, NCR) | MACB_BIT(TE));
+
 	/* Now we are ready to start transmission again */
 	netif_tx_start_all_queues(bp->dev);
 	macb_writel(bp, NCR, macb_readl(bp, NCR) | MACB_BIT(TSTART));
-- 
2.17.1


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

* Re: [PATCH net-next] net: macb: Reset TX when TX halt times out
  2023-03-16  8:35 [PATCH net-next] net: macb: Reset TX when TX halt times out Harini Katakam
@ 2023-03-16 10:54 ` Michal Swiatkowski
  2023-03-16 16:20   ` Nicolas Ferre
  0 siblings, 1 reply; 3+ messages in thread
From: Michal Swiatkowski @ 2023-03-16 10:54 UTC (permalink / raw)
  To: Harini Katakam
  Cc: nicolas.ferre, davem, claudiu.beznea, kuba, edumazet, pabeni,
	netdev, linux-kernel, michal.simek, harinikatakamlinux

On Thu, Mar 16, 2023 at 02:05:54PM +0530, Harini Katakam wrote:
> From: Harini Katakam <harini.katakam@xilinx.com>
> 
> Reset TX when halt times out i.e. disable TX, clean up TX BDs,
> interrupts (already done) and enable TX.
> This addresses the issue observed when iperf is run at 10Mps Half
> duplex where, after multiple collisions and retries, TX halts.
> 
> Signed-off-by: Harini Katakam <harini.katakam@xilinx.com>
> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
> Signed-off-by: Radhey Shyam Pandey <radhey.shyam.pandey@xilinx.com>
> ---
>  drivers/net/ethernet/cadence/macb_main.c | 10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c
> index 96fd2aa9ee90..473c2d0174ad 100644
> --- a/drivers/net/ethernet/cadence/macb_main.c
> +++ b/drivers/net/ethernet/cadence/macb_main.c
> @@ -1021,6 +1021,7 @@ static void macb_tx_error_task(struct work_struct *work)
>  	struct sk_buff		*skb;
>  	unsigned int		tail;
>  	unsigned long		flags;
> +	bool			halt_timeout = false;
RCT

Otherwise looks fine
Reviewed-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>

[...]

> -- 
> 2.17.1
> 

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

* Re: [PATCH net-next] net: macb: Reset TX when TX halt times out
  2023-03-16 10:54 ` Michal Swiatkowski
@ 2023-03-16 16:20   ` Nicolas Ferre
  0 siblings, 0 replies; 3+ messages in thread
From: Nicolas Ferre @ 2023-03-16 16:20 UTC (permalink / raw)
  To: Harini Katakam
  Cc: davem, claudiu.beznea, Michal Swiatkowski, kuba, edumazet,
	pabeni, netdev, linux-kernel, michal.simek, harinikatakamlinux

On 16/03/2023 at 11:54, Michal Swiatkowski wrote:
> On Thu, Mar 16, 2023 at 02:05:54PM +0530, Harini Katakam wrote:
>> From: Harini Katakam <harini.katakam@xilinx.com>
>>
>> Reset TX when halt times out i.e. disable TX, clean up TX BDs,
>> interrupts (already done) and enable TX.
>> This addresses the issue observed when iperf is run at 10Mps Half
>> duplex where, after multiple collisions and retries, TX halts.
>>
>> Signed-off-by: Harini Katakam <harini.katakam@xilinx.com>
>> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
>> Signed-off-by: Radhey Shyam Pandey <radhey.shyam.pandey@xilinx.com>
>> ---
>>   drivers/net/ethernet/cadence/macb_main.c | 10 ++++++++--
>>   1 file changed, 8 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c
>> index 96fd2aa9ee90..473c2d0174ad 100644
>> --- a/drivers/net/ethernet/cadence/macb_main.c
>> +++ b/drivers/net/ethernet/cadence/macb_main.c
>> @@ -1021,6 +1021,7 @@ static void macb_tx_error_task(struct work_struct *work)
>>        struct sk_buff          *skb;
>>        unsigned int            tail;
>>        unsigned long           flags;
>> +     bool                    halt_timeout = false;
> RCT

Yes, might not pass the netdev checks.

> Otherwise looks fine
> Reviewed-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>

Likewise, this fixed:
Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com>

Best regards,
   Nicolas

> 
> [...]
> 
>> --
>> 2.17.1
>>

-- 
Nicolas Ferre


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

end of thread, other threads:[~2023-03-16 16:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-16  8:35 [PATCH net-next] net: macb: Reset TX when TX halt times out Harini Katakam
2023-03-16 10:54 ` Michal Swiatkowski
2023-03-16 16:20   ` Nicolas Ferre

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