From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-CO1-obe.outbound.protection.outlook.com (mail-co1nam03on0057.outbound.protection.outlook.com [104.47.40.57]) by dpdk.org (Postfix) with ESMTP id 77F75FA66 for ; Thu, 2 Mar 2017 12:39:18 +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=EtVAPBaLJ6wwFNy38mPAqE+ES8Jj2UxFX5XbBriTUUQOWzRWPa6qJ3d3y+Zs620aAlPY55i9qWDv+G2oLd8KFFoyg5maT+rmRjkU9s2xsmbT6tQph5GE8gusSe0qaG3q9z3CEZLlkRJ48fqhD9zreXQTD0k+O1oHC7QON+UAVv8= 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 CY1PR07MB2277.namprd07.prod.outlook.com (10.164.112.155) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.947.12; Thu, 2 Mar 2017 11:39:14 +0000 From: Shijith Thotton To: ferruh.yigit@intel.com Cc: dev@dpdk.org, Jerin Jacob , Derek Chickles , Venkat Koppula , Srisivasubramanian S , Mallesham Jatharakonda Date: Thu, 2 Mar 2017 17:02:31 +0530 Message-Id: <1488454371-3342-27-git-send-email-shijith.thotton@caviumnetworks.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1488454371-3342-1-git-send-email-shijith.thotton@caviumnetworks.com> References: <1487669225-30091-1-git-send-email-shijith.thotton@caviumnetworks.com> <1488454371-3342-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: BM1PR01CA0021.INDPRD01.PROD.OUTLOOK.COM (10.163.198.156) To CY1PR07MB2277.namprd07.prod.outlook.com (10.164.112.155) X-MS-Office365-Filtering-Correlation-Id: db69063a-3880-498d-9d36-08d46160c266 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:CY1PR07MB2277; X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2277; 3:UKuGEOK+SrdDyy/e9x+NLvBc8f4kg8cgCXd+am3qoyqj9DWoqgI03U1BTnR/3MUS+2gT1P6oq1ZyUvxT258vZUjkth6emkaxSAmcv3n84wQA8A8Fy1OKBS4tToAnZLqc3wVsiQkAixrsXQgiQXMIMA6NCeJlCR+gklEp73IlMt6fcx/MJMl1GQZcgbbGLp3BBKP4VGK+7UmKSbKBwv6/u3Y4SpxCMR6WlpUSQpoa5LecDjvu5fPuyjO+knbLIvHqcP7XRMLDnaPZG8Rw56FWbw==; 25:AjSVEIF6v4MKlRz4mOCYnGvHbHwXdcWCND3OZjQG3wABjl2ATYZj1Ivtu+KPCNH/Ay1gj5YMWuFijnM3x91lrP5yVSSkhjetYguZp9MuDQEqZHkUjnWgrB8v4LmpO+kJfiU2gkqAbV0aK3rR0jwa6Ay2eNS3a9hX4dp6upXVtzic3rzqVY4ykGR/jP4T+aI+26ttVU9231u4A3m0oEXwVQdK6sxTH05yLHuVz3S2XyyfOFJshX9U51Op3YplQ4H7hXbfbi1kNn+nJV6UJqo0/holtLpZx9g6xaiTH4HE85fsmTbQhOIQy27AzG0KQj2a0rmsmi9MR2guwQVWZcz+XrTEsQm4yRPvBHkqDJR9RmFbTn/VYQEiar913LxmBHtZypiKUTWKYIxouZyc03IPM9X0JJqo5eJlPf8uVTQSNh27KN6yg0lDgUMcBo5AGCkjJbhPbgModR8I0GWwjZjSuQ== X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2277; 31:F3HVF9XXBUuQjsff344dqUDb7UJ2u5M5Nfjye/ITWlmG2SYiZtMPmhwsPzRAftLbAsNgPoTQEa9TdhE39N3WmTgFIZ5jBB0JQ8AiZE9AxgxlK/3IxFWyAs2MFXePNdFoXeCsxOF01mS1U2CAqd3Rpe/KEBpPDp6HzAgtcjae8a1jvzb8QtQghdL747S4PowtMFNfFT5OIcbIr3M1IH/M8vz2O9w5Seac79ysHvgf49xg/t0NtBYWzlhVo3q2PaSt; 20:1tm3i/NO3mEGdR+8u7RE9rJo59pCnWCUKbyQzGSSm0SSx21vOzje4m4bT/UjYc5fb4twdSMii6fJ/IFNb7j/rwGMw1Y/q8pEFcalzkN4nt9j337HbLyVWYp0MjUjv3TCuBK4N9O746mYh35g7BMOOaDcbQvZM4IvA7A9vXTpk1/SzoZh1n8r8RR4iSITOcWK5+aEhSgjVLCTRyFobocJ/M416RHW/OeoMsvaWKlBEdyDUPVOmKJP7vJxXXdUczA1IsK5a+tgknE4Qq+uyAuEnVDsswWEkhUgIqMe5130eIrSujXRSmjYHhhBQAS0iA6WwzUF+8OpiEQIlxkI5GnjO+OfceEDg5wylJuGH1SI48NZxc4NDeZz+7Gq4whr0wxgn9gcMzk1xltpYVeq8/nrUm65OG6uYoTw4xzT80wCCDh4XgKiiNKGYxthzRUV9BWZk+gfafpcjW1PF+5HUcmajrLsB+eHJ7R4U/oRvjLmYpSy6Dv/uBTrc77We3YxIyjdxSuHBpnc2G3HwmXj1hr5gALtdT7MHKL7BqZ5sOMa2ayQO6MAVn7t7rpVhtVghar2zl4W+BH6LMMqqOdSsCf4gQHghpw2O813AbKJN7jSLpA= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040375)(601004)(2401047)(5005006)(8121501046)(10201501046)(3002001)(6041248)(20161123558025)(20161123555025)(20161123560025)(20161123564025)(20161123562025)(6072148); SRVR:CY1PR07MB2277; BCL:0; PCL:0; RULEID:; SRVR:CY1PR07MB2277; X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2277; 4:FUtTgWpGemszNKNIhPRWm3nho3YQ2V4HGqOwl0fSkna4opz7KyjAEfAg1DRrebkY3aHxWsuP1FK6eTU4lcwPLiK7Oz0QFwKZmfD+xmzctrdFxeUqYEB6RoSj99tSw0gWYup9WYVS4DBws63Jf+CyoWXuftvjl0Wn7heHO3qsTGUsZ37gE/3OWp20UuAoQLXEGaCua3NAE+67N2Fo/vLNV60fnmhTw8cmZVT/gVh6wAmGgNokot05TBLkS55sMsHPhsL02HhTuLLDZG2vwmMTsbamjO7dcX4QkTk0nFk7jR4tb3UE3dNz9/WvahedLrQgEbUGL2OAbw/A1lhdC1y95B6G8l/9CMhBWobaw9a5CSwhxj7lsE3aNnvmSaDRRdS5LidWmJjGtqzxnFo4/rWaqVswNsXycyMqYlO1HFcnBBiXWhduVfhNyGDwLBpkXb4pZACmwjKAXPh7WimR390zQTIQU9rMIZRYqDkAG+huR9nXBFBdLLTBORN4LVpP6mV97XhKwXz4wRyc3Dua5Pz1ytsuYVRdWXB5t6IoscrljqosadLfL3jencvF+9hBeCApdczij8r1vnAlpOnRbE2rycOmNVKOc11OHUskbqMdYB8= X-Forefront-PRVS: 023495660C X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(979002)(6009001)(7916002)(39450400003)(2950100002)(6916009)(42882006)(5660300001)(92566002)(4720700003)(33646002)(48376002)(50226002)(6666003)(2906002)(5003940100001)(36756003)(8676002)(50466002)(81166006)(110136004)(38730400002)(4326008)(305945005)(2361001)(53936002)(2351001)(25786008)(6512007)(189998001)(54906002)(47776003)(6506006)(6486002)(66066001)(6116002)(3846002)(50986999)(76176999)(5009440100003)(42186005)(7736002)(7099028)(110426004)(969003)(989001)(999001)(1009001)(1019001); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR07MB2277; H:lio357.in.caveonetworks.com; FPR:; SPF:None; MLV:ovr; PTR:InfoNoRecords; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY1PR07MB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Em+E/Mkza5EdWRadYNpfI8dvcMjz/ehGviOGIIb9XiJnlJ1ktPmYleg= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2277; 7:O4skI+MYTi3tFaP6k/Fp/SKn3ecyUTwb3RgR8uD2hDiqucI4LCEsbcB6ku0MDlfx5sM0C6XEcNTEGcjewjqtDKbHV+pGj+cA2uArwqWdJYjcmjEtzKCTl6cwGO5EYhQARvgBYCwooaFt81H92B9Me0SgpST31ax6Um4Ftg/kAGZkvJVPT4VICerh/LJHvQbufjJy+FM6F9i+aYMqydjf57/LTyAF7v/omJ7p87dDdmAfxN4zRqtoSwvitSiIg2Rp35LSGlgbZ1Xt9HSjE4fD49iRC3PdqGhaNOYuzTbVfB+aaQw06TZm+52/S+3Yj7rO0QLPZDdY7/chJLY7qizthQ== X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Mar 2017 11:39:14.8435 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR07MB2277 Subject: [dpdk-dev] [PATCH v2 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: Thu, 02 Mar 2017 11:39:19 -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