From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-BY2-obe.outbound.protection.outlook.com (mail-by2nam03on0049.outbound.protection.outlook.com [104.47.42.49]) by dpdk.org (Postfix) with ESMTP id 2C0388E01 for ; Tue, 2 Jan 2018 10:53:42 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=N7O0T1tGM70kzCWBzOrKeprq2ES4v5AZWwZvVP7pEFA=; b=RK82N9/0oi51qZdeQQuN19+891HuEczbbWavMPzjnuDgLvwBXCKe1sXFdOT1unRvRlZmTWBp8mMMOMnPuAiMfIDAONRNQzJbt7v/ftOpR+qtIQ/U2E4g8vWGeWS6rqpZqR0mW4J/IXAqjTsaRu7swi3fhLjGi3bTzO0eECfbU3Y= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Pavan.Bhagavatula@cavium.com; Received: from Pavan-LT.caveonetworks.com (111.93.218.67) by DM5PR07MB3468.namprd07.prod.outlook.com (10.164.153.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.366.8; Tue, 2 Jan 2018 09:53:38 +0000 From: Pavan Nikhilesh To: bruce.richardson@intel.com, pablo.de.lara.guarch@intel.com, stephen@networkplumber.org Cc: dev@dpdk.org, Pavan Nikhilesh Date: Tue, 2 Jan 2018 15:23:08 +0530 Message-Id: <20180102095308.12783-1-pbhagavatula@caviumnetworks.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20171228201906.22770-1-pbhagavatula@caviumnetworks.com> References: <20171228201906.22770-1-pbhagavatula@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [111.93.218.67] X-ClientProxiedBy: DM5PR12CA0069.namprd12.prod.outlook.com (10.175.83.159) To DM5PR07MB3468.namprd07.prod.outlook.com (10.164.153.23) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 833458b2-7a7a-4e74-41be-08d551c6b3a2 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(5600026)(4604075)(2017052603307)(7153060); SRVR:DM5PR07MB3468; X-Microsoft-Exchange-Diagnostics: 1; DM5PR07MB3468; 3:7kCEEiByWvlmClm6aWKbY1U5YAyx0fr6FKquFXMSMDpTei38ODjesPPO0lCQYvww06Ue7VLp2ihIMQkZqDF00B6mhbepSAsfrhBMz1xHSLi+/70giKV91K7s2A2nKPYMCFoaIVWoJQG+nm3Ladz4Ts4nRC8TCz8Q6lzQEXeZ83qkTKyqtPQDnCOliMh0EzJaEPIyqoklZLRqmQBfK8p0kOT2CKvJ+kbwXff32UCgLIhgemfrMVusfMieyTmk25L6; 25:i84iySR5UQzyeLSZJPuD8d1lsgSizHvKieawuq17SBmqqLY5yWqfWuSxNuKva3ihqXdgJxYGCvS1+w+4s1eCbkHEsGvIETWX3p7wmRgiQ5M2yye6x/jwxIHhrFVcIrys7JqLM3mZX1XfseJfP1zkw8j6FWIDpupIGe4gTS+tXVqvgV/hV1WFl5ikH079GpwZK8Y4DN4sCxxBUXwIRAyR6/UFVjXN9v4a/5CQ9X8/U6i37zex60ot0BYoPgi0uXPC/IE3aWBsP1SdPotQVdxFDwi7BMNRRF9nGn4weHp2x/N16+1hrpgoWkLzIk7UJftz4XVi8dtYPhpmCAggKPCT1w==; 31:TsHAJJGFAzVwuaxG670umBYkRNOzhk+m5hrZynTEXULi+PK0MgSelqvA4+7zkZv4DX8YrAbqsu3KR+O+KoyRVB4739k5Q8B9kemxZHrHmaTK2I6QPquE7asFDSMjY5+9hUTU6fVMEMptEuH1KhoJS1Hb3rkwdDe5FDEDEcRH2t+PT7RUsSD4gDUbwFlihfkCvzDu+p8wDOrrJLArc2PNCFKDvsMQhy3vsU8SGUoJfDk= X-MS-TrafficTypeDiagnostic: DM5PR07MB3468: X-Microsoft-Exchange-Diagnostics: 1; DM5PR07MB3468; 20:vX1/OGD2Q4sZ1xpdKYmdv/j2cNbGIRQg5JauOFjpbEmhI32+tQD6wrUi0HNfy2a7+1E0lftsk7MiUlhA63IVjYVqcc7f6muqnIsi0laz+7yhAigaPYznxJDlA6xWsfv7IJ/QT3TLgjzJe7XM/cp3YOYBREwl3M22E2ytJjI3FAocE9fXKx8bu1TMIeUQ9TtHPPULIchC4mK31Z23imFNN3G73JcJAh41nbmVkFL5zJCztm+0VVQEqmpV6uG6Ntubq9dkm4YSPlMCNzSPgERzUfVW1U2D9C6jwFstySHL7oVjNRr+bVxfSVjlf4iIAU8E6yEUfeT6cDgo+UGmzIQseXxQwYyEFxhhxb8OYrqhnWEjzs/qwfJBn5vXySEAPxWalDxt5BuhSr+OA5gyjCmZCfDCerUEIFcBa/PTzw+p4XGeu6WC4GtENzdl5KWDlvTVbCkbgPJ+W3Hff8a3pbwHhm8bRP90ZkBNTwJO05mveP7mQUiNbyetGtD0unGEcPTIJGYV9aw6l1miPie/HJhxCq9XZclMsppq1ym9OjoJ8Lxus2CLqf3XYF/VJFCmnVldeC52gK7KFRpLKc1O9SLiKYDZgi981jCys+Yr5Ww9IGM=; 4:gf4BbcwOwgikfU5MX22fO5+xxfnd2aq/+Z0pssN6EDm8OI4nQy87e5LpC4u3U92h2oTcQWv669uCrrs0XUVi9aA3GwYvZA+7ilYDIwg4eTERih4eG5DikBARKdTxyXwbr8KIdFhAnp0OKeevlqxHasm+2iOK2/ERQ70JMGxdWtn1897qqmmm1hca/3PdJgg+SQlaJTDVXE8JPah6QKpDm8EssChhgtym28iRN/oVojHMqdY0pNbzIuuig4ruJUq2QkepQbVyG++4h8Iz/bY/Rw== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040470)(2401047)(5005006)(8121501046)(3231023)(944501075)(93006095)(3002001)(10201501046)(6041268)(20161123558120)(20161123560045)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(6072148)(201708071742011); SRVR:DM5PR07MB3468; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:DM5PR07MB3468; X-Forefront-PRVS: 0540846A1D X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(39850400004)(376002)(396003)(346002)(366004)(39380400002)(189003)(199004)(4326008)(8676002)(72206003)(5660300001)(316002)(5009440100003)(2950100002)(53416004)(50466002)(42882006)(8936002)(51416003)(52116002)(2906002)(386003)(25786009)(6512007)(59450400001)(107886003)(76176011)(48376002)(3846002)(6666003)(81166006)(6506007)(97736004)(81156014)(36756003)(106356001)(6116002)(105586002)(47776003)(6486002)(66066001)(7736002)(16526018)(50226002)(1076002)(53936002)(68736007)(69596002)(305945005)(16586007)(478600001)(42262002); DIR:OUT; SFP:1101; SCL:1; SRVR:DM5PR07MB3468; H:Pavan-LT.caveonetworks.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM5PR07MB3468; 23:nNW53yC1/n0glmgD8H61pC4+ePjLyKAZtKsd0Vgts?= =?us-ascii?Q?6UXuFIYzAXp6vXr5fuzwkMJ12rQPm6t73w2WN2/kmcf21L2CCCrGpm8KfwQ7?= =?us-ascii?Q?bnxGi9dKLoAOAkPAdlsfBRQlcSD+IbxEw9h764GgsgUt2BMTUR0IXSSrfFzh?= =?us-ascii?Q?M1iGFoC1CIICnsWwm5Ly1NZ2D8wKB16Nb+oEeo5mx4kY6v2gvH8zIVFWVA3p?= =?us-ascii?Q?DwIkLMH5mLWtNts/n36zp2Xk+OkZluwWLlXjYvfY9v9tR+eu8AbFwDdWvkrh?= =?us-ascii?Q?7q65Z+k1WI9KV602uWJuBwQkcQdStr6E/IYi/3H3iVAWTPQ8boTM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com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Jan 2018 09:53:38.4266 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 833458b2-7a7a-4e74-41be-08d551c6b3a2 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR07MB3468 Subject: [dpdk-dev] [PATCH v2] examples/l2fwd: increase pktmbuf pool size 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: , X-List-Received-Date: Tue, 02 Jan 2018 09:53:42 -0000 Make pktmbuf pool size a function of ports and lcores detected instead of using constant 8192. Signed-off-by: Pavan Nikhilesh --- v2 Changes: - used variable inplace rather than having a macro. examples/l2fwd/main.c | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/examples/l2fwd/main.c b/examples/l2fwd/main.c index e89e2e1bf..e6229955f 100644 --- a/examples/l2fwd/main.c +++ b/examples/l2fwd/main.c @@ -75,8 +75,6 @@ static int mac_updating = 1; #define RTE_LOGTYPE_L2FWD RTE_LOGTYPE_USER1 -#define NB_MBUF 8192 - #define MAX_PKT_BURST 32 #define BURST_TX_DRAIN_US 100 /* TX drain every ~100us */ #define MEMPOOL_CACHE_SIZE 256 @@ -556,6 +554,8 @@ main(int argc, char **argv) uint16_t portid, last_port; unsigned lcore_id, rx_lcore_id; unsigned nb_ports_in_mask = 0; + unsigned int nb_lcores = 0; + unsigned int nb_mbufs; /* init EAL */ ret = rte_eal_init(argc, argv); @@ -578,13 +578,6 @@ main(int argc, char **argv) /* convert to number of cycles */ timer_period *= rte_get_timer_hz(); - /* 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()); - if (l2fwd_pktmbuf_pool == NULL) - rte_exit(EXIT_FAILURE, "Cannot init mbuf pool\n"); - nb_ports = rte_eth_dev_count(); if (nb_ports == 0) rte_exit(EXIT_FAILURE, "No Ethernet ports - bye\n"); @@ -636,9 +629,11 @@ main(int argc, char **argv) rte_exit(EXIT_FAILURE, "Not enough cores\n"); } - if (qconf != &lcore_queue_conf[rx_lcore_id]) + if (qconf != &lcore_queue_conf[rx_lcore_id]) { /* Assigned a new logical core in the loop above. */ qconf = &lcore_queue_conf[rx_lcore_id]; + nb_lcores++; + } qconf->rx_port_list[qconf->n_rx_port] = portid; qconf->n_rx_port++; @@ -647,6 +642,16 @@ main(int argc, char **argv) nb_ports_available = nb_ports; + nb_mbufs = RTE_MAX(nb_ports * (nb_rxd + nb_txd + MAX_PKT_BURST + + nb_lcores * MEMPOOL_CACHE_SIZE), 8192U); + + /* create the mbuf pool */ + l2fwd_pktmbuf_pool = rte_pktmbuf_pool_create("mbuf_pool", nb_mbufs, + MEMPOOL_CACHE_SIZE, 0, RTE_MBUF_DEFAULT_BUF_SIZE, + rte_socket_id()); + if (l2fwd_pktmbuf_pool == NULL) + rte_exit(EXIT_FAILURE, "Cannot init mbuf pool\n"); + /* Initialise each port */ for (portid = 0; portid < nb_ports; portid++) { /* skip ports that are not enabled */ -- 2.15.1