From patchwork Thu Dec 1 18:00:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hariprasad Kelam X-Patchwork-Id: 28491 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp412228wrr; Thu, 1 Dec 2022 10:13:26 -0800 (PST) X-Google-Smtp-Source: AA0mqf7REVZCH/LD+5jahbXHuh77nCiqqRvhR9h6NA8k8R6PBeTpWZsUj2Ooc0sgz35S96IgwwIF X-Received: by 2002:a17:906:1ecf:b0:7ad:902c:d1d6 with SMTP id m15-20020a1709061ecf00b007ad902cd1d6mr44787946ejj.143.1669918406478; Thu, 01 Dec 2022 10:13:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669918406; cv=none; d=google.com; s=arc-20160816; b=nYOoorj5y+oJ2Qhnwyvl1c7hMzXEwtoHmXe7TpcYdb0wcbPhZByO4kZPXywd5ltwZ3 OWWg9mbxQmKuo1f3veBd8Pekz/wLPeT+O8Uyx136nUmgARrEctqF9wk6OXB5Nj2eHXiO rhysIYHZVfN3Bcx1pwtDXJM2OjjEkspAYoPq7jvVtM9dGgmj0gokjTwKT0ykh08cLOWn UjizUAeRm2q+UJ13uBxbGQYLyY+dZsD7Cb4x9CWYAZb1Pg2dccrCRT8uSmbbrw1IOPOa bP+1BYPppe9fZzshLpsX/73FOD8+6vWGY5Ctql43N3L3LxvT+4R/jEjrF8VT26BjXXJ9 bXKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=Rh0uSF8TsggV3/DnlXbmQAucA+aHg5lIDmniZ0MoirU=; b=JI2EF3vYVW9G/pUWrk+EhzXiHS13gAfyC8M1KSlWWIcFeDFSSQiRZflCY3kid4JjOm r3OqEO1sBJH1cbGtiYeWUKi5rqOfsKoIc/yTLp/pglp/IGg00DT1bsOkWQ29ZX5tHzA/ ktk28X2RS3ihJTo5NJyyprC4yO5zBxf/a6tqX3ahbeFT/UeLyoFEFr0GSPPwEFbh9I2n t/Vq1SOcHM6RTATwcylwqCGRh8XKP0tS6YHoU1E1oC3zTiXTTNFiZIceQ6p2Exv4ihPh M7UGX8crZ5IQlPnxVpgQBGidjVjY7Vx7Yq3Mm96/bA7jJNUcEDCLQv/E5NFDEa5Wp34K qPxQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=gXYSDqF2; 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=REJECT dis=NONE) header.from=marvell.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qf34-20020a1709077f2200b0070fc7c9d71dsi4887173ejc.989.2022.12.01.10.13.02; Thu, 01 Dec 2022 10:13:26 -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=@marvell.com header.s=pfpt0220 header.b=gXYSDqF2; 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=REJECT dis=NONE) header.from=marvell.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231245AbiLASCD (ORCPT + 99 others); Thu, 1 Dec 2022 13:02:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54882 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230440AbiLASBR (ORCPT ); Thu, 1 Dec 2022 13:01:17 -0500 Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7E35AB5D9F; Thu, 1 Dec 2022 10:01:10 -0800 (PST) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 2B1DtgiH024643; Thu, 1 Dec 2022 10:00:58 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=pfpt0220; bh=Rh0uSF8TsggV3/DnlXbmQAucA+aHg5lIDmniZ0MoirU=; b=gXYSDqF2CCJUX83EqGgoGa5onvVydy49NplxI4zPjWV2FNbo/KQijE+oVegRfKBS6VyU gLE5fyruf8wFrc1OhArgw+qXuW1Xu2X8FfuAojX296IvOj1OkiRjd8IheH7imw+l4+4i iqckigL3v8WU6QRApxlryyqubsQ3MQO/dP4fFmZrimuV0o/8LvVfz6uyqTKBR8+3AgYp aa3x/eZEWqCvqCdsvgH5T+pCiFtU+5+g6NlV9HvhePNOdN6oUNUe33Br7/2H3Z+jnOEb 5wI38ZDQhfyPCC74oEOc6igcnBpG6gtBfuEsjfyrnvWstKLs6X9eaHO8OKCMP5R28Jgw ng== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3m6k8k2xms-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Thu, 01 Dec 2022 10:00:57 -0800 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 1 Dec 2022 10:00:55 -0800 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Thu, 1 Dec 2022 10:00:55 -0800 Received: from hyd1soter3.marvell.com (unknown [10.29.37.12]) by maili.marvell.com (Postfix) with ESMTP id B686E5B6921; Thu, 1 Dec 2022 10:00:52 -0800 (PST) From: Hariprasad Kelam To: , CC: , , , , , , , , Subject: [net-next PATCH v3 3/4] octeontx2-pf: ethtool: Implement get_fec_stats Date: Thu, 1 Dec 2022 23:30:39 +0530 Message-ID: <20221201180040.14147-4-hkelam@marvell.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20221201180040.14147-1-hkelam@marvell.com> References: <20221201180040.14147-1-hkelam@marvell.com> MIME-Version: 1.0 X-Proofpoint-GUID: 3QMJ-HFO5DXDwQJfzr-loui81ewIto1l X-Proofpoint-ORIG-GUID: 3QMJ-HFO5DXDwQJfzr-loui81ewIto1l X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.923,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-12-01_12,2022-12-01_01,2022-06-22_01 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE, SPF_NONE 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1751036362737254843?= X-GMAIL-MSGID: =?utf-8?q?1751036362737254843?= 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(+) -- 2.17.1 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 && + !otx2_get_phy_fec_stats(pfvf)) { + /* Fetch fwdata again because it's been recently populated with + * latest PHY FEC stats. + */ + rsp = otx2_get_fwdata(pfvf); + if (!IS_ERR(rsp)) { + struct fec_stats_s *p = &rsp->fwdata.phy.fec_stats; + + if (pfvf->linfo.fec == OTX2_FEC_BASER) { + fec_stats->corrected_blocks.total = + p->brfec_corr_blks; + fec_stats->uncorrectable_blocks.total = + p->brfec_uncorr_blks; + } else { + fec_stats->corrected_blocks.total = + p->rsfec_corr_cws; + fec_stats->uncorrectable_blocks.total = + p->rsfec_uncorr_cws; + } + } + } else { + /* 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; + } +} + 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,