[ethtool] 08/20: ethtool: print hash function with ethtool -x|--show-rxfh-indir

debian-kernel at lists.debian.org debian-kernel at lists.debian.org
Wed Aug 30 12:59:24 UTC 2017


This is an automated email from the git hooks/post-receive script.

benh pushed a commit to branch master
in repository ethtool.

commit b932835d2302ccbb3e7c0cf708a9c3fd25868de6
Author: Jakub Kicinski <jakub.kicinski at netronome.com>
Date:   Tue Mar 7 11:19:06 2017 -0800

    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 at netronome.com>
    Signed-off-by: John W. Linville <linville at tuxdriver.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 1fdaf0e..9fc22c8 100644
--- a/ethtool.8.in
+++ b/ethtool.8.in
@@ -856,7 +856,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 669bc36..8b03aaf 100644
--- a/ethtool.c
+++ b/ethtool.c
@@ -3644,6 +3644,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};
@@ -3689,6 +3718,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);
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/kernel/ethtool.git



More information about the Kernel-svn-changes mailing list