From: "Russell King (Oracle)" <linux@armlinux.org.uk>
To: Steen Hegelund <steen.hegelund@microchip.com>
Cc: "David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>, Andrew Lunn <andrew@lunn.ch>,
Microchip Linux Driver Support <UNGLinuxDriver@microchip.com>,
Alexandre Belloni <alexandre.belloni@bootlin.com>,
Madalin Bucur <madalin.bucur@oss.nxp.com>,
Mark Einon <mark.einon@gmail.com>,
Masahiro Yamada <masahiroy@kernel.org>,
Arnd Bergmann <arnd@arndb.de>,
Philipp Zabel <p.zabel@pengutronix.de>,
Simon Horman <simon.horman@netronome.com>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
Bjarni Jonasson <bjarni.jonasson@microchip.com>,
Lars Povlsen <lars.povlsen@microchip.com>
Subject: Re: [PATCH net-next v3 03/10] net: sparx5: add hostmode with phylink support
Date: Mon, 7 Jun 2021 10:15:36 +0100 [thread overview]
Message-ID: <20210607091536.GA30436@shell.armlinux.org.uk> (raw)
In-Reply-To: <20210604085600.3014532-4-steen.hegelund@microchip.com>
On Fri, Jun 04, 2021 at 10:55:53AM +0200, Steen Hegelund wrote:
> +static void sparx5_phylink_mac_config(struct phylink_config *config,
> + unsigned int mode,
> + const struct phylink_link_state *state)
> +{
> + struct sparx5_port *port = netdev_priv(to_net_dev(config->dev));
> + struct sparx5_port_config conf;
> +
> + conf = port->conf;
> + conf.power_down = false;
> + conf.portmode = state->interface;
> + conf.speed = state->speed;
> + conf.autoneg = state->an_enabled;
> + conf.pause = state->pause;
> +
> + if (state->interface == PHY_INTERFACE_MODE_10GBASER) {
> + if (state->speed == SPEED_UNKNOWN) {
> + /* When a SFP is plugged in we use capabilities to
> + * default to the highest supported speed
> + */
> + if (phylink_test(state->advertising, 25000baseSR_Full) ||
> + phylink_test(state->advertising, 25000baseCR_Full))
> + conf.speed = SPEED_25000;
> + else if (state->interface == PHY_INTERFACE_MODE_10GBASER)
> + conf.speed = SPEED_10000;
> + } else if (state->speed == SPEED_2500) {
> + conf.portmode = PHY_INTERFACE_MODE_2500BASEX;
> + } else if (state->speed == SPEED_1000) {
> + conf.portmode = PHY_INTERFACE_MODE_1000BASEX;
> + }
1) As detailed in the documentation for phylink, state->speed is not
guaranteed to be valid in the mac_config method.
2) We clearly need PHY_INTERFACE_MODE_25GBASER rather than working
around this by testing bits in the advertising bitmap.
3) I really don't get what's going on with setting the port mode to
2500base-X and 1000base-X here when state->interface is 10GBASER.
> + if (phylink_test(state->advertising, FIBRE))
> + conf.media = PHY_MEDIA_SR;
> + else
> + conf.media = PHY_MEDIA_DAC;
> + }
> +
> + if (!port_conf_has_changed(&port->conf, &conf))
> + return;
> +}
> +
> +static void sparx5_phylink_mac_link_up(struct phylink_config *config,
> + struct phy_device *phy,
> + unsigned int mode,
> + phy_interface_t interface,
> + int speed, int duplex,
> + bool tx_pause, bool rx_pause)
> +{
This is the only place that the MAC is guaranteed to know the
negotiated speed.
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
WARNING: multiple messages have this Message-ID (diff)
From: "Russell King (Oracle)" <linux@armlinux.org.uk>
To: Steen Hegelund <steen.hegelund@microchip.com>
Cc: "David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>, Andrew Lunn <andrew@lunn.ch>,
Microchip Linux Driver Support <UNGLinuxDriver@microchip.com>,
Alexandre Belloni <alexandre.belloni@bootlin.com>,
Madalin Bucur <madalin.bucur@oss.nxp.com>,
Mark Einon <mark.einon@gmail.com>,
Masahiro Yamada <masahiroy@kernel.org>,
Arnd Bergmann <arnd@arndb.de>,
Philipp Zabel <p.zabel@pengutronix.de>,
Simon Horman <simon.horman@netronome.com>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
Bjarni Jonasson <bjarni.jonasson@microchip.com>,
Lars Povlsen <lars.povlsen@microchip.com>
Subject: Re: [PATCH net-next v3 03/10] net: sparx5: add hostmode with phylink support
Date: Mon, 7 Jun 2021 10:15:36 +0100 [thread overview]
Message-ID: <20210607091536.GA30436@shell.armlinux.org.uk> (raw)
In-Reply-To: <20210604085600.3014532-4-steen.hegelund@microchip.com>
On Fri, Jun 04, 2021 at 10:55:53AM +0200, Steen Hegelund wrote:
> +static void sparx5_phylink_mac_config(struct phylink_config *config,
> + unsigned int mode,
> + const struct phylink_link_state *state)
> +{
> + struct sparx5_port *port = netdev_priv(to_net_dev(config->dev));
> + struct sparx5_port_config conf;
> +
> + conf = port->conf;
> + conf.power_down = false;
> + conf.portmode = state->interface;
> + conf.speed = state->speed;
> + conf.autoneg = state->an_enabled;
> + conf.pause = state->pause;
> +
> + if (state->interface == PHY_INTERFACE_MODE_10GBASER) {
> + if (state->speed == SPEED_UNKNOWN) {
> + /* When a SFP is plugged in we use capabilities to
> + * default to the highest supported speed
> + */
> + if (phylink_test(state->advertising, 25000baseSR_Full) ||
> + phylink_test(state->advertising, 25000baseCR_Full))
> + conf.speed = SPEED_25000;
> + else if (state->interface == PHY_INTERFACE_MODE_10GBASER)
> + conf.speed = SPEED_10000;
> + } else if (state->speed == SPEED_2500) {
> + conf.portmode = PHY_INTERFACE_MODE_2500BASEX;
> + } else if (state->speed == SPEED_1000) {
> + conf.portmode = PHY_INTERFACE_MODE_1000BASEX;
> + }
1) As detailed in the documentation for phylink, state->speed is not
guaranteed to be valid in the mac_config method.
2) We clearly need PHY_INTERFACE_MODE_25GBASER rather than working
around this by testing bits in the advertising bitmap.
3) I really don't get what's going on with setting the port mode to
2500base-X and 1000base-X here when state->interface is 10GBASER.
> + if (phylink_test(state->advertising, FIBRE))
> + conf.media = PHY_MEDIA_SR;
> + else
> + conf.media = PHY_MEDIA_DAC;
> + }
> +
> + if (!port_conf_has_changed(&port->conf, &conf))
> + return;
> +}
> +
> +static void sparx5_phylink_mac_link_up(struct phylink_config *config,
> + struct phy_device *phy,
> + unsigned int mode,
> + phy_interface_t interface,
> + int speed, int duplex,
> + bool tx_pause, bool rx_pause)
> +{
This is the only place that the MAC is guaranteed to know the
negotiated speed.
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!
next prev parent reply other threads:[~2021-06-07 9:36 UTC|newest]
Thread overview: 47+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-04 8:55 [PATCH net-next v3 00/10] Adding the Sparx5 Switch Driver Steen Hegelund
2021-06-04 8:55 ` Steen Hegelund
2021-06-04 8:55 ` [PATCH net-next v3 01/10] dt-bindings: net: sparx5: Add sparx5-switch bindings Steen Hegelund
2021-06-04 8:55 ` Steen Hegelund
2021-06-04 8:55 ` [PATCH net-next v3 02/10] net: sparx5: add the basic sparx5 driver Steen Hegelund
2021-06-04 9:28 ` Philipp Zabel
2021-06-04 9:28 ` Philipp Zabel
2021-06-07 7:34 ` Steen Hegelund
2021-06-07 7:34 ` Steen Hegelund
2021-06-07 8:13 ` Philipp Zabel
2021-06-07 8:13 ` Philipp Zabel
2021-06-04 8:55 ` [PATCH net-next v3 03/10] net: sparx5: add hostmode with phylink support Steen Hegelund
2021-06-04 8:55 ` Steen Hegelund
2021-06-07 9:15 ` Russell King (Oracle) [this message]
2021-06-07 9:15 ` Russell King (Oracle)
2021-06-07 12:45 ` Steen Hegelund
2021-06-07 12:45 ` Steen Hegelund
2021-06-07 13:09 ` Russell King (Oracle)
2021-06-07 13:09 ` Russell King (Oracle)
2021-06-07 15:12 ` Steen Hegelund
2021-06-07 15:12 ` Steen Hegelund
2021-06-07 15:35 ` Russell King (Oracle)
2021-06-07 15:35 ` Russell King (Oracle)
2021-06-08 9:24 ` Steen Hegelund
2021-06-08 9:24 ` Steen Hegelund
2021-06-04 8:55 ` [PATCH net-next v3 04/10] net: sparx5: add port module support Steen Hegelund
2021-06-04 8:55 ` Steen Hegelund
2021-06-07 9:21 ` Russell King (Oracle)
2021-06-07 9:21 ` Russell King (Oracle)
2021-06-07 12:46 ` Steen Hegelund
2021-06-07 12:46 ` Steen Hegelund
2021-06-07 13:12 ` Russell King (Oracle)
2021-06-07 13:12 ` Russell King (Oracle)
2021-06-07 15:14 ` Steen Hegelund
2021-06-07 15:14 ` Steen Hegelund
2021-06-04 8:55 ` [PATCH net-next v3 05/10] net: sparx5: add mactable support Steen Hegelund
2021-06-04 8:55 ` Steen Hegelund
2021-06-04 8:55 ` [PATCH net-next v3 06/10] net: sparx5: add vlan support Steen Hegelund
2021-06-04 8:55 ` Steen Hegelund
2021-06-04 8:55 ` [PATCH net-next v3 07/10] net: sparx5: add switching support Steen Hegelund
2021-06-04 8:55 ` Steen Hegelund
2021-06-04 8:55 ` [PATCH net-next v3 08/10] net: sparx5: add calendar bandwidth allocation support Steen Hegelund
2021-06-04 8:55 ` Steen Hegelund
2021-06-04 8:55 ` [PATCH net-next v3 09/10] net: sparx5: add ethtool configuration and statistics support Steen Hegelund
2021-06-04 8:55 ` Steen Hegelund
2021-06-04 8:56 ` [PATCH net-next v3 10/10] arm64: dts: sparx5: Add the Sparx5 switch node Steen Hegelund
2021-06-04 8:56 ` Steen Hegelund
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=20210607091536.GA30436@shell.armlinux.org.uk \
--to=linux@armlinux.org.uk \
--cc=UNGLinuxDriver@microchip.com \
--cc=alexandre.belloni@bootlin.com \
--cc=andrew@lunn.ch \
--cc=arnd@arndb.de \
--cc=bjarni.jonasson@microchip.com \
--cc=davem@davemloft.net \
--cc=kuba@kernel.org \
--cc=lars.povlsen@microchip.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=madalin.bucur@oss.nxp.com \
--cc=mark.einon@gmail.com \
--cc=masahiroy@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=p.zabel@pengutronix.de \
--cc=simon.horman@netronome.com \
--cc=steen.hegelund@microchip.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 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.