public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Vladimir Oltean <olteanv@gmail.com>
To: "Russell King (Oracle)" <linux@armlinux.org.uk>,
	Wong Vee Khee <vee.khee.wong@linux.intel.com>
Cc: Jakub Kicinski <kuba@kernel.org>,
	"David S. Miller" <davem@davemloft.net>,
	netdev@vger.kernel.org, Ong Boon Leong <boon.leong.ong@intel.com>,
	Michael Sit Wei Hong <michael.wei.hong.sit@intel.com>,
	Giuseppe Cavallaro <peppe.cavallaro@st.com>,
	Alexandre Torgue <alexandre.torgue@foss.st.com>,
	Jose Abreu <joabreu@synopsys.com>,
	Maxime Coquelin <mcoquelin.stm32@gmail.com>,
	Heiner Kallweit <hkallweit1@gmail.com>,
	Florian Fainelli <f.fainelli@gmail.com>,
	Andrew Lunn <andrew@lunn.ch>,
	Vladimir Oltean <vladimir.oltean@nxp.com>
Subject: Re: [RFC PATCH v2 net-next 9/9] net: pcs: xpcs: convert to phylink_pcs_ops
Date: Wed, 2 Jun 2021 16:43:21 +0300	[thread overview]
Message-ID: <20210602134321.ppvusilvmmybodtx@skbuf> (raw)
In-Reply-To: <20210601121032.GV30436@shell.armlinux.org.uk>

On Tue, Jun 01, 2021 at 01:10:33PM +0100, Russell King (Oracle) wrote:
> On Tue, Jun 01, 2021 at 03:33:25AM +0300, Vladimir Oltean wrote:
> >  static const struct phylink_mac_ops stmmac_phylink_mac_ops = {
> >  	.validate = stmmac_validate,
> > -	.mac_pcs_get_state = stmmac_mac_pcs_get_state,
> > -	.mac_config = stmmac_mac_config,
> 
> mac_config is still a required function.

This is correct, thanks.

VK, would you mind testing again with this extra patch added to the mix?
If it works, I will add it to the series in v3, ordered properly.

-----------------------------[ cut here]-----------------------------
From a79863027998451c73d5bbfaf1b77cf6097a110c Mon Sep 17 00:00:00 2001
From: Vladimir Oltean <vladimir.oltean@nxp.com>
Date: Wed, 2 Jun 2021 16:35:55 +0300
Subject: [PATCH] net: phylink: allow the mac_config method to be missing if
 pcs_ops are provided

The pcs_config method from struct phylink_pcs_ops does everything that
the mac_config method from struct phylink_mac_ops used to do in the
legacy approach of driving a MAC PCS. So allow drivers to not implement
the mac_config method if there is nothing to do. Keep the method
required for setups that do not provide pcs_ops.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
---
 drivers/net/phy/phylink.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c
index 96d8e88b4e46..a8842c6ce3a2 100644
--- a/drivers/net/phy/phylink.c
+++ b/drivers/net/phy/phylink.c
@@ -415,6 +415,9 @@ static void phylink_resolve_flow(struct phylink_link_state *state)
 static void phylink_mac_config(struct phylink *pl,
 			       const struct phylink_link_state *state)
 {
+	if (!pl->mac_ops->mac_config)
+		return;
+
 	phylink_dbg(pl,
 		    "%s: mode=%s/%s/%s/%s adv=%*pb pause=%02x link=%u an=%u\n",
 		    __func__, phylink_an_mode_str(pl->cur_link_an_mode),
@@ -1192,6 +1195,12 @@ void phylink_start(struct phylink *pl)
 
 	ASSERT_RTNL();
 
+	/* The mac_ops::mac_config method may be absent only if the
+	 * pcs_ops are present.
+	 */
+	if (WARN_ON_ONCE(!pl->mac_ops->mac_config && !pl->pcs_ops))
+		return;
+
 	phylink_info(pl, "configuring for %s/%s link mode\n",
 		     phylink_an_mode_str(pl->cur_link_an_mode),
 		     phy_modes(pl->link_config.interface));
-----------------------------[ cut here]-----------------------------

  reply	other threads:[~2021-06-02 13:44 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-01  0:33 [RFC PATCH v2 net-next 0/9] Convert xpcs to phylink_pcs_ops Vladimir Oltean
2021-06-01  0:33 ` [RFC PATCH v2 net-next 1/9] net: pcs: xpcs: delete shim definition for mdio_xpcs_get_ops() Vladimir Oltean
2021-06-01  0:33 ` [RFC PATCH v2 net-next 2/9] net: pcs: xpcs: there is only one PHY ID Vladimir Oltean
2021-06-01  0:33 ` [RFC PATCH v2 net-next 3/9] net: pcs: xpcs: make the checks related to the PHY interface mode stateless Vladimir Oltean
2021-06-01  0:33 ` [RFC PATCH v2 net-next 4/9] net: pcs: xpcs: export xpcs_validate Vladimir Oltean
2021-06-01  0:33 ` [RFC PATCH v2 net-next 5/9] net: pcs: xpcs: export xpcs_config_eee Vladimir Oltean
2021-06-01  0:33 ` [RFC PATCH v2 net-next 6/9] net: pcs: xpcs: export xpcs_probe Vladimir Oltean
2021-06-01  0:33 ` [RFC PATCH v2 net-next 7/9] net: pcs: xpcs: use mdiobus_c45_addr in xpcs_{read,write} Vladimir Oltean
2021-06-01  0:33 ` [RFC PATCH v2 net-next 8/9] net: pcs: xpcs: convert to mdio_device Vladimir Oltean
2021-06-01  0:33 ` [RFC PATCH v2 net-next 9/9] net: pcs: xpcs: convert to phylink_pcs_ops Vladimir Oltean
2021-06-01 12:10   ` Russell King (Oracle)
2021-06-02 13:43     ` Vladimir Oltean [this message]
2021-06-02 13:47       ` Russell King (Oracle)
2021-06-02 14:02         ` Vladimir Oltean
2021-06-02 14:43           ` Wong Vee Khee
2021-06-02 14:57             ` Vladimir Oltean
2021-06-02 15:10               ` Wong Vee Khee
2021-06-02 15:14                 ` Vladimir Oltean
2021-06-02 15:28                   ` Wong Vee Khee
2021-06-01  8:20 ` [RFC PATCH v2 net-next 0/9] Convert xpcs " Wong Vee Khee

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=20210602134321.ppvusilvmmybodtx@skbuf \
    --to=olteanv@gmail.com \
    --cc=alexandre.torgue@foss.st.com \
    --cc=andrew@lunn.ch \
    --cc=boon.leong.ong@intel.com \
    --cc=davem@davemloft.net \
    --cc=f.fainelli@gmail.com \
    --cc=hkallweit1@gmail.com \
    --cc=joabreu@synopsys.com \
    --cc=kuba@kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=mcoquelin.stm32@gmail.com \
    --cc=michael.wei.hong.sit@intel.com \
    --cc=netdev@vger.kernel.org \
    --cc=peppe.cavallaro@st.com \
    --cc=vee.khee.wong@linux.intel.com \
    --cc=vladimir.oltean@nxp.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