From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-BY2-obe.outbound.protection.outlook.com (mail-by2nam03on0053.outbound.protection.outlook.com [104.47.42.53]) by dpdk.org (Postfix) with ESMTP id 3E0E51B00F for ; Fri, 15 Dec 2017 17:00:55 +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=wp0lZ61ZWeUvnO6PzPyYQ8QAoi4yQjcEQBku6gMx2es=; b=br6fpukWVc61Id1cy2vbiYqqwNFIjOYMOkWqiO9s5nMfXtkzi7hXwBB9x34CeF+YycjScwBMFREUbwI+k3MNprD07mY93KgFPK61GG2/NGHrCKtPrpK2F1S8tYBmGNBaUrIt6F5d9wvdNXX/882+V30jsGDdjve4bYSR3kyoguU= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Pavan.Bhagavatula@cavium.com; Received: from Pavan-LT.caveonetworks.com (111.93.218.67) by DM5PR07MB3466.namprd07.prod.outlook.com (10.164.153.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.302.9; Fri, 15 Dec 2017 16:00:51 +0000 From: Pavan Nikhilesh To: santosh.shukla@caviumnetworks.com, olivier.matz@6wind.com Cc: dev@dpdk.org, Pavan Nikhilesh Date: Fri, 15 Dec 2017 21:30:31 +0530 Message-Id: <20171215160031.11354-2-pbhagavatula@caviumnetworks.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20171215160031.11354-1-pbhagavatula@caviumnetworks.com> References: <20171215160031.11354-1-pbhagavatula@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [111.93.218.67] X-ClientProxiedBy: YQXPR0101CA0071.CANPRD01.PROD.OUTLOOK.COM (52.132.74.48) To DM5PR07MB3466.namprd07.prod.outlook.com (10.164.153.21) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: dd5dbfac-8cb3-4a4e-90f0-08d543d504fb X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(5600026)(4604075)(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(2017052603307); SRVR:DM5PR07MB3466; X-Microsoft-Exchange-Diagnostics: 1; DM5PR07MB3466; 3:BChd2JQwwLClDMmzeZcanBwp3759PL7J7p/SdIC7FA6i9q8e4sgboAuZ2UAr0ZczSz8q5G6vPQ9uzoA7zTqHJWBkeJiBIdznUgmI94gpTs75UKaC0IMMH1zRaUE6mjglr9LFOJ9lO0UqbWMFGD6VMYNZoWdbIfnWEr448FHa5zYfpWU7ulDAfbI3+7kdBHe7yK+XdxE5h5E+kQycIXowNBC+AyFrxgEQp/IahtvbAg6rOAki5vX0sTO1fvBl6MC/; 25:FlKc56W78a/KkcfFc7Npet5nxvYuRDsOaEafQFDIrIy0Oasc7NwtcYpqkpNDfg0sjnAOy4wG2SH01kPnfZXtHfFrd4u1aTOKZ0NgcshS9FA8CAXb0h1WkxdvjBDI27V3NN8Bh3wUO4OW7LqnBTUn1bcxwqlJhUyPBcpU2zfVYxJDZdJZ4vZrb90Zhy9RdCnIF5wxPQf4G864qVx1H/NlR5ytWuKqqTDAkjaavJTEJtQvvO+XkHUhf7gK7/d/rEs4NO3smLucJTsUDXcPmhlgJvBsZn/bvuhbkpPuaDmZYt3gSookY2MrS+TbXKeu7nmAnlHsL19V20UsJmylGcUIng==; 31:/KS6Ke42xzArwhC9iFR/8xgZcYwqa34dK+aP3ij/cFcC4IjqkrBsNj5E48L4MMmNGjsHOZsU6WhR/ce5wToW4UOEPPUUilYNDFRv2dPxVS+kHd9+H9bVjju+J9WiNQZsDJ9j/ST5VHJ01w2dJASQ0XIsbv0dyu/t3SYTwU97W2W/XvA8qQV+dYQZ6J36Ns7lI0ybidLxs+3AFjyPuY7qRiAAQdM6Vu8ma1cRpJMpbGM= X-MS-TrafficTypeDiagnostic: DM5PR07MB3466: X-Microsoft-Exchange-Diagnostics: 1; DM5PR07MB3466; 20:iIEfrzGyv3yeSRijEeIGEk8wTPrjD3xm/PCzLD1ux58IGERkJrr2qLFnMozbkemqYYZZBtgvkO62GUknDbKnBrI0tL8+eIP1cyUz16Nspf8duhH3DEyeHgE+4j6FyKOaLtb6MudUFDVsG0ISyWJRdS40mzjAw1NSQfyAUtlG5oYgdYPW97jCu6DIm7kOHmBicLkaywdXWrgtk1zovjWrwMxpLr388r7WPIUtiF98i6v8Ya2KIijmwMbrWqdBDL7C9hCI+8wMJh+YMqlEhp+QwvDVDY3Ctynj+37A0c22MZdkuiigWBDmn+FAiXO1CRu+Ldw4eqrbz/UskdZFrGEXzLt4eDoJ/gsOAWqc+k+kawUHdCzdlGjl4Mmm3n/Mip1gevwdscua336giadsT2Mh0yDIcrvqJydfM5hyyInejY7++R0Jdezh5MLYqIsiRsCL7hCzQrG5PKQLeECyqWNNeMPEEW5NPSVvQXho7mqt8eh/gNK8Zuu8L35eNIRNST0/kjkguFXb5tmi84sHvRUkvo77z+4hHwNag7jLWHzu+LkBGJbmd4zsvjZWFU5sl8aTq5geXSxHVwTecFwLKmOp5WchoVCHRhLEXyZTyipfEjc=; 4:rHsyWhaFFzQazA88LL6lhP6xWCPAqRZAXVflmK+ht00SnbIgMkNwYzcKOo0L8LfOow4Pol1Ix/Nk9GW0J+qkil4pNgG7R+hzTWxDQ0vEuLYYo6RcgCZfR6/EUAVGHMqCwD7RDpu0KkQVKNu/J2/aEWp0+FKGZtGhp6WapYVSGYoishuMO++SrizHrnwxyxnZ+Ps6YvaE94TnQJMteV/MKssY3cu0T0kAjlsGO54LF5lk5FzYVBsFEs9t7H0lxYpMpTiujoT2St3IQi9QTYHlHA== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040450)(2401047)(5005006)(8121501046)(3231023)(93006095)(3002001)(10201501046)(6041248)(20161123562025)(20161123564025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123558100)(20161123555025)(20161123560025)(6072148)(201708071742011); SRVR:DM5PR07MB3466; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:DM5PR07MB3466; X-Forefront-PRVS: 05220145DE X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(979002)(39860400002)(346002)(366004)(376002)(396003)(199004)(189003)(50226002)(51416003)(305945005)(25786009)(5660300001)(2906002)(59450400001)(6512007)(6486002)(8936002)(48376002)(50466002)(76176011)(52116002)(53416004)(7736002)(105586002)(106356001)(1076002)(478600001)(4326008)(72206003)(107886003)(6506007)(69596002)(36756003)(53936002)(47776003)(16526018)(386003)(5009440100003)(66066001)(575784001)(81156014)(6666003)(42882006)(2950100002)(16586007)(81166006)(68736007)(3846002)(6116002)(8676002)(97736004)(316002)(42262002)(969003)(989001)(999001)(1009001)(1019001); DIR:OUT; SFP:1101; SCL:1; SRVR:DM5PR07MB3466; H:Pavan-LT.caveonetworks.com; 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; DM5PR07MB3466; 23:+A1f/0Dle1z7viVKSBKHgVnfxjBHepnAJhcMv188t?= =?us-ascii?Q?R9i+G9ATjl6HrY/ttNB3OfZi6KZuXSrUMpizw/dy2RNM3hRH6O4udzvOCime?= =?us-ascii?Q?KLt8c2wPpeTa95/Yn4pUlSPqa45BAbGCmHlykbCZldJDCIfTdMsUa76MXod3?= =?us-ascii?Q?+/m2rd5frlgSNVBrjHMQ+NNU4Vf4s1E5NY7cFqNdsqN7K3g46+Qzw8xmA2hX?= =?us-ascii?Q?nU4YJIs7HsrRJxVqUqh42HgvkKlEmPtsiNq8SUCET2d1AVhwqm0XcfljSzLm?= =?us-ascii?Q?XKR6Eoq5vm4Ko6sR9CTiT7jbe1AMO0iC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7/IIj0WYAgfElINuGjqXb0I3e0uG8i461K9gxMJMLYvWXCJrbqI3D7Qd SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Dec 2017 16:00:51.6764 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: dd5dbfac-8cb3-4a4e-90f0-08d543d504fb X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR07MB3466 Subject: [dpdk-dev] [PATCH 2/2] mempool/octeontx: clean up memory area registration 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: Fri, 15 Dec 2017 16:00:56 -0000 Clean up dependency between alloc and memory area registration, this removes the need for SLIST data structure and octeontx_pool_list. Signed-off-by: Pavan Nikhilesh --- drivers/mempool/octeontx/octeontx_fpavf.c | 23 ++------ drivers/mempool/octeontx/octeontx_fpavf.h | 6 ++- drivers/mempool/octeontx/rte_mempool_octeontx.c | 72 ++----------------------- 3 files changed, 12 insertions(+), 89 deletions(-) diff --git a/drivers/mempool/octeontx/octeontx_fpavf.c b/drivers/mempool/octeontx/octeontx_fpavf.c index 3bc50f3..28f431e 100644 --- a/drivers/mempool/octeontx/octeontx_fpavf.c +++ b/drivers/mempool/octeontx/octeontx_fpavf.c @@ -386,8 +386,8 @@ octeontx_fpapf_aura_detach(unsigned int gpool_index) return ret; } -static int -octeontx_fpavf_pool_setup(uintptr_t handle, unsigned long memsz, +int +octeontx_fpavf_pool_set_range(uintptr_t handle, unsigned long memsz, void *memva, uint16_t gpool) { uint64_t va_end; @@ -509,12 +509,9 @@ octeontx_fpa_bufpool_free_count(uintptr_t handle) uintptr_t octeontx_fpa_bufpool_create(unsigned int object_size, unsigned int object_count, - unsigned int buf_offset, char **va_start, - int node_id) + unsigned int buf_offset, int node_id) { unsigned int gpool; - void *memva; - unsigned long memsz; uintptr_t gpool_handle; uintptr_t pool_bar; int res; @@ -522,9 +519,6 @@ octeontx_fpa_bufpool_create(unsigned int object_size, unsigned int object_count, RTE_SET_USED(node_id); RTE_BUILD_BUG_ON(sizeof(struct rte_mbuf) > OCTEONTX_FPAVF_BUF_OFFSET); - if (unlikely(*va_start == NULL)) - goto error_end; - object_size = RTE_CACHE_LINE_ROUNDUP(object_size); if (object_size > FPA_MAX_OBJ_SIZE) { errno = EINVAL; @@ -567,15 +561,6 @@ octeontx_fpa_bufpool_create(unsigned int object_size, unsigned int object_count, goto error_pool_destroy; } - /* vf pool setup */ - memsz = object_size * object_count; - memva = *va_start; - res = octeontx_fpavf_pool_setup(pool_bar, memsz, memva, gpool); - if (res < 0) { - errno = res; - goto error_gaura_detach; - } - /* Release lock */ rte_spinlock_unlock(&fpadev.lock); @@ -591,8 +576,6 @@ octeontx_fpa_bufpool_create(unsigned int object_size, unsigned int object_count, return gpool_handle; -error_gaura_detach: - (void) octeontx_fpapf_aura_detach(gpool); error_pool_destroy: octeontx_fpavf_free(gpool); octeontx_fpapf_pool_destroy(gpool); diff --git a/drivers/mempool/octeontx/octeontx_fpavf.h b/drivers/mempool/octeontx/octeontx_fpavf.h index 1d09f00..bc5dc3b 100644 --- a/drivers/mempool/octeontx/octeontx_fpavf.h +++ b/drivers/mempool/octeontx/octeontx_fpavf.h @@ -114,8 +114,10 @@ do { \ uintptr_t octeontx_fpa_bufpool_create(unsigned int object_size, unsigned int object_count, - unsigned int buf_offset, char **va_start, - int node); + unsigned int buf_offset, int node); +int +octeontx_fpavf_pool_set_range(uintptr_t handle, unsigned long memsz, + void *memva, uint16_t gpool); int octeontx_fpa_bufpool_destroy(uintptr_t handle, int node); int diff --git a/drivers/mempool/octeontx/rte_mempool_octeontx.c b/drivers/mempool/octeontx/rte_mempool_octeontx.c index e89355c..fc0cab9 100644 --- a/drivers/mempool/octeontx/rte_mempool_octeontx.c +++ b/drivers/mempool/octeontx/rte_mempool_octeontx.c @@ -36,55 +36,18 @@ #include "octeontx_fpavf.h" -/* - * Per-pool descriptor. - * Links mempool with the corresponding memzone, - * that provides memory under the pool's elements. - */ -struct octeontx_pool_info { - const struct rte_mempool *mp; - uintptr_t mz_addr; - - SLIST_ENTRY(octeontx_pool_info) link; -}; - -SLIST_HEAD(octeontx_pool_list, octeontx_pool_info); - -/* List of the allocated pools */ -static struct octeontx_pool_list octeontx_pool_head = - SLIST_HEAD_INITIALIZER(octeontx_pool_head); -/* Spinlock to protect pool list */ -static rte_spinlock_t pool_list_lock = RTE_SPINLOCK_INITIALIZER; - static int octeontx_fpavf_alloc(struct rte_mempool *mp) { uintptr_t pool; - struct octeontx_pool_info *pool_info; uint32_t memseg_count = mp->size; uint32_t object_size; - uintptr_t va_start; int rc = 0; - rte_spinlock_lock(&pool_list_lock); - SLIST_FOREACH(pool_info, &octeontx_pool_head, link) { - if (pool_info->mp == mp) - break; - } - if (pool_info == NULL) { - rte_spinlock_unlock(&pool_list_lock); - return -ENXIO; - } - - /* virtual hugepage mapped addr */ - va_start = pool_info->mz_addr; - rte_spinlock_unlock(&pool_list_lock); - object_size = mp->elt_size + mp->header_size + mp->trailer_size; pool = octeontx_fpa_bufpool_create(object_size, memseg_count, OCTEONTX_FPAVF_BUF_OFFSET, - (char **)&va_start, mp->socket_id); rc = octeontx_fpa_bufpool_block_size(pool); if (rc < 0) @@ -109,27 +72,9 @@ octeontx_fpavf_alloc(struct rte_mempool *mp) static void octeontx_fpavf_free(struct rte_mempool *mp) { - struct octeontx_pool_info *pool_info; uintptr_t pool; - pool = (uintptr_t)mp->pool_id; - rte_spinlock_lock(&pool_list_lock); - SLIST_FOREACH(pool_info, &octeontx_pool_head, link) { - if (pool_info->mp == mp) - break; - } - - if (pool_info == NULL) { - rte_spinlock_unlock(&pool_list_lock); - rte_panic("%s: trying to free pool with no valid metadata", - __func__); - } - - SLIST_REMOVE(&octeontx_pool_head, pool_info, octeontx_pool_info, link); - rte_spinlock_unlock(&pool_list_lock); - - rte_free(pool_info); octeontx_fpa_bufpool_destroy(pool, mp->socket_id); } @@ -222,21 +167,14 @@ static int octeontx_fpavf_register_memory_area(const struct rte_mempool *mp, char *vaddr, rte_iova_t paddr, size_t len) { - struct octeontx_pool_info *pool_info; - RTE_SET_USED(paddr); - RTE_SET_USED(len); + uint8_t gpool; + uintptr_t pool_bar; - pool_info = rte_malloc("octeontx_pool_info", sizeof(*pool_info), 0); - if (pool_info == NULL) - return -ENOMEM; + gpool = octeontx_fpa_bufpool_gpool(mp->pool_id); + pool_bar = mp->pool_id & ~(uint64_t)FPA_GPOOL_MASK; - pool_info->mp = mp; - pool_info->mz_addr = (uintptr_t)vaddr; - rte_spinlock_lock(&pool_list_lock); - SLIST_INSERT_HEAD(&octeontx_pool_head, pool_info, link); - rte_spinlock_unlock(&pool_list_lock); - return 0; + return octeontx_fpavf_pool_set_range(pool_bar, len, vaddr, gpool); } static struct rte_mempool_ops octeontx_fpavf_ops = { -- 2.7.4