🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #26867

Re: [PATCH net-next 2/3] net: wwan: qcom_bam_dmux: use DMA transfer size for RX packets

#26867
From: Stephan Gerhold
Date: Fri, 04 Dec 2026 10:14
56 lines
13783 bytes
On Thu, Dec 03, 2026 at 09:40:53PM +0530, Vishnu Santhosh wrote:
> With QMAP, the multiplexing protocol handled by the rmnet driver, the
> modem sets the length in the header of DATA packets to 0xffff. This
> means that the payload fills the rest of the DMA transfer, which can
> hold several QMAP packets. The driver treats 0xffff as a real length
> and drops every such packet:
> 
>   Data larger than buffer? (65535 > 2040)
> 
> Get the number of received bytes from the DMA result, and:
> 
>  - drop the buffer if the transfer failed or is shorter than a header
>  - take the payload length from the received size if the header says
>    0xffff
>  - drop packets that claim more data than was received, replacing the
>    check against the buffer size, since a transfer cannot be larger
>    than the buffer
> 
> Co-developed-by: Deepak Kumar Singh <deepak.singh@oss.qualcomm.com>
> Signed-off-by: Deepak Kumar Singh <deepak.singh@oss.qualcomm.com>
> Signed-off-by: Vishnu Santhosh <vishnu.santhosh@oss.qualcomm.com>
> ---
>  drivers/net/wwan/qcom_bam_dmux.c | 38 ++++++++++++++++++++++++++++++--------
>  1 file changed, 30 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/net/wwan/qcom_bam_dmux.c b/drivers/net/wwan/qcom_bam_dmux.c
> index e1cc3038a724ee2a3eba4a9d97715f1f5966452d..a7d05b1b8b1230d1d54e9a7abcbc16a16681797e 100644
> --- a/drivers/net/wwan/qcom_bam_dmux.c
> +++ b/drivers/net/wwan/qcom_bam_dmux.c
> [...]
> @@ -593,9 +611,13 @@ static void bam_dmux_rx_callback(void *data)
>  		goto out;
>  	}
>  
> +	/* The remote side may leave it to us to use the DMA transfer size */
> +	if (hdr->cmd == BAM_DMUX_CMD_DATA && hdr->len == BAM_DMUX_LEN_FROM_DMA)
> +		hdr->len = rx_len - sizeof(*hdr);
> +
>  	switch (hdr->cmd) {
>  	case BAM_DMUX_CMD_DATA:
> -		bam_dmux_cmd_data(skb_dma);
> +		bam_dmux_cmd_data(skb_dma, rx_len);
>  		break;

We already check for if (hdr->cmd == BAM_DMUX_CMD_DATA ...) in the
switch statement here, so I think the code would be easier to read if
you move the if statement above directly into bam_dmux_cmd_data().

I'm also not sure if we need to modify the hdr->len at all, since this
is kind of a header/struct owned" by BAM-DMUX and not us.
bam_dmux_cmd_data() could just read it into a variable and override it
with your calculation from the BAM if it's BAM_DMUX_LEN_FROM_DMA.

Thanks,
Stephan
Technical Details
Message-ID: <axKSgIkcbRwliRni@linaro.org>
Path: mbox-mo1.pugleaf.net!news-fra.pugleaf.net!feed-eu-txt.newsdeef.eu!feed-eu-ch.newsdeef.eu!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-377245-linux-kernel-netdev=dewy.ru
References: <20261203-qcom-bam-dmux-qmap-v1-0-abc2e80a03af@oss.qualcomm.com> <20261203-qcom-bam-dmux-qmap-v1-2-abc2e80a03af@oss.qualcomm.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-fra.pugleaf.net!feed-eu-txt.newsdeef.eu!feed-eu-ch.newsdeef.eu!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-377245-linux-kernel-netdev=dewy.ru
From: stephan.gerhold@linaro.org (Stephan Gerhold)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net-next 2/3] net: wwan: qcom_bam_dmux: use DMA transfer
 size for RX packets
