From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.128.42 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796379269; b=PUn18GmZOz3DmNfhQuxWRA3HZNfmURxPap7/Oj0ZHRpYbCg6W5G/2ZJ/oY6t81t4bWfH lY1V+wbp6WqM8+Z76Gqe6ApbjWdPZIGoJIvE9XHLXS7jzxHoxy7ufXOKk52h3ysDSNbCs J5MIkoq02AWIsnqP/ihX87fe+m6Om4jz7RYwVG/X4KWBPkSr1gxBRGDn9saIGffibqHBV qVLffRLprjm1QZ1plDXBkaWaPvMCmFtuF6L7ZrFCp4Hlnha00VsnImh3IO19aGELKGi6C E6+UABhGMRKeO0H4KhG2sN59OdqIjTzlOHDtk4MV9N5sP0EfrlKBBau7yxN1/7TLwZw== 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=apTPosPCjxVUGVDeG5UkHQNpI6n3OBJKiMCa786TQrkY9d9sBH/ayYeosdD/D3h0c6QE ZlS6pzVXWiYCUPRoqZu9l9J8rh7Y0LuFnGuh05RtsPd5JZWbIwWdZbXgoJ3fkDiYWpXqq U5BSCkrF6WSVAlQh0/xEvIrYnwARzF8ceqiQ1y2iaBXilD2hTI5PI8oH6LrQkw8nQsj3d FrG7zxfCGq9qYV5kv4RpO10foqM5KYra9JoJ8zhzoRjkh76nC3NQ67sYFg83CR+6m73FA XHwC4QMyT/COZ9Hn/w0xnBnhKYS2hav98tUUOJDI7X5qHcaSGDXBNCnCLT2N7Z3GHLw== 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.42 Received: from mail-wm1-f42.google.com (mail-wm1-f42.google.com [209.85.128.42]) (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 E9F07606A681 for ; Fri, 4 Dec 2026 10:14:28 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org E9F07606A681 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-f42.google.com with SMTP id 5b1f17b1804b1-4bb70074ab2so4136775e9.0 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=rGB/TOxsQdeo2tBy3FS2zU8lIAP/GyG4sg7xnTk7+pCV96GSetVXefLX+b2VffRtR8 bVNssKWguEiduJrWcJorc50tVmrUWx1s0dAg7h5xiYVT/Bj/deUyQ3oxdGmoX64aonka ucu0YVBZanrtGfa5OyYA/5TNLzr4x04RYXPSEtxFGEszi+tG+Y+TIqHjpZXE6QDE632c 0mO6bqMcG4ivO5htBlyyJ+jQ1nsZJn9RhEdnt7uJPhnbWL7foGFFn+Kwwwkjb+o4Fuzv 0adidgHh2YC3vlLhHHxTUFW5ujycvtWuiGFviibyrIwEXl/AIAwWSi9V5letKJhyHnSa 83pQ== X-Forwarded-Encrypted: i=1; AL+hErE8G9e/Bdxi/ZD0fiA7fFMCyramxorBxqr/hsIQkNu4hthY5HeDcPKLxku4mQx6uB4OjkYbGFd+l8W5QbFl@vger.kernel.org X-Gm-Message-State: APuU4Z90nhT7CISk0oirQbzuLRgrBKca2y18qGcTlMT39hk+WpFmrBKT VCHXIYKDLPwVbXsf3Xptqx3w48VbcdMx7+925pwYE7G48rDK1al8CbAXb+kGXs3/G9Q= X-Gm-Gg: AZFdTZf9+0tu9a6m1WPZ72KCmi0Mt/Eq0K2gIJBPzThpt5/E4TTEAK9PVEMWP3JziNT QUGV2SPvwwoV6rRTuPT6YdNiTpOxP4IvHonWFR83BZoJ9pCjOB3bPMBbyn7yVLyr8zQmsvl4VzF goaiciUg/nLEfY74wGxsvG2FpUDVdbRAy6DMx7lMrfwhZktGWIa5odg+Jd/D7rPsjn3uSm+JjG2 OR8YvgAzJFmn8YcVY8ZQvMKGShojkJvH5yMPtbO/rHvNUmk8AB4dU5uE6HBCx1lV5VJenSjOQ5e uZKOBVmcVBloehriFMd7IRsN2pzIx6hmV7SliPwscXaJfCStthSUANrN0Qlik698sCOf+Fw7zgu VxcPS/Lewt8OhpqpSDkAsNHIS6ZOOe4q/2UMPNDcGKTjRaJ85heqzgozT1y436mjN5fY57+wHIl 9gSudpdhnAHnzIHEDRJlPk1LPFlH4rV4XYQvbSL3D6Flz1pj/80pvU+UyouaEOwOjHUPSPiZJBG jCKe+Pz6f0251YMNyoq/9RqUnbzWeq2pXrLPin4tg6I2/PgzhWKvitR/AMC6uEMK9BYQ1ykFPfI lPWETc4jdNQKZP2jwa/DiYymo/8PA58aB0jZ1nA= 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: linux-arm-msm@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