lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ff106cec-7e63-4475-a0e6-452bfcb823b3@linux.dev>
Date: Thu, 24 Jul 2025 11:09:56 +0100
From: Vadim Fedorenko <vadim.fedorenko@...ux.dev>
To: Lorenzo Bianconi <lorenzo@...nel.org>, Andrew Lunn
 <andrew+netdev@...n.ch>, "David S. Miller" <davem@...emloft.net>,
 Eric Dumazet <edumazet@...gle.com>, Jakub Kicinski <kuba@...nel.org>,
 Paolo Abeni <pabeni@...hat.com>, Rob Herring <robh@...nel.org>,
 Krzysztof Kozlowski <krzk+dt@...nel.org>, Conor Dooley <conor+dt@...nel.org>
Cc: Simon Horman <horms@...nel.org>, Felix Fietkau <nbd@....name>,
 linux-arm-kernel@...ts.infradead.org, linux-mediatek@...ts.infradead.org,
 netdev@...r.kernel.org, devicetree@...r.kernel.org
Subject: Re: [PATCH net-next v5 3/7] net: airoha: npu: Add wlan_{send,get}_msg
 NPU callbacks

On 23/07/2025 18:19, Lorenzo Bianconi wrote:
> Introduce wlan_send_msg() and wlan_get_msg() NPU wlan callbacks used
> by the wlan driver (MT76) to initialize NPU module registers in order to
> offload wireless-wired traffic.
> This is a preliminary patch to enable wlan flowtable offload for EN7581
> SoC with MT76 driver.
> 
> Signed-off-by: Lorenzo Bianconi <lorenzo@...nel.org>
> ---
>   drivers/net/ethernet/airoha/airoha_npu.c | 58 ++++++++++++++++++++++++++++++++
>   drivers/net/ethernet/airoha/airoha_npu.h | 21 ++++++++++++
>   2 files changed, 79 insertions(+)
> 

[...]

> @@ -131,6 +147,12 @@ struct wlan_mbox_data {
>   	u32 func_id;
>   	union {
>   		u32 data;
> +		struct {
> +			u32 dir;
> +			u32 in_counter_addr;
> +			u32 out_status_addr;
> +			u32 out_counter_addr;
> +		} txrx_addr;
>   		u8 stats[WLAN_MAX_STATS_SIZE];
>   	};
>   };
> @@ -424,6 +446,30 @@ static int airoha_npu_wlan_msg_send(struct airoha_npu *npu, int ifindex,
>   	return err;
>   }
>   
> +static int airoha_npu_wlan_msg_get(struct airoha_npu *npu, int ifindex,
> +				   enum airoha_npu_wlan_get_cmd func_id,
> +				   u32 *data, gfp_t gfp)
> +{
> +	struct wlan_mbox_data *wlan_data;
> +	int err;
> +
> +	wlan_data = kzalloc(sizeof(*wlan_data), gfp);
> +	if (!wlan_data)
> +		return -ENOMEM;
> +
> +	wlan_data->ifindex = ifindex;
> +	wlan_data->func_type = NPU_OP_GET;
> +	wlan_data->func_id = func_id;
> +
> +	err = airoha_npu_send_msg(npu, NPU_FUNC_WIFI, wlan_data,
> +				  sizeof(*wlan_data));
> +	if (!err)
> +		*data = wlan_data->data;
> +	kfree(wlan_data);
> +
> +	return err;
> +}

Am I reading it correct, that on message_get you allocate 4408 + 8 byte, 
setting it 0, then reallocate the same size in airoha_npu_send_msg() and
copy the data, and then free both buffers, and this is all done just to
get u32 value back?

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