From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-SN1-obe.outbound.protection.outlook.com (mail-sn1nam01on0078.outbound.protection.outlook.com [104.47.32.78]) by dpdk.org (Postfix) with ESMTP id A5403FA55 for ; Tue, 21 Feb 2017 10:29:33 +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=1OXTTrxVMf2Qi+1bGB3pDd4MJsznMBRNUV00hSfP0VE=; b=aVyitHgad3bx0VVasODEaWiao7zpLJBeV8EpmIWP311uGfPn6lpyIqJSwPp5SO7+5iIpXzoksy/s7AKMEl0tWSrEM1n2ClHdw43MVr268Nk6Y9eSoalVR+A4DpqPFriXCXEzdQWfjTTO6tkinJkFKv9dEBMGp39I/xLaY4km+W4= 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:30 +0000 From: Shijith Thotton To: dev@dpdk.org Cc: Jerin Jacob , Derek Chickles , Venkat Koppula , Mallesham Jatharakonda Date: Tue, 21 Feb 2017 14:56:42 +0530 Message-Id: <1487669225-30091-28-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: ff4437c0-9e9c-44b5-4db6-08d45a3c244f X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:SN1PR07MB2285; X-Microsoft-Exchange-Diagnostics: 1; SN1PR07MB2285; 3:G4cerMskmYzBuOXP6SEMr9IsxEGUFyG79spLWa5EBIwe2GnmsZqHxq2eOkGoch5pUtN5gg3F8AHvRKvZyR4InVxhzYAPSJ42eMJE3PF3rBoLs9IE8kkEy+uE7wcJYH40ukOMvee5k+6GxDCDERZqsIFnhlr2+33OVqhIHwpDN4/aUvqxiayUBQjz71AndypuilTA8q4Xk4DE8rJhk1cWb+pzX9RExs4weFg4CXmIIopehrWhI1EOWwb6Oaq72C3UenK+EQLFGlqZ+yd7HhanqA==; 25:RbiSKNpiK4G5vGXTkt9M81y+wwmeCaQP+lyrx/KJ8LnDKwTDDdY+VOlYFOTUm2rXrCjN2lgzL8K6nPDFjBLAR7/Gg3+D5K/XKp+JYNxw1oWaEajIOvcWJgu+wP7qO2U2KRwC7GuDo0+F0pgYoPR014IztZcusWb6nf1j5QLAET72Py8zZKO4Sc7NQ9LD1nTb28HAPQ/wLJRH5pDAUVtNNn7zIMEfUDHW7zoBQgPcXSXmYOc8m+iQLyykEJp4hok6NORf0tKIBqEgM41xnViGsegwzoTUKaUWzJoNPl1tfrMV384Jo+ApdqM2MkvDv3XVCB/yVqSdRMlFErFg89cpsMRCh7kBzbPtAXOiGL0Lpe6J0Fllfkq/3en73KH3IkLfst2Z4jhgPhQYtNZpjzuNgifPHnGyIlF0QNN+yOmKDRxToZi4nqNR6J0g/wdAP9MoM/j8ZpTOLBAgMjifzA+HfQ== X-Microsoft-Exchange-Diagnostics: 1; SN1PR07MB2285; 31:4Ga87TBLJL/cfPAM0binKFNIqo4zjARe49U8565ZEk7wxvolmAwHNv5f1iEnUi9TZlwnAZ6Kgw1YBTn+DaO3VUNoWys2ZQaiSABOXqrOGsHJXNAiK9MljYWnbocDEItL33yGTVKuWDc4nIRq81A5/HiR70JpcRNeGdeQpRe57TDzdiuc6tl9UpthjCAYtzZ9ciHcfju8eqTM05zcmbjMls5efsj/3la1rtnegFhsDTgubWsU1yKYZWgel69N4mEk; 20:SYSDRxwUFRjXoVgjW3Mn7XP8RMsc5bLmeuohPWEuXe3OOzcByiPpwHPP8682VNKHQoHDWObwb37xD7o4RDp/5mIW9o9rl7l/vrFHEl5tR/D1z/j9pyAGsDCc4X0GoWFVMmjIQflTn1h4/OAV0DZzALQYNg0dDvbkcmlXRxjgCsVqdTB/S0EroNWJsQG1LVlycPNRbbyyxG86+MW9Kh4ZXjdYKSfYtAWsEj2dMxyAvXzPIdrdxX6eD6WIdKz0hqerssimz9yryPNHPK9ILmbpUqVYKqQUDteTq/WjyC47mQhB0XxWn1t8AJjQJTWArTAYmWcQ6Df+fr6TasaB7zkHwnox4gJbUxWvNHgSvWGOyHJjVobdjLS94sW8GKgCuKuQEk2EOdTPOFpiGovnYrDWheBcR3oErBaiohv6KwhIjsdIjoQiCyaxJpYCdNYmfzXKNMqM08kcQF8R8XTAg389vAIs9rZ7nxC4Q0bKiuyJUHJ5y91rwnB768FjD3G3yaL8czFM1175Qdkaw8sFAYJVbKN9rDVlCBKSFtiSvW3AJPL/5rna0itEW1VkDP7j+5gAr5HDyw6Wtkuwh2hc5H+Lb+geIcZJ/N6lq0S3F79lUbM= 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:xSqlJfZ3r0VWm8Bd4v60WkTORKu3Xik2FTId8khZ25Atw36Mew3eEvpH+78V3qZVWc3A09JWZ9Ke8wfi3QfIxhTx6mdDT0tJ0isZc0hjG4vd9W4GTCmZ7jUeQhQtdu4RKatN+MP0aiVv72nJyTSUZhRihH5gO6D6Lxuo7uB0orOQQq1K/kYDBBdWiCRSbp6vSxKp16fRheDLOzQ4ZLlDFG1jDq0A7wRTRJArb5HfRLoxZUNMAcp1gYstKsNu80eK0j7h7Nz3nI7YzuP7nWJ4ivp7NEUiWksIoGJsaMG4YHENbOnQMifArPEkMI31/umj7FhtMaXi5aIYd1ZkJnhH2pUgGIkD/korJ7yYs9nXRSt8Q6nG8pUYV6fqTrsPkUJQbyxdeLl9iLebgW3atIIvH4q23jKuk7HW6IcdQ905JCzy2Vej1FF7gszNh4LQEAr+1U30VbGtuzBcCrFe54f7LMHZh753hfEE/bQUdunAVO/gptFWHRGLUBCOuTDbXmIsq3hxMDPooNNlWP33pLNZU1YfBHq8hspBL9xmyeZ2oc5kTkV3gcwzcxim2akjgDeL5qZpAyK03M8BIeLxxlnvIN1/xN+Pfn1Rp8yQmbhY8Mc= 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); 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;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XYl3wGIM0rYKU6yYjDxNBX1S+dl5GRIy0GTUbaWUtIbfWxwB+4HPHDdxIVi2CahrTXYMcdmrnwmDCFo2En9irAsICNhGS8cR+TEQ==; 24:ObS4O1SikPN2GR0/RXWjubaa9pVQRDB2xdUe602Ec5WGi3gVI8PDOe1SS4iCUBKL7j9yu8SOrgquUItWeAZHcDmye1jR80nXesw9pDlYjzQ= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; SN1PR07MB2285; 7:O+AgTQaB2P5cG1wkCiaMATx5hougF1L7WxhmbWK4S4C01TsJi4Im0NZWDwQtv9IPmMxvJ3sxxVkuT/wPoNc/bzgHHgkUfhAVNrjjQ9mk/w6ugIvPF4esUNcmVG4/n/MalKPT38M71sCtvHn7BxBceHqEZrC5Xn/E4VeMoXAu9lkNvUA/ROcbISe9EEKttzB98RiQQUarNax3yntC3lKg+dgJmeY67qHGo/lS74MFzsL8ZL3Nt0va49nPM9Uo+8K7RNaA+22MQOeV7TxQi5GDfx4VVFiIEszbb5JPAK26Q1vSOhet/3j9fEeBKsI3VcVHsUva6B025GQsdMW1TA49Dw== X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Feb 2017 09:29:30.0890 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR07MB2285 Subject: [dpdk-dev] [PATCH 27/50] net/liquidio: add API to setup Tx queue 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:34 -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/lio_ethdev.c | 60 +++++++++++++++++++++++++++++++++++++++ drivers/net/liquidio/lio_rxtx.c | 39 +++++++++++++++++++++++++ drivers/net/liquidio/lio_rxtx.h | 3 ++ 3 files changed, 102 insertions(+) diff --git a/drivers/net/liquidio/lio_ethdev.c b/drivers/net/liquidio/lio_ethdev.c index 9778b3a..d096edc 100644 --- a/drivers/net/liquidio/lio_ethdev.c +++ b/drivers/net/liquidio/lio_ethdev.c @@ -148,6 +148,65 @@ } } +/** + * Allocate and initialize SW ring. Initialize associated HW registers. + * + * @param eth_dev + * Pointer to structure rte_eth_dev + * + * @param q_no + * Queue number + * + * @param num_tx_descs + * Number of ringbuffer descriptors + * + * @param socket_id + * NUMA socket id, used for memory allocations + * + * @param tx_conf + * Pointer to the structure rte_eth_txconf + * + * @return + * - On success, return 0 + * - On failure, return -errno value + */ +static int +lio_dev_tx_queue_setup(struct rte_eth_dev *eth_dev, uint16_t q_no, + uint16_t num_tx_descs, unsigned int socket_id, + const struct rte_eth_txconf *tx_conf __rte_unused) +{ + struct lio_device *lio_dev = LIO_DEV(eth_dev); + int fw_mapped_iq = lio_dev->linfo.txpciq[q_no].s.q_no; + int retval; + + if (q_no >= lio_dev->nb_tx_queues) { + lio_dev_err(lio_dev, "Invalid tx queue number %u\n", q_no); + return -EINVAL; + } + + lio_dev_dbg(lio_dev, "setting up tx queue %u\n", q_no); + + if ((lio_dev->instr_queue[fw_mapped_iq] != NULL) && + (num_tx_descs != lio_dev->instr_queue[fw_mapped_iq]->max_count)) { + lio_dev_err(lio_dev, + "Reconfiguring Tx descs not supported. Configure descs to same value %u or restart application\n", + lio_dev->instr_queue[fw_mapped_iq]->max_count); + return -ENOTSUP; + } + + retval = lio_setup_iq(lio_dev, q_no, lio_dev->linfo.txpciq[q_no], + num_tx_descs, lio_dev, socket_id); + + if (retval) { + lio_dev_err(lio_dev, "Runtime IQ(TxQ) creation failed.\n"); + return retval; + } + + eth_dev->data->tx_queues[q_no] = lio_dev->instr_queue[fw_mapped_iq]; + + return 0; +} + static int lio_dev_configure(struct rte_eth_dev *eth_dev) { struct lio_device *lio_dev = LIO_DEV(eth_dev); @@ -294,6 +353,7 @@ static int lio_dev_configure(struct rte_eth_dev *eth_dev) .dev_configure = lio_dev_configure, .rx_queue_setup = lio_dev_rx_queue_setup, .rx_queue_release = lio_dev_rx_queue_release, + .tx_queue_setup = lio_dev_tx_queue_setup, }; static void diff --git a/drivers/net/liquidio/lio_rxtx.c b/drivers/net/liquidio/lio_rxtx.c index b7687a1..11319b2 100644 --- a/drivers/net/liquidio/lio_rxtx.c +++ b/drivers/net/liquidio/lio_rxtx.c @@ -861,6 +861,45 @@ lio_dev->num_iqs--; } +/* Return 0 on success, -1 on failure */ +int +lio_setup_iq(struct lio_device *lio_dev, int q_index, + union octeon_txpciq txpciq, uint32_t num_descs, void *app_ctx, + unsigned int socket_id) +{ + uint32_t iq_no = (uint32_t)txpciq.s.q_no; + + if (lio_dev->instr_queue[iq_no]) { + lio_dev_dbg(lio_dev, "IQ is in use. Cannot create the IQ: %d again\n", + iq_no); + lio_dev->instr_queue[iq_no]->txpciq.txpciq64 = txpciq.txpciq64; + lio_dev->instr_queue[iq_no]->app_ctx = app_ctx; + return 0; + } + + lio_dev->instr_queue[iq_no] = rte_zmalloc_socket("ethdev TX queue", + sizeof(struct lio_instr_queue), + RTE_CACHE_LINE_SIZE, socket_id); + if (lio_dev->instr_queue[iq_no] == NULL) + return -1; + + lio_dev->instr_queue[iq_no]->q_index = q_index; + lio_dev->instr_queue[iq_no]->app_ctx = app_ctx; + + if (lio_init_instr_queue(lio_dev, txpciq, num_descs, socket_id)) + goto release_lio_iq; + + lio_dev->num_iqs++; + + return 0; + +release_lio_iq: + rte_free(lio_dev->instr_queue[iq_no]); + lio_dev->instr_queue[iq_no] = NULL; + + return -1; +} + static inline void lio_ring_doorbell(struct lio_device *lio_dev, struct lio_instr_queue *iq) diff --git a/drivers/net/liquidio/lio_rxtx.h b/drivers/net/liquidio/lio_rxtx.h index 41c351a..6f8ec75 100644 --- a/drivers/net/liquidio/lio_rxtx.h +++ b/drivers/net/liquidio/lio_rxtx.h @@ -548,6 +548,9 @@ uint16_t lio_dev_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t budget); void lio_delete_droq_queue(struct lio_device *lio_dev, int oq_no); +int lio_setup_iq(struct lio_device *lio_dev, int q_index, + union octeon_txpciq iq_no, uint32_t num_descs, void *app_ctx, + unsigned int socket_id); /** Setup instruction queue zero for the device * @param lio_dev which lio device to setup * -- 1.8.3.1