[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aIXmcUCQe7-gm9--@lore-desk>
Date: Sun, 27 Jul 2025 10:42:25 +0200
From: Lorenzo Bianconi <lorenzo@...nel.org>
To: Vadim Fedorenko <vadim.fedorenko@...ux.dev>
Cc: 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>, 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?
ack, right. This is was the original approach in the vendor sdk.
I will fix in v6.
Regards,
Lorenzo
Download attachment "signature.asc" of type "application/pgp-signature" (229 bytes)
Powered by blists - more mailing lists