[PATCH net-next 2/6] net: airoha: npu: Add more wlan NPU callbacks

Simon Horman horms at kernel.org
Fri Jul 4 07:51:42 PDT 2025


On Wed, Jul 02, 2025 at 12:23:31AM +0200, Lorenzo Bianconi wrote:
> Introduce more NPU wlan callbacks used by wlan driver (MT76) to initialize
> NPU module register for offloading wireless-wired offloading.
> This is a preliminary patch to enable wlan flowtable offload for EN7581
> SoC with MT76 driver.
> 
> Signed-off-by: Lorenzo Bianconi <lorenzo at kernel.org>

...

> diff --git a/drivers/net/ethernet/airoha/airoha_npu.h b/drivers/net/ethernet/airoha/airoha_npu.h
> index 242f0d15b2f7c262daaf7bb78ee386ccc8a0433d..9fdec469e7b0e7caa5d988dfd78578d860a0e66d 100644
> --- a/drivers/net/ethernet/airoha/airoha_npu.h
> +++ b/drivers/net/ethernet/airoha/airoha_npu.h
> @@ -30,6 +30,27 @@ struct airoha_npu {
>  					    u32 entry_size, u32 hash,
>  					    bool ppe2);
>  		int (*wlan_init_reserved_memory)(struct airoha_npu *npu);
> +		int (*wlan_set_txrx_reg_addr)(struct airoha_npu *npu,
> +					      int ifindex, u32 dir,
> +					      u32 in_counter_addr,
> +					      u32 out_status_addr,
> +					      u32 out_counter_addr);
> +		int (*wlan_set_pcie_port_type)(struct airoha_npu *npu,
> +					       int ifindex, u32 port_type);
> +		int (*wlan_set_pcie_addr)(struct airoha_npu *npu, int ifindex,
> +					  u32 addr);
> +		int (*wlan_set_desc)(struct airoha_npu *npu, int ifindex,
> +				     u32 desc);
> +		int (*wlan_set_tx_ring_pcie_addr)(struct airoha_npu *npu,
> +						  int ifindex, u32 addr);
> +		int (*wlan_get_rx_desc_base)(struct airoha_npu *npu,
> +					     int ifindex, u32 *data);
> +		int (*wlan_set_tx_buf_space_base)(struct airoha_npu *npu,
> +						  int ifindex, u32 addr);
> +		int (*wlan_set_rx_ring_for_txdone)(struct airoha_npu *npu,
> +						   int ifindex, u32 addr);
> +		u32 (*wlan_get_queue_addr)(struct airoha_npu *npu, int qid,
> +					   bool xmit);

Hi Lorenzo,

It seems that the implementation in this patch of
most (all?) of the callbacks are trivial wrapper around
airoha_npu_wlan_send_msg(). Which provide a named callback to callers.

It seems to me that a different approach would be to provide a
wlan_send_msg() callback (name could be different, of course),
and have callers pass the _wlan_send_msg(). Which for one thing,
seems far less verbose in this driver.

Could you comment on these different approaches?

...



More information about the Linux-mediatek mailing list