From patchwork Fri Sep 8 13:00:06 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 112072 Delivered-To: patch@linaro.org Received: by 10.37.128.210 with SMTP id c18csp1576246ybm; Fri, 8 Sep 2017 06:01:02 -0700 (PDT) X-Google-Smtp-Source: AOwi7QCvBhSnpLEbPh+Wmm339Rp9oqarQIRA8gtGHD7AZ3vsPPAmvcksKxMxP1ae0iduzc+X/Kb4 X-Received: by 10.200.35.123 with SMTP id b56mr3988610qtb.62.1504875662236; Fri, 08 Sep 2017 06:01:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1504875662; cv=none; d=google.com; s=arc-20160816; b=Iq3w+LQjkvarhomFEDT0iAZlzpLWQu6svZx/Qmh6/+zBOqm0gPIZ1d0VIczM3p6vFb HeJdMk36/apAXDKqhffQIfdw2Gno4za/MmRHDbPNjWrzmiF8DcK/eAyR7IxQBM0WGO+P fbx33c9/KAHs7uClnL62iBUqLMm5UQEBdTQo3kvcRBZX9llpYdpKnp5yXqaxYvKPnP+g oD8daoKbsFOY1IYLjDMlggx3S0ckSLwJE6/7oJtouRwJVX5JgJF9rOGXaUTDxMwObF07 ZcqkZt6apKSX5CssDG6j5RqkCtrbTE8n+0ixlofCUqUy8ceKwKer7CVTeUVHJTa7SjMR ZhAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:github-pr-num :references:in-reply-to:message-id:date:to:from:delivered-to :arc-authentication-results; bh=WFYnSticIReWvMvsXrPyuPe9Sbv4vDtXXjL4F7G5/0o=; b=Y82Nv541MbTRscjEs9lhF6aACznHiRxuFheFuciEKd4WwJkzE22mqmmxlAnDFLeET9 U/bvwdi/A0xAzCwCh5rWaITXl45VGD/116qqwcIswckiLLhdEoynGQJX/xSNsyQeNaUB DH0/0Nf0+Gli0jKkY+GoRi+k3O+rz6vRWyw/teb5K+dLu3MT/6EDYAR857asfKm35sKg 5+YsHOnfPPXSKUDC6wggFxo/1mwN1WK49ZGPeUQJd36cpLqiwWS53YAXS9kc0YK4UE7I +bM9Wptm10/XpOgjuOFlP/hmUW465PsY6X0Ss3lH/c6m8iLc5xXQBp9bAMH1LjCJCVRR bR+Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id s59si311073qtd.512.2017.09.08.06.01.01; Fri, 08 Sep 2017 06:01:02 -0700 (PDT) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Received: by lists.linaro.org (Postfix, from userid 109) id DCA3365BEC; Fri, 8 Sep 2017 13:01:01 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id ECB3F65BD2; Fri, 8 Sep 2017 13:00:26 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 8E72465BCF; Fri, 8 Sep 2017 13:00:17 +0000 (UTC) Received: from forward106j.mail.yandex.net (forward106j.mail.yandex.net [5.45.198.249]) by lists.linaro.org (Postfix) with ESMTPS id 40D5965BCA for ; Fri, 8 Sep 2017 13:00:15 +0000 (UTC) Received: from mxback2g.mail.yandex.net (mxback2g.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:163]) by forward106j.mail.yandex.net (Yandex) with ESMTP id 542521804473 for ; Fri, 8 Sep 2017 16:00:13 +0300 (MSK) Received: from smtp1p.mail.yandex.net (smtp1p.mail.yandex.net [2a02:6b8:0:1472:2741:0:8b6:6]) by mxback2g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id l2AkTyMfFM-0DV0uplC; Fri, 08 Sep 2017 16:00:13 +0300 Received: by smtp1p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id P5WMpzmmv9-0CbmYO2h; Fri, 08 Sep 2017 16:00:12 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client certificate not present) From: Github ODP bot To: lng-odp@lists.linaro.org Date: Fri, 8 Sep 2017 16:00:06 +0300 Message-Id: <1504875607-2391-2-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1504875607-2391-1-git-send-email-odpbot@yandex.ru> References: <1504875607-2391-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 169 Subject: [lng-odp] [PATCH CLOUD-DEV v2 1/2] linux-dpdk:prepare for buffer submodule X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" From: Balakrishna Garapati Signed-off-by: Balakrishna Garapati --- /** Email created from pull request 169 (GBalakrishna:dpdk_buffer_submodule) ** https://github.com/Linaro/odp/pull/169 ** Patch: https://github.com/Linaro/odp/pull/169.patch ** Base sha: 344fe21a06ef4273f34c4441edd0caef876517d9 ** Merge commit sha: 26368c50425595b1ad56df6a2eb6a809b22e7def **/ platform/linux-dpdk/Makefile.am | 2 +- platform/linux-dpdk/{odp_buffer.c => buffer/dpdk.c} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename platform/linux-dpdk/{odp_buffer.c => buffer/dpdk.c} (100%) diff --git a/platform/linux-dpdk/Makefile.am b/platform/linux-dpdk/Makefile.am index 6e7f0b1dd..dea65e5dd 100644 --- a/platform/linux-dpdk/Makefile.am +++ b/platform/linux-dpdk/Makefile.am @@ -225,7 +225,7 @@ __LIB__libodp_dpdk_la_SOURCES = \ ../linux-generic/odp_atomic.c \ ../linux-generic/odp_barrier.c \ ../linux-generic/odp_bitmap.c \ - odp_buffer.c \ + buffer/dpdk.c \ ../linux-generic/odp_byteorder.c \ ../linux-generic/odp_classification.c \ ../linux-generic/odp_cpu.c \ diff --git a/platform/linux-dpdk/odp_buffer.c b/platform/linux-dpdk/buffer/dpdk.c similarity index 100% rename from platform/linux-dpdk/odp_buffer.c rename to platform/linux-dpdk/buffer/dpdk.c From patchwork Fri Sep 8 13:00:07 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 112073 Delivered-To: patch@linaro.org Received: by 10.37.128.210 with SMTP id c18csp1577571ybm; Fri, 8 Sep 2017 06:01:48 -0700 (PDT) X-Google-Smtp-Source: AOwi7QBHWa+OP83b5D048L7ihlTnu9eAVzG8jzYUvwvSKJorFrG7tVippTez4lOqkIy+odg6/Q2w X-Received: by 10.55.36.3 with SMTP id w3mr3638913qkg.284.1504875708576; Fri, 08 Sep 2017 06:01:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1504875708; cv=none; d=google.com; s=arc-20160816; b=d9r1axUxopdlYkgYga7qgrkIGx4PIIfzMQu/o28s25KrzwNN4/tabSlscm74J0ZvNy bJT7fVyNZtmd7D6ybdCV40Q9mLAHqr7hmIuY8fkGqhVsmlP5pXGGgCj2mMU+hmsMqodd XLwCf+L2DGyfsj/D433mTlb5BsuCO5fHZ3v18t/jDWt2JK72XP8c4w6YIWNm7DK1SOrf Bsma4YfNuTpO5y3Ijvq/HrDSe60bHNJGnrNcPGMQ+FlXF8zERmy6ycnnidbyjzvDqnlh 61hJ1t9PQ5sitE+EXM4ViVwtvYPBqAEPHou28KTGFG5km6GER93h6FK3W/o6q560Yfvj K7sQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:github-pr-num :references:in-reply-to:message-id:date:to:from:delivered-to :arc-authentication-results; bh=QNoA62INgIDAv97LFGtmGafm7TI7dhEinsvTfK4jW/4=; b=LBI+8rtIOH5YL8tgBoyMFnEqK6Yst9k+H/FbHrjHndd2UFS1VT5FA0+8uBYHbwtHFo tHURLkyDbFnyncEpbiqm08PsO8DJouXJ8d2Bx1+HnIWVETRp9LR/KHa60RzldvxqhGEz 2s7W6/nGfh64Ss6y2TE5S5ofjpyBEwC9VmW+hqAoYIGF3xmundirRtbmNyR1yBk1Bdtx OhxRmcWcxReWEWQ2EmaOfL4FFi1vBSpDSHS7IYrcYiicRnVl1MQArScfU7UYJMka/3ut 4wgwoy7NCJzVMft4YK6PQ+rNQPFxvwuldfA6SKeuH/MZcYM4IlwTkncoI6ksivyF4IrN Xleg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id b1si1943276qke.473.2017.09.08.06.01.48; Fri, 08 Sep 2017 06:01:48 -0700 (PDT) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Received: by lists.linaro.org (Postfix, from userid 109) id 2F23165BEC; Fri, 8 Sep 2017 13:01:48 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_SORBS_SPAM, URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 5848765BDD; Fri, 8 Sep 2017 13:00:30 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 230EB65BC8; Fri, 8 Sep 2017 13:00:21 +0000 (UTC) Received: from forward105p.mail.yandex.net (forward105p.mail.yandex.net [77.88.28.108]) by lists.linaro.org (Postfix) with ESMTPS id A7FFC65BCC for ; Fri, 8 Sep 2017 13:00:15 +0000 (UTC) Received: from mxback7o.mail.yandex.net (mxback7o.mail.yandex.net [IPv6:2a02:6b8:0:1a2d::21]) by forward105p.mail.yandex.net (Yandex) with ESMTP id 0DA99408236B for ; Fri, 8 Sep 2017 16:00:14 +0300 (MSK) Received: from smtp1p.mail.yandex.net (smtp1p.mail.yandex.net [2a02:6b8:0:1472:2741:0:8b6:6]) by mxback7o.mail.yandex.net (nwsmtp/Yandex) with ESMTP id 1bFjkEjpG0-0DV4ud76; Fri, 08 Sep 2017 16:00:13 +0300 Received: by smtp1p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id P5WMpzmmv9-0DbmDuOa; Fri, 08 Sep 2017 16:00:13 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client certificate not present) From: Github ODP bot To: lng-odp@lists.linaro.org Date: Fri, 8 Sep 2017 16:00:07 +0300 Message-Id: <1504875607-2391-3-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1504875607-2391-1-git-send-email-odpbot@yandex.ru> References: <1504875607-2391-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 169 Subject: [lng-odp] [PATCH CLOUD-DEV v2 2/2] linux-dpdk:introduce buffer submodule X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" From: Balakrishna Garapati Signed-off-by: Balakrishna Garapati --- /** Email created from pull request 169 (GBalakrishna:dpdk_buffer_submodule) ** https://github.com/Linaro/odp/pull/169 ** Patch: https://github.com/Linaro/odp/pull/169.patch ** Base sha: 344fe21a06ef4273f34c4441edd0caef876517d9 ** Merge commit sha: 26368c50425595b1ad56df6a2eb6a809b22e7def **/ platform/linux-dpdk/Makefile.am | 3 + platform/linux-dpdk/buffer/dpdk.c | 128 +++++++++++++++++++++++++++++++++----- platform/linux-dpdk/pool/dpdk.c | 62 ------------------ 3 files changed, 114 insertions(+), 79 deletions(-) diff --git a/platform/linux-dpdk/Makefile.am b/platform/linux-dpdk/Makefile.am index dea65e5dd..89818a737 100644 --- a/platform/linux-dpdk/Makefile.am +++ b/platform/linux-dpdk/Makefile.am @@ -168,6 +168,7 @@ odpdrvplatinclude_HEADERS = \ noinst_HEADERS = \ + ${top_srcdir}/platform/linux-generic/include/odp_buffer_subsystem.h \ ${top_srcdir}/platform/linux-generic/include/_fdserver_internal.h \ ${top_srcdir}/platform/linux-generic/include/_ishm_internal.h \ ${top_srcdir}/platform/linux-generic/include/_ishmphy_internal.h \ @@ -251,6 +252,7 @@ __LIB__libodp_dpdk_la_SOURCES = \ ../linux-generic/odp_rwlock.c \ ../linux-generic/odp_rwlock_recursive.c \ ../linux-generic/pool/subsystem.c \ + ../linux-generic/buffer/subsystem.c \ ../linux-generic/odp_schedule.c \ ../linux-generic/odp_schedule_if.c \ ../linux-generic/odp_schedule_iquery.c \ @@ -295,6 +297,7 @@ __LIB__libodp_dpdk_la_SOURCES += arch/x86/cpu_flags.c \ endif pool/dpdk.lo: AM_CFLAGS += -DIM_ACTIVE_MODULE +buffer/dpdk.lo: AM_CFLAGS += -DIM_ACTIVE_MODULE # Build modular framework into odp-linux library modularframeworkdir = $(top_srcdir)/frameworks/modular diff --git a/platform/linux-dpdk/buffer/dpdk.c b/platform/linux-dpdk/buffer/dpdk.c index 3c71fef84..f39ab31f1 100644 --- a/platform/linux-dpdk/buffer/dpdk.c +++ b/platform/linux-dpdk/buffer/dpdk.c @@ -7,30 +7,96 @@ #include #include #include +#include #include +#include #include #include #include -odp_buffer_t odp_buffer_from_event(odp_event_t ev) +static odp_buffer_t buffer_alloc(odp_pool_t pool_hdl) +{ + odp_buffer_t buffer; + pool_entry_cp_t *pool_cp; + pool_entry_dp_t *pool_dp; + + pool_cp = odp_pool_to_entry_cp(pool_hdl); + pool_dp = odp_pool_to_entry_dp(pool_hdl); + + ODP_ASSERT(pool_cp->params.type != ODP_POOL_BUFFER || + pool_cp->params.type != ODP_POOL_TIMEOUT); + + buffer = (odp_buffer_t)rte_ctrlmbuf_alloc(pool_dp->rte_mempool); + + if ((struct rte_mbuf *)buffer == NULL) { + rte_errno = ENOMEM; + return ODP_BUFFER_INVALID; + } + + buf_hdl_to_hdr(buffer)->next = NULL; + return buffer; +} + +static odp_buffer_t dpdk_buffer_alloc(odp_pool_t pool_hdl) +{ + ODP_ASSERT(ODP_POOL_INVALID != pool_hdl); + + return buffer_alloc(pool_hdl); +} + +static int dpdk_buffer_alloc_multi(odp_pool_t pool_hdl, + odp_buffer_t buf[], + int num) +{ + int i; + + ODP_ASSERT(ODP_POOL_INVALID != pool_hdl); + + for (i = 0; i < num; i++) { + buf[i] = buffer_alloc(pool_hdl); + if (buf[i] == ODP_BUFFER_INVALID) + return rte_errno == ENOMEM ? i : -EINVAL; + } + return i; +} + +static void dpdk_buffer_free(odp_buffer_t buf) +{ + struct rte_mbuf *mbuf = (struct rte_mbuf *)buf; + + rte_ctrlmbuf_free(mbuf); +} + +static void dpdk_buffer_free_multi(const odp_buffer_t buf[], int num) +{ + int i; + + for (i = 0; i < num; i++) { + struct rte_mbuf *mbuf = (struct rte_mbuf *)buf[i]; + + rte_ctrlmbuf_free(mbuf); + } +} + +static odp_buffer_t dpdk_buffer_from_event(odp_event_t ev) { return (odp_buffer_t)ev; } -odp_event_t odp_buffer_to_event(odp_buffer_t buf) +static odp_event_t dpdk_buffer_to_event(odp_buffer_t buf) { return (odp_event_t)buf; } -void *odp_buffer_addr(odp_buffer_t buf) +static void *dpdk_buffer_addr(odp_buffer_t buf) { odp_buffer_hdr_t *hdr = buf_hdl_to_hdr(buf); return hdr->mb.buf_addr; } -uint32_t odp_buffer_size(odp_buffer_t buf) +static uint32_t dpdk_buffer_size(odp_buffer_t buf) { odp_buffer_hdr_t *hdr = buf_hdl_to_hdr(buf); struct rte_mbuf *mbuf = (struct rte_mbuf *)hdr; @@ -52,7 +118,7 @@ void _odp_buffer_type_set(odp_buffer_t buf, int type) hdr->type = type; } -int odp_buffer_is_valid(odp_buffer_t buf) +static int dpdk_buffer_is_valid(odp_buffer_t buf) { /* We could call rte_mbuf_sanity_check, but that panics * and aborts the program */ @@ -71,43 +137,71 @@ int odp_buffer_snprint(char *str, uint32_t n, odp_buffer_t buf) hdr = buf_hdl_to_hdr(buf); - len += snprintf(&str[len], n-len, + len += snprintf(&str[len], n - len, "Buffer\n"); - len += snprintf(&str[len], n-len, + len += snprintf(&str[len], n - len, " pool %p\n", hdr->mb.pool); - len += snprintf(&str[len], n-len, - " phy_addr %"PRIu64"\n", hdr->mb.buf_physaddr); - len += snprintf(&str[len], n-len, + len += snprintf(&str[len], n - len, + " phy_addr %" PRIu64 "\n", hdr->mb.buf_physaddr); + len += snprintf(&str[len], n - len, " addr %p\n", hdr->mb.buf_addr); - len += snprintf(&str[len], n-len, + len += snprintf(&str[len], n - len, " size %u\n", hdr->mb.buf_len); - len += snprintf(&str[len], n-len, + len += snprintf(&str[len], n - len, " ref_count %i\n", rte_mbuf_refcnt_read(&hdr->mb)); - len += snprintf(&str[len], n-len, + len += snprintf(&str[len], n - len, " odp type %i\n", hdr->type); return len; } -void odp_buffer_print(odp_buffer_t buf) +static void dpdk_buffer_print(odp_buffer_t buf) { int max_len = 512; char str[max_len]; int len; - len = odp_buffer_snprint(str, max_len-1, buf); + len = odp_buffer_snprint(str, max_len - 1, buf); str[len] = 0; ODP_PRINT("\n%s\n", str); } -uint64_t odp_buffer_to_u64(odp_buffer_t hdl) +static uint64_t dpdk_buffer_to_u64(odp_buffer_t hdl) { return _odp_pri(hdl); } -odp_pool_t odp_buffer_pool(odp_buffer_t buf) +static odp_pool_t dpdk_buffer_pool(odp_buffer_t buf) { return buf_hdl_to_hdr(buf)->pool_hdl; } + +odp_buffer_module_t dpdk_buffer = { + .base = { + .name = "dpdk_buffer", + .init_local = NULL, + .term_local = NULL, + .init_global = NULL, + .term_global = NULL, + }, + .buffer_alloc = dpdk_buffer_alloc, + .buffer_alloc_multi = dpdk_buffer_alloc_multi, + .buffer_free = dpdk_buffer_free, + .buffer_free_multi = dpdk_buffer_free_multi, + .buffer_from_event = dpdk_buffer_from_event, + .buffer_to_event = dpdk_buffer_to_event, + .buffer_addr = dpdk_buffer_addr, + .buffer_size = dpdk_buffer_size, + .buffer_is_valid = dpdk_buffer_is_valid, + .buffer_print = dpdk_buffer_print, + .buffer_to_u64 = dpdk_buffer_to_u64, + .buffer_pool = dpdk_buffer_pool, +}; + +ODP_MODULE_CONSTRUCTOR(dpdk_buffer) +{ + odp_module_constructor(&dpdk_buffer); + odp_subsystem_register_module(buffer, &dpdk_buffer); +} diff --git a/platform/linux-dpdk/pool/dpdk.c b/platform/linux-dpdk/pool/dpdk.c index 499bea127..6acc4e901 100644 --- a/platform/linux-dpdk/pool/dpdk.c +++ b/platform/linux-dpdk/pool/dpdk.c @@ -549,68 +549,6 @@ static odp_pool_t dpdk_pool_lookup(const char *name) return pool_hdl; } -static odp_buffer_t buffer_alloc(odp_pool_t pool_hdl) -{ - odp_buffer_t buffer; - pool_entry_cp_t *pool_cp; - pool_entry_dp_t *pool_dp; - - pool_cp = odp_pool_to_entry_cp(pool_hdl); - pool_dp = odp_pool_to_entry_dp(pool_hdl); - - ODP_ASSERT(pool_cp->params.type != ODP_POOL_BUFFER && - pool_cp->params.type != ODP_POOL_TIMEOUT); - - buffer = (odp_buffer_t)rte_ctrlmbuf_alloc(pool_dp->rte_mempool); - - if ((struct rte_mbuf *)buffer == NULL) { - rte_errno = ENOMEM; - return ODP_BUFFER_INVALID; - } - - buf_hdl_to_hdr(buffer)->next = NULL; - return buffer; -} - -odp_buffer_t odp_buffer_alloc(odp_pool_t pool_hdl) -{ - ODP_ASSERT(ODP_POOL_INVALID != pool_hdl); - - return buffer_alloc(pool_hdl); -} - -int odp_buffer_alloc_multi(odp_pool_t pool_hdl, odp_buffer_t buf[], int num) -{ - int i; - - ODP_ASSERT(ODP_POOL_INVALID != pool_hdl); - - for (i = 0; i < num; i++) { - buf[i] = buffer_alloc(pool_hdl); - if (buf[i] == ODP_BUFFER_INVALID) - return rte_errno == ENOMEM ? i : -EINVAL; - } - return i; -} - -void odp_buffer_free(odp_buffer_t buf) -{ - struct rte_mbuf *mbuf = (struct rte_mbuf *)buf; - - rte_ctrlmbuf_free(mbuf); -} - -void odp_buffer_free_multi(const odp_buffer_t buf[], int num) -{ - int i; - - for (i = 0; i < num; i++) { - struct rte_mbuf *mbuf = (struct rte_mbuf *)buf[i]; - - rte_ctrlmbuf_free(mbuf); - } -} - static void dpdk_pool_print(odp_pool_t pool_hdl) { pool_entry_dp_t *pool_dp = odp_pool_to_entry_dp(pool_hdl);