From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-172.mta1.migadu.com (out-172.mta1.migadu.com [95.215.58.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9F831257423 for ; Thu, 24 Jul 2025 10:10:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753351803; cv=none; b=WlMHBu0S1eq/GgXMiaV2qvVwP6ZX0IYw37R9dKg+ga4D1N8WJjugSB+yeCSyeY/I1c+f0gBAfrYySOnMZOwuKkcYx5jqlzAegZt8xDLV8qrlcrVcRk4rVv2NI0nFAezvUDn4jj/y+KiPzVzXY+s1Zau9mVPvxOZWjdK6DqsYbZY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753351803; c=relaxed/simple; bh=zzy2iT6xVqMbADM2CVlsHoH3vD1stfeWWC2/NO4H8KY=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=Mi2pQkB/xK2aVm1r4evlynjbC1w/L8pCyIKVByw2zqDQ62D1OxGeHWMfnPf7aX+AtIziREDtC28prwlMBU+SAByxlEzXFoYrGr+Nlxvx7dgyJZ6iQ4x1ipNuEuxVU4eqz25ITm6hzB356rroQ2bALbRDsfsT2p/IF156n2Pf5mY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=KT+7+EMi; arc=none smtp.client-ip=95.215.58.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="KT+7+EMi" Message-ID: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1753351799; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=p9N4kKF1ybQ5CXgh1GBlu4OfVzelg+1wad03LAF0VVI=; b=KT+7+EMiLruXAUoUM3EAPX6VEEuwHxr71sLBL9KEsUx/rQCdAEU7Ar1IUZ5DUhU8Byfm4z JK+8WatmU+6FhG/+atS/1qr9O/p9vm9keg/LSGw9cFa8enrGbUqsiKmcMJWVVDAEtxFcCj HL6W46KKPKBUZAkjlraCt+uufSgtjCQ= Date: Thu, 24 Jul 2025 11:09:56 +0100 Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Subject: Re: [PATCH net-next v5 3/7] net: airoha: npu: Add wlan_{send,get}_msg NPU callbacks To: Lorenzo Bianconi , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: Simon Horman , Felix Fietkau , linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, netdev@vger.kernel.org, devicetree@vger.kernel.org References: <20250723-airoha-en7581-wlan-offlaod-v5-0-da92e0f8c497@kernel.org> <20250723-airoha-en7581-wlan-offlaod-v5-3-da92e0f8c497@kernel.org> Content-Language: en-US X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Vadim Fedorenko In-Reply-To: <20250723-airoha-en7581-wlan-offlaod-v5-3-da92e0f8c497@kernel.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_OUT 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 > --- > 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?