LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Horatiu Vultur <horatiu.vultur@microchip.com>
To: "Russell King (Oracle)" <linux@armlinux.org.uk>
Cc: <davem@davemloft.net>, <kuba@kernel.org>, <robh+dt@kernel.org>,
	<UNGLinuxDriver@microchip.com>, <p.zabel@pengutronix.de>,
	<andrew@lunn.ch>, <netdev@vger.kernel.org>,
	<devicetree@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH net-next v4 3/6] net: lan966x: add port module support
Date: Mon, 29 Nov 2021 12:08:34 +0100	[thread overview]
Message-ID: <20211129110834.yy6wai63vaftnias@soft-dev3-1.localhost> (raw)
In-Reply-To: <YaC/OT0f2JKBPMOb@shell.armlinux.org.uk>

The 11/26/2021 11:04, Russell King (Oracle) wrote:
> 
> On Fri, Nov 26, 2021 at 10:05:37AM +0100, Horatiu Vultur wrote:
> > This patch adds support for netdev and phylink in the switch. The
> > injection + extraction is register based. This will be replaced with DMA
> > accees.
> >
> > Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>
> 
> This looks mostly good now, thanks. There's one remaining issue:

Thanks for the help!

> 
> > +int lan966x_port_pcs_set(struct lan966x_port *port,
> > +                      struct lan966x_port_config *config)
> > +{
> > +     struct lan966x *lan966x = port->lan966x;
> > +     bool inband_aneg = false;
> > +     bool outband;
> > +     int err;
> > +
> > +     lan966x_port_link_down(port);
> 
> This looks like something the MAC layer should be doing. Phylink won't
> change the interface mode by just calling the PCS - it will do this
> sequence, known as a major reconfiguration:
> 
> mac_link_down() (if the link was previously up)
> mac_prepare()
> mac_config()
> if (pcs_config() > 0)
>   pcs_an_restart()
> mac_finish()
> 
> pcs_config() will also be called thusly:
> 
> if (pcs_config() > 0)
>   pcs_an_restart()
> 
> to change the ethtool advertising mask which changes the inband advert
> or the Autoneg bit, which has an effect only on your DEV_PCS1G_ANEG_CFG()
> register, and this may be called with the link up or down.
> 
> Also, pcs_config() is supposed to return 0 if the inband advert has not
> changed, or positive if it has (so pcs_an_restart() is called to cause
> in-band negotiation to be restarted.)
> 
> Note also that pcs_an_restart() may  also be called when ethtool
> requests negotiation restart when we're operating in 802.3z modes.
> 
> So, my question is - do you need to be so heavy weight with the call to
> lan966x_port_link_down() to take everything down when pcs_config() is
> called, and is it really in the right place through the sequence for
> a major reconfiguration?

Thanks for the detail explanation.
You are right, it doesn't look like it is needed to call
lan966x_port_link_down when pcs_config is called.
I can put the lan966x_port_link_down() inside the mac_link_down() callback.

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

-- 
/Horatiu

  reply	other threads:[~2021-11-29 11:08 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-26  9:05 [PATCH net-next v4 0/6] net: lan966x: Add lan966x switch driver Horatiu Vultur
2021-11-26  9:05 ` [PATCH net-next v4 1/6] dt-bindings: net: lan966x: Add lan966x-switch bindings Horatiu Vultur
2021-11-28 23:40   ` Rob Herring
2021-11-29 10:55     ` Horatiu Vultur
2021-11-26  9:05 ` [PATCH net-next v4 2/6] net: lan966x: add the basic lan966x driver Horatiu Vultur
2021-11-26 10:19   ` Philipp Zabel
2021-11-26  9:05 ` [PATCH net-next v4 3/6] net: lan966x: add port module support Horatiu Vultur
2021-11-26 11:04   ` Russell King (Oracle)
2021-11-29 11:08     ` Horatiu Vultur [this message]
2021-11-26 18:12   ` Jakub Kicinski
2021-11-29 10:59     ` Horatiu Vultur
2021-11-26  9:05 ` [PATCH net-next v4 4/6] net: lan966x: add mactable support Horatiu Vultur
2021-11-26  9:05 ` [PATCH net-next v4 5/6] net: lan966x: add ethtool configuration and statistics Horatiu Vultur
2021-11-26  9:05 ` [PATCH net-next v4 6/6] net: lan966x: Update MAINTAINERS to include lan966x driver Horatiu Vultur

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=20211129110834.yy6wai63vaftnias@soft-dev3-1.localhost \
    --to=horatiu.vultur@microchip.com \
    --cc=UNGLinuxDriver@microchip.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=devicetree@vger.kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=netdev@vger.kernel.org \
    --cc=p.zabel@pengutronix.de \
    --cc=robh+dt@kernel.org \
    --subject='Re: [PATCH net-next v4 3/6] net: lan966x: add port module support' \
    /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

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).