From patchwork Wed Mar 25 17:42:42 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vlad Zolotarov X-Patchwork-Id: 454739 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 126B7140161 for ; Thu, 26 Mar 2015 05:59:40 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 3A5AD338C2 for ; Wed, 25 Mar 2015 18:59:40 +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 4PzUPOEKpsyD for ; Wed, 25 Mar 2015 18:59:38 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by silver.osuosl.org (Postfix) with ESMTP id 3A92A338D7 for ; Wed, 25 Mar 2015 18:59:36 +0000 (UTC) X-Original-To: intel-wired-lan@lists.osuosl.org Delivered-To: intel-wired-lan@lists.osuosl.org Received: from whitealder.osuosl.org (whitealder.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id BB6B01BFA7A for ; Wed, 25 Mar 2015 17:49:23 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id B67FC8AB87 for ; Wed, 25 Mar 2015 17:49:23 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id UK6qOM4-tuzs for ; Wed, 25 Mar 2015 17:49:23 +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 whitealder.osuosl.org (Postfix) with ESMTPS id DEAF08A87B for ; Wed, 25 Mar 2015 17:49:22 +0000 (UTC) Received: by wgbcc7 with SMTP id cc7so36006448wgb.0 for ; Wed, 25 Mar 2015 10:49:21 -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=obN4c5lTsZT15gpZNKHQQ6EcPZi7c2tX3H3r/s833sw=; b=g8ityTa/qijwBDrfbu+HUdOsCS3qAk9sXuWRBrCN1ppsw0XyURPzG1NIXFxd7SE+R+ Cu6J34VLHpPt2BjpWDaXXFy8CEyey3wNwW33mYBoXqR2VzELV2owvSfrJAPCwq5XgWFz ZbdIgRUsmjYZ+TOC+oN8Fq52KKN9CZvVsswWlFIJODDA6oMFODf0ymNrXSrJOuY3uZdE ruS0SQ054jCn+a5RX4EWUN2BZJKLekvMkcuLilCn0e0+BJyyHRYq15lbFD9VqB+erMkJ FUOh54q5+XE8LTha6SjUS9HJnBR0wuwErimQUw/USnwH5zaCWeqXqSrei/T4vtvT47J1 x/bw== X-Gm-Message-State: ALoCoQkNE1aB3IGni2ZhJVDCOD9X5TnJOcfvM3PyPSNCrhms99+rX1yJSVKfA3M7XXbrOsH8tq8K X-Received: by 10.194.63.172 with SMTP id h12mr20050697wjs.48.1427305379878; Wed, 25 Mar 2015 10:42:59 -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 na4sm5267653wic.10.2015.03.25.10.42.58 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 25 Mar 2015 10:42:59 -0700 (PDT) From: Vlad Zolotarov To: netdev@vger.kernel.org Date: Wed, 25 Mar 2015 19:42:42 +0200 Message-Id: <1427305362-23948-8-git-send-email-vladz@cloudius-systems.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1427305362-23948-1-git-send-email-vladz@cloudius-systems.com> References: <1427305362-23948-1-git-send-email-vladz@cloudius-systems.com> X-Mailman-Approved-At: Wed, 25 Mar 2015 18:59:34 +0000 Cc: avi@cloudius-systems.com, intel-wired-lan@lists.osuosl.org, gleb@cloudius-systems.com Subject: [Intel-wired-lan] [PATCH net-next v8 7/7] ixgbevf: 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 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. --- 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..7cb4008 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, indir); + if (err) + return err; + } + + if (key) { + err = ixgbevf_get_rss_key(adapter, 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)