From patchwork Thu Mar 26 22:44:46 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vlad Zolotarov X-Patchwork-Id: 455227 X-Patchwork-Delegate: jeffrey.t.kirsher@intel.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from silver.osuosl.org (silver.osuosl.org [140.211.166.136]) by ozlabs.org (Postfix) with ESMTP id 6F4AF14012F for ; Fri, 27 Mar 2015 09:45:00 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id BCB8F33165 for ; Thu, 26 Mar 2015 22:44:59 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Vo+Y0u82iYw1 for ; Thu, 26 Mar 2015 22:44:58 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by silver.osuosl.org (Postfix) with ESMTP id 79E3933BB9 for ; Thu, 26 Mar 2015 22:44:58 +0000 (UTC) X-Original-To: intel-wired-lan@lists.osuosl.org Delivered-To: intel-wired-lan@lists.osuosl.org Received: from hemlock.osuosl.org (hemlock.osuosl.org [140.211.166.133]) by ash.osuosl.org (Postfix) with ESMTP id ECF431C2378 for ; Thu, 26 Mar 2015 22:44:56 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id E719295B5F for ; Thu, 26 Mar 2015 22:44:56 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id i4vtbPjQydgG for ; Thu, 26 Mar 2015 22:44:56 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mail-wg0-f49.google.com (mail-wg0-f49.google.com [74.125.82.49]) by hemlock.osuosl.org (Postfix) with ESMTPS id F190495B5D for ; Thu, 26 Mar 2015 22:44:55 +0000 (UTC) Received: by wgdm6 with SMTP id m6so80780565wgd.2 for ; Thu, 26 Mar 2015 15:44:54 -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=tzXZZzEXNh1vJa048v3hCLueha695CS24UzgvrhEvds=; b=XrKIM0glv3fIXAQOxW/zFmSdmKICgnPMcUoTQQQjx3ZGXSF2x42KcmoEHeBu0o73+A YA/N34regv7wSs8/LQC1ovdwra4RbyaLa9SjZt826AOobNAkuPHufqwXnwWedQ7a+Uy/ O8osIr9eaftnNNM/h3Ifef1lLZfqnWfFF80LW6nNZIdZWnHA0PbDUlvc8+uTRbh5QFDG 1xV+xYZ432nAF8LQjSmTSY3y3tO2e3NoYkI7h0+KzwI6g2HXU3Ek6io9hQnBzcSKJyCM kbyuSm+zOE87MyC0ebpR3l85wrBewMnvUX9dNUemQ6TBMVuU7/TkN+0IfwF2yK8oBtFc lWxA== X-Gm-Message-State: ALoCoQktbj5IX+Lb4k71bUr9ZRcpkFMSwZnGU6B1Jetf5fT9uYffTx2sr8Js59VhJHHElaj+A3X0 X-Received: by 10.195.12.35 with SMTP id en3mr30998655wjd.129.1427409894327; Thu, 26 Mar 2015 15:44:54 -0700 (PDT) Received: from vladz-laptop.localdomain (bzq-109-65-117-109.red.bezeqint.net. [109.65.117.109]) by mx.google.com with ESMTPSA id g8sm214969wiy.19.2015.03.26.15.44.53 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 26 Mar 2015 15:44:53 -0700 (PDT) From: Vlad Zolotarov To: netdev@vger.kernel.org Date: Fri, 27 Mar 2015 00:44:46 +0200 Message-Id: <1427409886-20261-3-git-send-email-vladz@cloudius-systems.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1427409886-20261-1-git-send-email-vladz@cloudius-systems.com> References: <1427409886-20261-1-git-send-email-vladz@cloudius-systems.com> Cc: avi@cloudius-systems.com, intel-wired-lan@lists.osuosl.org, gleb@cloudius-systems.com Subject: [Intel-wired-lan] [PATCH net-next v2 2/2] ixgbe: Add the appropriate ethtool ops to query RSS indirection table and key X-BeenThere: intel-wired-lan@lists.osuosl.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Intel Wired Ethernet Linux Kernel Driver Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-wired-lan-bounces@lists.osuosl.org Sender: "Intel-wired-lan" 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. Signed-off-by: Vlad Zolotarov --- drivers/net/ethernet/intel/ixgbe/ixgbe.h | 1 + drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c | 42 ++++++++++++++++++++++++ drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 2 +- 3 files changed, 44 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe.h b/drivers/net/ethernet/intel/ixgbe/ixgbe.h index 7bf4b77..42ed4b4 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe.h +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe.h @@ -963,4 +963,5 @@ void ixgbe_sriov_reinit(struct ixgbe_adapter *adapter); netdev_tx_t ixgbe_xmit_frame_ring(struct sk_buff *skb, struct ixgbe_adapter *adapter, struct ixgbe_ring *tx_ring); +u32 ixgbe_rss_indir_tbl_entries(struct ixgbe_adapter *adapter); #endif /* _IXGBE_H_ */ diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c index 02ffb30..0b880a4 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c @@ -2853,6 +2853,45 @@ static int ixgbe_set_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd) return ret; } +static u32 ixgbe_get_rxfh_key_size(struct net_device *netdev) +{ + struct ixgbe_adapter *adapter = netdev_priv(netdev); + + return sizeof(adapter->rss_key); +} + +static u32 ixgbe_rss_indir_size(struct net_device *netdev) +{ + struct ixgbe_adapter *adapter = netdev_priv(netdev); + + return ixgbe_rss_indir_tbl_entries(adapter); +} + +static void ixgbe_get_reta(struct ixgbe_adapter *adapter, u32 *indir) +{ + int i, reta_size = ixgbe_rss_indir_tbl_entries(adapter); + + for (i = 0; i < reta_size; i++) + indir[i] = adapter->rss_indir_tbl[i]; +} + +static int ixgbe_get_rxfh(struct net_device *netdev, u32 *indir, u8 *key, + u8 *hfunc) +{ + struct ixgbe_adapter *adapter = netdev_priv(netdev); + + if (hfunc) + *hfunc = ETH_RSS_HASH_TOP; + + if (indir) + ixgbe_get_reta(adapter, indir); + + if (key) + memcpy(key, adapter->rss_key, ixgbe_get_rxfh_key_size(netdev)); + + return 0; +} + static int ixgbe_get_ts_info(struct net_device *dev, struct ethtool_ts_info *info) { @@ -3110,6 +3149,9 @@ static const struct ethtool_ops ixgbe_ethtool_ops = { .set_coalesce = ixgbe_set_coalesce, .get_rxnfc = ixgbe_get_rxnfc, .set_rxnfc = ixgbe_set_rxnfc, + .get_rxfh_indir_size = ixgbe_rss_indir_size, + .get_rxfh_key_size = ixgbe_get_rxfh_key_size, + .get_rxfh = ixgbe_get_rxfh, .get_channels = ixgbe_get_channels, .set_channels = ixgbe_set_channels, .get_ts_info = ixgbe_get_ts_info, diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c index d8051d3..a99bc5d 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c @@ -3237,7 +3237,7 @@ static void ixgbe_configure_srrctl(struct ixgbe_adapter *adapter, * - X550(non-SRIOV mode): 512 * - X550(SRIOV mode): 64 */ -static u32 ixgbe_rss_indir_tbl_entries(struct ixgbe_adapter *adapter) +u32 ixgbe_rss_indir_tbl_entries(struct ixgbe_adapter *adapter) { if (adapter->hw.mac.type < ixgbe_mac_X550) return 128;