From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on0087.outbound.protection.outlook.com [104.47.36.87]) by dpdk.org (Postfix) with ESMTP id C8788F962 for ; Sat, 25 Mar 2017 07:28:15 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=Jm7dNu95CFb0wCb390I16bhF6S8pyCahYMYWNEDv1CY=; b=ggy+3mZC3OtaNsYDziU/LDUJdaTMW4RaSEXjxWPCNa4+X/vZOhtlbizY9uy4jhoqv2s6uG4EM8RZKQvOoIYR0Hd+2TYisxOKwwQcxIbq6Fm68BPJVVrpgzvzy5ogkXcb8n5Kul0uE5nRflZXj9P3wy0qhw5suR1/UekgaSaKvTQ= Authentication-Results: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=caviumnetworks.com; Received: from lio357.in.caveonetworks.com (14.140.2.178) by CY1PR07MB2280.namprd07.prod.outlook.com (10.164.112.158) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.977.11; Sat, 25 Mar 2017 06:28:11 +0000 From: Shijith Thotton To: Ferruh Yigit Cc: dev@dpdk.org, Jerin Jacob , Derek Chickles , Venkat Koppula , Srisivasubramanian S , Mallesham Jatharakonda Date: Sat, 25 Mar 2017 11:54:37 +0530 Message-Id: <1490423097-6797-27-git-send-email-shijith.thotton@caviumnetworks.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1490423097-6797-1-git-send-email-shijith.thotton@caviumnetworks.com> References: <1488454371-3342-1-git-send-email-shijith.thotton@caviumnetworks.com> <1490423097-6797-1-git-send-email-shijith.thotton@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [14.140.2.178] X-ClientProxiedBy: BM1PR01CA0117.INDPRD01.PROD.OUTLOOK.COM (10.174.208.33) To CY1PR07MB2280.namprd07.prod.outlook.com (10.164.112.158) X-MS-Office365-Filtering-Correlation-Id: 5e15587f-cbef-498a-925b-08d473481ddc X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:CY1PR07MB2280; X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2280; 3:KaY1RJaq2Q33XLcwFB1ERUBS2VH7fzQgTIBObFXWvGhPvxmu/dOZcJh38DrbIU7jxocF6CvAoBombwsP72A4Q/wDE/5LUVYTk1/10f615cMvHilyiMslHPUEf3kehAbSgiaF8Lz4TEBCTJ2b0YPCdPsnx8nT/0CtGq1yDqy54sQuHOVEQMkdv+D6ulyIBO8fSIicys2miD/X2Hq21Dzh/VTVr0lUJfFEkn5jXxXNtCKz+og4fCHGFQ3eh9lEDNQM2BspYIC/gw5KlcyZ8qsN8Q==; 25:TQHe9vEw6HbJdgp9B6VrPUu/uYnkVKAZpQl4taeg+hzvOzn/8H+3f5daG/PACDnDzF4BBfzJ6TM9f4HQhCp3Q7qHW5ZdwbuNK/BGInY0nzC2vAQlqngHVR7TqhwzsWYu5H4RTgWD30DSCoat9I+UMnMjqdz2H/OaMoYN8R9lOa3v8AsXwM3Et6iWA2SckfHrr7tYq/8BZ+SYD7MUJcZ4SxBn7HDzTfpWlfWEG6KRzfNS0yrqaP2UwCNyULrAOAbaSW2uOD7MwmLSX4leX09ScAU9HNRLjP37I8w9oGpjsi3T8AlunWIw2RslgI7sUESn+htIRRpeak3+wrSlXcunEv3Qc8KOaTm6F7vHTAU3h/foQvJMmZkCTUfKAVZVmIp/sCA0LrYYZ1GWsmC15H/oCmzY4pSkHWOUEBn+/AvZguiDTA4MeD2Bt4mETDQdH/g/4kk7kqivfzBCqTJntBgS9A== X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2280; 31:d5KveFr9GifolHo7jEW5JbfiO/f5+P+cwqRDnKCUPz6/j01Kx/Lwrxw3zGqu/7iw4CPsn6a26AS2R+mhi3QWm81zWoX+1mRhjMgzyQZJn9/hJTMK2XtK3egxvZkDStc6km1wZXtRYd/vASFy9jZ9JN8HdRej3I3D/QNdrokVAUfHIb93BGRkQIWVcQC4g0m78kH0n8GEWjEA4ICKFOqtAbJCT1osyhsQad6YKyX5768QMMKLp1ucPUxV3cOJ+513aaS6GhLOnVlhzLdC6kHcug==; 20:jC65TfoPI/ycklaoOF2xnb8/NxohcZ+f3Dbb7pNgjPZcKtZjsJhDyFiPQG5+zyHxWvMKbBZKefsZ9e2PUIn0kKLgJdKn1iBI7nYZ0SQsBNl6tTdtvH4Q/5dVNH1nxzWuVPKDAK1Sg6RZxRb/lz1uydDrw8sMUt6qa4A4wXbLnCklGdVIOzaMvVy5/GpGOJDsoxnHybaMYxmQiiR1eilxx5x96O61zrzDBPAjlZDEdzd7a4ThDsAvIBsImK1fjWLJn9eSF1UHJde1vIh0NVARr148l62OwFSQ9puH4ewERwk5I99o4PcahOSc04xy6I17ANbXyhFf6Nsb2X41m1qNZyPAL6UCeU3WUEGSH7r6fPdzHIkqhsXxK1HTGJ5luPVEWMurgI03xwHBf++asA09Z4uDrpBwQDT5wqKtmY7n6gAcUDn3M6dZHx4maJGM/uQIsJZLiMzqGry1EUbHuPZVSdrNAQLd1wGJkQNse6AD3NDvENuaaHJhRYdEhRJy+MaOcwEZgl1dsqKvwxVEQaTc7usmwZaTcCOwPxC1jtwgPo68RRxchnQCGKcpxz+wnomjrNM21KWogToNi+TJMSefJwKQEXbN5mfozmNwFxubvhw= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040375)(601004)(2401047)(8121501046)(5005006)(3002001)(10201501046)(6041248)(20161123564025)(20161123560025)(20161123562025)(20161123558025)(20161123555025)(6072148); SRVR:CY1PR07MB2280; BCL:0; PCL:0; RULEID:; SRVR:CY1PR07MB2280; X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2280; 4:bz9RUFi0WbtjKXo2jXRTm/1visL+2DmT4j6vJDmVkPPH2wTiiUSin7YwTHfjsAxzvT0oV43r435d5EFh1AZ1Y96+V+e9Sz5FdJxxDSuzLeIcqnyLoHQiVF4zLZVEK1c30xtCaoV+kc6Uz5a+sDPfSpFy1lxNzjMaihFIPsIJxmfzH6nj5uoybPo+OA0ISJAmaHbib15d+2m9eo+s+j7O+FiMBrVhE8WTP82fn3SYlsCnAuGikdF+4tnAE6J1tpyVgSsvP+g28hsiECBkJw4gUFjRCsGFvdIGpZnq36uikf+bIxqsvxdlt6zcwPDqYSMMLXqb0V0WgHUpbdwcgJWoCxvRZsxmqrIHcuzcRLqXzwEMmXhunoOzHVtW21isVCstDBlvAr3Rzfwcglv5Zws/ZEF7HnQTyeqwG3Y9iCez/uyEL3VaZBcyct9eCl81lCYbtRVhPsOTpVzARMbXwj3LhZwYWHLvzRh3jrga3CR82zLYsSthJs+7/vH3VKXUyqKNtVf3jlLnh/5SJme09fM1mMIc8bknMQd+A+JBoQTVrVJ2JF1zWtzKoe45PWxycuHKQmd9BJqiHjzmSZUwpP72E6zC0S7rhGhOGkQCT6gVpvM= X-Forefront-PRVS: 025796F161 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(39450400003)(39410400002)(39830400002)(2906002)(2950100002)(5003940100001)(66066001)(42882006)(6916009)(50466002)(48376002)(47776003)(42186005)(53936002)(6512007)(68736007)(5009440100003)(54906002)(50226002)(38730400002)(6486002)(6666003)(25786009)(305945005)(81166006)(7736002)(6116002)(3846002)(4326008)(8676002)(6506006)(189998001)(36756003)(50986999)(76176999)(33646002)(4720700003)(5660300001)(110136004)(110426004); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR07MB2280; H:lio357.in.caveonetworks.com; FPR:; SPF:None; MLV:nov; PTR:InfoNoRecords; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY1P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ZMf3sL6yakmB8JpPeg?= =?us-ascii?Q?/FCWgD3Gz0n4DvRhW2Cio3QjTXhBHyFdXIoK3S/8GF1VVUF+W6g7rB5F8GY2?= =?us-ascii?Q?NQXtQnKsrT3KovXnoX0GTAgmFUQ6TD/UU2r6x55L6Gm0AnQx7yLKOKiI4e4b?= =?us-ascii?Q?wabxOif0MWhS19s/KM8k5JtzCv2l4evTK1uSfrU2uC2LtnNH4q2govK5KRIW?= =?us-ascii?Q?bFPCsaSjDodwpdDugvQp05K9xhg?= X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2280; 6:/x8Vci+CaFUD6pz3wZ6glUji9ojoSfLIoza0t5pAta7mE37W6z9VXE210dOSsvKHUVEUP2tXW2mfM4JjHV1i5k9BslXIvAuHPvHFm2ah4SXeSMnG0UUxsXf7C+VzdUt/3jRuXf1vg2bM6mjPhZK5EJh8g7kPXEKTVuxHMhlBUhkA31/8RThh/5cEC453ca27rXPH1oBMM6n2CZrD2egklCnkX+ZHwszTKbC4MwGKiYppuboX7nW6YHoVty3CFCayy20HQClBQ3kWiFMsGeGh8iXjb9mVQD+m4A8KTVavcsUTMcXiespuTBNwA971lO/6FvcLhH3Icg1gjXYHArXalw4gzI0nf4oPCw3vWAwN+QHILYtkjL1hrRxtijknDuD6RZHSFuuOs2lJYqos3mpTzA==; 5:8u6uBA1ytPV7b9e6/KGchkhwbmmSF0GFGEfT5a1Mg6CVVDBVF01lXg38fThiW5WwhMjNSZpRKSdwpAlUIt78F4tA5f38+8csjz3cXp8tynC1ch/fnO4H7h0BHmtdH0gyKmWEkw3kKuRz46ANRrLWAA==; 24:18HtvclSXk7z8JM1ttS78M3O7Li8fZuyMIuLa6RyztE75VhoVk6dxTmuRazpeOe4Noch3fcvMWR3gdZq8gMoMYU0LMGE121WjMsq2Vkdr3U= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2280; 7:Ivhls/bVccFINIXUMQFXVkU4PVE8t3PEeXALEakU9dpxMUpKiLfIDWydCfCnRpPeueWt2ZY0uh4ewI3a++Fd4x1reUESOhEADTemPiFRR2L6KRv0AduffmpshmIzAZH0p5eqrC+pF8jvdBWu9gny+lnqTLiCKqK/LKPidkgmayBudqoV1LZshi8cahmvppObv0fCvXfu47BK0OudcIwhOCmoQL+v5YylVk3SRn5cQQt2Jhh2OtOUGDPWLoT1VyexmvyPloMmGnreuBp9M8tXCkfieiZZlu89Uy6u/yYRGsm7G/aSBrHaUJFdJVdEqywqk4DU36iJ4SgGBhUboC6doQ== X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Mar 2017 06:28:11.8007 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR07MB2280 Subject: [dpdk-dev] [PATCH v3 26/46] net/liquidio: add APIs to enable and disable IO queues X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Mar 2017 06:28:16 -0000 Signed-off-by: Shijith Thotton Signed-off-by: Jerin Jacob Signed-off-by: Derek Chickles Signed-off-by: Venkat Koppula Signed-off-by: Srisivasubramanian S Signed-off-by: Mallesham Jatharakonda --- drivers/net/liquidio/base/lio_23xx_vf.c | 70 +++++++++++++++++++++++++++++++++ drivers/net/liquidio/lio_ethdev.c | 13 ++++++ drivers/net/liquidio/lio_rxtx.c | 5 +++ drivers/net/liquidio/lio_struct.h | 2 + 4 files changed, 90 insertions(+) diff --git a/drivers/net/liquidio/base/lio_23xx_vf.c b/drivers/net/liquidio/base/lio_23xx_vf.c index 44d90c0..6ff5b69 100644 --- a/drivers/net/liquidio/base/lio_23xx_vf.c +++ b/drivers/net/liquidio/base/lio_23xx_vf.c @@ -310,6 +310,73 @@ return 0; } +static int +cn23xx_vf_enable_io_queues(struct lio_device *lio_dev) +{ + uint32_t q_no; + + PMD_INIT_FUNC_TRACE(); + + for (q_no = 0; q_no < lio_dev->num_iqs; q_no++) { + uint64_t reg_val; + + /* set the corresponding IQ IS_64B bit */ + if (lio_dev->io_qmask.iq64B & (1ULL << q_no)) { + reg_val = lio_read_csr64( + lio_dev, + CN23XX_SLI_IQ_PKT_CONTROL64(q_no)); + reg_val = reg_val | CN23XX_PKT_INPUT_CTL_IS_64B; + lio_write_csr64(lio_dev, + CN23XX_SLI_IQ_PKT_CONTROL64(q_no), + reg_val); + } + + /* set the corresponding IQ ENB bit */ + if (lio_dev->io_qmask.iq & (1ULL << q_no)) { + reg_val = lio_read_csr64( + lio_dev, + CN23XX_SLI_IQ_PKT_CONTROL64(q_no)); + reg_val = reg_val | CN23XX_PKT_INPUT_CTL_RING_ENB; + lio_write_csr64(lio_dev, + CN23XX_SLI_IQ_PKT_CONTROL64(q_no), + reg_val); + } + } + for (q_no = 0; q_no < lio_dev->num_oqs; q_no++) { + uint32_t reg_val; + + /* set the corresponding OQ ENB bit */ + if (lio_dev->io_qmask.oq & (1ULL << q_no)) { + reg_val = lio_read_csr( + lio_dev, + CN23XX_SLI_OQ_PKT_CONTROL(q_no)); + reg_val = reg_val | CN23XX_PKT_OUTPUT_CTL_RING_ENB; + lio_write_csr(lio_dev, + CN23XX_SLI_OQ_PKT_CONTROL(q_no), + reg_val); + } + } + + return 0; +} + +static void +cn23xx_vf_disable_io_queues(struct lio_device *lio_dev) +{ + uint32_t num_queues; + + PMD_INIT_FUNC_TRACE(); + + /* per HRM, rings can only be disabled via reset operation, + * NOT via SLI_PKT()_INPUT/OUTPUT_CONTROL[ENB] + */ + num_queues = lio_dev->num_iqs; + if (num_queues < lio_dev->num_oqs) + num_queues = lio_dev->num_oqs; + + cn23xx_vf_reset_io_queues(lio_dev, num_queues); +} + void cn23xx_vf_ask_pf_to_do_flr(struct lio_device *lio_dev) { @@ -463,6 +530,9 @@ lio_dev->fn_list.setup_device_regs = cn23xx_vf_setup_device_regs; + lio_dev->fn_list.enable_io_queues = cn23xx_vf_enable_io_queues; + lio_dev->fn_list.disable_io_queues = cn23xx_vf_disable_io_queues; + return 0; } diff --git a/drivers/net/liquidio/lio_ethdev.c b/drivers/net/liquidio/lio_ethdev.c index 77106f6..b2e7a29 100644 --- a/drivers/net/liquidio/lio_ethdev.c +++ b/drivers/net/liquidio/lio_ethdev.c @@ -361,6 +361,15 @@ static int lio_dev_configure(struct rte_eth_dev *eth_dev) lio_free_soft_command(sc); + /* Disable iq_0 for reconf */ + lio_dev->fn_list.disable_io_queues(lio_dev); + + /* Reset ioq regs */ + lio_dev->fn_list.setup_device_regs(lio_dev); + + /* Free iq_0 used during init */ + lio_free_instr_queue0(lio_dev); + return 0; nic_config_fail: @@ -487,6 +496,10 @@ static int lio_dev_configure(struct rte_eth_dev *eth_dev) lio_dev->max_tx_queues = dpdk_queues; lio_dev->max_rx_queues = dpdk_queues; + /* Enable input and output queues for this device */ + if (lio_dev->fn_list.enable_io_queues(lio_dev)) + goto error; + return 0; error: diff --git a/drivers/net/liquidio/lio_rxtx.c b/drivers/net/liquidio/lio_rxtx.c index 50deaba..63d8896 100644 --- a/drivers/net/liquidio/lio_rxtx.c +++ b/drivers/net/liquidio/lio_rxtx.c @@ -892,9 +892,14 @@ goto release_lio_iq; lio_dev->num_iqs++; + if (lio_dev->fn_list.enable_io_queues(lio_dev)) + goto delete_lio_iq; return 0; +delete_lio_iq: + lio_delete_instr_queue(lio_dev, iq_no); + lio_dev->num_iqs--; release_lio_iq: rte_free(lio_dev->instr_queue[iq_no]); lio_dev->instr_queue[iq_no] = NULL; diff --git a/drivers/net/liquidio/lio_struct.h b/drivers/net/liquidio/lio_struct.h index 4d67eb6..906553c 100644 --- a/drivers/net/liquidio/lio_struct.h +++ b/drivers/net/liquidio/lio_struct.h @@ -347,6 +347,8 @@ struct lio_fn_list { void (*free_mbox)(struct lio_device *); int (*setup_device_regs)(struct lio_device *); + int (*enable_io_queues)(struct lio_device *); + void (*disable_io_queues)(struct lio_device *); }; struct lio_pf_vf_hs_word { -- 1.8.3.1