From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-BY2-obe.outbound.protection.outlook.com (mail-by2nam01on0041.outbound.protection.outlook.com [104.47.34.41]) by dpdk.org (Postfix) with ESMTP id A1BBC1AEF1 for ; Fri, 19 Jan 2018 13:41:52 +0100 (CET) Received: from BN6PR03CA0052.namprd03.prod.outlook.com (10.173.137.14) by DM5PR03MB2698.namprd03.prod.outlook.com (10.168.197.136) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.428.17; Fri, 19 Jan 2018 12:41:51 +0000 Received: from BN1BFFO11FD048.protection.gbl (2a01:111:f400:7c10::1:125) by BN6PR03CA0052.outlook.office365.com (2603:10b6:404:4c::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.428.17 via Frontend Transport; Fri, 19 Jan 2018 12:41:51 +0000 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=nxp.com; 6wind.com; dkim=none (message not signed) header.d=none;6wind.com; 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 BN1BFFO11FD048.mail.protection.outlook.com (10.58.145.3) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.345.12 via Frontend Transport; Fri, 19 Jan 2018 12:41:50 +0000 Received: from [10.232.133.65] (B10814-12.ap.freescale.net [10.232.133.65]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id w0JCfleD015704; Fri, 19 Jan 2018 05:41:48 -0700 To: Olivier Matz References: <1515996674-26338-1-git-send-email-hemant.agrawal@nxp.com> <1516281992-6873-1-git-send-email-hemant.agrawal@nxp.com> <1516281992-6873-4-git-send-email-hemant.agrawal@nxp.com> <20180119100147.wbhddhtgcsbdac5w@platinum> CC: , , From: Hemant Agrawal Message-ID: <89a76d94-b4a1-7bf4-dd64-16096f8b6bbe@nxp.com> Date: Fri, 19 Jan 2018 18:11:47 +0530 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: <20180119100147.wbhddhtgcsbdac5w@platinum> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit X-EOPAttributedMessage: 0 X-Matching-Connectors: 131608393108397308; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.168.50; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(39380400002)(396003)(346002)(376002)(39860400002)(2980300002)(1109001)(1110001)(339900001)(189003)(199004)(229853002)(316002)(97736004)(54906003)(58126008)(50466002)(86362001)(105606002)(93886005)(53936002)(23746002)(83506002)(67846002)(106466001)(59450400001)(53376002)(85426001)(230700001)(6246003)(6306002)(4326008)(77096007)(26005)(76176011)(53546011)(104016004)(36756003)(8676002)(64126003)(305945005)(65826007)(966005)(2906002)(31696002)(356003)(65806001)(65956001)(68736007)(47776003)(2950100002)(498600001)(8936002)(5660300001)(6916009)(31686004)(81156014)(81166006); DIR:OUT; SFP:1101; SCL:1; SRVR:DM5PR03MB2698; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1BFFO11FD048; 1:S5zFuPO/iGJbETeiQZj6mWLBYIjryILjHdbXMFdbnF40MOhgjBxQGaxpmdIb35gWdOuTnYhoSB5WSjdpXaBbitlV56djPFqcGKSbQRp5n8xBCNiyF1WqBmfwaXPD/E0q X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 2de84072-51f2-47cd-3b9e-08d55f3a0324 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(5600026)(4604075)(2017052603307); SRVR:DM5PR03MB2698; X-Microsoft-Exchange-Diagnostics: 1; DM5PR03MB2698; 3:GRcaGuS7W6NjQ9ps0kAitmg+9abmsikhA4k0d/+GzQrNBOMYH53NY7AoP7vadg+kIzKlOJjc36jAW0G9vpATilXl/tugt7DWn0ZtBdHbgWWuYRsmoPXw4kQ0OJK1T4mVBdxtF8W079VISe2yVFS8SiOgtA18rvQnHcH8we+HrSdHwCJFpJ4kHf9WRhVR+aNcwpHPRF8C8LvpdS+TPhYunNGElTxfgmQiIGdjpNZU/rTki6YWgl+kmNPPb/NPMFr3jEgtMIt32GI0M3g+EwrQMCmtYQeijuIbcRNZTj2iPZlnxYm38P/C2rF7Tzr5WA7+XIPLYO9TBOM3s+ooeAmewYM2JP98y2xhgYBeyZP09tI=; 25:/yK+M62f2o8fuZZe4QJye9s1mhoBh9aPE3USXCdvAHTB8sfphavoyJyBGVH4RvND6axhr6/BTqOJ05DlgeBhgP2i3FlxOx1GT+sUyYIVxGy+RntTNxRZp1IjBBpi/ZEikkukoOqexJQ2mjM5fSYxsrWUV3skcsosVK7UrMH4OcXtnB2MKRoUHC5LqtialIL+W6ADJzFTVsmv/tBmoiM0XavrqLtqaOax5CTwYA9oNPMcZBnSfTZiPBWcdjXE+0QZjef78vwrQAY+Ea22jkJPconBr5yln7PFb6LifPG04Dv34vrTHiSnuqkbV/Oayb35RR43vMzQ9qDSwuPK925Ghw== X-MS-TrafficTypeDiagnostic: DM5PR03MB2698: X-Microsoft-Exchange-Diagnostics: 1; DM5PR03MB2698; 31:lvmzR3ZEgkWEfEwI6A6hlANcpF2zUiQHuLtOuaTRS+T2cOT6Wj8wg44DN1fyvA8IbaVfXqiqrcfcTMuN+4KtyYLihYZjuD9i7WjzDTMj6faIDeMBsqz1woDJoVSfwd8fHEFsod/tulV/QU9Amo/MJy4dgXNXlEWysP4gdRLJTJ1DkKMnmD/r75t3jBHUSlqeM1CtI7cjZudkslZnFHwuxn9/SCy4TU2iULcG2ptj710=; 4:LNDWVLBlvfYAURPB7YZcOIYQTsUpZBhfm4At/R2aNgW8IJMYD2+oRzC4+M0rha/yzH+fyr0mlp9Sl11PgBommN0DwXeQHPUc2RnJDcOL2U0dj1Q9NuKU2iATdIqtsta8oxGg0ySKgF72w/exdou+qkHGDjtBdtNX92Dt15rDBcZZSsjvaJl3pMQFr+As/vMjQUiZ/fxn5zIkysOmnc3z3OO3nRyhK6KFOkYl8zJySN5VtM80Ifk6hzIhZz0Xtgq5gWF4I59Znu1yfys0+BX29pa4FoGKyBQmcb4Soadxn5rcagE1JXxSyIDu1PWTlCTX X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6095135)(2401047)(5005006)(8121501046)(93006095)(93001095)(10201501046)(3231023)(2400077)(944501161)(3002001)(6055026)(6096035)(20161123565025)(20161123556025)(20161123561025)(20161123563025)(201703131430075)(201703131448075)(201703131433075)(201703151042153)(20161123559100)(201708071742011); SRVR:DM5PR03MB2698; BCL:0; PCL:0; RULEID:(100000803101)(100110400095)(400006); SRVR:DM5PR03MB2698; X-Forefront-PRVS: 0557CBAD84 X-Microsoft-Exchange-Diagnostics: =?Windows-1252?Q?1; DM5PR03MB2698; 23:ouyXWsLsULSWCFKYn6oQsPtl5Nz9GP88mcp7v?= =?Windows-1252?Q?xBDi1E7X2yiOUQDrybBee8PLVPLf+Vz47C69xP9kGLGhbpycNVZAzeLb?= =?Windows-1252?Q?IKRTO4Bt9K4WaixOWdIO3J16O6hHYYyGdOxuSmQ1pZZ0Ids0rdNf/XhF?= =?Windows-1252?Q?Q+i3PfgRgGz18MYYiQneCaG/61CRtRh92ZCuNDe09OvdKh24YhZI/WO0?= =?Windows-1252?Q?EIh1H11fF1f2Lu6Pj65z6oYoYdcM0WwtXr2dgSIAIyz/ZNwBqyf1nflh?= =?Windows-1252?Q?csRmzZ80hitMAuY+mJh8Q3sDlJrXnOmeNvHp0uKias0hJ21HSgDhX5DM?= =?Windows-1252?Q?xYDXP7WZrOfa6Tx3zynwJNgs1auNoz81hk8zmYoTcTMoUVJwMyIzUcHL?= =?Windows-1252?Q?+2OTPqiqsoe0lFn6Cgj5oh57MrMe4Wu06q/VSG4mlUgnP4UcpjDOozOv?= =?Windows-1252?Q?KMSbmBAyD/sN86o9Yu5q6uK4eBOsHIleStJrc57ZllXEUf65jD5babtb?= =?Windows-1252?Q?iMtojzQu/oDk/6AkKYzkKBUA2VfMTYEVH9DIUpL8q++7e15/MLJOnRSC?= =?Windows-1252?Q?rtR2VwKkro3TTy2QDyCwgZAIYynNILZqaj13oOsC7ED1UadbdOdMl1Rl?= =?Windows-1252?Q?EUvPMweO1v054WXN3wriOiwL1p5Cny4ymAYmM9Q+74CQfJtuFNvuIgPr?= =?Windows-1252?Q?pz010zxsjuWpBuonubz49uHMSuOmkgcSriBGZsBdODuw2TdeFvCqCr4z?= =?Windows-1252?Q?/NgVOelyK4ZA5xqcgT/hSwauvochk10bhUIHFWs9oVBCTlBSB7XSZFBG?= =?Windows-1252?Q?Ezxx/FImeCwlwsh+K6xejq+FZ3mewvLjE7vdHUucIfBgnEAVUHdT25rV?= =?Windows-1252?Q?xjdkhgcxBnIrOQ6yglMtA31osK/rDmyBTMplxNodSDVM1tzGbOGekVYe?= =?Windows-1252?Q?VEJd4nWNgAuSUFZcsXNyebU+N9U61rkOg5YkhpNEy8BAetY3orTfMjSg?= =?Windows-1252?Q?Gu010RM9D5i+UDqWm9aUcNvJPR4m72JO+2GL7fDpD426Hu2BHSlJ9rgk?= =?Windows-1252?Q?/fgvOUFjeVAJeO5LrrXYGJ4PnoeHrsdOFqPxw5lN4Onxws33DXmOM3VF?= =?Windows-1252?Q?RtmIjTklQZscYSVKXhkDEEkK0WDZxSJGL2wHdYsTydBMGe0h9g022BsA?= =?Windows-1252?Q?vOgykUcPoP4CtWpr0ABpa6+j9xXBQhrGUyRNltJvUeD1Qo3GZyERg9yR?= =?Windows-1252?Q?38326tKZk79jacp/w03BIsgBru9/ghB/Th3lim8ERuRYeh2z/MrgkmOU?= =?Windows-1252?Q?6iMvZM/ZQhgayR+ioufRFir/cc6kau8SaYwpZGzdkjZkzX08immuql2f?= =?Windows-1252?Q?2DaSoaHsY+LlgHt2UhttGQM58st5Xjek51ylqdOD+h9ey4LSRxNf/+jW?= =?Windows-1252?Q?mPF6msYHBNG6YifQhLm?= X-Microsoft-Exchange-Diagnostics: 1; DM5PR03MB2698; 6:l8cU+XyLo0pDFZpCVui94OXYxmaagJcVfumobesX6GrActYZhF+7wo/wFc1ievmAytWGtFj22pmcWuMrRjMGyligGdKg17wQ3ArU0TM9mwW8FeUaCLyF5jfX4zD6S8fk+U3+OlYs6kltOWIFxfB5SmBxDXXuYNWGkl5xDWPbEqwJKJ6VCskQ86TvP+xgBdckJsdTTwwEzam0R/wldJ92PF2AXxLQjKo0BZJKRZPb0QGnzsnSUTyBg+GibTpbII5ZRkosOs9J/BCViE1/uuAVZXXh5uu/cgauaAUxbJhqfJCJS+MLW2PCu3qUWM2MPWcrKSmadb+WZoYHUErKEKY+LYs+GO5sHnkPhKVqnbNu8CI=; 5:f8dh+1IYQ+GJEILNSowBfwFQ+YoUhL1RwyA1TOG25xvECwOM+geiPz8oEX5Pidkgld/e6cRJua1HruyqEy/g6+aw9Rw/9+Fye+T93FeCcPeCtFUPfRQBUykuUDO2cJgpgeeTz06W2vy8f/iN/4z9FyHW/ntOrzYATzO2rm0zMNk=; 24:32cEHnXyk5Sc/trCdf/TebQz+5h+3/61GpxwKYsGHpQceWVo/oQZr0rv/ipF0eHUryOab0FQIV59zxq9KCAyqORbsznPuTI7IdtH/JvqbFE=; 7:+Fcfl+9+Zo/luN0SzlGlNGvaLLaElqX6/kRfuBrnrVz1BMlnHQ+WG8/HzjllIWKEf6r0PUSUSXsfGKAXqh72mAqW4mmmSYyOiBI9AEUnd8D9ByjndDyQA4/24nnCxFNm/4ahLiSulbaSkKDnoHeePlh1EXEPSLYDfh2F9S+9jcV/a+t+h0S6WxcwZ89fyYAsr7L79j6I58IQnWvtnpo5zGQmxz3mr2nBWaRtbdAqFmiUMQewANfDDWVynfPbYNo/ SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jan 2018 12:41:50.6213 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2de84072-51f2-47cd-3b9e-08d55f3a0324 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: DM5PR03MB2698 Subject: Re: [dpdk-dev] [PATCH v3 3/7] mbuf: add pool ops name selection API helpers 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, 19 Jan 2018 12:41:53 -0000 Hi Olivier, On 1/19/2018 3:31 PM, Olivier Matz wrote: > On Thu, Jan 18, 2018 at 06:56:28PM +0530, Hemant Agrawal wrote: >> This patch add support for various mempool ops config helper APIs. >> >> 1.User defined mempool ops >> 2.Platform detected HW mempool ops (active). >> 3.Best selection of mempool ops by looking into user defined, >> platform registered and compile time configured. >> >> Signed-off-by: Hemant Agrawal >> --- > > ... > >> --- /dev/null >> +++ b/lib/librte_mbuf/rte_mbuf_pool_ops.c >> @@ -0,0 +1,68 @@ >> +/* SPDX-License-Identifier: BSD-3-Clause >> + * Copyright 2018 NXP >> + */ >> + >> +#include >> +#include >> +#include >> +#include >> +#include >> +#include >> + >> +static char *plat_mbuf_pool_ops_name; > > I have some doubts about secondary processes. > > Maybe it's ok if the loaded driver and eal arguments are exactly the > same in the secondary process. It would be safer to use a named memzone > for that. > Typically a secondary process should not set the platform mempool name. I can also add a check to know if secondary process is trying to do it. Yes. I can change it to a named memzone. > It would be even safer to not use secondary processes ;) > > >> + >> +int >> +rte_mbuf_register_platform_mempool_ops(const char *ops_name) >> +{ > > We have "register" for platform and "set" for user. > I think "set" should be used everywhere. > ok >> + if (plat_mbuf_pool_ops_name == NULL) { >> + plat_mbuf_pool_ops_name = >> + rte_malloc(NULL, RTE_MEMPOOL_OPS_NAMESIZE, 0); >> + if (plat_mbuf_pool_ops_name == NULL) >> + return -ENOMEM; >> + strcpy((char *)plat_mbuf_pool_ops_name, ops_name); > > If strlen(ops_name) >= RTE_MEMPOOL_OPS_NAMESIZE, this may lead to > bad behavior. > That should not happen, we can check that. > I suggest to simply do a strdup() instead. Well, strdup based string will not be readable/accessible from the secondary process? > > >> + return 0; >> + } else if (strcmp(plat_mbuf_pool_ops_name, ops_name) == 0) { >> + return 0; >> + } >> + >> + RTE_LOG(ERR, MBUF, >> + "%s is already registered as platform mbuf pool ops\n", >> + plat_mbuf_pool_ops_name); > > So, this log means that a we should try to never have 2 drivers registering > different platform drivers on the same machine, right? > > So this API is kind of reserved for network processors and should not be > used in usual PCI PMDs? > No, PCI PMDs can also use it. But only one registration allowed for now. As I mentioned in the cover letter: ~~~~~ This logic can be further extended with addition for following patch, which is still under discussion. The ethdev PMD capability exposed through existing rte_eth_dev_pool_ops_supported() to select the update the mempool ops with some "weight" based algorithm like: http://dpdk.org/dev/patchwork/patch/32245/ ~~~~~~ > >> + return -EEXIST; >> +} >> + >> +const char * >> +rte_mbuf_platform_mempool_ops(void) >> +{ >> + return (const char *)plat_mbuf_pool_ops_name; > > cast is not required > >> +} >> + >> +void >> +rte_mbuf_set_user_mempool_ops(const char *ops_name) >> +{ >> + rte_eal_set_mbuf_user_mempool_ops(ops_name); >> +} > > Instead of calling the EAL API, we can set a static variable as > for platform ops. > >> + >> +const char * >> +rte_mbuf_user_mempool_ops(void) >> +{ >> + return rte_eal_mbuf_default_mempool_ops(); >> +} > > And here, I suggest instead: > > rte_mbuf_user_mempool_ops(void) > { > if (user_mbuf_pool_ops_name != NULL) > return user_mbuf_pool_ops_name; > return rte_eal_mbuf_default_mempool_ops(); > } > > i.e. rte_eal_mbuf_default_mempool_ops() remains the ops passed as > command line arguments. > > >> + >> +/* Return mbuf pool ops name */ >> +const char * >> +rte_mbuf_best_mempool_ops(void) >> +{ >> + /* User defined mempool ops takes the priority */ >> + const char *best_ops = rte_mbuf_user_mempool_ops(); >> + if (best_ops) >> + return best_ops; >> + >> + /* Next choice is platform configured mempool ops */ >> + best_ops = rte_mbuf_platform_mempool_ops(); >> + if (best_ops) >> + return best_ops; >> + >> + /* Last choice is to use the compile time config pool */ >> + return RTE_MBUF_DEFAULT_MEMPOOL_OPS; >> +} > > I like this function, this is much clearer than what we have today :) >