From mboxrd@z Thu Jan 1 00:00:00 1970 From: Olivier Matz Subject: [RFC 1/7] mbuf: set the handler at mbuf pool creation Date: Mon, 19 Sep 2016 15:42:41 +0200 Message-ID: <1474292567-21912-2-git-send-email-olivier.matz@6wind.com> References: <1474292567-21912-1-git-send-email-olivier.matz@6wind.com> Cc: jerin.jacob@caviumnetworks.com, hemant.agrawal@nxp.com, david.hunt@intel.com To: dev@dpdk.org Return-path: Received: from proxy.6wind.com (host.76.145.23.62.rev.coltfrance.com [62.23.145.76]) by dpdk.org (Postfix) with ESMTP id C6F9A2716 for ; Mon, 19 Sep 2016 15:42:59 +0200 (CEST) In-Reply-To: <1474292567-21912-1-git-send-email-olivier.matz@6wind.com> List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Add a new argument to rte_pktmbuf_pool_create() in order to specify the mempool ops (handler) to use. By default, if set to NULL, the default pool handler for mbuf will be selected (RTE_MBUF_DEFAULT_MEMPOOL_OPS). Signed-off-by: Olivier Matz --- app/pdump/main.c | 2 +- app/test-pipeline/init.c | 3 ++- app/test-pmd/testpmd.c | 3 ++- app/test/test_cryptodev.c | 2 +- app/test/test_cryptodev_perf.c | 2 +- app/test/test_distributor.c | 2 +- app/test/test_distributor_perf.c | 2 +- app/test/test_kni.c | 2 +- app/test/test_link_bonding.c | 2 +- app/test/test_link_bonding_mode4.c | 2 +- app/test/test_mbuf.c | 6 ++--- app/test/test_pmd_perf.c | 3 ++- app/test/test_pmd_ring.c | 2 +- app/test/test_reorder.c | 2 +- app/test/test_sched.c | 2 +- app/test/test_table.c | 2 +- drivers/net/bonding/rte_eth_bond_alb.c | 2 +- examples/bond/main.c | 2 +- examples/distributor/main.c | 2 +- examples/dpdk_qat/main.c | 3 ++- examples/ethtool/ethtool-app/main.c | 4 ++-- examples/exception_path/main.c | 3 ++- examples/ip_fragmentation/main.c | 4 ++-- examples/ipsec-secgw/ipsec-secgw.c | 2 +- examples/ipv4_multicast/main.c | 6 ++--- examples/kni/main.c | 2 +- examples/l2fwd-cat/l2fwd-cat.c | 3 ++- examples/l2fwd-crypto/main.c | 2 +- examples/l2fwd-jobstats/main.c | 2 +- examples/l2fwd-keepalive/main.c | 2 +- examples/l2fwd/main.c | 2 +- examples/l3fwd-acl/main.c | 2 +- examples/l3fwd-power/main.c | 2 +- examples/l3fwd-vf/main.c | 2 +- examples/l3fwd/main.c | 3 ++- examples/link_status_interrupt/main.c | 2 +- examples/load_balancer/init.c | 2 +- .../client_server_mp/mp_server/init.c | 3 ++- examples/multi_process/symmetric_mp/main.c | 2 +- examples/netmap_compat/bridge/bridge.c | 2 +- examples/packet_ordering/main.c | 2 +- examples/performance-thread/l3fwd-thread/main.c | 2 +- examples/ptpclient/ptpclient.c | 3 ++- examples/qos_meter/main.c | 2 +- examples/qos_sched/init.c | 2 +- examples/quota_watermark/qw/main.c | 2 +- examples/rxtx_callbacks/main.c | 2 +- examples/skeleton/basicfwd.c | 3 ++- examples/vhost/main.c | 2 +- examples/vhost_xen/main.c | 2 +- examples/vmdq/main.c | 2 +- examples/vmdq_dcb/main.c | 2 +- lib/librte_mbuf/rte_mbuf.c | 27 ++++++++++++++++++---- lib/librte_mbuf/rte_mbuf.h | 15 ++++++++++++ lib/librte_mbuf/rte_mbuf_version.map | 7 ++++++ 55 files changed, 113 insertions(+), 62 deletions(-) diff --git a/app/pdump/main.c b/app/pdump/main.c index f3ef181..d3b83aa 100644 --- a/app/pdump/main.c +++ b/app/pdump/main.c @@ -641,7 +641,7 @@ create_mp_ring_vdev(void) pt->total_num_mbufs, MBUF_POOL_CACHE_SIZE, 0, pt->mbuf_data_size, - rte_socket_id()); + rte_socket_id(), NULL); if (mbuf_pool == NULL) { cleanup_rings(); rte_exit(EXIT_FAILURE, diff --git a/app/test-pipeline/init.c b/app/test-pipeline/init.c index aef082f..d2dd190 100644 --- a/app/test-pipeline/init.c +++ b/app/test-pipeline/init.c @@ -144,7 +144,8 @@ app_init_mbuf_pools(void) /* Init the buffer pool */ RTE_LOG(INFO, USER1, "Creating the mbuf pool ...\n"); app.pool = rte_pktmbuf_pool_create("mempool", app.pool_size, - app.pool_cache_size, 0, app.pool_buffer_size, rte_socket_id()); + app.pool_cache_size, 0, app.pool_buffer_size, rte_socket_id(), + NULL); if (app.pool == NULL) rte_panic("Cannot create mbuf pool\n"); } diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index 30749a4..cc3d2d0 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -453,7 +453,8 @@ mbuf_pool_create(uint16_t mbuf_seg_size, unsigned nb_mbuf, } else { /* wrapper to rte_mempool_create() */ rte_mp = rte_pktmbuf_pool_create(pool_name, nb_mbuf, - mb_mempool_cache, 0, mbuf_seg_size, socket_id); + mb_mempool_cache, 0, mbuf_seg_size, socket_id, + NULL); } } diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c index 647787d..b36116f 100644 --- a/app/test/test_cryptodev.c +++ b/app/test/test_cryptodev.c @@ -160,7 +160,7 @@ testsuite_setup(void) ts_params->mbuf_pool = rte_pktmbuf_pool_create( "CRYPTO_MBUFPOOL", NUM_MBUFS, MBUF_CACHE_SIZE, 0, MBUF_SIZE, - rte_socket_id()); + rte_socket_id(), NULL); if (ts_params->mbuf_pool == NULL) { RTE_LOG(ERR, USER1, "Can't create CRYPTO_MBUFPOOL\n"); return TEST_FAILED; diff --git a/app/test/test_cryptodev_perf.c b/app/test/test_cryptodev_perf.c index 2398d84..b77b09b 100644 --- a/app/test/test_cryptodev_perf.c +++ b/app/test/test_cryptodev_perf.c @@ -224,7 +224,7 @@ testsuite_setup(void) ts_params->mbuf_mp = rte_pktmbuf_pool_create( "CRYPTO_PERF_MBUFPOOL", NUM_MBUFS, MBUF_CACHE_SIZE, 0, MBUF_SIZE, - rte_socket_id()); + rte_socket_id(), NULL); if (ts_params->mbuf_mp == NULL) { RTE_LOG(ERR, USER1, "Can't create CRYPTO_PERF_MBUFPOOL\n"); return TEST_FAILED; diff --git a/app/test/test_distributor.c b/app/test/test_distributor.c index 85cb8f3..a2bacb1 100644 --- a/app/test/test_distributor.c +++ b/app/test/test_distributor.c @@ -529,7 +529,7 @@ test_distributor(void) (BIG_BATCH * 2) - 1 : (511 * rte_lcore_count()); if (p == NULL) { p = rte_pktmbuf_pool_create("DT_MBUF_POOL", nb_bufs, BURST, - 0, RTE_MBUF_DEFAULT_BUF_SIZE, rte_socket_id()); + 0, RTE_MBUF_DEFAULT_BUF_SIZE, rte_socket_id(), NULL); if (p == NULL) { printf("Error creating mempool\n"); return -1; diff --git a/app/test/test_distributor_perf.c b/app/test/test_distributor_perf.c index 7947fe9..3a0755b 100644 --- a/app/test/test_distributor_perf.c +++ b/app/test/test_distributor_perf.c @@ -242,7 +242,7 @@ test_distributor_perf(void) (BIG_BATCH * 2) - 1 : (511 * rte_lcore_count()); if (p == NULL) { p = rte_pktmbuf_pool_create("DPT_MBUF_POOL", nb_bufs, BURST, - 0, RTE_MBUF_DEFAULT_BUF_SIZE, rte_socket_id()); + 0, RTE_MBUF_DEFAULT_BUF_SIZE, rte_socket_id(), NULL); if (p == NULL) { printf("Error creating mempool\n"); return -1; diff --git a/app/test/test_kni.c b/app/test/test_kni.c index 309741c..6d25ffd 100644 --- a/app/test/test_kni.c +++ b/app/test/test_kni.c @@ -120,7 +120,7 @@ test_kni_create_mempool(void) mp = rte_pktmbuf_pool_create("kni_mempool", NB_MBUF, MEMPOOL_CACHE_SZ, 0, MBUF_DATA_SZ, - SOCKET); + SOCKET, NULL); return mp; } diff --git a/app/test/test_link_bonding.c b/app/test/test_link_bonding.c index 3229660..9f864a5 100644 --- a/app/test/test_link_bonding.c +++ b/app/test/test_link_bonding.c @@ -279,7 +279,7 @@ test_setup(void) if (test_params->mbuf_pool == NULL) { test_params->mbuf_pool = rte_pktmbuf_pool_create("MBUF_POOL", nb_mbuf_per_pool, MBUF_CACHE_SIZE, 0, - RTE_MBUF_DEFAULT_BUF_SIZE, rte_socket_id()); + RTE_MBUF_DEFAULT_BUF_SIZE, rte_socket_id(), NULL); TEST_ASSERT_NOT_NULL(test_params->mbuf_pool, "rte_mempool_create failed"); } diff --git a/app/test/test_link_bonding_mode4.c b/app/test/test_link_bonding_mode4.c index 53caa3e..8dc23c9 100644 --- a/app/test/test_link_bonding_mode4.c +++ b/app/test/test_link_bonding_mode4.c @@ -416,7 +416,7 @@ test_setup(void) TEST_TX_DESC_MAX + MAX_PKT_BURST; test_params.mbuf_pool = rte_pktmbuf_pool_create("TEST_MODE4", nb_mbuf_per_pool, MBUF_CACHE_SIZE, 0, - RTE_MBUF_DEFAULT_BUF_SIZE, socket_id); + RTE_MBUF_DEFAULT_BUF_SIZE, socket_id, NULL); TEST_ASSERT(test_params.mbuf_pool != NULL, "rte_mempool_create failed\n"); diff --git a/app/test/test_mbuf.c b/app/test/test_mbuf.c index c0823ea..016f621 100644 --- a/app/test/test_mbuf.c +++ b/app/test/test_mbuf.c @@ -801,7 +801,7 @@ test_refcnt_mbuf(void) (refcnt_pool = rte_pktmbuf_pool_create( MAKE_STRING(refcnt_pool), REFCNT_MBUF_NUM, 0, 0, 0, - SOCKET_ID_ANY)) == NULL) { + SOCKET_ID_ANY, NULL)) == NULL) { printf("%s: cannot allocate " MAKE_STRING(refcnt_pool) "\n", __func__); return -1; @@ -939,7 +939,7 @@ test_mbuf(void) /* create pktmbuf pool if it does not exist */ if (pktmbuf_pool == NULL) { pktmbuf_pool = rte_pktmbuf_pool_create("test_pktmbuf_pool", - NB_MBUF, 32, 0, MBUF_DATA_SIZE, SOCKET_ID_ANY); + NB_MBUF, 32, 0, MBUF_DATA_SIZE, SOCKET_ID_ANY, NULL); } if (pktmbuf_pool == NULL) { @@ -951,7 +951,7 @@ test_mbuf(void) * room size */ if (pktmbuf_pool2 == NULL) { pktmbuf_pool2 = rte_pktmbuf_pool_create("test_pktmbuf_pool2", - NB_MBUF, 32, MBUF2_PRIV_SIZE, 0, SOCKET_ID_ANY); + NB_MBUF, 32, MBUF2_PRIV_SIZE, 0, SOCKET_ID_ANY, NULL); } if (pktmbuf_pool2 == NULL) { diff --git a/app/test/test_pmd_perf.c b/app/test/test_pmd_perf.c index e055aa0..8b6b629 100644 --- a/app/test/test_pmd_perf.c +++ b/app/test/test_pmd_perf.c @@ -290,7 +290,8 @@ init_mbufpool(unsigned nb_mbuf) mbufpool[socketid] = rte_pktmbuf_pool_create(s, nb_mbuf, MEMPOOL_CACHE_SIZE, 0, - RTE_MBUF_DEFAULT_BUF_SIZE, socketid); + RTE_MBUF_DEFAULT_BUF_SIZE, socketid, + NULL); if (mbufpool[socketid] == NULL) rte_exit(EXIT_FAILURE, "Cannot init mbuf pool on socket %d\n", diff --git a/app/test/test_pmd_ring.c b/app/test/test_pmd_ring.c index 47374db..f92c1d4 100644 --- a/app/test/test_pmd_ring.c +++ b/app/test/test_pmd_ring.c @@ -464,7 +464,7 @@ test_pmd_ring(void) } mp = rte_pktmbuf_pool_create("mbuf_pool", NB_MBUF, 32, - 0, RTE_MBUF_DEFAULT_BUF_SIZE, rte_socket_id()); + 0, RTE_MBUF_DEFAULT_BUF_SIZE, rte_socket_id(), NULL); if (mp == NULL) return -1; diff --git a/app/test/test_reorder.c b/app/test/test_reorder.c index e8a0a2f..79e2bb6 100644 --- a/app/test/test_reorder.c +++ b/app/test/test_reorder.c @@ -353,7 +353,7 @@ test_setup(void) if (test_params->p == NULL) { test_params->p = rte_pktmbuf_pool_create("RO_MBUF_POOL", NUM_MBUFS, BURST, 0, RTE_MBUF_DEFAULT_BUF_SIZE, - rte_socket_id()); + rte_socket_id(), NULL); if (test_params->p == NULL) { printf("%s: Error creating mempool\n", __func__); return -1; diff --git a/app/test/test_sched.c b/app/test/test_sched.c index 63ab084..8e237f9 100644 --- a/app/test/test_sched.c +++ b/app/test/test_sched.c @@ -99,7 +99,7 @@ create_mempool(void) mp = rte_mempool_lookup("test_sched"); if (!mp) mp = rte_pktmbuf_pool_create("test_sched", NB_MBUF, - MEMPOOL_CACHE_SZ, 0, MBUF_DATA_SZ, SOCKET); + MEMPOOL_CACHE_SZ, 0, MBUF_DATA_SZ, SOCKET, NULL); return mp; } diff --git a/app/test/test_table.c b/app/test/test_table.c index 1faa0a6..f2a9976 100644 --- a/app/test/test_table.c +++ b/app/test/test_table.c @@ -93,7 +93,7 @@ app_init_mbuf_pools(void) "mempool", POOL_SIZE, POOL_CACHE_SIZE, 0, POOL_BUFFER_SIZE, - 0); + 0, NULL); if (pool == NULL) rte_panic("Cannot create mbuf pool\n"); } diff --git a/drivers/net/bonding/rte_eth_bond_alb.c b/drivers/net/bonding/rte_eth_bond_alb.c index 38f5c4d..e11a3bd 100644 --- a/drivers/net/bonding/rte_eth_bond_alb.c +++ b/drivers/net/bonding/rte_eth_bond_alb.c @@ -85,7 +85,7 @@ bond_mode_alb_enable(struct rte_eth_dev *bond_dev) 512 * RTE_MAX_ETHPORTS, RTE_MEMPOOL_CACHE_MAX_SIZE >= 32 ? 32 : RTE_MEMPOOL_CACHE_MAX_SIZE, - 0, data_size, socket_id); + 0, data_size, socket_id, NULL); if (internals->mode6.mempool == NULL) { RTE_LOG(ERR, PMD, "%s: Failed to initialize ALB mempool.\n", diff --git a/examples/bond/main.c b/examples/bond/main.c index 6402c6b..9061092 100644 --- a/examples/bond/main.c +++ b/examples/bond/main.c @@ -746,7 +746,7 @@ main(int argc, char *argv[]) rte_exit(EXIT_FAILURE, "You can have max 4 ports\n"); mbuf_pool = rte_pktmbuf_pool_create("MBUF_POOL", NB_MBUF, 32, - 0, RTE_MBUF_DEFAULT_BUF_SIZE, rte_socket_id()); + 0, RTE_MBUF_DEFAULT_BUF_SIZE, rte_socket_id(), NULL); if (mbuf_pool == NULL) rte_exit(EXIT_FAILURE, "Cannot create mbuf pool\n"); diff --git a/examples/distributor/main.c b/examples/distributor/main.c index 537cee1..ed78dd8 100644 --- a/examples/distributor/main.c +++ b/examples/distributor/main.c @@ -534,7 +534,7 @@ main(int argc, char *argv[]) mbuf_pool = rte_pktmbuf_pool_create("MBUF_POOL", NUM_MBUFS * nb_ports, MBUF_CACHE_SIZE, 0, - RTE_MBUF_DEFAULT_BUF_SIZE, rte_socket_id()); + RTE_MBUF_DEFAULT_BUF_SIZE, rte_socket_id(), NULL); if (mbuf_pool == NULL) rte_exit(EXIT_FAILURE, "Cannot create mbuf pool\n"); nb_ports_available = nb_ports; diff --git a/examples/dpdk_qat/main.c b/examples/dpdk_qat/main.c index aa9b1d5..d18076f 100644 --- a/examples/dpdk_qat/main.c +++ b/examples/dpdk_qat/main.c @@ -612,7 +612,8 @@ init_mem(void) snprintf(s, sizeof(s), "mbuf_pool_%d", socketid); pktmbuf_pool[socketid] = rte_pktmbuf_pool_create(s, NB_MBUF, 32, 0, - RTE_MBUF_DEFAULT_BUF_SIZE, socketid); + RTE_MBUF_DEFAULT_BUF_SIZE, socketid, + NULL); if (pktmbuf_pool[socketid] == NULL) { printf("Cannot init mbuf pool on socket %d\n", socketid); return -1; diff --git a/examples/ethtool/ethtool-app/main.c b/examples/ethtool/ethtool-app/main.c index 2c655d8..6f64729 100644 --- a/examples/ethtool/ethtool-app/main.c +++ b/examples/ethtool/ethtool-app/main.c @@ -139,8 +139,8 @@ static void setup_ports(struct app_config *app_cfg, int cnt_ports) size_pktpool, PKTPOOL_CACHE, 0, RTE_MBUF_DEFAULT_BUF_SIZE, - rte_socket_id() - ); + rte_socket_id(), + NULL); if (ptr_port->pkt_pool == NULL) rte_exit(EXIT_FAILURE, "rte_pktmbuf_pool_create failed" diff --git a/examples/exception_path/main.c b/examples/exception_path/main.c index 73d50b6..c53f034 100644 --- a/examples/exception_path/main.c +++ b/examples/exception_path/main.c @@ -530,7 +530,8 @@ main(int argc, char** argv) /* Create the mbuf pool */ pktmbuf_pool = rte_pktmbuf_pool_create("mbuf_pool", NB_MBUF, - MEMPOOL_CACHE_SZ, 0, MBUF_DATA_SZ, rte_socket_id()); + MEMPOOL_CACHE_SZ, 0, MBUF_DATA_SZ, rte_socket_id(), + NULL); if (pktmbuf_pool == NULL) { FATAL_ERROR("Could not initialise mbuf pool"); return -1; diff --git a/examples/ip_fragmentation/main.c b/examples/ip_fragmentation/main.c index e1e32c6..657c9da 100644 --- a/examples/ip_fragmentation/main.c +++ b/examples/ip_fragmentation/main.c @@ -742,7 +742,7 @@ init_mem(void) snprintf(buf, sizeof(buf), "pool_direct_%i", socket); mp = rte_pktmbuf_pool_create(buf, NB_MBUF, 32, - 0, RTE_MBUF_DEFAULT_BUF_SIZE, socket); + 0, RTE_MBUF_DEFAULT_BUF_SIZE, socket, NULL); if (mp == NULL) { RTE_LOG(ERR, IP_FRAG, "Cannot create direct mempool\n"); return -1; @@ -756,7 +756,7 @@ init_mem(void) snprintf(buf, sizeof(buf), "pool_indirect_%i", socket); mp = rte_pktmbuf_pool_create(buf, NB_MBUF, 32, 0, 0, - socket); + socket, NULL); if (mp == NULL) { RTE_LOG(ERR, IP_FRAG, "Cannot create indirect mempool\n"); return -1; diff --git a/examples/ipsec-secgw/ipsec-secgw.c b/examples/ipsec-secgw/ipsec-secgw.c index 5d04eb3..462939e 100644 --- a/examples/ipsec-secgw/ipsec-secgw.c +++ b/examples/ipsec-secgw/ipsec-secgw.c @@ -1384,7 +1384,7 @@ pool_init(struct socket_ctx *ctx, int32_t socket_id, uint32_t nb_mbuf) ctx->mbuf_pool = rte_pktmbuf_pool_create(s, nb_mbuf, MEMPOOL_CACHE_SIZE, ipsec_metadata_size(), RTE_MBUF_DEFAULT_BUF_SIZE, - socket_id); + socket_id, NULL); if (ctx->mbuf_pool == NULL) rte_exit(EXIT_FAILURE, "Cannot init mbuf pool on socket %d\n", socket_id); diff --git a/examples/ipv4_multicast/main.c b/examples/ipv4_multicast/main.c index 708d76e..f28c55d 100644 --- a/examples/ipv4_multicast/main.c +++ b/examples/ipv4_multicast/main.c @@ -690,19 +690,19 @@ main(int argc, char **argv) /* create the mbuf pools */ packet_pool = rte_pktmbuf_pool_create("packet_pool", NB_PKT_MBUF, 32, - 0, PKT_MBUF_DATA_SIZE, rte_socket_id()); + 0, PKT_MBUF_DATA_SIZE, rte_socket_id(), NULL); if (packet_pool == NULL) rte_exit(EXIT_FAILURE, "Cannot init packet mbuf pool\n"); header_pool = rte_pktmbuf_pool_create("header_pool", NB_HDR_MBUF, 32, - 0, HDR_MBUF_DATA_SIZE, rte_socket_id()); + 0, HDR_MBUF_DATA_SIZE, rte_socket_id(), NULL); if (header_pool == NULL) rte_exit(EXIT_FAILURE, "Cannot init header mbuf pool\n"); clone_pool = rte_pktmbuf_pool_create("clone_pool", NB_CLONE_MBUF, 32, - 0, 0, rte_socket_id()); + 0, 0, rte_socket_id(), NULL); if (clone_pool == NULL) rte_exit(EXIT_FAILURE, "Cannot init clone mbuf pool\n"); diff --git a/examples/kni/main.c b/examples/kni/main.c index 57313d1..edae0bd 100644 --- a/examples/kni/main.c +++ b/examples/kni/main.c @@ -865,7 +865,7 @@ main(int argc, char** argv) /* Create the mbuf pool */ pktmbuf_pool = rte_pktmbuf_pool_create("mbuf_pool", NB_MBUF, - MEMPOOL_CACHE_SZ, 0, MBUF_DATA_SZ, rte_socket_id()); + MEMPOOL_CACHE_SZ, 0, MBUF_DATA_SZ, rte_socket_id(), NULL); if (pktmbuf_pool == NULL) { rte_exit(EXIT_FAILURE, "Could not initialise mbuf pool\n"); return -1; diff --git a/examples/l2fwd-cat/l2fwd-cat.c b/examples/l2fwd-cat/l2fwd-cat.c index 8cce33b..bc2bf9b 100644 --- a/examples/l2fwd-cat/l2fwd-cat.c +++ b/examples/l2fwd-cat/l2fwd-cat.c @@ -203,7 +203,8 @@ main(int argc, char *argv[]) /* Creates a new mempool in memory to hold the mbufs. */ mbuf_pool = rte_pktmbuf_pool_create("MBUF_POOL", NUM_MBUFS * nb_ports, - MBUF_CACHE_SIZE, 0, RTE_MBUF_DEFAULT_BUF_SIZE, rte_socket_id()); + MBUF_CACHE_SIZE, 0, RTE_MBUF_DEFAULT_BUF_SIZE, rte_socket_id(), + NULL); if (mbuf_pool == NULL) rte_exit(EXIT_FAILURE, "Cannot create mbuf pool\n"); diff --git a/examples/l2fwd-crypto/main.c b/examples/l2fwd-crypto/main.c index ffce5f3..05cd7f3 100644 --- a/examples/l2fwd-crypto/main.c +++ b/examples/l2fwd-crypto/main.c @@ -1972,7 +1972,7 @@ main(int argc, char **argv) /* create the mbuf pool */ l2fwd_pktmbuf_pool = rte_pktmbuf_pool_create("mbuf_pool", NB_MBUF, 512, sizeof(struct rte_crypto_op), - RTE_MBUF_DEFAULT_BUF_SIZE, rte_socket_id()); + RTE_MBUF_DEFAULT_BUF_SIZE, rte_socket_id(), NULL); if (l2fwd_pktmbuf_pool == NULL) rte_exit(EXIT_FAILURE, "Cannot create mbuf pool\n"); diff --git a/examples/l2fwd-jobstats/main.c b/examples/l2fwd-jobstats/main.c index dd9201b..ff24c65 100644 --- a/examples/l2fwd-jobstats/main.c +++ b/examples/l2fwd-jobstats/main.c @@ -802,7 +802,7 @@ main(int argc, char **argv) /* create the mbuf pool */ l2fwd_pktmbuf_pool = rte_pktmbuf_pool_create("mbuf_pool", NB_MBUF, 32, - 0, RTE_MBUF_DEFAULT_BUF_SIZE, rte_socket_id()); + 0, RTE_MBUF_DEFAULT_BUF_SIZE, rte_socket_id(), NULL); if (l2fwd_pktmbuf_pool == NULL) rte_exit(EXIT_FAILURE, "Cannot init mbuf pool\n"); diff --git a/examples/l2fwd-keepalive/main.c b/examples/l2fwd-keepalive/main.c index 60cccdb..8ab99e5 100644 --- a/examples/l2fwd-keepalive/main.c +++ b/examples/l2fwd-keepalive/main.c @@ -571,7 +571,7 @@ main(int argc, char **argv) /* create the mbuf pool */ l2fwd_pktmbuf_pool = rte_pktmbuf_pool_create("mbuf_pool", NB_MBUF, 32, - 0, RTE_MBUF_DEFAULT_BUF_SIZE, rte_socket_id()); + 0, RTE_MBUF_DEFAULT_BUF_SIZE, rte_socket_id(), NULL); if (l2fwd_pktmbuf_pool == NULL) rte_exit(EXIT_FAILURE, "Cannot init mbuf pool\n"); diff --git a/examples/l2fwd/main.c b/examples/l2fwd/main.c index 3827aa4..41ac1e1 100644 --- a/examples/l2fwd/main.c +++ b/examples/l2fwd/main.c @@ -547,7 +547,7 @@ main(int argc, char **argv) /* create the mbuf pool */ l2fwd_pktmbuf_pool = rte_pktmbuf_pool_create("mbuf_pool", NB_MBUF, MEMPOOL_CACHE_SIZE, 0, RTE_MBUF_DEFAULT_BUF_SIZE, - rte_socket_id()); + rte_socket_id(), NULL); if (l2fwd_pktmbuf_pool == NULL) rte_exit(EXIT_FAILURE, "Cannot init mbuf pool\n"); diff --git a/examples/l3fwd-acl/main.c b/examples/l3fwd-acl/main.c index 3cfbb40..080f3dd 100644 --- a/examples/l3fwd-acl/main.c +++ b/examples/l3fwd-acl/main.c @@ -1815,7 +1815,7 @@ init_mem(unsigned nb_mbuf) rte_pktmbuf_pool_create(s, nb_mbuf, MEMPOOL_CACHE_SIZE, 0, RTE_MBUF_DEFAULT_BUF_SIZE, - socketid); + socketid, NULL); if (pktmbuf_pool[socketid] == NULL) rte_exit(EXIT_FAILURE, "Cannot init mbuf pool on socket %d\n", diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c index b65d683..e3f98ed 100644 --- a/examples/l3fwd-power/main.c +++ b/examples/l3fwd-power/main.c @@ -1452,7 +1452,7 @@ init_mem(unsigned nb_mbuf) rte_pktmbuf_pool_create(s, nb_mbuf, MEMPOOL_CACHE_SIZE, 0, RTE_MBUF_DEFAULT_BUF_SIZE, - socketid); + socketid, NULL); if (pktmbuf_pool[socketid] == NULL) rte_exit(EXIT_FAILURE, "Cannot init mbuf pool on socket %d\n", diff --git a/examples/l3fwd-vf/main.c b/examples/l3fwd-vf/main.c index f56e8db..f4ff35a 100644 --- a/examples/l3fwd-vf/main.c +++ b/examples/l3fwd-vf/main.c @@ -928,7 +928,7 @@ init_mem(unsigned nb_mbuf) snprintf(s, sizeof(s), "mbuf_pool_%d", socketid); pktmbuf_pool[socketid] = rte_pktmbuf_pool_create(s, nb_mbuf, MEMPOOL_CACHE_SIZE, 0, - RTE_MBUF_DEFAULT_BUF_SIZE, socketid); + RTE_MBUF_DEFAULT_BUF_SIZE, socketid, NULL); if (pktmbuf_pool[socketid] == NULL) rte_exit(EXIT_FAILURE, "Cannot init mbuf pool on socket %d\n", socketid); else diff --git a/examples/l3fwd/main.c b/examples/l3fwd/main.c index 7223e77..328bae2 100644 --- a/examples/l3fwd/main.c +++ b/examples/l3fwd/main.c @@ -723,7 +723,8 @@ init_mem(unsigned nb_mbuf) pktmbuf_pool[socketid] = rte_pktmbuf_pool_create(s, nb_mbuf, MEMPOOL_CACHE_SIZE, 0, - RTE_MBUF_DEFAULT_BUF_SIZE, socketid); + RTE_MBUF_DEFAULT_BUF_SIZE, socketid, + NULL); if (pktmbuf_pool[socketid] == NULL) rte_exit(EXIT_FAILURE, "Cannot init mbuf pool on socket %d\n", diff --git a/examples/link_status_interrupt/main.c b/examples/link_status_interrupt/main.c index 14a038b..28da420 100644 --- a/examples/link_status_interrupt/main.c +++ b/examples/link_status_interrupt/main.c @@ -571,7 +571,7 @@ main(int argc, char **argv) /* create the mbuf pool */ lsi_pktmbuf_pool = rte_pktmbuf_pool_create("mbuf_pool", NB_MBUF, 32, 0, - RTE_MBUF_DEFAULT_BUF_SIZE, rte_socket_id()); + RTE_MBUF_DEFAULT_BUF_SIZE, rte_socket_id(), NULL); if (lsi_pktmbuf_pool == NULL) rte_panic("Cannot init mbuf pool\n"); diff --git a/examples/load_balancer/init.c b/examples/load_balancer/init.c index e07850b..b541625 100644 --- a/examples/load_balancer/init.c +++ b/examples/load_balancer/init.c @@ -130,7 +130,7 @@ app_init_mbuf_pools(void) app.pools[socket] = rte_pktmbuf_pool_create( name, APP_DEFAULT_MEMPOOL_BUFFERS, APP_DEFAULT_MEMPOOL_CACHE_SIZE, - 0, APP_DEFAULT_MBUF_DATA_SIZE, socket); + 0, APP_DEFAULT_MBUF_DATA_SIZE, socket, NULL); if (app.pools[socket] == NULL) { rte_panic("Cannot create mbuf pool on socket %u\n", socket); } diff --git a/examples/multi_process/client_server_mp/mp_server/init.c b/examples/multi_process/client_server_mp/mp_server/init.c index ad941a7..0470333 100644 --- a/examples/multi_process/client_server_mp/mp_server/init.c +++ b/examples/multi_process/client_server_mp/mp_server/init.c @@ -101,7 +101,8 @@ init_mbuf_pools(void) printf("Creating mbuf pool '%s' [%u mbufs] ...\n", PKTMBUF_POOL_NAME, num_mbufs); pktmbuf_pool = rte_pktmbuf_pool_create(PKTMBUF_POOL_NAME, num_mbufs, - MBUF_CACHE_SIZE, 0, RTE_MBUF_DEFAULT_BUF_SIZE, rte_socket_id()); + MBUF_CACHE_SIZE, 0, RTE_MBUF_DEFAULT_BUF_SIZE, rte_socket_id(), + NULL); return pktmbuf_pool == NULL; /* 0 on success */ } diff --git a/examples/multi_process/symmetric_mp/main.c b/examples/multi_process/symmetric_mp/main.c index d30ff4a..56479dd 100644 --- a/examples/multi_process/symmetric_mp/main.c +++ b/examples/multi_process/symmetric_mp/main.c @@ -446,7 +446,7 @@ main(int argc, char **argv) rte_mempool_lookup(_SMP_MBUF_POOL) : rte_pktmbuf_pool_create(_SMP_MBUF_POOL, NB_MBUFS, MBUF_CACHE_SIZE, 0, RTE_MBUF_DEFAULT_BUF_SIZE, - rte_socket_id()); + rte_socket_id(), NULL); if (mp == NULL) rte_exit(EXIT_FAILURE, "Cannot get memory pool for buffers\n"); diff --git a/examples/netmap_compat/bridge/bridge.c b/examples/netmap_compat/bridge/bridge.c index 53f5fdb..b432100 100644 --- a/examples/netmap_compat/bridge/bridge.c +++ b/examples/netmap_compat/bridge/bridge.c @@ -272,7 +272,7 @@ int main(int argc, char *argv[]) rte_exit(EXIT_FAILURE, "Not enough ethernet ports available\n"); pool = rte_pktmbuf_pool_create("mbuf_pool", MBUF_PER_POOL, 32, 0, - MBUF_DATA_SIZE, rte_socket_id()); + MBUF_DATA_SIZE, rte_socket_id(), NULL); if (pool == NULL) rte_exit(EXIT_FAILURE, "Couldn't create mempool\n"); diff --git a/examples/packet_ordering/main.c b/examples/packet_ordering/main.c index 3c88b86..7657aaa 100644 --- a/examples/packet_ordering/main.c +++ b/examples/packet_ordering/main.c @@ -665,7 +665,7 @@ main(int argc, char **argv) mbuf_pool = rte_pktmbuf_pool_create("mbuf_pool", MBUF_PER_POOL, MBUF_POOL_CACHE_SIZE, 0, RTE_MBUF_DEFAULT_BUF_SIZE, - rte_socket_id()); + rte_socket_id(), NULL); if (mbuf_pool == NULL) rte_exit(EXIT_FAILURE, "%s\n", rte_strerror(rte_errno)); diff --git a/examples/performance-thread/l3fwd-thread/main.c b/examples/performance-thread/l3fwd-thread/main.c index fdc90b2..93fd866 100644 --- a/examples/performance-thread/l3fwd-thread/main.c +++ b/examples/performance-thread/l3fwd-thread/main.c @@ -3359,7 +3359,7 @@ init_mem(unsigned nb_mbuf) pktmbuf_pool[socketid] = rte_pktmbuf_pool_create(s, nb_mbuf, MEMPOOL_CACHE_SIZE, 0, - RTE_MBUF_DEFAULT_BUF_SIZE, socketid); + RTE_MBUF_DEFAULT_BUF_SIZE, socketid, NULL); if (pktmbuf_pool[socketid] == NULL) rte_exit(EXIT_FAILURE, "Cannot init mbuf pool on socket %d\n", socketid); diff --git a/examples/ptpclient/ptpclient.c b/examples/ptpclient/ptpclient.c index 0af4f3b..25603dc 100644 --- a/examples/ptpclient/ptpclient.c +++ b/examples/ptpclient/ptpclient.c @@ -744,7 +744,8 @@ main(int argc, char *argv[]) /* Creates a new mempool in memory to hold the mbufs. */ mbuf_pool = rte_pktmbuf_pool_create("MBUF_POOL", NUM_MBUFS * nb_ports, - MBUF_CACHE_SIZE, 0, RTE_MBUF_DEFAULT_BUF_SIZE, rte_socket_id()); + MBUF_CACHE_SIZE, 0, RTE_MBUF_DEFAULT_BUF_SIZE, rte_socket_id(), + NULL); if (mbuf_pool == NULL) rte_exit(EXIT_FAILURE, "Cannot create mbuf pool\n"); diff --git a/examples/qos_meter/main.c b/examples/qos_meter/main.c index 1565615..ec4a7d4 100644 --- a/examples/qos_meter/main.c +++ b/examples/qos_meter/main.c @@ -328,7 +328,7 @@ main(int argc, char **argv) /* Buffer pool init */ pool = rte_pktmbuf_pool_create("pool", NB_MBUF, MEMPOOL_CACHE_SIZE, - 0, RTE_MBUF_DEFAULT_BUF_SIZE, rte_socket_id()); + 0, RTE_MBUF_DEFAULT_BUF_SIZE, rte_socket_id(), NULL); if (pool == NULL) rte_exit(EXIT_FAILURE, "Buffer pool creation error\n"); diff --git a/examples/qos_sched/init.c b/examples/qos_sched/init.c index 70e12bb..2b89470 100644 --- a/examples/qos_sched/init.c +++ b/examples/qos_sched/init.c @@ -338,7 +338,7 @@ int app_init(void) qos_conf[i].mbuf_pool = rte_pktmbuf_pool_create(pool_name, mp_size, burst_conf.rx_burst * 4, 0, RTE_MBUF_DEFAULT_BUF_SIZE, - rte_eth_dev_socket_id(qos_conf[i].rx_port)); + rte_eth_dev_socket_id(qos_conf[i].rx_port), NULL); if (qos_conf[i].mbuf_pool == NULL) rte_exit(EXIT_FAILURE, "Cannot init mbuf pool for socket %u\n", i); diff --git a/examples/quota_watermark/qw/main.c b/examples/quota_watermark/qw/main.c index 8ed0214..6031d50 100644 --- a/examples/quota_watermark/qw/main.c +++ b/examples/quota_watermark/qw/main.c @@ -336,7 +336,7 @@ main(int argc, char **argv) /* Create a pool of mbuf to store packets */ mbuf_pool = rte_pktmbuf_pool_create("mbuf_pool", MBUF_PER_POOL, 32, 0, - MBUF_DATA_SIZE, rte_socket_id()); + MBUF_DATA_SIZE, rte_socket_id(), NULL); if (mbuf_pool == NULL) rte_panic("%s\n", rte_strerror(rte_errno)); diff --git a/examples/rxtx_callbacks/main.c b/examples/rxtx_callbacks/main.c index 048b23f..22c280c 100644 --- a/examples/rxtx_callbacks/main.c +++ b/examples/rxtx_callbacks/main.c @@ -205,7 +205,7 @@ main(int argc, char *argv[]) mbuf_pool = rte_pktmbuf_pool_create("MBUF_POOL", NUM_MBUFS * nb_ports, MBUF_CACHE_SIZE, 0, - RTE_MBUF_DEFAULT_BUF_SIZE, rte_socket_id()); + RTE_MBUF_DEFAULT_BUF_SIZE, rte_socket_id(), NULL); if (mbuf_pool == NULL) rte_exit(EXIT_FAILURE, "Cannot create mbuf pool\n"); diff --git a/examples/skeleton/basicfwd.c b/examples/skeleton/basicfwd.c index c89822c..2acedac 100644 --- a/examples/skeleton/basicfwd.c +++ b/examples/skeleton/basicfwd.c @@ -190,7 +190,8 @@ main(int argc, char *argv[]) /* Creates a new mempool in memory to hold the mbufs. */ mbuf_pool = rte_pktmbuf_pool_create("MBUF_POOL", NUM_MBUFS * nb_ports, - MBUF_CACHE_SIZE, 0, RTE_MBUF_DEFAULT_BUF_SIZE, rte_socket_id()); + MBUF_CACHE_SIZE, 0, RTE_MBUF_DEFAULT_BUF_SIZE, rte_socket_id(), + NULL); if (mbuf_pool == NULL) rte_exit(EXIT_FAILURE, "Cannot create mbuf pool\n"); diff --git a/examples/vhost/main.c b/examples/vhost/main.c index 92a9823..20066e0 100644 --- a/examples/vhost/main.c +++ b/examples/vhost/main.c @@ -1397,7 +1397,7 @@ create_mbuf_pool(uint16_t nr_port, uint32_t nr_switch_core, uint32_t mbuf_size, mbuf_pool = rte_pktmbuf_pool_create("MBUF_POOL", nr_mbufs, nr_mbuf_cache, 0, mbuf_size, - rte_socket_id()); + rte_socket_id(), NULL); if (mbuf_pool == NULL) rte_exit(EXIT_FAILURE, "Cannot create mbuf pool\n"); } diff --git a/examples/vhost_xen/main.c b/examples/vhost_xen/main.c index 2e40357..af2604f 100644 --- a/examples/vhost_xen/main.c +++ b/examples/vhost_xen/main.c @@ -1461,7 +1461,7 @@ main(int argc, char *argv[]) /* Create the mbuf pool. */ mbuf_pool = rte_pktmbuf_pool_create("MBUF_POOL", NUM_MBUFS_PER_PORT * valid_num_ports, MBUF_CACHE_SIZE, 0, - RTE_MBUF_DEFAULT_BUF_SIZE, rte_socket_id()); + RTE_MBUF_DEFAULT_BUF_SIZE, rte_socket_id(), NULL); if (mbuf_pool == NULL) rte_exit(EXIT_FAILURE, "Cannot create mbuf pool\n"); diff --git a/examples/vmdq/main.c b/examples/vmdq/main.c index f639355..28ee7e2 100644 --- a/examples/vmdq/main.c +++ b/examples/vmdq/main.c @@ -612,7 +612,7 @@ main(int argc, char *argv[]) mbuf_pool = rte_pktmbuf_pool_create("MBUF_POOL", NUM_MBUFS_PER_PORT * nb_ports, MBUF_CACHE_SIZE, - 0, RTE_MBUF_DEFAULT_BUF_SIZE, rte_socket_id()); + 0, RTE_MBUF_DEFAULT_BUF_SIZE, rte_socket_id(), NULL); if (mbuf_pool == NULL) rte_exit(EXIT_FAILURE, "Cannot create mbuf pool\n"); diff --git a/examples/vmdq_dcb/main.c b/examples/vmdq_dcb/main.c index 35ffffa..91d1d90 100644 --- a/examples/vmdq_dcb/main.c +++ b/examples/vmdq_dcb/main.c @@ -675,7 +675,7 @@ main(int argc, char *argv[]) mbuf_pool = rte_pktmbuf_pool_create("MBUF_POOL", NUM_MBUFS_PER_PORT * nb_ports, MBUF_CACHE_SIZE, - 0, RTE_MBUF_DEFAULT_BUF_SIZE, rte_socket_id()); + 0, RTE_MBUF_DEFAULT_BUF_SIZE, rte_socket_id(), NULL); if (mbuf_pool == NULL) rte_exit(EXIT_FAILURE, "Cannot create mbuf pool\n"); diff --git a/lib/librte_mbuf/rte_mbuf.c b/lib/librte_mbuf/rte_mbuf.c index 72f9280..3e9cbb6 100644 --- a/lib/librte_mbuf/rte_mbuf.c +++ b/lib/librte_mbuf/rte_mbuf.c @@ -58,6 +58,7 @@ #include #include #include +#include /* * ctrlmbuf constructor, given as a callback function to @@ -148,9 +149,9 @@ rte_pktmbuf_init(struct rte_mempool *mp, /* helper to create a mbuf pool */ struct rte_mempool * -rte_pktmbuf_pool_create(const char *name, unsigned n, +rte_pktmbuf_pool_create_v1611(const char *name, unsigned n, unsigned cache_size, uint16_t priv_size, uint16_t data_room_size, - int socket_id) + int socket_id, const char *mempool_ops) { struct rte_mempool *mp; struct rte_pktmbuf_pool_private mbp_priv; @@ -173,8 +174,10 @@ rte_pktmbuf_pool_create(const char *name, unsigned n, if (mp == NULL) return NULL; - ret = rte_mempool_set_ops_byname(mp, - RTE_MBUF_DEFAULT_MEMPOOL_OPS, NULL); + if (mempool_ops == NULL) + mempool_ops = RTE_MBUF_DEFAULT_MEMPOOL_OPS; + + ret = rte_mempool_set_ops_byname(mp, mempool_ops, NULL); if (ret != 0) { RTE_LOG(ERR, MBUF, "error setting mempool handler\n"); rte_mempool_free(mp); @@ -194,6 +197,22 @@ rte_pktmbuf_pool_create(const char *name, unsigned n, return mp; } +VERSION_SYMBOL(rte_pktmbuf_pool_create, _v21, 2.1); + +struct rte_mempool * +rte_pktmbuf_pool_create_v21(const char *name, unsigned n, + unsigned cache_size, uint16_t priv_size, uint16_t data_room_size, + int socket_id) +{ + return rte_pktmbuf_pool_create_v1611(name, n, cache_size, priv_size, + data_room_size, socket_id, NULL); +} +BIND_DEFAULT_SYMBOL(rte_pktmbuf_pool_create, _v1611, 16.11); +MAP_STATIC_SYMBOL(struct rte_mempool * rte_pktmbuf_pool_create(const char *name, + unsigned n, unsigned cache_size, uint16_t priv_size, + uint16_t data_room_size, int socket_id, + const char *mempool_ops), + rte_pktmbuf_pool_create_v1611); /* do some sanity checks on a mbuf: panic if it fails */ void diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h index 23b7bf8..774e071 100644 --- a/lib/librte_mbuf/rte_mbuf.h +++ b/lib/librte_mbuf/rte_mbuf.h @@ -1330,6 +1330,10 @@ void rte_pktmbuf_pool_init(struct rte_mempool *mp, void *opaque_arg); * The socket identifier where the memory should be allocated. The * value can be *SOCKET_ID_ANY* if there is no NUMA constraint for the * reserved zone. + * @param mempool_ops + * String identifying the the mempool operations to be used. If set + * to NULL, use the default mempool operations defined at compile-time + * (RTE_MBUF_DEFAULT_MEMPOOL_OPS). * @return * The pointer to the new allocated mempool, on success. NULL on error * with rte_errno set appropriately. Possible rte_errno values include: @@ -1343,8 +1347,19 @@ void rte_pktmbuf_pool_init(struct rte_mempool *mp, void *opaque_arg); struct rte_mempool * rte_pktmbuf_pool_create(const char *name, unsigned n, unsigned cache_size, uint16_t priv_size, uint16_t data_room_size, + int socket_id, const char *mempool_ops); + +struct rte_mempool * +rte_pktmbuf_pool_create_v21(const char *name, unsigned n, + unsigned cache_size, uint16_t priv_size, uint16_t data_room_size, int socket_id); +struct rte_mempool * +rte_pktmbuf_pool_create_v1611(const char *name, unsigned n, + unsigned cache_size, uint16_t priv_size, uint16_t data_room_size, + int socket_id, const char *mempool_ops); + + /** * Get the data room size of mbufs stored in a pktmbuf_pool * diff --git a/lib/librte_mbuf/rte_mbuf_version.map b/lib/librte_mbuf/rte_mbuf_version.map index e10f6bd..606509d 100644 --- a/lib/librte_mbuf/rte_mbuf_version.map +++ b/lib/librte_mbuf/rte_mbuf_version.map @@ -18,3 +18,10 @@ DPDK_2.1 { rte_pktmbuf_pool_create; } DPDK_2.0; + +DPDK_16.11 { + global: + + rte_pktmbuf_pool_create; + +} DPDK_2.1; -- 2.8.1