mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Paolo Abeni <pabeni@redhat.com>
To: Oleksij Rempel <o.rempel@pengutronix.de>,
	Andrew Lunn <andrew@lunn.ch>,
	Heiner Kallweit <hkallweit1@gmail.com>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>
Cc: kernel@pengutronix.de, linux-kernel@vger.kernel.org,
	Russell King <linux@armlinux.org.uk>,
	netdev@vger.kernel.org
Subject: Re: [PATCH net-next v1 1/1] phy: micrel: add Signal Quality Indicator (SQI) support for KSZ9477 switch PHYs
Date: Tue, 24 Jun 2025 10:39:31 +0200	[thread overview]
Message-ID: <8d5c6585-bc49-498d-9bb9-91d02e8e793f@redhat.com> (raw)
In-Reply-To: <20250619133437.1373087-1-o.rempel@pengutronix.de>

On 6/19/25 3:34 PM, Oleksij Rempel wrote:
> The KSZ9477 family of switch chips integrates PHYs that support a
> Signal Quality Indicator (SQI) feature. This feature provides a
> relative measure of receive signal quality, which approximates the
> signal-to-noise ratio and can help detect degraded cabling or
> noisy environments.
> 
> This commit implements the .get_sqi callback for these embedded PHYs
> in the Micrel PHY driver. It uses the MMD PMA/PMD device registers
> (0x01, 0xAC–0xAF) to read raw SQI values from each channel.
> 
> According to the KSZ9477S datasheet (DS00002392C), section 4.1.11:
>   - SQI registers update every 2 µs.
>   - Readings can vary significantly even in stable conditions.
>   - Averaging 30–50 samples is recommended for reliable results.
> 
> The implementation:
>   - Averages 40 samples per channel, with 3 µs delay between reads.
>   - Polls only channel A for 100BASE-TX links.
>   - Polls all four channels (A–D) for 1000BASE-T links.
>   - Returns the *worst* quality (highest raw SQI), inverted to match
>     the Linux convention where higher SQI indicates better signal quality.
> 
> Since there is no direct MDIO access to the PHYs, communication occurs
> via SPI, I2C, or MDIO interfaces with the switch core, which then provides
> an emulated MDIO bus to the integrated PHYs. Due to this level of
> indirection, and the number of reads required for stable SQI sampling,
> read latency becomes noticeable.
> 
> For example, on an i.MX8MP platform with a KSZ9893R switch connected
> via SPI, invoking `ethtool` to read the link status takes approximately
> 200 ms when SQI support is enabled.
> 
> Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
> ---
> 
> This commit currently focuses on single-channel SQI support due to
> budget constraints that prevent immediate extension of the SQI API for
> full multichannel functionality. Despite this limitation, the feature
> still significantly improves diagnostic capabilities for users, and I
> intend to upstream it in its current form.

AFAICS the commit message reflects the 'wannabe'/future implementation
and not the actual one included into this patch.

I think you should reword the commit message, describing the current
implementation.

Also it looks like the SQI value is not inverted, I'm unsure if you
should update the commit message accordingly or actually do the invert
in the code.

Thanks,

Paolo


      reply	other threads:[~2025-06-24  8:39 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-19 13:34 Oleksij Rempel
2025-06-24  8:39 ` Paolo Abeni [this message]

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=8d5c6585-bc49-498d-9bb9-91d02e8e793f@redhat.com \
    --to=pabeni@redhat.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=hkallweit1@gmail.com \
    --cc=kernel@pengutronix.de \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=netdev@vger.kernel.org \
    --cc=o.rempel@pengutronix.de \
    /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

all inboxes | Powered by JetHome®