From nobody Fri Sep 25 16:02:16 2026 Received: from smtpout-03.galae.net (smtpout-03.galae.net [185.246.85.4]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 925F3369D6D; Thu, 10 Sep 2026 15:14:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.85.4 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789053272; cv=none; b=CRGzd5kL7EnhxtWEBt3TsrEg7rPfNNwf0jgvUA8XptrRqa+wiZ/ZJzEJVmfJC2cXO3t68u1vbCinP+4nlXAelLC74qG/iTG1TSonRdhKv6/cb7mkiFHWl4Ua6E21PiMKF++MTah7QXAEFQqnFCFroMqDfyr42chTX1yVTPiU7Es= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789053272; c=relaxed/simple; bh=57YANBJl5PwefqB99euvaUE2FJXJt+Ws4eoGLiojHC8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=uuQ0jdbzQ6jv0m18TlAGlD/wVH/FolDZCBYivmCt4Jq06T8S6I7T0izG+yGhT6AqOZxy55QVLPTqijHPE8XyPXykDD5OcJ9R/Jk7KD7r4nKqXqG0AUbwG1AMmw7UOLgEJH//qnpBzQbtMbtITDAJoL2YqzvR6Lh+3DnRlPLdrdA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=K/HP254I; arc=none smtp.client-ip=185.246.85.4 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="K/HP254I" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id 139754E40107; Thu, 10 Sep 2026 15:14:23 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id D93915FA2F; Thu, 10 Sep 2026 15:14:22 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 3EFF911C799CC; Thu, 10 Sep 2026 17:14:17 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1789053260; h=from:subject:date:message-id:to:cc:mime-version: content-transfer-encoding:in-reply-to:references; bh=acg21s52zn73yG1o10b+uWJAS2RrIOADAmWZx0hmucI=; b=K/HP254InF82/kPVp2OTvH88F78ebglu+GtBb7knTo1O4Me+mmTNwl+Z2TZ43GcqeHZJH+ 13odnXkB8EtHtjz5j9D+0ERL8fsRZWr3IeDU2pIkdxgeuxmAYR+pH9MdHBdR8tpGWm5yUE jYcJPa3tsm86+m8WVEL5eJ1/R367cFpBfqYEstoIKVDTVRvfd5/UKiwr7pzVer7+zb9XLP h5457oiVgjDmiN2R4ddSNL/A0kX8+oqksVhvJvZfur7mXTWzt4GGWxAchMDcSgciaO2w3I vb3n+o9nR9nqPgsOIVvmpKsg7kp89y9++fmI3ZAoS7kxU9NEYiO6sfLF/47dkQ== From: Maxime Chevallier To: Andrew Lunn , davem@davemloft.net, Eric Dumazet , Jakub Kicinski , Paolo Abeni , Russell King , Heiner Kallweit , =?UTF-8?q?Alexis=20Lothor=C3=A9?= , Maxime Coquelin , Alexandre Torgue , Emil Renner Berthing , Minda Chen , Neil Armstrong , Kevin Hilman , Jerome Brunet , Martin Blumenstingl , Jan Petrous , Ovidiu Panait , Jose.Abreu@synopsys.com, Nicolai Buchwitz Cc: Maxime Chevallier , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, thomas.petazzoni@bootlin.com, linux-arm-kernel@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, PKneuper@dspace.de, David Laight Subject: [PATCH net v2 1/6] net: stmmac: selftests: Support running selftests on DSA conduits Date: Thu, 10 Sep 2026 17:13:58 +0200 Message-ID: <20260910151404.976753-2-maxime.chevallier@bootlin.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260910151404.976753-1-maxime.chevallier@bootlin.com> References: <20260910151404.976753-1-maxime.chevallier@bootlin.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Last-TLS-Session-Version: TLSv1.3 Content-Type: text/plain; charset="utf-8" Most stmmac selftests rely on dev_add_pack() to add custom handlers, that validate the packets sent to ourselves through MAC loopback. However, when the stmmac-driven interface is a DSA CPU conduit, all frames that are received have ETH_P_XDSA as a protocol, even though they don't actually contain any tag as they come from the loopback and not the switch. This will prevent any incoming packet to match our packet handlers. Let's register a ETH_P_ALL packet handler when we detect that we're a DSA conduit, and use a proxy packet handler to filter the h_proto. Note that we may still receive incoming packets from the switch, but these frames shouldn't interfere with the very specific frames used for selftests, and stmmac selftests in general aren't safe against external traffic interferences. This was validated on a WPQ864 devkit for IPQ8064, that has the SoC connected to a QCA8k switch. The ARP offload's packet handler is left alone, this feature is just not implemented in stmmac and due for removal. Fixes: 091810dbded9 ("net: stmmac: Introduce selftests support") Signed-off-by: Maxime Chevallier Reviewed-by: Nicolai Buchwitz --- .../stmicro/stmmac/stmmac_selftests.c | 68 ++++++++++++++++--- 1 file changed, 58 insertions(+), 10 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c b/drive= rs/net/ethernet/stmicro/stmmac/stmmac_selftests.c index 6372ec7c3f31..6503678b646e 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -237,6 +238,9 @@ struct stmmac_test_priv { struct stmmac_packet_attrs *packet; struct packet_type pt; struct completion comp; + __be16 packet_type; + int (*func)(struct sk_buff *skb, struct net_device *ndev, + struct packet_type *pt, struct net_device *orig_ndev); int double_vlan; int vlan_id; int ok; @@ -316,6 +320,50 @@ static int stmmac_test_loopback_validate(struct sk_buf= f *skb, return 0; } =20 +static int stmmac_sft_filter(struct sk_buff *skb, struct net_device *ndev, + struct packet_type *pt, + struct net_device *orig_ndev) +{ + struct stmmac_test_priv *tpriv =3D pt->af_packet_priv; + struct ethhdr *hdr =3D eth_hdr(skb); + int ret =3D 0; + + if (hdr->h_proto =3D=3D tpriv->packet_type) { + struct sk_buff *nskb =3D skb_clone(skb, GFP_ATOMIC); + + if (nskb) + ret =3D tpriv->func(nskb, ndev, pt, orig_ndev); + } + + kfree_skb(skb); + return ret; +} + +static void stmmac_sft_add_pack(struct packet_type *pt) +{ + struct stmmac_test_priv *tpriv =3D pt->af_packet_priv; + + if (netdev_uses_dsa(tpriv->pt.dev)) { + tpriv->packet_type =3D tpriv->pt.type; + tpriv->func =3D tpriv->pt.func; + + /* DSA conduit will report ETH_P_XDSA, so our packet handler + * won't match. Let's register a ETH_P_ALL match and filter + * manually in stmmac_sft_filter. + */ + tpriv->pt.type =3D htons(ETH_P_ALL); + tpriv->pt.func =3D stmmac_sft_filter; + tpriv->pt.ignore_outgoing =3D true; + } + + dev_add_pack(pt); +} + +static void stmmac_sft_remove_pack(struct packet_type *pt) +{ + dev_remove_pack(pt); +} + static int __stmmac_test_loopback(struct stmmac_priv *priv, struct stmmac_packet_attrs *attr) { @@ -337,7 +385,7 @@ static int __stmmac_test_loopback(struct stmmac_priv *p= riv, tpriv->packet =3D attr; =20 if (!attr->dont_wait) - dev_add_pack(&tpriv->pt); + stmmac_sft_add_pack(&tpriv->pt); =20 skb =3D stmmac_test_get_udp_skb(priv, attr); if (!skb) { @@ -360,7 +408,7 @@ static int __stmmac_test_loopback(struct stmmac_priv *p= riv, =20 cleanup: if (!attr->dont_wait) - dev_remove_pack(&tpriv->pt); + stmmac_sft_remove_pack(&tpriv->pt); kfree(tpriv); return ret; } @@ -767,7 +815,7 @@ static int stmmac_test_flowctrl(struct stmmac_priv *pri= v) tpriv->pt.func =3D stmmac_test_flowctrl_validate; tpriv->pt.dev =3D priv->dev; tpriv->pt.af_packet_priv =3D tpriv; - dev_add_pack(&tpriv->pt); + stmmac_sft_add_pack(&tpriv->pt); =20 /* Compute minimum number of packets to make FIFO full */ pkt_count =3D rx_fifo_size; @@ -823,7 +871,7 @@ static int stmmac_test_flowctrl(struct stmmac_priv *pri= v) cleanup: dev_mc_del(priv->dev, paddr); dev_set_promiscuity(priv->dev, -1); - dev_remove_pack(&tpriv->pt); + stmmac_sft_remove_pack(&tpriv->pt); kfree(tpriv); return ret; } @@ -928,7 +976,7 @@ static int __stmmac_test_vlanfilt(struct stmmac_priv *p= riv) * HASH values. */ tpriv->vlan_id =3D 0x123; - dev_add_pack(&tpriv->pt); + stmmac_sft_add_pack(&tpriv->pt); =20 ret =3D vlan_vid_add(priv->dev, htons(ETH_P_8021Q), tpriv->vlan_id); if (ret) @@ -968,7 +1016,7 @@ static int __stmmac_test_vlanfilt(struct stmmac_priv *= priv) vlan_del: vlan_vid_del(priv->dev, htons(ETH_P_8021Q), tpriv->vlan_id); cleanup: - dev_remove_pack(&tpriv->pt); + stmmac_sft_remove_pack(&tpriv->pt); kfree(tpriv); return ret; } @@ -1022,7 +1070,7 @@ static int __stmmac_test_dvlanfilt(struct stmmac_priv= *priv) * HASH values. */ tpriv->vlan_id =3D 0x123; - dev_add_pack(&tpriv->pt); + stmmac_sft_add_pack(&tpriv->pt); =20 ret =3D vlan_vid_add(priv->dev, htons(ETH_P_8021AD), tpriv->vlan_id); if (ret) @@ -1062,7 +1110,7 @@ static int __stmmac_test_dvlanfilt(struct stmmac_priv= *priv) vlan_del: vlan_vid_del(priv->dev, htons(ETH_P_8021AD), tpriv->vlan_id); cleanup: - dev_remove_pack(&tpriv->pt); + stmmac_sft_remove_pack(&tpriv->pt); kfree(tpriv); return ret; } @@ -1293,7 +1341,7 @@ static int stmmac_test_vlanoff_common(struct stmmac_p= riv *priv, bool svlan) tpriv->pt.af_packet_priv =3D tpriv; tpriv->packet =3D &attr; tpriv->vlan_id =3D 0x123; - dev_add_pack(&tpriv->pt); + stmmac_sft_add_pack(&tpriv->pt); =20 ret =3D vlan_vid_add(priv->dev, htons(proto), tpriv->vlan_id); if (ret) @@ -1320,7 +1368,7 @@ static int stmmac_test_vlanoff_common(struct stmmac_p= riv *priv, bool svlan) vlan_del: vlan_vid_del(priv->dev, htons(proto), tpriv->vlan_id); cleanup: - dev_remove_pack(&tpriv->pt); + stmmac_sft_remove_pack(&tpriv->pt); kfree(tpriv); return ret; } --=20 2.55.0 From nobody Fri Sep 25 16:02:16 2026 Received: from smtpout-03.galae.net (smtpout-03.galae.net [185.246.85.4]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 73D73493643 for ; Thu, 10 Sep 2026 15:14:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.85.4 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789053273; cv=none; b=mblf1+N1kZBL1UYKOmKKDrv3XeF3hN97YerOFB5BHdep1q4xjUjOLA0jzh/TfuhVqGgpj+Zg/j045eKOUaFDG2enrS2MSl/2pn9xYq2k8vPKZbvI/lVnbvVqO52JovE2k61AXgjiG/+DYeJ7woK3ZqzOzAjM+hG7NgJC0yzQFEI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789053273; c=relaxed/simple; bh=2fppCEk3a5ehRChhFmz0Q32VBY8fKX8kCPjVTxZ+Bcg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=A5GcBSdvjINJtay3RefyacZYnOXFAC5Dp1ECODGKOeo2EZcfT6+9UuzmmfV+M55z4Ixzl4XU4F/FZdT7p4Wlb/VbQVskPW0J2irf0OuGN2Z5urDeFITuuOJUVrBOmGYLF9RN5fKbBkqmgzCkKbdOEWWNuT3OtTNbUrMCD2+k/94= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=RHbtafzH; arc=none smtp.client-ip=185.246.85.4 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="RHbtafzH" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id 2A12B4E40108; Thu, 10 Sep 2026 15:14:27 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id F09035FA2F; Thu, 10 Sep 2026 15:14:26 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 445CF11C79E5A; Thu, 10 Sep 2026 17:14:21 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1789053265; h=from:subject:date:message-id:to:cc:mime-version: content-transfer-encoding:in-reply-to:references; bh=DNPAM9nDsQc4xWLjYUEEe56W4814wcdUv3lS7rYFjR0=; b=RHbtafzH3Ec0enGh5IsBUxWsI/AG0EySCN9HiXsqJtmZ/telJ/1mTPua726VLAwilDARq0 aJ/G9BIf061vOwkR7ywRhqs7NHOUqqCVjSf44wtI7eKva5tlfxTxpodO/cE1Sb1iWfr6uY ODlRirq5Br9qNyW7JwyJodnm8kKUP2CObDIZuMU04LV0U5f+uwCBgyQYzbbg82SCfH7MSK LWNowoJWZ6bgbjjnTSswmIcaCX7mMEyt+kXgRJYJn8uLNjNyBJmh8Bje6i/Mb+F5D9HPzm hCgVR9KMHUHansZlU6PU5vZqmXtJ3OL5geLkqOK2UgWteyz/zDTSqhE8g2xpgg== From: Maxime Chevallier To: Andrew Lunn , davem@davemloft.net, Eric Dumazet , Jakub Kicinski , Paolo Abeni , Russell King , Heiner Kallweit , =?UTF-8?q?Alexis=20Lothor=C3=A9?= , Maxime Coquelin , Alexandre Torgue , Emil Renner Berthing , Minda Chen , Neil Armstrong , Kevin Hilman , Jerome Brunet , Martin Blumenstingl , Jan Petrous , Ovidiu Panait , Jose.Abreu@synopsys.com, Nicolai Buchwitz Cc: Maxime Chevallier , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, thomas.petazzoni@bootlin.com, linux-arm-kernel@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, PKneuper@dspace.de, David Laight Subject: [PATCH net v2 2/6] net: stmmac: selftests: Validate EEE based on the actual LPI timer value Date: Thu, 10 Sep 2026 17:13:59 +0200 Message-ID: <20260910151404.976753-3-maxime.chevallier@bootlin.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260910151404.976753-1-maxime.chevallier@bootlin.com> References: <20260910151404.976753-1-maxime.chevallier@bootlin.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Last-TLS-Session-Version: TLSv1.3 Content-Type: text/plain; charset="utf-8" The EEE selftest is a 2-step test : - It validates that we enter in LPI mode with the irq_tx_path_in_lpi_mode_n counter - It then validates that we exit LPI when sending a frame, with the irq_tx_path_exit_lpi_mode_n counter. The current state of the test lacks 2 main things : - We don't know exactly when was the previous frame sent (it's from the previous selftest) - The timeout is hardcoded, while the LPI is entered after a user-configurable delay. On top of that, the timeout loop uses a pre-decrement iterator (--retries) that actually only iterate nine times, so 900ms while the default LPI value is 1 second. Let's therefore make it more deterministic : - Send a frame at the beginning of the test - Wait for more than the lpi timer value, we timeout after about twice the value, - Then send another frame, and verify that we do go out of LPI, also with a timeout. Note that the test's goal isn't to validate the LPI timer value itself, only that we enter/leave LPI mode. Fixes: 091810dbded9 ("net: stmmac: Introduce selftests support") Signed-off-by: Maxime Chevallier Reviewed-by: Nicolai Buchwitz dma_cap.eee || !priv->eee_active) @@ -478,14 +478,21 @@ static int stmmac_test_eee(struct stmmac_priv *priv) goto out_free_initial; } =20 + /* Snapshot stats, we want to count the in_lpi events. We may enter + * LPI just after the packet was sent. + */ memcpy(initial, &priv->xstats, sizeof(*initial)); =20 + /* Send a frame, then wait to enter LPI */ ret =3D stmmac_test_mac_loopback(priv); if (ret) goto out_free_final; =20 + max_duration =3D usecs_to_jiffies(2 * priv->tx_lpi_timer); + /* We have no traffic in the line so, sooner or later it will go LPI */ - while (--retries) { + timeout =3D jiffies + max_duration; + while (!time_after(jiffies, timeout)) { memcpy(final, &priv->xstats, sizeof(*final)); =20 if (final->irq_tx_path_in_lpi_mode_n > @@ -494,20 +501,38 @@ static int stmmac_test_eee(struct stmmac_priv *priv) msleep(100); } =20 - if (!retries) { + memcpy(final, &priv->xstats, sizeof(*final)); + if (final->irq_tx_path_in_lpi_mode_n <=3D + initial->irq_tx_path_in_lpi_mode_n) { ret =3D -ETIMEDOUT; goto out_free_final; } =20 - if (final->irq_tx_path_in_lpi_mode_n <=3D - initial->irq_tx_path_in_lpi_mode_n) { - ret =3D -EINVAL; + /* Re-snapshot, as we want to measure exit_lpi events. We should be + * in LPI right now. + */ + memcpy(initial, &priv->xstats, sizeof(*initial)); + + /* TX something so we go out of LPI */ + ret =3D stmmac_test_mac_loopback(priv); + if (ret) goto out_free_final; + + /* Wait for the exit LPI interrupt */ + timeout =3D jiffies + max_duration; + while (!time_after(jiffies, timeout)) { + memcpy(final, &priv->xstats, sizeof(*final)); + + if (final->irq_tx_path_exit_lpi_mode_n > + initial->irq_tx_path_exit_lpi_mode_n) + break; + msleep(100); } =20 + memcpy(final, &priv->xstats, sizeof(*final)); if (final->irq_tx_path_exit_lpi_mode_n <=3D initial->irq_tx_path_exit_lpi_mode_n) { - ret =3D -EINVAL; + ret =3D -ETIMEDOUT; goto out_free_final; } =20 --=20 2.55.0 From nobody Fri Sep 25 16:02:16 2026 Received: from smtpout-04.galae.net (smtpout-04.galae.net [185.171.202.116]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9472A3DB64B; Thu, 10 Sep 2026 15:14:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.171.202.116 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789053284; cv=none; b=dLDNMfGOacSuKwldVKujwiAg4u/xuPHUZKyeXH9MVcKc32u1vdT0IIgCsoG0cEm4nDZoV4ESD9kDsDC9thVuayKAstQbUXvMeJo2ws07JnELWkcL948qKZvt2J1gt4L9W1IKADhCtVmn0c74NVHdXHKZVJ1qfYexwaRKCXezI9E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789053284; c=relaxed/simple; bh=7irgMhQW8nbeyXZU6usCEDkPlfO/injFYuJXGlD5y5k=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=DPR3j2VB+lwhS27ivtv5j4P/l12aSN5tA7uTAUfb/AWOFXvN+5s7QWU5s71DfUoat58L3pDnRKhxaiLVWjSwxh5ed/cj74c4H6kmn2B7+gVp+HLX7+lIyaddU9L7Vl3UuFmSgDSZcbM9M1HT/WVUIRvJpgI0qLBjp4oYWspeAUo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=wdmkJ7TA; arc=none smtp.client-ip=185.171.202.116 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="wdmkJ7TA" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-04.galae.net (Postfix) with ESMTPS id D4D65C653E5; Thu, 10 Sep 2026 15:15:15 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 7780F5FA2F; Thu, 10 Sep 2026 15:14:34 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id CCF1911C7A1A1; Thu, 10 Sep 2026 17:14:25 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1789053269; h=from:subject:date:message-id:to:cc:mime-version: content-transfer-encoding:in-reply-to:references; bh=RJfocTlOORaTvso6KmauJUuwxsbukatHXvhE99wz6ZY=; b=wdmkJ7TABqdAPMZvI3gElyweW7LxwfsN66SDIEA2qqXYxSWISPi9gqcSIYSnXTU9rxPQWw Ggrr0eNbZ7nL5X3Umpmz2x3lHQx4Zo03Q0oZYj4BAGomF78MCR6LZ4B83jXDlOlGsU1UsV 8qx3SwKjXZYaeDgrPC1CA9tePAVPK0NBQe1ZkpH9TT1gCMFutVFyHo6V4H9rjugzlogsCv kBov8hIMzCByaqtURR0cQ9IyUHD6cdnQNljxHI7InCbSl0MPfiD7cmFFY0rH2zl3jype0V DvDRYOQaAYTGE2w0brMqntIdvVnk/Pz5T5o8xNlwnT9KgsrGi2qe6ASjb4cwWQ== From: Maxime Chevallier To: Andrew Lunn , davem@davemloft.net, Eric Dumazet , Jakub Kicinski , Paolo Abeni , Russell King , Heiner Kallweit , =?UTF-8?q?Alexis=20Lothor=C3=A9?= , Maxime Coquelin , Alexandre Torgue , Emil Renner Berthing , Minda Chen , Neil Armstrong , Kevin Hilman , Jerome Brunet , Martin Blumenstingl , Jan Petrous , Ovidiu Panait , Jose.Abreu@synopsys.com, Nicolai Buchwitz Cc: Maxime Chevallier , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, thomas.petazzoni@bootlin.com, linux-arm-kernel@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, PKneuper@dspace.de, David Laight Subject: [PATCH net v2 3/6] net: stmmac: selftests: Check the dev->features for S-TAG offload testing Date: Thu, 10 Sep 2026 17:14:00 +0200 Message-ID: <20260910151404.976753-4-maxime.chevallier@bootlin.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260910151404.976753-1-maxime.chevallier@bootlin.com> References: <20260910151404.976753-1-maxime.chevallier@bootlin.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Last-TLS-Session-Version: TLSv1.3 Content-Type: text/plain; charset="utf-8" The S-TAG offload insertion incorrectly checks the dvlan (double vlan) DMA cap, which is different than S-TAG support. Use NETIF_F_HW_VLAN_STAG_TX to check if the feature is supported instead. Note that this flag isn't set in stmmac yet, but contrary to ARP offload, this is a feature that has a chance to get there eventually so let's leave the selftest here for now. It'll report -EOPNOTSUPP in the meantime. Fixes: 091810dbded9 ("net: stmmac: Introduce selftests support") Signed-off-by: Maxime Chevallier Reviewed-by: Nicolai Buchwitz --- drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c b/drive= rs/net/ethernet/stmicro/stmmac/stmmac_selftests.c index a8280834185c..f3a533bc6bb6 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c @@ -1405,7 +1405,7 @@ static int stmmac_test_vlanoff(struct stmmac_priv *pr= iv) =20 static int stmmac_test_svlanoff(struct stmmac_priv *priv) { - if (!priv->dma_cap.dvlan) + if (!(priv->dev->features & NETIF_F_HW_VLAN_STAG_TX)) return -EOPNOTSUPP; return stmmac_test_vlanoff_common(priv, true); } --=20 2.55.0 From nobody Fri Sep 25 16:02:16 2026 Received: from smtpout-02.galae.net (smtpout-02.galae.net [185.246.84.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 675464A68A0 for ; Thu, 10 Sep 2026 15:14:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.84.56 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789053291; cv=none; b=lN2v00iF3M6qwPOnu5d9NNGI11lmq4VAnbfpen8nSZWfIG4c+5l93dC4lcCL8sveQukgRRYamh1kKVN9K/pdzX/WsWYjtG0Kjn4rgxCAS3EPqHjGR/Ncic9EjLm+H6TawRfxiDL/Cy63d97TrHo+ergjnUQbwBZuN/kQY5HdOg8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789053291; c=relaxed/simple; bh=P67JEVq7rHuOQWlWTVABCnBJLICe+F1s3z0vbsJVNnA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=TQl40nib1JTxVvpIyxurAI+08eKFMxH6mNdZQC8ZP5hY1ck/xcw+8ahmxTEKJSjGAY1F9SPtILmS6CWcgz/kjHuSomlO3SdvDG4Be6FTFjgVJjLvWe/7IQ36GITWpdnbIoDkWmv4AUo/CECLEST02Q0NJNRCW4UNI7ox9YTh7ss= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=M2/iMb6R; arc=none smtp.client-ip=185.246.84.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="M2/iMb6R" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-02.galae.net (Postfix) with ESMTPS id 7C0181A0114; Thu, 10 Sep 2026 15:14:42 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 47BD95FA2F; Thu, 10 Sep 2026 15:14:42 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id BF1CD11C7926E; Thu, 10 Sep 2026 17:14:33 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1789053276; h=from:subject:date:message-id:to:cc:mime-version: content-transfer-encoding:in-reply-to:references; bh=aWpLdQw4aQjr0fuf/ARo3m+WrUsGlzweK0gYsEYy92o=; b=M2/iMb6R8fM9AwE3Suw0bFfRdGLxlIZKBHrpf4ICRxGYrTys2iUAflfbxJFocgQ/IsauXa dxuSIYJa5Eg9HS+bokSNF4/ySaPPQX7LCd+DZ7iUCBiZjFvOlZTbikedPvpXQa1rxhsKOU 7dpVCL4aI5WOf+QZRUg7z7h+7O0T1gPlu2jJVdhCGzhCpFbbUoNMxg4X4rgdFX2E6ODdbn uHdmH5C8tXPJbWfGzIj4Rz9u6HbWAaMSF7NZ7YcysGzBvxEeqole7frDC9i579Dhg+25ND TSV7VKOoUvEizVAsDCX2aVrDLaeKhl9nqf0U2L4rkcMO3NeDAjhBYJZxrEaU4A== From: Maxime Chevallier To: Andrew Lunn , davem@davemloft.net, Eric Dumazet , Jakub Kicinski , Paolo Abeni , Russell King , Heiner Kallweit , =?UTF-8?q?Alexis=20Lothor=C3=A9?= , Maxime Coquelin , Alexandre Torgue , Emil Renner Berthing , Minda Chen , Neil Armstrong , Kevin Hilman , Jerome Brunet , Martin Blumenstingl , Jan Petrous , Ovidiu Panait , Jose.Abreu@synopsys.com, Nicolai Buchwitz Cc: Maxime Chevallier , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, thomas.petazzoni@bootlin.com, linux-arm-kernel@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, PKneuper@dspace.de, David Laight Subject: [PATCH net v2 4/6] net: stmmac: selftests: Capture all packets for vlan checks Date: Thu, 10 Sep 2026 17:14:01 +0200 Message-ID: <20260910151404.976753-5-maxime.chevallier@bootlin.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260910151404.976753-1-maxime.chevallier@bootlin.com> References: <20260910151404.976753-1-maxime.chevallier@bootlin.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Last-TLS-Session-Version: TLSv1.3 Content-Type: text/plain; charset="utf-8" While we use vlan_vid_add to trigger the tag filtering machinery in the driver, there's no netdev associated to the VLAN. This causes the skb to arrive with empty skb->vlan_tci fields, as the packet is marked OTHERHOST in __netif_receive_skb_core(), and we fail our validation. Let's use the proxy mechanism introduced for DSA, that registers a ETH_P_ALL packet handler that runs earlier, before the vlan netdev lookup, then filters for the correct ethertype before passing an skb clone to our validation function. Fixes: 091810dbded9 ("net: stmmac: Introduce selftests support") Signed-off-by: Maxime Chevallier Reviewed-by: Nicolai Buchwitz --- drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c b/drive= rs/net/ethernet/stmicro/stmmac/stmmac_selftests.c index f3a533bc6bb6..ec56ee0031ab 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c @@ -241,6 +241,7 @@ struct stmmac_test_priv { __be16 packet_type; int (*func)(struct sk_buff *skb, struct net_device *ndev, struct packet_type *pt, struct net_device *orig_ndev); + bool capture_all; int double_vlan; int vlan_id; int ok; @@ -343,7 +344,7 @@ static void stmmac_sft_add_pack(struct packet_type *pt) { struct stmmac_test_priv *tpriv =3D pt->af_packet_priv; =20 - if (netdev_uses_dsa(tpriv->pt.dev)) { + if (netdev_uses_dsa(tpriv->pt.dev) || tpriv->capture_all) { tpriv->packet_type =3D tpriv->pt.type; tpriv->func =3D tpriv->pt.func; =20 @@ -994,6 +995,7 @@ static int __stmmac_test_vlanfilt(struct stmmac_priv *p= riv) tpriv->pt.dev =3D priv->dev; tpriv->pt.af_packet_priv =3D tpriv; tpriv->packet =3D &attr; + tpriv->capture_all =3D true; =20 /* * As we use HASH filtering, false positives may appear. This is a @@ -1088,6 +1090,7 @@ static int __stmmac_test_dvlanfilt(struct stmmac_priv= *priv) tpriv->pt.dev =3D priv->dev; tpriv->pt.af_packet_priv =3D tpriv; tpriv->packet =3D &attr; + tpriv->capture_all =3D true; =20 /* * As we use HASH filtering, false positives may appear. This is a @@ -1366,6 +1369,7 @@ static int stmmac_test_vlanoff_common(struct stmmac_p= riv *priv, bool svlan) tpriv->pt.af_packet_priv =3D tpriv; tpriv->packet =3D &attr; tpriv->vlan_id =3D 0x123; + tpriv->capture_all =3D true; stmmac_sft_add_pack(&tpriv->pt); =20 ret =3D vlan_vid_add(priv->dev, htons(proto), tpriv->vlan_id); --=20 2.55.0 From nobody Fri Sep 25 16:02:16 2026 Received: from smtpout-03.galae.net (smtpout-03.galae.net [185.246.85.4]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6CF864AB1AC for ; Thu, 10 Sep 2026 15:14:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.85.4 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789053296; cv=none; b=BcRZNJqYtWXnwoPsQsgdCj1BATFBLDq5+pORuEzQrwd+H4Zbs3DHruzesukDmTcg0ONUbF3lgc0oztiC4/uVlRluGvBgylWE+P5Db83B85zIe+AH6+8FpFHUhGmTm1fwogvEgbDCtJkHnm7zWBvcLaSnnWDcn1wx1nVRMIlM91I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789053296; c=relaxed/simple; bh=A4kQD+23Mua2AjBLHg+zWBNeXtwnx2Ko/7k/sqasMfk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=adpUAluJ8zlh+RzeTJaMX6S8JUpmL70JLMAt86Ln88G5rLAny29H9/bDzg6UDyrt3LJYROKPenyvKoTcya3iUrMHeqh4B3s9NBYyWvzq8BwlkaE80JXHLX+4Cbwq/zYo3KGaNTax2is8aahZtMbpM7UNGNg12fgORssKmY6vMpg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=AZlAp3rW; arc=none smtp.client-ip=185.246.85.4 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="AZlAp3rW" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id ED35D4E40107; Thu, 10 Sep 2026 15:14:45 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id BEB805FA2F; Thu, 10 Sep 2026 15:14:45 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 4E29311C7A35F; Thu, 10 Sep 2026 17:14:41 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1789053284; h=from:subject:date:message-id:to:cc:mime-version: content-transfer-encoding:in-reply-to:references; bh=6h68E5chXjQxsCdAvZaW4D7GIP/l2Su79aiZxrUfj0g=; b=AZlAp3rWhVHW5N4oNIUir/C48BFFcLDeNw64yNgWdEWL4N4REL/Apjk2tWeNlLhvusrmK5 vBzBzEIfuLCcYzhaeLl5OkWAu25By+JKS+mbFiLeGwyeG8jMrDVNukarI5kmP7pW0AMSJH IWNgBJ1Dk66nlG24n5ohxdB+Ow276Xf/hWmRCzt1hVwJSAxbLiqieAyPRoboeFTy1z+f26 se4g3UOfTCA82KJdGe1aqQRSkP+BzO7dyeWeLzKCtYiyJhZPRIQYkNOd2QH+XaUUy3kUxO kJGMhY/asAZeC+Vcuk9wvznyzU4uIQrSqfee4yoBginPL0IrS3kGxnGRAnxe0g== From: Maxime Chevallier To: Andrew Lunn , davem@davemloft.net, Eric Dumazet , Jakub Kicinski , Paolo Abeni , Russell King , Heiner Kallweit , =?UTF-8?q?Alexis=20Lothor=C3=A9?= , Maxime Coquelin , Alexandre Torgue , Emil Renner Berthing , Minda Chen , Neil Armstrong , Kevin Hilman , Jerome Brunet , Martin Blumenstingl , Jan Petrous , Ovidiu Panait , Jose.Abreu@synopsys.com, Nicolai Buchwitz Cc: Maxime Chevallier , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, thomas.petazzoni@bootlin.com, linux-arm-kernel@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, PKneuper@dspace.de, David Laight Subject: [PATCH net v2 5/6] net: stmmac: size the RX buffers from the frame length, not the MTU Date: Thu, 10 Sep 2026 17:14:02 +0200 Message-ID: <20260910151404.976753-6-maxime.chevallier@bootlin.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260910151404.976753-1-maxime.chevallier@bootlin.com> References: <20260910151404.976753-1-maxime.chevallier@bootlin.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Last-TLS-Session-Version: TLSv1.3 Content-Type: text/plain; charset="utf-8" When picking the buffsize to use based on the MTU, we shouldn't check only the MTU value, but also : - ETH_HLEN for the L2 header, - up to 2 VLAN tags, - the FCS, - the NET_IP_ALIGN The default bufsize is 1536 bytes, which is enough to contain all the above so this hasn't surfaced before, but the addition of NET_IP_ALIGN to the start of buffer address tripped the Jumbo selftest, leading to this discovery. With that, we don't need the '>=3D' checks on the buffer len, we can use more consistent comparison operators in stmmac_set_bfsize. Fixes: 286a83721720 ("stmmac: add CHAINED descriptor mode support (V4)") Signed-off-by: Maxime Chevallier Reviewed-by: Nicolai Buchwitz --- .../net/ethernet/stmicro/stmmac/stmmac_main.c | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/ne= t/ethernet/stmicro/stmmac/stmmac_main.c index 5fe7e95fdd34..3664a298574a 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -1536,17 +1536,17 @@ static unsigned int stmmac_rx_offset(struct stmmac_= priv *priv) return NET_SKB_PAD + NET_IP_ALIGN; } =20 -static int stmmac_set_bfsize(int mtu) +static int stmmac_set_bfsize(int len) { int ret; =20 - if (mtu >=3D BUF_SIZE_8KiB) + if (len > BUF_SIZE_8KiB) ret =3D BUF_SIZE_16KiB; - else if (mtu >=3D BUF_SIZE_4KiB) + else if (len > BUF_SIZE_4KiB) ret =3D BUF_SIZE_8KiB; - else if (mtu >=3D BUF_SIZE_2KiB) + else if (len > BUF_SIZE_2KiB) ret =3D BUF_SIZE_4KiB; - else if (mtu > DEFAULT_BUFSIZE) + else if (len > DEFAULT_BUFSIZE) ret =3D BUF_SIZE_2KiB; else ret =3D DEFAULT_BUFSIZE; @@ -4063,7 +4063,7 @@ static struct stmmac_dma_conf * stmmac_setup_dma_desc(struct stmmac_priv *priv, unsigned int mtu) { struct stmmac_dma_conf *dma_conf; - int bfsize, ret; + int bfsize, len, ret; u8 chan; =20 dma_conf =3D kzalloc_obj(*dma_conf); @@ -4073,13 +4073,15 @@ stmmac_setup_dma_desc(struct stmmac_priv *priv, uns= igned int mtu) return ERR_PTR(-ENOMEM); } =20 - /* Returns 0 or BUF_SIZE_16KiB if mtu > 8KiB and dwmac4 or ring mode */ - bfsize =3D stmmac_set_16kib_bfsize(priv, mtu); + len =3D mtu + ETH_HLEN + 2 * VLAN_HLEN + ETH_FCS_LEN + NET_IP_ALIGN; + + /* Returns 0 or BUF_SIZE_16KiB if len > 8KiB and dwmac4 or ring mode */ + bfsize =3D stmmac_set_16kib_bfsize(priv, len); if (bfsize < 0) bfsize =3D 0; =20 if (bfsize < BUF_SIZE_16KiB) - bfsize =3D stmmac_set_bfsize(mtu); + bfsize =3D stmmac_set_bfsize(len); =20 dma_conf->dma_buf_sz =3D bfsize; /* Chose the tx/rx size from the already defined one in the --=20 2.55.0 From nobody Fri Sep 25 16:02:16 2026 Received: from smtpout-04.galae.net (smtpout-04.galae.net [185.171.202.116]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DAA7C4AC16D for ; Thu, 10 Sep 2026 15:14:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.171.202.116 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789053299; cv=none; b=GowbmmOmUe3pCBjAh2Rgr8WvmkcvkjtU63JzyBB92rFAi0FCREIj6Ao5oySIL2eKIBPV0Mjogpnr/uypS1DBdUMlDQymixV2434H2uqMPFIANkbVinrHUjgX4o14HjpdbH02aViN78vZ2cCor/1i9sgVBFnIc4q0Yuifby18Fec= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789053299; c=relaxed/simple; bh=0lVp4AjJ0cED1bbit+uYOsbChUQdrS+rWhX4sd/7pk4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=eTjJvQiSJxc1cqgbCjBErUBR7AT6o7sfkHBQLDKmMJ0s28exfP61NaKRoC73ZDPo5rVm2Y+iHa5VYuGY/cuNWsVrXpWh4JCISNL7QPo+3vc7ARSYU03EUkSCScSs7LtcfJe8WVHMancGYAfJDRExwiEqypuczFt+Otky4xZdq5s= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=Ejt7K3Of; arc=none smtp.client-ip=185.171.202.116 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="Ejt7K3Of" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-04.galae.net (Postfix) with ESMTPS id 51574C653E5; Thu, 10 Sep 2026 15:15:30 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id E9C425FA2F; Thu, 10 Sep 2026 15:14:48 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id AD77D11C7926E; Thu, 10 Sep 2026 17:14:44 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1789053287; h=from:subject:date:message-id:to:cc:mime-version: content-transfer-encoding:in-reply-to:references; bh=yAsi3cGu3TI2BDEMG0McW5k+U5cb9+s/V5vDEJqx/gQ=; b=Ejt7K3OfGInw+hfhX6r+/ekZZwYvgCR7ywEG9UdyAexrsSGT3SFgn0qpvOrlv1cpOE6Xx5 PXA9EOZCiVipYDw6OUmhBZSbf9KfuahmG0Qrw2I6ukfaZ4IEs/sI6rE8AM7/ddlQSoCx7b 1Bua3KlVnCTwNF/DzAJo0QMGUML4zaSkBtBhtu2Ww0FfYw98GLFGuMcgtsI0FC5GysxLTo Vq5q/oIrh4VR95gU+jgw7IGtUPLL5yaxJ7eCsBwhFl4EodqdT54NQ8zixsqmX6m2bq1XFC uJc/+vtjhgbjk2Y6QsqQUKZMP/qqJ/ciMiSlC91Q1L7XgKSpluH8yo64pmJtEQ== From: Maxime Chevallier To: Andrew Lunn , davem@davemloft.net, Eric Dumazet , Jakub Kicinski , Paolo Abeni , Russell King , Heiner Kallweit , =?UTF-8?q?Alexis=20Lothor=C3=A9?= , Maxime Coquelin , Alexandre Torgue , Emil Renner Berthing , Minda Chen , Neil Armstrong , Kevin Hilman , Jerome Brunet , Martin Blumenstingl , Jan Petrous , Ovidiu Panait , Jose.Abreu@synopsys.com, Nicolai Buchwitz Cc: Maxime Chevallier , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, thomas.petazzoni@bootlin.com, linux-arm-kernel@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, PKneuper@dspace.de, David Laight Subject: [PATCH net v2 6/6] net: stmmac: selftests: Account for alignment shift on dwmac1000 for Jumbo test Date: Thu, 10 Sep 2026 17:14:03 +0200 Message-ID: <20260910151404.976753-7-maxime.chevallier@bootlin.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260910151404.976753-1-maxime.chevallier@bootlin.com> References: <20260910151404.976753-1-maxime.chevallier@bootlin.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Last-TLS-Session-Version: TLSv1.3 Content-Type: text/plain; charset="utf-8" On dwmac1000, we currently only support single-descriptor frames. The Jumbo test started failing when NET_IP_ALIGN was added to align the IP header, as this tests tries to send the biggest possible frame. On dwmac1000 the DMA transfer is aligned on 4-bytes, so adding a 2-byte shift at the start-of-buffer address means it takes a whole extra 4-byte DMA burst to receive the Jumbo packet, causing it to spill over the next descriptor. This doesn't seem to happen on dwmac4 and xgmac that appear to correctly handle unaligned xfers (only tested on dwmac4) Let's account for that in the Jumbo test, reduce the size of our big packet by the align size. Fixes: 23680bf5f8c6 ("net: stmmac: restore NET_IP_ALIGN in the RX DMA offse= t") Signed-off-by: Maxime Chevallier Reviewed-by: Nicolai Buchwitz --- drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c b/drive= rs/net/ethernet/stmicro/stmmac/stmmac_selftests.c index ec56ee0031ab..fc8d69260f43 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c @@ -1776,6 +1776,9 @@ static int __stmmac_test_jumbo(struct stmmac_priv *pr= iv, u16 queue) struct stmmac_packet_attrs attr =3D { }; int size =3D priv->dma_conf.dma_buf_sz; =20 + if (!dwmac_is_xmac(priv->plat->core_type)) + size -=3D NET_IP_ALIGN; + attr.dst =3D priv->dev->dev_addr; attr.max_size =3D size - ETH_FCS_LEN; attr.queue_mapping =3D queue; --=20 2.55.0