From patchwork Sun Mar 14 01:43:45 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ajit Khaparde X-Patchwork-Id: 47723 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id E1490B7D55 for ; Sun, 14 Mar 2010 12:44:09 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759451Ab0CNBnw (ORCPT ); Sat, 13 Mar 2010 20:43:52 -0500 Received: from mail-iw0-f176.google.com ([209.85.223.176]:45005 "EHLO mail-iw0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759394Ab0CNBnv (ORCPT ); Sat, 13 Mar 2010 20:43:51 -0500 Received: by iwn6 with SMTP id 6so901334iwn.4 for ; Sat, 13 Mar 2010 17:43:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:date:from:to:cc:subject :message-id:reply-to:mime-version:content-type:content-disposition :x-url:organization:user-agent:x-os; bh=KYlzmm25zgF4fZfyqsP64eoyGDzIcEwC+THewWbyvBo=; b=dqUjFnc8u+CjIH3yAfSkhXKX+ZxQJgM1X5SS5Yzqkh2I45fN/htpqQb4d8j+q0GnSD EeDJf8zZjgrDq4ir/kJScDx0N/k13BDWxnyZMw6pKRym1wgo7iUW0iFNRwKEjpbFh9lM 8gXMvFumIA4fQGswrFSryd1DaWaAsg1H+zjSM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:reply-to:mime-version :content-type:content-disposition:x-url:organization:user-agent:x-os; b=limXPAjGcEc5PmpawBUxDlMHS20U2wqIJqoRmtJB0xTfKBYJ1PW0kT6Xv0j0ZuQY97 auFMK1djGYh4RAzgKN3bhACl9rHJYVPAziKxNRgpbaN7Il6YSMRTXsfE9Sow8s9zKEMw vN0JmGKVPS405z+bAlH+fP/G+a2hsOlIpzS+A= Received: by 10.231.191.147 with SMTP id dm19mr801685ibb.86.1268531030299; Sat, 13 Mar 2010 17:43:50 -0800 (PST) Received: from serverengines.com ([124.30.166.146]) by mx.google.com with ESMTPS id 21sm2497671iwn.11.2010.03.13.17.43.47 (version=SSLv3 cipher=RC4-MD5); Sat, 13 Mar 2010 17:43:49 -0800 (PST) Date: Sun, 14 Mar 2010 07:13:45 +0530 From: Ajit Khaparde To: David Miller , jeff@garzik.org Cc: netdev Subject: [RFC PATCH net-2.6] net/ethtool: add multiple queue support to {get,set}_ringparams Message-ID: <20100314014335.GA17208@serverengines.com> Reply-To: Ajit Khaparde MIME-Version: 1.0 Content-Disposition: inline X-URL: http://www.serverengines.com Organization: ServerEngines Corp User-Agent: "Ajit's Mutt" X-OS: Linux x86_64 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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 --- 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)))