From: Raju Lakkaraju <Raju.Lakkaraju@microchip.com>
To: Andrew Lunn <andrew@lunn.ch>
Cc: <netdev@vger.kernel.org>, <davem@davemloft.net>,
<kuba@kernel.org>, <linux-kernel@vger.kernel.org>,
<bryan.whitehead@microchip.com>, <edumazet@google.com>,
<pabeni@redhat.com>, <UNGLinuxDriver@microchip.com>
Subject: Re: [PATCH net-next V3] net: lan743x: Add support to SGMII register dump for PCI11010/PCI11414 chips
Date: Wed, 12 Oct 2022 10:32:52 +0530 [thread overview]
Message-ID: <20221012050252.GA70729@raju-project-pc> (raw)
In-Reply-To: <Y0R0B0sOzjOTIM66@lunn.ch>
Hi Andrew,
Thank you for review comments.
The 10/10/2022 21:35, Andrew Lunn wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
>
> > static int lan743x_get_regs_len(struct net_device *dev)
> > {
> > - return MAX_LAN743X_ETH_REGS * sizeof(u32);
> > + struct lan743x_adapter *adapter = netdev_priv(dev);
> > + u32 num_regs = MAX_LAN743X_ETH_COMMON_REGS;
> > +
> > + if (adapter->is_sgmii_en)
> > + num_regs += MAX_LAN743X_ETH_SGMII_REGS;
> > +
> > + return num_regs * sizeof(u32);
> > }
> >
> > static void lan743x_get_regs(struct net_device *dev,
> > struct ethtool_regs *regs, void *p)
> > {
> > + struct lan743x_adapter *adapter = netdev_priv(dev);
> > + int regs_len;
> > +
> > + regs_len = lan743x_get_regs_len(dev);
> > + memset(p, 0, regs_len);
> > +
> > regs->version = LAN743X_ETH_REG_VERSION;
> > + regs->len = regs_len;
> > +
> > + lan743x_common_regs(dev, p);
> > + p = (u32 *)p + MAX_LAN743X_ETH_COMMON_REGS;
> >
> > - lan743x_common_regs(dev, regs, p);
> > + if (adapter->is_sgmii_en) {
> > + lan743x_sgmii_regs(dev, p);
> > + p = (u32 *)p + MAX_LAN743X_ETH_SGMII_REGS;
> > + }
>
> This seems O.K. for the moment, but how does it work when you add the
> next set of optional registers? Say you want to add the PTP registers?
Yes.
For other modules (i.e. PTP etc) register dumps, i would like
implement ethtool -w/-W option to configure dump flag.
Existing private flag use for EEPROM/OTP access which we don't use same
flag for register dumps to avoid accidental changes which may damage
EEPROM/OTP sensitive data.
>
> One idea might be to use the LAN743X_ETH_REG_VERSION as a
> bitfield. Bit 0 indicates the common registers are present. Bit 1
> indicates the SGMII registers are present. Bit 2 is for whatever next
> set of optional registers you add, say PTP.
OK.
Otherwise, I will create LAN743X_ETH_REG_FLAGS and follow your
suggestion.
>
> Andrew
--------
Thanks,
Raju
prev parent reply other threads:[~2022-10-12 5:03 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-03 10:38 [PATCH net-next V3] net: lan743x: Add support to SGMII register dump for PCI11010/PCI11414 chips Raju Lakkaraju
2022-10-04 0:31 ` Jakub Kicinski
2022-10-10 19:35 ` Andrew Lunn
2022-10-12 5:02 ` Raju Lakkaraju [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=20221012050252.GA70729@raju-project-pc \
--to=raju.lakkaraju@microchip.com \
--cc=UNGLinuxDriver@microchip.com \
--cc=andrew@lunn.ch \
--cc=bryan.whitehead@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;
as well as URLs for NNTP newsgroup(s).