netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Russell King (Oracle)" <rmk+kernel@armlinux.org.uk>
To: Andrew Lunn <andrew@lunn.ch>, Heiner Kallweit <hkallweit1@gmail.com>
Cc: "Broadcom internal kernel review list"
	<bcm-kernel-feedback-list@broadcom.com>,
	"David S. Miller" <davem@davemloft.net>,
	"Eric Dumazet" <edumazet@google.com>,
	"Florian Fainelli" <florian.fainelli@broadcom.com>,
	"Jakub Kicinski" <kuba@kernel.org>,
	"Marek Behún" <kabel@kernel.org>,
	netdev@vger.kernel.org, "Paolo Abeni" <pabeni@redhat.com>
Subject: [PATCH net-next 08/10] net: phylink: pass PHY into phylink_validate_mask()
Date: Fri, 24 Nov 2023 12:28:29 +0000	[thread overview]
Message-ID: <E1r6VIL-00DDM3-HJ@rmk-PC.armlinux.org.uk> (raw)
In-Reply-To: <ZWCWn+uNkVLPaQhn@shell.armlinux.org.uk>

Pass the phy (if any) into phylink_validate_mask() so that we can
validate each interface with its rate matching setting.

Tested-by: Luo Jie <quic_luoj@quicinc.com>
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
 drivers/net/phy/phylink.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c
index 52414af5c93f..ac48a1db9979 100644
--- a/drivers/net/phy/phylink.c
+++ b/drivers/net/phy/phylink.c
@@ -719,7 +719,8 @@ static void phylink_validate_one(struct phylink *pl, struct phy_device *phy,
 	}
 }
 
-static int phylink_validate_mask(struct phylink *pl, unsigned long *supported,
+static int phylink_validate_mask(struct phylink *pl, struct phy_device *phy,
+				 unsigned long *supported,
 				 struct phylink_link_state *state,
 				 const unsigned long *interfaces)
 {
@@ -728,7 +729,7 @@ static int phylink_validate_mask(struct phylink *pl, unsigned long *supported,
 	int interface;
 
 	for_each_set_bit(interface, interfaces, PHY_INTERFACE_MODE_MAX)
-		phylink_validate_one(pl, NULL, supported, state, interface,
+		phylink_validate_one(pl, phy, supported, state, interface,
 				     all_s, all_adv);
 
 	linkmode_copy(supported, all_s);
@@ -743,7 +744,8 @@ static int phylink_validate(struct phylink *pl, unsigned long *supported,
 	const unsigned long *interfaces = pl->config->supported_interfaces;
 
 	if (state->interface == PHY_INTERFACE_MODE_NA)
-		return phylink_validate_mask(pl, supported, state, interfaces);
+		return phylink_validate_mask(pl, NULL, supported, state,
+					     interfaces);
 
 	if (!test_bit(state->interface, interfaces))
 		return -EINVAL;
@@ -3179,7 +3181,8 @@ static int phylink_sfp_config_optical(struct phylink *pl)
 	/* For all the interfaces that are supported, reduce the sfp_support
 	 * mask to only those link modes that can be supported.
 	 */
-	ret = phylink_validate_mask(pl, pl->sfp_support, &config, interfaces);
+	ret = phylink_validate_mask(pl, NULL, pl->sfp_support, &config,
+				    interfaces);
 	if (ret) {
 		phylink_err(pl, "unsupported SFP module: validation with support %*pb failed\n",
 			    __ETHTOOL_LINK_MODE_MASK_NBITS, support);
-- 
2.30.2


  parent reply	other threads:[~2023-11-24 12:28 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-24 12:27 [PATCH net-next 00/10] net: phylink: improve PHY validation Russell King (Oracle)
2023-11-24 12:27 ` [PATCH net-next 01/10] net: phy: add possible interfaces Russell King (Oracle)
2023-11-25 17:06   ` Andrew Lunn
2023-11-24 12:27 ` [PATCH net-next 02/10] net: phy: marvell10g: table driven mactype decode Russell King (Oracle)
2023-11-24 12:28 ` [PATCH net-next 03/10] net: phy: marvell10g: fill in possible_interfaces Russell King (Oracle)
2023-11-25 17:09   ` Andrew Lunn
2023-11-24 12:28 ` [PATCH net-next 04/10] net: phy: bcm84881: " Russell King (Oracle)
2023-11-25 17:10   ` Andrew Lunn
2023-11-24 12:28 ` [PATCH net-next 05/10] net: phy: aquantia: fill in possible_interfaces for AQR113C Russell King (Oracle)
2023-11-25 17:11   ` Andrew Lunn
2023-11-24 12:28 ` [PATCH net-next 06/10] net: phylink: split out per-interface validation Russell King (Oracle)
2023-11-25 17:12   ` Andrew Lunn
2023-11-24 12:28 ` [PATCH net-next 07/10] net: phylink: pass PHY into phylink_validate_one() Russell King (Oracle)
2023-11-25 17:13   ` Andrew Lunn
2023-11-24 12:28 ` Russell King (Oracle) [this message]
2023-11-25 17:13   ` [PATCH net-next 08/10] net: phylink: pass PHY into phylink_validate_mask() Andrew Lunn
2023-11-24 12:28 ` [PATCH net-next 09/10] net: phylink: split out PHY validation from phylink_bringup_phy() Russell King (Oracle)
2023-11-25 17:15   ` Andrew Lunn
2023-11-24 12:28 ` [PATCH net-next 10/10] net: phylink: use the PHY's possible_interfaces if populated Russell King (Oracle)
2023-11-25 17:18   ` Andrew Lunn
2023-11-28  2:08 ` [PATCH net-next 00/10] net: phylink: improve PHY validation Jakub Kicinski
2023-11-28  2:20 ` patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E1r6VIL-00DDM3-HJ@rmk-PC.armlinux.org.uk \
    --to=rmk+kernel@armlinux.org.uk \
    --cc=andrew@lunn.ch \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=florian.fainelli@broadcom.com \
    --cc=hkallweit1@gmail.com \
    --cc=kabel@kernel.org \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).