From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-lj1-f172.google.com (mail-lj1-f172.google.com [209.85.208.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8D6EA14EC7B; Fri, 12 Apr 2024 18:04:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712945049; cv=none; b=bAZ6RL5CzdXsWMqPtcUZ5HJ264oZUILbZErqzxDXJDyDN4717iqq1vl6wesYOiXx0ILAU+kihmAgApLHQuENhzfGrk41KL0XTEoqvPnUwO4qCHBTzM7NkN4YyHd/FQhTRKonRJk0u/hsBGYt7xUezcXStVFXYZzepMAdRn0tob4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712945049; c=relaxed/simple; bh=H+DJg0zEQr8LzbY3dt0QnLd4raAs9+rzlHWu2fQFx4A=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=E+orR2rGAlCIInQt1ZzPBxZflACTA8HZgdA+6lCoDzqK6SsxS3FXgz5a4nJabV56ryz95PrBMdOzy1e8VgsOQDrgUqzAJo9+gUFMWuWpN3fnKUWJctLzkjT3IrXPKedW8gTjWbdeXKBexTkGBd38Yr04t4O5H2E5UvskGFA4RS4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=IK4itjKD; arc=none smtp.client-ip=209.85.208.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="IK4itjKD" Received: by mail-lj1-f172.google.com with SMTP id 38308e7fff4ca-2d476d7972aso14922441fa.1; 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=vger.kernel.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=IK4itjKDyGKDGdDefsEmsG54E1aTidUVatsPpYjGGUYupInKcYlxgqzG9Ug5v0tgTh Dgums5aHoarAgw1ZuQG7eTEOK2DwUS9LkSVULVWTaFjDNC9dCw0QDSil5ki/14OSNTox xu5uVYMMg0aKnCTz6Ffp/cMXMyt1NwnlomHia7322SIZ6u5p1XzyhMZVyPQvUrFAZWbu YpD4tq0U5rl71pPZPqYen6Ygwu28HmCXFJh7MQjwMR9N2/l3CAsPPKch7nMa+zSwzgEJ y0ol3HzUGZ1nXZbnrfo+9jiTJUFvX3pUZ7NVg9uKwzV+uyM74+WeRgmj1Z2fs472oHoe k8Fw== 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=Qo+iOi6SoFj93wONy1bTrnmkbuyVdaIVPw2/lmrtSgN8ZxdKTrPAE1M9VuK9fc3cKN 4hLxLkJEDNsehxCjUmCuij6sYAjHyV3PmsYv4lhF4X6oQ7CJQK1QB9DPbLyYZkrRgeEW Ip8V3Fz3cF40Z1z0mdtwN4r3wh4zWrPgZAY38JRC4h80QSr422EJM5bng6F+RAsbaicA jqGXGBvsdVzoWiN1oWUt6j5JtAmt9ZGlkqbe7i4zAtWkTGML3howGBdkEffmrE2ECVIy TieOHPm5Fq6nMrV2INQlVZw6dePnDPaJEgAZyxUPiUjSMjeTMOLxUoF+fA0pJNxj7AbD h6MA== X-Forwarded-Encrypted: i=1; AJvYcCU2btqtD9KoC3z5phsm3VaurqhMxNQGVu5SBa3Z9rmrrnazF9+pmN8ivh5p0UBgGiq4sNPG8qLWuiHNDr0UUVe09Y+m/8VbW7S+m2gRNGbNl4VROL50vgjdOaegRLHH69nIDlTQ X-Gm-Message-State: AOJu0YyHbAyRtQDPjfmy7EUip/wZ194xVzQsKQgy/r3VYmFmkhuxouy7 kj66dsAB2hy6gs/gEuUzmsqZJsDZPjq0JZQzHjXd0qofzl98X2K2 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> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 --- 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)) -- 2.43.0 From mboxrd@z Thu Jan 1 00:00:00 1970 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 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 --- 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)) -- 2.43.0 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel