From patchwork Fri Apr 19 09:03:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Serge Semin X-Patchwork-Id: 13635980 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 5EC19C04FF6 for ; Fri, 19 Apr 2024 09:04:33 +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=bV4mlzO3adaX2b+cuuKMDcMgulKUzHMx8jY9zKX2bbc=; b=W1gCMZjMEL2yci v3N0hg1NEk155EJygQlzIeP/BNK4rbeuQszcHQljqoy/pMSJOw1uSPwLwu5Jh7sdudWq0OE91rw/M wn2meQm54vZUPzQX06WC+RqbB4kL07EBl5L3AmQmSsbJUhXnH2e7Eqmg7OwoUiZHbJ9Y5Y9B4UDYJ fICLppuQdEuPWVGMyFr4pn5cmh0oSlWKIibUrVXAzGOfhFGfim3oZv5Ln9USrN7svypmkYKhgWAk6 uExLrQ6kYMdRBu0qTqT0sFiK2xuTzLgolvOed9G2zp1ABtOd8HqvTAbjFB/LdCVYifF90GxavNJco 6GHjp5i56/+uWwjvdbrQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rxkAM-000000051x3-326D; Fri, 19 Apr 2024 09:04:18 +0000 Received: from mail-lj1-x22d.google.com ([2a00:1450:4864:20::22d]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rxkAD-000000051uu-1Y6b for linux-arm-kernel@lists.infradead.org; Fri, 19 Apr 2024 09:04:10 +0000 Received: by mail-lj1-x22d.google.com with SMTP id 38308e7fff4ca-2db101c11feso12263681fa.0 for ; Fri, 19 Apr 2024 02:04:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1713517447; x=1714122247; 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=2+UxECjZ2bOznPZSMcj9cuChQ4TT4LhNaweaduToB00=; b=nCbEpCwjJW47o9aWTE6+e62lpmdxnSA+GHDWAUKwdg/a88VBu2+WhtbMYbAkjDbMza xDB/B6jV8F6Oogqt94mkqosZu8wPrN4ZR/vXVFjQ0V8kqzEBWfn9TxG157bluGdcEvii GLVwIKH4RWtr01KUDsRNVJTw+9dBtQqif3AT7VFXtF3Lx4OfJr5uiSZWt0M/Iwc1c9Dd 2jwzcJWOSV0BKI+VRU+C9CMUrxxHnT638AWgdINo6u0NaP7MJ9pYc7HRkf38zVfAbX+9 BOYQy5l2bn+urOXzuVZ4uf0/dgYZgcKx9q/xzvE/UmPlqdk/HzbLhetDtHj4ejeLOYIG Ebiw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713517447; x=1714122247; 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=2+UxECjZ2bOznPZSMcj9cuChQ4TT4LhNaweaduToB00=; b=eBDiSwvyKYwxafnP5UCklRdPPgEXzC6sPdYwXqIBnK+5nn5ebdDAhULObxd1llFton IWBMbDqLyC73K8RICcM0BFIYZnP0MH82i096TvNSZiFRCANOZIEfEOYrptcoXtmnWvy3 Np3NoUOg6+2WIg6ywKfVlCV9B7l7e9BEmtpwYn2YXDEfEJGYC3Ytvo/L3uXPYVQYOG9U ASHHLKUoGkZOMIHBBtgH8N0i81JtJrvdtnjkLM+ixYlegCFJ07MVMChK8ugsOKBAr3Zb o2JASq7k+YxdytwWS4AgiwCQ7zGCOHeJe0s/v6R2upi3XBVPdDv8g0XHd7yRz9VBDCNw zXoQ== X-Forwarded-Encrypted: i=1; AJvYcCWiygZhFPU1QS9dsjukvrygTis1/tDNoyXpN4oqkMIEELrbSO2EqPxXzCdjxc8AuY7ZDtOCkrog5pndUfRMg4n9LEE/gnqP4oGbFYLnbIpvOIyj1H8= X-Gm-Message-State: AOJu0YyNolLmmv0e/oY2ao7bWjMCOhheF8WXEMgZ/3LL1tC3LYJUXijo 8Ou/3ScfZ0Imqa3XTsw6CN8XvVN94qDnoEnFAC9cWQoLieuu/qTh X-Google-Smtp-Source: AGHT+IFH89zQPQ3GixxrpiN7kS+j8bXFxn8wZiGxujO3H0oIWI/CEKmSLCc+cQUZORC9BEhMDNEbYw== X-Received: by 2002:a2e:b94d:0:b0:2d8:606d:c797 with SMTP id 13-20020a2eb94d000000b002d8606dc797mr507570ljs.10.1713517446579; Fri, 19 Apr 2024 02:04:06 -0700 (PDT) Received: from localhost (srv1.baikalchip.ru. [87.245.175.227]) by smtp.gmail.com with ESMTPSA id l2-20020a2e7002000000b002d9ff7ff007sm523884ljc.40.2024.04.19.02.04.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Apr 2024 02:04:06 -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 RESEND net-next v3 1/2] net: stmmac: Rename phylink_get_caps() callback to update_caps() Date: Fri, 19 Apr 2024 12:03:05 +0300 Message-ID: <20240419090357.5547-2-fancer.lancer@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240419090357.5547-1-fancer.lancer@gmail.com> References: <20240419090357.5547-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-20240419_020409_436123_D2C12496 X-CRM114-Status: GOOD ( 17.65 ) 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 Fri Apr 19 09:03:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Serge Semin X-Patchwork-Id: 13635981 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 BAD9FC4345F for ; Fri, 19 Apr 2024 09:04:34 +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=hqi+KHmSeQmsnMCshyY1bTBD/Jkn4kQ3RSIEuZVaMJk=; b=Z4qh4XBnWIH9e0 8Fp9bFyRtT0M9m88G38rLjnAoj/D0BLOYbd4Mv4jz8CGZJJLnb2dTw3bwpp/HhN8dVQEcrI35+HMg eM4+gE4qJQrVqRStlWpJBfCVogxjWWWvQ9d824z9Z7ybXF/QAJr7aH2kYwApac5u69eQT/EAozNy2 QkTX6zuXT1rZ8T4m9jvzrWuItBI0tBdgyxtW6BcDSAQRDJCEdnWecsGWaV8oYkvyA/faz3PkwUVeb El6vJgMFn7dn3sv0dgB8LAsMCIPCaTWC/B9ryZigqemBGnMpDAhcU7/cN3tmqjtjJyO9YajFkxzPh HVANEliNv7Gf5ze9plPg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rxkAN-000000051xN-205a; Fri, 19 Apr 2024 09:04:19 +0000 Received: from mail-lj1-x22f.google.com ([2a00:1450:4864:20::22f]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rxkAE-000000051v0-2cX8 for linux-arm-kernel@lists.infradead.org; Fri, 19 Apr 2024 09:04:12 +0000 Received: by mail-lj1-x22f.google.com with SMTP id 38308e7fff4ca-2db2f6cb312so33058551fa.2 for ; Fri, 19 Apr 2024 02:04:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1713517448; x=1714122248; 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=rgMQYr4oV4JNndEuD2biU5vQV/pnebRAnRkbrVejXaA=; b=RBGJshBCPhcb2gR9gzV3r3ya7u6KwjamOIKRS5qpF0CYhQXs4F6oLeGzg+xdx4ScIC tAspwDxty7b1fhY9MilQ0h5fgQhVUXqtxeoev5S8ThRLAMozzXsKvsrb3TJnt4i/+d9y 7s9ivXTgJQSSDfWzBGDc+vMV23gQ49XSmtqCKzC6Ya0gz1jamR1Jp0IXcJ7dnP9+FwuI /Kkb4k0bRoPN4TB8YmNLHKF3ahXKMtMQlb7ZiFp0nrQacmYulgLqeoejaU4KDOAaaAk1 SBgUoKkIfodUI+zDBWmUehC986GzZmoJK+e/ypNun3rMCS3AamwkOJ/eVE3A339NTkSD j0ng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713517448; x=1714122248; 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=rgMQYr4oV4JNndEuD2biU5vQV/pnebRAnRkbrVejXaA=; b=NR2GQupcxVoLcQ1ei/aacJ+4rzhORIiGFd0RmrEREW9LsCUhDjvHpTAAKrw7r9aLWY qVs1TZx0z4wHe9YK019A9C+FDR+3sAw+0qpi2M/UKZOkEKOAyx9kAYBiUAoDPPZF7Kwa p1+y8LszqDe7DSLuWau7uk7NJiLjPukGpnBVUQ2AwRbt3hvBVycJzVd6Qn3ZAs6bUj13 odGFhqsyjdAzjGAw9NzRG4AlKHZkx2JwO0IXmkajjTSsI1u1kwbFFoMR09uV2/SNkkHc 88JHWxPJ+r6Uadk9jRqWGFwURX1+XhlMcD2hnrt60dClDwIxEE3dPnOOJhjZZIpaOc3U 4pPQ== X-Forwarded-Encrypted: i=1; AJvYcCVVXJnBHPfqAoikodVjXLIvrRUNteQhaRmO69bSgZbuTIBJsYTwPy9sZabweWYw6ZD+hsLS6EvnyRfq4bXWQYA+PGIbVr2wEb8EHewcr/Dy8UcSiBQ= X-Gm-Message-State: AOJu0YwnYYS/3nryeVTp3JERLhMLy8cZra3I5aPdQ22JvUOjRoZq0nKU 1XE+AT+bQJRxsENtLiC62YCeGwThAmygC8LGrpbX4a+8j4CIZoMZ X-Google-Smtp-Source: AGHT+IHQi06xeUbRVNwJPi1rGkVQYXntNtrD89Vy0P8/uMlqN9zH9EDGdcfcGdRrkx/08kp0eZERLQ== X-Received: by 2002:a2e:2a46:0:b0:2d4:7455:89f6 with SMTP id q67-20020a2e2a46000000b002d4745589f6mr1137769ljq.40.1713517448297; Fri, 19 Apr 2024 02:04:08 -0700 (PDT) Received: from localhost (srv1.baikalchip.ru. [87.245.175.227]) by smtp.gmail.com with ESMTPSA id h25-20020a2e3a19000000b002da968f03f9sm520526lja.89.2024.04.19.02.04.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Apr 2024 02:04:07 -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 RESEND net-next v3 2/2] net: stmmac: Move MAC caps init to phylink MAC caps getter Date: Fri, 19 Apr 2024 12:03:06 +0300 Message-ID: <20240419090357.5547-3-fancer.lancer@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240419090357.5547-1-fancer.lancer@gmail.com> References: <20240419090357.5547-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-20240419_020410_687171_530CEF84 X-CRM114-Status: GOOD ( 16.72 ) 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))