From patchwork Wed Jan 7 19:26:37 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vlad Zolotarov X-Patchwork-Id: 426380 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 2F9731400B7 for ; Thu, 8 Jan 2015 06:27:07 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754458AbbAGT07 (ORCPT ); Wed, 7 Jan 2015 14:26:59 -0500 Received: from mail-we0-f170.google.com ([74.125.82.170]:36889 "EHLO mail-we0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753603AbbAGT06 (ORCPT ); Wed, 7 Jan 2015 14:26:58 -0500 Received: by mail-we0-f170.google.com with SMTP id w61so1768047wes.15 for ; Wed, 07 Jan 2015 11:26:57 -0800 (PST) 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=9gdSwbKITXm2PaLxe15lWA0cLurmcoNlBira3j+8gZ8=; b=hI4do9LhMCQXrlrNFrfTaTfWZLY74gKd4NrE1aOJWzxyPRD1Qol8CKQuoR5DpNSEcu DbtzrTO7WFeXZE1aqG9ovy+NIceKotIy573j9oY8V6VNdVu6/ZOZCLX983Wty5wU+NLF ECS2d44e99H8z/vewPpkWkOnh31JYZKHM4lsFCJNwy4YnuXvpqH2wISbwjnkzQy60aYV itMCgdGfGDpc/NXucEUzxvpUZScVylxCb1ZiZSaKFUXaIhfG8S9RJxQWDCkLSAVZk562 7/ex2hYWXTGQUr6PJJ/G/4ZJjNkHluxKbzmGuT0xzCezIBzqDcYkSoChzSke1ZgBCW5/ 0fFQ== X-Gm-Message-State: ALoCoQn5E8JtorMHnGShfjVixNYm/DCCsJa21szHMnCH1twrU+Bc0CfKGzv8KmALqkrwxJskcncS X-Received: by 10.180.198.52 with SMTP id iz20mr51644806wic.60.1420658817200; Wed, 07 Jan 2015 11:26:57 -0800 (PST) Received: from vladz-laptop.localdomain ([109.66.164.96]) by mx.google.com with ESMTPSA id cs8sm19008663wib.1.2015.01.07.11.26.56 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 07 Jan 2015 11:26:56 -0800 (PST) From: Vlad Zolotarov To: netdev@vger.kernel.org Cc: gleb@cloudius-systems.com, avi@cloudius-systems.com, jeffrey.t.kirsher@intel.com, Vlad Zolotarov Subject: [PATCH net-next v5 2/7] ixgbe: Add a new netdev op to allow/prevent a VF from querying an RSS info Date: Wed, 7 Jan 2015 21:26:37 +0200 Message-Id: <1420658802-18061-3-git-send-email-vladz@cloudius-systems.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1420658802-18061-1-git-send-email-vladz@cloudius-systems.com> References: <1420658802-18061-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 Implements the new netdev op to allow user to enable/disable the ability of a specific VF to query its RSS Indirection Table and an RSS Hash Key. Signed-off-by: Vlad Zolotarov --- drivers/net/ethernet/intel/ixgbe/ixgbe.h | 1 + drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 7 +++++++ drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c | 27 ++++++++++++++++++++++++++ drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.h | 2 ++ 4 files changed, 37 insertions(+) diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe.h b/drivers/net/ethernet/intel/ixgbe/ixgbe.h index 38fc64c..5e3ff3e 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe.h +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe.h @@ -149,6 +149,7 @@ struct vf_data_storage { u16 tx_rate; u16 vlan_count; u8 spoofchk_enabled; + bool rss_query_enabled; unsigned int vf_api; }; diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c index 2ed2c7d..0074e63 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c @@ -3569,6 +3569,12 @@ static void ixgbe_configure_virtualization(struct ixgbe_adapter *adapter) if (!adapter->vfinfo[i].spoofchk_enabled) ixgbe_ndo_set_vf_spoofchk(adapter->netdev, i, false); } + + /* Enable/Disable RSS query feature */ + for (i = 0; i < adapter->num_vfs; i++) + ixgbe_ndo_set_vf_rss_query_en(adapter->netdev, i, + adapter->vfinfo[i].rss_query_enabled); + } static void ixgbe_set_rx_buffer_len(struct ixgbe_adapter *adapter) @@ -7955,6 +7961,7 @@ static const struct net_device_ops ixgbe_netdev_ops = { .ndo_set_vf_vlan = ixgbe_ndo_set_vf_vlan, .ndo_set_vf_rate = ixgbe_ndo_set_vf_bw, .ndo_set_vf_spoofchk = ixgbe_ndo_set_vf_spoofchk, + .ndo_set_vf_rss_query_en = ixgbe_ndo_set_vf_rss_query_en, .ndo_get_vf_config = ixgbe_ndo_get_vf_config, .ndo_get_stats64 = ixgbe_get_stats64, #ifdef CONFIG_IXGBE_DCB diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c index c76ba90..c903ab2 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c @@ -111,6 +111,19 @@ static int __ixgbe_enable_sriov(struct ixgbe_adapter *adapter) /* enable spoof checking for all VFs */ for (i = 0; i < adapter->num_vfs; i++) adapter->vfinfo[i].spoofchk_enabled = true; + + /* by default: + * - Enable RSS query for x550 devices. x550 VFs don't share + * RSS Redirection Table and RSS Hash Key with a PF, so + * there isn't any possible security threat in allowing them + * to query this information. + * - disable - for all the rest since they do share it with a + * PF. + */ + for (i = 0; i < adapter->num_vfs; i++) + adapter->vfinfo[i].rss_query_enabled = + (adapter->hw.mac.type >= ixgbe_mac_X550); + return 0; } @@ -1330,6 +1343,19 @@ int ixgbe_ndo_set_vf_spoofchk(struct net_device *netdev, int vf, bool setting) return 0; } +int ixgbe_ndo_set_vf_rss_query_en(struct net_device *netdev, int vf, + bool setting) +{ + struct ixgbe_adapter *adapter = netdev_priv(netdev); + + if (vf >= adapter->num_vfs) + return -EINVAL; + + adapter->vfinfo[vf].rss_query_enabled = setting; + + return 0; +} + int ixgbe_ndo_get_vf_config(struct net_device *netdev, int vf, struct ifla_vf_info *ivi) { @@ -1343,5 +1369,6 @@ int ixgbe_ndo_get_vf_config(struct net_device *netdev, ivi->vlan = adapter->vfinfo[vf].pf_vlan; ivi->qos = adapter->vfinfo[vf].pf_qos; ivi->spoofchk = adapter->vfinfo[vf].spoofchk_enabled; + ivi->rss_query_en = adapter->vfinfo[vf].rss_query_enabled; return 0; } diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.h b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.h index 32c26d5..2c197e6 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.h +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.h @@ -47,6 +47,8 @@ int ixgbe_ndo_set_vf_vlan(struct net_device *netdev, int queue, u16 vlan, int ixgbe_ndo_set_vf_bw(struct net_device *netdev, int vf, int min_tx_rate, int max_tx_rate); int ixgbe_ndo_set_vf_spoofchk(struct net_device *netdev, int vf, bool setting); +int ixgbe_ndo_set_vf_rss_query_en(struct net_device *netdev, int vf, + bool setting); int ixgbe_ndo_get_vf_config(struct net_device *netdev, int vf, struct ifla_vf_info *ivi); void ixgbe_check_vf_rate_limit(struct ixgbe_adapter *adapter);