Received: by 2002:ab2:69cc:0:b0:1f4:be93:e15a with SMTP id n12csp83596lqp; Fri, 12 Apr 2024 11:04:51 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWMHJ4qUkBI6C0oasGAeV1QvhfUn4/cTal7fMYeIzqTwMx7BvWblT57IfZ6jjJVTlXnLfrsETXliJ0lLpXkskGk8aqjysF1j201wdi0wg== X-Google-Smtp-Source: AGHT+IGfb078pNFBXHYpKf/wpbSU3jD34e/WSWc0UyGsM00xOMhsKgOdbDbuYOt4dH2+sfl/XP4s X-Received: by 2002:a05:6214:558e:b0:69b:54f0:5bf4 with SMTP id mi14-20020a056214558e00b0069b54f05bf4mr991945qvb.27.1712945090728; Fri, 12 Apr 2024 11:04:50 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712945090; cv=pass; d=google.com; s=arc-20160816; b=SUWivV/Z8dPRKNdTgmhYxFtBmCgZR8B3SwWC+spgTatGUH2kPliI/uwUE7GEr0PxsJ tFHT8b6q3EpQdQFXAXmF5/cGZqAgpZePaxBZkonM4P8CIYkV8eF2qaQtkGWqq2pHJmtp 46gHk4tyfjqH6aBVZFin5AUCVgIOz7bMcCjLk6NLBXchmbi3vjPgfekRC5f1uznvLw33 t6vVy0PXq1nQ4uKoJqmy9vQ1QSE+efrITzgswu9BiLCgkqjhrfjcOCMnruOJnJNb86/G VhSGh84k9FDNPaJl4YLHMKRJ5pySvd3KnFqUEgTub5nlwC7BBIo/cA1keafmOLNluLdL h1JQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=cN13xKrisJWzHEEUXlM2Kj3W0urUTpSnKk1qxa6jOEk=; fh=uOKI2PxIRuvvVadq4CjmOwVR45KNJA/NOy6ml9mjLio=; b=GXTk+aEGg+zqMQ+2ckhfe4LvJn/HbbJhEGKku3PAqU5X/zS3FHkZWStl82MT/BSNzT cYnBqafNi3eGsUPJcYl3PHT+5V4JNngSfLQpkIVIkF7FX1MibuxVEbPpvVf5BwXIbZa2 C4sgRfWanU/Mnp/c46752ptPDLjQ6cxoelhl5ACATBV4Fnusa7tqBRu5+r5ijYMylc56 YVvAOLB9ll9fasYk7gcTQ4pOtPX5idNktBQtheMo5wTV+ulbB76qZnyzChgl3Y1AxWTL 5QXGzoSYy2b44+I+DIwiYUCSH0Q7JAndojEoSOJsUNI/1gZXL74d0url0JANADcX085H YpwQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=IK4itjKD; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-143168-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-143168-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id ne19-20020a056214425300b006993198f68asi4150414qvb.325.2024.04.12.11.04.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Apr 2024 11:04:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-143168-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=IK4itjKD; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-143168-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-143168-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 565171C21C99 for ; Fri, 12 Apr 2024 18:04:50 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F109114F13F; Fri, 12 Apr 2024 18:04:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="IK4itjKD" 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 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-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