From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-DM3-obe.outbound.protection.outlook.com (mail-dm3nam03on0062.outbound.protection.outlook.com [104.47.41.62]) by dpdk.org (Postfix) with ESMTP id 807441B1EF for ; Sun, 1 Oct 2017 11:29:56 +0200 (CEST) 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=jQGOvkr+rZBJh0ucT7nYVqpoyohOPb+iMqKD3b5JhLQ=; b=eEgDj+eVbAQLD0r+Gi5Ag986ibD5SyWJ6gnguvmK5GTeBtk2xpISAfERlfnWShpdKK2c4VR1/bF06ri5kb+gWZK7iewZqdNKmM/wFdZEJa/pItT/qtPGY665sXzCTu09OCyS8U3HzxWfdbzIAnYeanIc/+dSFBJRU9FOIlnWrC0= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Santosh.Shukla@cavium.com; Received: from localhost.localdomain (111.93.218.67) by DM5PR07MB3098.namprd07.prod.outlook.com (10.172.85.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.77.7; Sun, 1 Oct 2017 09:29:52 +0000 From: Santosh Shukla To: olivier.matz@6wind.com, dev@dpdk.org Cc: thomas@monjalon.net, jerin.jacob@caviumnetworks.com, hemant.agrawal@nxp.com, Santosh Shukla Date: Sun, 1 Oct 2017 14:59:00 +0530 Message-Id: <20171001092902.10842-7-santosh.shukla@caviumnetworks.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20171001092902.10842-1-santosh.shukla@caviumnetworks.com> References: <20170907153042.30890-1-santosh.shukla@caviumnetworks.com> <20171001092902.10842-1-santosh.shukla@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [111.93.218.67] X-ClientProxiedBy: BM1PR01CA0077.INDPRD01.PROD.OUTLOOK.COM (10.174.208.145) To DM5PR07MB3098.namprd07.prod.outlook.com (10.172.85.8) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 740f3207-35e5-45e8-1d7e-08d508aefa19 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(2017030254152)(2017052603199)(201703131423075)(201703031133081)(201702281549075); SRVR:DM5PR07MB3098; X-Microsoft-Exchange-Diagnostics: 1; DM5PR07MB3098; 3:ZIkRVOCtXmyGHoDEGX7CURmIvhaYpi3iOGBWF7dtw5pDh5dBPTAmXkONf3r5tkvb7nKyC3/9FEgJ/NDbMfT6sUcVbGO667daUaPYoGJPoMsJLWYPoULidaC7RgR5H1ZPtPTnUWEVXNluuGdV3SGAyZzHk9+Efc+B3tIBQyaGHwoGa1IlH6Vf8a0wSnyrQErMG9b8Bfa7dK56epCN2TNcN0r0nqX3222W17KkF10cUWVs/JBBRcBr+PnuT2hcwJWa; 25:96QX2exX2iZyIB7an19cL0n4y7N4B3jYucAlkq+l3izZJ3doZtikrICh7kOU74CJvJ0KkBDio/NNPNrKlMZoOH08lB0+Te+EVXuoqBn1mOzcev47+iH0Rt8v2KTXaAOUG3IRglZBza63PDFMUBC34IQeXyUyRKQRNwOytVcznNA1/ZL5x+BgmIfx4MvrksaQ078mMvWTGHgeUfEGuSSA1noVVViycpXFH3R6ATOigOYS1L0pjnVx+us4AvLDWZEC1azaxpLYBSNufRlpzv1wElStc1BTbDiN2NKK5QCRvsVktGqCuKu+KwrDSvOJLs5AO3bbflFJnBkUmBUQb+QLsw==; 31:dEZetkNbF2qj3pYro2gZVzZgt7d88yc6TPi6CUwBAVJpajRzMOeIJkkyzXGZFt7DSK3faJRIRgJBPM5MBoG/Ig9eLtQcPdtfRG2ubj8ai735yrFa8wjlaG2Z8JStFfbK/pBKzdJx/VRy1XllZXJ+f8qzmM5cHOBmIRBmwQ0XPkJvwy3b+jJlx9tpVUbBGg1zYJGLBbSSY0OCEg+sjHZ6S/HiOppYwKIcO2fkPYzTxEk= X-MS-TrafficTypeDiagnostic: DM5PR07MB3098: X-Microsoft-Exchange-Diagnostics: 1; DM5PR07MB3098; 20:fMp8nDtI5OmBx9sTy687eWd8O/G6EzLVgMdxRP5jVb+9VGwtZ8fZ1q5V+wA3ZFeNDALnVlvRplXO0ELvRZNS7xEyk73G89NRdO/WZd5HdZTnLAPaf6i0sArJeT8QTdmAcke8akQ/OrCtUBrGWhgukQ68xqd4BBe5AuupIOTXUt4Aoa/5oga7ti81cKKexdOaTxdidaMGiuxE0oGHG1YS8EN/jBx7pB0mVnpQ5/TikOd+2m/YyfaQLB5uvtXWuuFwiBlcf+p/IH05n9WGM94rNR9Jhd6ofBOGiJ62qDAraeuVWqx+Tlcw0Iz0Hh7X9yk2KIen8TFGma2sdzGwhMKkMu00HIIYB6oDnYRJ7vxVk/PLNhu2EyHw/nuncCb59HrNlDLmRXbdZG9Uy0ApThWl/VkYjJHFk1H9JCw9ChI75LnYjHPjwPdxY4OITBLQldAtDsz5j/dPdQnty2lHheF6d2ZchK02/l4+wKYMQ9LBMtYYHL5W6TuEIjaFTtpMZQuhFMWrW/w0e3WV09h9xU11YiccTrDQViaYPbMztGI2cM440tp4or2tz8Lizm5g2aH/u7KIB34YK16zEUbUlqIGfA9Ets4JHcjtTICtMQ+esf4=; 4:q0l9ijIOKb8qs8Dpljens/ZA0LmSlyOXa/qvcN8OqQBaJq8hHy/kCGpfU/oIJTfTL9ZZ89j7EbGwIu8Ns+0C8mICid37ky5SCUw53+zcF0F92LtjJQKYAjQlw99XWXO+wxkIU4eaeYLwFdALDzzAZh+wrkySU5zRUn3rMkX3QhwyAi5UtIyJGqxMyg4sEu6kKwEOCAxur7A3RFZFo0wqtTtSHqBSvYgKXyuDVq46ggXQM0ctsrG+JJbvrz1xXeSOGvikTR+laCFXYDhS63N4YVFLx8tcarm4j7ZGuX8By2I= X-Exchange-Antispam-Report-Test: UriScan:(131327999870524); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(5005006)(8121501046)(100000703101)(100105400095)(93006095)(3002001)(10201501046)(6041248)(20161123558100)(20161123560025)(20161123564025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123555025)(20161123562025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:DM5PR07MB3098; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:DM5PR07MB3098; X-Forefront-PRVS: 0447DB1C71 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6009001)(6069001)(376002)(346002)(189002)(199003)(101416001)(478600001)(189998001)(106356001)(50986999)(81166006)(16586007)(81156014)(8676002)(72206003)(68736007)(42882006)(50466002)(8936002)(5660300001)(16526017)(48376002)(8656003)(2950100002)(2906002)(105586002)(66066001)(3846002)(6512007)(1076002)(36756003)(47776003)(316002)(76176999)(6116002)(4326008)(97736004)(53936002)(5009440100003)(25786009)(50226002)(6486002)(107886003)(6666003)(5003940100001)(33646002)(6506006)(305945005)(7736002); DIR:OUT; SFP:1101; SCL:1; SRVR:DM5PR07MB3098; H:localhost.localdomain; 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; DM5PR07MB3098; 23:KlgqKe89hYCusjGFDUtZmORB7OsdXCy3VY4vB9N0k?= =?us-ascii?Q?USB5zx20/ndmNZWBjdGmTfboZuVSZA1g0qhd3OPQEZQ0O9iFfD+wu0/E6tSa?= =?us-ascii?Q?OGpxpDcRJ/FBIZ6yYKjhOcahzcafhgA1MS8WUyE9aArXWKlt1hCNIhNRcBtH?= =?us-ascii?Q?owKVB5JWe2K/2L+7gtBcc3llmD5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DiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Oct 2017 09:29:52.9512 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR07MB3098 Subject: [dpdk-dev] [PATCH v7 6/8] mempool: detect physical contiguous object in pool 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: Sun, 01 Oct 2017 09:29:56 -0000 The memory area containing all the objects must be physically contiguous. Introducing MEMPOOL_F_CAPA_PHYS_CONTIG flag for such use-case. The flag useful to detect whether pool area has sufficient space to fit all objects. If not then return -ENOSPC. This way, we make sure that all object within a pool is contiguous. Signed-off-by: Santosh Shukla Signed-off-by: Jerin Jacob Acked-by: Olivier Matz --- lib/librte_mempool/rte_mempool.c | 10 ++++++++++ lib/librte_mempool/rte_mempool.h | 6 ++++++ 2 files changed, 16 insertions(+) diff --git a/lib/librte_mempool/rte_mempool.c b/lib/librte_mempool/rte_mempool.c index 92de39562..146e38675 100644 --- a/lib/librte_mempool/rte_mempool.c +++ b/lib/librte_mempool/rte_mempool.c @@ -369,6 +369,16 @@ rte_mempool_populate_phys(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) { + RTE_LOG(ERR, MEMPOOL, + "pool area %" PRIx64 " not enough\n", + (uint64_t)len); + return -ENOSPC; + } + } + memhdr = rte_zmalloc("MEMPOOL_MEMHDR", sizeof(*memhdr), 0); if (memhdr == NULL) return -ENOMEM; diff --git a/lib/librte_mempool/rte_mempool.h b/lib/librte_mempool/rte_mempool.h index d251d4255..734392556 100644 --- a/lib/librte_mempool/rte_mempool.h +++ b/lib/librte_mempool/rte_mempool.h @@ -265,6 +265,12 @@ struct rte_mempool { #define MEMPOOL_F_SC_GET 0x0008 /**< Default get is "single-consumer".*/ #define MEMPOOL_F_POOL_CREATED 0x0010 /**< Internal: pool is created. */ #define MEMPOOL_F_NO_PHYS_CONTIG 0x0020 /**< Don't need physically contiguous objs. */ +/** + * This capability flag is advertised by a mempool handler, if the whole + * memory area containing the objects must be physically contiguous. + * Note: This flag should not be passed by application. + */ +#define MEMPOOL_F_CAPA_PHYS_CONTIG 0x0040 /** * @internal When debug is enabled, store some statistics. -- 2.14.1