From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <hemant.agrawal@nxp.com>
Received: from NAM03-BY2-obe.outbound.protection.outlook.com
 (mail-by2nam03on0085.outbound.protection.outlook.com [104.47.42.85])
 by dpdk.org (Postfix) with ESMTP id 3A47DE5D
 for <dev@dpdk.org>; Wed,  6 Dec 2017 13:32:13 +0100 (CET)
Received: from MWHPR03CA0050.namprd03.prod.outlook.com (2603:10b6:301:3b::39)
 by SN2PR03MB2366.namprd03.prod.outlook.com (2603:10b6:804:e::17) with
 Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.302.9; Wed, 6 Dec
 2017 12:32:11 +0000
Received: from BY2FFO11FD028.protection.gbl (2a01:111:f400:7c0c::130) by
 MWHPR03CA0050.outlook.office365.com (2603:10b6:301:3b::39) with Microsoft
 SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id
 15.20.282.5 via Frontend Transport; Wed, 6 Dec 2017 12:32:11 +0000
Authentication-Results: spf=fail (sender IP is 192.88.168.50)
 smtp.mailfrom=nxp.com; dpdk.org; dkim=none (message not signed)
 header.d=none;dpdk.org; dmarc=fail action=none header.from=nxp.com;
Received-SPF: Fail (protection.outlook.com: domain of nxp.com does not
 designate 192.88.168.50 as permitted sender) receiver=protection.outlook.com; 
 client-ip=192.88.168.50; helo=tx30smr01.am.freescale.net;
Received: from tx30smr01.am.freescale.net (192.88.168.50) by
 BY2FFO11FD028.mail.protection.outlook.com (10.1.15.217) with Microsoft SMTP
 Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.239.4
 via Frontend Transport; Wed, 6 Dec 2017 12:32:10 +0000
Received: from bf-netperf1.ap.freescale.net (bf-netperf1.ap.freescale.net
 [10.232.134.28])
 by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id vB6CW66C004419;
 Wed, 6 Dec 2017 05:32:07 -0700
From: Hemant Agrawal <hemant.agrawal@nxp.com>
To: <olivier.matz@6wind.com>
CC: <dev@dpdk.org>
Date: Wed, 6 Dec 2017 18:01:12 +0530
Message-ID: <1512563473-19969-1-git-send-email-hemant.agrawal@nxp.com>
X-Mailer: git-send-email 2.7.4
X-EOPAttributedMessage: 0
X-Matching-Connectors: 131570371307971496;
 (91ab9b29-cfa4-454e-5278-08d120cd25b8); ()
X-Forefront-Antispam-Report: CIP:192.88.168.50; IPV:NLI; CTRY:US; EFV:NLI;
 SFV:NSPM;
 SFS:(10009020)(336005)(376002)(39380400002)(346002)(39860400002)(2980300002)(1109001)(1110001)(339900001)(199004)(189003)(33646002)(316002)(2351001)(36756003)(106466001)(105606002)(16586007)(5660300001)(50226002)(68736007)(8936002)(104016004)(305945005)(356003)(6916009)(6666003)(2906002)(77096006)(4326008)(8676002)(53936002)(47776003)(97736004)(498600001)(51416003)(48376002)(50466002)(86362001)(85426001)(81156014)(81166006);
 DIR:OUT; SFP:1101; SCL:1; SRVR:SN2PR03MB2366; H:tx30smr01.am.freescale.net;
 FPR:; SPF:Fail; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; 
X-Microsoft-Exchange-Diagnostics: 1; BY2FFO11FD028;
 1:SvSunpnlKglHk30Z9ShMATe+TI1U66xHEF6lBcvHaQzKdNzVhcRHpTZQVLJeguF3CVE5KNNWbR0/TaWxrJVV4eMr+OoaIm2AvZvUycbB9/2GMSbQkI+RgGK+kOQSvNnj
