From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-BY2-obe.outbound.protection.outlook.com (mail-by2nam03on0065.outbound.protection.outlook.com [104.47.42.65]) by dpdk.org (Postfix) with ESMTP id D6703F974 for ; Thu, 2 Mar 2017 12:38:42 +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=mI16u4OOHCpj3IL5ejZxlwouhs7MEzGNER0/frTsqFA=; b=QOJd9MATCRZqHhKIzItqnyAjbZc82P9/ISyOWYMlu/K1UlzwWhFd34Cg5DR6lTKFtwC5OkH5oaYF38l/GPONBwf8/Ybl54eXwauCithgf9EE9tf2lsyPozWxfvpN+XSRvuGY8OpEcGexqEitD/aG1Wt9DHMYxQ44HbG5kC41f4s= 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:38:39 +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:20 +0530 Message-Id: <1488454371-3342-16-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: 2739b4d2-17ef-4d19-9566-08d46160ad3d X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:CY1PR07MB2277; X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2277; 3:u7snS8wKD8k4vdW0uiOgQ/PvljWSAKIVrevezFpmfVmIRyZ+xSTVBDZcMh7JnO+cNcJ4tddC1J49QmXQfUiTStFqb6zZC7ClZMos2ZzIW58mr3zmc14wKon71ma3CuN8xeF4jAjBCGhKqXS16fqUzXcriee/KM/ieDY3D1HNxpJHNPe4EwmzyGGZ+Yv0NrGzjIJSRSWK08143Jcx5wNYZqQXiQbIJQ8Xv42gKXbDgNb7dMVDujQYFCYJ2MNVDLSnrqMGPJjaRrgn9b4DQ1Y/GQ==; 25:C0kLSU4YnXYGTuiCjuPlq3Cdzih2YrV3SNf9U6xccvoYUbOImDrV0/eEHfYRYIvWjnBeoT6mcpF5iXDw908E5CBRF1HVQf7/bWlaqiKe13fy5TcUuD4id+3alt/0F+IzvWJMbpY0uOpeHCFNpEaWPy8hldmPc68ZLTPuY3Zh0C6v28GdMloq9KHhNwdL40Httc2GBpqZbwKDWL0qKKVTBQURl6TbBqjbPtLHe9skaf3d8wBAuyO4yAU8fNCenr9ig7rbzDIHKQu2Cd/6OegnjfmEn9BR+h0BUOm9HYfpDvyh3i1Dy0NfKkFAI89sPXaXg8FzDkULcgk5zjV47B3ZFGe2Zo95vuCgn9eeVPUX/1Aty0sD8tSSaei8B0hZoYa6CzvNuc/UlaAUNbJuMKiQrMuTjvpHkQgSrkFDxtIncmrNETevgd38oklCfWV5H9NPPUNTsf/dQniuQcjB4ZxGYw== X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2277; 31:vmMGnKOoz7V5V4yqukFTyHHdepJlYn5YjuQmdBKokzeDQlkBOpbYx8uoK5IKylrzzmYk/YIf6gl3hHrC3mdg6jdeJdoeyLkWHz2qFg5rUpejvQcEKaECvakm3SrRdSakIU1xdVHR2qhyJGFaDt+W4Eo3fhiTOgk93z6PeqUKFHq0F4pLFJ17LxBVlgbxVG/rLFR/o2tQy+Peu8TO1SACD1ajgv8PoReMToIG8Jz7PdI=; 20:00EM2JQ72qmdFOAi0r7CLPcM2wzRfmqUwbNvTT2Fz0SVA4ttZShT3PsxdOixUI1THfuXHfkfBChxK8aFBRAjqE0LyiaK2gLa5Y6ylHlukHguYGOQ63YgrK756KKrY/muVMElpvLOb1U38i5L4J7j05WU/F7T3ZKRKU+JTge8vAOvbb2FQhrybepmfP6rygB+EaMrs5enkpZaVC9MFYKlkEhfWGuDFDmZzDD8Qhi+jYqTKweCTacdi9ZMSnahOEnJ5zDxFaxv6Zapnd6TeIcGIF14mucuY8HNKXrR7jHgvkAJFa40vUyLhloraVBJ+iIUlgzCKThNZm5HfThfYIOrGrddvF99ZSDmT1TlKHNO4YxqhI7Z32sLll7Ju82Eqi4xiXqB+yOxV+6gKPD74iwL6IvIQ3yg+cAl+Vzxns7+lh9HfUt2N2cWbI1M2jW8Sct2GBcYCpMEOYt0YsbYJL5mK6PP6Lxad2j1XpStICWkWYU4DKq8iy0PVgy1rDNp+RmdW84A2+wDLBTW059DOa2p7wASOO1k5uLoF0xglhezWvuw3zvTz+YyQT7SlW5AvgeX+jHG/cVwff9dxwr2lvKPmCGPRvMoj2XE1s5A8UETiec= 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:m+aLcak9++rNTtgfgk4mS+Mxhoq3iYU7b0t68Xqt/Bd4P5G0JLe24JTJ/FHDtlUx5spmbuYPXQoVHkjMnQc0ZnUaQKz2vppf8278/l9iIZGh95FDkIQdqX9vMRSc3xv6FCwi5tZsNZlrhwraAEFYNotZKKpUsKUyHaky6bEgSietuYhGdMr/kXKcec1KWTEP9kz8Ggeg3+3S9Ro3WllC62yJwWNifOynI8pFUxlJkB+P4r1LT0xrDB7UlcS1Vu6yI15d/NozSWoWYIX5zrz2EoCTBFHQ9nHokChy50ShfAYybtXcbrYsL2T5zA3Xv+w8MasU0H9sunTLjGcP1mWLfiGzqpJ+sq2ZoH79dhc3oQ9V3q2PS5YHccvRSdEJwa/xYRt6gpCjnSghg/13fiCmZAsAeY5iT6tvNgTGZRxTubWYOt2VFDTz64k3mN3Gfgl+yi1scnY8+LQuOJcbi4RKk72f4vd/jHMUo2gBAXVPv2neCvdGVWRAWK2JEan2Kq6VkBfjtihtaeynCwFo+pC1kQl6b6/+hmsjBjj1Fw+weswvV1QM0McFH+E5QNUaVLHhroWPnaCl7lXv05gMDmKQuvJNdxAIUdAfgg96nFB2pwc= X-Forefront-PRVS: 023495660C X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(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); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR07MB2277; H:lio357.in.caveonetworks.com; FPR:; SPF:None; MLV:nov; PTR:InfoNoRecords; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY1PR07MB2277; 23:46O/FmquV9owvOVgSdFVl7qm819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ZFoR/gZonFZlkQG60nGsKtGWoFhMBpd5rCUYLc1vY0tu+gkAI7P?= =?us-ascii?Q?ZbT24HLXjOjEsoO8jeammDJRjIn0DYPQvLbfLSMR5jpaMz3k2Oyh6WwbQHw0?= =?us-ascii?Q?6S7x/lkO1GVpU5RpVC/FNaMgIL53wZKyiPRi2C+fzwCbIw1DF9wBMH6anYyp?= =?us-ascii?Q?9iKw1Xj8X9zeyNbr+iFwEIWglWI0uFBibevsPReQhlk3yks5A=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2277; 6:TTSvLng6skP9zmUL0KIsRuSq1C6acSQ+rrN+TYv9jgVaU9rfWO4DkL3qiraVBilAKgJMTREaKbC7saBsR/SYN2d1ryeLKrvtVa3gaVQraLSfsNPFHpe6AihuHEKKdQ986NOOTX8p9Fc9rMA5I08rYwELHAhq9abbV1Z2S2emcu3sj706AXS+IjgmDBDpqrrDlMx819jgKiEGhhR5xvOnEZs2TPKPWJhC80yYDJayFj2IJO+u9zlePlwzdOsmUxzWW9MnFFeg4sUoxWGJS1lS+gQMgnjam/+WtlH9mLFVB6K7vwNJGVIuOxuCsgZjsqdrJwG8yX/+Sk0fgBl32eAJa+qgOENQ2Z3zScoEtfIa7exiwfyF3oD2tLGi8NvadbM5ZqTPA7Qhg9wjtjlyPw/yIw==; 5:kxw3aCAPoyze1lEwjYkL6uKOWFHmpEOOd2p9uosJO9FjI6p6dDXfHOpPUbK4GxN9D4SdSRRPZFCXgxYBJo3+NaBlbLv3ABY+rJEHAm4/uzozlK4038j7G5aVj/rECc+EGakJtxf7dufMmU3uL4yLPA==; 24:tur6IsuxF+o/icbgtTl2QZO8QFsAKolEImCC+7ILaajATYKZd6O+lwUmu1oaAMbAdjz+jX8Gx20tLNVpuAUM7jExg772Z9k6ewEIidkCIdM= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2277; 7:wpDWqi66/eKU//ei8qrN1QW+S/GvjNqW7ZSSMzEJ0kGfnFHsOvn9AEtqKnxuSLLXrpVnCp8EqtSc2ZqVM2R9XjW4eI59SaWh4g28ruHnlXfX7dw/EfCQrSwNStr8zsmIVkEzCgVayfU5PSnX+QDZwBsMLs8oi99dh2F2ZsHqFD5+CAMRwsPpTikA8LyHM+IiiMODxt3rhTAIqtb71nn/Kd45o7bPShjyaBOrMYJr77Im4B3NyMJ2xXIkVXTeAV5q41FMf7U66RFsB3i5X/9AFGWAHSByeRN3yhWNGrTH1lfQt7wZKWxLkwEsQwgSOORpozSv3KTOp3+QCzcQCS8TKw== X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Mar 2017 11:38:39.0768 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR07MB2277 Subject: [dpdk-dev] [PATCH v2 15/46] net/liquidio: add APIs to allocate and free SC buffer 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: Thu, 02 Mar 2017 11:38:43 -0000 Soft command (SC) holds device control command and related information. SC buffer pool holds buffers which are used during soft command allocation. 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/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 5d7d5a7..a1dcdf6 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