[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20211123163955.154512-27-alexandr.lobakin@intel.com>
Date: Tue, 23 Nov 2021 17:39:55 +0100
From: Alexander Lobakin <alexandr.lobakin@...el.com>
To: "David S. Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>
Cc: Alexander Lobakin <alexandr.lobakin@...el.com>,
Jesse Brandeburg <jesse.brandeburg@...el.com>,
Michal Swiatkowski <michal.swiatkowski@...ux.intel.com>,
Maciej Fijalkowski <maciej.fijalkowski@...el.com>,
Jonathan Corbet <corbet@....net>,
Shay Agroskin <shayagr@...zon.com>,
Arthur Kiyanovski <akiyano@...zon.com>,
David Arinzon <darinzon@...zon.com>,
Noam Dagan <ndagan@...zon.com>,
Saeed Bishara <saeedb@...zon.com>,
Ioana Ciornei <ioana.ciornei@....com>,
Claudiu Manoil <claudiu.manoil@....com>,
Tony Nguyen <anthony.l.nguyen@...el.com>,
Thomas Petazzoni <thomas.petazzoni@...tlin.com>,
Marcin Wojtas <mw@...ihalf.com>,
Russell King <linux@...linux.org.uk>,
Saeed Mahameed <saeedm@...dia.com>,
Leon Romanovsky <leon@...nel.org>,
Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Jesper Dangaard Brouer <hawk@...nel.org>,
Toke Høiland-Jørgensen <toke@...hat.com>,
John Fastabend <john.fastabend@...il.com>,
Edward Cree <ecree.xilinx@...il.com>,
Martin Habets <habetsm.xilinx@...il.com>,
"Michael S. Tsirkin" <mst@...hat.com>,
Jason Wang <jasowang@...hat.com>,
Andrii Nakryiko <andrii@...nel.org>,
Martin KaFai Lau <kafai@...com>,
Song Liu <songliubraving@...com>, Yonghong Song <yhs@...com>,
KP Singh <kpsingh@...nel.org>,
Lorenzo Bianconi <lorenzo@...nel.org>,
Yajun Deng <yajun.deng@...ux.dev>,
Sergey Ryazanov <ryazanov.s.a@...il.com>,
David Ahern <dsahern@...nel.org>,
Andrei Vagin <avagin@...il.com>,
Johannes Berg <johannes.berg@...el.com>,
Vladimir Oltean <vladimir.oltean@....com>,
Cong Wang <cong.wang@...edance.com>, netdev@...r.kernel.org,
linux-doc@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-rdma@...r.kernel.org, bpf@...r.kernel.org,
virtualization@...ts.linux-foundation.org
Subject: [PATCH v2 net-next 26/26] Documentation: reflect generic XDP statistics
Add a couple of hints on how to retrieve and implement generic XDP
statistics for drivers/interfaces. Mention that it's unwanted to
include related XDP counters in driver-defined Ethtool stats.
Signed-off-by: Alexander Lobakin <alexandr.lobakin@...el.com>
---
Documentation/networking/statistics.rst | 33 +++++++++++++++++++++++++
1 file changed, 33 insertions(+)
diff --git a/Documentation/networking/statistics.rst b/Documentation/networking/statistics.rst
index c9aeb70dafa2..ec5d14f279e1 100644
--- a/Documentation/networking/statistics.rst
+++ b/Documentation/networking/statistics.rst
@@ -41,6 +41,29 @@ If `-s` is specified once the detailed errors won't be shown.
`ip` supports JSON formatting via the `-j` option.
+For some interfaces, standard XDP statistics are available.
+It can be accessed the same ways, e.g. `ip`::
+
+ $ ip link xdpstats dev enp178s0
+ 16: enp178s0:
+ xdp-channel0-rx_xdp_packets: 0
+ xdp-channel0-rx_xdp_bytes: 1
+ xdp-channel0-rx_xdp_errors: 2
+ xdp-channel0-rx_xdp_aborted: 3
+ xdp-channel0-rx_xdp_drop: 4
+ xdp-channel0-rx_xdp_invalid: 5
+ xdp-channel0-rx_xdp_pass: 6
+ xdp-channel0-rx_xdp_redirect: 7
+ xdp-channel0-rx_xdp_redirect_errors: 8
+ xdp-channel0-rx_xdp_tx: 9
+ xdp-channel0-rx_xdp_tx_errors: 10
+ xdp-channel0-tx_xdp_xmit_packets: 11
+ xdp-channel0-tx_xdp_xmit_bytes: 12
+ xdp-channel0-tx_xdp_xmit_errors: 13
+ xdp-channel0-tx_xdp_xmit_full: 14
+
+Those are usually per-channel. JSON is also supported via the `-j` opt.
+
Protocol-specific statistics
----------------------------
@@ -147,6 +170,8 @@ Statistics are reported both in the responses to link information
requests (`RTM_GETLINK`) and statistic requests (`RTM_GETSTATS`,
when `IFLA_STATS_LINK_64` bit is set in the `.filter_mask` of the request).
+`IFLA_STATS_LINK_XDP_XSTATS` bit is used to retrieve standard XDP statstics.
+
ethtool
-------
@@ -206,6 +231,14 @@ Retrieving ethtool statistics is a multi-syscall process, drivers are advised
to keep the number of statistics constant to avoid race conditions with
user space trying to read them.
+It is up to the developers whether to implement XDP statistics or not due to
+possible performance hits. If so, it is encouraged to export it using generic
+XDP statistics infrastructure, not driver-defined Ethtool stats.
+It can be achieve by implementing `.ndo_get_xdp_stats` and, optionally but
+preferred, `.ndo_get_xdp_stats_nch`. There are several common helper structures
+and functions in `include/net/xdp.h` to make this simpler and keep the code
+compact.
+
Statistics must persist across routine operations like bringing the interface
down and up.
--
2.33.1
Powered by blists - more mailing lists