[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20170307191906.63288-1-jakub.kicinski@netronome.com>
Date: Tue, 7 Mar 2017 11:19:06 -0800
From: Jakub Kicinski <jakub.kicinski@...ronome.com>
To: netdev@...r.kernel.org
Cc: oss-drivers@...ronome.com,
Jakub Kicinski <jakub.kicinski@...ronome.com>
Subject: [PATCH ethtool] ethtool: print hash function with ethtool -x|--show-rxfh-indir
Make ethtool -x|--show-rxfh-indir print the RSS hash function name.
Signed-off-by: Jakub Kicinski <jakub.kicinski@...ronome.com>
---
ethtool.8.in | 3 ++-
ethtool.c | 31 +++++++++++++++++++++++++++++++
2 files changed, 33 insertions(+), 1 deletion(-)
diff --git a/ethtool.8.in b/ethtool.8.in
index 5c36c06385f6..5f5a141c1482 100644
--- a/ethtool.8.in
+++ b/ethtool.8.in
@@ -854,7 +854,8 @@ Show the device's time stamping capabilities and associated PTP
hardware clock.
.TP
.B \-x \-\-show\-rxfh\-indir \-\-show\-rxfh
-Retrieves the receive flow hash indirection table and/or RSS hash key.
+Retrieves the receive flow hash indirection table, hash function and RSS hash
+key.
.TP
.B \-X \-\-set\-rxfh\-indir \-\-rxfh
Configures the receive flow hash indirection table and/or RSS hash key.
diff --git a/ethtool.c b/ethtool.c
index 7af039e26b50..2d8dd54752c4 100644
--- a/ethtool.c
+++ b/ethtool.c
@@ -3638,6 +3638,35 @@ static int do_grxfhindir(struct cmd_context *ctx,
return 0;
}
+static void print_grxfh_hfunc(struct cmd_context *ctx, __u8 hfunc)
+{
+ unsigned int func_id = ffs(hfunc) - 1;
+ struct ethtool_gstrings *strings;
+
+ printf("RSS hash function: ");
+ if (!hfunc) {
+ printf("unknown\n");
+ return;
+ }
+
+ strings = get_stringset(ctx, ETH_SS_RSS_HASH_FUNCS, 0, 1);
+ if (!strings) {
+ if (errno != EOPNOTSUPP)
+ printf("%s\n", strerror(errno));
+ else
+ printf("unnamed (%d)\n", func_id);
+ return;
+ }
+
+ if (func_id < strings->len)
+ printf("%s\n",
+ (char *)strings->data + func_id * ETH_GSTRING_LEN);
+ else
+ printf("unnamed (%d)\n", func_id);
+
+ free(strings);
+}
+
static int do_grxfh(struct cmd_context *ctx)
{
struct ethtool_rxfh rss_head = {0};
@@ -3683,6 +3712,8 @@ static int do_grxfh(struct cmd_context *ctx)
print_indir_table(ctx, &ring_count, rss->indir_size, rss->rss_config);
+ print_grxfh_hfunc(ctx, rss->hfunc);
+
indir_bytes = rss->indir_size * sizeof(rss->rss_config[0]);
hkey = ((char *)rss->rss_config + indir_bytes);
--
2.11.0
Powered by blists - more mailing lists