From: Joe Damato <jdamato@fastly.com>
To: Sanman Pradhan <sanman.p211993@gmail.com>
Cc: netdev@vger.kernel.org, alexanderduyck@fb.com, kuba@kernel.org,
kernel-team@meta.com, davem@davemloft.net, edumazet@google.com,
pabeni@redhat.com, horms@kernel.org, corbet@lwn.net,
mohsin.bashr@gmail.com, sanmanpradhan@meta.com,
andrew+netdev@lunn.ch, vadim.fedorenko@linux.dev,
sdf@fomichev.me, linux-doc@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next] eth: fbnic: Add PCIe hardware statistics
Date: Tue, 5 Nov 2024 16:49:19 -0800 [thread overview]
Message-ID: <Zyq9D1WCvuykHsUv@LQ3V64L9R2> (raw)
In-Reply-To: <20241106002625.1857904-1-sanman.p211993@gmail.com>
On Tue, Nov 05, 2024 at 04:26:25PM -0800, Sanman Pradhan wrote:
> Add PCIe hardware statistics support to the fbnic driver. These stats
> provide insight into PCIe transaction performance and error conditions,
> including, read/write and completion TLP counts and DWORD counts and
> debug counters for tag, completion credit and NP credit exhaustion
The second sentence is long and doesn't have a period at the end of
it. Maybe break it up a bit into a set of shorter sentences or a
list or something like that?
> The stats are exposed via ethtool and can be used to monitor PCIe
> performance and debug PCIe issues.
>
> Signed-off-by: Sanman Pradhan <sanman.p211993@gmail.com>
> ---
> .../device_drivers/ethernet/meta/fbnic.rst | 27 +++++
> drivers/net/ethernet/meta/fbnic/fbnic.h | 1 +
> drivers/net/ethernet/meta/fbnic/fbnic_csr.h | 39 ++++++
> .../net/ethernet/meta/fbnic/fbnic_ethtool.c | 77 +++++++++++-
> .../net/ethernet/meta/fbnic/fbnic_hw_stats.c | 114 ++++++++++++++++++
> .../net/ethernet/meta/fbnic/fbnic_hw_stats.h | 17 +++
> .../net/ethernet/meta/fbnic/fbnic_netdev.c | 3 +
> drivers/net/ethernet/meta/fbnic/fbnic_pci.c | 2 +
> 8 files changed, 278 insertions(+), 2 deletions(-)
[...]
> diff --git a/drivers/net/ethernet/meta/fbnic/fbnic_ethtool.c b/drivers/net/ethernet/meta/fbnic/fbnic_ethtool.c
> index 1117d5a32867..9f590a42a9df 100644
> --- a/drivers/net/ethernet/meta/fbnic/fbnic_ethtool.c
> +++ b/drivers/net/ethernet/meta/fbnic/fbnic_ethtool.c
> @@ -6,6 +6,39 @@
[...]
> +
> +#define FBNIC_HW_FIXED_STATS_LEN ARRAY_SIZE(fbnic_gstrings_hw_stats)
> +#define FBNIC_HW_STATS_LEN \
> + (FBNIC_HW_FIXED_STATS_LEN)
Does the above need to be on a separate line? Might be able to fit
in under 80 chars?
> static int
> fbnic_get_ts_info(struct net_device *netdev,
> struct kernel_ethtool_ts_info *tsinfo)
> @@ -51,6 +84,43 @@ static void fbnic_set_counter(u64 *stat, struct fbnic_stat_counter *counter)
> *stat = counter->value;
> }
>
> +static void fbnic_get_strings(struct net_device *dev, u32 sset, u8 *data)
> +{
> + int i;
> +
> + switch (sset) {
> + case ETH_SS_STATS:
> + for (i = 0; i < FBNIC_HW_STATS_LEN; i++)
> + ethtool_puts(&data, fbnic_gstrings_hw_stats[i].string);
> + break;
> + }
> +}
> +
> +static int fbnic_get_sset_count(struct net_device *dev, int sset)
> +{
> + switch (sset) {
> + case ETH_SS_STATS:
> + return FBNIC_HW_STATS_LEN;
> + default:
> + return -EOPNOTSUPP;
> + }
> +}
> +
> +static void fbnic_get_ethtool_stats(struct net_device *dev,
> + struct ethtool_stats *stats, u64 *data)
> +{
> + struct fbnic_net *fbn = netdev_priv(dev);
> + const struct fbnic_stat *stat;
> + int i;
> +
> + fbnic_get_hw_stats(fbn->fbd);
> +
> + for (i = 0; i < FBNIC_HW_STATS_LEN; i++) {
> + stat = &fbnic_gstrings_hw_stats[i];
> + data[i] = *(u64 *)((u8 *)&fbn->fbd->hw_stats + stat->offset);
> + }
> +}
> +
> static void
> fbnic_get_eth_mac_stats(struct net_device *netdev,
> struct ethtool_eth_mac_stats *eth_mac_stats)
> @@ -117,10 +187,13 @@ static void fbnic_get_ts_stats(struct net_device *netdev,
> }
>
> static const struct ethtool_ops fbnic_ethtool_ops = {
> - .get_drvinfo = fbnic_get_drvinfo,
> .get_ts_info = fbnic_get_ts_info,
> - .get_ts_stats = fbnic_get_ts_stats,
> + .get_drvinfo = fbnic_get_drvinfo,
> + .get_strings = fbnic_get_strings,
> + .get_sset_count = fbnic_get_sset_count,
> + .get_ethtool_stats = fbnic_get_ethtool_stats,
> .get_eth_mac_stats = fbnic_get_eth_mac_stats,
> + .get_ts_stats = fbnic_get_ts_stats,
> };
Seems like the two deleted lines were just re-ordered but otherwise
unchanged?
I don't think it's any reason to hold this back, but limiting
changes like that in the future is probably a good idea because it
makes the diff smaller and easier to review.
next prev parent reply other threads:[~2024-11-06 0:49 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-06 0:26 [PATCH net-next] eth: fbnic: Add PCIe hardware statistics Sanman Pradhan
2024-11-06 0:43 ` Jakub Kicinski
2024-11-06 0:49 ` Joe Damato [this message]
2024-11-07 2:14 ` Sanman Pradhan
2024-11-06 12:22 ` Leon Romanovsky
2024-11-06 17:12 ` Bjorn Helgaas
2024-11-06 17:36 ` Andrew Lunn
2024-11-07 0:09 ` Jakub Kicinski
2024-11-07 8:23 ` Leon Romanovsky
2024-11-07 11:30 ` Vadim Fedorenko
2024-11-07 12:03 ` Leon Romanovsky
2024-11-07 15:40 ` Jakub Kicinski
2024-11-07 16:42 ` Leon Romanovsky
2024-11-06 17:50 ` Leon Romanovsky
2024-11-06 21:17 ` Bjorn Helgaas
2024-11-07 8:11 ` Leon Romanovsky
2024-11-06 17:32 ` Andrew Lunn
2024-11-07 2:16 ` Sanman Pradhan
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=Zyq9D1WCvuykHsUv@LQ3V64L9R2 \
--to=jdamato@fastly.com \
--cc=alexanderduyck@fb.com \
--cc=andrew+netdev@lunn.ch \
--cc=corbet@lwn.net \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=kernel-team@meta.com \
--cc=kuba@kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mohsin.bashr@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=sanman.p211993@gmail.com \
--cc=sanmanpradhan@meta.com \
--cc=sdf@fomichev.me \
--cc=vadim.fedorenko@linux.dev \
/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