From patchwork Sun Mar 22 19:01:27 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vlad Zolotarov X-Patchwork-Id: 453202 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 2FB8014012F for ; Mon, 23 Mar 2015 06:01:57 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751938AbbCVTBx (ORCPT ); Sun, 22 Mar 2015 15:01:53 -0400 Received: from mail-wg0-f47.google.com ([74.125.82.47]:34421 "EHLO mail-wg0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751926AbbCVTBo (ORCPT ); Sun, 22 Mar 2015 15:01:44 -0400 Received: by wgs2 with SMTP id 2so22901733wgs.1 for ; Sun, 22 Mar 2015 12:01:43 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=ZmYdyS+ZdqPKH9o3c7Q+pOC9Fn4ugxCt5ZWLMZ4DbGw=; b=UOoTPh+D6iq9Yf6wGsT16s0deS4rx2E1ooqD41kShRMtiYE7fQY80xe2jN+hNoqzQk p/NCSv1PwXamtmuNbj13qEYZZvXuaxgil8uqjztalTzpbIF5bl2URQblvNQ3qvfDkjWW ujVi8vwsFznu05rbigqGS8Mo/kuug+lA6iIHjUIf64IQ7H4kq08kBZZdWaxv1ugBBE88 oauDRER6gAS5oz/doyme900bFj3jcmlpaPy1Mme5CvQHdRSXO1Q3a2pm5tGabc0FY59T x0sx245rpabqxKqV76oNKUbcgWutiJVKPKRVXqxlS7edXHoWkfNG28HUb6BHKpQunaNI q8FA== X-Gm-Message-State: ALoCoQkuxVHn3Ob+LmASuX9amZpRbj2YhklpmBwvQHgcr9pDU5FwPEKSvxZhmIzwfzkOBZpXRygW X-Received: by 10.180.80.199 with SMTP id t7mr13608086wix.52.1427050902998; Sun, 22 Mar 2015 12:01:42 -0700 (PDT) Received: from vladz-laptop.cloudius-systems.com. ([212.143.139.214]) by mx.google.com with ESMTPSA id ga8sm7696906wib.11.2015.03.22.12.01.41 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 22 Mar 2015 12:01:42 -0700 (PDT) From: Vlad Zolotarov To: netdev@vger.kernel.org Cc: jeffrey.t.kirsher@intel.com, avi@cloudius-systems.com, gleb@cloudius-systems.com, Vlad Zolotarov Subject: [PATCH net-next v6 7/7] ixgbevf: Add the appropriate ethtool ops to query RSS indirection table and key Date: Sun, 22 Mar 2015 21:01:27 +0200 Message-Id: <1427050887-19412-8-git-send-email-vladz@cloudius-systems.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1427050887-19412-1-git-send-email-vladz@cloudius-systems.com> References: <1427050887-19412-1-git-send-email-vladz@cloudius-systems.com> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Added get_rxfh_indir_size, get_rxfh_key_size and get_rxfh ethtool_ops callbacks implementations. This enables the ethtool's "-x" and "--show-rxfh[-indir]" options for VF devices. Signed-off-by: Vlad Zolotarov --- New in v6: - Added a required get_rxnfc callback to ixgbevf_ethtool_ops. New in v4: - Removed not needed braces in if-statement in ixgbevf_get_rxfh_indir_size(). New in v3: - Added a proper support for x550 devices: return the correct redirection table size. New in v2: - Added a detailed description to the patch. Signed-off-by: Vlad Zolotarov --- drivers/net/ethernet/intel/ixgbevf/ethtool.c | 58 ++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/drivers/net/ethernet/intel/ixgbevf/ethtool.c b/drivers/net/ethernet/intel/ixgbevf/ethtool.c index e83c85b..037a4af 100644 --- a/drivers/net/ethernet/intel/ixgbevf/ethtool.c +++ b/drivers/net/ethernet/intel/ixgbevf/ethtool.c @@ -794,6 +794,60 @@ static int ixgbevf_set_coalesce(struct net_device *netdev, return 0; } +static int ixgbevf_get_rxnfc(struct net_device *dev, struct ethtool_rxnfc *info, + u32 *rules __always_unused) +{ + struct ixgbevf_adapter *adapter = netdev_priv(dev); + + switch (info->cmd) { + case ETHTOOL_GRXRINGS: + info->data = adapter->num_rx_queues; + return 0; + default: + hw_dbg(&adapter->hw, "Command parameters not supported\n"); + return -EOPNOTSUPP; + } +} + +static u32 ixgbevf_get_rxfh_indir_size(struct net_device *netdev) +{ + struct ixgbevf_adapter *adapter = netdev_priv(netdev); + + if (adapter->hw.mac.type >= ixgbe_mac_X550_vf) + return 64; + else + return 128; +} + +static u32 ixgbevf_get_rxfh_key_size(struct net_device *netdev) +{ + return 40; +} + +static int ixgbevf_get_rxfh(struct net_device *netdev, u32 *indir, u8 *key, + u8 *hfunc) +{ + struct ixgbevf_adapter *adapter = netdev_priv(netdev); + int err; + + if (hfunc) + *hfunc = ETH_RSS_HASH_TOP; + + if (indir) { + err = ixgbevf_get_reta(&adapter->hw, indir); + if (err) + return err; + } + + if (key) { + err = ixgbevf_get_rss_key(&adapter->hw, key); + if (err) + return err; + } + + return 0; +} + static const struct ethtool_ops ixgbevf_ethtool_ops = { .get_settings = ixgbevf_get_settings, .get_drvinfo = ixgbevf_get_drvinfo, @@ -811,6 +865,10 @@ static const struct ethtool_ops ixgbevf_ethtool_ops = { .get_ethtool_stats = ixgbevf_get_ethtool_stats, .get_coalesce = ixgbevf_get_coalesce, .set_coalesce = ixgbevf_set_coalesce, + .get_rxnfc = ixgbevf_get_rxnfc, + .get_rxfh_indir_size = ixgbevf_get_rxfh_indir_size, + .get_rxfh_key_size = ixgbevf_get_rxfh_key_size, + .get_rxfh = ixgbevf_get_rxfh, }; void ixgbevf_set_ethtool_ops(struct net_device *netdev)