MIME-Version: 1.0
Content-Type: text/plain
X-MS-PublicTrafficType: Email
X-MS-Office365-Filtering-Correlation-Id: d8b97034-f564-40cc-d05a-08d53ca55f1c
X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0;
 RULEID:(5600026)(4604075)(4534020)(4628075)(201703131517081)(2017052603286);
 SRVR:SN2PR03MB2366; 
X-Microsoft-Exchange-Diagnostics: 1; SN2PR03MB2366;
 3:gb11tzKf0+hZOdU2ZhqhBorgpXJg9lVmN8PETaet6C6WY0vQ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yFTubBojULhCbDKJ6u//WVm4Fwpza9mKJ6O2Rv+0yv4PqK4mgBvqMZ2idG62w178ysQpxuvvvEh+t01owsp1etn+3lTF0w70UMHAaQm9I/WDj95Sncr1CHYk8YqPSnJWaM41LWEzHUGR1jPo7sn7ymU+Cn/9PaMhwmRHtmudPMvh5VUtuVfUoFMFYPXT5xhSaPAfY4Up2Q+ptLNE2umkxYC4e8qghV9BTny1G7Ch4aRKUCLMgT5S4l4okUA0bGpRfCQ=
X-Microsoft-Antispam-PRVS: <SN2PR03MB2366CEC99580967C949FCC6589320@SN2PR03MB2366.namprd03.prod.outlook.com>
X-Exchange-Antispam-Report-Test: UriScan:(131327999870524)(185117386973197);
X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0;
 RULEID:(6095135)(2401047)(5005006)(8121501046)(3002001)(3231022)(93006095)(93001095)(10201501046)(6055026)(6096035)(201703131430075)(201703131433075)(201703131448075)(201703161259150)(201703151042153)(20161123556025)(20161123563025)(20161123559100)(20161123561025)(20161123565025)(201708071742011);
 SRVR:SN2PR03MB2366; BCL:0; PCL:0; RULEID:(100000803101)(100110400095)(400006);
 SRVR:SN2PR03MB2366; 
X-Forefront-PRVS: 05134F8B4F
X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; SN2PR03MB2366;
 23:br8ZvCMdJEnNwXb0PLnJbBwKfDUlT9WLeFtoEdc77?=
 =?us-ascii?Q?tdB1mtKPofNeDApkHCTQfIxLn96KI9K/mc6HG5x+Y/g2Y6cdAVwqqWWUwF5C?=
 =?us-ascii?Q?iTd7lbhmnPKfDUYTQUpJeJ8Eajh3+cymbu65FV+LKcKVUgiuOhj0TPI9E6Ww?=
 =?us-ascii?Q?E5AwDe7dFBeQ2KEVjusiwKZfBbxTkW39wJNIgX3MqEf27+NohPgv2KjJ0W6T?=
 =?us-ascii?Q?dWBSpuKseB5eSpom7Ku6Kx8uYQA2yjMey/CGcSUzDgOMq8r25jns77fam1Jz?=
 =?us-ascii?Q?pnv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l1abc4TycgPi4wZgwuZcYidndTmgOwL9sRXa7TsD98slaH9+NBGhBB2Bkx8q+0fEbhF3d0mrdK8npmZiir1wKQXl1z1b+kHpMvum7XivdczNQa3jAZ55wFzsbr5cITiWf0opwxqSNKc/TIiZeMqUPjfrUI8vPxQNinX3WTNLk5BFjms13dB/ecvbxlK4onkusQehzjb1iS9KSVmeBGBaTFh8XpH0gndLMvrkje3biQUs5UgxPhzZ59NULE+YDE=;
 5:DshEzCsyfL56EJnOufjn9x/gawB8lAUVFNzndx9gRYSAVNAMgLSOLOz7cFfI4uX4xZaKsJqy9eYJIQWHSG69B7PW5ctxBE2cds8lY1SfT5YyP74DJNtY4rm96M+kWegdBLrJSH4i7B62hNWkLvIEvGT82nstzo7tS0B5i+c7Kzo=;
 24:CbhGyTVZZ/KjNn0gWIoIjie399Yc6Bw/D2WefxE82bFK7LY8Vx27uosgFC0KXJQhvIMjN2KGe6KPMTawslH2rsdLt5Y0i8JOSYx5GzfapSQ=;
 7:qzRoDz2e9PEtEx9qZo52RRs3GOGQDQx71R1MPcY9UOfZ7o2tQvejTSewtXfb1pk+jT9fi+odSkKwDecDM/iy9JWa/mLiDMP0q0Jhl2/sENZq2k4mnbyja0YH2KvGpUBS0xXzLcicyEPzaRBPoHbyFaJlXu3cg+3LGWQU/6XjJ75djDHm+KZnZu6AZO/V/7BGC13baXRdGV0rNUnbrPuw2amHgjnze8AaCG0c0X3ZWdtfGK7XNZSYCcoAqEqvImgB
