From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-CY1-obe.outbound.protection.outlook.com (mail-cys01nam02on0046.outbound.protection.outlook.com [104.47.37.46]) by dpdk.org (Postfix) with ESMTP id 2BED27D53 for ; Mon, 4 Sep 2017 17:53:05 +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=mXnY0jRfXXhrGv+kChPglNsaNno5G9aBhYXur98mwQw=; b=EhMf263kIiwZCbfPLOB7BHPHLju1ZNXuw5cLISh3RMLlhIZRoAi+uFiXIzQAkj1B/1zYIZ7Gu5ifhHxighyC5gpheOwNAUWynQuvvbs7fEf0zlShXAT1Bazu0zUbvvROdWlQWQSZ5oQ4/8VNIt37YaQ4MK+Vc4maOiZLs1TVlck= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Santosh.Shukla@cavium.com; Received: from [10.89.1.1] (14.140.2.178) by BN6PR07MB3090.namprd07.prod.outlook.com (10.172.105.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.13.10; Mon, 4 Sep 2017 15:53:01 +0000 To: Olivier MATZ References: <20170720134759.4680-1-santosh.shukla@caviumnetworks.com> <20170815060743.21076-1-santosh.shukla@caviumnetworks.com> <20170815060743.21076-3-santosh.shukla@caviumnetworks.com> <20170904142232.jri222kqnvc5sorv@neon> <20170904144636.7kot5gcvpv3w5k4a@neon> <3d57f862-4005-79e7-4732-ae03dd0b6399@caviumnetworks.com> <20170904152316.nw2x5vo3qhociqg7@neon> Cc: dev@dpdk.org, thomas@monjalon.net, jerin.jacob@caviumnetworks.com, hemant.agrawal@nxp.com From: santosh Message-ID: Date: Mon, 4 Sep 2017 21:22:43 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 MIME-Version: 1.0 In-Reply-To: <20170904152316.nw2x5vo3qhociqg7@neon> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-Originating-IP: [14.140.2.178] X-ClientProxiedBy: PN1PR01CA0096.INDPRD01.PROD.OUTLOOK.COM (10.174.144.12) To BN6PR07MB3090.namprd07.prod.outlook.com (10.172.105.8) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: bfcc4c0c-a791-46e6-7318-08d4f3ad0693 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(300000502095)(300135100095)(22001)(2017030254152)(300000503095)(300135400095)(2017052603199)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095); SRVR:BN6PR07MB3090; X-Microsoft-Exchange-Diagnostics: 1; BN6PR07MB3090; 3:y+Z5ajhGepmNhDYbJt4UMhd5FWUCB2s+oqodAD7ZwF5VPkHbNXY53kYKNYdTsFyAlF5rDyOjiBNACNDQjth6L3/rTMTHD/tLk0hyKxxeikjsmAX7sOL50giXL9bvxKPaEAixys/qcbfFb0Thy4Gtt+hMq17A79YlNwcv6G5tZkBCyOUsApJr7h/6HS+35aUHLg7Djf8hD2JqcFCX5s7JmopJsbAGG6wP2PpxnXeGwhoiPOJ8XPyIb/hLN712/2X5; 25:228j+g+gXu1AeyvMJNFywqTe5yJ+ZhvSVs54wfmiLe+4rDT81pb8eJSgwjNfkp3uUBkN15npSDMEcMaoGIbV13rxu1Bc5ZOVzfJs6RDHMQ/GD5MpXdvooLNlfJcTHsvEXRvASxhRhnrWqB+fEl8QU2wr7eLgHGNeOPuucMlh7GMqJ/9anyCusqfGHsVwU712fRRUjiIzwt98TJu9u5dz6qK2MBIVilh/X9ozwAaYe6GGlBGz1TL7H2SHEOh6jqQ4hVxVoDzixbaqxYQYGWjMhteRSQNXqk5lh4RU/QSmD3fVW8V/uIo4TtbKR9aVojc/ZNl7RJ454vG78W1fwojmSg==; 31:7KK3K7cz439iUt1AvOQVYV9QzAR1jFozevHnFizg71m7w4nm7r53uB0RjkMFNM2XIBNZXfF9EShVKztAPyKfKEvWoh34c9n2HaHJZDlrB5AG4weI9A4O7va8N9UxFkOd94R4r5TKtCvkmalatR1W9ZC9o+kI/M+Vx0mltIx0lefKkLfztPFpF2jigxLl63O5QVGnS9gIMC7qMPJHoHdASikMn3WG++UNg2DBuhOe2rE= X-MS-TrafficTypeDiagnostic: BN6PR07MB3090: X-Microsoft-Exchange-Diagnostics: 1; BN6PR07MB3090; 20:ZhMc7773XZWoAp66D6z/9LpibB4Y7pWUHukwC6xLM1KTFVa+Gr68oJVE89eLCJWeNkbY1EQmFI2ktvA+6bY8/w0eOIANgNUsYFHZMGvMc1xIzVkSlcVUieBgSaNdEtYtp3vWbh9S3bnNuDEVUooYrIJVoPz9V3pNMN54wKgnUPLlUE3gIJyLTYLdFHESpO35C7j/Xo7E1EJ6kAGlu67naZgmZzpF86GmNih4bgMUmYQ1FWFuZoYC4p2oEdXUHWu0rQY9X0NLLxA5wRMf1hgoLJ4M5ckJ/GPgW4iyhlPR7TFyfVojIib6jFw+/GHFwe4w0iuzrg2AFyCco2zj38id8BIxz4humb3kpqEBzbTflizs7kBvJgCIiwfmaVQ3wo35O03mAItA8MXArmQptdI6Xv3MARwT0iO+vK7bsYQjyRii4c9/3NmD/YtRUKomTJUhI2narRFVVGMo26ZAtAMJv6ahC7cdX6DMfR2BPSBDJRpr6RFfIQOnOINMOp7TOUkOl3wzTeCPN6m36d8hERN/kmYPMBpivD861ZHHD0thG4lsLhLWP2CFiFGif04WKLpz421wDssB13l9oXn52pILFd5S5lppxjK7Dn8bblH8MvE=; 4:jwrkz30IoZwzJ9dPuIa7ZDCtd4xboqTQszHE0WRMi7Pf4wDMUBMPVnCS5gsHt0sRHI0P2XN423vHFZs/X0avczBrMMNVNj1BWK1vuYkC49VCwond3jc3BXxxHp0XXPINx2rzdGPtfO72083k07Q7s2XU8xmM/RDiaBV77FBG3D61xtgmxaewsBba06o/8Rn6krKZFLRMeMGIBvH9peN2aJF5owCjqmvC32ET6g5VrAJVAo7vTl0uELwvFKNEErPG X-Exchange-Antispam-Report-Test: UriScan:; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(8121501046)(5005006)(10201501046)(3002001)(93006095)(100000703101)(100105400095)(6041248)(20161123562025)(20161123558100)(20161123560025)(20161123555025)(20161123564025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:BN6PR07MB3090; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:BN6PR07MB3090; X-Forefront-PRVS: 0420213CCD X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6049001)(6009001)(377454003)(189002)(199003)(24454002)(8656003)(189998001)(83506001)(36756003)(33646002)(64126003)(66066001)(65806001)(5660300001)(47776003)(3846002)(6116002)(65826007)(2906002)(4326008)(230700001)(23746002)(6486002)(65956001)(50466002)(90366009)(68736007)(5009440100003)(72206003)(77096006)(42186005)(8936002)(106356001)(25786009)(305945005)(6246003)(6916009)(4001350100001)(105586002)(31696002)(50986999)(76176999)(54356999)(2950100002)(42882006)(6666003)(575784001)(101416001)(31686004)(8676002)(229853002)(110136004)(97736004)(7736002)(53936002)(86152003)(81156014)(81166006)(93886005)(478600001)(110426004); DIR:OUT; SFP:1101; SCL:1; SRVR:BN6PR07MB3090; H:[10.89.1.1]; 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: =?Windows-1252?Q?1; BN6PR07MB3090; 23:GquW0wtKu1Nr4PAlf1gNaizbjkarT+YI9dB4J?= =?Windows-1252?Q?3Eho1EO0eE178NSzGbyFlvNDNWwH2Cq7dntufTDUlczN1M0LJjaON556?= =?Windows-1252?Q?PEin9yIE4+N2h8T2RDnGanUWzyfjyVbGRJD/ne+NqWH+5yHW2JsUFG8r?= =?Windows-1252?Q?5k2cJ0k5SqFmnXllakJ+3a4wFtxeCBCXKjweFI1cih367nnpvaWKH0lu?= =?Windows-1252?Q?WRanxAZ1raAAuwsY1gKfDtIOREYk+qUuW1FDXGVPjDWMzMNQnKkL6bM7?= =?Windows-1252?Q?KPPOw/EFqfQzv5cZdHUjO7coWsYFs+shPmzWmu+6BauStkQcnOIqlZjZ?= =?Windows-1252?Q?a0/X5j5ISnXIaI7IyxGIo3w+tGbHEKgETxLgVtoS9ZpgNxe/ICA7MDmg?= =?Windows-1252?Q?1kyf+Ygf+trNV7yyAw7QP9rFoOf6HrH26AEcWIqYxpO52VJ9IJXEXCqX?= =?Windows-1252?Q?4rXnqMcYNbtlDeG+0t4EGpgcQs9cHE1hqyDos0U4kEBARQdLuBpcyzQP?= =?Windows-1252?Q?+BugO2zwLgbVV6o7eCPw00KsyQI+f8yHB3h7p1OnrZsWH4PPRl4XaKkV?= =?Windows-1252?Q?s5aP1hVbHIyfXgE84ia+4b8qMuiz1Q1hC8snqVbr7rpflT37x8dIeny2?= =?Windows-1252?Q?er0Em3NduZqZ8uXgs7zf71fZWVAXyv4qHlPsu6O5leZVd0M41tTwQPDk?= =?Windows-1252?Q?k76BRcDqIp06/559K5MeHjatsjzFW4dF1wv1W8WZvDiuSaEsVsiTwLAy?= =?Windows-1252?Q?EvPzLx7TegBqRw6LVrXVqlYcLgoGAWikuwFIjq/u8edCk4/g2givRV7Y?= =?Windows-1252?Q?9wHsKRm6NaFO9KLApWLNh/ZszI237nwXMWh/+lMosrLDJWTk8XzyksVv?= =?Windows-1252?Q?3RIqou5x/CCYD3Q7RO1pyaiyIyiQBvmQ9GROdULYJuFAMoAPehivQ++g?= =?Windows-1252?Q?F50b3rehX5kEZitJjJKGtpvPehwQiJMGPCztogHyR93J59dVllceGRsI?= =?Windows-1252?Q?5ZvoMrZbH7OuIyv5mo8KEJOHh+AxF9avM5kLeG1iauqkKWMMB8YPW4wY?= =?Windows-1252?Q?WjMKuBRtkxiJ2wPCusIh4NB9rSO8G7yXajwOBKsINfz732ShSz15l6Iw?= =?Windows-1252?Q?5xF/vde7D73EJW2SWeUx97rDwGD6KETDiW9ISbDSakckxcrtIxkAKz+4?= =?Windows-1252?Q?0t2YtN8MjirFBqtMsp7CYkJrFW+ZcM8kQHlgy8iq3xHXU2nJ7RUSJv6B?= =?Windows-1252?Q?qYLLLAohC+doov54yvgkQdzmDTZJlYEzpycIZN2sERm8fpou0KPdwWyJ?= =?Windows-1252?Q?drIhEvUJdlT2QW/8PHpHuXdHSCB1oFN6zGobmicppxMS8r3X4xqvOw5/?= =?Windows-1252?Q?B+6xbyNVpDygVyZH4Dv2IYVrjlkIYSbXp9+bmpANUlaj/ZRUmgyzY0bg?= =?Windows-1252?Q?DehUl7W40S6BD6W5npkMnpdd68l82qY7Qi3ydkfTp/oqmYivpcm/vL/g?= =?Windows-1252?Q?1GbZ7kYX32FCDQSk3rYCBG4xwenASrTW2XK8CKx2ZmyjtuE9FwHPJoTV?= =?Windows-1252?Q?s+0mHgHhXPCyKKRo16FFkfTjHzzOD+Jw04B?= X-Microsoft-Exchange-Diagnostics: 1; BN6PR07MB3090; 6:vvwpljO8owLfJsJTVBqo3toHSyiQCMi9zZKeKllKA+X9XE8gi0k5fcM5vClWyqAwzCm0fmEocHoR9JNXm1A1BYQpDmjNrFgOm1j/824e2xpuWqX/K81xFPanTFWqTL+lCgIfc/YGfjjDj+iF+HP7i09ME/vma8NndpF35Xjt7Pet/3wjDfBXk7Dnv7jhFQWzijLfX2bwgm0571+KwLUI2PkEgRNhfbTXogeNuFUHd120W7xPHcb1UPXEW/5zLCN0X6BbMA7xpyo0TfgknNKzdWtV2y3ddGWe/+rR/P3zwsRznOZK1lKDVtqkEy8+5VY26nL0eVih6hNXzgW63lJycA==; 5:o1zCYkSFsPlM0X8vnodu++97hepXkHm7AU7hhNQYZsLY8jZopt0w2jVTUZ94bCemvw10DweIY8IHiEP/OfWpz8gSQqm5/ofswhoDUwnX4f69M2s6xJD8hiw4udjJIQQBPLUd2+IVRSrPCn1a/PCaYA==; 24:6GVpvkJJ7095AGmAGyzZs7aO8i/LP7G58XTKHlInGag0gm+QT3gSzWXubj4MuDUgt1qdloFjxozHd/QQwSQw0YgIfbm7xEmltiV6Yr3IPYA=; 7:lpQ9hhUkiv19R/moVtJ28Flucpz2mh4M5p1+INufD49m24g7dh7tlDQpRsRtkJ6IU6Ur7dk88V0I429KyxpqCS4WEWSJ9ZcyPl3n02wRTe+k/0Nh/44RyQHO+W9xBKagV2FublMv6g256C3rcHMDGolvVEowgJOpyLODdtZzyq2T0IduaXBBXTHkzEo3ienLqH//wU3h/20Wwki4/X2wcnQWkoU0bvgCr3vQTFEhp4s= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Sep 2017 15:53:01.2550 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR07MB3090 Subject: Re: [dpdk-dev] [PATCH v4 2/7] mempool: add mempool arg in xmem size and usage 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: Mon, 04 Sep 2017 15:53:05 -0000 On Monday 04 September 2017 08:53 PM, Olivier MATZ wrote: > On Mon, Sep 04, 2017 at 08:28:36PM +0530, santosh wrote: >> On Monday 04 September 2017 08:16 PM, Olivier MATZ wrote: >>> On Mon, Sep 04, 2017 at 08:03:53PM +0530, santosh wrote: >>>> On Monday 04 September 2017 07:52 PM, Olivier MATZ wrote: >>>>> On Tue, Aug 15, 2017 at 11:37:38AM +0530, Santosh Shukla wrote: >>>>>> xmem_size and xmem_usage need to know the status of mp->flag. >>>>>> Following patch will make use of that. >>>>>> >>>>>> Signed-off-by: Santosh Shukla >>>>>> --- >>>>>> drivers/net/xenvirt/rte_mempool_gntalloc.c | 5 +++-- >>>>>> lib/librte_mempool/rte_mempool.c | 10 ++++++---- >>>>>> lib/librte_mempool/rte_mempool.h | 8 ++++++-- >>>>>> test/test/test_mempool.c | 4 ++-- >>>>>> 4 files changed, 17 insertions(+), 10 deletions(-) >>>>>> >>>>>> diff --git a/drivers/net/xenvirt/rte_mempool_gntalloc.c b/drivers/net/xenvirt/rte_mempool_gntalloc.c >>>>>> index 73e82f808..ee0bda459 100644 >>>>>> --- a/drivers/net/xenvirt/rte_mempool_gntalloc.c >>>>>> +++ b/drivers/net/xenvirt/rte_mempool_gntalloc.c >>>>>> @@ -114,7 +114,7 @@ _create_mempool(const char *name, unsigned elt_num, unsigned elt_size, >>>>>> pg_shift = rte_bsf32(pg_sz); >>>>>> >>>>>> rte_mempool_calc_obj_size(elt_size, flags, &objsz); >>>>>> - sz = rte_mempool_xmem_size(elt_num, objsz.total_size, pg_shift); >>>>>> + sz = rte_mempool_xmem_size(elt_num, objsz.total_size, pg_shift, NULL); >>>>>> pg_num = sz >> pg_shift; >>>>>> >>>>>> pa_arr = calloc(pg_num, sizeof(pa_arr[0])); >>>>> What is the meaning of passing NULL to rte_mempool_xmem_size()? >>>>> Does it mean that flags are ignored? >>>> Yes that mean flags are ignored. >>> But the flags change the return value of rte_mempool_xmem_size(), right? >> no, It won't change. >> >>> So, correct me if I'm wrong, but if we don't pass the proper flags, the >>> returned value won't be the one we expect. >> passing flag value other than MEMPOOL_F_POOL_BLK_SZ_ALIGNED, wont impact return value. > That's the case today with your patches. > > But if someone else wants to add another flag, this may change. trying to understand your point of view here: - We have 64B wide flag and if new flag introduced, considering new flag sets bit in 2^x order then 'if' condition in xmem_size() will fail and elt_num won;t increment thus won;t impact return type, right? > And you do not describe in the help that mp can be NULL, why it would > occur, and what does that mean. agree, It meant flag ignored in below particular case where upper xen driver API ie.. __create_mempool() is calling _xmem_size() before pool create (valid case though). >>>>> Wouldn't it be better to pass the mempool flags instead of the mempool >>>>> pointer? >>>> Keeping mempool as param rather flag useful in case user want to do/refer more >>>> thing in future for xmem_size/usage() api. Otherwise he has append one more param >>>> to api and send out deprecation notice.. Btw, its const param so won;t hurt right? >>>> >>>> However if you still want to restrict param to mp->flags then pl. suggest. > Yes, it looks better to pass the flags instead of the mempool pointer. ok, queued for v5. Thanks.