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>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Florian Fainelli <f.fainelli@gmail.com>,
	Jakub Kicinski <kuba@kernel.org>,
	netdev@vger.kernel.org, Paolo Abeni <pabeni@redhat.com>
Subject: Re: [PATCH RFC net-next 2/3] net: dsa: allow DSA switch drivers to provide their own phylink mac ops
Date: Fri, 5 Apr 2024 17:23:53 +0100	[thread overview]
Message-ID: <ZhAlmRQ0pz+ibqGB@shell.armlinux.org.uk> (raw)
In-Reply-To: <20240405162100.5iy2k66bqnhprej4@skbuf>

On Fri, Apr 05, 2024 at 07:21:00PM +0300, Vladimir Oltean wrote:
> On Wed, Apr 03, 2024 at 03:18:41PM +0100, Russell King (Oracle) wrote:
> > diff --git a/net/dsa/port.c b/net/dsa/port.c
> > index 02bf1c306bdc..4cafbc505009 100644
> > --- a/net/dsa/port.c
> > +++ b/net/dsa/port.c
> > @@ -1662,6 +1662,7 @@ static const struct phylink_mac_ops dsa_port_phylink_mac_ops = {
> >  
> >  int dsa_port_phylink_create(struct dsa_port *dp)
> >  {
> > +	const struct phylink_mac_ops *mac_ops;
> >  	struct dsa_switch *ds = dp->ds;
> >  	phy_interface_t mode;
> >  	struct phylink *pl;
> > @@ -1685,8 +1686,12 @@ int dsa_port_phylink_create(struct dsa_port *dp)
> >  		}
> >  	}
> >  
> > -	pl = phylink_create(&dp->pl_config, of_fwnode_handle(dp->dn),
> > -			    mode, &dsa_port_phylink_mac_ops);
> > +	mac_ops = &dsa_port_phylink_mac_ops;
> > +	if (ds->phylink_mac_ops)
> > +		mac_ops = ds->phylink_mac_ops;
> > +
> > +	pl = phylink_create(&dp->pl_config, of_fwnode_handle(dp->dn), mode,
> > +			    mac_ops);
> >  	if (IS_ERR(pl)) {
> >  		pr_err("error creating PHYLINK: %ld\n", PTR_ERR(pl));
> >  		return PTR_ERR(pl);
> > -- 
> > 2.30.2
> > 
> 
> This is not sufficient. We will have to make DSA call the driver through
> the mac_ops it provides, rather than through ds->ops, here:
> 
> dsa_shared_port_link_register_of()
> 
> 	if (!ds->ops->adjust_link) {
> 		if (missing_link_description) {
> 			dev_warn(ds->dev,
> 				 "Skipping phylink registration for %s port %d\n",
> 				 dsa_port_is_cpu(dp) ? "CPU" : "DSA", dp->index);
> 		} else {
> 			if (ds->ops->phylink_mac_link_down)
> 				ds->ops->phylink_mac_link_down(ds, port,
> 					MLO_AN_FIXED, PHY_INTERFACE_MODE_NA);
> 			~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 
> 			return dsa_shared_port_phylink_register(dp);
> 		}
> 		return 0;
> 	}
> 
> Coincidentally mv88e6xxx is exactly one of those drivers which needs the
> early mac_link_down() call that isn't driven by phylink.

Thanks for the review, I'd forgotten that this path exists!

-- 
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-04-05 16:24 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-03 14:17 [PATCH RFC 0/3] net: dsa: allow phylink_mac_ops in DSA drivers Russell King (Oracle)
2024-04-03 14:18 ` [PATCH RFC net-next 1/3] net: dsa: introduce dsa_phylink_to_port() Russell King (Oracle)
2024-04-03 14:18 ` [PATCH RFC net-next 2/3] net: dsa: allow DSA switch drivers to provide their own phylink mac ops Russell King (Oracle)
2024-04-05 16:21   ` Vladimir Oltean
2024-04-05 16:23     ` Russell King (Oracle) [this message]
2024-04-03 14:18 ` [PATCH RFC net-next 3/3] net: dsa: mv88e6xxx: provide own phylink MAC operations Russell King (Oracle)

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=ZhAlmRQ0pz+ibqGB@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=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).