From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-SN1-obe.outbound.protection.outlook.com (mail-sn1nam01on0086.outbound.protection.outlook.com [104.47.32.86]) by dpdk.org (Postfix) with ESMTP id EF3E8FA45 for ; Tue, 21 Feb 2017 10:29:39 +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=JN+P7SoDQPQEprtUaeKSvrv5b1CzDgRcPvrYLgeY5BM=; b=MFnG1AnhfPUsgdy8t5JjEIaca21g4Xk17bm7D/bXkmn/gtGH5/joo8EJqlEmbEG2C/H04awUShtTliOBn3s4jI6+OKPzZHIH8ZSXcb2IyDQGm3x7DzLHi98MK+DKcMDkwSZxUFT/MdJzNADMcBblbKYVeJVp2AtgVuVtpE5hsa0= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Shijith.Thotton@cavium.com; Received: from lio357.in.caveonetworks.com (14.140.2.178) by SN1PR07MB2285.namprd07.prod.outlook.com (10.164.47.155) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.919.13; Tue, 21 Feb 2017 09:29:35 +0000 From: Shijith Thotton To: dev@dpdk.org Cc: Jerin Jacob , Derek Chickles , Venkat Koppula , Mallesham Jatharakonda Date: Tue, 21 Feb 2017 14:56:44 +0530 Message-Id: <1487669225-30091-30-git-send-email-shijith.thotton@caviumnetworks.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1487669225-30091-1-git-send-email-shijith.thotton@caviumnetworks.com> References: <1487669225-30091-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: MA1PR01CA0089.INDPRD01.PROD.OUTLOOK.COM (10.174.56.29) To SN1PR07MB2285.namprd07.prod.outlook.com (10.164.47.155) X-MS-Office365-Filtering-Correlation-Id: bb5e1239-d114-4796-ece7-08d45a3c2814 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:SN1PR07MB2285; X-Microsoft-Exchange-Diagnostics: 1; SN1PR07MB2285; 3:wrU4GcLZag6mN0JUlrfu58o0lo26q+4JpCMOiOX7LnkglGbznfpdgwuIZzrV4Iv2t5EUAo0YkxCTkKR37JEdlnV5E1XEFcmSyapntPlQ4bJ5uCZQsAgBMnAkwJuzwpYVZ4VOOHTehMx6nf/nMoreJM2UPaT3/7D2C1Gb4CkO//iq7+T+cPqXz8lzBwaaKnatMcDD12ndmzGkprutA3oyXT4yd2aNug8vXvM1vIGF41mJR27kvhxd6jAikWdbKPe6s4M2HvRd0M49AwJsZI6WyQ==; 25:BTxpoDPMfqLN5okG5VgB0VlWAvhdfvlZz1tkWCsXSXG4B+gXM8tiWGDgJ9Lz+6/3rEL1w/Kol2jxrSs9zwFPpzDpKvQQXWAjloLgeT97rtSU1slrmP6kXRG7S+WYCVoOKNYeXEd8UvrBrArOc2+L4jIENnXOJa59V9hs0cZZXT5ejFjIJMPwT//AMO+Qc58Y0/2bWDfRaseqQxGFia70gEDrrNCElQUlU+MwTPQW9yoBPGkZItpy38/aU10+MFSc0J994LoPkOnMuvcFIt+maKrmnqIwDGCmVMuXMSG7SYjb7bkdOo3L+EIJqanf1k80IZHpwBKfAJpwNtfKSrUPDdiNWlRS8TqaElOGW8eojY9n19ctH/tIV67G0CL2Wq6Bg0O8eWyBKxPTN0zNDv02abvMU+niSDbEL7ebxxS2VhkKy9cRytD6xtDvi8vC33XFkQXVG02wEnVoAmAazM9Y4Q== X-Microsoft-Exchange-Diagnostics: 1; SN1PR07MB2285; 31:KTwAW780oIfew0pE466jpmfnUuPqfV4WX5lS3ZNwl11PH5m1TMJcgNnUAuJccfj1KI6x5L548dAWfgi6T2wmHjwMqsjHvFmxcayeuk1iY848r0NAaidQYfjm2SG9Kelw7vJDgpQA5RNTLFi23whMUkj0oUyXLrkqHeVDPxYiN4orSmPRBAyrRkIBQRCVM3QNCl0uBCnxAm2ZkLmp8JiJ5+556yyJnj4p9zdJ1L8aM7c=; 20:T/tBanFc3vp7GlJoA15bgmMur1GlCPCPsKzCVxmvbdl7h6Kw5xFc5r76R8JUODZvRa17M1cbhri3b0w1XYEOnJ9ZHo/4hvRV9gTpkrIG1dhrVU8BRxuxTNRniSAcm7KBfYaCmsBX2gdUSMXqP/unOFQZE0ilch5CsEoWe/g4Dm9Waei7IZAT83hXTw/4j7DBkRkZ0LGZY71Ubh6BFzS8HfthLhyoZoCeKFqeUWWJCCmj636BqYNUvScqSuH1GQr5jFHVtNZvZS5T+mt+AuQa7Wq9PeJV01AtybtmWaP3/LqPp8ToWIQfmor2mhBuGR55xpj1ktX9G4vrR0r75ZnCmvMHh1mxS9P+baoj/Nv4bRVXpEcPf6Mc17nXW39/mD9xeQoDMyWjFnlgHl5HiIsuImOsZ5cTVXUPc4SBhuWgkyZhHlDk/1Ri+rpF4B9wBWoNG9bt4mlmqrVlYDTRXO+0T7liTNbGfE6o7GW3rpmapfDqslpYSr2oNVIVjfpcvQHOunSSPJbY6lQ73fLyyInMvVEVBnhKkeAn3jjC6ODoBC6+wg6KP+B8RXLaF4jwlAaAGIZYy3XtC+OVJdicdFeT68I8i/rWvQYZQXGuZIjxBZI= 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)(3002001)(10201501046)(6041248)(20161123555025)(20161123564025)(20161123562025)(20161123560025)(20161123558025)(6072148); SRVR:SN1PR07MB2285; BCL:0; PCL:0; RULEID:; SRVR:SN1PR07MB2285; X-Microsoft-Exchange-Diagnostics: 1; SN1PR07MB2285; 4:Chdze1Qobq6sD0fD4VJ9DfuzKrm8pkCOUYZ1qbImlbn6sUi8Zcihgkv1fVrUd3n0Vn97RiIHRcCyo3cblnYIdcRdbl8ReV4cwFpe4uRXA4NU6dfamxFaBJFxm/+eTCDUE4Mc3e0MW+PZJTdSA+STRfsorcJPLomRPAxqJ/HNhgElVDp9SjbuAgIHcttqXobOzin6krJFlzn7ZB/RFk9Rf1xg4qIeEkA2vYg93aSPPo10cpPL/YpVUKmtE0mNNJlRnFqUygfWuCYJ6GG8pOHHNj333CrIwT5d7m5FD1PJV8nAsryczNQR9Czl68pXOjQ7WWgzU+seKtpL4x6sVaI6hqbmK3h3RM+GWbc0oPB2FNJvBeBIq9Y1Z6umVVwsC6gv9d6n4uILxV9J9Ym8qbgf8i/81K2OHoOUdrAybVrqM49rokxR1z9DWzwJtNf1fVThP0xBdPYFKi540C3DfAmfKcYibr/KJyUX7cZsfe7iFfB2yq306Q7aO1EGVXlyp5AKqDAk1ugRHVdSJ5IX7zn9byzNxVsauM3NvzIRy7DKtg3IUFcOZ/KHCayVt1Oj13eGfvtVmlp5y1l4EMwP8sren8HWJtng0lnGkV9652eObks= X-Forefront-PRVS: 0225B0D5BC X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(7916002)(39450400003)(39410400002)(39830400002)(189002)(199003)(50226002)(81166006)(42186005)(2361001)(101416001)(81156014)(305945005)(3846002)(6116002)(5009440100003)(8676002)(105586002)(7736002)(53936002)(36756003)(110136004)(106356001)(6506006)(25786008)(38730400002)(2351001)(92566002)(48376002)(6486002)(97736004)(50466002)(5003940100001)(189998001)(68736007)(2906002)(4326007)(33646002)(76176999)(54906002)(5660300001)(6666003)(6916009)(50986999)(2950100002)(6512007)(4720700003)(42882006)(66066001)(47776003)(7099028)(110426004)(473944003); DIR:OUT; SFP:1101; SCL:1; SRVR:SN1PR07MB2285; H:lio357.in.caveonetworks.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; SN1PR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nGGzFh0lYnW2B1//Ge0B?= =?us-ascii?Q?wSIo6pwZRxz2P14b8tbcV4MBHo2bhcEEHfCu+ZsSuOydnkY0kIRM87eMa69Y?= =?us-ascii?Q?4umDv6rDFXRA0ToYqBdpNObaSByVH4o2/k5KaUVWBEICDJQwb4lHof2agIrR?= =?us-ascii?Q?IIrHy1op+TOp134MA2KW4srAmQyF52ImzA2/y5fiEf7vQG3vgB2t9MY2IF28?= =?us-ascii?Q?LBTK32nx9CZ98prsqsvfyCTciF+f8mefem8sANxy+BR4E1mAy4XfO07jp5y2?= =?us-ascii?Q?xhD6kM4tU8uxTzow6DAfgTpX9DdU6miZYjba7qpajQ1uGdwONx/E+0My103j?= =?us-ascii?Q?KArf+HdxsL1vHavmiqHptqg42oWZK6e1VScwA9SnBuZLEPr2lnyeqgW8dKKF?= =?us-ascii?Q?8JaZqpuKaHuZY83K7JlgkuqbVZBdeIgOI7GXCtRnXiJEgeXq6RohAz/eZLn3?= =?us-ascii?Q?brUs6HJU8+saPEsVj1950/knk3l+I+qFknGA3N5xU8c?= X-Microsoft-Exchange-Diagnostics: 1; SN1PR07MB2285; 6:gNuqcJW7fufQKSN8WLsCbaLmkqLEEcAkfIK8oti0oWTT6mXJU3ZWC/iSrnPsoiw0/IjOybT+jUN73ELoqU4W3RYXrHrpp/xfheCq097g/WK58jLl1/3FfmAgeqvz4yq7rCfwgEoOz3KqjYcIS/esNPImZOel81uz1iTalBmijL4mqOANzYDFutTiH31QUU5K5ibrhrb8mo5Lp7TIj+7G40myEdnYGKSBn+W0V6ryLDCRk/ckJ36/NiSp2H47zOwKE/65OrmKDakCmQxkiRRDnKHYtUhrz39V0A081f4z7Nj9tBTzDrqUARSPqAM+6gCak0Uh51mqJ50FOt6/XREPMhunExY/STCwl0lWxPc+2votJ8ejNnmJ0D2P4XNhvS2KaTAgTmR4WMFrC/wMMxnxBw==; 5:OgXyPSoywuDUK8dLddy0+3GhLFa3E1h62zBMdNQAxiTlytRKK8cVd0AMQHz4laQROeQMVQuhxdDuiCtCST8rOFUWqw4jspGocq/5jbrIeZKZmxrRiUlEfvsniJKh1i72qeQ2TLy/QDT433upJ2tFAQ==; 24:GiwjLEZKkK+T8VDtOlD5cgaTy4XkYrtZQlhTDMefBNEnz72X9UvJC/n+DF7zHDVYk3bnDv9XP7va/PK1CpTueCjh0M1QiiLI8cG5YjirIas= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; SN1PR07MB2285; 7:aY+kXRbGUrrFynzJtx0btWVTLesGIWjrFEIgoRpL/WwcDyQw66fIX0fH+/OrLx3UZc4K7b6thCjJk3z7Lq9/+2OLQg9gxhbplNS8Vu6HKH6wr68pmh3M5DzAymFMEtV+g08qXH3bnezauUOE+95WdODuVFziLEpS7l/8PLLZ9SQP9fr0DKA2vE1jvQzFVimHdLoZWkQf497QLEAo+Qy/Dy4Wy6TWZSls9LesYX5xxLImyOAHghTjaHAMl8hfrO3KvD5aAkpeKgT2J+wYd6Esd4PwDprqClgPpDRUMRBgBhcHhvN3zVN3wG0JiFpFI6BChZCky8eDGhLg1eWIXLsc2w== X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Feb 2017 09:29:35.8704 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR07MB2285 Subject: [dpdk-dev] [PATCH 29/50] net/liquidio: add API 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: Tue, 21 Feb 2017 09:29:40 -0000 Signed-off-by: Shijith Thotton Signed-off-by: Jerin Jacob Signed-off-by: Derek Chickles Signed-off-by: Venkat Koppula 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 8488342..ff1fdad 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 ec9e184..9ed0030 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 1280785..be3bf79 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