From: Raju Lakkaraju <Raju.Lakkaraju@microchip.com>
To: Jakub Kicinski <kuba@kernel.org>
Cc: <netdev@vger.kernel.org>, <davem@davemloft.net>,
<linux-kernel@vger.kernel.org>, <Bryan.Whitehead@microchip.com>,
<edumazet@google.com>, <pabeni@redhat.com>,
<UNGLinuxDriver@microchip.com>
Subject: Re: [PATCH net-next V4] net: lan743x: Add support to SGMII register dump for PCI11010/PCI11414 chips
Date: Mon, 31 Oct 2022 12:23:36 +0530 [thread overview]
Message-ID: <20221031065336.GB8441@raju-project-pc> (raw)
In-Reply-To: <20221019164344.52cf16dd@kernel.org>
Hi Jakub,
Thank you for review comments.
The 10/19/2022 16:43, Jakub Kicinski wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
>
> On Tue, 18 Oct 2022 11:44:25 +0530 Raju Lakkaraju wrote:
> > Add support to SGMII register dump
>
> > +++ b/drivers/net/ethernet/microchip/lan743x_ethtool.c
> > @@ -24,6 +24,9 @@
> > #define LOCK_TIMEOUT_MAX_CNT (100) // 1 sec (10 msce * 100)
> >
> > #define LAN743X_CSR_READ_OP(offset) lan743x_csr_read(adapter, offset)
> > +#define VSPEC1 MDIO_MMD_VEND1
> > +#define VSPEC2 MDIO_MMD_VEND2
> > +#define SGMII_RD(adp, dev, adr) lan743x_sgmii_dump_read(adp, dev, adr)
>
> These defines help limit the line length?
> Please don't obfuscate code like that, see below.
>
Accepted. I will remove the above code.
> > +static void lan743x_sgmii_regs(struct net_device *dev, void *p)
> > +{
> > + struct lan743x_adapter *adp = netdev_priv(dev);
> > + u32 *rb = p;
> > +
> > + rb[ETH_SR_VSMMD_DEV_ID1] = SGMII_RD(adp, VSPEC1, 0x0002);
> > + rb[ETH_SR_VSMMD_DEV_ID2] = SGMII_RD(adp, VSPEC1, 0x0003);
> > + rb[ETH_SR_VSMMD_PCS_ID1] = SGMII_RD(adp, VSPEC1, 0x0004);
> > + rb[ETH_SR_VSMMD_PCS_ID2] = SGMII_RD(adp, VSPEC1, 0x0005);
> > + rb[ETH_SR_VSMMD_STS] = SGMII_RD(adp, VSPEC1, 0x0008);
> > + rb[ETH_SR_VSMMD_CTRL] = SGMII_RD(adp, VSPEC1, 0x0009);
> > + rb[ETH_SR_MII_CTRL] = SGMII_RD(adp, VSPEC2, 0x0000);
> > + rb[ETH_SR_MII_STS] = SGMII_RD(adp, VSPEC2, 0x0001);
> > + rb[ETH_SR_MII_DEV_ID1] = SGMII_RD(adp, VSPEC2, 0x0002);
> > + rb[ETH_SR_MII_DEV_ID2] = SGMII_RD(adp, VSPEC2, 0x0003);
> > + rb[ETH_SR_MII_AN_ADV] = SGMII_RD(adp, VSPEC2, 0x0004);
> > + rb[ETH_SR_MII_LP_BABL] = SGMII_RD(adp, VSPEC2, 0x0005);
> > + rb[ETH_SR_MII_EXPN] = SGMII_RD(adp, VSPEC2, 0x0006);
> > + rb[ETH_SR_MII_EXT_STS] = SGMII_RD(adp, VSPEC2, 0x000F);
> > + rb[ETH_SR_MII_TIME_SYNC_ABL] = SGMII_RD(adp, VSPEC2, 0x0708);
> > + rb[ETH_SR_MII_TIME_SYNC_TX_MAX_DLY_LWR] = SGMII_RD(adp, VSPEC2, 0x0709);
>
> You can declare a structure holding the params and save the info there:
>
> struct {
> u8 id;
> u8 dev;
> u16 addr;
> } regs[] = {
> { ETH_SR_MII_TIME_SYNC_TX_MAX_DLY_LWR, MDIO_MMD_VEND2, 0x0709 },
> };
>
> that should fit on the line.
O.K. I will change.
>
> You can then read the values in a loop. And inside that loop you can
> handle errors (perhaps avoiding the need for lan743x_sgmii_dump_read()
> which seems rather unnecessary as lan743x_sgmii_read() already prints
> errors).
>
> FWIW I like Andrew's suggestion from v3 to use version as a bitfield, too.
I will implement Andrew's suggestion in my next regdump function patch.
Is it OK ?
--------
Thanks,
Raju
next prev parent reply other threads:[~2022-10-31 6:54 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-18 6:14 [PATCH net-next V4] net: lan743x: Add support to SGMII register dump for PCI11010/PCI11414 chips Raju Lakkaraju
2022-10-19 23:43 ` Jakub Kicinski
2022-10-31 6:53 ` Raju Lakkaraju [this message]
2022-10-31 23:41 ` Jakub Kicinski
2022-10-20 0:20 ` Vladimir Oltean
2022-10-31 6:43 ` Raju Lakkaraju
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=20221031065336.GB8441@raju-project-pc \
--to=raju.lakkaraju@microchip.com \
--cc=Bryan.Whitehead@microchip.com \
--cc=UNGLinuxDriver@microchip.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--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