Article View: linux.kernel.netdev
Article #15136[PATCH net 4/5] net: wwan: iosm: pass the DL command parameter by pointer
From: Fang Xieyan
Date: Thu, 12 Nov 2026 12:52
Date: Thu, 12 Nov 2026 12:52
117 lines
13405 bytes
13405 bytes
ipc_mux_dl_cmdresps_decode_process() takes the twelve byte union
mux_cmd_param by value, so every received command copies the whole union
out of the skb even when the command type only needs one member of it.
The driver also builds its answers inside the received block:
ipc_mux_dl_cmd_decode() writes the link status response into cmdh->param
of the skb and reads it back a few lines later, and
ipc_mux_dl_acbcmd_decode() writes into it as well.
Take the parameter as a const pointer, and keep the link status response
of the lite path in a local variable. The aggregated path does not need a
parameter pointer at all: it passes a size of zero to
ipc_mux_dl_acb_send_cmds(), so nothing is ever copied from it and the
write into cmdh->param had no effect.
The bytes handed to the UL path are unchanged, the lite path still sends
the four byte response field and the aggregated path still sends none.
Reviewed-by: Guanglei Zhu <zhugl3@xiaopeng.com>
Signed-off-by: Fang Xieyan <fangxy@xiaopeng.com>
---
drivers/net/wwan/iosm/iosm_ipc_mux_codec.c | 29 ++++++++++------------
1 file changed, 13 insertions(+), 16 deletions(-)
diff --git a/drivers/net/wwan/iosm/iosm_ipc_mux_codec.c b/drivers/net/wwan/iosm/iosm_ipc_mux_codec.c
index 2c4f175233a1..aea4cd9ec20d 100644
--- a/drivers/net/wwan/iosm/iosm_ipc_mux_codec.c
+++ b/drivers/net/wwan/iosm/iosm_ipc_mux_codec.c
@@ -184,7 +184,7 @@ void ipc_mux_netif_tx_flowctrl(struct mux_session *session, int idx, bool on)
}
static int ipc_mux_dl_cmdresps_decode_process(struct iosm_mux *ipc_mux,
- union mux_cmd_param param,
+ const union mux_cmd_param *param,
__le32 command_type, u8 if_id,
__le32 transaction_id)
{
@@ -194,7 +194,7 @@ static int ipc_mux_dl_cmdresps_decode_process(struct iosm_mux *ipc_mux,
case MUX_CMD_OPEN_SESSION_RESP:
case MUX_CMD_CLOSE_SESSION_RESP:
/* Resume the control application. */
- acb->got_param = param;
+ acb->got_param = *param;
break;
case MUX_LITE_CMD_FLOW_CTL_ACK:
@@ -318,7 +318,7 @@ static void ipc_mux_dl_cmd_decode(struct iosm_mux *ipc_mux, struct sk_buff *skb)
__le32 trans_id = cmdh->transaction_id;
int size;
- if (ipc_mux_dl_cmdresps_decode_process(ipc_mux, cmdh->param,
+ if (ipc_mux_dl_cmdresps_decode_process(ipc_mux, &cmdh->param,
cmdh->command_type, cmdh->if_id,
cmdh->transaction_id)) {
/* Unable to decode command response indicates the cmd_type
@@ -333,14 +333,15 @@ static void ipc_mux_dl_cmd_decode(struct iosm_mux *ipc_mux, struct sk_buff *skb)
/* Decoded command may need a response. Give the
* response according to the command type.
*/
+ union mux_cmd_param response = {};
union mux_cmd_param *mux_cmd = NULL;
size_t size = 0;
u32 cmd = MUX_LITE_CMD_LINK_STATUS_REPORT_RESP;
if (cmdh->command_type ==
cpu_to_le32(MUX_LITE_CMD_LINK_STATUS_REPORT)) {
- mux_cmd = &cmdh->param;
- mux_cmd->link_status_resp.response =
+ mux_cmd = &response;
+ response.link_status_resp.response =
cpu_to_le32(MUX_CMD_RESP_SUCCESS);
/* response field is u32 */
size = sizeof(u32);
@@ -500,26 +501,22 @@ static void ipc_mux_dl_acbcmd_decode(struct iosm_mux *ipc_mux,
u32 fctl_dis = IOSM_AGGR_MUX_CMD_FLOW_CTL_DISABLE;
u32 fctl_ena = IOSM_AGGR_MUX_CMD_FLOW_CTL_ENABLE;
u32 fctl_ack = IOSM_AGGR_MUX_CMD_FLOW_CTL_ACK;
- union mux_cmd_param *cmd_p = NULL;
u32 cmd = link_st;
u32 trans_id;
if (!ipc_mux_dl_cmds_decode_process(ipc_mux, &cmdh->param,
cmdh->command_type, cmdh->if_id,
cmdh->cmd_len, size)) {
- size = 0;
- if (cmdh->command_type == cpu_to_le32(link_st)) {
- cmd_p = &cmdh->param;
- cmd_p->link_status_resp.response = MUX_CMD_RESP_SUCCESS;
- } else if ((cmdh->command_type == cpu_to_le32(fctl_ena)) ||
- (cmdh->command_type == cpu_to_le32(fctl_dis))) {
+ if (cmdh->command_type == cpu_to_le32(fctl_ena) ||
+ cmdh->command_type == cpu_to_le32(fctl_dis))
cmd = fctl_ack;
- } else {
+ else if (cmdh->command_type != cpu_to_le32(link_st))
return;
- }
+
trans_id = le32_to_cpu(cmdh->transaction_id);
+ /* No response parameter is sent in the aggregated protocol. */
ipc_mux_dl_acb_send_cmds(ipc_mux, cmd, cmdh->if_id,
- trans_id, cmd_p, size, false, true);
+ trans_id, NULL, 0, false, true);
}
}
@@ -571,7 +568,7 @@ static void ipc_mux_dl_acb_decode(struct iosm_mux *ipc_mux, struct sk_buff *skb)
skb->len - next_cmd_index < hdr_len))
break;
- if (ipc_mux_dl_cmdresps_decode_process(ipc_mux, cmdh->param,
+ if (ipc_mux_dl_cmdresps_decode_process(ipc_mux, &cmdh->param,
cmdh->command_type,
cmdh->if_id,
cmdh->transaction_id)) {
--
2.50.1
Technical Details
Message-ID:
<20261112125201.1019-5-fangxy@xiaopeng.com>Path:
mbox-mo1.pugleaf.net!news-lax.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-361813-linux-kernel-netdev=dewy.ruReferences:
<20261112125201.1019-1-fangxy@xiaopeng.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-361813-linux-kernel-netdev=dewy.ru
From: fangxy@xiaopeng.com (Fang Xieyan)
Newsgroups: linux.kernel.netdev
Subject: [PATCH net 4/5] net: wwan: iosm: pass the DL command parameter by pointer
Date: Thu, 12 Nov 2026 20:52:00 +0800
Organization: Usenet Network
Message-ID: <20261112125201.1019-5-fangxy@xiaopeng.com>
References: <20261112125201.1019-1-fangxy@xiaopeng.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
logging-data="1088859"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:3omJVlBxe32ll8o78mrYsLmQvlU= sha256:75fZeOiB/AR8Sa3WSRydeZKNJjWmV85Ufr04F2lSNsY=
sha1:Uxn9aZM8hyujj339JJX7LaY4VKY= sha256:3i+h4ZnSZtX51CM6fakJtmUgKHHvqrAerWi/gRbszrg=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
by mail.dewy.ru (Postfix) with ESMTP id D20F611422D; Thu, 12 Nov 2026 16:00:56 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.05
X-Spam-Status: No, score=-3.05 tagged_above=-9999 required=6.31
tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.249,
MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
SPF_PASS=-0.001, UNPARSEABLE_RELAY=0.001]
autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (1024-bit key)
header.d=xiaopeng.com
X-Received: from mail.dewy.ru ([127.0.0.1])
by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
with ESMTP id WkRaq1Ebth8o;
Thu, 12 Nov 2026 16:00:53 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-361813-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN>
X-Authentication-Results: OpenDMARC; dmarc=none (p=none dis=none) header.from=xiaopeng.com
X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
by mail.dewy.ru (Postfix) with ESMTPS id F3B8E1141AD; Thu, 12 Nov 2026 16:00:44 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
by tor.lore.kernel.org (Postfix) with ESMTP id 72D6AE63DA; Thu, 12 Nov 2026 12:52:45 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
t=1794487941;
b=BFsT+sEGK+dsWdNdWm78tSkuVXPx+wmBGLM+nsu6C3bZadB37lJHTUpr+D/c/ZImXEN6
h6e4BQejT5E5UixIQYxf0yXfMOQUI0bczQ3bRDS5qJVCBubY4MT8eGYSXb7Dd4exNWb95
V7KK+R+AbsjwwqWN/rWQApFws9KkT6Jt2ivjFOS29El43uqi1P+1oKyNsmxkwuP4Nnz8c
W2ywFpu98XtBlXOj1GpboHT8UO79h2FyCQscVVlVTapP509IcqcVA8cMzkr49E+UrJXWt
fPJi//zLAszz7dDfBr5QV2Shv7C/4Rnd+I8txEQaO4qkou8SAd2yHZknQgAykKGmJyQ==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1794487941;
h=X-Original-To:Received:DMARC-Filter:DKIM-Signature:
X-Alimail-AntiSpam:Received:From:To:Cc:Subject:Date:Message-ID:
X-Mailer:In-Reply-To:References:X-Mailing-List:List-Id:List-Post:
List-Help:List-Subscribe:List-Unsubscribe:List-Owner:Precedence:
MIME-Version:Content-Transfer-Encoding;
bh=6XcGtGAW+6Ub371/XFnhKIHvkGjNjYFiujd/YbHY8nE=;
b=LbBLAfK971dy4rKvqOOFbDt81+PGEu8F96dNfNyX2OuhmZFJkD9d6BuwIsfDziw0od6W
l2o9nQlMqafj5//Mopv8gqztbBf+QQpLOXqORgTWT1aHC2v38P0tJD2+2rc4F4kegIxPi
eijY2JQk1DHvdLfSOwExBAEEiVOGR+/jnIJiyOdWbP+mq8keNaXGZGAmYq/kNaR4u6NoE
19FpIholwSzGQLmehbynbY/nUsBCrN7p8NcRmwIriJ8jUJeGVivyP+9+kh6KaxFmFdpnm
z6eTsONm0akpXAflKJjJmI6f1hVl+2rnsYVcV2t0xWsJNSfbvBUmq8UyoZmP9t8S7fA==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org;
dkim=pass header.d=xiaopeng.com header.i=@xiaopeng.com header.a=rsa-sha256 header.s=default header.b=CrPLjen4;
dmarc=none header.from=xiaopeng.com;
spf=pass smtp.mailfrom=xiaopeng.com;
arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id BE004606A8BD;
Thu, 12 Nov 2026 12:52:21 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (1024-bit key) header.d=xiaopeng.com header.i=@xiaopeng.com header.a=rsa-sha256 header.s=default header.b=CrPLjen4
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=115.124.28.218
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
t=1794487940;
b=No/ZHUd9uFpopLdS3oE1MSHoOh32CDOpO86ECrizvM/SxXFmFL9K20E6hoNZxphd1uJA
oQZ+h3VMdwQyD6KORrkurj2/1jXKKI89jvrv1Ybc9eFKmteww94QWVBPx0xXBHZldHN6m
6QMJX4zbfu/WymQwgCa0YY70UHYGXeqL6IA87/7CLDAypUX+oy2r04gmFJu0wrmtk2jlD
g21WYXDobhEuYKovVM4bT8ueOKvHKoXpG1HeLR/ezMSpxk3hW4lDYz8Xyxvfy8SOd7g56
tE0kwKY9R7n2jeOI/WriEcbhiv+pi9UIVLhgwFktBm4R/ZLFbfMNLMTlRTADil0xlUw==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1794487940;
h=DMARC-Filter:DKIM-Signature:X-Alimail-AntiSpam:Received:From:To:Cc:
Subject:Date:Message-ID:X-Mailer:In-Reply-To:References:MIME-Version:
Content-Transfer-Encoding;
bh=6XcGtGAW+6Ub371/XFnhKIHvkGjNjYFiujd/YbHY8nE=;
b=dkypSPzl82W2WN+w8gGuyPGd3n5bevT3oiRy5/EETySNtSFVUlLc+q33v9//il1vBX4v
sPormqBU5GilPMlqAvRiwvZ86LxUQctbMN/ddoi8uzyCn7dwx7RD9TvIh7wQE8hDUvjne
w9AwZPMyJuvJPsldtsapMWf/AwMh8SdeZ2Lk9LpR3q198ttQwZgF9OMEttRjJuDi6g61u
LVNbTo2IjQLb9Ri3u8m3mhd9sVEKUKc1t+ssKyq5PyBsegvSICgERGAd3zyOC0UwRvS6A
F2uwkxQsU+Qu+FStyKDIE4ZsKRhSPxiVtXIZC7uP2CR3sTGRV4y+AHwpgOgGOJ74HvA==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org;
dmarc=none header.from=xiaopeng.com;
spf=pass smtp.mailfrom=xiaopeng.com;
dkim=pass header.d=xiaopeng.com header.i=@xiaopeng.com header.a=rsa-sha256 header.s=default header.b=CrPLjen4;
arc=none smtp.remote-ip=115.124.28.218
X-Received: from out28-218.mail.aliyun.com (out28-218.mail.aliyun.com [115.124.28.218])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id CD766606A8A7;
Thu, 12 Nov 2026 12:52:19 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org CD766606A8A7
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=xiaopeng.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=xiaopeng.com
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=xiaopeng.com; s=default;
t=1794487931; h=From:To:Subject:Date:Message-ID:MIME-Version;
bh=6XcGtGAW+6Ub371/XFnhKIHvkGjNjYFiujd/YbHY8nE=;
b=CrPLjen4Jj8bm5y1vtxOLgbfarEbsenBrPhHAdFMCBEk5zknLkpWHUTcMPLzqzDbczpkZMvaXL5nqG8DpWax2H2u6+tGeHAN3rvrFYQ+mTbN8oGnCqhmmAJ6lC5UT7ZqVH8XIXSNjidb3MIe+QyIRk28Bm3kOld2WU1QLyYunQA=
X-Alimail-AntiSpam: AC=CONTINUE;BC=0.04436265|-1;CH=green;DM=|CONTINUE|false|;DS=CONTINUE|ham_system_inform|0.00745487-0.000394108-0.992151;FP=16019763649318518801|0|0|0|0|-1|-1|-1;HT=maildocker-contentspam033045038069;MF=fangxy@xiaopeng.com;NM=1;PH=DS;RN=14;RT=14;SR=0;TI=SMTPD_---.k0cpdf3_1794487929;
X-Received: from localhost.localdomain(mailfrom:fangxy@xiaopeng.com fp:SMTPD_---.k0cpdf3_1794487929 cluster:ay29)
by smtp.aliyun-inc.com;
Thu, 12 Nov 2026 20:52:10 +0800
X-Cc: Johannes Berg <johannes@sipsolutions.net>,
Andrew Lunn <andrew+netdev@lunn.ch>,
"David S . Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@kernel.org>,
Jakub Kicinski <kuba@kernel.org>,
Paolo Abeni <pabeni@redhat.com>,
linux-kernel@vger.kernel.org,
Maoyi Xie <maoyixie.tju@gmail.com>,
Simon Horman <horms@kernel.org>,
M Chetan Kumar <m.chetan.kumar@linux.intel.com>,
Guanglei Zhu <zhugl3@xiaopeng.com>
X-Mailer: git-send-email 2.50.1
X-In-Reply-To: <20261112125201.1019-1-fangxy@xiaopeng.com>
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list