From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id BC4AB42BE5; Tue, 30 May 2023 15:32:09 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 503F440A82; Tue, 30 May 2023 15:32:09 +0200 (CEST) Received: from wout3-smtp.messagingengine.com (wout3-smtp.messagingengine.com [64.147.123.19]) by mails.dpdk.org (Postfix) with ESMTP id 8BCCD406BC for ; Tue, 30 May 2023 15:32:07 +0200 (CEST) Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.west.internal (Postfix) with ESMTP id 101733200124; Tue, 30 May 2023 09:32:05 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Tue, 30 May 2023 09:32:06 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= cc:cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to; s=fm1; t= 1685453525; x=1685539925; bh=NKH1fXj/vY/2vy3E5OhtshdSAc2hFrBOP4o 21Crk8nA=; b=LQYkjEPekyJzQBzau50EE0giIONbwbMcfYhWmVk3mKLvFb8gvt/ OOc3qUY9PWaa/vyYxpFQR0kN9hFtKkSLO95QCL5y18TilTv688bAjj0G87iCYnpH H3Vz475HKThCcjz25/FM5rGX4axFedEoaWnKKtr/j5jwSrYYe+rs9ot56fnpcYMj /9P5/Jw3VXspbksHNvPjDqKDOMElYcV3u8zRnqdNQujtGegFJr/2jx3hGLASJUzh zB7zAwCZv9hguVeb+OlgleRpWhVtV6uHCnL2Ofl4SNXym5I+o0fCKkQWd6EkQnxS M9UTvHXoSMSDqWbBY/xssQVovUADPztQ2Tg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t= 1685453525; x=1685539925; bh=NKH1fXj/vY/2vy3E5OhtshdSAc2hFrBOP4o 21Crk8nA=; b=rY0WIHov7OUaW+OjviVzqYIFLk4XpuqC0nrVlMYT7e001haNyoo 4zPHH7e6C+GaMabjNzV5ml0HhGtPjdiR5rQGHZn66vvDM3AJihkbTyUt+iidZtWd +G3o+SkdDJpnjCRIejrNCzJlp2mMq2il2LNGy5vdiRNpr8t7Ii1Ag9NAmc6ywR38 VNHPATaacW9+8HfBxq7lMTwEWjBR8Sa44jUJmdHYytXdISjBGZhfJkbvm3IzmEs3 fgsp+oWLZPwEqkkKYn3X6HxaBtEke8Lu7Zk02GB2QUnduex/hP+8RXc6W9bnVMPg FUAwMD7ZdjWU3aDc/wHhW0TQDFJcMLI6fiw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrfeekjedgieegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefufffkjghfggfgtgesthfuredttddtvdenucfhrhhomhepvfhhohhm rghsucfoohhnjhgrlhhonhcuoehthhhomhgrshesmhhonhhjrghlohhnrdhnvghtqeenuc ggtffrrghtthgvrhhnpedtjeeiieefhedtfffgvdelteeufeefheeujefgueetfedttdei kefgkeduhedtgfenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfh hrohhmpehthhhomhgrshesmhhonhhjrghlohhnrdhnvght X-ME-Proxy: Feedback-ID: i47234305:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 30 May 2023 09:32:04 -0400 (EDT) From: Thomas Monjalon To: Ophir Munk Cc: dev@dpdk.org, Bruce Richardson , Devendra Singh Rawat , Alok Prasad , Matan Azrad , Lior Margalit Subject: Re: [PATCH v4] lib: set/get max memzone segments Date: Tue, 30 May 2023 15:32:02 +0200 Message-ID: <3067045.U3zVgo479M@thomas> In-Reply-To: <20230524222550.3538819-1-ophirmu@nvidia.com> References: <20230503072641.474600-1-ophirmu@nvidia.com> <20230524222550.3538819-1-ophirmu@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org 25/05/2023 00:25, Ophir Munk: > --- a/config/rte_config.h > +++ b/config/rte_config.h > -#define RTE_MAX_MEMZONE 2560 Good to be able to remove this compilation-time configuration. > --- a/lib/eal/common/eal_common_memzone.c > +++ b/lib/eal/common/eal_common_memzone.c > +#define DEFAULT_MAX_MEMZONE 2560 Maybe add "_COUNT" at the end to make clear it is not about the size of a memzone. We should add a comment here to explain the meaning of this default: used until the "set" function is called. > - "%s(): Number of requested memzone segments exceeds RTE_MAX_MEMZONE\n", > - __func__); > + "%s(): Number of requested memzone segments exceeds " > + "maximum %u\n", __func__, arr->len); We should keep "maximum" on the first line to ease "grep" in the code. > +int > +rte_memzone_max_set(size_t max) > +{ > + struct rte_mem_config *mcfg; > + > + if (eal_get_internal_configuration()->init_complete > 0) > + return -1; An error log would be needed here I think. > + > + mcfg = rte_eal_get_configuration()->mem_config; > + if (!mcfg) Better to use "== NULL" for pointers. > + return -1; Do we need an error log as well? > + > + mcfg->max_memzone = max; > + > + return 0; > +} > + > +size_t > +rte_memzone_max_get(void) > +{ > + struct rte_mem_config *mcfg; > + > + mcfg = rte_eal_get_configuration()->mem_config; > + if (!mcfg || !mcfg->max_memzone) Same comment as above: don't use boolean operator for pointer or value. > + return DEFAULT_MAX_MEMZONE; > + > + return mcfg->max_memzone; > +} > diff --git a/lib/eal/common/eal_memcfg.h b/lib/eal/common/eal_memcfg.h > index ea013a9..183bb25 100644 > --- a/lib/eal/common/eal_memcfg.h > +++ b/lib/eal/common/eal_memcfg.h > @@ -75,6 +75,8 @@ struct rte_mem_config { > /**< TSC rate */ > > uint8_t dma_maskbits; /**< Keeps the more restricted dma mask. */ > + > + size_t max_memzone; /**< maximum allowed allocated memzones. */ Uppercase for first work, and we may remove "allowed"? Suggestion: "Maximum number of allocated memzones." [...] > +/** > + * @warning > + * @b EXPERIMENTAL: this API may change without prior notice > + * > + * Set max memzone value Add a dot at the end. Instead of "value", we should mention "number" or "count". > + * > + * This function can only be called prior to rte_eal_init(). > + * > + * @param max > + * Maximum number of memzones > + * @return > + * 0 on success, -1 otherwise > + */ > +__rte_experimental > +int rte_memzone_max_set(size_t max); > + > +/** > + * @warning > + * @b EXPERIMENTAL: this API may change without prior notice > + * > + * Get the maximum number of memzones. > + * > + * @note: The maximum value will not change after calling rte_eal_init(). > + * > + * @return > + * Maximum number of memzones > + */ > +__rte_experimental > +size_t rte_memzone_max_get(void); Good, thank you.