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=1796492112; b=GwHewM7KFI2WG4dneArN2M0K6hEs8bDbyIoIcqqyCPbhQ6HTtfr3fBSbqxFeaiWqc0aB Xjyx2IPS5VVx8xF6ZRzrvxs0jaT0MIQPeywGJLSRG3q4/aIrfpif6HpZSNaEVNPZ48+8g zYqnUKdCjzu9QNv6AJ1d87v7XXYPMH95YEPiycxluF+eI58FPFjX6ikjm/vUM+Rk1jGOu o7nmcI/zDw4aDq5gNAQjnq4kHMFPfDE4mIjnGt8RGAKmRum7lzSGEt9aO20Qqwv83cICf 9H4elB/TgZKfjzRx9SZwZhA+gI1+sCfP2mzzTHoBQKRQKeRkp1QsU9WMuWBtnxqHlfA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796492112; h=DMARC-Filter:Received:DKIM-Signature:Received:Received: DKIM-Signature:X-Google-DKIM-Signature: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-Info:X-Proofpoint-Spam-Details-Enc: X-Authority-Analysis:X-Proofpoint-ORIG-GUID:X-Proofpoint-GUID: X-Proofpoint-Virus-Version:X-Proofpoint-Spam-Details; bh=SO/Hka5pvwfcOFIZ3IKEQmX6KhsBzx9MB4eJ3hP0hHM=; b=S37BYxRJMETMcbU+arSnyFTKSd/sgnZDPSYASl6UXY3tOW1MLvQ6ebknYrjaUbCkmVVT SCGOlRPViN0PvsBuDXo3+T4UnpBmilxNP+l/N1FBf916V3aGmqE+V/eWLuC/EmQLlijcF 0FHPOph50HKcP6DvwINhd6F/7T5w+768lu7pNWY2ZTSO9bPI15wfcJw4uWrJi/Y72gV5P bPTEKPMPKB7X1Fud+HGis5Ymjk4+ngh9SLLtDcYSjVz6ROLGPUf/abXyjAyB6mMNN08Dz BB7m+VB61yRCOWYvRhka27zEraWupPb/gAeRdRtsNOBqVmPvzo89Yhkt9SFtGLtUvag== 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=klp81O0W; dkim=pass header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.a=rsa-sha256 header.s=google header.b=DRRINjFh; 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 F17C5606A322 for ; Sat, 5 Dec 2026 17:35:11 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org F17C5606A322 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=klp81O0W; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.a=rsa-sha256 header.s=google header.b=DRRINjFh Received: from pps.filterd (m0279864.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 6B5GmfrY514665 for ; Sat, 5 Dec 2026 17:35:11 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=SO/Hka5pvwfcOFIZ3IKEQmX6 KhsBzx9MB4eJ3hP0hHM=; b=klp81O0WGo/I/fUkk5owEFpZ94otPSc3911JfdWc 0dkNeBFtxiFYyk3dXqY5KTsv+YCfZVK1EspJAfDJGcXOAhxC3gLAbnFbgn0i7yTX +1rFNNsVBLKaPqF4D99ccefzizCsR5t6wtlaBUN5agMkZzAlmGCW+oe+dz8j6ats iDgdz9B5cKhhg6RhwhevvRnRrYrtk7Fdsu6CAFjJ+rUrjDb/t3674nHfkA7IvL+m fnhN8fOQJ5GSt2MKH+sRmtJTHISY+Rb7FdEOu5ElfOYbr3Y6iKPAQh+w2TizOvOL INzSDLGe/K9VI6Xud36jd/Iy2n/ASFOw5eb5wTmpXfo3hA== Received: from mail-ua1-f70.google.com (mail-ua1-f70.google.com [209.85.222.70]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4jcbshhggx-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Sat, 05 Dec 2026 17:35:10 +0000 (GMT) Received: by mail-ua1-f70.google.com with SMTP id a1e0cc1a2514c-99e14fa4868so380748241.1 for ; Sat, 05 Dec 2026 09:35:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1796492110; x=1797096910; 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=SO/Hka5pvwfcOFIZ3IKEQmX6KhsBzx9MB4eJ3hP0hHM=; b=DRRINjFhKwi3g7uojzkmrzsjrFOXp5ioeTrwU0otlfyx2IqmfefuzIPkee6mT9ELrl 5eFVorV+hX+fXD0E4axS/RGMxURSnmVRBFwTnQ0rlnPawL6QhJgqHOPTz+cpexs52Toi +cYkhE3qILAsz4v9bmS7aygrbfWrUerPP0BZtKBvG+HTUZL+cppCasZldzE8EtApzW8m ZZbzDkRngsT8gBob5QFPvn3ed+RovYG2QU8UCUUrIpCGmNU7BpLh8RgM3C9q8A4CCwxu Hi1fSq8MMhQFK67AsJCEf6xKiOdCik5o0Nhr+yWzuD6nww6w3AvSTi9W4flqLNEAB1O9 hG5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796492110; x=1797096910; 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=SO/Hka5pvwfcOFIZ3IKEQmX6KhsBzx9MB4eJ3hP0hHM=; b=AYwEre191IgZsVxBBSdAIVaePseza+hlBT708z+iFXn9Dep6y8u1xxVuQ2gol7VjJ6 et8Qlk7TArKs6bUNAkuCdfb5pr5GwFYtbvhkrmLZptUY7Lj5PokStd3OmZQGuGgJEGQu rttCDZp7qUOKxXiMaImvWr2hL5mpH4C+a8j1oFSbzhhGd20rpNv9lbUH1/gN2bcGlJEH 0r74h+PFtHp0nl5nMKX964gYnwGvKzwhlqRMpu6QvVDrs63ei81J0e4c7+ucuufTOskN D8+nalKMoFl/WbBWB4jAsadg2L2bIJnqbfoaHH2y1GaUn1RiYu4jsNwidvQ7ETyqWYPm g6Rg== X-Gm-Message-State: AB4q+uEPDQnW5BCJOUClaIceNlTZlNEDhkEE6ludbXQzhOYhE5/y9vh9 yLqV1yslR/SnhFqLHIYkaoVXv7z07F/FeOvhWFDw9wV+3lVpHBinFhEcoZqqmAvB9E7VCeoZsvJ 6a+MA5gCcRvXW0D8JlCW9XI9sXguwtlgPkzxGmUxSpotrHxtCM/QNbbc= X-Gm-Gg: AZFdTZcD7/s+lIxhS6uX7T8WTgydysyOb0L/qTUAZ/Rd69VYk139RX4Rje08I3B+JEp sLH/LokwixFrnP1YG3B7arbD6OsVla/2SqVm6wxWWlS52PX/qYD/GsNOXbM69mn4nbj6b8hWdCW JWyYPyrDr/ZM5JTwce2iNn6/kZucgrYzb8piaS++RJUVdLBJSh3xL5PxgV4s+ee21nb9s8Da6nV WRVoC3s/WGl5mslP027KfG0qTqPS5m4+2OU+/ZOiQKH8Csw8WnGinOf+crn9r2sTCVKhjpdTeEj BpR88pj7ywzBtnexvZe1Uqo/ANuGSWMpMXpTV3i8dSBf4l6wp4o3v3JjMK4CYPB6+gFYjJ80MyS Jm4G6PS6r8zhc+gAXjy7I1BtIYXW/4VGds29CAsaCacr2MSGkCVquw0heKWlNXg== X-Received: by 2002:a67:e115:0:b0:7ca:e2c1:9a09 with SMTP id ada2fe7eead31-7daec7e39b2mr3833744137.20.1796492109741; Sat, 05 Dec 2026 09:35:09 -0800 (PST) X-Received: by 2002:a67:e115:0:b0:7ca:e2c1:9a09 with SMTP id ada2fe7eead31-7daec7e39b2mr3833728137.20.1796492109034; Sat, 05 Dec 2026 09:35:09 -0800 (PST) Received: from localhost ([130.25.105.85]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4d17426821asm11908937f8f.45.2026.12.05.09.35.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 05 Dec 2026 09:35:07 -0800 (PST) Date: Sat, 5 Dec 2026 18:35:06 +0100 From: Lorenzo Bianconi To: sashiko-reviews@lists.linux.dev Cc: bpf@vger.kernel.org Subject: Re: [PATCH net-next v14 2/5] net: stmmac: remove software VLAN tag stripping Message-ID: References: <20261204-stmmac-rx-mb-v14-0-5506796fd39e@oss.qualcomm.com> <20261204-stmmac-rx-mb-v14-2-5506796fd39e@oss.qualcomm.com> X-Mailing-List: bpf@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="h8K7gMwhMGrxoJTo" Content-Disposition: inline In-Reply-To: X-Proofpoint-Spam-Info: AW1haW4tMjYxMjA1MDA2OSBTYWx0ZWRfXzIEuhHAdwjm9 +5/wdorCWNG3suq8lJtQUYzudS+l/3bGXUQjwB2vZ2Mw13s7pSgpORNynrawQdFeGFef9iTwQ2e PI80tzgw9cBCDQAemk52kB6KtrYKA2s= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMjA1MDA2OSBTYWx0ZWRfX8MSIPBrLG3j5 TrsL/GMOi9KzQaNVMMalCr17A0eDZYJK8Uf2/U6rMuNKnXplJTWQdQZmjZmtBtTydDt3VykGxU1 Z6X3FPKXO03dG/RP+q6nMRzrUIhGyk9cWEsbF7/DfNqatMM0PHm2Wqb2rANR1/Szfxok3FVhZsv 2QgWIjK7ItZCcp8BL/ZHCjjiHsYJMsw6/mYl5RqjQ+0ZMKjkhPx3wHIelW6Ks4GVg2bnyLhOcXb bHYAEH6X6d8pWS5wtjAls2Lv1vpp/XoUB7via+NqrFHnUQIdOHk1jrW4/NLhmmlR7EjW11j3v1h k0W/awGNXURuhmVJNu8LMe/doe3k11k3VtvuQ7ZzB8rizjQsJwip9RsO2IcNM+88/K6/j8L/uLp oAeluEtUiXlyrkUYQFFSN6jq6oMpdMFhkx4h03ynJ6IPK9fpqhMhxUQoy1g3ulbjUp87C9a3sfv HGmIcEQJ2tiHiGixMog== X-Authority-Analysis: v=2.4 cv=ONiyTiaB c=1 sm=1 tr=0 ts=6b144b4f cx=c_pps a=R6oCqFB+Yf/t2GF8e0/dFg==:117 a=RcFDq6c+avmIvxkL9iwlxA==:17 a=pUM-KoujPXoA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=DJpcGTmdVt4CTyJn9g5Z:22 a=VwQbUJbxAAAA:8 a=EUspDBNiAAAA:8 a=c92rfblmAAAA:8 a=P-IC7800AAAA:8 a=1RTuLK3dAAAA:8 a=WzVO0JfpXhN2DXh-kuoA:9 a=wPNLvfGTeEIA:10 a=lOOg7hQ1Z2NlOcLMa6kA:9 a=TD8TdBvy0hsOASGTdmB-:22 a=GvGzcOZaWPEFPQC_NcjD:22 a=d3PnA9EDa4IxuAV0gXij:22 a=kRpfLKi8w9umh8uBmg1i:22 X-Proofpoint-ORIG-GUID: mk5QWoH5QMoVVI7XbOwXiao9tJaQryTq X-Proofpoint-GUID: mk5QWoH5QMoVVI7XbOwXiao9tJaQryTq 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-05_05,2026-12-03_04,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 spamscore=0 suspectscore=0 lowpriorityscore=0 phishscore=0 impostorscore=0 adultscore=0 clxscore=1015 bulkscore=0 malwarescore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2612040000 definitions=main-2612050069 --h8K7gMwhMGrxoJTo Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable > Thank you for your contribution! Sashiko AI review found 3 potential > issues to consider: > - [Medium] net: stmmac: data race and TOCTOU on hw_vlan_en in > stmmac_set_features() > - [Medium] net: stmmac: VLAN feature gating enables EEE RXC stop on > dwmac1000/DWXLGMAC > - [Low] net: stmmac: Fixes tag queues broad non-backportable VLAN > cleanup to stable > -- >=20 > commit 5b78ea93f852617d0df5a6496b17b18f659bcb2d > Author: Lorenzo Bianconi >=20 > > net: stmmac: remove software VLAN tag stripping > > > > The software VLAN stripping logic in stmmac_rx_vlan() was originally > > introduced in 2014 by 'commit b93819854d6e ("stmmac: Add vlan rx for > > better GRO performance.")' as a workaround to improve GRO performance, > > since at that time GRO could not handle frames with VLAN tags. However, > > this limitation was resolved in 2015 by 'commit 66e5133f19e9 ("vlan: Add > > GRO support for non hardware accelerated vlan")', which added GRO suppo= rt > > for non-hardware-accelerated VLAN frames. Keeping a software fallback > > path for VLAN stripping is no longer necessary and only adds complexity. > > > > After removing it, VLAN tags remain in the packet, so > > stmmac_has_ip_ethertype() has to keep recognising IPv4/IPv6 behind a > > single in-payload VLAN tag. On RX the helper runs after eth_type_trans(= ), > > which has already pulled the Ethernet header, so walk the tag chain with > > skb_mac_offset() instead of __vlan_get_protocol(), which assumes the MAC > > header still sits at skb->data. On TX the helper still runs before the > > header is pulled. > > > > Make the tolerated L2 depth explicit: > > - on RX allow a single in-payload C-tag while the MAC is not stripping > > tags (VLAN_ETH_HLEN); when HW stripping is active the payload must be > > tag-free, so keep the ETH_HLEN limit and reject any tag that is still > > there; > > - in-payload S-tags are always rejected, as only an S-tag that the > > hardware stripped (and whose type is reported through > > get_rx_vlan_proto) is known to have been parsed by the checksum engin= e; > > - on TX keep the old ETH_HLEN limit, so DSA-tagged frames that the > > checksum engine ignores (see commit c2945c435c99 ("net: stmmac: > > Prevent DSA tags from breaking COE")) remain excluded from hardware > > checksum and TSO. > > > > This intentionally changes the advertised features: > > - dwmac100/dwmac1000 no longer advertise NETIF_F_HW_VLAN_CTAG_RX; > > they have no hardware VLAN stripping. > > - On xmac cores NETIF_F_HW_VLAN_CTAG_RX is advertised only when the > > VLAN ops provide .set_hw_vlan_mode and .rx_hw_vlan, so DWXLGMAC no > > longer falsely advertises RX VLAN offload. > > - NETIF_F_HW_VLAN_STAG_RX is advertised only on cores that provide > > hardware RX VLAN offload and whose descriptor ops report the stripped > > tag protocol (get_rx_vlan_proto), i.e. DWXGMAC. DWXLGMAC loses it > > because it has no RX VLAN offload, while cores without > > get_rx_vlan_proto report stripped S-tags as C-tags. > > > > The DWXLGMAC mis-advertisement was introduced by 'commit 534df0c1724b > > ("net: stmmac: dwxgmac2: Add support for HW-accelerated VLAN stripping"= ), > > which widened the RX VLAN offload gate from GMAC4 to all xmac cores but > > only added .rx_hw_vlan to dwxgmac210_vlan_ops. DWXLGMAC is also > > DWMAC_CORE_XGMAC, and dwxlgmac2_vlan_ops has no .rx_hw_vlan, so it ended > > up advertising RX VLAN offload while neither hardware nor software > > stripped the tag. Tag the fix accordingly. > > > > With NETIF_F_VLAN_FEATURES possibly empty, stmmac_phylink_setup() may > > now allow the PHY to stop the RX clock in LPI on cores that no longer > > advertise any VLAN feature, for example dwmac1000 with EEE and DWXLGMAC > > without vlhash/vlins. The MAC needs RXC running for some register > > accesses, including the MAC address and filter registers written by > > stmmac_set_rx_mode(). That callback runs with bottom halves disabled and > > cannot use phylink_rx_clk_stop_block(), so a multicast, unicast or > > promiscuous update could be lost while the clock is stopped. > > > > This is not a new failure mode: the same window already exists with > > CONFIG_VLAN_8021Q=3Dn and existed before 'commit c171e679ee66 ("net: st= mmac: > > Disable EEE RX clock stop when VLAN is enabled"), whose VLAN feature > > check only guarded it incidentally. dwmac100 is unaffected because it > > has no EEE. > > > > This will be addressed by a dedicated follow-up patch that decouples the > > EEE RX clock-stop policy from the advertised VLAN features and makes the > > atomic register accesses safe. The preceding selftests patch already > > blocks RX clock stop while the ethtool selftests run. > > > > This depends on the preceding selftests fix. > > > > Fixes: 534df0c1724b ("net: stmmac: dwxgmac2: Add support for HW-acceler= ated VLAN stripping") > > Suggested-by: Maxime Chevallier > > Co-developed-by: Peilin He > > Signed-off-by: Peilin He > > Reviewed-by: Maxime Chevallier > > Signed-off-by: Lorenzo Bianconi >=20 > [Severity: Low] > Should this patch carry Fixes: 534df0c1724b ("net: stmmac: dwxgmac2: Add > support for HW-accelerated VLAN stripping")? >=20 > In netdev, a Fixes: tag queues the commit for automated stable backportin= g, > but this change cannot be backported standalone to stable trees carrying > 534df0c1724b: stmmac_has_ip_ethertype() calls > vlan_get_protocol_offset_inline() from 7a4cd71fa451 ("net: add > vlan_get_protocol_offset_inline() helper"), and the patch depends on comm= it > "net: stmmac: selftests: Prevent RXC from being disabled in LPI". >=20 > It also bundles the narrow DWXLGMAC fix with removing stmmac_rx_vlan(), > dropping NETIF_F_HW_VLAN_CTAG_RX on dwmac100/dwmac1000, and exposing the > EEE RX clock-stop window noted above. Splitting out the DWXLGMAC > advertisement fix for net/stable, or dropping the Fixes: tag here, would > avoid broken backports. >=20 > [ ... ] >=20 > > diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/driver= s/net/ethernet/stmicro/stmmac/stmmac_main.c > > index b3524d46863da..c429cb9e1ccbe 100644 > > --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c > > +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c > > @@ -4893,16 +4895,25 @@ static netdev_tx_t stmmac_tso_xmit(struct sk_bu= ff *skb, struct net_device *dev) > > * Return: true if the ethertype can trigger the checksum engine, false > > * otherwise > > */ > > -static bool stmmac_has_ip_ethertype(struct sk_buff *skb) > > +static bool stmmac_has_ip_ethertype(struct stmmac_priv *priv, > > + struct sk_buff *skb, bool xmit) > > { > > - int depth =3D 0; > > - __be16 proto; > > + __be16 proto, h_proto =3D eth_header_parse_protocol(skb); > > + int max_l2_hlen, depth =3D 0; > > + > > + /* An S-tag still in the payload may not have been parsed by the > > + * checksum engine; only trust it when the hardware stripped it, in > > + * which case h_proto is no longer ETH_P_8021AD. > > + */ > > + if (h_proto =3D=3D htons(ETH_P_8021AD)) > > + return false; > > =20 > > - proto =3D __vlan_get_protocol(skb, eth_header_parse_protocol(skb), > > - &depth); > > + proto =3D vlan_get_protocol_offset_inline(skb, h_proto, > > + skb_mac_offset(skb), &depth); > > =20 > > - return (depth <=3D ETH_HLEN) && > > - (proto =3D=3D htons(ETH_P_IP) || proto =3D=3D htons(ETH_P_IPV6)); > > + max_l2_hlen =3D xmit || priv->hw->hw_vlan_en ? ETH_HLEN : VLAN_ETH_HL= EN; > > + return depth <=3D max_l2_hlen && > > + (proto =3D=3D htons(ETH_P_IP) || proto =3D=3D htons(ETH_P_IPV6= )); > > } >=20 > [Severity: Medium] > Can concurrent ethtool -K rxvlan toggling race with RX polling on > priv->hw->hw_vlan_en? >=20 > stmmac_set_features() writes priv->hw->hw_vlan_en under rtnl_lock() > without stopping NAPI or using WRITE_ONCE(), while stmmac_rx() and > stmmac_dispatch_skb_zc() now read it twice per packet without locking: > once before stmmac_rx_hw_vlan() and again inside stmmac_has_ip_ethertype(= ). >=20 > CPU0 CPU1 > stmmac_set_features() stmmac_rx() > (ethtool -K rxvlan off) if (priv->hw->hw_vlan_en) /* true */ > stmmac_rx_hw_vlan(...) > eth_type_trans(...) > priv->hw->hw_vlan_en =3D false; > phylink_rx_clk_stop_block(...) > stmmac_has_ip_ethertype(...) > priv->hw->hw_vlan_en /* false */ > max_l2_hlen =3D VLAN_ETH_HLEN > <-- inner C-tag marked UNNECESSARY >=20 > On a double-tagged frame whose outer tag hardware already stripped, > reading true then false lets stmmac_has_ip_ethertype() accept the > remaining inner C-tag and mark the frame CHECKSUM_UNNECESSARY. This also > compounds the window where stmmac_set_features() flips hw_vlan_en before > sleeping in phylink_rx_clk_stop_block() and before > stmmac_set_hw_vlan_mode() updates the hardware register: toggling rxvlan > on can duplicate an unstripped tag, while toggling it off can drop a > stripped tag. >=20 > Passing a single READ_ONCE(priv->hw->hw_vlan_en) snapshot into > stmmac_has_ip_ethertype() avoids the per-packet mismatch, and > synchronizing the flag update with NAPI/RX programming avoids the > hardware/software window. This issue was already present even before this patch so I posted a dedicat= ed fix here: https://lore.kernel.org/netdev/20261205-stmmac-do-not-flip-vlan-offload-v1-= 1-5b3fa52c306b@oss.qualcomm.com/T/#u >=20 > [ ... ] >=20 > > @@ -8282,15 +8255,15 @@ static int __stmmac_dvr_probe(struct device *de= vice, > > ndev->features |=3D ndev->hw_features | NETIF_F_HIGHDMA; > > ndev->watchdog_timeo =3D msecs_to_jiffies(watchdog); > > #ifdef STMMAC_VLAN_TAG_USED > > - /* Both mac100 and gmac support receive VLAN tag detection */ > > - ndev->features |=3D NETIF_F_HW_VLAN_CTAG_RX; > > - if (priv->plat->core_type =3D=3D DWMAC_CORE_XGMAC) > > - ndev->features |=3D NETIF_F_HW_VLAN_STAG_RX; > > - > > - if (dwmac_is_xmac(priv->plat->core_type)) { > > + if (stmmac_rx_8021q_offload(priv)) { > > + ndev->features |=3D NETIF_F_HW_VLAN_CTAG_RX; > > ndev->hw_features |=3D NETIF_F_HW_VLAN_CTAG_RX; > > priv->hw->hw_vlan_en =3D true; > > } > > + > > + if (stmmac_rx_8021ad_offload(priv)) > > + ndev->features |=3D NETIF_F_HW_VLAN_STAG_RX; > > + > > if (priv->dma_cap.vlhash) { > > ndev->features |=3D NETIF_F_HW_VLAN_CTAG_FILTER; > > if (priv->plat->core_type =3D=3D DWMAC_CORE_XGMAC) >=20 > [Severity: Medium] > Can gating NETIF_F_HW_VLAN_CTAG_RX here cause stmmac_set_rx_mode() > register writes to be lost on dwmac1000 and DWXLGMAC? >=20 > Previously, with CONFIG_VLAN_8021Q enabled, __stmmac_dvr_probe() always > set NETIF_F_HW_VLAN_CTAG_RX, keeping NETIF_F_VLAN_FEATURES non-empty so > stmmac_phylink_setup() left config->eee_rx_clk_stop_enable false. Now > dwmac1000 (which has no vlan ops and no vlhash/vlins, but supports EEE) > and DWXLGMAC without vlhash/vlins leave NETIF_F_VLAN_FEATURES empty, > enabling PHY RX clock stop in LPI. >=20 > Because stmmac_set_rx_mode() runs with bottom halves disabled and cannot > call phylink_rx_clk_stop_block(), multicast, unicast, or promiscuous > filter updates can be silently dropped while RXC is stopped. The commit > message defers decoupling EEE RX clock stop from NETIF_F_VLAN_FEATURES to > a future patch outside this series; should that fix land before gating > NETIF_F_HW_VLAN_CTAG_RX here? This issue has not been introduced by this patch so I posted a dedicated fix for it here: https://lore.kernel.org/netdev/20261205-stmmac-keep-rxc-running-v1-1-35f8cb= 71cb98@oss.qualcomm.com/T/#u Regards, Lorenzo >=20 > --=20 > Sashiko AI review =B7 https://sashiko.dev/#/patchset/20261204-stmmac-rx-m= b-v14-0-5506796fd39e@oss.qualcomm.com?part=3D2 --h8K7gMwhMGrxoJTo Content-Type: application/pgp-signature; name=signature.asc -----BEGIN PGP SIGNATURE----- iHUEABYKAB0WIQTquNwa3Txd3rGGn7Y6cBh0uS2trAUCaxRLSgAKCRA6cBh0uS2t rKLSAQDo2TUn+xXblGwlYFxlFXvdxPpbn19LLmlar/4FxrXM0gD8CJwVebkvLh8k 60rnbJ9KTH1muPh0lRe5FYg6pz9kewE= =BfRY -----END PGP SIGNATURE----- --h8K7gMwhMGrxoJTo--