netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Russell King (Oracle)" <linux@armlinux.org.uk>
To: Vladimir Oltean <olteanv@gmail.com>
Cc: Andrew Lunn <andrew@lunn.ch>,
	Heiner Kallweit <hkallweit1@gmail.com>,
	Florian Fainelli <f.fainelli@gmail.com>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	netdev@vger.kernel.org
Subject: Re: [PATCH net-next v2] net: dsa: remove obsolete phylink dsa_switch operations
Date: Thu, 3 Oct 2024 16:28:57 +0100	[thread overview]
Message-ID: <Zv64OWFyXY5B0B-l@shell.armlinux.org.uk> (raw)
In-Reply-To: <20241003145103.i23tx4mpjtg4e6df@skbuf>

On Thu, Oct 03, 2024 at 05:51:03PM +0300, Vladimir Oltean wrote:
> On Thu, Oct 03, 2024 at 12:52:17PM +0100, Russell King (Oracle) wrote:
> > No driver now uses the DSA switch phylink members, so we can now remove
> > the method pointers, but we need to leave empty shim functions to allow
> > those drivers that do not provide phylink MAC operations structure to
> > continue functioning.
> > 
> > Signed-off-by: Russell King (oracle) <rmk+kernel@armlinux.org.uk>
> > ---
> > diff --git a/net/dsa/dsa.c b/net/dsa/dsa.c
> > index 668c729946ea..09d2f5d4b3dd 100644
> > --- a/net/dsa/dsa.c
> > +++ b/net/dsa/dsa.c
> > diff --git a/net/dsa/port.c b/net/dsa/port.c
> > index 25258b33e59e..f1e96706a701 100644
> > --- a/net/dsa/port.c
> > +++ b/net/dsa/port.c
> > @@ -1579,40 +1579,19 @@ static struct phylink_pcs *
> >  dsa_port_phylink_mac_select_pcs(struct phylink_config *config,
> >  				phy_interface_t interface)
> >  {
> > -	struct dsa_port *dp = dsa_phylink_to_port(config);
> > -	struct phylink_pcs *pcs = ERR_PTR(-EOPNOTSUPP);
> > -	struct dsa_switch *ds = dp->ds;
> > -
> > -	if (ds->ops->phylink_mac_select_pcs)
> > -		pcs = ds->ops->phylink_mac_select_pcs(ds, dp->index, interface);
> > -
> > -	return pcs;
> > +	return ERR_PTR(-EOPNOTSUPP);
> >  }
> 
> dsa_port_phylink_mac_select_pcs() didn't have to stay, as phylink_mac_select_pcs()
> is entirely optional in phylink. Otherwise:

Yes, that's correct, but let's keep it to this for the moment.

There's more to do with mac_select_pcs(). When it was introdued, we
needed a way to distinguish whether the method was actually implemented
or whether the old phylink_set_pcs() function was being used. Those days
are long gone, so returning ERR_PTR(-EOPNOTSUPP) no longer makes much
sense.

DSA's core code returns this, as does mv88e6xxx when the chip doesn't
have any pcs_ops (I'm not sure now why I did the latter now.)

So, I'd like to (a) make mv88e6xxx_mac_select_pcs() return NULL, then
kill dsa_port_phylink_mac_select_pcs() and then eliminate:

        if (mac_ops->mac_select_pcs &&
            mac_ops->mac_select_pcs(config, PHY_INTERFACE_MODE_NA) !=
              ERR_PTR(-EOPNOTSUPP))
                using_mac_select_pcs = true;

replacing all other cases of pl->using_mac_select_pcs with a test
for pl->mac_ops->mac_select_pcs being non-NULL.

However, that's for later - I think for this patch, it makes sense
to keep returning the ERR_PTR() value because that's what it was
doing prior to this patch - we're then only removing the members
on the dsa_switch_ops and their callsite in this patch.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!

  reply	other threads:[~2024-10-03 15:29 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-03 11:52 [PATCH net-next v2] net: dsa: remove obsolete phylink dsa_switch operations Russell King (Oracle)
2024-10-03 14:51 ` Vladimir Oltean
2024-10-03 15:28   ` Russell King (Oracle) [this message]
2024-10-03 22:28     ` Vladimir Oltean
2024-10-07 23:40 ` 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=Zv64OWFyXY5B0B-l@shell.armlinux.org.uk \
    --to=linux@armlinux.org.uk \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=f.fainelli@gmail.com \
    --cc=hkallweit1@gmail.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=olteanv@gmail.com \
    --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).