Introduce EN7581 SoC support with currently rfb board supported. This is a new 64bit SoC from Airoha that is currently almost fully supported upstream with only the DTS missing. Setting source-only waiting for the full upstream support to be completed. Link: https://github.com/openwrt/openwrt/pull/16730 Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
		
			
				
	
	
		
			47 lines
		
	
	
		
			1.6 KiB
		
	
	
	
		
			Diff
		
	
	
	
	
	
			
		
		
	
	
			47 lines
		
	
	
		
			1.6 KiB
		
	
	
	
		
			Diff
		
	
	
	
	
	
From 1f038d5897fe6b439039fc28420842abcc0d126b Mon Sep 17 00:00:00 2001
 | 
						|
From: Lorenzo Bianconi <lorenzo@kernel.org>
 | 
						|
Date: Wed, 17 Jul 2024 10:15:46 +0200
 | 
						|
Subject: [PATCH] net: airoha: fix error branch in airoha_dev_xmit and
 | 
						|
 airoha_set_gdm_ports
 | 
						|
 | 
						|
Fix error case management in airoha_dev_xmit routine since we need to
 | 
						|
DMA unmap pending buffers starting from q->head.
 | 
						|
Moreover fix a typo in error case branch in airoha_set_gdm_ports
 | 
						|
routine.
 | 
						|
 | 
						|
Fixes: 23020f049327 ("net: airoha: Introduce ethernet support for EN7581 SoC")
 | 
						|
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
 | 
						|
Reviewed-by: Simon Horman <horms@kernel.org>
 | 
						|
Link: https://patch.msgid.link/b628871bc8ae4861b5e2ab4db90aaf373cbb7cee.1721203880.git.lorenzo@kernel.org
 | 
						|
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
 | 
						|
---
 | 
						|
 drivers/net/ethernet/mediatek/airoha_eth.c | 10 ++++++----
 | 
						|
 1 file changed, 6 insertions(+), 4 deletions(-)
 | 
						|
 | 
						|
--- a/drivers/net/ethernet/mediatek/airoha_eth.c
 | 
						|
+++ b/drivers/net/ethernet/mediatek/airoha_eth.c
 | 
						|
@@ -977,7 +977,7 @@ static int airoha_set_gdm_ports(struct a
 | 
						|
 	return 0;
 | 
						|
 
 | 
						|
 error:
 | 
						|
-	for (i--; i >= 0; i++)
 | 
						|
+	for (i--; i >= 0; i--)
 | 
						|
 		airoha_set_gdm_port(eth, port_list[i], false);
 | 
						|
 
 | 
						|
 	return err;
 | 
						|
@@ -2432,9 +2432,11 @@ static netdev_tx_t airoha_dev_xmit(struc
 | 
						|
 	return NETDEV_TX_OK;
 | 
						|
 
 | 
						|
 error_unmap:
 | 
						|
-	for (i--; i >= 0; i++)
 | 
						|
-		dma_unmap_single(dev->dev.parent, q->entry[i].dma_addr,
 | 
						|
-				 q->entry[i].dma_len, DMA_TO_DEVICE);
 | 
						|
+	for (i--; i >= 0; i--) {
 | 
						|
+		index = (q->head + i) % q->ndesc;
 | 
						|
+		dma_unmap_single(dev->dev.parent, q->entry[index].dma_addr,
 | 
						|
+				 q->entry[index].dma_len, DMA_TO_DEVICE);
 | 
						|
+	}
 | 
						|
 
 | 
						|
 	spin_unlock_bh(&q->lock);
 | 
						|
 error:
 |