From patchwork Wed Apr 17 14:00:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Serge Semin X-Patchwork-Id: 13633421 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 A9092C001CC for ; Wed, 17 Apr 2024 14:00:49 +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=2rLk09OtvELpkN39cOkYIfxa6/JCiGChDK7WwGrrniw=; b=iaODywhJ/z9/9l I5kXm+rHyW/tL3WAQR4vMkLCxpEveLUSVZWE9gvF6+BVrudwT2yer3+pzcNsBKuPiAf619CTko9r7 ttUCqwf9dTc+cy/a0uIOQ4MZmwerU84I8qwHw09abQKlWMEWBie3+5bsJCYtiqebxUprcg8x3kWBu gTSJ1l6na7UrOBSwD7XIg+/9060qxrsUuCmcfo0Hdq0Axk2tYXBR2uy40edonIq5cWVym5We/AgEm XYkQRlJ3BpZ77F+wGd3+YB7DB9Zi6jcDFhUDTJ/Y/BtZQ57kJuExSBjtNXU8fBwHgxKqsVFkvKcq6 yjT9THAuga148PEvgLqw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rx5pu-0000000GG4E-0CwN; Wed, 17 Apr 2024 14:00:30 +0000 Received: from mail-lj1-x22a.google.com ([2a00:1450:4864:20::22a]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rx5pm-0000000GFzp-3U0J for linux-arm-kernel@lists.infradead.org; Wed, 17 Apr 2024 14:00:28 +0000 Received: by mail-lj1-x22a.google.com with SMTP id 38308e7fff4ca-2da63269e75so42466511fa.1 for ; Wed, 17 Apr 2024 07:00:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1713362417; x=1713967217; 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=wCuHkgJvG5roUfAj93LLXibybGnOYsen6TK2djTp+uM=; b=Cpdfs+NwtzVOQ2O4eXEBm/BlG6mhTop0hNrKDDZlbk+SrhVORQE27RDAvnIVF6D9XZ uQid6f/TI2pOPkYuQsT3izww/9syF4Cwsk29asbTB5zuiTmSAKl27hYZe15hLYbFqxzA Bm5QeNcNZoTPSbXpnozMe+hJ24CbTEpGIriobaXeJ0RodbNNzcNNwbdgUQKa9UjQSlzf Kko9+1Ca9T7/hwRLo6a5YgPO6n7OlfoE1/nLGQo6KYVawcJWqJO2WKrEQiDyokegvqEl 24Ow4TG+7BbL139XoQk4OU1x51y0zw3RI+qMLXwR67X9YWciX6u5sCT255cGO+skw/v8 UE6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713362417; x=1713967217; 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=wCuHkgJvG5roUfAj93LLXibybGnOYsen6TK2djTp+uM=; b=OUxSe097S509yzG2UIoZJUN/5hL8JeCRp8kx4F5IkdCrEhv+hq0V4nFw9GR/HanUvp cVXRrhvCrzXWXE0tXBt6zf89jsamBx2q+I8v8oyosisfyfn6iCc2YqYIbEnW8eVdSqaG eNg8Tj/2vRqkGFGWwVqZ3Q8lNclYOrG/zYpnoDD5CrIhlE2py1yvuxC8pPhIN8I0Y23P DU+4DhgyXTKr0wB5kZRiAMD0iwPNsmYPi7Ie7z2kqaAlB7N5FK0qLTqPXKvv5oX/1Ugu O1sEtm18vB9zb1Lz7/YGjkEtbv20OobUD2QOXPRxEka5jg2JRJCQ7+KQIQ0/biDvaiLL m7mw== X-Forwarded-Encrypted: i=1; AJvYcCW7Wju++zQfbbrcrPMqxnfuWeklcaFxzuzk00chONR5N9+UfcWdRtHci/g53ScTH0embEZaQOogiYyylR3nRpPBYoIgGZF1fQ6rt2rFv25tk9l43Qk= X-Gm-Message-State: AOJu0Yz6S1WqWJuf31jHbilOvRctrzcVWKSGzFQBSXeJ/vuXwZUSOUMq vI8hsc3hc+N42Dv51vAFpvxk0WfJxMvUs5SgOykTvHBH7sAHsQuC X-Google-Smtp-Source: AGHT+IHZISTn2b4MdatLv09pVqgN8Rj/zh3VicITjG9ZAtAiCv8/i6AUH8xtyM+z/+qSzfgj1akGPQ== X-Received: by 2002:a05:6512:1150:b0:516:ced5:3afa with SMTP id m16-20020a056512115000b00516ced53afamr14396995lfg.5.1713362417376; Wed, 17 Apr 2024 07:00:17 -0700 (PDT) Received: from localhost ([94.125.187.42]) by smtp.gmail.com with ESMTPSA id g11-20020a0565123b8b00b00518f53da2dfsm890439lfv.291.2024.04.17.07.00.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Apr 2024 07:00:17 -0700 (PDT) From: Serge Semin To: Alexandre Torgue , Jose Abreu , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Russell King , Yanteng Si , Romain Gantois , Maxime Coquelin 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-next v2 1/2] net: stmmac: Rename phylink_get_caps() callback to update_caps() Date: Wed, 17 Apr 2024 17:00:07 +0300 Message-ID: <20240417140013.12575-2-fancer.lancer@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240417140013.12575-1-fancer.lancer@gmail.com> References: <20240417140013.12575-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-20240417_070022_926608_D707F78E X-CRM114-Status: GOOD ( 17.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 Since recent commits the stmmac_ops::phylink_get_caps() callback has no longer been responsible for the phylink MAC capabilities getting, but merely updates the MAC capabilities in the mac_device_info::link::caps field. Rename the callback to comply with the what the method does now. Signed-off-by: Serge Semin Reviewed-by: Romain Gantois --- Link: https://lore.kernel.org/netdev/20240412180340.7965-5-fancer.lancer@gmail.com/ Changelog v2: - This is a new patch created based on the discussion around patch #4 in the series above. --- drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c | 8 ++++---- drivers/net/ethernet/stmicro/stmmac/hwif.h | 8 ++++---- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 6 +++--- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c b/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c index a38226d7cc6a..b25774d69195 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c @@ -68,7 +68,7 @@ static void dwmac4_core_init(struct mac_device_info *hw, init_waitqueue_head(&priv->tstamp_busy_wait); } -static void dwmac4_phylink_get_caps(struct stmmac_priv *priv) +static void dwmac4_update_caps(struct stmmac_priv *priv) { if (priv->plat->tx_queues_to_use > 1) priv->hw->link.caps &= ~(MAC_10HD | MAC_100HD | MAC_1000HD); @@ -1190,7 +1190,7 @@ static void dwmac4_set_hw_vlan_mode(struct mac_device_info *hw) const struct stmmac_ops dwmac4_ops = { .core_init = dwmac4_core_init, - .phylink_get_caps = dwmac4_phylink_get_caps, + .update_caps = dwmac4_update_caps, .set_mac = stmmac_set_mac, .rx_ipc = dwmac4_rx_ipc_enable, .rx_queue_enable = dwmac4_rx_queue_enable, @@ -1235,7 +1235,7 @@ const struct stmmac_ops dwmac4_ops = { const struct stmmac_ops dwmac410_ops = { .core_init = dwmac4_core_init, - .phylink_get_caps = dwmac4_phylink_get_caps, + .update_caps = dwmac4_update_caps, .set_mac = stmmac_dwmac4_set_mac, .rx_ipc = dwmac4_rx_ipc_enable, .rx_queue_enable = dwmac4_rx_queue_enable, @@ -1284,7 +1284,7 @@ const struct stmmac_ops dwmac410_ops = { const struct stmmac_ops dwmac510_ops = { .core_init = dwmac4_core_init, - .phylink_get_caps = dwmac4_phylink_get_caps, + .update_caps = dwmac4_update_caps, .set_mac = stmmac_dwmac4_set_mac, .rx_ipc = dwmac4_rx_ipc_enable, .rx_queue_enable = dwmac4_rx_queue_enable, diff --git a/drivers/net/ethernet/stmicro/stmmac/hwif.h b/drivers/net/ethernet/stmicro/stmmac/hwif.h index 7be04b54738b..90384db228b5 100644 --- a/drivers/net/ethernet/stmicro/stmmac/hwif.h +++ b/drivers/net/ethernet/stmicro/stmmac/hwif.h @@ -308,8 +308,8 @@ struct stmmac_est; struct stmmac_ops { /* MAC core initialization */ void (*core_init)(struct mac_device_info *hw, struct net_device *dev); - /* Get phylink capabilities */ - void (*phylink_get_caps)(struct stmmac_priv *priv); + /* Update MAC capabilities */ + void (*update_caps)(struct stmmac_priv *priv); /* Enable the MAC RX/TX */ void (*set_mac)(void __iomem *ioaddr, bool enable); /* Enable and verify that the IPC module is supported */ @@ -430,8 +430,8 @@ struct stmmac_ops { #define stmmac_core_init(__priv, __args...) \ stmmac_do_void_callback(__priv, mac, core_init, __args) -#define stmmac_mac_phylink_get_caps(__priv) \ - stmmac_do_void_callback(__priv, mac, phylink_get_caps, __priv) +#define stmmac_mac_update_caps(__priv) \ + stmmac_do_void_callback(__priv, mac, update_caps, __priv) #define stmmac_mac_set(__priv, __args...) \ stmmac_do_void_callback(__priv, mac, set_mac, __args) #define stmmac_rx_ipc(__priv, __args...) \ diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 7c6fb14b5555..b810f6b69bf5 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -1225,8 +1225,8 @@ static int stmmac_phy_setup(struct stmmac_priv *priv) xpcs_get_interfaces(priv->hw->xpcs, priv->phylink_config.supported_interfaces); - /* Get the MAC specific capabilities */ - stmmac_mac_phylink_get_caps(priv); + /* Refresh the MAC-specific capabilities */ + stmmac_mac_update_caps(priv); priv->phylink_config.mac_capabilities = priv->hw->link.caps; @@ -7341,7 +7341,7 @@ int stmmac_reinit_queues(struct net_device *dev, u32 rx_cnt, u32 tx_cnt) priv->rss.table[i] = ethtool_rxfh_indir_default(i, rx_cnt); - stmmac_mac_phylink_get_caps(priv); + stmmac_mac_update_caps(priv); priv->phylink_config.mac_capabilities = priv->hw->link.caps; From patchwork Wed Apr 17 14:00:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Serge Semin X-Patchwork-Id: 13633422 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 B5741C4345F for ; Wed, 17 Apr 2024 14:01:00 +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=7lgNJsWbk7pRookaSFUsQk+GNfyUQ0w9oJcq1WxTJIM=; b=Jt1Udn/FABqUyg C5B16FBhtnii8KUDpoWwy0gnAlBXgd73/J2ZQWOq20H2P9qcAYr5Ml7AxFDV7iK5PUweqSZuDTrMj bey8sG5eujCKhnSwb8GY9ZTVS2TSWKpMEEAmImVbwO8H3jl3KJkz8b0RSLdIyCq5rcrRnu93hz9Ho Gm1f1kem45cOa6Gv1hWnenNwZsQGtHogIMG5YfI+5cw9ilmFPhk8uzodGwExLmuuct362aH/FUlfO p04p4zPMxSR3nPiTl9NIwabDIht8JfVG6rCqJp+qvY9q8Mw+fylo5PUjNiH1md60IGIVVMzPlOguE h+uVTpniDNWVFoG/m7pg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rx5q5-0000000GG90-3Xfx; Wed, 17 Apr 2024 14:00:41 +0000 Received: from mail-lf1-x131.google.com ([2a00:1450:4864:20::131]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rx5pm-0000000GG0T-3TC5 for linux-arm-kernel@lists.infradead.org; Wed, 17 Apr 2024 14:00:30 +0000 Received: by mail-lf1-x131.google.com with SMTP id 2adb3069b0e04-518c9ff3e29so4321899e87.0 for ; Wed, 17 Apr 2024 07:00:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1713362419; x=1713967219; 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=8KnMWOMZl4OlIeWKfyhTeTgh6nDBj0ThrZdjCpvV0rs=; b=lz9pQweU0U1ovW04JRAfgJ8q0687fq66x82uoqum5bp9zwU47ChiUdtXoqcocJdQTG 8rIE2aXFh/ENyhtelcQzuAj/jo58y/yEEuinCNiKfnkmUZ1Rj56TXJk6/rLLIB8fOoqv RnFUek764aQP7dphYU4EzTuqZlimlms54dgGp7KGpij6ZkkxQ0zdHp8fbOmieu5wIKZs Vuc4c5z9lqMPfcnGC+hlCK6NXljQ3j08zaanvYfNwKO7AiKJiDZ0OooJ4J4Zj1+wacgQ UYzPDADO3j7FZ5SnaZYQwygNwNUnG1J16jLO6PfQWyWHx6W67sFuaZDuwAFAkVLvMHga vHpw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713362419; x=1713967219; 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=8KnMWOMZl4OlIeWKfyhTeTgh6nDBj0ThrZdjCpvV0rs=; b=Em+dOkpatI9uydwczmh2HsbWv8+TLouU9GH8QL1qtlq9j7vuAuHI+DFm1bxS29ZbF+ a6A//j6b6+4Lb/35SyXSf6utsi7Rd8qilE/uUHlDDJsD4cyFd4HlxC3mr0TkjoXJZcvb Ojfv3Z+CQtu7n8xOW7MFdmBxaJKAFf4R/8vOJ6EzjAgdGwAX/9iveKF+IWUFkd0tXWxC 36kTK9aoH7Ce8HkBGAK4KW5opT2pOID0E8h9jO6MCct8kxtBspbQiuo5bwODZv6DOKhD ojIjWYmzkBSKQXfALChP9JJo925nMX3fn5FoC1E9aA+zzgZbSJ1SHw+I3WziIuX7eO1b XWUg== X-Forwarded-Encrypted: i=1; AJvYcCVhzw1C2+4MDcpxPzx7UEW8nzRiT6epknvRydpiNikYRh+tkuTzqpBTV/H9UJQecFNqCwj2j+wRtrFdjCnNEqnFWil/Fd6Sywh/iJt13BF0l/LW9nM= X-Gm-Message-State: AOJu0YwVMCmfkLELJYCPtCM2sfKt5C3/K7ZX61K2eL7euYyauHn62bkh UPkNEE5JYQBiQfjQBHcOj8Lm6THunouDlpY3hBSqHKNPGrWRMLKI X-Google-Smtp-Source: AGHT+IEFwpS1qE+a87B7Ubcokq+jSyQu+NQX48mgWo7d9MJK3BT85N5w69dYy1tGNwmTeX2J7BN2jw== X-Received: by 2002:ac2:4d9b:0:b0:516:d33a:7571 with SMTP id g27-20020ac24d9b000000b00516d33a7571mr10745339lfe.8.1713362418928; Wed, 17 Apr 2024 07:00:18 -0700 (PDT) Received: from localhost ([94.125.187.42]) by smtp.gmail.com with ESMTPSA id g20-20020a19ee14000000b00515b0706b95sm1971640lfb.17.2024.04.17.07.00.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Apr 2024 07:00:18 -0700 (PDT) From: Serge Semin To: Alexandre Torgue , Jose Abreu , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Russell King , Yanteng Si , Romain Gantois , Maxime Coquelin 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-next v2 2/2] net: stmmac: Move MAC caps init to phylink MAC caps getter Date: Wed, 17 Apr 2024 17:00:08 +0300 Message-ID: <20240417140013.12575-3-fancer.lancer@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240417140013.12575-1-fancer.lancer@gmail.com> References: <20240417140013.12575-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-20240417_070022_930352_B76DCE5B X-CRM114-Status: GOOD ( 16.59 ) 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 After a set of recent fixes the stmmac_phy_setup() and stmmac_reinit_queues() methods have turned to having some duplicated code. Let's get rid from the duplication by moving the MAC-capabilities initialization to the PHYLINK MAC-capabilities getter. The getter is called during each network device interface open/close cycle. So the MAC-capabilities will be initialized in generic device open procedure and in case of the Tx/Rx queues re-initialization as the original code semantics implies. Signed-off-by: Serge Semin Reviewed-by: Romain Gantois --- Link: https://lore.kernel.org/netdev/20240412180340.7965-5-fancer.lancer@gmail.com/ Changelog v2: - Resubmit the patch to net-next separately from the main patchset (Paolo) --- .../net/ethernet/stmicro/stmmac/stmmac_main.c | 36 +++++++++---------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index b810f6b69bf5..0d6cd1704e6a 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -936,6 +936,22 @@ static void stmmac_mac_flow_ctrl(struct stmmac_priv *priv, u32 duplex) priv->pause, tx_cnt); } +static unsigned long stmmac_mac_get_caps(struct phylink_config *config, + phy_interface_t interface) +{ + struct stmmac_priv *priv = netdev_priv(to_net_dev(config->dev)); + + /* Refresh the MAC-specific capabilities */ + stmmac_mac_update_caps(priv); + + config->mac_capabilities = priv->hw->link.caps; + + if (priv->plat->max_speed) + phylink_limit_mac_speed(config, priv->plat->max_speed); + + return config->mac_capabilities; +} + static struct phylink_pcs *stmmac_mac_select_pcs(struct phylink_config *config, phy_interface_t interface) { @@ -1105,6 +1121,7 @@ static void stmmac_mac_link_up(struct phylink_config *config, } static const struct phylink_mac_ops stmmac_phylink_mac_ops = { + .mac_get_caps = stmmac_mac_get_caps, .mac_select_pcs = stmmac_mac_select_pcs, .mac_config = stmmac_mac_config, .mac_link_down = stmmac_mac_link_down, @@ -1204,7 +1221,6 @@ static int stmmac_phy_setup(struct stmmac_priv *priv) int mode = priv->plat->phy_interface; struct fwnode_handle *fwnode; struct phylink *phylink; - int max_speed; priv->phylink_config.dev = &priv->dev->dev; priv->phylink_config.type = PHYLINK_NETDEV; @@ -1225,15 +1241,6 @@ static int stmmac_phy_setup(struct stmmac_priv *priv) xpcs_get_interfaces(priv->hw->xpcs, priv->phylink_config.supported_interfaces); - /* Refresh the MAC-specific capabilities */ - stmmac_mac_update_caps(priv); - - priv->phylink_config.mac_capabilities = priv->hw->link.caps; - - max_speed = priv->plat->max_speed; - if (max_speed) - phylink_limit_mac_speed(&priv->phylink_config, max_speed); - fwnode = priv->plat->port_node; if (!fwnode) fwnode = dev_fwnode(priv->device); @@ -7327,7 +7334,6 @@ 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); @@ -7341,14 +7347,6 @@ int stmmac_reinit_queues(struct net_device *dev, u32 rx_cnt, u32 tx_cnt) priv->rss.table[i] = ethtool_rxfh_indir_default(i, rx_cnt); - stmmac_mac_update_caps(priv); - - priv->phylink_config.mac_capabilities = priv->hw->link.caps; - - 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))