From patchwork Mon Mar 20 10:03:10 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shreyansh Jain X-Patchwork-Id: 21985 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id B47A72C29; Mon, 20 Mar 2017 10:57:32 +0100 (CET) Received: from NAM03-CO1-obe.outbound.protection.outlook.com (mail-co1nam03on0074.outbound.protection.outlook.com [104.47.40.74]) by dpdk.org (Postfix) with ESMTP id 24189133F for ; Mon, 20 Mar 2017 10:57:30 +0100 (CET) Received: from CY4PR03CA0003.namprd03.prod.outlook.com (10.168.162.13) by MWHPR03MB2798.namprd03.prod.outlook.com (10.168.208.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.947.12; Mon, 20 Mar 2017 09:57:28 +0000 Received: from BN1AFFO11OLC003.protection.gbl (2a01:111:f400:7c10::104) by CY4PR03CA0003.outlook.office365.com (2603:10b6:903:33::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.977.11 via Frontend Transport; Mon, 20 Mar 2017 09:57:28 +0000 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=nxp.com; nxp.com; dkim=none (message not signed) header.d=none;nxp.com; dmarc=fail action=none header.from=nxp.com; Received-SPF: Fail (protection.outlook.com: domain of nxp.com does not designate 192.88.168.50 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.168.50; helo=tx30smr01.am.freescale.net; Received: from tx30smr01.am.freescale.net (192.88.168.50) by BN1AFFO11OLC003.mail.protection.outlook.com (10.58.53.74) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.977.7 via Frontend Transport; Mon, 20 Mar 2017 09:57:27 +0000 Received: from Tophie.ap.freescale.net ([10.232.14.39]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id v2K9vJ3a015173; Mon, 20 Mar 2017 02:57:25 -0700 From: Shreyansh Jain To: CC: , , , Shreyansh Jain Date: Mon, 20 Mar 2017 15:33:10 +0530 Message-ID: <1490004190-16892-2-git-send-email-shreyansh.jain@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1490004190-16892-1-git-send-email-shreyansh.jain@nxp.com> References: <1490004190-16892-1-git-send-email-shreyansh.jain@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131344774479948323; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.168.50; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(336005)(39380400002)(39840400002)(39400400002)(39410400002)(39850400002)(39860400002)(39450400003)(2980300002)(1110001)(1109001)(339900001)(189002)(199003)(9170700003)(53936002)(110136004)(47776003)(5660300001)(104016004)(8676002)(50226002)(6916009)(5003940100001)(48376002)(4326008)(54906002)(76176999)(305945005)(81166006)(2906002)(50466002)(2351001)(8936002)(356003)(36756003)(105606002)(106466001)(86362001)(50986999)(33646002)(6666003)(8656002)(38730400002)(77096006)(189998001)(85426001)(2950100002); DIR:OUT; SFP:1101; SCL:1; SRVR:MWHPR03MB2798; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; MLV:ovrnspm; MX:1; A:1; PTR:InfoDomainNonexistent; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1AFFO11OLC003; 1:A/+4TAbOhonfV8gwSuU9mr24RGITB39V7IrDvKx1ZnnMQsFEHwsKfEPZuhDOBFNJfr7mj7qqF6nM9OnlOU/b0JhsZ3rB9kIzKnJpp+p4xavGA45ZJEraRwIe3ifX5Y7GScAKIdFZn0bdS99FK0aIuMg8LP+iuInPHpyU5ZRH+9ndemuORRQqNXwifj4qLAqdRadMmr+U+QuYZRvispFoSw6SPSuwEfw63dQIlmKzLvTHCJidcQmd5NXxv5upvpkRjUQvW1+n5hDbvwsPbcr3t5J7FmwsAaIV2AhXK6rY1MtNf04DyjQNmyu6KSQg+tbcMbNfbANRaM7B8cTjv1VKy3gsy0kh1CDPROc7mMhjGpqXZplxxB0ib4mZ8vtcBnUDbjeHDgSKSCus84OiRztrXRGNQ1wFnEAUbkP45AhsTrU/6kSssVk18OKI4IxB6aZqqpyDcyqfUQm3qmNuYGLZQLGi3/GKw4lB43BRIYHlJyuhaosmEBoCcrIMH2gwrsCyCBVFU6AtSysAQachY/V3yvf+1Cuhai5BjhUe/djdN/W0nAAN2T3lXeF+9u4zsVCPBZnZYJXpa15T1wf30o20eNNO45rd37WFAc8nHr3636GL38LCbXFs9qDXBUYLIcYy0tqdT+Q+o7/AqMw6CotwZQAJFYwVurAH4Zdc4rIlG7rEa7Q6K2GG3nJ3cd8y3i+kaF0YqmB6AiqucRy9+UUidQ== MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: 19e830fd-98ef-4ddd-c8c4-08d46f77846f X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:MWHPR03MB2798; X-Microsoft-Exchange-Diagnostics: 1; MWHPR03MB2798; 3:17+RKwmG1acrhY7Qg5+AypZnMuX1oI2T1h5gUw7q8pI+TUS8cn9neJGhwVA82nfs5wvlqoddY1s+6UPw40g69Fez0I+UXL2aU+XIVIq/32vVv+k1UKaMgp1Twz7LIJs6UEXjttitZZBS7VyC8TNC0lqv+0KxDDgclRfXTlCxb2S+lEvDVZoadYejKnTqTg8QvGQrJiNbwolIJfC/yih/eeW4D5utAYLQiCMk+bWVM4TGEpvvFc1RlcsFGmy+F4WCdV0kvhKDBhJvVkHsqR6+FEAZepoIRF3FSsEVYC/5O81j+fj/PvFvAtO5vUGJNq4lwSbz+5GOZJWu8oA5ZKdnCV4vb3NdygtE88zaiwDgTDDwb5ywosect9EAuO7A0FFQ; 25:bUKQe64LjnasQfsZDlkxSAcA/FoZvaULBWx3i1Sz1d4EQzOdOpiG5NtYqoVB9fMBYQmV/ZBVMHdDtb5YWv4CpSNXFYmPbwUqVJkv+VCF2imITcXu4hn6wMBDgynSoUtPzBQIzTWCqCx/MUPbGO8WWFvw+RhL5m9uDehlA9WD2wjLt7gN9zsk3No0UkGih9fhq7LUrzL8OXmm0zEcVOxGE4qKG0gSH7zX2xBZJ5C4rrz9LAhiC2anvtVL8PqeNUNIhwsIepPyyTEOfVpXqUYtIB4VbBEE12i96H+tnJbHhtlyWHokaXv0ln1s24g55G38tibd5SqY8+ztpvByDnZKO+/FfF78VCtk4ephdGRy8bKKYHtq/a03icEabpm0GrtvVjcGeGGtydi97b5ITY9k+jh4bfk7B/MrYeh4I7TiPEvgBZG3JaBjotEXV3gQX6tNl6ZZqb6CyT7fshfjK30+Vg== X-Microsoft-Exchange-Diagnostics: 1; MWHPR03MB2798; 31:jVcO9y0kp+NNNj8cIjG3A+XbkHbHT4ZAo9ZbZd5CycG2+9efuVmr6BvcI9YB/yCb32khrRSDEWKqV2xKP47eCKF5k+hPxFoHKn/wsvCJjbuqrjiRC1Wbra6/4cCbyKZCQbOPMnTYxsTLv1+OkGsgQCzrSOjx6mNpbpHMCQqoecZjpIaYq+DL+jhs1YthuzKUB4BE/AUuLO6YJ+oecM9zVxF9UAY8SomXwDrPDmSCHQzeV3ee4Vo134l4H+R4qIpSH6NX4FjJh6/2a2IPMz8SRg== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6095060)(601004)(2401047)(13015025)(13017025)(8121501046)(13023025)(13024025)(13018025)(5005006)(3002001)(10201501046)(6055026)(6096035)(20161123556025)(20161123559025)(20161123561025)(20161123563025)(20161123565025); SRVR:MWHPR03MB2798; BCL:0; PCL:0; RULEID:(400006); SRVR:MWHPR03MB2798; X-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Ve1a9uhzUNxizquZkZwwGJCc7pGUbbwaJnZBP5M44DqXjbcA== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Mar 2017 09:57:27.7608 (UTC) X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e; Ip=[192.88.168.50]; Helo=[tx30smr01.am.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR03MB2798 Subject: [dpdk-dev] [PATCH 2/2] drivers/mempool: add ring mempool handler as driver 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" CONFIG_RTE_DRIVER_MEMPOOL_RING option is introduced. Ring Mempool handler moved from lib/librte_mempool into drivers/mempool. With this patch, the Ring mempool handler registration is optional and toggled via the configuration file. In case disabled (N), it would imply request for creating of mempool would fail. Signed-off-by: Shreyansh Jain --- config/common_base | 1 + drivers/mempool/Makefile | 1 + drivers/mempool/ring/Makefile | 55 ++++++++ drivers/mempool/ring/rte_mempool_ring.c | 161 ++++++++++++++++++++++ drivers/mempool/ring/rte_mempool_ring_version.map | 4 + lib/librte_mempool/Makefile | 1 - lib/librte_mempool/rte_mempool_ring.c | 161 ---------------------- 7 files changed, 222 insertions(+), 162 deletions(-) create mode 100644 drivers/mempool/ring/Makefile create mode 100644 drivers/mempool/ring/rte_mempool_ring.c create mode 100644 drivers/mempool/ring/rte_mempool_ring_version.map delete mode 100644 lib/librte_mempool/rte_mempool_ring.c diff --git a/config/common_base b/config/common_base index 3e70aa0..97e4bba 100644 --- a/config/common_base +++ b/config/common_base @@ -466,6 +466,7 @@ CONFIG_RTE_LIBRTE_MEMPOOL_DEBUG=n # # Compile Mempool drivers # +CONFIG_RTE_DRIVER_MEMPOOL_RING=y CONFIG_RTE_DRIVER_MEMPOOL_STACK=y # diff --git a/drivers/mempool/Makefile b/drivers/mempool/Makefile index b256a34..d840022 100644 --- a/drivers/mempool/Makefile +++ b/drivers/mempool/Makefile @@ -31,6 +31,7 @@ include $(RTE_SDK)/mk/rte.vars.mk +DIRS-$(CONFIG_RTE_DRIVER_MEMPOOL_RING) += ring DIRS-$(CONFIG_RTE_DRIVER_MEMPOOL_STACK) += stack include $(RTE_SDK)/mk/rte.subdir.mk diff --git a/drivers/mempool/ring/Makefile b/drivers/mempool/ring/Makefile new file mode 100644 index 0000000..21315c2 --- /dev/null +++ b/drivers/mempool/ring/Makefile @@ -0,0 +1,55 @@ +# BSD LICENSE +# +# Copyright(c) 2017 NXP. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the name of NXP nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +include $(RTE_SDK)/mk/rte.vars.mk + +# +# library name +# +LIB = librte_mempool_ring.a + +CFLAGS += -O3 +CFLAGS += $(WERROR_FLAGS) + +# Headers +CFLAGS += -I$(RTE_SDK)/lib/librte_mempool + +EXPORT_MAP := rte_mempool_ring_version.map + +LIBABIVER := 1 + +SRCS-$(CONFIG_RTE_DRIVER_MEMPOOL_RING) += rte_mempool_ring.c + +# this lib depends upon: +DEPDIRS-$(CONFIG_RTE_DRIVER_MEMPOOL_RING) += lib/librte_eal +DEPDIRS-$(CONFIG_RTE_DRIVER_MEMPOOL_RING) += lib/librte_mempool lib/librte_ring + +include $(RTE_SDK)/mk/rte.lib.mk diff --git a/drivers/mempool/ring/rte_mempool_ring.c b/drivers/mempool/ring/rte_mempool_ring.c new file mode 100644 index 0000000..b9aa64d --- /dev/null +++ b/drivers/mempool/ring/rte_mempool_ring.c @@ -0,0 +1,161 @@ +/*- + * BSD LICENSE + * + * Copyright(c) 2010-2016 Intel Corporation. All rights reserved. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include + +#include +#include +#include + +static int +common_ring_mp_enqueue(struct rte_mempool *mp, void * const *obj_table, + unsigned n) +{ + return rte_ring_mp_enqueue_bulk(mp->pool_data, obj_table, n); +} + +static int +common_ring_sp_enqueue(struct rte_mempool *mp, void * const *obj_table, + unsigned n) +{ + return rte_ring_sp_enqueue_bulk(mp->pool_data, obj_table, n); +} + +static int +common_ring_mc_dequeue(struct rte_mempool *mp, void **obj_table, unsigned n) +{ + return rte_ring_mc_dequeue_bulk(mp->pool_data, obj_table, n); +} + +static int +common_ring_sc_dequeue(struct rte_mempool *mp, void **obj_table, unsigned n) +{ + return rte_ring_sc_dequeue_bulk(mp->pool_data, obj_table, n); +} + +static unsigned +common_ring_get_count(const struct rte_mempool *mp) +{ + return rte_ring_count(mp->pool_data); +} + + +static int +common_ring_alloc(struct rte_mempool *mp) +{ + int rg_flags = 0, ret; + char rg_name[RTE_RING_NAMESIZE]; + struct rte_ring *r; + + ret = snprintf(rg_name, sizeof(rg_name), + RTE_MEMPOOL_MZ_FORMAT, mp->name); + if (ret < 0 || ret >= (int)sizeof(rg_name)) { + rte_errno = ENAMETOOLONG; + return -rte_errno; + } + + /* ring flags */ + if (mp->flags & MEMPOOL_F_SP_PUT) + rg_flags |= RING_F_SP_ENQ; + if (mp->flags & MEMPOOL_F_SC_GET) + rg_flags |= RING_F_SC_DEQ; + + /* + * Allocate the ring that will be used to store objects. + * Ring functions will return appropriate errors if we are + * running as a secondary process etc., so no checks made + * in this function for that condition. + */ + r = rte_ring_create(rg_name, rte_align32pow2(mp->size + 1), + mp->socket_id, rg_flags); + if (r == NULL) + return -rte_errno; + + mp->pool_data = r; + + return 0; +} + +static void +common_ring_free(struct rte_mempool *mp) +{ + rte_ring_free(mp->pool_data); +} + +/* + * The following 4 declarations of mempool ops structs address + * the need for the backward compatible mempool handlers for + * single/multi producers and single/multi consumers as dictated by the + * flags provided to the rte_mempool_create function + */ +static const struct rte_mempool_ops ops_mp_mc = { + .name = "ring_mp_mc", + .alloc = common_ring_alloc, + .free = common_ring_free, + .enqueue = common_ring_mp_enqueue, + .dequeue = common_ring_mc_dequeue, + .get_count = common_ring_get_count, +}; + +static const struct rte_mempool_ops ops_sp_sc = { + .name = "ring_sp_sc", + .alloc = common_ring_alloc, + .free = common_ring_free, + .enqueue = common_ring_sp_enqueue, + .dequeue = common_ring_sc_dequeue, + .get_count = common_ring_get_count, +}; + +static const struct rte_mempool_ops ops_mp_sc = { + .name = "ring_mp_sc", + .alloc = common_ring_alloc, + .free = common_ring_free, + .enqueue = common_ring_mp_enqueue, + .dequeue = common_ring_sc_dequeue, + .get_count = common_ring_get_count, +}; + +static const struct rte_mempool_ops ops_sp_mc = { + .name = "ring_sp_mc", + .alloc = common_ring_alloc, + .free = common_ring_free, + .enqueue = common_ring_sp_enqueue, + .dequeue = common_ring_mc_dequeue, + .get_count = common_ring_get_count, +}; + +MEMPOOL_REGISTER_OPS(ops_mp_mc); +MEMPOOL_REGISTER_OPS(ops_sp_sc); +MEMPOOL_REGISTER_OPS(ops_mp_sc); +MEMPOOL_REGISTER_OPS(ops_sp_mc); diff --git a/drivers/mempool/ring/rte_mempool_ring_version.map b/drivers/mempool/ring/rte_mempool_ring_version.map new file mode 100644 index 0000000..8591cc0 --- /dev/null +++ b/drivers/mempool/ring/rte_mempool_ring_version.map @@ -0,0 +1,4 @@ +DPDK_17.05 { + + local: *; +}; diff --git a/lib/librte_mempool/Makefile b/lib/librte_mempool/Makefile index a4c089e..4cbf772 100644 --- a/lib/librte_mempool/Makefile +++ b/lib/librte_mempool/Makefile @@ -43,7 +43,6 @@ LIBABIVER := 2 # all source are stored in SRCS-y SRCS-$(CONFIG_RTE_LIBRTE_MEMPOOL) += rte_mempool.c SRCS-$(CONFIG_RTE_LIBRTE_MEMPOOL) += rte_mempool_ops.c -SRCS-$(CONFIG_RTE_LIBRTE_MEMPOOL) += rte_mempool_ring.c # install includes SYMLINK-$(CONFIG_RTE_LIBRTE_MEMPOOL)-include := rte_mempool.h diff --git a/lib/librte_mempool/rte_mempool_ring.c b/lib/librte_mempool/rte_mempool_ring.c deleted file mode 100644 index b9aa64d..0000000 --- a/lib/librte_mempool/rte_mempool_ring.c +++ /dev/null @@ -1,161 +0,0 @@ -/*- - * BSD LICENSE - * - * Copyright(c) 2010-2016 Intel Corporation. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Intel Corporation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include -#include - -#include -#include -#include - -static int -common_ring_mp_enqueue(struct rte_mempool *mp, void * const *obj_table, - unsigned n) -{ - return rte_ring_mp_enqueue_bulk(mp->pool_data, obj_table, n); -} - -static int -common_ring_sp_enqueue(struct rte_mempool *mp, void * const *obj_table, - unsigned n) -{ - return rte_ring_sp_enqueue_bulk(mp->pool_data, obj_table, n); -} - -static int -common_ring_mc_dequeue(struct rte_mempool *mp, void **obj_table, unsigned n) -{ - return rte_ring_mc_dequeue_bulk(mp->pool_data, obj_table, n); -} - -static int -common_ring_sc_dequeue(struct rte_mempool *mp, void **obj_table, unsigned n) -{ - return rte_ring_sc_dequeue_bulk(mp->pool_data, obj_table, n); -} - -static unsigned -common_ring_get_count(const struct rte_mempool *mp) -{ - return rte_ring_count(mp->pool_data); -} - - -static int -common_ring_alloc(struct rte_mempool *mp) -{ - int rg_flags = 0, ret; - char rg_name[RTE_RING_NAMESIZE]; - struct rte_ring *r; - - ret = snprintf(rg_name, sizeof(rg_name), - RTE_MEMPOOL_MZ_FORMAT, mp->name); - if (ret < 0 || ret >= (int)sizeof(rg_name)) { - rte_errno = ENAMETOOLONG; - return -rte_errno; - } - - /* ring flags */ - if (mp->flags & MEMPOOL_F_SP_PUT) - rg_flags |= RING_F_SP_ENQ; - if (mp->flags & MEMPOOL_F_SC_GET) - rg_flags |= RING_F_SC_DEQ; - - /* - * Allocate the ring that will be used to store objects. - * Ring functions will return appropriate errors if we are - * running as a secondary process etc., so no checks made - * in this function for that condition. - */ - r = rte_ring_create(rg_name, rte_align32pow2(mp->size + 1), - mp->socket_id, rg_flags); - if (r == NULL) - return -rte_errno; - - mp->pool_data = r; - - return 0; -} - -static void -common_ring_free(struct rte_mempool *mp) -{ - rte_ring_free(mp->pool_data); -} - -/* - * The following 4 declarations of mempool ops structs address - * the need for the backward compatible mempool handlers for - * single/multi producers and single/multi consumers as dictated by the - * flags provided to the rte_mempool_create function - */ -static const struct rte_mempool_ops ops_mp_mc = { - .name = "ring_mp_mc", - .alloc = common_ring_alloc, - .free = common_ring_free, - .enqueue = common_ring_mp_enqueue, - .dequeue = common_ring_mc_dequeue, - .get_count = common_ring_get_count, -}; - -static const struct rte_mempool_ops ops_sp_sc = { - .name = "ring_sp_sc", - .alloc = common_ring_alloc, - .free = common_ring_free, - .enqueue = common_ring_sp_enqueue, - .dequeue = common_ring_sc_dequeue, - .get_count = common_ring_get_count, -}; - -static const struct rte_mempool_ops ops_mp_sc = { - .name = "ring_mp_sc", - .alloc = common_ring_alloc, - .free = common_ring_free, - .enqueue = common_ring_mp_enqueue, - .dequeue = common_ring_sc_dequeue, - .get_count = common_ring_get_count, -}; - -static const struct rte_mempool_ops ops_sp_mc = { - .name = "ring_sp_mc", - .alloc = common_ring_alloc, - .free = common_ring_free, - .enqueue = common_ring_sp_enqueue, - .dequeue = common_ring_mc_dequeue, - .get_count = common_ring_get_count, -}; - -MEMPOOL_REGISTER_OPS(ops_mp_mc); -MEMPOOL_REGISTER_OPS(ops_sp_sc); -MEMPOOL_REGISTER_OPS(ops_mp_sc); -MEMPOOL_REGISTER_OPS(ops_sp_mc);