From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-BN3-obe.outbound.protection.outlook.com (mail-bn3nam01on0060.outbound.protection.outlook.com [104.47.33.60]) by dpdk.org (Postfix) with ESMTP id 9D3097D8A for ; Tue, 15 Aug 2017 08:08:29 +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=Rer+Qg3kQZWOc/Bh7YcMPdikY67exKRhHzl0GZQPHvc=; b=ov7bCRrgakpZxgK3P6qk1eGxOddQtqj1oG1bYQ2+yEyPS25MmjfZ/QaYIw43JsqZVhF/l67oVrOWX/1gNNO1MZcnpyFk6+YAUpbYUZjsFesEAaF6yBCLCA2KZVp3aNO3w6Hr3kvKbZgZB+VPii83Dm2dcQiCOQC1gKKn3R+c0QY= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Santosh.Shukla@cavium.com; Received: from localhost.localdomain (14.140.2.178) by BN6PR07MB3089.namprd07.prod.outlook.com (10.172.105.7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.1.1341.17; Tue, 15 Aug 2017 06:08:25 +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: Tue, 15 Aug 2017 11:37:41 +0530 Message-Id: <20170815060743.21076-6-santosh.shukla@caviumnetworks.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170815060743.21076-1-santosh.shukla@caviumnetworks.com> References: <20170720134759.4680-1-santosh.shukla@caviumnetworks.com> <20170815060743.21076-1-santosh.shukla@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [14.140.2.178] X-ClientProxiedBy: BMXPR01CA0022.INDPRD01.PROD.OUTLOOK.COM (10.174.214.160) To BN6PR07MB3089.namprd07.prod.outlook.com (10.172.105.7) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e686b2fe-28d5-42d2-1e5e-08d4e3a40b88 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(300000502095)(300135100095)(22001)(2017030254152)(300000503095)(300135400095)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095); SRVR:BN6PR07MB3089; X-Microsoft-Exchange-Diagnostics: 1; BN6PR07MB3089; 3:0nL0ut8lM+k6Gl1EHzgE1bY4JMzMC1w4040hbHkiSsKsvZ13JjT0jx336kkZqez9NEIjt2PbB/xHVf8lBuDB3tNpiyGu9AF9oFPDPctC1gBb3zmUHW16QepEoy59hVX5uBlLU+zqf7BsJ4MQd29NcOv1d/boo2EekPcTCAuY/3SnT9QykJbEItg0tledlVkAPh6lUX8pDglTc++h6qtEMDOB2lauf4sN0Tm9k9DPdyyiT7RhUsEgKm2tlSYlxBAK; 25:0R2pPLGR4h8/RAaINmbvvYBBeLHOOZmXNl/STlHyFGKEVqZeOfDNP0leVpGDLTS4RxcOyH9U57btYbzn85bZMtQutqGZa0fCxLWZVBeZli5xd9m3lRftHVkrbkWBbF8Vu5vthtzsWEgGZiivzStWkjLba/Qrq4OlfnI6TSYUJ6i2lSkcfecBqiPDOKKsONQ9RNkgmqhqkCdL1hNu81DJxZPGBxYwyY+49fERL7ly/vA+GErJRd1ZkUMod2Tjjiq/UvfkqF8M+t7xi8wTmkOl5awxr+zFFhoDIHEOhfdyg2mUe0luLcZ+GfYk/i1HlUjf096EHv6wOyMH7dq4rt8rJA==; 31:JOoH2d0cfWxMCk8tzHiUDd+09JDdEhVizO47xnRUNxrFFA4LCyqRoFJiZkD84w67/H/zJXprrmfslhujaVa4EmmCSwQThBNH3gNGF4cmzet3HgYgW/hO5kELtmV5CEi76kwDw7B0zJRmFin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zeQmrLGyYsKjXfI= 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)(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046)(100000703101)(100105400095)(93006095)(6041248)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123555025)(20161123560025)(20161123562025)(20161123564025)(20161123558100)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:BN6PR07MB3089; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:BN6PR07MB3089; X-Forefront-PRVS: 04004D94E2 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(7370300001)(6009001)(6069001)(199003)(189002)(6512007)(106356001)(72206003)(6486002)(42882006)(6506006)(66066001)(2950100002)(47776003)(6666003)(48376002)(4326008)(36756003)(50466002)(68736007)(478600001)(25786009)(2906002)(105586002)(97736004)(5660300001)(7736002)(305945005)(50226002)(8656003)(189998001)(53936002)(8676002)(5003940100001)(7350300001)(42186005)(33646002)(5009440100003)(76176999)(6116002)(3846002)(107886003)(81156014)(81166006)(110136004)(101416001)(50986999)(1076002)(110426004); DIR:OUT; SFP:1101; SCL:1; SRVR:BN6PR07MB3089; H:localhost.localdomain; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX: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; BN6PR07MB3089; 23:z06uFYiTMvfuFEvXIy6+SYDQo0lOeM75Q0uS0gyhd?= =?us-ascii?Q?svkG5u8XZBioogJ/0vTb/s18UmzmT69IfFE6uHfzKfWaqPNnGDd+5Tp+EJBy?= =?us-ascii?Q?ZrnlK5cW6gbd58q4KggZhNL93piJp6eJhC9aZyAOpB+G3j8MZIME+dasa2rd?= =?us-ascii?Q?il1J5FgCd29GNCQE9L85hXuhxaogDSzYb+B1kMAaexByFMH+Q5gVQzJN4YrK?= =?us-ascii?Q?Dmk2ux3CKtB1fJBgxP7Dwov0XdMnqD+hH6axxxMS2jD6oe9+rfar+W0m/NAv?= =?us-ascii?Q?nX/VGD6TYJIfWtp2HRkzG2RZ50kU9I1kQt2N6vIk/vGrmw0zSZFYRemCELaB?= =?us-ascii?Q?M1G8i5DbQ26hDapaNx7i03C66R4jbJqmut4a+K36Hq5SH2LheJYyoOFDvbRr?= =?us-ascii?Q?shGaH+6TjwG4G1Qyzv66sKpr/9E5Gc98CJFR7BGk7fEGw7F1oBU072yb8GnX?= =?us-ascii?Q?n27HQe2OLcd6j79ni0G1ajNBfchMztyNknMJYNk074O1WaAI6TabD83lrstv?= =?us-ascii?Q?WsxDMlQxpEUF8OgfGK5nts1eefr0jrWYt9du2uSlJzUHscAKx2snkgH2yhoP?= =?us-ascii?Q?IhaHBCBpA664UReKw3yzW/TDrBX+ia8dZkjOnLSc0qltBw+X10VViic9I/sF?= =?us-ascii?Q?Vh7pUF1oD67yCaUOQOg6iIgG9uGT+bGNmncgi1qFLScEXVzIfTtYZuq4oMjh?= =?us-ascii?Q?57bT7Uh/GezRNgk564gFSc3wemVEWaqTnQhffv77DiSCV3B534UypAptS/h2?= =?us-ascii?Q?oxWaz2/YU1XJe8n+vZwBqkT+jdqnAJR0bLy4Pw9zjzBG8Yeg4kPh43Lb6dV+?= =?us-ascii?Q?lYtse8XTdNdTFbMC65f1CXOSHHNIw+iNMVETA4Cjh868Vux/wOEFaoxAIqcf?= =?us-ascii?Q?GycDUvaK5DbUzvjLztVx78PJtcDHoY6z28rTbm7miu7ip1TpAxdaqOQAeOlU?= =?us-ascii?Q?+2vJiY+Jg3ujf91OKMAOQ1s9zAO0BEuRLvgxKgKAGk3KFhbtqrRUZEK9qTv7?= =?us-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73iJUl6P7SK52gIUZU1hubrVt0i7Lh7CISNlntlhKufg/k9jusoZhp8mWrhhK+XU1FUICilsf2dptNU/f4kXdLN3oNJHrxBza8y6O4kF8LFk+CGX18V4D2GNv6+Ir+9L+KM= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Aug 2017 06:08:25.1350 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR07MB3089 Subject: [dpdk-dev] [PATCH v4 5/7] 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: Tue, 15 Aug 2017 06:08:30 -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 --- lib/librte_mempool/rte_mempool.c | 8 ++++++++ lib/librte_mempool/rte_mempool.h | 1 + 2 files changed, 9 insertions(+) diff --git a/lib/librte_mempool/rte_mempool.c b/lib/librte_mempool/rte_mempool.c index d518c53de..19e5e6ddf 100644 --- a/lib/librte_mempool/rte_mempool.c +++ b/lib/librte_mempool/rte_mempool.c @@ -370,6 +370,14 @@ 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 bc4a1dac7..a4bfdb56e 100644 --- a/lib/librte_mempool/rte_mempool.h +++ b/lib/librte_mempool/rte_mempool.h @@ -265,6 +265,7 @@ 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. */ +#define MEMPOOL_F_CAPA_PHYS_CONTIG 0x0040 /**< Detect physcially contiguous objs */ /** * @internal When debug is enabled, store some statistics. -- 2.11.0