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=TUBxF91EP4c29ydo2IzIHiK0MHKaVJKsefH1+zcbpji1F9RfkbF5X8GxN4l2oRMmJEwf ss2ItxXRV4wnXCxomGah5nEmpWO1mUHxmR2NOvZNjWPee84NVFVkT1FWsfyTezBgDZqub SCM7mvnsyfEF/dmdPhSTSWltf5fC20r3AhONdlK7sEfGj4lT4raTAm1GTHY6hfkc8mDpK wrYhljj0n8DztRjoZbOYadC5fMUd27jPf9VEMDnq/10nq96oz+ys02uNJWHxeNtiELgiM 3KWoQTKAa1DV/LQNOnQPN3ffkuEwqg8/raBJtee+dy7CsPnpfBavyveKVg7ISBGoxzg== 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=KuZ4bKEFvlEIfU7uSc3igea2zsg6k09LMaSXuyn7Q+a8BqPkZQqzTdrGVvh6+oQkbABb q1gzVG680hmSiFC3dufrBIM/y4q06LaXdEg7T+br3OmFRk47T+vRxgf34uSaH07K4X2g4 liS0vivar9SgYpe0OqKKBk2YTUCDGBHDZPvcHDvja18jLzZ9KnN5YDQ8K5wUTRtbUs/9s Lp4CFkqKajJbs36KuTpkov8+0qyn5mOdGmSLjZPw8br581+KnUt5XnicFJ5PJpWQDtVK/ j47MxgTeB3CR9gzeAcIVsb9W2R0mkX3kkwjIS67G92wr8WGv9vY+NsTKzTbDmqt4Mbg== 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 F1496606A687 for ; Fri, 4 Dec 2026 10:14:28 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org F1496606A687 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, unprotected) 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-4bb702a7548so3092045e9.1 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=BUc0OLlIYJeLDpGjsBL0rP9viNswMQ9caztTtei1LostzcZPmKhWZeW4smUo87ZN9H uDdPIgoIWTyX7W4iNYwcNMRf3offRaGAOLNxsUkN6nZsj8RHCTm84tEWiL7rI5EkUAR8 m9bogL9qTrblrO2L0kf9VWx7qLD/5YK/g/erRuRt4Rk6eFuRgX/T23E0NR+CuTiTrdnI 1mhrvCL8mtp3a6uPpH6PUdBSy1n0ypHSaAZmHJnBt0Kv2KeiX6tqXwtxAX/pXZJMKhWQ 3QQXW+7diH1F+8JgRUNiTLcOfa4USbjvR1FbD8fBhLHldhKDRDjj5IEXD3FNbsIntYL/ AVvg== X-Forwarded-Encrypted: i=1; AL+hErGTbjQwFihHL7jR5Y1mZEI+gYKOTRDZaSbW5XkefAxqC5N9Oi7a+jeojcU6uI4bcLRA2G65JlK+9do=@vger.kernel.org X-Gm-Message-State: APuU4Z+4m6mKKEKoKXrMRujR9yVmhxSA/ol/B6fGS6CkjRNOQvgn3E3m rD7QpjcwgYQpp9zX+Jo/4/7YvrN2t5FUa51gUdSYIxh6JPCkmkGAlzWTZ90kfgVE4sI= X-Gm-Gg: AZFdTZdDxOiglXpiUJpZ9JVWvXkwEA7cL/xGQz1Yi4etEtR6fj+kH2ge2E6oFyW2E43 tutiw4Hd5P/6GA5CLKzvOdd8jHCjS+rePprYuSIvFeAk0zyESg43QRzzKLFo7f7hrkqOMjCGytj oXnv4muuXz71IAqc7OAwk0AMtY6KWzTD0fH6QnJDLIu6g23VGjkefSw1XFX5uuXLbDRfgcnFF4Y spJWrzbO6vQ9TLy/1IHDjekmjU+RiarmgAwgosvomuIVorboZW/4KcW+9zha4soIFNaLDTEOQ1a 29WmoGLVUn5Io0eL8GgdaC2rPlzehXAzA4SNxht4JFvWWCGGoWFYIWqruZdTYfZUBrqJJpid2pT GAorSu+ELQAlkw6Jpmf2QGhxgGo7YOKm7xdDoU1bKh/mBYopAd7COspHrUEHXbjPWbMdR2dGZSO Etc1/zrSWhsxTgFKF/e7NA5SP1lPxmniEkQaSgloU1pW1DcDoVMdZYmjnF6D/h3zwxL59fk2plt dxC0wbSNHZnryJXH7ATVoYXEzR9N01z3bKdI4mnOebeV1LaAqrbu5T6s48NPDL4CntQwrtYRvSt 8OFrZsokY184TPf5Li09EdJ0P5LP94JQBYLVquY= 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: dmaengine@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