From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01on0062.outbound.protection.outlook.com [104.47.2.62]) by dpdk.org (Postfix) with ESMTP id 6786FA48D for ; Fri, 2 Feb 2018 09:04:46 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=f7wm7YrfZFahJXnFcgC299VbE5/Pevzc2aw2WjDXAVc=; b=p0TYO0xS3Fy94APjzZthUrs5++IM0eEMPLOk2qNb/nukg8Pjel7MidCw2WEuw8DGxrYAV5qxF4XyysvU6h4Pcu/zkjPbs3iLYFE0ZqQsC1n6Q/h3K6HZLbcTYygy/yVPcHrHmqrKrbRFfuVoP4OY4RRWNrDV4RJP5yHn+MCBKBc= Received: from bf-netperf1.ap.freescale.net (192.88.169.1) by DB4PR04MB0768.eurprd04.prod.outlook.com (2a01:111:e400:984d::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.444.14; Fri, 2 Feb 2018 08:04:33 +0000 From: Hemant Agrawal To: olivier.matz@6wind.com, thomas@monjalon.net, pbhagavatula@caviumnetworks.com Cc: nipun.gupta@nxp.com, jerin.jacob@caviumnetworks.com, santosh.shukla@caviumnetworks.com, dev@dpdk.org, Hemant Agrawal Date: Fri, 2 Feb 2018 13:33:00 +0530 Message-Id: <1517558582-27108-1-git-send-email-hemant.agrawal@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1517514427-28843-1-git-send-email-hemant.agrawal@nxp.com> References: <1517514427-28843-1-git-send-email-hemant.agrawal@nxp.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [192.88.169.1] X-ClientProxiedBy: SG2PR06CA0087.apcprd06.prod.outlook.com (2603:1096:3:14::13) To DB4PR04MB0768.eurprd04.prod.outlook.com (2a01:111:e400:984d::21) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: b9d464f0-a2b0-4976-2c50-08d56a139a0e X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(4534165)(4627221)(201703031133081)(201702281549075)(48565401081)(5600026)(4604075)(2017052603307)(7153060)(7193020); SRVR:DB4PR04MB0768; X-Microsoft-Exchange-Diagnostics: 1; DB4PR04MB0768; 3:Akvyd33Z71I1/JwefnO4OeQ0H0Eq3hwjE8e3IvqrMviAr7DEyRWqaqMpoO5GDNQZJ4VcP0Tr9ZM7SHQs6KPa05SSHagKXbOJBH5NRPIQ/T4wM9wuzNlBnTLuXoX6x5FdMDof6KgGk5oaZsmEP8f2J5IYR1sKyRBMp6Ra+iXV/cYJ/QYGWpZQTIFk2xo1Z+/MaylbnN38zfLYEfg1vI1lJPL+UXQQULpOaTUTtZY3srRT+OOEf0DA9f4SvupjYW8w; 25:vUIfibLah9kgZxtVNRc0JxnVFE8KCMmxvB5ZVJQmKz/yuHb/HvtZO5ROEFm3v8aYyPSB7W2Je8j+1km21pDVwhpOGT3o8XjONux1iQLkHH1QbnbgKR2/3B4864jcVpTLU+TNEsd/jaz0noiOmlE5QcYMldE2XZ82HgpFXvlz0eMtnU9tiH+WNuj7/jZ6xPrh8UCB6Eb/X2fA4m5RmAJsvufBR8fgT/GYSgTve3vTSGOfGZ6SYFOcAgoyJXWvWoPZRgtAUzSoi0BwbZG5/ocA8jcr2xAUzH3ANYp4SEdGIdtznumQ1vlwnr8mKdoyH/df1x4pdRYr2WxhzKay4Kou8w==; 31:I/2DKFL0rUNwd5Q1J3Sq8IJG00z/TKsec/eMKZPG0y3cS0dPmc1IGPEl41suLX+GQg8lmEPakkjxdA1IstnHEYr9jvJ4ktOqMFHhPiv74cR7YAHBF21oiMaWlvAf0/jUvbohpbzLGqzfDkA9gpfR2GhlTnObcwVhhMNiMDQUY56ecLpMZWCeD0DTLYIyONKS6GYPmeBWFlxDfY5hNeWi4hrMDVETo9RZ1texecgRsbA= X-MS-TrafficTypeDiagnostic: DB4PR04MB0768: Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=hemant.agrawal@nxp.com; X-Microsoft-Exchange-Diagnostics: 1; DB4PR04MB0768; 20:D93FhJh/mEa2d/m6pRpZAiD/8Pntuy94/ELcBJ5s13sR6fP/ERcTQmFauS0gA1yrMlywedDjrkYlslAxC0ksU45eDkf5nErB+dSjbADtva6tXR/DhD4p+lmfNH8u45FVnxw/79S2UyFxug8LrQS+taEcGVwLEJiFUO50n/ESkTNL+tsTSZ2ClAwcKzeMiNSxtLBgwzzuySAkMIiWDGP45KgJi5J2ooAO27EFDhZeCAt9va70VXbUycC+C4L8EQNJjVHDrnkhyAi7Ts8gVaPlUj8qvRKbfC8lwyRbH1QBJXRbbF+ygk1lxcehVNVqxEck3S+jrIiUpLxlzPB5/Sb314rKKsEfimA+usTCalHHVM2Rdj/EHyg5FhZ4gP9Z/RLnCJZnE7qpWCzgRnqaDGInVFSxSpuPTiuD3r1P2L97lfrb13tSa4i8cU+oe7ocqmgg3NTQhZg7fokL4q8bf9eELD1/DySe/tCqmXyoXGzT2+IeV79fx3RBn2wF9GWcfDqE; 4:UfYVb2uEV2R8kSPymzMEkR9rTbw+i+O13HQkVpHD2JayAwEZ5eBU8nYgn/59b2TIjvVwClVNheOZsQmbghUheokx2A0LP6G+hpp+HpeYh03PLXhE3+pFfOcrOt+DQdZq8UmvJf6Hxfi0FMqT8FVoy0n/j2tmRLgUQMi1XPIR4wEzpDGY15PHfOvwyY2B+T1fuuk5SVbAz0cL5lXXlp2H3tpfkjXjH9HC8wrbSlUVdLlV2Nj+cEVIx+IsMAPQkxJqThdlaMET/sPWM4EYdNLyZ31uef5fkdUxFLykvgGtHZCbXN2exWzlsFguxVPH7WNj X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040501)(2401047)(8121501046)(5005006)(3002001)(93006095)(93001095)(3231101)(2400082)(944501161)(10201501046)(6055026)(6041288)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123564045)(20161123562045)(20161123558120)(6072148)(201708071742011); SRVR:DB4PR04MB0768; BCL:0; PCL:0; RULEID:; SRVR:DB4PR04MB0768; X-Forefront-PRVS: 05715BE7FD X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(376002)(39380400002)(39860400002)(346002)(366004)(396003)(189003)(199004)(6512007)(6486002)(53936002)(478600001)(305945005)(316002)(16586007)(50226002)(25786009)(386003)(106356001)(6506007)(8676002)(51416003)(81156014)(52116002)(81166006)(105586002)(6116002)(3846002)(5660300001)(4326008)(2950100002)(76176011)(2906002)(8936002)(6666003)(36756003)(66066001)(48376002)(68736007)(86362001)(97736004)(47776003)(186003)(16526019)(7736002)(26005)(50466002); DIR:OUT; SFP:1101; SCL:1; SRVR:DB4PR04MB0768; H:bf-netperf1.ap.freescale.net; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DB4PR04MB0768; 23:W36BNapejL+NenmkznT8UxLtBf28TQkc0g2IxQJhH?= =?us-ascii?Q?gDp+de+xJx9Bm/yDfuDP9ssCIh29tysNTL0kzciLqpjiWs6FA42XyglTFevh?= =?us-ascii?Q?bG+9atcNWr9IiCL65K5mbaFnjxJhpxk39m1dQ5SfH7q3Sz9Rb+9xq7UllfKM?= =?us-ascii?Q?C+KNuTXigvovHyJbG4paS6sso1Feiux8/R5KutMAIZ0eBYF8GekKzmWJrGn8?= =?us-ascii?Q?fkO5EDbu5yFZu60BPphcrpxFV6S1W5MGlc68QUY5+gCjRkRlXhnCBjld4loN?= =?us-ascii?Q?LVtrY8p5KFN1uOJncHWb7Lq01JYPPjc/KxPGWG9PKA4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4RL2NTPEYOAN/KvDmaOLCE/+ckRhC5uUmQN97LAOWHJ/YR6rcJwmzZqEUhjFG5DEdxcOreb6vK0AtW+MbUCDpqH/573JM9y/I3JUK+t9QmmRJdHK9EJf+x0+Ge6Qsi0MjnxpelIhrOrWs/6So6a2wva7QHiPd+GMsC3tP6U4XFpMVl8BtV6yGOSuNcSLtWyyOMLNIATLnH3+pFAVGC/o94zI5vlHj3Sckr3+ckcQJuBFkPLu3w1xGPhYwVKwGSpOTyS77XI6iQ3MkS1GhjjK21vcXH4=; 5:2KJm4oPBD6sv02PCCyocBsHmKxzUZZWV1omVjk1o2ODDd+ScjHypmKvzGTgF3U5bB+0Qza7X2+oToIzi8eW8ejw2lmGKoX+58+oU66NMeCplkMHWeXt3J8H9IuVsauZOoJ0Yux5Mi/yvJL8fPWDgrgC53b/ccsXmmMRqrbgJlqE=; 24:Fmom9PCGFvH+ofgTDfvVCohZygd9r5Wfo1jjjZN4Hm51hr/3LAgWnABvxTOVQgtoWqXs1uQCAJANabKyjQx46cZMYKJ91XF7A5MY2hutCWQ=; 7:Ygp36kkTVoSx54jgyIEGDYXTJNH1PHV1/QJcThuY6K84cUiaCcmAll1FfqpXuIB1LeR7YD3Am9j3CA7CvxwdfadPwZmb4riY5kg2akpK25lJCsrPEbWlBxaLf48w8am5j0RnHIPyVB2UhRbLZbvcLn2L8iunoBJ4k9gBV8YZdx9nHR9n7vaPl7NetMc6ve8bg8yy9h5wwIa+hmd1fU0xqFS291cChYQbb9s6iXTAVmzKGVNx4qVymios01oxhORI SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Feb 2018 08:04:33.5898 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b9d464f0-a2b0-4976-2c50-08d56a139a0e X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB4PR04MB0768 Subject: [dpdk-dev] [PATCH FIX-OPTION-2 1/2] eal: use named memzone to store user mempool ops name 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, 02 Feb 2018 08:04:46 -0000 The new mbuf pool ops name API uses the named memzone to store different types of configured mempool ops name. It is better to also save the user configured mempool ops name in named memzone. This way the best mempool ops name can easily get the user configured mempool ops name for it's decisions. This will also avoid the need to maintain a eal api for default mempool ops name. Signed-off-by: Hemant Agrawal --- lib/librte_eal/bsdapp/eal/Makefile | 1 + lib/librte_eal/bsdapp/eal/eal.c | 5 +++ lib/librte_eal/common/eal_common_mempool.c | 50 ++++++++++++++++++++++++++++++ lib/librte_eal/common/eal_private.h | 12 +++++++ lib/librte_eal/common/meson.build | 1 + lib/librte_eal/linuxapp/eal/Makefile | 1 + lib/librte_eal/linuxapp/eal/eal.c | 5 +++ 7 files changed, 75 insertions(+) create mode 100644 lib/librte_eal/common/eal_common_mempool.c diff --git a/lib/librte_eal/bsdapp/eal/Makefile b/lib/librte_eal/bsdapp/eal/Makefile index dd455e6..f07dace 100644 --- a/lib/librte_eal/bsdapp/eal/Makefile +++ b/lib/librte_eal/bsdapp/eal/Makefile @@ -38,6 +38,7 @@ SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_alarm.c SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_common_lcore.c SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_common_timer.c SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_common_memzone.c +SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_common_mempool.c SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_common_log.c SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_common_launch.c SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_common_memory.c diff --git a/lib/librte_eal/bsdapp/eal/eal.c b/lib/librte_eal/bsdapp/eal/eal.c index 1622a41..2c33a60 100644 --- a/lib/librte_eal/bsdapp/eal/eal.c +++ b/lib/librte_eal/bsdapp/eal/eal.c @@ -621,6 +621,11 @@ rte_eal_init(int argc, char **argv) return -1; } + if (rte_eal_mempool_ops_config() < 0) { + rte_eal_init_alert("Cannot config user Mempool Ops\n"); + return -1; + } + eal_check_mem_on_local_socket(); eal_thread_init_master(rte_config.master_lcore); diff --git a/lib/librte_eal/common/eal_common_mempool.c b/lib/librte_eal/common/eal_common_mempool.c new file mode 100644 index 0000000..1d10a75 --- /dev/null +++ b/lib/librte_eal/common/eal_common_mempool.c @@ -0,0 +1,50 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright 2018 NXP + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include "eal_private.h" +#include "eal_internal_cfg.h" + +/* init mempool ops */ +int +rte_eal_mempool_ops_config(void) +{ + RTE_LOG(DEBUG, EAL, "Configuring user mempool ops name...\n"); + + /* secondary processes don't need to initialise anything */ + if (rte_eal_process_type() == RTE_PROC_SECONDARY) + return 0; + + if (internal_config.user_mbuf_pool_ops_name) { + const struct rte_memzone *mz; + + mz = rte_memzone_lookup("mbuf_user_pool_ops"); + if (mz == NULL) { + mz = rte_memzone_reserve("mbuf_user_pool_ops", + 32, SOCKET_ID_ANY, 0); + if (mz == NULL) + return -rte_errno; + } + + strncpy(mz->addr, internal_config.user_mbuf_pool_ops_name, + strlen(internal_config.user_mbuf_pool_ops_name)); + } + + return 0; +} diff --git a/lib/librte_eal/common/eal_private.h b/lib/librte_eal/common/eal_private.h index 0b28770..76beaff 100644 --- a/lib/librte_eal/common/eal_private.h +++ b/lib/librte_eal/common/eal_private.h @@ -205,4 +205,16 @@ struct rte_bus *rte_bus_find_by_device_name(const char *str); int rte_mp_channel_init(void); +/** + * Mempool ops configuration + * + * This function is private to EAL. + * + * Set the user defined mempool ops in the named memzone area. + * + * @return + * 0 on success, negative on error + */ +int rte_eal_mempool_ops_config(void); + #endif /* _EAL_PRIVATE_H_ */ diff --git a/lib/librte_eal/common/meson.build b/lib/librte_eal/common/meson.build index 82b8910..3c6125b 100644 --- a/lib/librte_eal/common/meson.build +++ b/lib/librte_eal/common/meson.build @@ -16,6 +16,7 @@ common_sources = files( 'eal_common_lcore.c', 'eal_common_log.c', 'eal_common_memory.c', + 'eal_common_mempool.c', 'eal_common_memzone.c', 'eal_common_options.c', 'eal_common_proc.c', diff --git a/lib/librte_eal/linuxapp/eal/Makefile b/lib/librte_eal/linuxapp/eal/Makefile index 7e5bbe8..83a08b0 100644 --- a/lib/librte_eal/linuxapp/eal/Makefile +++ b/lib/librte_eal/linuxapp/eal/Makefile @@ -46,6 +46,7 @@ SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_alarm.c SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_lcore.c SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_timer.c SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_memzone.c +SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_mempool.c SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_log.c SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_launch.c SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_memory.c diff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c index 451fdaf..42a79d1 100644 --- a/lib/librte_eal/linuxapp/eal/eal.c +++ b/lib/librte_eal/linuxapp/eal/eal.c @@ -877,6 +877,11 @@ rte_eal_init(int argc, char **argv) return -1; } + if (rte_eal_mempool_ops_config() < 0) { + rte_eal_init_alert("Cannot config user Mempool Ops\n"); + return -1; + } + eal_check_mem_on_local_socket(); eal_thread_init_master(rte_config.master_lcore); -- 2.7.4