mirror of
				https://git.openwrt.org/openwrt/openwrt.git
				synced 2025-10-31 20:18:35 +00:00 
			
		
		
		
	Backport upstream patch for AN7583 Ethernet support. While at it also backport some additional fixes required to apply the AN7583 patches cleanly. Refresh all affected patch automatically (aside from the XSI patch that changed the implementation) Link: https://github.com/openwrt/openwrt/pull/20489 Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
		
			
				
	
	
		
			72 lines
		
	
	
		
			2.2 KiB
		
	
	
	
		
			Diff
		
	
	
	
	
	
			
		
		
	
	
			72 lines
		
	
	
		
			2.2 KiB
		
	
	
	
		
			Diff
		
	
	
	
	
	
| From 620d7b91aadbd4eb930895b07e34f0a155a9d3c1 Mon Sep 17 00:00:00 2001
 | |
| From: Lorenzo Bianconi <lorenzo@kernel.org>
 | |
| Date: Fri, 17 Oct 2025 11:06:18 +0200
 | |
| Subject: [PATCH 08/12] net: airoha: ppe: Flush PPE SRAM table during PPE setup
 | |
| 
 | |
| Rely on airoha_ppe_foe_commit_sram_entry routine to flush SRAM PPE table
 | |
| entries. This patch allow moving PPE SRAM flush during PPE setup and
 | |
| avoid dumping uninitialized values via the debugfs if no entries are
 | |
| offloaded yet.
 | |
| 
 | |
| Reviewed-by: Simon Horman <horms@kernel.org>
 | |
| Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
 | |
| Link: https://patch.msgid.link/20251017-an7583-eth-support-v3-9-f28319666667@kernel.org
 | |
| Signed-off-by: Paolo Abeni <pabeni@redhat.com>
 | |
| ---
 | |
|  drivers/net/ethernet/airoha/airoha_ppe.c | 24 ++++++++++++++----------
 | |
|  1 file changed, 14 insertions(+), 10 deletions(-)
 | |
| 
 | |
| --- a/drivers/net/ethernet/airoha/airoha_ppe.c
 | |
| +++ b/drivers/net/ethernet/airoha/airoha_ppe.c
 | |
| @@ -1291,18 +1291,22 @@ static int airoha_ppe_flow_offload_cmd(s
 | |
|  	return -EOPNOTSUPP;
 | |
|  }
 | |
|  
 | |
| -static int airoha_ppe_flush_sram_entries(struct airoha_ppe *ppe,
 | |
| -					 struct airoha_npu *npu)
 | |
| +static int airoha_ppe_flush_sram_entries(struct airoha_ppe *ppe)
 | |
|  {
 | |
|  	u32 sram_num_entries = airoha_ppe_get_total_sram_num_entries(ppe);
 | |
|  	struct airoha_foe_entry *hwe = ppe->foe;
 | |
| -	int i;
 | |
| +	int i, err = 0;
 | |
| +
 | |
| +	for (i = 0; i < sram_num_entries; i++) {
 | |
| +		int err;
 | |
|  
 | |
| -	for (i = 0; i < PPE_SRAM_NUM_ENTRIES; i++)
 | |
|  		memset(&hwe[i], 0, sizeof(*hwe));
 | |
| +		err = airoha_ppe_foe_commit_sram_entry(ppe, i);
 | |
| +		if (err)
 | |
| +			break;
 | |
| +	}
 | |
|  
 | |
| -	return npu->ops.ppe_flush_sram_entries(npu, ppe->foe_dma,
 | |
| -					       sram_num_entries);
 | |
| +	return err;
 | |
|  }
 | |
|  
 | |
|  static struct airoha_npu *airoha_ppe_npu_get(struct airoha_eth *eth)
 | |
| @@ -1339,10 +1343,6 @@ static int airoha_ppe_offload_setup(stru
 | |
|  	}
 | |
|  
 | |
|  	airoha_ppe_hw_init(ppe);
 | |
| -	err = airoha_ppe_flush_sram_entries(ppe, npu);
 | |
| -	if (err)
 | |
| -		goto error_npu_put;
 | |
| -
 | |
|  	airoha_ppe_foe_flow_stats_reset(ppe, npu);
 | |
|  
 | |
|  	rcu_assign_pointer(eth->npu, npu);
 | |
| @@ -1513,6 +1513,10 @@ int airoha_ppe_init(struct airoha_eth *e
 | |
|  	if (!ppe->foe_check_time)
 | |
|  		return -ENOMEM;
 | |
|  
 | |
| +	err = airoha_ppe_flush_sram_entries(ppe);
 | |
| +	if (err)
 | |
| +		return err;
 | |
| +
 | |
|  	err = rhashtable_init(ð->flow_table, &airoha_flow_table_params);
 | |
|  	if (err)
 | |
|  		return err;
 |