lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230313224237.28757-10-Sergey.Semin@baikalelectronics.ru>
Date:   Tue, 14 Mar 2023 01:42:33 +0300
From:   Serge Semin <Sergey.Semin@...kalelectronics.ru>
To:     Giuseppe Cavallaro <peppe.cavallaro@...com>,
        Alexandre Torgue <alexandre.torgue@...s.st.com>,
        Jose Abreu <joabreu@...opsys.com>,
        "David S. Miller" <davem@...emloft.net>,
        Eric Dumazet <edumazet@...gle.com>,
        Jakub Kicinski <kuba@...nel.org>,
        Paolo Abeni <pabeni@...hat.com>,
        Maxime Coquelin <mcoquelin.stm32@...il.com>,
        Russell King <linux@...linux.org.uk>,
        Andrew Lunn <andrew@...n.ch>,
        Heiner Kallweit <hkallweit1@...il.com>
CC:     Serge Semin <Sergey.Semin@...kalelectronics.ru>,
        Serge Semin <fancer.lancer@...il.com>,
        Alexey Malahov <Alexey.Malahov@...kalelectronics.ru>,
        Pavel Parkhomenko <Pavel.Parkhomenko@...kalelectronics.ru>,
        Christian Marangi <ansuelsmth@...il.com>,
        Biao Huang <biao.huang@...iatek.com>,
        Yang Yingliang <yangyingliang@...wei.com>,
        <netdev@...r.kernel.org>,
        <linux-stm32@...md-mailman.stormreply.com>,
        <linux-arm-kernel@...ts.infradead.org>,
        <linux-kernel@...r.kernel.org>,
        Jose Abreu <Jose.Abreu@...opsys.com>
Subject: [PATCH net 09/13] net: stmmac: Remove default maxmtu DT-platform setting

Initializing maxmtu platform parameter in the stmmac_probe_config_dt()
method by default makes being pointless the DW MAC-specific maximum MTU
selection algorithm implemented in the stmmac_dvr_probe() method. At least
for xGMAC we'll always have a frame MTU limited with 9000 while it
supports units up to 16KB. Let's remove the default initialization of
the maxmtu platform setting then. We don't replace it with setting the
maxmtu with some greater value because a default maximum MTU is
calculated later in the stmmac_dvr_probe() anyway. That would have been a
pointless limitation too. Instead from now the main STMMAC driver code
will consider the out of bounds maxmtu value as invalid and will silently
replace it with a maximum MTU value specific to the corresponding DW MAC.

Note this alteration will only affect the xGMAC IP-cores due to the way
the MTU autodetecion algorithm is implemented. So from now the driver will
permit DW xGMACs to handle frames up to 16KB length (XGMAC_JUMBO_LEN). As
before DW GMAC IP-cores of v4.0 and higher and IP-cores with enhanced
descriptor support will be able to work with frames up to 8KB (JUMBO_LEN).
The rest of the NICs will support frames of SKB_MAX_HEAD(NET_SKB_PAD +
NET_IP_ALIGN) size.

Fixes: 7d9e6c5afab6 ("net: stmmac: Integrate XGMAC into main driver flow")
Signed-off-by: Serge Semin <Sergey.Semin@...kalelectronics.ru>
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c     | 4 ----
 drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c | 5 -----
 2 files changed, 9 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 32aa7953d296..e5cb4edc4e23 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -7252,10 +7252,6 @@ int stmmac_dvr_probe(struct device *device,
 	if ((priv->plat->maxmtu < ndev->max_mtu) &&
 	    (priv->plat->maxmtu >= ndev->min_mtu))
 		ndev->max_mtu = priv->plat->maxmtu;
-	else if (priv->plat->maxmtu < ndev->min_mtu)
-		dev_warn(priv->device,
-			 "%s: warning: maxmtu having invalid value (%d)\n",
-			 __func__, priv->plat->maxmtu);
 
 	if (flow_ctrl)
 		priv->flow_ctrl = FLOW_AUTO;	/* RX/TX pause on */
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
index 067a40fe0a23..857411105a0a 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
@@ -468,11 +468,6 @@ stmmac_probe_config_dt(struct platform_device *pdev, u8 *mac)
 	plat->en_tx_lpi_clockgating =
 		of_property_read_bool(np, "snps,en-tx-lpi-clockgating");
 
-	/* Set the maxmtu to a default of JUMBO_LEN in case the
-	 * parameter is not present in the device tree.
-	 */
-	plat->maxmtu = JUMBO_LEN;
-
 	/* Set default value for multicast hash bins */
 	plat->multicast_filter_bins = HASH_TABLE_SIZE;
 
-- 
2.39.2


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