netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Allan W. Nielsen" <allan.nielsen@microsemi.com>
To: <netdev@vger.kernel.org>
Cc: <andrew@lunn.ch>, <raju.lakkaraju@microsemi.com>,
	<allan.nielsen@microsemi.com>,
	Raju Lakkaraju <Raju.Lakkaraju@microsemi.com>
Subject: [PATCH net-next v2 4/5] ethtool: Core impl for ETHTOOL_PHY_DOWNSHIFT tunable
Date: Mon, 14 Nov 2016 10:29:19 +0100	[thread overview]
Message-ID: <1479115760-1182-5-git-send-email-allan.nielsen@microsemi.com> (raw)
In-Reply-To: <1479115760-1182-1-git-send-email-allan.nielsen@microsemi.com>

From: Raju Lakkaraju <Raju.Lakkaraju@microsemi.com>

Adding validation support for the ETHTOOL_PHY_DOWNSHIFT. Functional
implementation needs to be done in the individual PHY drivers.

Signed-off-by: Raju Lakkaraju <Raju.Lakkaraju@microsemi.com>
---
 net/core/ethtool.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/net/core/ethtool.c b/net/core/ethtool.c
index 61aebdf..e9b45567 100644
--- a/net/core/ethtool.c
+++ b/net/core/ethtool.c
@@ -122,6 +122,7 @@ tunable_strings[__ETHTOOL_TUNABLE_COUNT][ETH_GSTRING_LEN] = {
 static const char
 phy_tunable_strings[__ETHTOOL_PHY_TUNABLE_COUNT][ETH_GSTRING_LEN] = {
 	[ETHTOOL_ID_UNSPEC]     = "Unspec",
+	[ETHTOOL_PHY_DOWNSHIFT]	= "phy-downshift",
 };
 
 static int ethtool_get_features(struct net_device *dev, void __user *useraddr)
@@ -2435,6 +2436,11 @@ static int ethtool_set_per_queue(struct net_device *dev, void __user *useraddr)
 static int ethtool_phy_tunable_valid(const struct ethtool_tunable *tuna)
 {
 	switch (tuna->id) {
+	case ETHTOOL_PHY_DOWNSHIFT:
+		if (tuna->len != sizeof(u8) ||
+		    tuna->type_id != ETHTOOL_TUNABLE_U8)
+			return -EINVAL;
+		break;
 	default:
 		return -EINVAL;
 	}
-- 
2.7.3

  parent reply	other threads:[~2016-11-14 10:28 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-14  9:29 [PATCH net-next v2 0/5] Adding PHY-Tunables and downshift support Allan W. Nielsen
2016-11-14  9:29 ` [PATCH net-next v2 1/5] ethtool: (uapi) Add ETHTOOL_PHY_GTUNABLE and ETHTOOL_PHY_STUNABLE Allan W. Nielsen
2016-11-14 13:36   ` Andrew Lunn
2016-11-14  9:29 ` [PATCH net-next v2 2/5] ethtool: Implements ETHTOOL_PHY_GTUNABLE/ETHTOOL_PHY_STUNABLE Allan W. Nielsen
2016-11-14 13:40   ` Andrew Lunn
2016-11-14  9:29 ` [PATCH net-next v2 3/5] ethtool: (uapi) Add ETHTOOL_PHY_DOWNSHIFT to PHY tunables Allan W. Nielsen
2016-11-14 13:42   ` Andrew Lunn
2016-11-14  9:29 ` Allan W. Nielsen [this message]
2016-11-14 13:43   ` [PATCH net-next v2 4/5] ethtool: Core impl for ETHTOOL_PHY_DOWNSHIFT tunable Andrew Lunn
2016-11-14  9:29 ` [PATCH net-next v2 5/5] net: phy: Add downshift get/set support in Microsemi PHYs driver Allan W. Nielsen
2016-11-14 13:48   ` Andrew Lunn
2016-11-14 13:49 ` [PATCH net-next v2 0/5] Adding PHY-Tunables and downshift support Andrew Lunn

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=1479115760-1182-5-git-send-email-allan.nielsen@microsemi.com \
    --to=allan.nielsen@microsemi.com \
    --cc=andrew@lunn.ch \
    --cc=netdev@vger.kernel.org \
    --cc=raju.lakkaraju@microsemi.com \
    /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;
as well as URLs for NNTP newsgroup(s).