From patchwork Fri Apr 12 18:03:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Serge Semin X-Patchwork-Id: 13628226 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B3A6AC04FF8 for ; Fri, 12 Apr 2024 18:04:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=pWeaSdO1Zs2aDRcYEdS6IfaGonM67afWQCva0P65qOk=; b=n0SU7nE9tQs7Fb KqIdH1orq7FTTKZIxoVK0seiyJt6lmnLtI4YWB2B19ZiZm+GuF7PqCmkgWVrYxkZd4L0cj1gm0DhF kc+Y1dLYkqXraEf9sYNFFewsbJjLuiFyLz71lQAUVtJDyx5YCzCtBEXB24ABAGBqdRnPAF1J8Pqx1 dKXoX34r3zVtReVXS24DWIjR570eJ329XJFwNrt/MUBMiy/Bn/zFM24tiTawX7dZzUzq/+JAf+ks2 NXMDFkb67S1FcVJvVU5egSt66ohzIFO0mmzW9FaIKWLZYFfS6dxeWJwd7iwCb8qTtYlx9O0AI9E+8 IsQ/ouENCJeISn7ImtnA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rvLGH-00000000mD3-0YEj; Fri, 12 Apr 2024 18:04:29 +0000 Received: from mail-lj1-x233.google.com ([2a00:1450:4864:20::233]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rvLFw-00000000m38-3fq3 for linux-arm-kernel@lists.infradead.org; Fri, 12 Apr 2024 18:04:10 +0000 Received: by mail-lj1-x233.google.com with SMTP id 38308e7fff4ca-2d87660d5c9so11416671fa.2 for ; Fri, 12 Apr 2024 11:04:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712945046; x=1713549846; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=cN13xKrisJWzHEEUXlM2Kj3W0urUTpSnKk1qxa6jOEk=; b=AAv/xmX8XivJwoNOv63dZim54urx8OJClJ1FPSPb41V8IsBqJdsWk0Sc8oSt5TVbRv VofZZHhqsz7WfhVzm9VPFvNnJ8z9EQiyS1NLuzysfT01ug4E5KPKQ4HUeQdcPS9gKmDp /oKk669UJbUm3T9lWxB7TT3FEjjbi8k1nt/CbP9CcnkY5IBgUm6G/FVXGHChKm8okx/j dHT0o9bRsl1LGHFTF/OhQdz8uYpgVb0lnXYnUyhoUokiHAsP9EPAI2j5clM/RwOfJ0RQ hBBpg+VbzRYj1inXqVAUkJzKzom2Cg89pH2SxcHswP4y5S5s4I+AGZM9wmZhWKz6d5ME s2PA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712945046; x=1713549846; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=cN13xKrisJWzHEEUXlM2Kj3W0urUTpSnKk1qxa6jOEk=; b=bp9JRmBQ4MkAcZyElJ6yLVbw1wrhgnXyoy7Fxf3URv28lvFZptJvZFZNhCb19TnYRJ 315sLwLXWDgRtPJActyhiFsbOYolm3TQouIIKMfwdZy8sC68qNUmNpnVCxgKEQL3kd3i /jJes9liTTySZC7NIMR8LcksrJpa2soq4pCJyQ4dTCkl3HdgQajyjjZXS+172hslkfXP SRAnNWX2SHt0PYrzEyW7bZESIlKSsd+84S3sk3jY9BF49Tq2H5Yk6ji7DC0WTNt1+19A gjKJhCKtRJ6u9/dVX45QeqZwIwosw4U+PSIDXivNDW/pOITFb9edES2HB56SFFiI7ude Mr+Q== X-Forwarded-Encrypted: i=1; AJvYcCUDGzvH4fo+lsvE7GtybG+dcveT0h63551Wqz2iZiWpgukShVGWyEmab+Lpb2pIFlq3H70P0owPx01bPOqru6P1wYQIoE0NPDl5zwdYQz2US3kLjzk= X-Gm-Message-State: AOJu0Yz1CTqdKKs4XMA03sGpr74dJXqaciI3V4jUcxWd36UwldIlqSVc 2mW9Ik+IG7QPwcYhBJucTk+grfX6ZEP37pMkC7C4jB9el8D2tSTg X-Google-Smtp-Source: AGHT+IEOHDnXn4A0X8osVWAoYeNfoKuOFh0OduIqkCo7A2A3nIvR3DQ2+Flg9QxnlP2QZA+Omg958Q== X-Received: by 2002:a05:651c:b0b:b0:2d8:3e07:5651 with SMTP id b11-20020a05651c0b0b00b002d83e075651mr3195379ljr.34.1712945045603; Fri, 12 Apr 2024 11:04:05 -0700 (PDT) Received: from localhost ([95.79.241.172]) by smtp.gmail.com with ESMTPSA id f28-20020a05651c02dc00b002d2dfe8a36csm560225ljo.96.2024.04.12.11.04.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Apr 2024 11:04:05 -0700 (PDT) From: Serge Semin To: Alexandre Torgue , Jose Abreu , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Russell King , Yanteng Si , Maxime Coquelin , Michael Sit Wei Hong , "Gan, Yi Fang" Cc: Serge Semin , Simon Horman , Huacai Chen , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [PATCH net 2/4] net: stmmac: Fix max-speed being ignored on queue re-init Date: Fri, 12 Apr 2024 21:03:15 +0300 Message-ID: <20240412180340.7965-3-fancer.lancer@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240412180340.7965-1-fancer.lancer@gmail.com> References: <20240412180340.7965-1-fancer.lancer@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240412_110409_077993_6337D64A X-CRM114-Status: GOOD ( 13.52 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org It's possible to have the maximum link speed being artificially limited on the platform-specific basis. It's done either by setting up the plat_stmmacenet_data::max_speed field or by specifying the "max-speed" DT-property. In such cases it's required that any specific MAC-capabilities re-initializations would take the limit into account. In particular the link speed capabilities may change during the number of active Tx/Rx queues re-initialization. But the currently implemented procedure doesn't take the speed limit into account. Fix that by calling phylink_limit_mac_speed() in the stmmac_reinit_queues() method if the speed limitation was required in the same way as it's done in the stmmac_phy_setup() function. Fixes: 95201f36f395 ("net: stmmac: update MAC capabilities when tx queues are updated") Signed-off-by: Serge Semin Reviewed-by: Romain Gantois --- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index dd58c21b53ee..b8a1f02398ee 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -7328,6 +7328,7 @@ int stmmac_reinit_queues(struct net_device *dev, u32 rx_cnt, u32 tx_cnt) { struct stmmac_priv *priv = netdev_priv(dev); int ret = 0, i; + int max_speed; if (netif_running(dev)) stmmac_release(dev); @@ -7343,6 +7344,10 @@ int stmmac_reinit_queues(struct net_device *dev, u32 rx_cnt, u32 tx_cnt) stmmac_mac_phylink_get_caps(priv); + max_speed = priv->plat->max_speed; + if (max_speed) + phylink_limit_mac_speed(&priv->phylink_config, max_speed); + stmmac_napi_add(dev); if (netif_running(dev))