[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1bc19123247e0ffb7e08083244846407966e972c.1709934897.git.petrm@nvidia.com>
Date: Fri, 8 Mar 2024 23:29:09 +0100
From: Petr Machata <petrm@...dia.com>
To: David Ahern <dsahern@...nel.org>, Stephen Hemminger
<stephen@...workplumber.org>, <netdev@...r.kernel.org>
CC: Ido Schimmel <idosch@...dia.com>, Petr Machata <petrm@...dia.com>,
<mlxsw@...dia.com>
Subject: [PATCH iproute2-next 4/4] ip: ipnexthop: Allow toggling collection of nexthop group HW statistics
Besides SW datapath stats, the kernel also support collecting statistics
from HW datapath, for nexthop groups offloaded to HW. Since collection of
these statistics may consume HW resources, there is an interface to request
that the HW stats be recorded. Add this toggle to "ip nexthop".
Signed-off-by: Petr Machata <petrm@...dia.com>
---
ip/ipnexthop.c | 12 ++++++++++++
man/man8/ip-nexthop.8 | 2 ++
2 files changed, 14 insertions(+)
diff --git a/ip/ipnexthop.c b/ip/ipnexthop.c
index 573f1abb..74685c49 100644
--- a/ip/ipnexthop.c
+++ b/ip/ipnexthop.c
@@ -56,6 +56,7 @@ static void usage(void)
" [ encap ENCAPTYPE ENCAPHDR ] |\n"
" group GROUP [ fdb ] [ type TYPE [ TYPE_ARGS ] ] }\n"
"GROUP := [ <id[,weight]>/<id[,weight]>/... ]\n"
+ " [ hw_stats {off|on} ]\n"
"TYPE := { mpath | resilient }\n"
"TYPE_ARGS := [ RESILIENT_ARGS ]\n"
"RESILIENT_ARGS := [ buckets BUCKETS ] [ idle_timer IDLE ]\n"
@@ -1100,6 +1101,17 @@ static int ipnh_modify(int cmd, unsigned int flags, int argc, char **argv)
if (rtnl_rtprot_a2n(&prot, *argv))
invarg("\"protocol\" value is invalid\n", *argv);
req.nhm.nh_protocol = prot;
+ } else if (!strcmp(*argv, "hw_stats")) {
+ bool hw_stats;
+ int ret;
+
+ NEXT_ARG();
+ hw_stats = parse_on_off("hw_stats", *argv, &ret);
+ if (ret)
+ return ret;
+
+ addattr32(&req.n, sizeof(req), NHA_HW_STATS_ENABLE,
+ hw_stats);
} else if (strcmp(*argv, "help") == 0) {
usage();
} else {
diff --git a/man/man8/ip-nexthop.8 b/man/man8/ip-nexthop.8
index f81a5910..aad68696 100644
--- a/man/man8/ip-nexthop.8
+++ b/man/man8/ip-nexthop.8
@@ -68,6 +68,8 @@ ip-nexthop \- nexthop object management
.BR fdb " ] | "
.B group
.IR GROUP " [ "
+.BR hw_stats " { "
+.BR on " | " off " } ] [ "
.BR fdb " ] [ "
.B type
.IR TYPE " [ " TYPE_ARGS " ] ] }"
--
2.43.0
Powered by blists - more mailing lists