From patchwork Fri Sep 11 19:52:55 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Kicinski X-Patchwork-Id: 261029 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=-13.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,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 644E1C43461 for ; Fri, 11 Sep 2020 19:53:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2664421D47 for ; Fri, 11 Sep 2020 19:53:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599854019; bh=9mnPGUv9uaaxuD+AUwBraGGLo2itRuGs+sBhGxoa66k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=iFQBt6eJZqwHjS6CBBA2v513SdRunMlB6g56EGyagaXZCZGTBU8ypMfXy8euTgcR+ v351tezaSvIGVVUOd99r5u6wk7iYi7i9szr/K1l2qWIjYgqg4Y/AUImLiLBxF3y5WK 8/AqAyuuZxmutY/JnfgCJitfgV9NMW7FDJd1mT+Y= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725895AbgIKTxg (ORCPT ); Fri, 11 Sep 2020 15:53:36 -0400 Received: from mail.kernel.org ([198.145.29.99]:49376 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725816AbgIKTxK (ORCPT ); Fri, 11 Sep 2020 15:53:10 -0400 Received: from kicinski-fedora-PC1C0HJN.thefacebook.com (unknown [163.114.132.4]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 379AE2220F; Fri, 11 Sep 2020 19:53:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599853989; bh=9mnPGUv9uaaxuD+AUwBraGGLo2itRuGs+sBhGxoa66k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=otMWIVdEZ5t7BCurqde2Q2KuPDgPURvWJWgUPkBuXhmj6Sl5BwqpInLHAeoO9NeJD dKb7qMGkunGa4ete85Rc4onHcgnxTuO273vX4i4hWcdNfHYqhH7iJSy+2evQlaA9Y5 qcYmmyRz7UzqIj38s/q5Y1pMB31c1wO5X6JK9HaQ= From: Jakub Kicinski To: davem@davemloft.net Cc: netdev@vger.kernel.org, mkubecek@suse.cz, michael.chan@broadcom.com, tariqt@nvidia.com, saeedm@nvidia.com, alexander.duyck@gmail.com, andrew@lunn.ch, Jakub Kicinski Subject: [PATCH net-next 5/8] bnxt: add pause frame stats Date: Fri, 11 Sep 2020 12:52:55 -0700 Message-Id: <20200911195258.1048468-6-kuba@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200911195258.1048468-1-kuba@kernel.org> References: <20200911195258.1048468-1-kuba@kernel.org> MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org These stats are already reported in ethtool -S. Hopefully they are equivalent to standard stats? Signed-off-by: Jakub Kicinski --- .../net/ethernet/broadcom/bnxt/bnxt_ethtool.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c index d0928334bdc8..b5de242766e3 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c @@ -1778,6 +1778,24 @@ static void bnxt_get_pauseparam(struct net_device *dev, epause->tx_pause = !!(link_info->req_flow_ctrl & BNXT_LINK_PAUSE_TX); } +static void bnxt_get_pause_stats(struct net_device *dev, + struct ethtool_pause_stats *epstat) +{ + struct bnxt *bp = netdev_priv(dev); + struct rx_port_stats *rx_stats; + struct tx_port_stats *tx_stats; + + if (BNXT_VF(bp) || !(bp->flags & BNXT_FLAG_PORT_STATS)) + return; + + rx_stats = (void *)bp->port_stats.sw_stats; + tx_stats = (void *)((unsigned long)bp->port_stats.sw_stats + + BNXT_TX_PORT_STATS_BYTE_OFFSET); + + epstat->rx_pause_frames = rx_stats->rx_pause_frames; + epstat->tx_pause_frames = tx_stats->tx_pause_frames; +} + static int bnxt_set_pauseparam(struct net_device *dev, struct ethtool_pauseparam *epause) { @@ -3645,6 +3663,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_pause_stats = bnxt_get_pause_stats, .get_pauseparam = bnxt_get_pauseparam, .set_pauseparam = bnxt_set_pauseparam, .get_drvinfo = bnxt_get_drvinfo,