netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ajit Khaparde <ajitkhaparde@gmail.com>
To: David Miller <davem@davemloft.net>, jeff@garzik.org
Cc: netdev <netdev@vger.kernel.org>
Subject: [RFC PATCH net-2.6] net/ethtool: add multiple queue support to {get,set}_ringparams
Date: Sun, 14 Mar 2010 07:13:45 +0530	[thread overview]
Message-ID: <20100314014335.GA17208@serverengines.com> (raw)

With network devices and hence device drivers supporting
multiple Tx and Rx rings, currently there is no way for
ethtool to specify which Tx/Rx ring the user wants to get/set.
This patch enhances the {get,set}_ringparams by allowing
the user to specify the Tx/Rx ring id of interest.
Please review.

Signed-off-by: Ajit Khaparde <ajitk@serverengines.com>
---
 include/linux/ethtool.h |    1 +
 net/core/ethtool.c      |    5 ++++-
 2 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
index b33f316..de6a90a 100644
--- a/include/linux/ethtool.h
+++ b/include/linux/ethtool.h
@@ -206,6 +206,7 @@ struct ethtool_coalesce {
 /* for configuring RX/TX ring parameters */
 struct ethtool_ringparam {
 	__u32	cmd;	/* ETHTOOL_{G,S}RINGPARAM */
+	__u32	ring_id;
 
 	/* Read only attributes.  These indicate the maximum number
 	 * of pending RX/TX ring entries the driver will allow the
diff --git a/net/core/ethtool.c b/net/core/ethtool.c
index f4cb6b6..81e2e62 100644
--- a/net/core/ethtool.c
+++ b/net/core/ethtool.c
@@ -881,11 +881,14 @@ static noinline_for_stack int ethtool_set_coalesce(struct net_device *dev, void
 
 static int ethtool_get_ringparam(struct net_device *dev, void __user *useraddr)
 {
-	struct ethtool_ringparam ringparam = { .cmd = ETHTOOL_GRINGPARAM };
+	struct ethtool_ringparam ringparam;
 
 	if (!dev->ethtool_ops->get_ringparam)
 		return -EOPNOTSUPP;
 
+	if (copy_from_user(&ringparam, useraddr, sizeof(ringparam)))
+		return -EFAULT;
+
 	dev->ethtool_ops->get_ringparam(dev, &ringparam);
 
 	if (copy_to_user(useraddr, &ringparam, sizeof(ringparam)))
-- 
1.6.3.3


             reply	other threads:[~2010-03-14  1:43 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-14  1:43 Ajit Khaparde [this message]
2010-03-14  2:11 ` [RFC PATCH net-2.6] net/ethtool: add multiple queue support to {get,set}_ringparams David Miller
2010-03-14 16:17   ` [PATCH] ethtool.h: Add "structs are public" disclaimer comment Joe Perches
2010-03-14 17:50     ` Ben Hutchings
2010-03-14 18:38       ` Jeff Garzik
2010-03-14 22:08     ` David Miller
2010-03-14  4:21 ` [RFC PATCH net-2.6] net/ethtool: add multiple queue support to {get,set}_ringparams Ben Hutchings

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=20100314014335.GA17208@serverengines.com \
    --to=ajitkhaparde@gmail.com \
    --cc=ajitk@serverengines.com \
    --cc=davem@davemloft.net \
    --cc=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;
as well as URLs for NNTP newsgroup(s).