From patchwork Thu Apr 15 22:53:16 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Kicinski X-Patchwork-Id: 12206239 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 29C31C433ED for ; Thu, 15 Apr 2021 22:53:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0E4CA610FC for ; Thu, 15 Apr 2021 22:53:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237610AbhDOWxz (ORCPT ); Thu, 15 Apr 2021 18:53:55 -0400 Received: from mail.kernel.org ([198.145.29.99]:37570 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237561AbhDOWxq (ORCPT ); Thu, 15 Apr 2021 18:53:46 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 8DB7961132; Thu, 15 Apr 2021 22:53:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1618527203; bh=2IxP4258Tf899maDiwPVmiwXEwAlgUgAPktO56+G6NE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hNzJRknwk8BnQnGS/sqcxYXkxQ83wUY/rPXSmZJj6wFKYQepqMTPJZwLqIllwgls4 C2qvzCZsqNI90UqprBPbUg1T//cJi2ZUqVw0ntAg/aleMPExm9++z+ZbNHHKenopAd zlGijyYEFlBpMbpH9epTdahAbP4EJyso0r//5PzG0PoFL4ReMU2AwPQlVWw9j44n+B 4SZdSFSUZ5nbF5131gpBOieu/ca4mQkg9RMElNkvTCIUHthNP2M/M5i1DDWwyoPeYU b82hnZO6YKDzaTjvE/r6+f0uN50XknIUBik6Vvhbk9EcUyq9t9jt66Ypqp8IMzTBVH TkvTzj4ZUYfnA== From: Jakub Kicinski To: davem@davemloft.net Cc: netdev@vger.kernel.org, michael.chan@broadcom.com, saeedm@nvidia.com, leon@kernel.org, ecree.xilinx@gmail.com, habetsm.xilinx@gmail.com, f.fainelli@gmail.com, andrew@lunn.ch, mkubecek@suse.cz, ariela@nvidia.com, Jakub Kicinski Subject: [PATCH net-next v2 4/6] bnxt: implement ethtool::get_fec_stats Date: Thu, 15 Apr 2021 15:53:16 -0700 Message-Id: <20210415225318.2726095-5-kuba@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210415225318.2726095-1-kuba@kernel.org> References: <20210415225318.2726095-1-kuba@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Report corrected bits. Signed-off-by: Jakub Kicinski Reviewed-by: Michael Chan --- drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c index 2f8b193a772d..7b90357daba1 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c @@ -1930,6 +1930,20 @@ static int bnxt_get_fecparam(struct net_device *dev, return 0; } +static void bnxt_get_fec_stats(struct net_device *dev, + struct ethtool_fec_stats *fec_stats) +{ + struct bnxt *bp = netdev_priv(dev); + u64 *rx; + + if (BNXT_VF(bp) || !(bp->flags & BNXT_FLAG_PORT_STATS_EXT)) + return; + + rx = bp->rx_port_stats_ext.sw_stats; + fec_stats->corrected_bits.total = + *(rx + BNXT_RX_STATS_EXT_OFFSET(rx_corrected_bits)); +} + static u32 bnxt_ethtool_forced_fec_to_fw(struct bnxt_link_info *link_info, u32 fec) { @@ -3991,6 +4005,7 @@ const struct ethtool_ops bnxt_ethtool_ops = { ETHTOOL_COALESCE_USE_ADAPTIVE_RX, .get_link_ksettings = bnxt_get_link_ksettings, .set_link_ksettings = bnxt_set_link_ksettings, + .get_fec_stats = bnxt_get_fec_stats, .get_fecparam = bnxt_get_fecparam, .set_fecparam = bnxt_set_fecparam, .get_pause_stats = bnxt_get_pause_stats,