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=bIegTSRJPCc14gEKVT5hOgqNT9wg8TJfxZ/IHKYDGzSF4egkxiUKw3/9VVbPV5+L0Xjd j9jdEUehC5S8JbMRDiIjGFanibKpgpVACiKQ4m5fjoVxaS2W0e8qgxf4LFalR7EI5b7cf zyiMvHM4xg6gyTSDtpMey4d8KsVOsndRtDGBP5+qrdDSeNq/L+8NRitsFRa/okMkuVByl pwjLtCDbvN+LZrVVXTtchLQcYFwl5nqATyGYx1UU5XSG1zAKQI+IA/ZhHX4K/SZRHVPcw 79bJH+1psA051PRsS4VjkMh4ruMdk7WcXMzgvrkMM7uYqK0cCf98dt9mcvHVN7T1tig== 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=gqIMNcQWzCUHXIWzixy/9rQH4JWeXtmjjVlfERmb48BELfZ3iEzrJ8JLAermDEcBD29V kz9vk2y+DJLZTEuvTO+rQuygB76EJooIxx03/IfYaBsQR/WzVvxp6XMrFxWgZDyaFmWav 35br7/JONPJKKnGiqpL0nP77cShliDQTEGeA3j9Nc4aZtNR+TnR+Y1KfozgTSZGi/IMBc u2GWS7MYSJo3b087+3HlbC3Elc9itfA7EcAj1E45hiYqaJdjO51MgiGB3l68mrPuMdfkJ fZHW9K1pln8BzCNizr3ZJks7k5qhWNyRTlq0xpojT0ZJ7KOIZOp8feNveeOozPdAxeQ== 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 F13CA606A685 for ; Fri, 4 Dec 2026 10:14:28 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org F13CA606A685 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-4bb70074ab2so4136755e9.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=Mz+sSLPxoZqjwYnvH3XKJNP/HGtF3qCUkH2PIOGtoZyBQjmLT6WaBbii3myeuAOw+K rqA4g+MtosBwfYzDOcU5hS9SA8CHGEL2kand9ZXIYLREvdV3wSG+N0xTgVsMbt4Q482U FXouPAUUoJMXertsKjo8hp1yU/JKUkEmAZuhnluilik6aufgwqXyh+AtEnWWcOCHZESa 1+rMxgkN+e9dU5gKCDn5LNSIsru8hQe7H1ZvydRZ1GB/q0zjV3q9276KOMLPZ8oqHsCX KnDTDHoserdTIdT15QXPu9W6QWteCtHKMFir24L0XeLL4LgfKmqXr/tCu5tSY2tVU/qg SxCA== X-Forwarded-Encrypted: i=1; AL+hErGeatO8SDdTt6ZBxJrj4EMv6uuu13irjL9Y8Czp51ycx8+N52LN0SGTXw/hwU2Yam5RPfPAcOaYljLMYHM=@vger.kernel.org X-Gm-Message-State: APuU4Z/TLjcAdw+JNcYLyrzyPsQbtWf3ySymMStH1JEZQBkqdXod6Gf2 0bM5bwC6qEhPW3yNk1z8cjFG6hBNhHTOfYyllytxNCQT9OkE1jjqiPp2aNG2Z0ivr3w= X-Gm-Gg: AZFdTZe8wiSTwYm7PGHv5Ip0ll72cV3jVJHI1Y7cDd5djGAj6+h2PbPWDcZi0YpbRRQ dKViTI80njALj04NfzcC7Gr0tBnCSJDDqKqZYPrVkWuiR1LyVa8vII1CEaCfJJrlhJ6elKUJ/4h DF7TuOpwvPJdX00o+vwZm3CxQpRNVJtrSLGvXBEwG88zej648CCbiGBTH3we104n4HFJ2knc/Kn PWolPlVJGjFYOfKhn2A8tEXbD4wMhsmF/NsePda0egCm39t7AgDPmJ2+doQQE04v4SpklcmitQZ 6xYGsQRu/PieAu0Yedy7/1uNQxDm6TATiBdeQhOg7UD0and4Z4b/B03mdeIPPBL/ylfzVuULSn8 YWj8Yq+hggU+hcLz7FnlCTdsa8ouFV2W9EfwsJMO1pAroeBXnXFU1J3Y6uO33h84Js+Pvjq4UMO jdcJzvAHfSfO/M8ZwjBls0WCRYB37yWPhPRS0ouhCbqUZJsDrtkLQs4Xq906yud+RDXi2TCFtcq SsPJCK8zCQ/cxIWtrrIPTtZ+HEClpjnzPqm9cXnRK0BrCTZVWtAvBDG/2FjO9OGusRwH1gkGfDQ 6M5mdp+T8MJDLRV6AMM0QeoMUabv51P3rH5aN70= 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-kernel@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