netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Russell King (Oracle)" <rmk+kernel@armlinux.org.uk>
To: netdev@vger.kernel.org
Cc: Andrew Lunn <andrew@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	Florian Fainelli <f.fainelli@gmail.com>,
	Hauke Mehrtens <hauke@hauke-m.de>,
	Jakub Kicinski <kuba@kernel.org>,
	Kurt Kanzenbach <kurt@linutronix.de>,
	Vivien Didelot <vivien.didelot@gmail.com>,
	Vladimir Oltean <olteanv@gmail.com>
Subject: [PATCH net-next 3/5] net: dsa: support use of phylink_generic_validate()
Date: Tue, 30 Nov 2021 13:10:06 +0000	[thread overview]
Message-ID: <E1ms2ta-00ECJH-6c@rmk-PC.armlinux.org.uk> (raw)
In-Reply-To: <YaYiiU9nvmVugqnJ@shell.armlinux.org.uk>

Support the use of phylink_generic_validate() when there is no
phylink_validate method given in the DSA switch operations and
mac_capabilities have been set in the phylink_config structure by the
DSA switch driver.

This gives DSA switch drivers the option to use this if they provide
the supported_interfaces and mac_capabilities, while still giving them
an option to override the default implementation if necessary.

Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
 net/dsa/port.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/net/dsa/port.c b/net/dsa/port.c
index ef0acf005f8f..6d5ebe61280b 100644
--- a/net/dsa/port.c
+++ b/net/dsa/port.c
@@ -981,8 +981,11 @@ static void dsa_port_phylink_validate(struct phylink_config *config,
 	struct dsa_port *dp = container_of(config, struct dsa_port, pl_config);
 	struct dsa_switch *ds = dp->ds;
 
-	if (!ds->ops->phylink_validate)
+	if (!ds->ops->phylink_validate) {
+		if (config->mac_capabilities)
+			phylink_generic_validate(config, supported, state);
 		return;
+	}
 
 	ds->ops->phylink_validate(ds, dp->index, supported, state);
 }
-- 
2.30.2


  parent reply	other threads:[~2021-11-30 13:10 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-30 13:09 [PATCH net-next 0/5] net: dsa: convert two drivers to phylink_generic_validate() Russell King (Oracle)
2021-11-30 13:09 ` [PATCH net-next 1/5] net: dsa: consolidate phylink creation Russell King (Oracle)
2021-11-30 15:41   ` Marek Behún
2021-11-30 15:43   ` Andrew Lunn
2021-11-30 13:10 ` [PATCH net-next 2/5] net: dsa: replace phylink_get_interfaces() with phylink_get_caps() Russell King (Oracle)
2021-11-30 15:42   ` Marek Behún
2021-11-30 15:48   ` Andrew Lunn
2021-11-30 13:10 ` Russell King (Oracle) [this message]
2021-11-30 15:43   ` [PATCH net-next 3/5] net: dsa: support use of phylink_generic_validate() Marek Behún
2021-11-30 15:49   ` Andrew Lunn
2021-11-30 13:10 ` [PATCH net-next 4/5] net: dsa: hellcreek: convert to phylink_generic_validate() Russell King (Oracle)
2021-11-30 13:10 ` [PATCH net-next 5/5] net: dsa: lantiq: " Russell King (Oracle)
2021-12-02  3:20 ` [PATCH net-next 0/5] net: dsa: convert two drivers " 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=E1ms2ta-00ECJH-6c@rmk-PC.armlinux.org.uk \
    --to=rmk+kernel@armlinux.org.uk \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=f.fainelli@gmail.com \
    --cc=hauke@hauke-m.de \
    --cc=kuba@kernel.org \
    --cc=kurt@linutronix.de \
    --cc=netdev@vger.kernel.org \
    --cc=olteanv@gmail.com \
    --cc=vivien.didelot@gmail.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).