From: Vladimir Oltean <olteanv@gmail.com>
To: Russell King - ARM Linux admin <linux@armlinux.org.uk>
Cc: Andrew Lunn <andrew@lunn.ch>,
Florian Fainelli <f.fainelli@gmail.com>,
Heiner Kallweit <hkallweit1@gmail.com>,
Ioana Ciornei <ioana.ciornei@nxp.com>,
Vladimir Oltean <vladimir.oltean@nxp.com>,
Claudiu Manoil <claudiu.manoil@nxp.com>,
Alexandru Marginean <alexandru.marginean@nxp.com>,
"michael@walle.cc" <michael@walle.cc>,
"David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>, netdev <netdev@vger.kernel.org>
Subject: Re: [PATCH RFC net-next 12/13] net: phylink: add struct phylink_pcs
Date: Wed, 1 Jul 2020 14:24:50 +0300 [thread overview]
Message-ID: <CA+h21hp_ZNRw9Df75nH64A6it26JXj-9DpQyft6cB22M0YMvNQ@mail.gmail.com> (raw)
In-Reply-To: <20200701111642.GJ1551@shell.armlinux.org.uk>
On Wed, 1 Jul 2020 at 14:16, Russell King - ARM Linux admin
<linux@armlinux.org.uk> wrote:
>
> On Wed, Jul 01, 2020 at 01:47:27PM +0300, Vladimir Oltean wrote:
> > Hi Russell,
> >
> > On Tue, 30 Jun 2020 at 17:29, Russell King <rmk+kernel@armlinux.org.uk> wrote:
> > >
> > > Add a way for MAC PCS to have private data while keeping independence
> > > from struct phylink_config, which is used for the MAC itself. We need
> > > this independence as we will have stand-alone code for PCS that is
> > > independent of the MAC. Introduce struct phylink_pcs, which is
> > > designed to be embedded in a driver private data structure.
> > >
> > > This structure does not include a mdio_device as there are PCS
> > > implementations such as the Marvell DSA and network drivers where this
> > > is not necessary.
> > >
> > > Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
> > > ---
> > > drivers/net/phy/phylink.c | 25 ++++++++++++++++------
> > > include/linux/phylink.h | 45 ++++++++++++++++++++++++++-------------
> > > 2 files changed, 48 insertions(+), 22 deletions(-)
> > >
> > > diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c
> > > index a31a00fb4974..fbc8591b474b 100644
> > > --- a/drivers/net/phy/phylink.c
> > > +++ b/drivers/net/phy/phylink.c
> > > @@ -43,6 +43,7 @@ struct phylink {
> > > const struct phylink_mac_ops *mac_ops;
> > > const struct phylink_pcs_ops *pcs_ops;
> > > struct phylink_config *config;
> > > + struct phylink_pcs *pcs;
> > > struct device *dev;
> > > unsigned int old_link_state:1;
> > >
> > > @@ -427,7 +428,7 @@ static void phylink_mac_pcs_an_restart(struct phylink *pl)
> > > phy_interface_mode_is_8023z(pl->link_config.interface) &&
> > > phylink_autoneg_inband(pl->cur_link_an_mode)) {
> > > if (pl->pcs_ops)
> > > - pl->pcs_ops->pcs_an_restart(pl->config);
> > > + pl->pcs_ops->pcs_an_restart(pl->pcs);
> > > else
> > > pl->mac_ops->mac_an_restart(pl->config);
> > > }
> > > @@ -453,7 +454,7 @@ static void phylink_change_interface(struct phylink *pl, bool restart,
> > > phylink_mac_config(pl, state);
> > >
> > > if (pl->pcs_ops) {
> > > - err = pl->pcs_ops->pcs_config(pl->config, pl->cur_link_an_mode,
> > > + err = pl->pcs_ops->pcs_config(pl->pcs, pl->cur_link_an_mode,
> > > state->interface,
> > > state->advertising,
> > > !!(pl->link_config.pause &
> > > @@ -533,7 +534,7 @@ static void phylink_mac_pcs_get_state(struct phylink *pl,
> > > state->link = 1;
> > >
> > > if (pl->pcs_ops)
> > > - pl->pcs_ops->pcs_get_state(pl->config, state);
> > > + pl->pcs_ops->pcs_get_state(pl->pcs, state);
> > > else
> > > pl->mac_ops->mac_pcs_get_state(pl->config, state);
> > > }
> > > @@ -604,7 +605,7 @@ static void phylink_link_up(struct phylink *pl,
> > > pl->cur_interface = link_state.interface;
> > >
> > > if (pl->pcs_ops && pl->pcs_ops->pcs_link_up)
> > > - pl->pcs_ops->pcs_link_up(pl->config, pl->cur_link_an_mode,
> > > + pl->pcs_ops->pcs_link_up(pl->pcs, pl->cur_link_an_mode,
> > > pl->cur_interface,
> > > link_state.speed, link_state.duplex);
> > >
> > > @@ -863,11 +864,19 @@ struct phylink *phylink_create(struct phylink_config *config,
> > > }
> > > EXPORT_SYMBOL_GPL(phylink_create);
> > >
> > > -void phylink_add_pcs(struct phylink *pl, const struct phylink_pcs_ops *ops)
> > > +/**
> > > + * phylink_set_pcs() - set the current PCS for phylink to use
> > > + * @pl: a pointer to a &struct phylink returned from phylink_create()
> > > + * @pcs: a pointer to the &struct phylink_pcs
> > > + *
> > > + * Bind the MAC PCS to phylink.
> > > + */
> > > +void phylink_set_pcs(struct phylink *pl, struct phylink_pcs *pcs)
> > > {
> > > - pl->pcs_ops = ops;
> > > + pl->pcs = pcs;
> > > + pl->pcs_ops = pcs->ops;
> > > }
> > > -EXPORT_SYMBOL_GPL(phylink_add_pcs);
> > > +EXPORT_SYMBOL_GPL(phylink_set_pcs);
> > >
> > > /**
> > > * phylink_destroy() - cleanup and destroy the phylink instance
> > > @@ -1212,6 +1221,8 @@ void phylink_start(struct phylink *pl)
> > > break;
> > > case MLO_AN_INBAND:
> > > poll |= pl->config->pcs_poll;
> > > + if (pl->pcs)
> > > + poll |= pl->pcs->poll;
> >
> > Do we see a need for yet another way to request phylink to poll the
> > PCS for link status?
>
> Please consider what the model looks like if we have the PCS almost
> self contained except for this property, which is in the MAC side.
> What if some PCS need to be polled but others do not. Why should the
> MAC need to have that knowledge - is it not a property of the PCS
> itself?
>
> The reason we stuffed it into phylink_config is that at the time, that
> was all that existed. That doesn't mean that when we change the model
> that we should be tied by that decision.
>
> So, for example, does the Lynx PCS IP support any kind of notification
> of link changes to its integrated system? If it does not, then having
> the Lynx PCS mark _itself_ as needing polling is entirely sane, rather
> than burying that information in the MAC driver.
>
> --
> RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
> FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!
Well, there is a MAC register called IEVENT[PCS]. For some Lynx
integrations, such as Felix, I know it doesn't fire an IRQ. Now, if it
doesn't fire on _all_ SoCs which integrate Lynx, that I don't know.
But the interrupt is going to be highly system-specific either way (on
some MACs it's a regular IRQ line, on others it's an MSI). So, in the
general case, I think this is system-specific and not a property of
the PCS itself.
next prev parent reply other threads:[~2020-07-01 11:25 UTC|newest]
Thread overview: 47+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-30 14:27 [PATCH RFC net-next 00/13] Phylink PCS updates Russell King - ARM Linux admin
2020-06-30 14:28 ` [PATCH RFC net-next 01/13] net: phylink: update ethtool reporting for fixed-link modes Russell King
2020-06-30 18:15 ` Florian Fainelli
2020-06-30 14:28 ` [PATCH RFC net-next 02/13] net: phylink: rejig link state tracking Russell King
2020-06-30 18:15 ` Florian Fainelli
2020-06-30 14:28 ` [PATCH RFC net-next 03/13] net: phylink: rearrange resolve mac_config() call Russell King
2020-06-30 18:32 ` Florian Fainelli
2020-06-30 14:28 ` [PATCH RFC net-next 04/13] net: phylink: ensure link is down when changing interface Russell King
2020-06-30 18:32 ` Florian Fainelli
2020-06-30 14:28 ` [PATCH RFC net-next 05/13] net: phylink: update PCS when changing interface during resolution Russell King
2020-06-30 18:33 ` Florian Fainelli
2020-06-30 14:29 ` [PATCH RFC net-next 06/13] net: phylink: avoid mac_config calls Russell King
2020-06-30 19:04 ` Florian Fainelli
2020-06-30 14:29 ` [PATCH RFC net-next 07/13] net: phylink: simplify ksettings_set() implementation Russell King
2020-07-20 10:24 ` Ioana Ciornei
2020-06-30 14:29 ` [PATCH RFC net-next 08/13] net: phylink: simplify phy case for ksettings_set method Russell King
2020-07-20 10:44 ` Ioana Ciornei
2020-07-20 12:45 ` Russell King - ARM Linux admin
2020-06-30 14:29 ` [PATCH RFC net-next 09/13] net: phylink: simplify fixed-link " Russell King
2020-07-20 10:52 ` Ioana Ciornei
2020-06-30 14:29 ` [PATCH RFC net-next 10/13] net: phylink: in-band pause mode advertisement update for PCS Russell King
2020-06-30 16:19 ` Jakub Kicinski
2020-06-30 14:29 ` [PATCH RFC net-next 11/13] net: phylink: re-implement interface configuration with PCS Russell King
2020-07-20 11:40 ` Ioana Ciornei
2020-07-20 12:44 ` Russell King - ARM Linux admin
2020-07-20 13:02 ` Ioana Ciornei
2020-07-20 14:19 ` Russell King - ARM Linux admin
2020-06-30 14:29 ` [PATCH RFC net-next 12/13] net: phylink: add struct phylink_pcs Russell King
2020-07-01 10:47 ` Vladimir Oltean
2020-07-01 11:16 ` Russell King - ARM Linux admin
2020-07-01 11:24 ` Vladimir Oltean [this message]
2020-07-20 15:50 ` Ioana Ciornei
2020-07-20 16:26 ` Russell King - ARM Linux admin
2020-07-20 16:59 ` Ioana Ciornei
2020-07-20 18:16 ` Russell King - ARM Linux admin
2020-06-30 14:29 ` [PATCH RFC net-next 13/13] net: phylink: add interface to configure clause 22 PCS PHY Russell King
2020-07-01 10:52 ` Ioana Ciornei
2020-07-14 8:49 ` [PATCH RFC net-next 00/13] Phylink PCS updates Vladimir Oltean
2020-07-14 13:18 ` Russell King - ARM Linux admin
2020-07-14 21:22 ` Florian Fainelli
2020-07-15 9:53 ` Russell King - ARM Linux admin
2020-07-14 23:46 ` Vladimir Oltean
2020-07-15 11:21 ` Russell King - ARM Linux admin
2020-07-15 11:34 ` Russell King - ARM Linux admin
2020-07-15 12:31 ` Vladimir Oltean
2020-07-15 14:20 ` Andrew Lunn
2020-07-15 17:02 ` Russell King - ARM Linux admin
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=CA+h21hp_ZNRw9Df75nH64A6it26JXj-9DpQyft6cB22M0YMvNQ@mail.gmail.com \
--to=olteanv@gmail.com \
--cc=alexandru.marginean@nxp.com \
--cc=andrew@lunn.ch \
--cc=claudiu.manoil@nxp.com \
--cc=davem@davemloft.net \
--cc=f.fainelli@gmail.com \
--cc=hkallweit1@gmail.com \
--cc=ioana.ciornei@nxp.com \
--cc=kuba@kernel.org \
--cc=linux@armlinux.org.uk \
--cc=michael@walle.cc \
--cc=netdev@vger.kernel.org \
--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;
as well as URLs for NNTP newsgroup(s).