From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on0051.outbound.protection.outlook.com [104.47.36.51]) by dpdk.org (Postfix) with ESMTP id 7DB36F975 for ; Tue, 21 Feb 2017 10:29:03 +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=RhUFNzWhqO/ia2/CT0kHofOLCpoMZDF5x3dJZO6G5Q4=; b=goXgedcMzTvgXeEffE7bXokpAHVzxGGnwceFWURfXll/RJosIFtkwQojpDH7g4y15g359ZPGqNgQODM/Ze/CMN86O0xZzsxW942d0dRCHmuz89EGlNAmnMsyzPX41BkfigNZEvyhoA6cJMn6uUG4pR8diQhvrPjhg8WM4p7kw+0= 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:28:59 +0000 From: Shijith Thotton To: dev@dpdk.org Cc: Jerin Jacob , Derek Chickles , Venkat Koppula , Mallesham Jatharakonda Date: Tue, 21 Feb 2017 14:56:33 +0530 Message-Id: <1487669225-30091-19-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: fc3aef44-42a5-42d5-4f08-08d45a3c1272 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:SN1PR07MB2285; X-Microsoft-Exchange-Diagnostics: 1; SN1PR07MB2285; 3:yXEbIqJQUv76p4UfgjkOGkVgaqK9PP5Mw+1XjOvXE+DZECRR9ynPoaErMKgjcNzUAiaRSgZtf53t8OJNVmLPDRgCo8XD69yKIWPme0cpmnwUZDii/7XdAbejjC9udyP2LTMzogkACEKNwJ+QDJtFWpklkYmW5E+u5WRFUMqLiRgVx4cCak694ni00rBxrZSNC6Z1H3glJCy9jxL8SOdP7g/jByHG+l3CYbX0OizoWYgYi6o18MYUmo/hvnUW586vboud55SCj6Jb3httwYJY6w==; 25:0M+yuYLCMfR2yFSo6MtTYF43YXkyAkxUI0XbzrgmFx2JxeyfybTBcsY9dursOvkdVwaAjJV0T1HHOXjyRba8hGVTmBswFYXDG2nJOBQ+/Pc2XhN/q5tMVDYtZsu1R0kZ40CpVLNt4KTH8EwwL+q1YF8jKiO4EjgSgNQi7W01VhzNVuvHDgtBQ5OTa94gDpPWYeIbkNgN+9GE6JeZWJ0a3+gcoFfIPRtrb5qyDUt+KLmWoP++zrdfvmQWSTylO3MAktZVN4nyxYuRBbRyVkYAKkwowgOaEgDB3q6wQP3vATLZ0hmIvA7ZRz/Bh0W/UiGfUgIhWTYPsixInu1qsttJHTgpQvDohiUeDU2m6IN931Nj5Hdpqgb/IgvETVyH97x5NcIZ9pWPqRo8aVWpCcVFKavZvatWo1TK7wKKgq3qDtLX/NAlLLJq+qO7PNKF57XlZdklP5uLcV12u0uFCIxumA== X-Microsoft-Exchange-Diagnostics: 1; SN1PR07MB2285; 31:7TOnzMxQFCVPVWcLYeyITc9m2eHtW+U35EiQN9u2t+GE/P1v7/e9zIBMbInq+eXG4MJwgyP3MGKwJilBXQ7BbBZQUYfKRVePgCE0Qp/9la0pyAnJqYIhESMtgTBV0Sa8kv6jI6d+2FRMvGlqeU6iXFQLK+q0zxCZDg0oJCMrCwvRURkfh8QtwF9k/jvxdFcq8vTeWru4h7HQ7Ziu3pK0nBpMYxoHwga/SnydKItwlEA=; 20:K3Rbw/qKgrk1Was3aPGuG7z+X7hUtE7l9Yo9yT48OHigWJPAfYS9SGk/9gbCu1frU1is5GszStZwCLlU8tQIOjEp5vETXYHihgriPAxGFXlZlBjtTNGYgTYmyarCDhXBnccARdZluMAdzP6cStzddql/y80/yNeJrxuk7dpG9wpCKIaeWA/7CK0K6n8E9TiTb4avIgbviNv5N6QTBe2ZPq6+PL/UDHRX/BhYBQZVU91Qhx8XDOQN2l0+dhnkBFKSP1XURAopGdwAQDQp42awmz9rCKaxhfOgbcymjwEtfQJXh7bpcORjTVnDp7AM4pg5iq28uHRfm4ofLm4JxlcQ0dWEO74/SWColwtOKKY6yjtM/WcCoZmNu+n+j6KmrqBmt/ASR8k98v/xwIVUMgqd7dX2gKYz/VdmGydSL6hVRL0/0BTIO7cJvNOpgcqo0KoidtKtU4KhZcWRiAC97GIovKU6rHZkD/1QDp9nYkpfhhj4SMrXt/F692P/iMacmED9pCADOsV0CBnQwAwlZ59AJydflmzGSwD4FJzquShTMySUsOk+0ko/oi8+uHFe8gR3iSUzW3NzGSk3Wmlhtf5fFty8SdwL1D27cPfZFFvGRHo= 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:XlXqjK0Y8F96PT/1pgRGs1CHHV1Z8FqGVrBOerSnT4WwFr+6mj9uJ4hLbYrK4UqtCAFHv01nlm5et1oEmT4qd10npGNNZiT8sD61U+XhGiK13phrnWMLc80a61xE/re6WT4/dfFmpZzVO6zhdkKxniAmFtfj9Dp5mg6A1cG8+JCBCpU1o82rJ75Q9e8VXEutFTF51mvskF5Teb3rne3GHxzHcTVwconmR5pJO+Awc6PVvkdp+C2F3fJfxzDAS011Tr9FDj2bKQQ0pT/EtMOw8LhTCoVHsT1pgH3TS8pxo81GNgzCCYlWT5mrwHOM3fCZNdKWCkuCe1eA6M0WhPLxu5qVufUojVdipE8zj5gTI98QLBowcPV62U04XanA9xSsimNJ7aESSpi56WuMEeN2rZRFaI6bhdxxrVF/6UG7yr798cPbuLV3ZynVFcHQM+VMhcmZ+uImq/kmFSHJoQzuQlnpx2asNAp8Yjkqos8PrPDe4coAchrFOaEQLwsp4oV4VTafkisQuV6DmsSyyOZVYG+jR+ffI17INY1OUdEEhw6tztKoKE1YSsUKhidQDlL7PBooZdQxMyWvlObM4djstXUGhv6nufN664LP9gJJ43o= 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; SN1PR07MB2285; 23:p5+ifFO/6dBOUbIUvzDADHztWQOzXIdFgf+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TPjP+paZM0HqrhoJj6uus9Bzug==; 24:1i+XR54r6JfPa74mTToIyBh4v4Dm6+mqINxZ0NI6Bgu7of2uca+4F866IRmv05tBYZ+gi549zXLXKsPlAjl66hwyKM4CMvJ/yYbo2zHh8Yw= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; SN1PR07MB2285; 7:hmXUdOU8dsxkEBJCMMvjjsl14xBY+eg/J+PyIbqLm9lUqI5o8OtIiOBdqc6N4TJAeQ0TnavrrZaWO1q5F3/jWJ0HrQf/6ncYZTtwKqDCcRHwb3UvlsLA6QqLJml67YDeFVH+KkoXJLFEjWrYeqt+Y8TBqXLO/fhzcfUmdOT5A/u6x2Nqp5N7yZHSWkLTPby8dILP6apyWv0iTtVWAOG/Qtj/wCSxEI68mc89kfwW7X4q90h3J3B3hjvFzF6NreJKDcIheyh6IhgCRus7eWthx35ymv24QJCtby5qIAfSpv8/4EzVW21FRuji4E9iVotgp2lmNkyMzFIZ8U3icwuqiw== X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Feb 2017 09:28:59.7444 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR07MB2285 Subject: [dpdk-dev] [PATCH 18/50] net/liquidio: add API to allocate and free command pool 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:04 -0000 Allocate soft command pool. It is used to allocate control packet buffers. 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 | 12 ++++++++++++ drivers/net/liquidio/lio_rxtx.c | 21 +++++++++++++++++++++ drivers/net/liquidio/lio_rxtx.h | 9 +++++++++ drivers/net/liquidio/lio_struct.h | 3 +++ 4 files changed, 45 insertions(+) diff --git a/drivers/net/liquidio/lio_ethdev.c b/drivers/net/liquidio/lio_ethdev.c index 3b11993..3702c61 100644 --- a/drivers/net/liquidio/lio_ethdev.c +++ b/drivers/net/liquidio/lio_ethdev.c @@ -101,6 +101,12 @@ return -1; } + /* Initialize soft command buffer pool */ + if (lio_setup_sc_buffer_pool(lio_dev)) { + lio_dev_err(lio_dev, "sc buffer pool allocation failed\n"); + return -1; + } + if (lio_dev->fn_list.setup_mbox(lio_dev)) { lio_dev_err(lio_dev, "Mailbox setup failed\n"); goto error; @@ -141,6 +147,7 @@ return 0; error: + lio_free_sc_buffer_pool(lio_dev); if (lio_dev->mbox[0]) lio_dev->fn_list.free_mbox(lio_dev); if (lio_dev->instr_queue[0]) @@ -152,11 +159,16 @@ static int lio_eth_dev_uninit(struct rte_eth_dev *eth_dev) { + struct lio_device *lio_dev = LIO_DEV(eth_dev); + PMD_INIT_FUNC_TRACE(); if (rte_eal_process_type() != RTE_PROC_PRIMARY) return -EPERM; + /* lio_free_sc_buffer_pool */ + lio_free_sc_buffer_pool(lio_dev); + rte_free(eth_dev->data->mac_addrs); eth_dev->data->mac_addrs = NULL; diff --git a/drivers/net/liquidio/lio_rxtx.c b/drivers/net/liquidio/lio_rxtx.c index 4a687d8..1c6ce59 100644 --- a/drivers/net/liquidio/lio_rxtx.c +++ b/drivers/net/liquidio/lio_rxtx.c @@ -206,3 +206,24 @@ lio_dev->instr_queue[0] = NULL; lio_dev->num_iqs--; } + +int +lio_setup_sc_buffer_pool(struct lio_device *lio_dev) +{ + char sc_pool_name[RTE_MEMPOOL_NAMESIZE]; + uint16_t buf_size; + + buf_size = LIO_SOFT_COMMAND_BUFFER_SIZE + RTE_PKTMBUF_HEADROOM; + snprintf(sc_pool_name, sizeof(sc_pool_name), + "lio_sc_pool_%u", lio_dev->port_id); + lio_dev->sc_buf_pool = rte_pktmbuf_pool_create(sc_pool_name, + LIO_MAX_SOFT_COMMAND_BUFFERS, + 0, 0, buf_size, SOCKET_ID_ANY); + return 0; +} + +void +lio_free_sc_buffer_pool(struct lio_device *lio_dev) +{ + rte_mempool_free(lio_dev->sc_buf_pool); +} diff --git a/drivers/net/liquidio/lio_rxtx.h b/drivers/net/liquidio/lio_rxtx.h index 33f178b..b308211 100644 --- a/drivers/net/liquidio/lio_rxtx.h +++ b/drivers/net/liquidio/lio_rxtx.h @@ -47,6 +47,15 @@ struct lio_request_list { void *buf; }; +/** The size of each buffer in soft command buffer pool */ +#define LIO_SOFT_COMMAND_BUFFER_SIZE 1536 + +/** Maximum number of buffers to allocate into soft command buffer pool */ +#define LIO_MAX_SOFT_COMMAND_BUFFERS 255 + +int lio_setup_sc_buffer_pool(struct lio_device *lio_dev); +void lio_free_sc_buffer_pool(struct lio_device *lio_dev); + /** Setup instruction queue zero for the device * @param lio_dev which lio device to setup * diff --git a/drivers/net/liquidio/lio_struct.h b/drivers/net/liquidio/lio_struct.h index 2806c37..992ad39 100644 --- a/drivers/net/liquidio/lio_struct.h +++ b/drivers/net/liquidio/lio_struct.h @@ -277,6 +277,9 @@ struct lio_device { uint32_t num_iqs; + /* The pool containing pre allocated buffers used for soft commands */ + struct rte_mempool *sc_buf_pool; + /** The input instruction queues */ struct lio_instr_queue *instr_queue[LIO_MAX_POSSIBLE_INSTR_QUEUES]; -- 1.8.3.1