diff mbox

[net,1/2] ethtool: Use values instead of bit flags for RSS hash function

Message ID 1430058966-24046-2-git-send-email-amirv@mellanox.com
State Changes Requested, archived
Delegated to: David Miller
Headers show

Commit Message

Amir Vadai April 26, 2015, 2:36 p.m. UTC
The RX indirection hash function is eight bits. Using more than one hash
function doesn't make sense, therefore using this field as a value
instead of a bit flag.
Moving from bit flags into value shouldn't introduce any backward
compatibility issues, since currently there are only 2 functions,
therfore the actual value in the field hfunc is the same like before 1
for Toeplitz and 2 for XOR.

Fixes: 892311f ("ethtool: Support for configurable RSS hash function")
Signed-off-by: Amir Vadai <amirv@mellanox.com>
---
 include/linux/ethtool.h | 9 ++-------
 net/core/ethtool.c      | 4 ++--
 2 files changed, 4 insertions(+), 9 deletions(-)
diff mbox

Patch

diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
index 653dc9c..d19f31a 100644
--- a/include/linux/ethtool.h
+++ b/include/linux/ethtool.h
@@ -60,8 +60,8 @@  enum ethtool_phys_id_state {
 };
 
 enum {
-	ETH_RSS_HASH_TOP_BIT, /* Configurable RSS hash function - Toeplitz */
-	ETH_RSS_HASH_XOR_BIT, /* Configurable RSS hash function - Xor */
+	ETH_RSS_HASH_TOP = 1, /* Configurable RSS hash function - Toeplitz */
+	ETH_RSS_HASH_XOR = 2, /* Configurable RSS hash function - Xor */
 
 	/*
 	 * Add your fresh new hash function bits above and remember to update
@@ -70,11 +70,6 @@  enum {
 	ETH_RSS_HASH_FUNCS_COUNT
 };
 
-#define __ETH_RSS_HASH_BIT(bit)	((u32)1 << (bit))
-#define __ETH_RSS_HASH(name)	__ETH_RSS_HASH_BIT(ETH_RSS_HASH_##name##_BIT)
-
-#define ETH_RSS_HASH_TOP	__ETH_RSS_HASH(TOP)
-#define ETH_RSS_HASH_XOR	__ETH_RSS_HASH(XOR)
 
 #define ETH_RSS_HASH_UNKNOWN	0
 #define ETH_RSS_HASH_NO_CHANGE	0
diff --git a/net/core/ethtool.c b/net/core/ethtool.c
index 1d00b89..1a1db95 100644
--- a/net/core/ethtool.c
+++ b/net/core/ethtool.c
@@ -103,8 +103,8 @@  static const char netdev_features_strings[NETDEV_FEATURE_COUNT][ETH_GSTRING_LEN]
 
 static const char
 rss_hash_func_strings[ETH_RSS_HASH_FUNCS_COUNT][ETH_GSTRING_LEN] = {
-	[ETH_RSS_HASH_TOP_BIT] =	"toeplitz",
-	[ETH_RSS_HASH_XOR_BIT] =	"xor",
+	[ETH_RSS_HASH_TOP] =		"toeplitz",
+	[ETH_RSS_HASH_XOR] =		"xor",
 };
 
 static int ethtool_get_features(struct net_device *dev, void __user *useraddr)