Date: Fri, 4 Dec 2026 11:14:24 +0100
Organization: Usenet Network
Message-ID: <axKSgIkcbRwliRni@linaro.org>
References: <20261203-qcom-bam-dmux-qmap-v1-0-abc2e80a03af@oss.qualcomm.com>
 <20261203-qcom-bam-dmux-qmap-v1-2-abc2e80a03af@oss.qualcomm.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: usenet.network;
	logging-data="2736066"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:nr5EMaSslAc18I6zQcxdx4t+64k= sha256:szHjLoPXZQ7Pbz+XbJ1Hv6g38E9977RUfBexK/H39bw=
	sha1:yrwv8mnCz++Y/BHmbt7l+20i7q4= sha256:RiducNBUuxE2A4zKFgMG87bf075KUOzZUebDcJ4Cb00=
Content-Disposition: inline
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 DCFF3117B99; Fri,  4 Dec 2026 13:14:44 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.398
X-Spam-Status: No, score=-3.398 tagged_above=-9999 required=6.31
	tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,
	HEADER_FROM_DIFFERENT_DOMAINS=0.001, MAILING_LIST_MULTI=-1,
	RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001,
	URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=linaro.org
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 qInenMJU7afV;
	Fri,  4 Dec 2026 13:14:42 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.232.135.74; helo=sto.lore.kernel.org; envelope-from=netdev+bounces-377245-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=linaro.org
X-Received: from sto.lore.kernel.org (sto.lore.kernel.org [172.232.135.74])
	by mail.dewy.ru (Postfix) with ESMTPS id CFB5E117B98; Fri,  4 Dec 2026 13:14:34 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sto.lore.kernel.org (Postfix) with ESMTP id 6B834600D2A; Fri,  4 Dec 2026 10:14:34 +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=1796379270;
	b=jQl0DBE3sovpuYmdh6kXDlQao4s4xIiTisODc8PtbA7STCUxeihJIrpxWxBdVUW7UPC3
	 MKmR5QLq7HcZT3zhPz6ekDgHp4SnN55PaLg7V84A2u9rDDzAmic3A47OMNBmrWJvut/Tr
	 8QDz3JNuH0mgPt/+Ns/talGpajtByL8phWjKXYySCHRmuBYEAL26E4C5KnevequkJAXLH
	 +jgnwn4kI9w2rt5W90LACB9cMwcRJFemUG1OYX+qpMa7c/KYWw2OZpuWJoBBvGTf1SoG5
	 ogVV8cw7IUiW/uQa0bV0kP0EHljfDCDqslH0umktFFRMBJUzxwEKyAoXHsqQ7fWKeQw==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796379270;
	h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:
	 X-Google-DKIM-Signature:X-Forwarded-Encrypted:X-Gm-Message-State:
	 X-Gm-Gg:X-Received:Received:Date:From:To:Cc:Subject:Message-ID:
	 References:X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe:
	 List-Unsubscribe:List-Owner:Precedence:MIME-Version:Content-Type:
	 Content-Disposition:In-Reply-To;
	bh=2/sLlDpaRjjJBP4mGymrjuE2CubvPgxzqMDmwbYoEvg=;
	b=ylvDhLXXk71GxAoQDoLrjPiX/GsHJqImfvyjNsGoEV0yabGx++SyPB4HI76E1cQOds2/
	 o1TDsqUL1mgL7xbYb352wxJLoFEphxQnHuNcF4AHGtal9X+75vc8ly2lmoHINQCBmO2WT
	 KcYB+gvHXygPBxTsLmhi7yFQLcQB3AEK316ahSDoODJ/lreswLWVDbsaHNZzhQHa8FiOw
	 tjFn8dHTqhk0oNeRvnU3g/uQTvhNxkG/lJl2LkW7+P/tp7r1Fsxp4NZ/6PFywRYByfLsL
	 9dgHsJt8rNgvy70KqjvxJqe+nvpIKCuna+PR5wHbqjZuqmv6ZBOOfLsG8Ly670de7iw==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=iJfXNsZ6;
	dmarc=pass header.from=linaro.org;
	spf=pass smtp.mailfrom=linaro.org;
	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 80C4C606A690;
	Fri,  4 Dec 2026 10:14:30 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=iJfXNsZ6
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.128.54
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1796379269;
	b=y6jcFvSLKmWXkRqULN7UaMyGZr/qD8qRM01fpq5e98lJvrqBwzpB9hxJ+kwh481AEw2F
	 ePy+U6mKjvXZKb6+QRSkYC/EXBHKN+BEP6SWgVUvXgLQzH781LTiJWST4NzVcOSEdG2qg
	 IyE7ayZEIdSyNgyzeiXQatwlzrdzEt8/0xh7Q63NfzY6sAdU2hmdqcxw0YF/4g66Tjsy3
	 Nx7T6DMoLbzDPWhHc7gMBNPjDw2b+JJcDSir86c6zIkY/JMclAJU0VPxt0QalWdTez2bR
	 lUcn10WP37xSRY9fyej7Trii+YcFeYkTvtUYmqZnMiVmVeRcBudcI0/BdQpbKhXyd5Q==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796379269;
	h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature:
	 X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received:
	 Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:
	 Content-Type:Content-Disposition:In-Reply-To;
	bh=2/sLlDpaRjjJBP4mGymrjuE2CubvPgxzqMDmwbYoEvg=;
	b=gj55LysssXURdbqDKo7NWijv9TPMvsmExakvsVFN5rbVjZmZFFRyGmu9ywD2tMbs5TtB
	 oVAIjaQwU76aZfSnJziMc56nmOX5aqEE06M8PCpdlkRUU37ERi0pdajX1luTrrw0IH5P2
	 f/JrAlrVfcJ9MdQRakNA+6dH56LAFZ+TB1yCfYCblRW9J2c+zRHkb3mDx5cNqTFZDV22M
	 Ix3MBRXaalpeCmEI21S7Hl3IGGkJ8xg2cpZ/4hq+99AR/gtEPK06OzJhDGCuscNH1Rp9Z
	 SBsJpk1bdN1iL2ZfxpLjHobkbx31qTz4qjeXNznIDczlgomiEy6KsYfMAeAo4N66QqQ==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dmarc=pass header.from=linaro.org;
	spf=pass smtp.mailfrom=linaro.org;
	dkim=pass header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=iJfXNsZ6;
	arc=none smtp.remote-ip=209.85.128.54
