From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id D2060423B9; Thu, 12 Jan 2023 19:53:57 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6B7AF42DCE; Thu, 12 Jan 2023 19:53:44 +0100 (CET) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by mails.dpdk.org (Postfix) with ESMTP id AC4CF42DA6 for ; Thu, 12 Jan 2023 19:53:40 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1673549620; x=1705085620; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=kxi0mPJJk3YnUhGVvf8UDwQW3Sn2P8k1Ke5ZSZWBOdE=; b=KJCO8b7KbShzd9nKJDSK8UoF/uMDvchFlsRqiFclWEYY0IbpQaw/I1y3 DqFhhWYG5CNNjeBd37bn2qkTuX8VygveJvWD1qRGeINMaDOXfxigIuFmn LkhAl2qepe3Qq6gFQt469sn0MS6K+Aen6tYPfouZV2ekOShaC1AqVpwom 50qoRX4fk4iY0XHK2CKs6/n3ORI0kNYpcD4/ckh9JqwXXl+6OXKwM1uoY rn5RfI/tlE1KjFBL3EEXaezW/Yv7rJmAFwnzTSGb9SXXvPohjX90M4WNY c0AART+2zWvxqu23j7RXvE0wVQ7WgypdZGRP7DTdnBGIxuiMUkykJ/mJj A==; X-IronPort-AV: E=McAfee;i="6500,9779,10588"; a="303492895" X-IronPort-AV: E=Sophos;i="5.97,211,1669104000"; d="scan'208";a="303492895" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jan 2023 10:53:40 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10588"; a="746647992" X-IronPort-AV: E=Sophos;i="5.97,211,1669104000"; d="scan'208";a="746647992" Received: from silpixa00400573.ir.intel.com (HELO silpixa00400573.ger.corp.intel.com) ([10.237.222.53]) by FMSMGA003.fm.intel.com with ESMTP; 12 Jan 2023 10:53:39 -0800 From: Cristian Dumitrescu To: dev@dpdk.org Cc: Kamalakannan R Subject: [PATCH V4 02/11] examples/pipeline: rework memory pool support Date: Thu, 12 Jan 2023 18:53:26 +0000 Message-Id: <20230112185335.247116-3-cristian.dumitrescu@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230112185335.247116-1-cristian.dumitrescu@intel.com> References: <20230111205608.87953-1-cristian.dumitrescu@intel.com> <20230112185335.247116-1-cristian.dumitrescu@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Rework the memory pool CLI command to accommodate the MBUF private meta-data area size parameter. Signed-off-by: Cristian Dumitrescu Signed-off-by: Kamalakannan R --- examples/pipeline/cli.c | 72 ++++++++++------- examples/pipeline/examples/fib.cli | 2 +- examples/pipeline/examples/hash_func.cli | 2 +- examples/pipeline/examples/l2fwd.cli | 2 +- examples/pipeline/examples/l2fwd_macswp.cli | 2 +- .../pipeline/examples/l2fwd_macswp_pcap.cli | 2 +- examples/pipeline/examples/l2fwd_pcap.cli | 2 +- examples/pipeline/examples/learner.cli | 2 +- examples/pipeline/examples/meter.cli | 2 +- examples/pipeline/examples/mirroring.cli | 2 +- examples/pipeline/examples/recirculation.cli | 2 +- examples/pipeline/examples/registers.cli | 2 +- examples/pipeline/examples/selector.cli | 2 +- examples/pipeline/examples/varbit.cli | 2 +- examples/pipeline/examples/vxlan.cli | 2 +- examples/pipeline/examples/vxlan_pcap.cli | 2 +- examples/pipeline/obj.c | 80 +------------------ examples/pipeline/obj.h | 27 ------- 18 files changed, 63 insertions(+), 146 deletions(-) diff --git a/examples/pipeline/cli.c b/examples/pipeline/cli.c index e1e7aaddc1..14f1cfa47e 100644 --- a/examples/pipeline/cli.c +++ b/examples/pipeline/cli.c @@ -192,72 +192,88 @@ parse_table_entry(struct rte_swx_ctl_pipeline *p, } static const char cmd_mempool_help[] = -"mempool \n" -" buffer \n" -" pool \n" -" cache \n" -" cpu \n"; +"mempool " +"meta " +"pkt " +"pool " +"cache " +"numa \n"; static void cmd_mempool(char **tokens, - uint32_t n_tokens, - char *out, - size_t out_size, - void *obj) + uint32_t n_tokens, + char *out, + size_t out_size, + void *obj __rte_unused) { - struct mempool_params p; - char *name; - struct mempool *mempool; + struct rte_mempool *mp; + char *mempool_name; + uint32_t mbuf_private_size, pkt_buffer_size, pool_size, cache_size, numa_node; - if (n_tokens != 10) { + if (n_tokens != 12) { snprintf(out, out_size, MSG_ARG_MISMATCH, tokens[0]); return; } - name = tokens[1]; + mempool_name = tokens[1]; + + if (strcmp(tokens[2], "meta")) { + snprintf(out, out_size, MSG_ARG_NOT_FOUND, "meta"); + return; + } - if (strcmp(tokens[2], "buffer") != 0) { - snprintf(out, out_size, MSG_ARG_NOT_FOUND, "buffer"); + if (parser_read_uint32(&mbuf_private_size, tokens[3])) { + snprintf(out, out_size, MSG_ARG_INVALID, "mbuf_private_size"); return; } - if (parser_read_uint32(&p.buffer_size, tokens[3]) != 0) { - snprintf(out, out_size, MSG_ARG_INVALID, "buffer_size"); + if (strcmp(tokens[4], "pkt")) { + snprintf(out, out_size, MSG_ARG_NOT_FOUND, "pkt"); return; } - if (strcmp(tokens[4], "pool") != 0) { + if (parser_read_uint32(&pkt_buffer_size, tokens[5])) { + snprintf(out, out_size, MSG_ARG_INVALID, "pkt_buffer_size"); + return; + } + + if (strcmp(tokens[6], "pool")) { snprintf(out, out_size, MSG_ARG_NOT_FOUND, "pool"); return; } - if (parser_read_uint32(&p.pool_size, tokens[5]) != 0) { + if (parser_read_uint32(&pool_size, tokens[7])) { snprintf(out, out_size, MSG_ARG_INVALID, "pool_size"); return; } - if (strcmp(tokens[6], "cache") != 0) { + if (strcmp(tokens[8], "cache")) { snprintf(out, out_size, MSG_ARG_NOT_FOUND, "cache"); return; } - if (parser_read_uint32(&p.cache_size, tokens[7]) != 0) { + if (parser_read_uint32(&cache_size, tokens[9])) { snprintf(out, out_size, MSG_ARG_INVALID, "cache_size"); return; } - if (strcmp(tokens[8], "cpu") != 0) { - snprintf(out, out_size, MSG_ARG_NOT_FOUND, "cpu"); + if (strcmp(tokens[10], "numa")) { + snprintf(out, out_size, MSG_ARG_NOT_FOUND, "numa"); return; } - if (parser_read_uint32(&p.cpu_id, tokens[9]) != 0) { - snprintf(out, out_size, MSG_ARG_INVALID, "cpu_id"); + if (parser_read_uint32(&numa_node, tokens[11])) { + snprintf(out, out_size, MSG_ARG_INVALID, "numa_node"); return; } - mempool = mempool_create(obj, name, &p); - if (mempool == NULL) { + mp = rte_pktmbuf_pool_create(mempool_name, + pool_size, + cache_size, + mbuf_private_size, + pkt_buffer_size, + numa_node); + if (!mp) { snprintf(out, out_size, MSG_CMD_FAIL, tokens[0]); return; } diff --git a/examples/pipeline/examples/fib.cli b/examples/pipeline/examples/fib.cli index 4e30c1320f..2450dc9ca4 100644 --- a/examples/pipeline/examples/fib.cli +++ b/examples/pipeline/examples/fib.cli @@ -18,7 +18,7 @@ pipeline libbuild /tmp/fib.c /tmp/fib.so ; ; Note: Customize the parameters below to match your setup. ; -mempool MEMPOOL0 buffer 2304 pool 32K cache 256 cpu 0 +mempool MEMPOOL0 meta 0 pkt 2176 pool 32K cache 256 numa 0 ethdev 0000:18:00.0 rxq 1 128 MEMPOOL0 txq 1 512 promiscuous on ethdev 0000:18:00.1 rxq 1 128 MEMPOOL0 txq 1 512 promiscuous on ethdev 0000:3b:00.0 rxq 1 128 MEMPOOL0 txq 1 512 promiscuous on diff --git a/examples/pipeline/examples/hash_func.cli b/examples/pipeline/examples/hash_func.cli index b2e219e4c9..3840e47a2b 100644 --- a/examples/pipeline/examples/hash_func.cli +++ b/examples/pipeline/examples/hash_func.cli @@ -18,7 +18,7 @@ pipeline libbuild /tmp/hash_func.c /tmp/hash_func.so ; ; Note: Customize the parameters below to match your setup. ; -mempool MEMPOOL0 buffer 2304 pool 32K cache 256 cpu 0 +mempool MEMPOOL0 meta 0 pkt 2176 pool 32K cache 256 numa 0 ethdev 0000:18:00.0 rxq 1 128 MEMPOOL0 txq 1 512 promiscuous on ethdev 0000:18:00.1 rxq 1 128 MEMPOOL0 txq 1 512 promiscuous on ethdev 0000:3b:00.0 rxq 1 128 MEMPOOL0 txq 1 512 promiscuous on diff --git a/examples/pipeline/examples/l2fwd.cli b/examples/pipeline/examples/l2fwd.cli index 27e37021b9..c5505df296 100644 --- a/examples/pipeline/examples/l2fwd.cli +++ b/examples/pipeline/examples/l2fwd.cli @@ -18,7 +18,7 @@ pipeline libbuild /tmp/l2fwd.c /tmp/l2fwd.so ; ; Note: Customize the parameters below to match your setup. ; -mempool MEMPOOL0 buffer 2304 pool 32K cache 256 cpu 0 +mempool MEMPOOL0 meta 0 pkt 2176 pool 32K cache 256 numa 0 ethdev 0000:18:00.0 rxq 1 128 MEMPOOL0 txq 1 512 promiscuous on ethdev 0000:18:00.1 rxq 1 128 MEMPOOL0 txq 1 512 promiscuous on ethdev 0000:3b:00.0 rxq 1 128 MEMPOOL0 txq 1 512 promiscuous on diff --git a/examples/pipeline/examples/l2fwd_macswp.cli b/examples/pipeline/examples/l2fwd_macswp.cli index 11bb4543b9..bd700707f5 100644 --- a/examples/pipeline/examples/l2fwd_macswp.cli +++ b/examples/pipeline/examples/l2fwd_macswp.cli @@ -18,7 +18,7 @@ pipeline libbuild /tmp/l2fwd_macswp.c /tmp/l2fwd_macswp.so ; ; Note: Customize the parameters below to match your setup. ; -mempool MEMPOOL0 buffer 2304 pool 32K cache 256 cpu 0 +mempool MEMPOOL0 meta 0 pkt 2176 pool 32K cache 256 numa 0 ethdev 0000:18:00.0 rxq 1 128 MEMPOOL0 txq 1 512 promiscuous on ethdev 0000:18:00.1 rxq 1 128 MEMPOOL0 txq 1 512 promiscuous on ethdev 0000:3b:00.0 rxq 1 128 MEMPOOL0 txq 1 512 promiscuous on diff --git a/examples/pipeline/examples/l2fwd_macswp_pcap.cli b/examples/pipeline/examples/l2fwd_macswp_pcap.cli index 8724dae3b0..aa64b32ab2 100644 --- a/examples/pipeline/examples/l2fwd_macswp_pcap.cli +++ b/examples/pipeline/examples/l2fwd_macswp_pcap.cli @@ -18,7 +18,7 @@ pipeline libbuild /tmp/l2fwd_macswp.c /tmp/l2fwd_macswp.so ; ; Note: Customize the parameters below to match your setup. ; -mempool MEMPOOL0 buffer 2304 pool 32K cache 256 cpu 0 +mempool MEMPOOL0 meta 0 pkt 2176 pool 32K cache 256 numa 0 ; ; List of pipelines. diff --git a/examples/pipeline/examples/l2fwd_pcap.cli b/examples/pipeline/examples/l2fwd_pcap.cli index 4db0a0dc56..619d17474f 100644 --- a/examples/pipeline/examples/l2fwd_pcap.cli +++ b/examples/pipeline/examples/l2fwd_pcap.cli @@ -18,7 +18,7 @@ pipeline libbuild /tmp/l2fwd.c /tmp/l2fwd.so ; ; Note: Customize the parameters below to match your setup. ; -mempool MEMPOOL0 buffer 2304 pool 32K cache 256 cpu 0 +mempool MEMPOOL0 meta 0 pkt 2176 pool 32K cache 256 numa 0 ; ; List of pipelines. diff --git a/examples/pipeline/examples/learner.cli b/examples/pipeline/examples/learner.cli index 6c8aa3921e..42184be1c8 100644 --- a/examples/pipeline/examples/learner.cli +++ b/examples/pipeline/examples/learner.cli @@ -18,7 +18,7 @@ pipeline libbuild /tmp/learner.c /tmp/learner.so ; ; Note: Customize the parameters below to match your setup. ; -mempool MEMPOOL0 buffer 2304 pool 32K cache 256 cpu 0 +mempool MEMPOOL0 meta 0 pkt 2176 pool 32K cache 256 numa 0 ethdev 0000:18:00.0 rxq 1 128 MEMPOOL0 txq 1 512 promiscuous on ethdev 0000:18:00.1 rxq 1 128 MEMPOOL0 txq 1 512 promiscuous on ethdev 0000:3b:00.0 rxq 1 128 MEMPOOL0 txq 1 512 promiscuous on diff --git a/examples/pipeline/examples/meter.cli b/examples/pipeline/examples/meter.cli index 21582554b9..0fa38b16b8 100644 --- a/examples/pipeline/examples/meter.cli +++ b/examples/pipeline/examples/meter.cli @@ -18,7 +18,7 @@ pipeline libbuild /tmp/meter.c /tmp/meter.so ; ; Note: Customize the parameters below to match your setup. ; -mempool MEMPOOL0 buffer 2304 pool 32K cache 256 cpu 0 +mempool MEMPOOL0 meta 0 pkt 2176 pool 32K cache 256 numa 0 ethdev 0000:18:00.0 rxq 1 128 MEMPOOL0 txq 1 512 promiscuous on ethdev 0000:18:00.1 rxq 1 128 MEMPOOL0 txq 1 512 promiscuous on ethdev 0000:3b:00.0 rxq 1 128 MEMPOOL0 txq 1 512 promiscuous on diff --git a/examples/pipeline/examples/mirroring.cli b/examples/pipeline/examples/mirroring.cli index 1d439e04d3..e7391de74b 100644 --- a/examples/pipeline/examples/mirroring.cli +++ b/examples/pipeline/examples/mirroring.cli @@ -18,7 +18,7 @@ pipeline libbuild /tmp/mirroring.c /tmp/mirroring.so ; ; Note: Customize the parameters below to match your setup. ; -mempool MEMPOOL0 buffer 2304 pool 32K cache 256 cpu 0 +mempool MEMPOOL0 meta 0 pkt 2176 pool 32K cache 256 numa 0 ethdev 0000:18:00.0 rxq 1 128 MEMPOOL0 txq 1 512 promiscuous on ethdev 0000:18:00.1 rxq 1 128 MEMPOOL0 txq 1 512 promiscuous on ethdev 0000:3b:00.0 rxq 1 128 MEMPOOL0 txq 1 512 promiscuous on diff --git a/examples/pipeline/examples/recirculation.cli b/examples/pipeline/examples/recirculation.cli index 52d0894f12..965c870fd4 100644 --- a/examples/pipeline/examples/recirculation.cli +++ b/examples/pipeline/examples/recirculation.cli @@ -18,7 +18,7 @@ pipeline libbuild /tmp/recirculation.c /tmp/recirculation.so ; ; Note: Customize the parameters below to match your setup. ; -mempool MEMPOOL0 buffer 2304 pool 32K cache 256 cpu 0 +mempool MEMPOOL0 meta 0 pkt 2176 pool 32K cache 256 numa 0 ethdev 0000:18:00.0 rxq 1 128 MEMPOOL0 txq 1 512 promiscuous on ethdev 0000:18:00.1 rxq 1 128 MEMPOOL0 txq 1 512 promiscuous on ethdev 0000:3b:00.0 rxq 1 128 MEMPOOL0 txq 1 512 promiscuous on diff --git a/examples/pipeline/examples/registers.cli b/examples/pipeline/examples/registers.cli index 3516f76a5b..aa775f71e5 100644 --- a/examples/pipeline/examples/registers.cli +++ b/examples/pipeline/examples/registers.cli @@ -18,7 +18,7 @@ pipeline libbuild /tmp/registers.c /tmp/registers.so ; ; Note: Customize the parameters below to match your setup. ; -mempool MEMPOOL0 buffer 2304 pool 32K cache 256 cpu 0 +mempool MEMPOOL0 meta 0 pkt 2176 pool 32K cache 256 numa 0 ethdev 0000:18:00.0 rxq 1 128 MEMPOOL0 txq 1 512 promiscuous on ethdev 0000:18:00.1 rxq 1 128 MEMPOOL0 txq 1 512 promiscuous on ethdev 0000:3b:00.0 rxq 1 128 MEMPOOL0 txq 1 512 promiscuous on diff --git a/examples/pipeline/examples/selector.cli b/examples/pipeline/examples/selector.cli index f0e251b657..f0608de184 100644 --- a/examples/pipeline/examples/selector.cli +++ b/examples/pipeline/examples/selector.cli @@ -18,7 +18,7 @@ pipeline libbuild /tmp/selector.c /tmp/selector.so ; ; Note: Customize the parameters below to match your setup. ; -mempool MEMPOOL0 buffer 2304 pool 32K cache 256 cpu 0 +mempool MEMPOOL0 meta 0 pkt 2176 pool 32K cache 256 numa 0 ethdev 0000:18:00.0 rxq 1 128 MEMPOOL0 txq 1 512 promiscuous on ethdev 0000:18:00.1 rxq 1 128 MEMPOOL0 txq 1 512 promiscuous on ethdev 0000:3b:00.0 rxq 1 128 MEMPOOL0 txq 1 512 promiscuous on diff --git a/examples/pipeline/examples/varbit.cli b/examples/pipeline/examples/varbit.cli index 0f89990471..648b8882c3 100644 --- a/examples/pipeline/examples/varbit.cli +++ b/examples/pipeline/examples/varbit.cli @@ -18,7 +18,7 @@ pipeline libbuild /tmp/varbit.c /tmp/varbit.so ; ; Note: Customize the parameters below to match your setup. ; -mempool MEMPOOL0 buffer 2304 pool 32K cache 256 cpu 0 +mempool MEMPOOL0 meta 0 pkt 2176 pool 32K cache 256 numa 0 ethdev 0000:18:00.0 rxq 1 128 MEMPOOL0 txq 1 512 promiscuous on ethdev 0000:18:00.1 rxq 1 128 MEMPOOL0 txq 1 512 promiscuous on ethdev 0000:3b:00.0 rxq 1 128 MEMPOOL0 txq 1 512 promiscuous on diff --git a/examples/pipeline/examples/vxlan.cli b/examples/pipeline/examples/vxlan.cli index 1fbd1be6e4..4565adfaea 100644 --- a/examples/pipeline/examples/vxlan.cli +++ b/examples/pipeline/examples/vxlan.cli @@ -18,7 +18,7 @@ pipeline libbuild /tmp/vxlan.c /tmp/vxlan.so ; ; Note: Customize the parameters below to match your setup. ; -mempool MEMPOOL0 buffer 2304 pool 32K cache 256 cpu 0 +mempool MEMPOOL0 meta 0 pkt 2176 pool 32K cache 256 numa 0 ethdev 0000:18:00.0 rxq 1 128 MEMPOOL0 txq 1 512 promiscuous on ethdev 0000:18:00.1 rxq 1 128 MEMPOOL0 txq 1 512 promiscuous on ethdev 0000:3b:00.0 rxq 1 128 MEMPOOL0 txq 1 512 promiscuous on diff --git a/examples/pipeline/examples/vxlan_pcap.cli b/examples/pipeline/examples/vxlan_pcap.cli index adc7f73312..510c2ad870 100644 --- a/examples/pipeline/examples/vxlan_pcap.cli +++ b/examples/pipeline/examples/vxlan_pcap.cli @@ -18,7 +18,7 @@ pipeline libbuild /tmp/vxlan.c /tmp/vxlan.so ; ; Note: Customize the parameters below to match your setup. ; -mempool MEMPOOL0 buffer 2304 pool 32K cache 256 cpu 0 +mempool MEMPOOL0 meta 0 pkt 2176 pool 32K cache 256 numa 0 ; ; List of pipelines. diff --git a/examples/pipeline/obj.c b/examples/pipeline/obj.c index cac825f22a..697d14a901 100644 --- a/examples/pipeline/obj.c +++ b/examples/pipeline/obj.c @@ -13,18 +13,12 @@ #include #include -#include #include #include #include #include "obj.h" -/* - * mempool - */ -TAILQ_HEAD(mempool_list, mempool); - /* * link */ @@ -39,75 +33,10 @@ TAILQ_HEAD(ring_list, ring); * obj */ struct obj { - struct mempool_list mempool_list; struct link_list link_list; struct ring_list ring_list; }; -/* - * mempool - */ -#define BUFFER_SIZE_MIN (sizeof(struct rte_mbuf) + RTE_PKTMBUF_HEADROOM) - -struct mempool * -mempool_create(struct obj *obj, const char *name, struct mempool_params *params) -{ - struct mempool *mempool; - struct rte_mempool *m; - - /* Check input params */ - if ((name == NULL) || - mempool_find(obj, name) || - (params == NULL) || - (params->buffer_size < BUFFER_SIZE_MIN) || - (params->pool_size == 0)) - return NULL; - - /* Resource create */ - m = rte_pktmbuf_pool_create( - name, - params->pool_size, - params->cache_size, - 0, - params->buffer_size - sizeof(struct rte_mbuf), - params->cpu_id); - - if (m == NULL) - return NULL; - - /* Node allocation */ - mempool = calloc(1, sizeof(struct mempool)); - if (mempool == NULL) { - rte_mempool_free(m); - return NULL; - } - - /* Node fill in */ - strlcpy(mempool->name, name, sizeof(mempool->name)); - mempool->m = m; - mempool->buffer_size = params->buffer_size; - - /* Node add to list */ - TAILQ_INSERT_TAIL(&obj->mempool_list, mempool, node); - - return mempool; -} - -struct mempool * -mempool_find(struct obj *obj, const char *name) -{ - struct mempool *mempool; - - if (!obj || !name) - return NULL; - - TAILQ_FOREACH(mempool, &obj->mempool_list, node) - if (strcmp(mempool->name, name) == 0) - return mempool; - - return NULL; -} - /* * link */ @@ -171,7 +100,7 @@ link_create(struct obj *obj, const char *name, struct link_params *params) struct rte_eth_conf port_conf; struct link *link; struct link_params_rss *rss; - struct mempool *mempool; + struct rte_mempool *mempool; uint32_t cpu_id, i; int status; uint16_t port_id = 0; @@ -193,8 +122,8 @@ link_create(struct obj *obj, const char *name, struct link_params *params) if (rte_eth_dev_info_get(port_id, &port_info) != 0) return NULL; - mempool = mempool_find(obj, params->rx.mempool_name); - if (mempool == NULL) + mempool = rte_mempool_lookup(params->rx.mempool_name); + if (!mempool) return NULL; rss = params->rx.rss; @@ -251,7 +180,7 @@ link_create(struct obj *obj, const char *name, struct link_params *params) params->rx.queue_size, cpu_id, NULL, - mempool->m); + mempool); if (status < 0) return NULL; @@ -421,7 +350,6 @@ obj_init(void) if (!obj) return NULL; - TAILQ_INIT(&obj->mempool_list); TAILQ_INIT(&obj->link_list); TAILQ_INIT(&obj->ring_list); diff --git a/examples/pipeline/obj.h b/examples/pipeline/obj.h index 8ea1c414c2..4ea610ceed 100644 --- a/examples/pipeline/obj.h +++ b/examples/pipeline/obj.h @@ -8,7 +8,6 @@ #include #include -#include #include #include @@ -24,32 +23,6 @@ struct obj; struct obj * obj_init(void); -/* - * mempool - */ -struct mempool_params { - uint32_t buffer_size; - uint32_t pool_size; - uint32_t cache_size; - uint32_t cpu_id; -}; - -struct mempool { - TAILQ_ENTRY(mempool) node; - char name[NAME_SIZE]; - struct rte_mempool *m; - uint32_t buffer_size; -}; - -struct mempool * -mempool_create(struct obj *obj, - const char *name, - struct mempool_params *params); - -struct mempool * -mempool_find(struct obj *obj, - const char *name); - /* * link */ -- 2.34.1