* [PATCH net-next] net/ethtool: Add current supported tunable options
@ 2015-06-09 15:29 Hadar Hen Zion
2015-06-11 5:07 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Hadar Hen Zion @ 2015-06-09 15:29 UTC (permalink / raw)
To: David S. Miller, Ben Hutchings
Cc: netdev, Amir Vadai, Or Gerlitz, Tal Alon, _govind, Hadar Hen Zion
Add strings array of the current supported tunable options.
Signed-off-by: Hadar Hen Zion <hadarh@mellanox.com>
Reviewed-by: Amir Vadai <amirv@mellanox.com>
---
include/uapi/linux/ethtool.h | 6 ++++++
net/core/ethtool.c | 12 ++++++++++++
2 files changed, 18 insertions(+)
diff --git a/include/uapi/linux/ethtool.h b/include/uapi/linux/ethtool.h
index 0594933..90e4bff 100644
--- a/include/uapi/linux/ethtool.h
+++ b/include/uapi/linux/ethtool.h
@@ -215,6 +215,11 @@ enum tunable_id {
ETHTOOL_ID_UNSPEC,
ETHTOOL_RX_COPYBREAK,
ETHTOOL_TX_COPYBREAK,
+ /*
+ * Add your fresh new tubale attribute above and remember to update
+ * tunable_strings[] in net/core/ethtool.c
+ */
+ ETHTOOL_TUNABLE_COUNT,
};
enum tunable_type_id {
@@ -545,6 +550,7 @@ enum ethtool_stringset {
ETH_SS_NTUPLE_FILTERS,
ETH_SS_FEATURES,
ETH_SS_RSS_HASH_FUNCS,
+ ETH_SS_TUNABLES,
};
/**
diff --git a/net/core/ethtool.c b/net/core/ethtool.c
index eb0c3ac..13bbb47 100644
--- a/net/core/ethtool.c
+++ b/net/core/ethtool.c
@@ -106,6 +106,13 @@ rss_hash_func_strings[ETH_RSS_HASH_FUNCS_COUNT][ETH_GSTRING_LEN] = {
[ETH_RSS_HASH_XOR_BIT] = "xor",
};
+static const char
+tunable_strings[ETHTOOL_TUNABLE_COUNT][ETH_GSTRING_LEN] = {
+ [ETHTOOL_ID_UNSPEC] = "Unspec",
+ [ETHTOOL_RX_COPYBREAK] = "rx-copybreak",
+ [ETHTOOL_TX_COPYBREAK] = "tx-copybreak",
+};
+
static int ethtool_get_features(struct net_device *dev, void __user *useraddr)
{
struct ethtool_gfeatures cmd = {
@@ -194,6 +201,9 @@ static int __ethtool_get_sset_count(struct net_device *dev, int sset)
if (sset == ETH_SS_RSS_HASH_FUNCS)
return ARRAY_SIZE(rss_hash_func_strings);
+ if (sset == ETH_SS_TUNABLES)
+ return ARRAY_SIZE(tunable_strings);
+
if (ops->get_sset_count && ops->get_strings)
return ops->get_sset_count(dev, sset);
else
@@ -211,6 +221,8 @@ static void __ethtool_get_strings(struct net_device *dev,
else if (stringset == ETH_SS_RSS_HASH_FUNCS)
memcpy(data, rss_hash_func_strings,
sizeof(rss_hash_func_strings));
+ else if (stringset == ETH_SS_TUNABLES)
+ memcpy(data, tunable_strings, sizeof(tunable_strings));
else
/* ops->get_strings is valid because checked earlier */
ops->get_strings(dev, stringset, data);
--
1.8.3.1
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH net-next] net/ethtool: Add current supported tunable options
2015-06-09 15:29 [PATCH net-next] net/ethtool: Add current supported tunable options Hadar Hen Zion
@ 2015-06-11 5:07 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2015-06-11 5:07 UTC (permalink / raw)
To: hadarh; +Cc: ben, netdev, amirv, ogerlitz, talal, _govind
From: Hadar Hen Zion <hadarh@mellanox.com>
Date: Tue, 9 Jun 2015 18:29:54 +0300
> Add strings array of the current supported tunable options.
>
> Signed-off-by: Hadar Hen Zion <hadarh@mellanox.com>
> Reviewed-by: Amir Vadai <amirv@mellanox.com>
> ---
> include/uapi/linux/ethtool.h | 6 ++++++
> net/core/ethtool.c | 12 ++++++++++++
> 2 files changed, 18 insertions(+)
>
> diff --git a/include/uapi/linux/ethtool.h b/include/uapi/linux/ethtool.h
> index 0594933..90e4bff 100644
> --- a/include/uapi/linux/ethtool.h
> +++ b/include/uapi/linux/ethtool.h
> @@ -215,6 +215,11 @@ enum tunable_id {
> ETHTOOL_ID_UNSPEC,
> ETHTOOL_RX_COPYBREAK,
> ETHTOOL_TX_COPYBREAK,
> + /*
> + * Add your fresh new tubale attribute above and remember to update
> + * tunable_strings[] in net/core/ethtool.c
> + */
> + ETHTOOL_TUNABLE_COUNT,
> };
>
> enum tunable_type_id {
Please put two leading underscores in the name of this enumeration
to make it clear that it is an implementation internal value that
users should not try to use. F.e. __ETHTOOL_TUNABLE_COUNT
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-06-11 5:07 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-09 15:29 [PATCH net-next] net/ethtool: Add current supported tunable options Hadar Hen Zion
2015-06-11 5:07 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).