From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.128.54 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== 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== 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 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 ; Fri, 4 Dec 2026 10:14:28 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org F1478606A686 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org 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 Received: by mail-wm1-f54.google.com with SMTP id 5b1f17b1804b1-4bb606491faso2612595e9.3 for ; Fri, 04 Dec 2026 02:14:28 -0800 (PST) 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) 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) Date: Fri, 4 Dec 2026 11:14:24 +0100 From: Stephan Gerhold To: Vishnu Santhosh Cc: Vinod Koul , Frank Li , Stephan Gerhold , Loic Poulain , Sergey Ryazanov , Johannes Berg , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , linux-arm-msm@vger.kernel.org, dmaengine@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Deepak Kumar Singh Subject: Re: [PATCH net-next 2/3] net: wwan: qcom_bam_dmux: use DMA transfer size for RX packets Message-ID: References: <20261203-qcom-bam-dmux-qmap-v1-0-abc2e80a03af@oss.qualcomm.com> <20261203-qcom-bam-dmux-qmap-v1-2-abc2e80a03af@oss.qualcomm.com> X-Mailing-List: netdev@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20261203-qcom-bam-dmux-qmap-v1-2-abc2e80a03af@oss.qualcomm.com> 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 > Signed-off-by: Deepak Kumar Singh > Signed-off-by: Vishnu Santhosh > --- > 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