From patchwork Wed Apr 14 03:44:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Kicinski X-Patchwork-Id: 421607 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, 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 88A5DC433B4 for ; Wed, 14 Apr 2021 03:45:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6C2F861154 for ; Wed, 14 Apr 2021 03:45:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347092AbhDNDpg (ORCPT ); Tue, 13 Apr 2021 23:45:36 -0400 Received: from mail.kernel.org ([198.145.29.99]:34418 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346963AbhDNDpZ (ORCPT ); Tue, 13 Apr 2021 23:45:25 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id E44C3613C4; Wed, 14 Apr 2021 03:45:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1618371904; bh=Tpta5X+xuSC6ObVpocfefy1XFdyBOdjLqcRTiOU08X4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QewgppHXrb1s4D+JH3eXF62JKWUOAV6BFZZfoBpHDs15i73vdDcPofbNfzJBknVjT 1sBtPPnHdv4KvjOwgEKPIDHFKc6fhCZXv3CqV9woDV3jXqqNSPyfmvmUzDFXPZKR+5 YmAGxteYeTTFUcanAIDlTV0ufCb6F+sltW51E33YMPmXfeGHNEO75VY7Rec6P3xDrA tWFgqzmEbBGNVXDjqWvEEkD8k36PzjyDw9t5kyT1e5ckpKUvn40s5pGJEegzqIGJ9P e8BU3fCYgiI1avI9boEbvJZEdPxKqlpfpDbIMbprIbb3wL2iXDNZhavEw/GTI90WsP uhExcCrebAQWQ== 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 4/6] bnxt: implement ethtool::get_fec_stats Date: Tue, 13 Apr 2021 20:44:52 -0700 Message-Id: <20210414034454.1970967-5-kuba@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210414034454.1970967-1-kuba@kernel.org> References: <20210414034454.1970967-1-kuba@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.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,