linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: phy: adin: add signal mean square error registers to phy-stats
@ 2020-12-03  8:07 Alexandru Ardelean
  2020-12-03 14:16 ` Andrew Lunn
  0 siblings, 1 reply; 3+ messages in thread
From: Alexandru Ardelean @ 2020-12-03  8:07 UTC (permalink / raw)
  To: netdev, linux-kernel
  Cc: andrew, hkallweit1, linux, davem, kuba, catherine.redmond,
	brian.murray, danail.baylov, maurice.obrien, Alexandru Ardelean

When the link is up on the ADIN1300/ADIN1200, the signal quality on each
pair is indicated in the mean square error register for each pair (MSE_A,
MSE_B, MSE_C, and MSE_D registers, Address 0x8402 to Address 0x8405,
Bits[7:0]).

These values can be useful for some industrial applications.

This change implements support for these registers using the PHY
statistics mechanism.

Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
---
 drivers/net/phy/adin.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/net/phy/adin.c b/drivers/net/phy/adin.c
index 55a0b91816e2..e4441bba98c3 100644
--- a/drivers/net/phy/adin.c
+++ b/drivers/net/phy/adin.c
@@ -184,6 +184,7 @@ struct adin_hw_stat {
 	const char *string;
 	u16 reg1;
 	u16 reg2;
+	bool do_not_accumulate;
 };
 
 static const struct adin_hw_stat adin_hw_stats[] = {
@@ -197,6 +198,10 @@ static const struct adin_hw_stat adin_hw_stats[] = {
 	{ "odd_preamble_packet_count",		0x9412 },
 	{ "dribble_bits_frames_count",		0x9413 },
 	{ "false_carrier_events_count",		0x9414 },
+	{ "signal_mean_square_error_a",		0x8402,	0,	true },
+	{ "signal_mean_square_error_b",		0x8403,	0,	true },
+	{ "signal_mean_square_error_c",		0x8404,	0,	true },
+	{ "signal_mean_square_error_d",		0x8405,	0,	true },
 };
 
 /**
@@ -757,7 +762,10 @@ static u64 adin_get_stat(struct phy_device *phydev, int i)
 		val = (ret & 0xffff);
 	}
 
-	priv->stats[i] += val;
+	if (stat->do_not_accumulate)
+		priv->stats[i] = val;
+	else
+		priv->stats[i] += val;
 
 	return priv->stats[i];
 }
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] net: phy: adin: add signal mean square error registers to phy-stats
  2020-12-03  8:07 [PATCH] net: phy: adin: add signal mean square error registers to phy-stats Alexandru Ardelean
@ 2020-12-03 14:16 ` Andrew Lunn
  2020-12-03 14:33   ` Ardelean, Alexandru
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Lunn @ 2020-12-03 14:16 UTC (permalink / raw)
  To: Alexandru Ardelean
  Cc: netdev, linux-kernel, hkallweit1, linux, davem, kuba,
	catherine.redmond, brian.murray, danail.baylov, maurice.obrien

On Thu, Dec 03, 2020 at 10:07:19AM +0200, Alexandru Ardelean wrote:
> When the link is up on the ADIN1300/ADIN1200, the signal quality on each
> pair is indicated in the mean square error register for each pair (MSE_A,
> MSE_B, MSE_C, and MSE_D registers, Address 0x8402 to Address 0x8405,
> Bits[7:0]).
> 
> These values can be useful for some industrial applications.
> 
> This change implements support for these registers using the PHY
> statistics mechanism.

There was a discussion about values like these before. If i remember
correctly, it was for a BroadReach PHY. I thought we decided to add
them to the link state information?

Ah, found it.

commit 68ff5e14759e7ac1aac7bc75ac5b935e390fa2b3
Author: Oleksij Rempel <linux@rempel-privat.de>
Date:   Wed May 20 08:29:15 2020 +0200

    net: phy: tja11xx: add SQI support

and

ommit 8066021915924f58ed338bf38208215f5a7355f6
Author: Oleksij Rempel <linux@rempel-privat.de>
Date:   Wed May 20 08:29:14 2020 +0200

    ethtool: provide UAPI for PHY Signal Quality Index (SQI)

Can you convert your MSE into SQI?

    Andrew

^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: [PATCH] net: phy: adin: add signal mean square error registers to phy-stats
  2020-12-03 14:16 ` Andrew Lunn
@ 2020-12-03 14:33   ` Ardelean, Alexandru
  0 siblings, 0 replies; 3+ messages in thread
From: Ardelean, Alexandru @ 2020-12-03 14:33 UTC (permalink / raw)
  To: Andrew Lunn
  Cc: netdev, linux-kernel, hkallweit1, linux, davem, kuba, Redmond,
	Catherine, Murray, Brian, Baylov, Danail, OBrien, Maurice



> -----Original Message-----
> From: Andrew Lunn <andrew@lunn.ch>
> Sent: Thursday, December 3, 2020 4:16 PM
> To: Ardelean, Alexandru <alexandru.Ardelean@analog.com>
> Cc: netdev@vger.kernel.org; linux-kernel@vger.kernel.org;
> hkallweit1@gmail.com; linux@armlinux.org.uk; davem@davemloft.net;
> kuba@kernel.org; Redmond, Catherine <Catherine.Redmond@analog.com>;
> Murray, Brian <Brian.Murray@analog.com>; Baylov, Danail
> <Danail.Baylov@analog.com>; OBrien, Maurice
> <Maurice.OBrien@analog.com>
> Subject: Re: [PATCH] net: phy: adin: add signal mean square error registers to
> phy-stats
> 
> On Thu, Dec 03, 2020 at 10:07:19AM +0200, Alexandru Ardelean wrote:
> > When the link is up on the ADIN1300/ADIN1200, the signal quality on
> > each pair is indicated in the mean square error register for each pair
> > (MSE_A, MSE_B, MSE_C, and MSE_D registers, Address 0x8402 to Address
> > 0x8405, Bits[7:0]).
> >
> > These values can be useful for some industrial applications.
> >
> > This change implements support for these registers using the PHY
> > statistics mechanism.
> 
> There was a discussion about values like these before. If i remember correctly, it
> was for a BroadReach PHY. I thought we decided to add them to the link state
> information?
> 

Oh, this is new.
I've had this MSE patch lying around in a branch since last year sometime.
Wasn't sure whether to put it in the phy-stats.

> Ah, found it.
> 
> commit 68ff5e14759e7ac1aac7bc75ac5b935e390fa2b3
> Author: Oleksij Rempel <linux@rempel-privat.de>
> Date:   Wed May 20 08:29:15 2020 +0200
> 
>     net: phy: tja11xx: add SQI support
> 
> and
> 
> ommit 8066021915924f58ed338bf38208215f5a7355f6
> Author: Oleksij Rempel <linux@rempel-privat.de>
> Date:   Wed May 20 08:29:14 2020 +0200
> 
>     ethtool: provide UAPI for PHY Signal Quality Index (SQI)
> 
> Can you convert your MSE into SQI?

I'll take a look and try to understand the SQI spec.
It's neat that there's a common place where to put this.

Thanks
Alex

> 
>     Andrew

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-12-03 14:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-03  8:07 [PATCH] net: phy: adin: add signal mean square error registers to phy-stats Alexandru Ardelean
2020-12-03 14:16 ` Andrew Lunn
2020-12-03 14:33   ` Ardelean, Alexandru

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