SpamDiagnosticOutput: 1:99
SpamDiagnosticMetadata: NSPM
X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Dec 2017 12:32:10.2199 (UTC)
X-MS-Exchange-CrossTenant-Network-Message-Id: d8b97034-f564-40cc-d05a-08d53ca55f1c
X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e
X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e; Ip=[192.88.168.50];
 Helo=[tx30smr01.am.freescale.net]
X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem
X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN2PR03MB2366
Subject: [dpdk-dev] [PATCH 1/2] mempool: indicate the usages of multi
	memzones
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <http://dpdk.org/ml/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <http://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Wed, 06 Dec 2017 12:32:13 -0000

This is required for the optimizations w.r.t hw mempools.
They will use different kind of optimizations if the buffers
are from single contiguous memzone.

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 lib/librte_mempool/rte_mempool.c | 7 +++++--
 lib/librte_mempool/rte_mempool.h | 5 +++++
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/lib/librte_mempool/rte_mempool.c b/lib/librte_mempool/rte_mempool.c
index d50dba4..9d3737c 100644
--- a/lib/librte_mempool/rte_mempool.c
+++ b/lib/librte_mempool/rte_mempool.c
@@ -387,13 +387,16 @@ rte_mempool_populate_iova(struct rte_mempool *mp, char *vaddr,
 	total_elt_sz = mp->header_size + mp->elt_size + mp->trailer_size;
 
 	/* Detect pool area has sufficient space for elements */
-	if (mp->flags & MEMPOOL_F_CAPA_PHYS_CONTIG) {
-		if (len < total_elt_sz * mp->size) {
+	if (len < total_elt_sz * mp->size) {
+		if (mp->flags & MEMPOOL_F_CAPA_PHYS_CONTIG) {
 			RTE_LOG(ERR, MEMPOOL,
 				"pool area %" PRIx64 " not enough\n",
 				(uint64_t)len);
 			return -ENOSPC;
 		}
+	} else {
+		/* Memory will be allocated from multiple memzones */
+		mp->flags |= MEMPOOL_F_MULTI_MEMZONE;
 	}
 
 	memhdr = rte_zmalloc("MEMPOOL_MEMHDR", sizeof(*memhdr), 0);
diff --git a/lib/librte_mempool/rte_mempool.h b/lib/librte_mempool/rte_mempool.h
index 721227f..394a4fe 100644
--- a/lib/librte_mempool/rte_mempool.h
+++ b/lib/librte_mempool/rte_mempool.h
@@ -292,6 +292,11 @@ struct rte_mempool {
  */
 #define MEMPOOL_F_CAPA_BLK_ALIGNED_OBJECTS 0x0080
 
+/* Indicates that the mempool buffers are allocated from multiple memzones
+ * the buffer may or may not be physically contiguous.
+ */
+#define MEMPOOL_F_MULTI_MEMZONE 0x0100
+
 /**
  * @internal When debug is enabled, store some statistics.
  *
-- 
2.7.4