From patchwork Tue Sep 15 00:11:53 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Kicinski X-Patchwork-Id: 260883 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=-14.9 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,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 0B658C2BBD1 for ; Tue, 15 Sep 2020 00:13:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C8B4A208DB for ; Tue, 15 Sep 2020 00:13:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600128837; bh=NWfN5hbHVckCw+VSVzPavjqr9ph54zq+tpKuv4Ib3nU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=x2ptYQk4jmlX56IhanA3RCMjRIJuQtcNlMThBHSqrIItjqKd4Ith7TEYVC7CoV7Wl WXvB/zMzDcjGUuuZOa0XFB4Udnozkd5Hz2L6Ahp7A2/+8MMd039ouV/yoqROtah3Nd p4y8MQU6Ywp4w6/ibgck/gJ1TRknx9r0PJ0iFtjs= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726140AbgIOANz (ORCPT ); Mon, 14 Sep 2020 20:13:55 -0400 Received: from mail.kernel.org ([198.145.29.99]:58298 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726024AbgIOANK (ORCPT ); Mon, 14 Sep 2020 20:13:10 -0400 Received: from kicinski-fedora-PC1C0HJN.thefacebook.com (unknown [163.114.132.5]) (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 4676321D7A; Tue, 15 Sep 2020 00:13:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600128789; bh=NWfN5hbHVckCw+VSVzPavjqr9ph54zq+tpKuv4Ib3nU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tJMowSR3+HrUmVtqD82C3odpSvHROfSGlRtvP4SENHAYAsl3kdbNnySTpVZZJfZWU qtmbkVol/YdLxXLnwwr+alflBdDZkytmF8+5R6jIsGINLXM/XJfMT5qZVnD3i5vn0K Ix5QW/Gjege9eJSkXXEmjFkeetTgaKUc9/ublwr4= From: Jakub Kicinski To: davem@davemloft.net Cc: mkubecek@suse.cz, michael.chan@broadcom.com, saeedm@nvidia.com, tariqt@nvidia.com, andrew@lunn.ch, alexander.duyck@gmail.com, netdev@vger.kernel.org, Jakub Kicinski Subject: [PATCH net-next v3 2/8] docs: net: include the new ethtool pause stats in the stats doc Date: Mon, 14 Sep 2020 17:11:53 -0700 Message-Id: <20200915001159.346469-3-kuba@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200915001159.346469-1-kuba@kernel.org> References: <20200915001159.346469-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 Tell people that there now is an interface for querying pause frames. A little bit of restructuring is needed given this is a first source of such statistics. Signed-off-by: Jakub Kicinski Reviewed-by: Saeed Mahameed --- Documentation/networking/statistics.rst | 57 ++++++++++++++++++++++--- 1 file changed, 52 insertions(+), 5 deletions(-) diff --git a/Documentation/networking/statistics.rst b/Documentation/networking/statistics.rst index d490b535cd14..8e15bc98830b 100644 --- a/Documentation/networking/statistics.rst +++ b/Documentation/networking/statistics.rst @@ -4,16 +4,23 @@ Interface statistics ==================== +Overview +======== + This document is a guide to Linux network interface statistics. -There are two main sources of interface statistics in Linux: +There are three main sources of interface statistics in Linux: - standard interface statistics based on - :c:type:`struct rtnl_link_stats64 `; and + :c:type:`struct rtnl_link_stats64 `; + - protocol-specific statistics; and - driver-defined statistics available via ethtool. -There are multiple interfaces to reach the former. Most commonly used -is the `ip` command from `iproute2`:: +Standard interface statistics +----------------------------- + +There are multiple interfaces to reach the standard statistics. +Most commonly used is the `ip` command from `iproute2`:: $ ip -s -s link show dev ens4u1u1 6: ens4u1u1: mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000 @@ -34,7 +41,26 @@ If `-s` is specified once the detailed errors won't be shown. `ip` supports JSON formatting via the `-j` option. -Ethtool statistics can be dumped using `ethtool -S $ifc`, e.g.:: +Protocol-specific statistics +---------------------------- + +Some of the interfaces used for configuring devices are also able +to report related statistics. For example ethtool interface used +to configure pause frames can report corresponding hardware counters:: + + $ ethtool --include-statistics -a eth0 + Pause parameters for eth0: + Autonegotiate: on + RX: on + TX: on + Statistics: + tx_pause_frames: 1 + rx_pause_frames: 1 + +Driver-defined statistics +------------------------- + +Driver-defined ethtool statistics can be dumped using `ethtool -S $ifc`, e.g.:: $ ethtool -S ens4u1u1 NIC statistics: @@ -94,6 +120,17 @@ Identifiers via `ETHTOOL_GSTRINGS` with `string_set` set to `ETH_SS_STATS`, and values via `ETHTOOL_GSTATS`. User space should use `ETHTOOL_GDRVINFO` to retrieve the number of statistics (`.n_stats`). +ethtool-netlink +--------------- + +Ethtool netlink is a replacement for the older IOCTL interface. + +Protocol-related statistics can be requested in get commands by setting +the `ETHTOOL_FLAG_STATS` flag in `ETHTOOL_A_HEADER_FLAGS`. Currently +statistics are supported in the following commands: + + - `ETHTOOL_MSG_PAUSE_GET` + debugfs ------- @@ -130,3 +167,13 @@ user space trying to read them. Statistics must persist across routine operations like bringing the interface down and up. + +Kernel-internal data structures +------------------------------- + +The following structures are internal to the kernel, their members are +translated to netlink attributes when dumped. Drivers must not overwrite +the statistics they don't report with 0. + +.. kernel-doc:: include/linux/ethtool.h + :identifiers: ethtool_pause_stats