All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Russell King (Oracle)" <linux@armlinux.org.uk>
To: Horatiu Vultur <horatiu.vultur@microchip.com>
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: Fri, 26 Nov 2021 11:04:25 +0000	[thread overview]
Message-ID: <YaC/OT0f2JKBPMOb@shell.armlinux.org.uk> (raw)
In-Reply-To: <20211126090540.3550913-4-horatiu.vultur@microchip.com>

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:

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

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

  reply	other threads:[~2021-11-26 11:41 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) [this message]
2021-11-29 11:08     ` Horatiu Vultur
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=YaC/OT0f2JKBPMOb@shell.armlinux.org.uk \
    --to=linux@armlinux.org.uk \
    --cc=UNGLinuxDriver@microchip.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=devicetree@vger.kernel.org \
    --cc=horatiu.vultur@microchip.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=p.zabel@pengutronix.de \
    --cc=robh+dt@kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.