From patchwork Sun Apr 7 05:02:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shahaf Shuler X-Patchwork-Id: 52374 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 986854CC0; Sun, 7 Apr 2019 07:02:54 +0200 (CEST) Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by dpdk.org (Postfix) with ESMTP id 0CB582C24 for ; Sun, 7 Apr 2019 07:02:43 +0200 (CEST) Received: from Internal Mail-Server by MTLPINE1 (envelope-from shahafs@mellanox.com) with ESMTPS (AES256-SHA encrypted); 7 Apr 2019 08:02:36 +0300 Received: from unicorn01.mtl.labs.mlnx. (unicorn01.mtl.labs.mlnx [10.7.12.62]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id x3752Zb2016030; Sun, 7 Apr 2019 08:02:35 +0300 From: Shahaf Shuler To: wenzhuo.lu@intel.com, jingjing.wu@intel.com, bernard.iremonger@intel.com Cc: dev@dpdk.org, rasland@mellanox.com, thomas@monjalon.net, ferruh.yigit@intel.com Date: Sun, 7 Apr 2019 08:02:25 +0300 Message-Id: <5e08fc1a928034d0d6f44916b8357d812919f603.1554613242.git.shahafs@mellanox.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: References: Subject: [dpdk-dev] [PATCH v4 2/3] app/testpmd: support creation of no IOVA contig mempools 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" providing a command line parameter to set the mempool flags accordingly. This mode is relevant only when creating an empty mempool and then populating with memory. Signed-off-by: Shahaf Shuler Acked-by: Anatoly Burakov --- app/test-pmd/parameters.c | 13 +++++++++++++ app/test-pmd/testpmd.c | 3 ++- app/test-pmd/testpmd.h | 2 ++ doc/guides/testpmd_app_ug/run_app.rst | 5 +++++ 4 files changed, 22 insertions(+), 1 deletion(-) diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c index 7b6b60905d..7f18b3e748 100644 --- a/app/test-pmd/parameters.c +++ b/app/test-pmd/parameters.c @@ -202,6 +202,8 @@ usage(char* progname) printf(" --noisy-lkup-num-writes=N: do N random writes per packet\n"); printf(" --noisy-lkup-num-reads=N: do N random reads per packet\n"); printf(" --noisy-lkup-num-writes=N: do N random reads and writes per packet\n"); + printf(" --no-iova-contig: mempool memory can be IOVA non contiguous. " + "valid only with --mp-alloc=anon\n"); } #ifdef RTE_LIBRTE_CMDLINE @@ -651,6 +653,7 @@ launch_args_parse(int argc, char** argv) { "noisy-lkup-num-writes", 1, 0, 0 }, { "noisy-lkup-num-reads", 1, 0, 0 }, { "noisy-lkup-num-reads-writes", 1, 0, 0 }, + { "no-iova-contig", 0, 0, 0 }, { 0, 0, 0, 0 }, }; @@ -1242,6 +1245,8 @@ launch_args_parse(int argc, char** argv) rte_exit(EXIT_FAILURE, "noisy-lkup-num-reads-writes must be >= 0\n"); } + if (!strcmp(lgopts[opt_idx].name, "no-iova-contig")) + mempool_flags = MEMPOOL_F_NO_IOVA_CONTIG; break; case 'h': usage(argv[0]); @@ -1258,4 +1263,12 @@ launch_args_parse(int argc, char** argv) /* Set offload configuration from command line parameters. */ rx_mode.offloads = rx_offloads; tx_mode.offloads = tx_offloads; + + if (mempool_flags & MEMPOOL_F_NO_IOVA_CONTIG && + mp_alloc_type != MP_ALLOC_ANON) { + TESTPMD_LOG(WARNING, "cannot use no-iova-contig without " + "mp-alloc=anon. mempool no-iova-contig is " + "ignored\n"); + mempool_flags = 0; + } } diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index b7f70b0c47..3b5ef0b6c1 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -189,6 +189,7 @@ struct fwd_engine * fwd_engines[] = { }; struct rte_mempool *mempools[RTE_MAX_NUMA_NODES]; +uint16_t mempool_flags; struct fwd_config cur_fwd_config; struct fwd_engine *cur_fwd_eng = &io_fwd_engine; /**< IO mode by default. */ @@ -867,7 +868,7 @@ mbuf_pool_create(uint16_t mbuf_seg_size, unsigned nb_mbuf, rte_mp = rte_mempool_create_empty(pool_name, nb_mbuf, mb_size, (unsigned int) mb_mempool_cache, sizeof(struct rte_pktmbuf_pool_private), - socket_id, 0); + socket_id, mempool_flags); if (rte_mp == NULL) goto err; diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h index a45988ebc5..e2117e66ff 100644 --- a/app/test-pmd/testpmd.h +++ b/app/test-pmd/testpmd.h @@ -264,6 +264,8 @@ extern struct fwd_engine ieee1588_fwd_engine; extern struct fwd_engine * fwd_engines[]; /**< NULL terminated array. */ +extern uint16_t mempool_flags; + /** * Forwarding Configuration * diff --git a/doc/guides/testpmd_app_ug/run_app.rst b/doc/guides/testpmd_app_ug/run_app.rst index b717b8c7b7..7b4341647f 100644 --- a/doc/guides/testpmd_app_ug/run_app.rst +++ b/doc/guides/testpmd_app_ug/run_app.rst @@ -427,3 +427,8 @@ The commandline options are: Set the number of r/w accesses to be done in noisy neighbour simulation memory buffer to N. Only available with the noisy forwarding mode. The default value is 0. + +* ``--no-iova-contig`` + + Enable to create mempool which is not IOVA contiguous. Valid only with --mp-alloc=anon. + The default value is 0.