diff mbox series

[ethtool,4/5] netlink: pass the source of statistics for port stats

Message ID 20230111153638.1454687-5-vladimir.oltean@nxp.com (mailing list archive)
State Superseded
Delegated to: Michal Kubecek
Headers show
Series MAC Merge layer support | expand

Checks

Context Check Description
netdev/tree_selection success Not a local patch

Commit Message

Vladimir Oltean Jan. 11, 2023, 3:36 p.m. UTC
Use the ETHTOOL_STATS_SRC_AGGREGATE attribute for the following
structured port groups, to allow looking at eMAC and pMAC counters
individually:

$ ethtool -S eno2 --groups eth-mac eth-phy eth-ctrl rmon -- --src pmac

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
---
 netlink/stats.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
diff mbox series

Patch

diff --git a/netlink/stats.c b/netlink/stats.c
index 9f609a4ec550..029aad29a135 100644
--- a/netlink/stats.c
+++ b/netlink/stats.c
@@ -268,6 +268,13 @@  err_free:
 	return ret;
 }
 
+static const struct lookup_entry_u32 stats_src_values[] = {
+	{ .arg = "aggregate",	.val = ETHTOOL_STATS_SRC_AGGREGATE },
+	{ .arg = "emac",	.val = ETHTOOL_STATS_SRC_EMAC },
+	{ .arg = "pmac",	.val = ETHTOOL_STATS_SRC_PMAC },
+	{}
+};
+
 static const struct param_parser stats_params[] = {
 	{
 		.arg		= "--groups",
@@ -283,6 +290,13 @@  static const struct param_parser stats_params[] = {
 		.handler	= stats_parse_all_groups,
 		.alt_group	= 1,
 	},
+	{
+		.arg		= "--src",
+		.type		= ETHTOOL_A_STATS_SRC,
+		.handler	= nl_parse_lookup_u32,
+		.handler_data	= stats_src_values,
+		.min_argc	= 1,
+	},
 	{}
 };