X-Received: from mail-wm1-f54.google.com (mail-wm1-f54.google.com [209.85.128.54])
	(using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id F1478606A686
	for <netdev@vger.kernel.org>; Fri,  4 Dec 2026 10:14:28 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org F1478606A686
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org
X-Received: by mail-wm1-f54.google.com with SMTP id 5b1f17b1804b1-4bb606491faso2612595e9.3
        for <netdev@vger.kernel.org>; Fri, 04 Dec 2026 02:14:28 -0800 (PST)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=linaro.org; s=google; t=1796379267; x=1796984067; darn=vger.kernel.org;
        h=in-reply-to:content-disposition:content-type:mime-version
         :references:message-id:subject:cc:to:from:date:from:to:cc:subject
         :date:message-id:reply-to:content-type;
        bh=2/sLlDpaRjjJBP4mGymrjuE2CubvPgxzqMDmwbYoEvg=;
        b=iJfXNsZ6LDjojWgfAB34SdzlQBj8sPZFw7ADyfibz9Ka8RBM9fgtZAfE411GiZtcLg
         9PPH/8xte5l1WsTU3GO8RRt8TwNM8dhBRPBC1jxgx/Nsr+qtwI5xCn85NacYTWJnebak
         3gNtO+mi+0jsm0rO2fY9z4D2EzUWPK0ZJbXs71Rtpo5cvaCAY8jYf6UJfb54DRnRdypC
         K1eiYjPh5FRAzt51BNVWYn/KdN0jND2nAWBaXfJsxwloUSvatkEHgJFrgjRhddpsfXSJ
         E9O8nVp4JAer5D/DAaXQadL4MN7KTBQ/790/ZpYPK10bWAiP0wrFP1lyDJs5u7Z9fJWB
         BWlg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20260707; t=1796379267; x=1796984067;
        h=in-reply-to:content-disposition:content-type:mime-version
         :references:message-id:subject:cc:to:from:date:x-gm-gg
         :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to
         :content-type;
        bh=2/sLlDpaRjjJBP4mGymrjuE2CubvPgxzqMDmwbYoEvg=;
        b=pYr1LC8sqEK6oubVAUL7U9jOUjtUp1yPBAy6yA+VQ1UoADgQBaHh98rov3jii1NuBE
         C6UKIy+paEo3c5FG5a+P/+fU1Xi0LELtQrA1KybOs0EkiqEVstnyDJy2OAoVbcKjMt9N
         j93UW9Z5x81gfbxaGc+3xe5LtsLUwJE285EaNpDbV3ktmhCDNUZ0PAPrxIlXyNcOHF2n
         T39bvNJvuBrRh54e8GDlDnAzzCln8BuBYsyR3eWGq98DAGixQNq0sub4A1ZiIMY/KsUj
         nx80AeHQWReXwFPtKxZE7QeT2w5I3jXNhrbflsLn8WYa5e+hq1SVBkygbhubFMm046IB
         mvjg==
X-Forwarded-Encrypted: i=1; AL+hErGcA0+WxJErts7pGjJ4yKWDuhBX6zsgYSKcGYSwcRGL4tTIjfuiUG0IBmVjSN3DFDk4H8xtJik=@vger.kernel.org
X-Gm-Message-State: APuU4Z9gXAkuGkAyTiU15pWhlWHYLqfxa27+/LOI3sstyhiwIL2Ur9S8
	OjPtMCv+7WDGClF4UdGhD6v4ISfKRJgG+qSkT8HWJbjk74lvDc8TLsynnC/L20kGZXo=
X-Gm-Gg: AZFdTZfjbBSLCZNdOYG+6YSF5uy84oPt0s1EPq/Bz7lgvDQQS5bb1OeeOCqS97q5r/e
	bB7D4++O+hqBoFJjN3MmWo7KE0vqyHGQj+212BJ6C8grtvLTWOakYQEHkfK9v8rp+RsqMK6MDYf
	durY+OWjjwwlimjci1lD47sWy6fo1oozLRpGQ7B5+qbmkFek7wWuzTSFUtl2IdD4RwESKv/9ENf
	9spWNJggAz6A4PmZVUVIk0/5mFC1vuy0qcosO2T4Z9dZeluPXlA459Kh1+lpcFOUxag1hl++OlV
	XFIr+kCJXjty2/xXAWDaVIEZOtnM09QQp35JZwc3B16nUDhVsAoA2gLMNHEnMGYjuO3DvBRVMEM
	/4pIi5UsQQdkzee/RbfHBtlfmMS8bQBJRk9W8WvFwvSJoeYcU8C519dkdRER7UI4ZRv5cxYV/Ki
	zZl8XdpP/O2eZLYd149RkuFaKk5Fuj70kmGt/2T8mYj9f0ycos9EOpgJrwPNvgy7dG9UzwOcXxO
	XxYrOXeS27MIqUvOynO86F+TSARSvdsdOnbpM0bXHmP3+alha+VVYhrjvZob1eXaGQGsOjg/04g
	PR8guYvhfXi3RmJICoHceuqkigtfAZVFxTBBjeE=
X-Received: by 2002:a05:600c:2289:b0:4bb:e25c:ea10 with SMTP id 5b1f17b1804b1-4bbeb8f6cf9mr18201995e9.32.1796379267224;
        Fri, 04 Dec 2026 02:14:27 -0800 (PST)
X-Received: from linaro.org ([2a02:2454:ff25:4f10:9821:14d4:1c0d:e790])
        by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4d2f5494205sm959413f8f.6.2026.12.04.02.14.26
        (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
        Fri, 04 Dec 2026 02:14:26 -0800 (PST)
X-Cc: Vinod Koul <vkoul@kernel.org>, Frank Li <Frank.Li@kernel.org>,
	Stephan Gerhold <stephan@gerhold.net>,
	Loic Poulain <loic.poulain@oss.qualcomm.com>,
	Sergey Ryazanov <ryazanov.s.a@gmail.com>,
	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-arm-msm@vger.kernel.org, dmaengine@vger.kernel.org,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	Deepak Kumar Singh <deepak.singh@oss.qualcomm.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
X-In-Reply-To: <20261203-qcom-bam-dmux-qmap-v1-2-abc2e80a03af@oss.qualcomm.com>