Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp4557734rwb; Sun, 4 Dec 2022 04:22:29 -0800 (PST) X-Google-Smtp-Source: AA0mqf4M539DJ1R2Yp/R/kISnA953GcBH0bkdI/j77bUr48m3hlpkYNEbmbgFFwMEBWCao1NX3NR X-Received: by 2002:a17:90a:4283:b0:218:4953:58aa with SMTP id p3-20020a17090a428300b00218495358aamr90381854pjg.219.1670156548935; Sun, 04 Dec 2022 04:22:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670156548; cv=none; d=google.com; s=arc-20160816; b=qhY6dQHeOcphE1/X5pT5zgkTDM9uO0d7pPKowsLhoWyffrV1VmLAh/2AtohMJ8iZvW 7nQ9L7Fcc7MQpyeYcFt+MZDJQoOBX4fOW0HfhAIZBiE2HXJce/bv5I6i31bCnBIdT93W wiJ0VH19OrtB8JdiEbhApt3aDXgLoxmRVEJ3UqDHQkX9dTk+Y0W8zGrPmgZOldFCSIZC /YylJfMHoQpwXzrRJdeoVYVb+vW5jy+bNC8lMzDoJkpT1GHl7iEkrEcLpvrgreVJ28AG Bu0EacxUaFyFZiVTvYFswGPtaOLmk7Sxp9w5TH/IIxmcZjQ86UlcJDG8PELtTPfLOXVP jj0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=2iMU7dpGRduWPpLdPS4toCPVqTLjmSM3fP7/Vvk1bpc=; b=D6igrP1RF45f3CeGJo37z9KW9hGRlvH+AXXgmVsU/dJKys84Y768c9L2hRmekwEL4N DLV2VxDXQuEuFCsFadD14Fx8AxbKUMT2WGEomQCbeWPmxoTBBqenQObximbw5ts5DP+P VuZv1byjtm65QfzmYrzVys7cL8Q6caA4AXnYj/POnmdFQhA9sRZdocIudjJZMRuygVCQ SZ4QmQlRN3O842i+hFp3ertLiEGor30qbkA5NeXyGFeLfUIth4u6+L3E5RoUlZOvPtiN xnoGwUYN7aS0eOls3tUb4JtdVQVvkxC4sJnTlqW6t9IAjQQU0nc4Gpkiv9OgO2Ph1Yjr bGFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=C2zy5GDv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t191-20020a6381c8000000b00478701e57c8si10890784pgd.807.2022.12.04.04.22.18; Sun, 04 Dec 2022 04:22:28 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=C2zy5GDv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230035AbiLDMBA (ORCPT + 82 others); Sun, 4 Dec 2022 07:01:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52900 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229931AbiLDMA6 (ORCPT ); Sun, 4 Dec 2022 07:00:58 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 07738167C4; Sun, 4 Dec 2022 04:00:57 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 8644660E86; Sun, 4 Dec 2022 12:00:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 28FCEC433C1; Sun, 4 Dec 2022 12:00:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1670155255; bh=7ZBhcByRZURXAJtuoohSKpSN7w7r+pDtXMuFv7/SXck=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=C2zy5GDvR5wgiCyuU6baPTJV+LaYMCeYKbXL8j8ras1i4cGscatkctQ94EiCBPEt9 CfKWf5v2nWHXgVwjtRtp1ModbUlrlX1uVPcezXXOda3erhNk6WMIOkBMIXqz2Svlm/ 3y+Amk5rRoyynsoYgBzAAS5pcs2wapFNdgAmKdtNRn7uaiWxyEhocY1NEdHJhzmp6L vSu7gfauoWd7RswdpxMPCmN7YsP5aKGwfjFtdn5QCPY1rbWflCcDSBpbqcqSQxFz6D pu4iljpvLOpOelq8/4DzMnrM+AnT4tBHyxQ1UlmjnN78gJI0mMrFuhSyuLV+tzZmdi ZghmOJh3Z73/w== Date: Sun, 4 Dec 2022 14:00:48 +0200 From: Leon Romanovsky To: Hariprasad Kelam 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 Message-ID: References: <20221201180040.14147-1-hkelam@marvell.com> <20221201180040.14147-4-hkelam@marvell.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221201180040.14147-4-hkelam@marvell.com> X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > Signed-off-by: Sunil Kovvuri Goutham > --- > 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