linux-mediatek.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Lorenzo Bianconi <lorenzo@kernel.org>
To: Vadim Fedorenko <vadim.fedorenko@linux.dev>
Cc: Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	Simon Horman <horms@kernel.org>, Felix Fietkau <nbd@nbd.name>,
	linux-arm-kernel@lists.infradead.org,
	linux-mediatek@lists.infradead.org, netdev@vger.kernel.org,
	devicetree@vger.kernel.org
Subject: Re: [PATCH net-next v5 3/7] net: airoha: npu: Add wlan_{send,get}_msg NPU callbacks
Date: Sun, 27 Jul 2025 10:42:25 +0200	[thread overview]
Message-ID: <aIXmcUCQe7-gm9--@lore-desk> (raw)
In-Reply-To: <ff106cec-7e63-4475-a0e6-452bfcb823b3@linux.dev>

[-- Attachment #1: Type: text/plain, Size: 2108 bytes --]

> 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@kernel.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


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

  reply	other threads:[~2025-07-27  8:45 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-23 17:19 [PATCH net-next v5 0/7] net: airoha: Introduce NPU callbacks for wlan offloading Lorenzo Bianconi
2025-07-23 17:19 ` [PATCH net-next v5 1/7] dt-bindings: net: airoha: npu: Add memory regions used for wlan offload Lorenzo Bianconi
2025-07-25  7:11   ` Krzysztof Kozlowski
2025-07-23 17:19 ` [PATCH net-next v5 2/7] net: airoha: npu: Add NPU wlan memory initialization commands Lorenzo Bianconi
2025-07-23 17:19 ` [PATCH net-next v5 3/7] net: airoha: npu: Add wlan_{send,get}_msg NPU callbacks Lorenzo Bianconi
2025-07-24 10:09   ` Vadim Fedorenko
2025-07-27  8:42     ` Lorenzo Bianconi [this message]
2025-07-23 17:19 ` [PATCH net-next v5 4/7] net: airoha: npu: Add wlan irq management callbacks Lorenzo Bianconi
2025-07-23 17:19 ` [PATCH net-next v5 5/7] net: airoha: npu: Read NPU wlan interrupt lines from the DTS Lorenzo Bianconi
2025-07-23 17:19 ` [PATCH net-next v5 6/7] net: airoha: npu: Enable core 3 for WiFi offloading Lorenzo Bianconi
2025-07-23 17:19 ` [PATCH net-next v5 7/7] net: airoha: Add airoha_offload.h header Lorenzo Bianconi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aIXmcUCQe7-gm9--@lore-desk \
    --to=lorenzo@kernel.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=conor+dt@kernel.org \
    --cc=davem@davemloft.net \
    --cc=devicetree@vger.kernel.org \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=nbd@nbd.name \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=robh@kernel.org \
    --cc=vadim.fedorenko@linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).