From: <Divya.Koppera@microchip.com>
To: <andrew@lunn.ch>
Cc: <hkallweit1@gmail.com>, <linux@armlinux.org.uk>,
<davem@davemloft.net>, <edumazet@google.com>, <kuba@kernel.org>,
<pabeni@redhat.com>, <netdev@vger.kernel.org>,
<linux-kernel@vger.kernel.org>, <UNGLinuxDriver@microchip.com>
Subject: RE: [PATCH v2 net-next] net: phy: micrel: Adding SQI support for lan8814 phy
Date: Tue, 6 Sep 2022 10:41:33 +0000 [thread overview]
Message-ID: <CO1PR11MB47712E1FAE109EEF5E502C5FE27E9@CO1PR11MB4771.namprd11.prod.outlook.com> (raw)
In-Reply-To: <YxX1I6wBFjzID2Ls@lunn.ch>
Hi Andrew,
> -----Original Message-----
> From: Andrew Lunn <andrew@lunn.ch>
> Sent: Monday, September 5, 2022 6:40 PM
> To: Divya Koppera - I30481 <Divya.Koppera@microchip.com>
> Cc: hkallweit1@gmail.com; linux@armlinux.org.uk; davem@davemloft.net;
> edumazet@google.com; kuba@kernel.org; pabeni@redhat.com;
> netdev@vger.kernel.org; linux-kernel@vger.kernel.org; UNGLinuxDriver
> <UNGLinuxDriver@microchip.com>
> Subject: Re: [PATCH v2 net-next] net: phy: micrel: Adding SQI support for
> lan8814 phy
>
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the
> content is safe
>
> On Mon, Sep 05, 2022 at 03:47:30PM +0530, Divya Koppera wrote:
> > Supports SQI(Signal Quality Index) for lan8814 phy, where it has SQI
> > index of 0-7 values and this indicator can be used for cable integrity
> > diagnostic and investigating other noise sources. It is not supported
> > for 10Mbps speed
> >
> > Signed-off-by: Divya Koppera <Divya.Koppera@microchip.com>
> > ---
> > v1 -> v2
> > - Given SQI support for all pairs of wires in 1000/100 base-T phy's
> > uAPI may run through all instances in future. At present returning
> > only first instance as uAPI supports for only 1 pair.
> > - SQI is not supported for 10Mbps speed, handled accordingly.
>
> I would prefer you solve the problem of returning all pairs.
>
I will try to improve uAPI.
The other way I can try is the point you mentioned below to write helper with pair number and having function cal with pair 0.
> I'm not sure how useful the current implementation is, especially at
> 100Mbps, where pair 0 could actually be the transmit pair. Does it give a
> sensible value in that case?
>
We do have SQI support for 100Mbps to pair 0 only. For other pairs SQI values are invalid values.
> > +static int lan8814_get_sqi(struct phy_device *phydev) {
> > + int ret, val, pair;
> > + int sqi_val[4];
> > +
> > + if (phydev->speed == SPEED_10)
> > + return -EOPNOTSUPP;
> > +
> > + for (pair = 0; pair < 4; pair++) {
> > + val = lanphy_read_page_reg(phydev, 1, LAN8814_DCQ_CTRL);
> > + if (val < 0)
> > + return val;
> > +
> > + val &= ~LAN8814_DCQ_CTRL_CHANNEL_MASK;
> > + val |= pair;
> > + val |= LAN8814_DCQ_CTRL_READ_CAPTURE_;
> > + ret = lanphy_write_page_reg(phydev, 1, LAN8814_DCQ_CTRL, val);
> > + if (ret < 0)
> > + return ret;
> > +
> > + ret = lanphy_read_page_reg(phydev, 1, LAN8814_DCQ_SQI);
> > + if (ret < 0)
> > + return ret;
> > +
> > + sqi_val[pair] = FIELD_GET(LAN8814_DCQ_SQI_VAL_MASK, ret);
> > + }
> > +
> > + return *sqi_val;
>
> How is this going to work in the future? sqi_val is on the stack. You cannot
> return a pointer to it. So this function is going to need modifications.
>
> If you really want to prepare for a future implementation which could return
> all four, i would probably make this a helper which takes a pair number. And
> then have a function call it once for pair 0.
>
I Will go for resolving this if I couldn't resolve that 4 pair issue in uAPI.
> Andrew
Thanks,
Divya
next prev parent reply other threads:[~2022-09-06 10:41 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-05 10:17 [PATCH v2 net-next] net: phy: micrel: Adding SQI support for lan8814 phy Divya Koppera
2022-09-05 13:09 ` Andrew Lunn
2022-09-06 10:41 ` Divya.Koppera [this message]
2022-09-06 14:02 ` Andrew Lunn
2022-09-07 9:30 ` Oleksij Rempel
2022-09-07 10:52 ` Divya.Koppera
2022-09-07 9:07 ` Michael Walle
2022-09-07 9:24 ` Divya.Koppera
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=CO1PR11MB47712E1FAE109EEF5E502C5FE27E9@CO1PR11MB4771.namprd11.prod.outlook.com \
--to=divya.koppera@microchip.com \
--cc=UNGLinuxDriver@microchip.com \
--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=linux@armlinux.org.uk \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.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).