From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-BL2-obe.outbound.protection.outlook.com (mail-bl2nam02on0065.outbound.protection.outlook.com [104.47.38.65]) by dpdk.org (Postfix) with ESMTP id B98BEDE0 for ; Sun, 11 Mar 2018 13:51:53 +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=2jkBmhdDULQkQXz+pkLtd9pOL0Bx/DvIMFJ15akUTDs=; b=A0YGPglsWrKC6sAhfVVoSSbY+sfxzC3MlGfLVdtzXjFoHsCRdJxjQYCZNdJNV/lXKBxj2NYkEzHgSN2XM1ikWyLnx+li/IOFtSFIahwTFTOanovg+IFEupM60tQhu/1te0jWfIwGiKqkd8DTPuDh/ZVUWCv571h8LVkb+bNLy1Y= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Santosh.Shukla@cavium.com; Received: from [192.168.0.106] (103.76.56.167) by CY1PR0701MB1900.namprd07.prod.outlook.com (2a01:111:e400:51df::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.567.14; Sun, 11 Mar 2018 12:51:49 +0000 To: Andrew Rybchenko , dev@dpdk.org Cc: Olivier MATZ References: <1516713372-10572-1-git-send-email-arybchenko@solarflare.com> <1520696382-16400-1-git-send-email-arybchenko@solarflare.com> <1520696382-16400-2-git-send-email-arybchenko@solarflare.com> From: santosh Message-ID: <9616c281-5a6c-c9fa-8346-bccdce9df7cd@caviumnetworks.com> Date: Sun, 11 Mar 2018 18:21:33 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <1520696382-16400-2-git-send-email-arybchenko@solarflare.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Content-Language: en-US X-Originating-IP: [103.76.56.167] X-ClientProxiedBy: KL1PR0601CA0004.apcprd06.prod.outlook.com (2603:1096:802:1::14) To CY1PR0701MB1900.namprd07.prod.outlook.com (2a01:111:e400:51df::30) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 9d57fd2a-6ddd-4961-b607-08d5874edbd3 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4604075)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:CY1PR0701MB1900; X-Microsoft-Exchange-Diagnostics: 1; CY1PR0701MB1900; 3:ZXrHL54yUe5l35XS5eVApat4GGu4HDiyOZLwuFa+DOrrVv6u8BHqHV9i2TrLW1NPOiF42/nMaD/QGKosDdKjxzmMD5QmQ86mfCdAqRBXJ+vtaltvv9cXD2TDlbsDQONzHPkuNcLQbnGijaYEbyqn5J8LGuL0qOQqf3QWUoy3SNutg/FVbQ/bZmhUDjOcGaw1ndq6ZsnEmpXWnsw6UDKdma8i6Njjp3fG/NDvBuJJDopiz5qjqrokiEXjjhSca5C5; 25:OxlPc8I2D3zWGU6KUAtN9LCOckerhJmG06rn8yCodthUAA8t0uJ0eLzsWKE3PzKicszlOmRTsEyo79uSfsrjHcFEor2fsRwQfsithxPN3dMHtEU3/Qe6tltatqD51Rz5AkfBHuOPwf48VhGwXyARFnVMRuzKK6fkbC2klf5Q5+uonXoBA0NlFrM7tVpyYR0QAR+ja7U27KFA3uAjvDh5CIeibGyY/KGVd1p/5b7AqNoILRnE208DYkdxhZH5nvhclphdEujjEeoHiOm5Suhzjler51F9Us0vdFWvvA4vdN+isrvKvJ8GUoOrs0Osq3Re4Sj3VDEdwdZN5ch1DJF7PQ==; 31:fUORzUy/JEFEtz3mResJkzYIwtPui09+Zs5NYjhgQlzqaqVaiGylUiiZzS0oXmB4dfnrkF/bB/IH+7knfzrzDcNk8ptx8OHoZAKcNtEjonchXparoAcPsRd1S4iZjc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QvKnCrVWQw== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(3231220)(944501244)(52105095)(10201501046)(93006095)(3002001)(6041310)(20161123558120)(20161123560045)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(6072148)(201708071742011); SRVR:CY1PR0701MB1900; BCL:0; PCL:0; RULEID:; SRVR:CY1PR0701MB1900; X-Forefront-PRVS: 0608DEDB67 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6049001)(366004)(39380400002)(346002)(396003)(376002)(39850400004)(189003)(199004)(65826007)(42882007)(2950100002)(16526019)(229853002)(6666003)(5660300001)(52116002)(65806001)(65956001)(97736004)(76176011)(64126003)(66066001)(50466002)(2486003)(52146003)(305945005)(7736002)(186003)(23676004)(53936002)(77096007)(26005)(230700001)(86152003)(105586002)(6116002)(16576012)(6246003)(81166006)(3846002)(8676002)(386003)(31686004)(58126008)(81156014)(117156002)(106356001)(316002)(25786009)(6486002)(47776003)(72206003)(68736007)(2906002)(478600001)(4326008)(31696002)(8936002)(36756003); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR0701MB1900; H:[192.168.0.106]; 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: =?utf-8?B?MTtDWTFQUjA3MDFNQjE5MDA7MjM6SEZlSHlxNUpLQ294RHJhN0FHSW9kZ1JE?= =?utf-8?B?b2JreCtObDc5Q0l4dndNcURHeUE4MFdaM1daZTVhWVdTa0dDWUZNNjFiaGQz?= =?utf-8?B?dXZaK084MTNkMHdwSVo2RHNBSmYvTEovWFMvcVp1cnNIY1IrdEplN25hTitk?= =?utf-8?B?bmlIcU5wUitwYVNvRUs0a1ljOWw2ME5MUUNDeX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MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Mar 2018 12:51:49.3076 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9d57fd2a-6ddd-4961-b607-08d5874edbd3 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR0701MB1900 Subject: Re: [dpdk-dev] [PATCH v1 1/9] mempool: add op to calculate memory size to be allocated 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: Sun, 11 Mar 2018 12:51:54 -0000 Hi Andrew, On Saturday 10 March 2018 09:09 PM, Andrew Rybchenko wrote: > Size of memory chunk required to populate mempool objects depends > on how objects are stored in the memory. Different mempool drivers > may have different requirements and a new operation allows to > calculate memory size in accordance with driver requirements and > advertise requirements on minimum memory chunk size and alignment > in a generic way. > > Bump ABI version since the patch breaks it. > > Signed-off-by: Andrew Rybchenko > --- > RFCv2 -> v1: > - move default calc_mem_size callback to rte_mempool_ops_default.c > - add ABI changes to release notes > - name default callback consistently: rte_mempool_op__default() > - bump ABI version since it is the first patch which breaks ABI > - describe default callback behaviour in details > - avoid introduction of internal function to cope with depration > (keep it to deprecation patch) > - move cache-line or page boundary chunk alignment to default callback > - highlight that min_chunk_size and align parameters are output only > [...] > diff --git a/lib/librte_mempool/rte_mempool_ops_default.c b/lib/librte_mempool/rte_mempool_ops_default.c > new file mode 100644 > index 0000000..57fe79b > --- /dev/null > +++ b/lib/librte_mempool/rte_mempool_ops_default.c > @@ -0,0 +1,38 @@ > +/* SPDX-License-Identifier: BSD-3-Clause > + * Copyright(c) 2016 Intel Corporation. > + * Copyright(c) 2016 6WIND S.A. > + * Copyright(c) 2018 Solarflare Communications Inc. > + */ > + > +#include > + > +ssize_t > +rte_mempool_op_calc_mem_size_default(const struct rte_mempool *mp, > + uint32_t obj_num, uint32_t pg_shift, > + size_t *min_chunk_size, size_t *align) > +{ > + unsigned int mp_flags; > + int ret; > + size_t total_elt_sz; > + size_t mem_size; > + > + /* Get mempool capabilities */ > + mp_flags = 0; > + ret = rte_mempool_ops_get_capabilities(mp, &mp_flags); > + if ((ret < 0) && (ret != -ENOTSUP)) > + return ret; > + > + total_elt_sz = mp->header_size + mp->elt_size + mp->trailer_size; > + > + mem_size = rte_mempool_xmem_size(obj_num, total_elt_sz, pg_shift, > + mp->flags | mp_flags); > + Looks ok to me except a nit: (mp->flags | mp_flags) style expression is to differentiate that mp_flags holds driver specific flag like BLK_ALIGN and mp->flags has appl specific flags.. is it so? If not then why not simply do like: mp->flags |= mp_flags. Thanks.