From: "Russell King (Oracle)" <linux@armlinux.org.uk>
To: Vladimir Oltean <olteanv@gmail.com>
Cc: Sean Anderson <sean.anderson@seco.com>,
Andrew Lunn <andrew@lunn.ch>,
Heiner Kallweit <hkallweit1@gmail.com>,
netdev@vger.kernel.org, "David S . Miller" <davem@davemloft.net>,
Paolo Abeni <pabeni@redhat.com>,
linux-kernel@vger.kernel.org, Jakub Kicinski <kuba@kernel.org>,
Eric Dumazet <edumazet@google.com>,
Tim Harvey <tharvey@gateworks.com>
Subject: Re: [PATCH net-next v5 4/4] phy: aquantia: Determine rate adaptation support from registers
Date: Thu, 5 Jan 2023 14:40:50 +0000 [thread overview]
Message-ID: <Y7bhctPZoyNnw1ay@shell.armlinux.org.uk> (raw)
In-Reply-To: <20230105140421.bqd2aed6du5mtxn4@skbuf>
On Thu, Jan 05, 2023 at 04:04:21PM +0200, Vladimir Oltean wrote:
> On Tue, Jan 03, 2023 at 05:05:11PM -0500, Sean Anderson wrote:
> > static int aqr107_get_rate_matching(struct phy_device *phydev,
> > phy_interface_t iface)
> > {
> > - if (iface == PHY_INTERFACE_MODE_10GBASER ||
> > - iface == PHY_INTERFACE_MODE_2500BASEX ||
> > - iface == PHY_INTERFACE_MODE_NA)
> > - return RATE_MATCH_PAUSE;
> > - return RATE_MATCH_NONE;
> > + static const struct aqr107_link_speed_cfg speed_table[] = {
> > + {
> > + .speed = SPEED_10,
> > + .reg = VEND1_GLOBAL_CFG_10M,
> > + .speed_bit = MDIO_PMA_SPEED_10,
> > + },
> > + {
> > + .speed = SPEED_100,
> > + .reg = VEND1_GLOBAL_CFG_100M,
> > + .speed_bit = MDIO_PMA_SPEED_100,
> > + },
> > + {
> > + .speed = SPEED_1000,
> > + .reg = VEND1_GLOBAL_CFG_1G,
> > + .speed_bit = MDIO_PMA_SPEED_1000,
> > + },
> > + {
> > + .speed = SPEED_2500,
> > + .reg = VEND1_GLOBAL_CFG_2_5G,
> > + .speed_bit = MDIO_PMA_SPEED_2_5G,
> > + },
> > + {
> > + .speed = SPEED_5000,
> > + .reg = VEND1_GLOBAL_CFG_5G,
> > + .speed_bit = MDIO_PMA_SPEED_5G,
> > + },
> > + {
> > + .speed = SPEED_10000,
> > + .reg = VEND1_GLOBAL_CFG_10G,
> > + .speed_bit = MDIO_PMA_SPEED_10G,
> > + },
> > + };
> > + int speed = phy_interface_max_speed(iface);
> > + bool got_one = false;
> > + int i;
> > +
> > + for (i = 0; i < ARRAY_SIZE(speed_table) &&
> > + speed_table[i].speed <= speed; i++) {
> > + if (!aqr107_rate_adapt_ok(phydev, speed, &speed_table[i]))
> > + return RATE_MATCH_NONE;
> > + got_one = true;
> > + }
>
> Trying to wrap my head around the API for rate matching that was
> originally proposed and how it applies to what we read from Aquantia
> registers now.
>
> IIUC, phylink (via the PHY library) asks "what kind of rate matching is
> supported for this SERDES protocol?". It doesn't ask "via what kind of
> rate matching can this SERDES protocol support this particular media
> side speed?".
>
> Your code walks through the speed_table[] of media speeds (from 10M up
> until the max speed of the SERDES) and sees whether the PHY was
> provisioned, for that speed, to use PAUSE rate adaptation.
>
> If the PHY firmware uses a combination like this: 10GBASE-R/XFI for
> media speeds of 10G, 5G, 2.5G (rate adapted), and SGMII for 1G, 100M
> and 10M, a call to your implementation of
> aqr107_get_rate_matching(PHY_INTERFACE_MODE_10GBASER) would return
> RATE_MATCH_NONE, right? So only ETHTOOL_LINK_MODE_10000baseT_Full_BIT
> would be advertised on the media side?
No, beause of the special condition in phylink that if it's a clause 45
PHY and we use something like 10GBASE-R, we don't limit to just 10G
speed, but try all interface modes - on the assumption that the PHY
will switch its host interface.
RATE_MATCH_NONE doesn't state anything about whether the PHY operates
in a single interface mode or not - with 10G PHYs (and thus clause 45
PHYs) it seems very common from current observations for
implementations to do this kind of host-interface switching.
--
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:[~2023-01-05 14:41 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-03 22:05 [PATCH net-next v5 0/4] phy: aquantia: Determine rate adaptation support from registers Sean Anderson
2023-01-03 22:05 ` [PATCH net-next v5 1/4] net: phy: Move/rename phylink_interface_max_speed Sean Anderson
2023-01-03 22:05 ` [PATCH net-next v5 2/4] phy: mdio: Reorganize defines Sean Anderson
2023-01-03 22:05 ` [PATCH net-next v5 3/4] net: mdio: Update speed register bits Sean Anderson
2023-01-03 22:05 ` [PATCH net-next v5 4/4] phy: aquantia: Determine rate adaptation support from registers Sean Anderson
2023-01-05 14:04 ` Vladimir Oltean
2023-01-05 14:40 ` Russell King (Oracle) [this message]
2023-01-05 17:43 ` Vladimir Oltean
2023-01-05 18:51 ` Russell King (Oracle)
2023-01-06 14:18 ` Vladimir Oltean
2023-01-05 16:21 ` Sean Anderson
2023-01-05 17:34 ` Vladimir Oltean
2023-01-05 17:43 ` Sean Anderson
2023-01-05 17:52 ` Vladimir Oltean
2023-01-05 17:55 ` Vladimir Oltean
2023-01-05 18:03 ` Sean Anderson
2023-01-05 18:11 ` Vladimir Oltean
2023-01-05 18:17 ` Sean Anderson
2023-01-05 18:58 ` Russell King (Oracle)
2023-01-05 19:00 ` Sean Anderson
2023-01-05 18:55 ` Russell King (Oracle)
2023-01-05 18:59 ` Sean Anderson
2023-01-05 19:06 ` Russell King (Oracle)
2023-01-05 19:10 ` Sean Anderson
2023-01-05 17:46 ` Russell King (Oracle)
2023-01-06 23:03 ` Vladimir Oltean
2023-01-06 23:21 ` Sean Anderson
2023-01-06 23:29 ` Vladimir Oltean
2023-01-19 18:32 ` Sean Anderson
2023-01-09 18:56 ` Tim Harvey
2023-01-05 13:39 ` [PATCH net-next v5 0/4] " Vladimir Oltean
2023-01-05 16:25 ` Sean Anderson
2023-01-19 18:17 ` Sean Anderson
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=Y7bhctPZoyNnw1ay@shell.armlinux.org.uk \
--to=linux@armlinux.org.uk \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=hkallweit1@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=olteanv@gmail.com \
--cc=pabeni@redhat.com \
--cc=sean.anderson@seco.com \
--cc=tharvey@gateworks.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).