Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp61932pxb; Tue, 12 Jan 2021 20:09:44 -0800 (PST) X-Google-Smtp-Source: ABdhPJze+OXG3/Ibwkd3rwVxdp6s4K/X5pKGiS6pODOCabteTfJcj1UlQeZfUVtjS8KaAXUFuV8m X-Received: by 2002:a17:906:3ac3:: with SMTP id z3mr133170ejd.449.1610510984760; Tue, 12 Jan 2021 20:09:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610510984; cv=none; d=google.com; s=arc-20160816; b=AWzv/K06S1DW74Hvs1fEJLhMH2COGBp1hJE8QHDFh+et5sIxMY5K7FzR95aRx5r3Mi 2QbqppR0JuGYDnbMs2+mdX/7keu7qTSFYIBe+U+FmIJ6Lp1hW+UWjtEdKA7jky5wDDb9 rfax//Lc1GITheaFhAjctuO3LrwJbsdQST/6NrIudnjRRPC8R/O2FEOOyYDC5721ooyG DlUiP/o492Hn2crmI5YSD91TJRSFbGTtBLCLTNDu1sZK/3f55nKuFEmAc1nS9l6nIHrO P2zypoM7mps2bNIVCh/opkBk4mAUa/ABSqcVbkbsh8MSNwHT1he0J2UOrHq5QF8kHcWI FaMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=Ew6KEH0yZn0b8d4sxb6WpPEx57JZjeh5C4JXNj7qjHk=; b=BKDhcYCN4Hu6qBawrvraWa8Wwd9m15mMP4D7YyIY6vfkeOlTzqhiLQ8Ew4BrWFkCcr UmcZsIDUrT8YFMbe/th/OQ56w790BLK5fTbVPR9842+jizlM5n4I1X3HqedlikJC2MYf huCBVKgD8bd2BwOQqGJ7keRniz9j26g67tYr+uR3THmOskKpFAKkHALcVWEWPFMJpQeC yIp+jCGMGlQzZ2L05caIhYLx5l7osRo8EugPSFveOVEb0sERzBcY6nULdaitdOU+aWmU 9x/GHPvwXGg9WqCKT5iZzvqIbB/jbdK2kERHGooWvyUolBYfbPyM7uUPKls71vCwmw+M 2Fbg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id jg3si328538ejc.744.2021.01.12.20.09.19; Tue, 12 Jan 2021 20:09:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725794AbhAMDuT (ORCPT + 99 others); Tue, 12 Jan 2021 22:50:19 -0500 Received: from lucky1.263xmail.com ([211.157.147.133]:53370 "EHLO lucky1.263xmail.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725536AbhAMDuT (ORCPT ); Tue, 12 Jan 2021 22:50:19 -0500 X-Greylist: delayed 382 seconds by postgrey-1.27 at vger.kernel.org; Tue, 12 Jan 2021 22:50:17 EST Received: from localhost (unknown [192.168.167.235]) by lucky1.263xmail.com (Postfix) with ESMTP id 8915FCA88D; Wed, 13 Jan 2021 11:41:36 +0800 (CST) X-MAIL-GRAY: 0 X-MAIL-DELIVERY: 1 X-ADDR-CHECKED4: 1 X-ANTISPAM-LEVEL: 2 X-ABS-CHECKED: 0 Received: from thinkpad-p51.mshome.net (unknown [58.22.7.114]) by smtp.263.net (postfix) whith ESMTP id P25768T139698924463872S1610509294957598_; Wed, 13 Jan 2021 11:41:36 +0800 (CST) X-IP-DOMAINF: 1 X-UNIQUE-TAG: <5523297ee3983dc260e5c9721f8e3364> X-RL-SENDER: david.wu@rock-chips.com X-SENDER: wdc@rock-chips.com X-LOGIN-NAME: david.wu@rock-chips.com X-FST-TO: netdev@vger.kernel.org X-SENDER-IP: 58.22.7.114 X-ATTACHMENT-NUM: 0 X-System-Flag: 0 From: David Wu To: netdev@vger.kernel.org Cc: davem@davemloft.net, kuba@kernel.org, joabreu@synopsys.com, alexandre.torgue@st.com, peppe.cavallaro@st.com, linux-kernel@vger.kernel.org, David Wu Subject: [PATCH] net: stmmac: Fixed mtu channged by cache aligned Date: Wed, 13 Jan 2021 11:41:09 +0800 Message-Id: <20210113034109.27865-1-david.wu@rock-chips.com> X-Mailer: git-send-email 2.19.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Since the original mtu is not used when the mtu is updated, the mtu is aligned with cache, this will get an incorrect. For example, if you want to configure the mtu to be 1500, but mtu 1536 is configured in fact. Fixed: eaf4fac478077 ("net: stmmac: Do not accept invalid MTU values") Signed-off-by: David Wu --- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 5b1c12ff98c0..e8640123db76 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -4025,7 +4025,7 @@ static void stmmac_set_rx_mode(struct net_device *dev) static int stmmac_change_mtu(struct net_device *dev, int new_mtu) { struct stmmac_priv *priv = netdev_priv(dev); - int txfifosz = priv->plat->tx_fifo_size; + int txfifosz = priv->plat->tx_fifo_size, mtu = new_mtu; if (txfifosz == 0) txfifosz = priv->dma_cap.tx_fifo_size; @@ -4043,7 +4043,7 @@ static int stmmac_change_mtu(struct net_device *dev, int new_mtu) if ((txfifosz < new_mtu) || (new_mtu > BUF_SIZE_16KiB)) return -EINVAL; - dev->mtu = new_mtu; + dev->mtu = mtu; netdev_update_features(dev); -- 2.19.1