netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Leon Romanovsky <leon@kernel.org>
To: Hariprasad Kelam <hkelam@marvell.com>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	kuba@kernel.org, davem@davemloft.net, pabeni@redhat.com,
	edumazet@google.com, sgoutham@marvell.com, lcherian@marvell.com,
	gakula@marvell.com, jerinj@marvell.com, sbhatta@marvell.com
Subject: Re: [net-next PATCH v3 3/4] octeontx2-pf: ethtool: Implement get_fec_stats
Date: Sun, 4 Dec 2022 14:00:48 +0200	[thread overview]
Message-ID: <Y4yL8OxbsgWdmhD4@unreal> (raw)
In-Reply-To: <20221201180040.14147-4-hkelam@marvell.com>

On Thu, Dec 01, 2022 at 11:30:39PM +0530, Hariprasad Kelam wrote:
> This patch registers a callback for get_fec_stats such that
> FEC stats can be queried from the below command
> 
> "ethtool -I --show-fec eth0"
> 
> Signed-off-by: Hariprasad Kelam <hkelam@marvell.com>
> Signed-off-by: Sunil Kovvuri Goutham <sgoutham@marvell.com>
> ---
> v3 * Dont remove existing FEC stats support over
>      ethtool statistics (ethtool -S)
> 
>  .../marvell/octeontx2/nic/otx2_ethtool.c      | 40 +++++++++++++++++++
>  1 file changed, 40 insertions(+)
> 
> diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c
> index 0eb74e8c553d..85f46e15ac03 100644
> --- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c
> +++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c
> @@ -1268,6 +1268,45 @@ static int otx2_set_link_ksettings(struct net_device *netdev,
>  	return err;
>  }
> 
> +static void otx2_get_fec_stats(struct net_device *netdev,
> +			       struct ethtool_fec_stats *fec_stats)
> +{
> +	struct otx2_nic *pfvf = netdev_priv(netdev);
> +	struct cgx_fw_data *rsp;
> +
> +	otx2_update_lmac_fec_stats(pfvf);
> +
> +	rsp = otx2_get_fwdata(pfvf);
> +	if (!IS_ERR(rsp) && rsp->fwdata.phy.misc.has_fec_stats &&

<...>

> +	} else {

I see that you copied this pattern of call to otx2_get_fwdata() and check
for error from another place. However, that function returns an error
while executing call to HW. I don't know if it is correct thing to
continue as nothing happened.

> +		/* Report MAC FEC stats */
> +		fec_stats->corrected_blocks.total     =
> +			pfvf->hw.cgx_fec_corr_blks;
> +		fec_stats->uncorrectable_blocks.total =
> +			pfvf->hw.cgx_fec_uncorr_blks;

Please don't do vertical alignment of new code. Please use clang formatter
to fix it.

> +	}
> +}
> +
>  static const struct ethtool_ops otx2_ethtool_ops = {
>  	.supported_coalesce_params = ETHTOOL_COALESCE_USECS |
>  				     ETHTOOL_COALESCE_MAX_FRAMES |
> @@ -1298,6 +1337,7 @@ static const struct ethtool_ops otx2_ethtool_ops = {
>  	.get_pauseparam		= otx2_get_pauseparam,
>  	.set_pauseparam		= otx2_set_pauseparam,
>  	.get_ts_info		= otx2_get_ts_info,
> +	.get_fec_stats		= otx2_get_fec_stats,
>  	.get_fecparam		= otx2_get_fecparam,
>  	.set_fecparam		= otx2_set_fecparam,
>  	.get_link_ksettings     = otx2_get_link_ksettings,
> --
> 2.17.1

  reply	other threads:[~2022-12-04 12:03 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-01 18:00 [net-next PATCH v3 0/4] CN10KB MAC block support Hariprasad Kelam
2022-12-01 18:00 ` [net-next PATCH v3 1/4] octeontx2-af: Support variable number of lmacs Hariprasad Kelam
2022-12-01 18:00 ` [net-next PATCH v3 2/4] octeontx2-af: cn10kb: Add RPM_USX MAC support Hariprasad Kelam
2022-12-01 18:00 ` [net-next PATCH v3 3/4] octeontx2-pf: ethtool: Implement get_fec_stats Hariprasad Kelam
2022-12-04 12:00   ` Leon Romanovsky [this message]
2022-12-01 18:00 ` [net-next PATCH v3 4/4] octeontx2-af: Add FEC stats for RPM/RPM_USX block Hariprasad Kelam

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=Y4yL8OxbsgWdmhD4@unreal \
    --to=leon@kernel.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=gakula@marvell.com \
    --cc=hkelam@marvell.com \
    --cc=jerinj@marvell.com \
    --cc=kuba@kernel.org \
    --cc=lcherian@marvell.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=sbhatta@marvell.com \
    --cc=sgoutham@marvell.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).