From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=205.220.168.131 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796246817; b=WxJ8HeHVQaI0hP3+KpYvmwcw3YCMoOsPwFmPYJrfMaX4b/jJ2jvCvyxURm25hpCrjHSy 8PbviavBQG8UE44IcdH3nRS67Q7uEb/s+0L+QT+I6HQ7iAb0eHcC/e0OzwaHWGVOn1ux0 l6ujfKpzPSyaOIRAPn+clSKYCpNnWamCHynLkU5fA/kSeeNXXBBZmQ19FW1uRhF6Iso3J EHIfZq1ZwC8i1cnLgLOPpocDPbai9huK+YXoFquSmwd990xffDXJmWN4uZbAemW2xrrlf cyfdHCRGPTIrTgowS58rXiWz+4/U5gL6g2gVR+aTF925epGwhjqvcva6huCmhL+QCdw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796246817; h=DMARC-Filter:Received:DKIM-Signature:Received:Received: DKIM-Signature:X-Google-DKIM-Signature:X-Forwarded-Encrypted: X-Gm-Message-State:X-Gm-Gg:X-Received:X-Received:Received:Date:From: To:Cc:Subject:Message-ID:References:MIME-Version:Content-Type: Content-Disposition:In-Reply-To:X-Proofpoint-Spam-Details-Enc: X-Authority-Analysis:X-Proofpoint-Spam-Info:X-Proofpoint-GUID: X-Proofpoint-ORIG-GUID:X-Proofpoint-Virus-Version: X-Proofpoint-Spam-Details; bh=szcUx3lQABKCGRnaORYqWhd0krJDLRVfYhRx+As3wjw=; b=q6ZqODAvh1R4IiecHb/bTjS4G0o6oKj/fxBOvmpZjgxxs0DZS8ZsGmX7bYtAk1iKSKOv 1pWuwDi28gO5y7N96IIeONxlW+5JMRt4g3Mqmcis3bwwPq9rR9IpQNGzGs7MGIPeE7xNb X2UlWj7mQS6mAqZ1pyYR+pXUdCPr3P9nSFE7eX43O/aTTp/JFaid/OygqeceXuDGNtWbi Ej2WEmMxWgyNJ6IoQd3NIfevvcD+eM3baA70/gqMaHJl8t3JynnlLIufy69rmPJPQCm1f cKUc4aLXL7IzJdWRz7HuYAAKE8k3QP47wVLVdjCdzX2d1Sq70snCfrRVyGc6u9zSq5A== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass header.d=qualcomm.com header.i=@qualcomm.com header.a=rsa-sha256 header.s=qcppdkim1 header.b=fezcwQ0m; dkim=pass header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.a=rsa-sha256 header.s=google header.b="TSLM/CHX"; arc=none smtp.remote-ip=205.220.168.131 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D56D9606A32D for ; Wed, 2 Dec 2026 21:26:56 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org D56D9606A32D Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.a=rsa-sha256 header.s=qcppdkim1 header.b=fezcwQ0m; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.a=rsa-sha256 header.s=google header.b=TSLM/CHX Received: from pps.filterd (m0279865.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 6B2LGo922211523 for ; Wed, 2 Dec 2026 21:26:56 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-type:date:from:in-reply-to:message-id:mime-version :references:subject:to; s=qcppdkim1; bh=szcUx3lQABKCGRnaORYqWhd0 krJDLRVfYhRx+As3wjw=; b=fezcwQ0mqnZgWvaco5DoEM0itxkEqsD8SeiaqGfd vqsuyXxxF9jYM+uHCJ47H9a6uvE8rZ/BLHpTEU/vQ8lIcMlQ+6OVRaNISZfdFG5G V+bUUAGgC2/ydfplFY3T8vH32P9RMx5eycCjxKUuntFv/yTeEi5gBekb+XkIcc6i KyxT8qFitolvI4z66Qrm+HhovbmKkWVcp/URLIRgTEeeNd9j6peNroeJ4SWmy1nj DjbIrmIS8YlSINo3hM5HhV7IPvKALGYTUQ0cKj4tef7AXgodJStiYnl9ehj+PEWv Ti6d0zx948t+nHUNZLHTlAGGlGSyMWfgwxrK/ovc4NDGag== Received: from mail-qk1-f197.google.com (mail-qk1-f197.google.com [209.85.222.197]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4jaj432dsm-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Wed, 02 Dec 2026 21:26:56 +0000 (GMT) Received: by mail-qk1-f197.google.com with SMTP id af79cd13be357-949b0d3232fso1847605185a.1 for ; Wed, 02 Dec 2026 13:26:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1796246815; x=1796851615; 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=szcUx3lQABKCGRnaORYqWhd0krJDLRVfYhRx+As3wjw=; b=TSLM/CHXPnC3r9rKydP5aSmRFasGhDkAr1fA6F6AFzkom42ihJXIawKpEp3CbjCrA1 +aErbMwwjp2HEj64gMYzJ36ig6Py66EtPI67kTzuPJDr82E95dqFwXHCOC5UmF+hUou5 E56CSaP3X9VrAqFVlha7cDmGuoGVBKDwqWp8SRajsLzGkDGTQjsdpMfJn77XsLrjc9cD 099+UPj+wjqs0KtLMqb336fA1oXMeHYE9qCQHeFw0K2ThE4oB3cQg0JbdfhNqLvMXGs+ Rmm4/AG7ic1HpYM26NW6A36B4aCNNVRj9dWXUp+f/bSUokO1Z8DxhgXWbIN007dJbL25 6Q0Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796246815; x=1796851615; 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=szcUx3lQABKCGRnaORYqWhd0krJDLRVfYhRx+As3wjw=; b=X4L2+sOUZW6HNpTgFIU4ZF/V2mQspBcbQiuiMfK3gz8+LeF3hRbf5PBeqKbf7twINK PeTFn535AAybhZq7w2AD2/J/yxL7BJNYIIPh9MWp8Rc9az4JPqJsLLH5zR2dwoYST9q3 7c40FIqUQ0RA/LQdTnkY7HH2gPGvBc/uitPpJaHM8Lzk4pOkmxi3yi4LSJtDmjdLg2ln cKVUnmW3nHySXmNiNbVehGOPcwgZbvZf7/lGiso0PgYLSa3+uMoPDu0xK4Kqw9VqVTGV 8Zdo7Aso+uod2B6+Hnu3sVuyhJV63iB7H+8sBW8Gccfbsw2FLXy8u5FblUU16sPzxt7s 2J0g== X-Forwarded-Encrypted: i=1; AL+hErG0Af/pMy07Wb8+vMeLLLspGzJ3AQmWJHnBB/Fxi/w680O4j35lvQ+NsT3SsYSsvBaZzQ7VyTw=@vger.kernel.org X-Gm-Message-State: APuU4Z84Nsx3UIJjdfhsDOueud+nyvl+hHCGec75Zl4TQYX60OjI8gg9 Wi5ObF2NPGptncPyewmjm6uIG8Ys9RCRoKjyWpn0zdDXzq7CcxXt6zxJ9I4FGQ1IbMEWYcswl4N 7wGOxy4YD9u5oOeXXYty+F9AItRnEgVFBjEYc1A1geoqhgJSkIPzB1ADQ9Zg= X-Gm-Gg: AZFdTZfDpOpclRZslADCdxpTICXTFMlmtllUGpwtGKBesLnXHUjcwvYQYaDy/e+Na7K X0Kfe98rkgmaMMFUz4kXM5iDLXurLLUxPZ9IVS9KZ8qz7pzfjHcT5kgOp49C/BKKelUNERJ2Hy/ 9XIW82motPj/3chWglZ2hw78XrJLyu98fpxyK4VXiEhlUQTfYymX+B7PNLlf+phoyY8OHDW+3LM O5/sTZ5Ynkps3B+LHrBKvjPr0dgIahs4FKIw1jPv+iTnALqdZFf0eI7iLiqtW8QOXWUhzYShkg1 JPGoSfsUqJdm3fO3S57TWrKzB3HWd4izYJ1rhshbBAtrY8af7FVf/rIpHVCQNb1ubpnECBo+FdR x8gRAgBpHzU41gXZzZ4VlEPaD9tu/WZX0tNQzuGkMNjd812Gyi7UOFz0/QbOEjw== X-Received: by 2002:a05:620a:454c:b0:940:7e5c:7424 with SMTP id af79cd13be357-949bab6789dmr7194992985a.66.1796246814831; Wed, 02 Dec 2026 13:26:54 -0800 (PST) X-Received: by 2002:a05:620a:454c:b0:940:7e5c:7424 with SMTP id af79cd13be357-949bab6789dmr7194988485a.66.1796246814207; Wed, 02 Dec 2026 13:26:54 -0800 (PST) Received: from localhost ([130.25.105.85]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4bbe005543esm19083485e9.5.2026.12.02.13.26.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Dec 2026 13:26:53 -0800 (PST) Date: Wed, 2 Dec 2026 22:26:52 +0100 From: Lorenzo Bianconi To: Sagar Cheluvegowda Cc: maxime.chevallier@bootlin.com, andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com, mcoquelin.stm32@gmail.com, alexandre.torgue@foss.st.com, Jose.Abreu@synopsys.com, netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, hongmei.xu@oss.qualcomm.com, abhishek.chauhan@oss.qualcomm.com, sarosh.hasan@oss.qualcomm.com Subject: Re: [PATCH net] net: stmmac: xgmac: fix RX split header length on multi-descriptor frames Message-ID: References: <20261125192531.1940982-1-sagar.cheluvegowda@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: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="Aw8fNkRhfVtD3w9r" Content-Disposition: inline In-Reply-To: <20261125192531.1940982-1-sagar.cheluvegowda@oss.qualcomm.com> X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMjAyMDA4NSBTYWx0ZWRfX/mCyScShNNkL UYqyT0eksm1UJzNIdEu7+7Un44Xaom+ZqvLoiJ4vIoNGenTqi4AWYIzw8jEtiJxjqpqijs8UCXN vl+fWJgf+I4BiF1Xvn1jVP5KNm/B8FssVrlKHjluAiRD0FUghjh7En5+1XL8rX0x6OVtsd5dcOO 40Bvo2WWQz1GRDCbU+nqno9VCfjkSySSVI8dWw5tOD54WccMVmlygRcTKkGY8MIH2tE7fg/tFwz cMIdts/GUjcBIeTLANCdrWDontgvfSOIkof73xkT6zySYyt8jksbF7WeycUSHSmglSkVoDX4fcj qCZ+oeuTenFQyxSiZSUJvBU9WbZpHpdiYhHkiIg/o4a+rnAF1KlLR0d+4DgO+eN6f9KMzpesyM3 6yM9wSRZW7hXmdzxL0hOzK1TznCIoX39S0DS1VEzQ5qj6bShZzDNN8vtpl0bupCpmRWMvadU+hq asSVniCQXkfTU0WPPRw== X-Authority-Analysis: v=2.4 cv=X7nHu2Te c=1 sm=1 tr=0 ts=6b108d20 cx=c_pps a=50t2pK5VMbmlHzFWWp8p/g==:117 a=RcFDq6c+avmIvxkL9iwlxA==:17 a=pUM-KoujPXoA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=Um2Pa8k9VHT-vaBCBUpS:22 a=VwQbUJbxAAAA:8 a=EUspDBNiAAAA:8 a=P9ILob_IFU2RldAgOg4A:9 a=CjuIK1q_8ugA:10 a=BIDXvaA6S5sl_s4Yt7kA:9 a=IoWCM6iH3mJn3m4BftBB:22 X-Proofpoint-Spam-Info: AW1haW4tMjYxMjAyMDA4NSBTYWx0ZWRfX+YhLF5gKPmQz fKcAqXxH75qDvoaeVWxNxlJ6wsWYTHTTn1qP0TSBwLXsHK0oW7rxbEEbtZzvLIgrKYguNWAg8G8 8QZT34JF5SliHT14NtGb0itaT7b+z0c= X-Proofpoint-GUID: eX78KVcn1TcmlixppBi_wBBK0NJ6cxAN X-Proofpoint-ORIG-GUID: eX78KVcn1TcmlixppBi_wBBK0NJ6cxAN X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.138,FMLib:17.12.100.49 definitions=2026-12-02_06,2026-12-02_07,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 phishscore=0 adultscore=0 bulkscore=0 clxscore=1015 priorityscore=1501 spamscore=0 malwarescore=0 lowpriorityscore=0 suspectscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2611040001 definitions=main-2612020085 --Aw8fNkRhfVtD3w9r Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Nov 25, Sagar Cheluvegowda wrote: > dwxgmac2_get_rx_header_len() only reads the split header length (HL) > from RDES2 when RDES3.L34T is non-zero. L34T, like all RDES3 status > fields other than bits [31:28], is only valid on the last descriptor > (LD set). HL, on the other hand, is only valid on the first descriptor > (FD set), and the databook's "Header Length Availability in RDES2" > table states that HL is available in RDES2[9:0] when FD=3D1 and LD=3D0, > without any dependency on L34T. >=20 > A frame spans multiple descriptors when it is larger than the RX buffer > size. This can happen at any MTU, as XGMAC_CORE_INIT_RX sets GPSLCE and > WD with GPSL =3D XGMAC_JUMBO_LEN (16368), so the MAC accepts frames up to > 16368 bytes while dma_buf_sz is only 1536 at an MTU of 1500. >=20 > For such a frame, the first descriptor has FD set and LD clear, and > L34T is not valid there. When it reads as zero, hlen stays 0 and > stmmac_rx_buf1_len() falls through to the rx_not_ls path, which counts > buffer 1 as a full dma_buf_sz although it only holds the split header. > The frame length accounting is then wrong and the skb is built with > the wrong data. >=20 > Read HL whenever the first descriptor is not also the last one, and > keep the L34T check for single-descriptor frames. Also return early > when FD is not set, as HL is not defined there. The caller already > ignores the header length for non-first descriptors, so this part > does not change the current behaviour. >=20 > Fixes: 96147375d49f ("net: stmmac: xgmac: Only get SPH header len if avai= lable") > Co-developed-by: Abhishek Chauhan > Signed-off-by: Abhishek Chauhan > Co-developed-by: Sarosh Hasan > Signed-off-by: Sarosh Hasan > Signed-off-by: Sagar Cheluvegowda Reviewed-by: Lorenzo Bianconi =20 > --- > This fix was split out of the net-next L2 split header series after > review of v5, where the multi-descriptor case was pointed out to be > reachable with the current GPSL setting and to need a separate fix. > The net-next patch will be reposted on top of this once it is in > net-next. >=20 > v5 of the net-next patch: > https://lore.kernel.org/netdev/20261120005243.3724402-1-sagar.cheluvegowd= a@oss.qualcomm.com/ > Review comment: > https://lore.kernel.org/netdev/179548403438.3135.1804854034587814346@kern= el.org/ >=20 > drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h | 1 + > drivers/net/ethernet/stmicro/stmmac/dwxgmac2_descs.c | 9 ++++++++- > 2 files changed, 9 insertions(+), 1 deletion(-) >=20 > diff --git a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h b/drivers/net= /ethernet/stmicro/stmmac/dwxgmac2.h > index f8ab347f7b5b..0cdc0bc695c2 100644 > --- a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h > +++ b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h > @@ -437,6 +437,7 @@ > #define XGMAC_RDES3_OWN BIT(31) > #define XGMAC_RDES3_CTXT BIT(30) > #define XGMAC_RDES3_IOC BIT(30) > +#define XGMAC_RDES3_FD BIT(29) > #define XGMAC_RDES3_LD BIT(28) > #define XGMAC_RDES3_CDA BIT(27) > #define XGMAC_RDES3_RSV BIT(26) > diff --git a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_descs.c b/drive= rs/net/ethernet/stmicro/stmmac/dwxgmac2_descs.c > index 6719ac6e395b..ed38aa358642 100644 > --- a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_descs.c > +++ b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_descs.c > @@ -292,7 +292,14 @@ static int dwxgmac2_get_rx_hash(struct dma_desc *p, = u32 *hash, > =20 > static void dwxgmac2_get_rx_header_len(struct dma_desc *p, unsigned int = *len) > { > - if (le32_to_cpu(p->des3) & XGMAC_RDES3_L34T) > + u32 rdes3 =3D le32_to_cpu(p->des3); > + > + /* HL is only defined on the first descriptor */ > + if (!(rdes3 & XGMAC_RDES3_FD)) > + return; > + > + /* L34T is only valid on the last descriptor */ > + if (!(rdes3 & XGMAC_RDES3_LD) || (rdes3 & XGMAC_RDES3_L34T)) > *len =3D le32_to_cpu(p->des2) & XGMAC_RDES2_HL; > } > =20 > --=20 > 2.34.1 >=20 --Aw8fNkRhfVtD3w9r Content-Type: application/pgp-signature; name=signature.asc -----BEGIN PGP SIGNATURE----- iHUEABYKAB0WIQTquNwa3Txd3rGGn7Y6cBh0uS2trAUCaxCNHAAKCRA6cBh0uS2t rOoEAQCY2hxV2rXhBWRa92H8T8Mh49oI9ZBfBCZlYK1chk4X8QD+NxB31Q7Z3JF3 5UbNn4VG7VB12I8VO02reP0QKL2WYws= =QkPF -----END PGP SIGNATURE----- --Aw8fNkRhfVtD3w9r--