From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-CO1-obe.outbound.protection.outlook.com (mail-co1nam03on0077.outbound.protection.outlook.com [104.47.40.77]) by dpdk.org (Postfix) with ESMTP id AC144199A9 for ; Thu, 7 Sep 2017 10:57:07 +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=/07QZhTsqoQpeSrmNyLWF6/L41faQctWqslAbjrw7y8=; b=g9SGorLTOTAYyyVOn3ZbiRT3PhzKTvWwXilS5FeW9WpgkJRizL5mVpS6uv4QptpREGfgIwhj56h9vvaZLgbAh471hXtyW/TnGQMKno+d6pYfpK1c7SwQia4s13r7QZzz9J2cuzdO7hyKRuUgVNRSU4mmJrWbjiMzjoDjl10xnoo= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Santosh.Shukla@cavium.com; Received: from [192.168.0.105] (103.76.56.167) by DM5PR07MB3099.namprd07.prod.outlook.com (10.172.85.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.35.12; Thu, 7 Sep 2017 08:57:03 +0000 To: Olivier MATZ References: <20170815060743.21076-1-santosh.shukla@caviumnetworks.com> <20170906112834.32378-1-santosh.shukla@caviumnetworks.com> <20170906112834.32378-9-santosh.shukla@caviumnetworks.com> <20170907082959.lfrkdp4mcg3qpb4r@neon> Cc: dev@dpdk.org, thomas@monjalon.net, jerin.jacob@caviumnetworks.com, hemant.agrawal@nxp.com From: santosh Message-ID: Date: Thu, 7 Sep 2017 14:26:49 +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: <20170907082959.lfrkdp4mcg3qpb4r@neon> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-Originating-IP: [103.76.56.167] X-ClientProxiedBy: HK2PR04CA0058.apcprd04.prod.outlook.com (10.170.154.26) To DM5PR07MB3099.namprd07.prod.outlook.com (10.172.85.9) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 5ab86264-800f-4056-96bf-08d4f5ce69ea X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(2017030254152)(300000503095)(300135400095)(2017052603199)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095); SRVR:DM5PR07MB3099; X-Microsoft-Exchange-Diagnostics: 1; DM5PR07MB3099; 3:rT4cuAoZHLoreVjW5hGRDFqc2fClRMMkIFUoXKKRP2SkUxGnRyeqhJP4ScGOyM3bgd1MiJVoyQCqYJxBOKVkyggb9gJnDhcLFtlElDs52d3rpQUhlEpTTa6rpUe8mxNLqULpIkzipXcqz51l0Logy7hpMSBJGiZc0mwey2JYPSltDkxATzOuiothFKcGNCNNeAisMsvwSiGTLGT5JUvoDIrcExVpmShU9vpVapZ3mtl8ZCRROcZRnrIMxKpBgkS/; 25:dRz6TT4Fr+U6lEeqL7J6ICkxmLgnmniaMisfiQAKDhcuFBpLVOZMxdHqNyWZdR/n+UDqhb5xrlBkBCRqCd8QxAhGhXP8sn5QmAXD2KI1143BxEuOHzN9joWjWA3E3xjlUEnH4dcEd0/jklgi1Duh+ShXHko5DWIZJv0wTXvF4CryDqHbjUPa0XtLdDokshgd1hKpvxGdd2GqatgP4uLvL0uHX/oKZQUG1cyhM+reAxxA2GGUJxaqUv5BdOCn8/t//SaosSL9kt46XO3GrQVIwf9whF0D/ZIaFa5jRdnoHAI0q/UINnqQX5KXDK87vBgyUZCq/4R5aBjwUP9qfKOZGw==; 31:iN5+jykuFq2GSs5K0volyoqCC5zXLAnkThUo44ym9vv5S/9ntR0KBtnE+OKqwH+ad0nEd/fkYzrjQumh2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67+TAPRsBVK6QvpMQvmQ8eT8hr0II1sgUlZd119Pz 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)(93006095)(10201501046)(100000703101)(100105400095)(3002001)(6041248)(20161123560025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123555025)(20161123558100)(20161123564025)(20161123562025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:DM5PR07MB3099; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:DM5PR07MB3099; X-Forefront-PRVS: 04238CD941 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6049001)(6009001)(189002)(24454002)(199003)(377454003)(25786009)(42186005)(53936002)(106356001)(5660300001)(83506001)(86152003)(23746002)(81166006)(31696002)(6916009)(2950100002)(72206003)(42882006)(31686004)(81156014)(68736007)(15650500001)(6116002)(105586002)(230700001)(3846002)(50466002)(6486002)(8676002)(4326008)(110136004)(229853002)(90366009)(66066001)(101416001)(65806001)(7736002)(65956001)(50986999)(2906002)(97736004)(478600001)(305945005)(65826007)(77096006)(4001350100001)(76176999)(54356999)(93886005)(6246003)(117156002)(64126003)(6666003)(47776003)(8936002)(33646002)(8656003)(36756003)(189998001); DIR:OUT; SFP:1101; SCL:1; SRVR:DM5PR07MB3099; H:[192.168.0.105]; 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; DM5PR07MB3099; 23:Pf8hGPkA63OGJQLBaCQz88jg3+SoyzMj39Rip?= =?Windows-1252?Q?5NJ1kQaQ9jG2ERRzpvplAG5kxdbKvhlrvI6/P2E8BZI71EWXefjAz81D?= =?Windows-1252?Q?UyWjgjFM6ZT5UQcbqKo7nQoDCArES3wnCJVCbPV0tf8Sv5WT0Hzl0Nir?= =?Windows-1252?Q?3boCkdW/lBSRpwdC4h3pwtiLuZSZXTplZ3cImDYFKFI98SrkmrWi027U?= =?Windows-1252?Q?vXE2v25l948LSOXiNFZZ8YynK7ClXOgfepsX2E5P5Lhrz0NSN5+iflTI?= =?Windows-1252?Q?StUUKPHcz5+5mBy1KVeqIXN77Nap4TYQvPJabv1v5WQ4DrOkC+UKD4Rn?= =?Windows-1252?Q?/nVwNrgFbd4xJxKOi3nz7pE2GrXrDReCEPoVlloFIKILHqEX44s5sGlF?= =?Windows-1252?Q?HQzVqtcW8gEY45zYIySojeMd9Gm1IxiRARJr2vl4nx6/HJnsPTYgu2Cm?= =?Windows-1252?Q?Z/pedzBA1IHtnro0kfYQy3NVnWFKAuoG1TedqhoD2o4MyDlTx/MKoEUo?= =?Windows-1252?Q?gvDC0J895UJa1uyLhv3Po6rrDAXxA5D1oLvw8LLjw1VE3KizRlamaPnx?= =?Windows-1252?Q?OEdqp8/r2YHQBV0CRw2zdTYYzbCqd2hh1IzNpUDEJVOv7P1XnaxhK2+U?= =?Windows-1252?Q?BjxX3KvRDWTROuZ7rOGMLgxbUeoaoG2CM/wrrfyv0UXJCtSMy+smdsX+?= =?Windows-1252?Q?ME+B5EHUyvFUCCfpeXRte2VOcaIY75S0s8NTZoZpE6AztIRWYzOoM404?= =?Windows-1252?Q?ULvu72dRxZYBnZ2GVGQvgZDgP4W5D0PG9YBXAj1r7SejSPOvHFfc6aep?= =?Windows-1252?Q?VR+JBSHHd+jl2pYzoX+dPHFtcEcPfzZl4mDSe88z2vV6oixPN/hfjYHo?= =?Windows-1252?Q?8xEPXl0wCeQc7fAO2KkgG6TDlejgEVYg0pBH/4sPJO/k3lDjzbultISY?= =?Windows-1252?Q?NkXI53RF1wl8W6UI7fQL4XDSHbuO4em8n6WbGtYkWN6//yBKNGgTY6Gb?= =?Windows-1252?Q?EQ1Q2FTLudFBgH5yp+4nC+9cshsHe3tkXMn/oTJY0mCC3z3pWGDcCEVH?= =?Windows-1252?Q?BA/6Nf7bohIhcgkZBavg1gUsN2OTkaDB/NaFCyLrxYV1EHCfyAF07SfF?= =?Windows-1252?Q?khVA2FthS5spgeDFUAsSartfEZJ2L4/TGfwc1GbiJ1zggqo80PZmhyGB?= =?Windows-1252?Q?3xruKXRmp/eIDdmDTvanzObsnM0ryX6cCHq6m0G4ET8p/FnxhHdSYLqq?= =?Windows-1252?Q?XXMWGaQIsdewbmquu6uhIoNpTtADEoeKRR8pQzJzCGaCehKM9UsuVqFf?= =?Windows-1252?Q?tuv00FOIqdUo7sS+9TQXIt7vLw4I8r6bG26mq8IdeDgQCBR0YNr2heWn?= =?Windows-1252?Q?xpNBqSQMzcrSWxOJiluEeCAJgtqd/LVZw/yLPWoIvj75YGJMe26wWQZI?= =?Windows-1252?Q?u32q81BiqDGbH14XysmJugboOnKfQw3c9rTVkOGUPZ7R8XxyYmXYChQg?= =?Windows-1252?Q?/amgiGHCARdxm3PCo9kwECdqGj7eUPaTrN5QsXogB2PVnq53v1NOMBP4?= =?Windows-1252?Q?PLQQIc0NhiVy/g=3D?= X-Microsoft-Exchange-Diagnostics: 1; DM5PR07MB3099; 6:IwzceLvAnAV8qgJtytphM8x8eS1A//4TK+ji8hblt8NnTrdaepTxwGqA/0xa0aswahmFXyVzB0L7BeEW9BvlgtD9gpjnLamHXEegqCYl/gcute8NTpAPxqG+/c4ZXuopvfZiDDg7cbKpol7lNA+sE9dZC/E3VdGw4vXluN+RLnanoGaE16LVbCbM+Qa79rTnpyfZQmWo1PEIt14GqwtEs9nIGJqIpmyZF5Ciws+LOJBA+hxTxkQ3DLrwkkeWF48EaT01fGLTRrRObBxngPj1UYA8yNYlsfccGD/DTXdTcwVgMub67eGk7t77awy6QkqhYy3gYCAo5EBJCib8m8UqoA==; 5:WPTAk0WQysHkMaSqJXdCqdGWVZPUbFo8NQcL7sds+i1/AMcziKKpawBJI1r3sUUGwMPjzgpyE5GISaElsls/AxQCfOqH4FNTY73SO516hlqo9HoXuGBqcl/kmxkj80bRwhwYffH8jIzjJAS3god0TQ==; 24:VYda6yyh2CWC1jIkVZEaec2LGN3tSheMjSYze1+Ns3/pSBGypYegZGXNfi/jPugc1+/6ECe70dbpXyCggIw/NWPPEElAXW1n6lE4oQQUy5c=; 7:TJxa3qQY0Jl3AyJJfOcQTZam4SPvygMOHjQm9eloab9xx3WlCiAAm4avQBFpgoA7BmYgCKV7hrVXurMPlZXyxCWN5MDinBi/0cRsLhJP7IErENqn40ArQYbL7Ufvnf81jXI6OB66F9tR1HeLCXWpCLIiA84pw6S6pFDVppeKtn6xJogBpnbIs1ZKoWCPt9ovKSDgW9ACIuXh/e+k+bxfdSNf7OoT2EyVFVq+n01CJpc= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Sep 2017 08:57:03.4819 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR07MB3099 Subject: Re: [dpdk-dev] [PATCH v5 8/8] mempool: update range info to 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: Thu, 07 Sep 2017 08:57:08 -0000 On Thursday 07 September 2017 02:00 PM, Olivier MATZ wrote: > On Wed, Sep 06, 2017 at 04:58:34PM +0530, Santosh Shukla wrote: >> HW pool manager e.g. Octeontx SoC demands s/w to program start and end >> address of pool. Currently, there is no such handle in external mempool. >> Introducing rte_mempool_update_range handle which will let HW(pool >> manager) to know when common layer selects hugepage: >> For each hugepage - update its start/end address to HW pool manager. >> >> Signed-off-by: Santosh Shukla >> Signed-off-by: Jerin Jacob >> --- >> lib/librte_mempool/rte_mempool.c | 3 +++ >> lib/librte_mempool/rte_mempool.h | 22 ++++++++++++++++++++++ >> lib/librte_mempool/rte_mempool_ops.c | 13 +++++++++++++ >> lib/librte_mempool/rte_mempool_version.map | 1 + >> 4 files changed, 39 insertions(+) >> >> diff --git a/lib/librte_mempool/rte_mempool.c b/lib/librte_mempool/rte_mempool.c >> index 38dab1067..65f17a7a7 100644 >> --- a/lib/librte_mempool/rte_mempool.c >> +++ b/lib/librte_mempool/rte_mempool.c >> @@ -363,6 +363,9 @@ rte_mempool_populate_phys(struct rte_mempool *mp, char *vaddr, >> struct rte_mempool_memhdr *memhdr; >> int ret; >> >> + /* update range info to mempool */ >> + rte_mempool_ops_update_range(mp, vaddr, paddr, len); >> + > > My understanding is that the 2 capability flags imply that the mempool > is composed of only one memory area (rte_mempool_memhdr). Do you confirm? yes. > So in your case, you will be notified only once with the full range of > the mempool. But if there are several memory areas, the function will > be called each time. > > So I suggest to rename rte_mempool_ops_update_range() in > rte_mempool_ops_register_memory_area(), which goal is to notify the mempool > handler each time a new memory area is added. > > This should be properly explained in the API comments. > > I think this handler can return an error code (0 on success, negative on > error). On error, rte_mempool_populate_phys() should fail. > Will rename to rte_mempool_ops_register_memory_area() and change return type from void to int. return description: 0 : for success <0 : failure, such that - if handler returns -ENOTSUP then valid error case--> no error handling at mempool layer - Otherwise rte_mempool_populate_phys () fails. Are you okay with error return? pl. confirm. Thanks. > >> /* create the internal ring if not already done */ >> if ((mp->flags & MEMPOOL_F_POOL_CREATED) == 0) { >> ret = rte_mempool_ops_alloc(mp); >> diff --git a/lib/librte_mempool/rte_mempool.h b/lib/librte_mempool/rte_mempool.h >> index 110ffb601..dfde31c35 100644 >> --- a/lib/librte_mempool/rte_mempool.h >> +++ b/lib/librte_mempool/rte_mempool.h >> @@ -405,6 +405,12 @@ typedef unsigned (*rte_mempool_get_count)(const struct rte_mempool *mp); >> typedef int (*rte_mempool_get_capabilities_t)(const struct rte_mempool *mp, >> unsigned int *flags); >> >> +/** >> + * Update range info to mempool. >> + */ >> +typedef void (*rte_mempool_update_range_t)(const struct rte_mempool *mp, >> + char *vaddr, phys_addr_t paddr, size_t len); >> + >> /** Structure defining mempool operations structure */ >> struct rte_mempool_ops { >> char name[RTE_MEMPOOL_OPS_NAMESIZE]; /**< Name of mempool ops struct. */ >> @@ -417,6 +423,7 @@ struct rte_mempool_ops { >> * Get the pool capability >> */ >> rte_mempool_get_capabilities_t get_capabilities; >> + rte_mempool_update_range_t update_range; /**< Update range to mempool */ >> } __rte_cache_aligned; >> >> #define RTE_MEMPOOL_MAX_OPS_IDX 16 /**< Max registered ops structs */ >> @@ -543,6 +550,21 @@ rte_mempool_ops_get_count(const struct rte_mempool *mp); >> int >> rte_mempool_ops_get_capabilities(const struct rte_mempool *mp, >> unsigned int *flags); >> +/** >> + * @internal wrapper for mempool_ops update_range callback. >> + * >> + * @param mp >> + * Pointer to the memory pool. >> + * @param vaddr >> + * Pointer to the buffer virtual address >> + * @param paddr >> + * Pointer to the buffer physical address >> + * @param len >> + * Pool size >> + */ >> +void >> +rte_mempool_ops_update_range(const struct rte_mempool *mp, >> + char *vaddr, phys_addr_t paddr, size_t len); >> >> /** >> * @internal wrapper for mempool_ops free callback. >> diff --git a/lib/librte_mempool/rte_mempool_ops.c b/lib/librte_mempool/rte_mempool_ops.c >> index 9f605ae2d..549ade2d1 100644 >> --- a/lib/librte_mempool/rte_mempool_ops.c >> +++ b/lib/librte_mempool/rte_mempool_ops.c >> @@ -87,6 +87,7 @@ rte_mempool_register_ops(const struct rte_mempool_ops *h) >> ops->dequeue = h->dequeue; >> ops->get_count = h->get_count; >> ops->get_capabilities = h->get_capabilities; >> + ops->update_range = h->update_range; >> >> rte_spinlock_unlock(&rte_mempool_ops_table.sl); >> >> @@ -138,6 +139,18 @@ rte_mempool_ops_get_capabilities(const struct rte_mempool *mp, >> return ops->get_capabilities(mp, flags); >> } >> >> +/* wrapper to update range info to external mempool */ >> +void >> +rte_mempool_ops_update_range(const struct rte_mempool *mp, char *vaddr, >> + phys_addr_t paddr, size_t len) >> +{ >> + struct rte_mempool_ops *ops; >> + >> + ops = rte_mempool_get_ops(mp->ops_index); >> + RTE_FUNC_PTR_OR_RET(ops->update_range); >> + ops->update_range(mp, vaddr, paddr, len); >> +} >> + >> /* sets mempool ops previously registered by rte_mempool_register_ops. */ >> int >> rte_mempool_set_ops_byname(struct rte_mempool *mp, const char *name, >> diff --git a/lib/librte_mempool/rte_mempool_version.map b/lib/librte_mempool/rte_mempool_version.map >> index 3c3471507..2663001c3 100644 >> --- a/lib/librte_mempool/rte_mempool_version.map >> +++ b/lib/librte_mempool/rte_mempool_version.map >> @@ -46,5 +46,6 @@ DPDK_17.11 { >> global: >> >> rte_mempool_ops_get_capabilities; >> + rte_mempool_ops_update_range; >> >> } DPDK_16.07; >> -- >> 2.11.0 >>