mirror of
				https://git.openwrt.org/openwrt/openwrt.git
				synced 2025-10-31 16:15:54 +00:00 
			
		
		
		
	Refresh patches 6.12 for airoha and econet Fixes:122135b964("airoha: an7581: add support for kernel 6.12") Fixes:73d0f92460("kernel: Add new platform EcoNet MIPS") Signed-off-by: Leo Barsky <leobrsky@proton.me> Link: https://github.com/openwrt/openwrt/pull/20073 Signed-off-by: Robert Marko <robimarko@gmail.com>
		
			
				
	
	
		
			65 lines
		
	
	
		
			2.5 KiB
		
	
	
	
		
			Diff
		
	
	
	
	
	
			
		
		
	
	
			65 lines
		
	
	
		
			2.5 KiB
		
	
	
	
		
			Diff
		
	
	
	
	
	
| From 7b46bdaec00a675f6fac9d0b01a2105b5746ebe9 Mon Sep 17 00:00:00 2001
 | |
| From: Lorenzo Bianconi <lorenzo@kernel.org>
 | |
| Date: Thu, 19 Jun 2025 09:07:25 +0200
 | |
| Subject: [PATCH 2/2] net: airoha: Differentiate hwfd buffer size for QDMA0 and
 | |
|  QDMA1
 | |
| 
 | |
| EN7581 SoC allows configuring the size and the number of buffers in
 | |
| hwfd payload queue for both QDMA0 and QDMA1.
 | |
| In order to reduce the required DRAM used for hwfd buffers queues and
 | |
| decrease the memory footprint, differentiate hwfd buffer size for QDMA0
 | |
| and QDMA1 and reduce hwfd buffer size to 1KB for QDMA1 (WAN) while
 | |
| maintaining 2KB for QDMA0 (LAN).
 | |
| 
 | |
| Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
 | |
| Reviewed-by: Simon Horman <horms@kernel.org>
 | |
| Link: https://patch.msgid.link/20250619-airoha-hw-num-desc-v4-2-49600a9b319a@kernel.org
 | |
| Signed-off-by: Jakub Kicinski <kuba@kernel.org>
 | |
| ---
 | |
|  drivers/net/ethernet/airoha/airoha_eth.c | 10 ++++++----
 | |
|  1 file changed, 6 insertions(+), 4 deletions(-)
 | |
| 
 | |
| --- a/drivers/net/ethernet/airoha/airoha_eth.c
 | |
| +++ b/drivers/net/ethernet/airoha/airoha_eth.c
 | |
| @@ -1068,14 +1068,15 @@ static int airoha_qdma_init_hfwd_queues(
 | |
|  	int size, index, num_desc = HW_DSCP_NUM;
 | |
|  	struct airoha_eth *eth = qdma->eth;
 | |
|  	int id = qdma - ð->qdma[0];
 | |
| +	u32 status, buf_size;
 | |
|  	dma_addr_t dma_addr;
 | |
|  	const char *name;
 | |
| -	u32 status;
 | |
|  
 | |
|  	name = devm_kasprintf(eth->dev, GFP_KERNEL, "qdma%d-buf", id);
 | |
|  	if (!name)
 | |
|  		return -ENOMEM;
 | |
|  
 | |
| +	buf_size = id ? AIROHA_MAX_PACKET_SIZE / 2 : AIROHA_MAX_PACKET_SIZE;
 | |
|  	index = of_property_match_string(eth->dev->of_node,
 | |
|  					 "memory-region-names", name);
 | |
|  	if (index >= 0) {
 | |
| @@ -1096,9 +1097,9 @@ static int airoha_qdma_init_hfwd_queues(
 | |
|  		/* Compute the number of hw descriptors according to the
 | |
|  		 * reserved memory size and the payload buffer size
 | |
|  		 */
 | |
| -		num_desc = rmem->size / AIROHA_MAX_PACKET_SIZE;
 | |
| +		num_desc = div_u64(rmem->size, buf_size);
 | |
|  	} else {
 | |
| -		size = AIROHA_MAX_PACKET_SIZE * num_desc;
 | |
| +		size = buf_size * num_desc;
 | |
|  		if (!dmam_alloc_coherent(eth->dev, size, &dma_addr,
 | |
|  					 GFP_KERNEL))
 | |
|  			return -ENOMEM;
 | |
| @@ -1111,9 +1112,10 @@ static int airoha_qdma_init_hfwd_queues(
 | |
|  		return -ENOMEM;
 | |
|  
 | |
|  	airoha_qdma_wr(qdma, REG_FWD_DSCP_BASE, dma_addr);
 | |
| +	/* QDMA0: 2KB. QDMA1: 1KB */
 | |
|  	airoha_qdma_rmw(qdma, REG_HW_FWD_DSCP_CFG,
 | |
|  			HW_FWD_DSCP_PAYLOAD_SIZE_MASK,
 | |
| -			FIELD_PREP(HW_FWD_DSCP_PAYLOAD_SIZE_MASK, 0));
 | |
| +			FIELD_PREP(HW_FWD_DSCP_PAYLOAD_SIZE_MASK, !!id));
 | |
|  	airoha_qdma_rmw(qdma, REG_FWD_DSCP_LOW_THR, FWD_DSCP_LOW_THR_MASK,
 | |
|  			FIELD_PREP(FWD_DSCP_LOW_THR_MASK, 128));
 | |
|  	airoha_qdma_rmw(qdma, REG_LMGR_INIT_CFG,
 |