From: Jeff Garzik <jeff@garzik.org>
To: netdev@vger.kernel.org
Subject: [PATCH] e1000e: export some settings using ethtool private flags
Date: Sat, 27 Feb 2010 03:23:05 -0500 [thread overview]
Message-ID: <20100227082305.GA18194@havoc.gtf.org> (raw)
The ethtool private flags interface exists to get/set driver-specific
settings at runtime, in a flexible manner.
Use this facility to export a couple e1000e features, that were
previously only set at module initialization time.
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
---
drivers/net/e1000e/ethtool.c | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)
diff --git a/drivers/net/e1000e/ethtool.c b/drivers/net/e1000e/ethtool.c
index b33e3cb..4bda27f 100644
--- a/drivers/net/e1000e/ethtool.c
+++ b/drivers/net/e1000e/ethtool.c
@@ -112,6 +112,30 @@ static const char e1000_gstrings_test[][ETH_GSTRING_LEN] = {
};
#define E1000_TEST_LEN ARRAY_SIZE(e1000_gstrings_test)
+enum e1000_pflags {
+ E1000_PF_SMART_POWERDOWN = (1 << 0),
+ E1000_PF_RO_NVM = (1 << 1),
+};
+
+#define E1000_N_PFLAGS ARRAY_SIZE(e1000_gstrings_pflags)
+static const char e1000_gstrings_pflags[][ETH_GSTRING_LEN] = {
+ "smart_power_down",
+ "read_only_nvm",
+};
+
+u32 e1000_get_priv_flags(struct net_device *netdev)
+{
+ struct e1000_adapter *adapter = netdev_priv(netdev);
+ u32 ret = 0;
+
+ if (adapter->flags & FLAG_SMART_POWER_DOWN)
+ ret |= E1000_PF_SMART_POWERDOWN;
+ if (adapter->flags & FLAG_READ_ONLY_NVM)
+ ret |= E1000_PF_RO_NVM;
+
+ return ret;
+}
+
static int e1000_get_settings(struct net_device *netdev,
struct ethtool_cmd *ecmd)
{
@@ -1666,6 +1690,8 @@ static int e1000e_get_sset_count(struct net_device *netdev, int sset)
return E1000_TEST_LEN;
case ETH_SS_STATS:
return E1000_STATS_LEN;
+ case ETH_SS_PRIV_FLAGS:
+ return E1000_N_PFLAGS;
default:
return -EOPNOTSUPP;
}
@@ -2014,6 +2040,7 @@ static const struct ethtool_ops e1000_ethtool_ops = {
.set_coalesce = e1000_set_coalesce,
.get_flags = ethtool_op_get_flags,
.set_flags = ethtool_op_set_flags,
+ .get_priv_flags = e1000_get_priv_flags,
};
void e1000e_set_ethtool_ops(struct net_device *netdev)
next reply other threads:[~2010-02-27 8:23 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-27 8:23 Jeff Garzik [this message]
2010-03-25 17:16 ` [PATCH] e1000e: export some settings using ethtool private flags Tantilov, Emil S
2010-03-25 17:30 ` Jeff Garzik
2010-03-25 17:33 ` Tantilov, Emil S
2010-03-25 17:52 ` Laurent Chavey
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100227082305.GA18194@havoc.gtf.org \
--to=jeff@garzik.org \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox