From patchwork Thu Mar 14 15:08:56 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vipul Pandya X-Patchwork-Id: 2271781 Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 502FCDFB79 for ; Thu, 14 Mar 2013 15:15:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933595Ab3CNPPq (ORCPT ); Thu, 14 Mar 2013 11:15:46 -0400 Received: from stargate.chelsio.com ([67.207.112.58]:6472 "EHLO stargate.chelsio.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933442Ab3CNPPn (ORCPT ); Thu, 14 Mar 2013 11:15:43 -0400 Received: from maui.asicdesigners.com (maui.asicdesigners.com [10.192.180.15]) by stargate.chelsio.com (8.13.1/8.13.1) with SMTP id r2EFFesd007559; Thu, 14 Mar 2013 08:15:40 -0700 Received: from strawberry.asicdesigners.com ([10.193.185.96]) by maui.asicdesigners.com with Microsoft SMTPSVC(6.0.3790.4675); Thu, 14 Mar 2013 08:15:39 -0700 From: Vipul Pandya To: netdev@vger.kernel.org, linux-rdma@vger.kernel.org, linux-scsi@vger.kernel.org Cc: davem@davemloft.net, roland@purestorage.com, JBottomley@parallels.com, dm@chelsio.com, swise@opengridcomputing.com, leedom@chelsio.com, naresh@chelsio.com, divy@chelsio.com, santosh@chelsio.com, arvindb@chelsio.com, abhishek@chelsio.com, vipul@chelsio.com Subject: [PATCH v2 net-next 10/22] cxgb4: Disable SR-IOV support for PF4-7 for T5 Date: Thu, 14 Mar 2013 20:38:56 +0530 Message-Id: <1363273748-25330-11-git-send-email-vipul@chelsio.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1363273748-25330-1-git-send-email-vipul@chelsio.com> References: <1363273748-25330-1-git-send-email-vipul@chelsio.com> X-OriginalArrivalTime: 14 Mar 2013 15:15:39.0707 (UTC) FILETIME=[C98800B0:01CE20C6] Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org From: Santosh Rastapur All T5 adapters will only support VFs on PF0-3 despite the ability of the hardware to support them on PF4-7. This keeps our T4 and T5 adapters more similar which simplifies host driver software. Signed-off-by: Vipul Pandya --- v2: Replaced #ifdef with portable interface wmb in ring_tx_db drivers/net/ethernet/chelsio/cxgb4/cxgb4.h | 8 ++++---- drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c | 21 ++++++--------------- 2 files changed, 10 insertions(+), 19 deletions(-) diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4.h b/drivers/net/ethernet/chelsio/cxgb4/cxgb4.h index 45b18bd..681804b 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4.h +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4.h @@ -534,11 +534,11 @@ enum chip_type { #ifdef CONFIG_PCI_IOV -/* T4 - 4 PFs support SRIOV - * T5 - 8 PFs support SRIOV +/* T4 supports SRIOV on PF0-3 and T5 on PF0-7. However, the Serial + * Configuration initialization for T5 only has SR-IOV functionality enabled + * on PF0-3 in order to simplify everything. */ -#define NUM_OF_PF_WITH_SRIOV_T4 4 -#define NUM_OF_PF_WITH_SRIOV_T5 8 +#define NUM_OF_PF_WITH_SRIOV 4 #endif diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c index c502e36..a59bb23 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c @@ -360,14 +360,13 @@ static bool vf_acls; module_param(vf_acls, bool, 0644); MODULE_PARM_DESC(vf_acls, "if set enable virtualization L2 ACL enforcement"); -/* Since T5 has more num of PFs, using NUM_OF_PF_WITH_SRIOV_T5 - * macro as num_vf array size +/* Configure the number of PCI-E Virtual Function which are to be instantiated + * on SR-IOV Capable Physical Functions. */ -static unsigned int num_vf[NUM_OF_PF_WITH_SRIOV_T5]; +static unsigned int num_vf[NUM_OF_PF_WITH_SRIOV]; module_param_array(num_vf, uint, NULL, 0644); -MODULE_PARM_DESC(num_vf, - "number of VFs for each of PFs 0-3 for T4 and PFs 0-7 for T5"); +MODULE_PARM_DESC(num_vf, "number of VFs for each of PFs 0-3"); #endif /* @@ -4633,10 +4632,8 @@ static int adap_init0_no_config(struct adapter *adapter, int reset) */ { int pf, vf; - int max_no_pf = is_t4(adapter->chip) ? NUM_OF_PF_WITH_SRIOV_T4 : - NUM_OF_PF_WITH_SRIOV_T5; - for (pf = 0; pf < max_no_pf; pf++) { + for (pf = 0; pf < ARRAY_SIZE(num_vf); pf++) { if (num_vf[pf] <= 0) continue; @@ -5483,9 +5480,6 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent) struct port_info *pi; bool highdma = false; struct adapter *adapter = NULL; -#ifdef CONFIG_PCI_IOV - int max_no_pf; -#endif printk_once(KERN_INFO "%s - version %s\n", DRV_DESC, DRV_VERSION); @@ -5704,10 +5698,7 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent) sriov: #ifdef CONFIG_PCI_IOV - max_no_pf = is_t4(adapter->chip) ? NUM_OF_PF_WITH_SRIOV_T4 : - NUM_OF_PF_WITH_SRIOV_T5; - - if (func < max_no_pf && num_vf[func] > 0) + if (func < ARRAY_SIZE(num_vf) && num_vf[func] > 0) if (pci_enable_sriov(pdev, num_vf[func]) == 0) dev_info(&pdev->dev, "instantiated %u virtual functions\n",