DPDK patches and discussions
 help / color / mirror / Atom feed
From: Thomas Monjalon <thomas@monjalon.net>
To: Ophir Munk <ophirmu@nvidia.com>
Cc: dev@dpdk.org, Bruce Richardson <bruce.richardson@intel.com>,
	Devendra Singh Rawat <dsinghrawat@marvell.com>,
	Alok Prasad <palok@marvell.com>, Matan Azrad <matan@nvidia.com>,
	Lior Margalit <lmargalit@nvidia.com>
Subject: Re: [PATCH v4] lib: set/get max memzone segments
Date: Tue, 30 May 2023 15:32:02 +0200	[thread overview]
Message-ID: <3067045.U3zVgo479M@thomas> (raw)
In-Reply-To: <20230524222550.3538819-1-ophirmu@nvidia.com>

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.



  parent reply	other threads:[~2023-05-30 13:32 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-19  8:36 [RFC] " Ophir Munk
2023-04-19  8:48 ` Ophir Munk
2023-04-19 13:42 ` [EXT] " Devendra Singh Rawat
2023-04-24 21:07   ` Ophir Munk
2023-04-19 14:42 ` Stephen Hemminger
2023-04-24 21:43   ` Ophir Munk
2023-04-19 14:51 ` Tyler Retzlaff
2023-04-20  7:43   ` Thomas Monjalon
2023-04-20 18:20     ` Tyler Retzlaff
2023-04-21  8:34       ` Thomas Monjalon
2023-04-21 11:08         ` Morten Brørup
2023-04-21 14:57           ` Thomas Monjalon
2023-04-21 15:19             ` Morten Brørup
2023-04-25 16:38               ` Ophir Munk
2023-04-25 13:46   ` Ophir Munk
2023-04-25 16:40 ` [RFC V2] " Ophir Munk
2023-05-03  7:26   ` [PATCH V3] " Ophir Munk
2023-05-03 21:41     ` Morten Brørup
2023-05-25  6:47       ` Ophir Munk
2023-05-04  7:27     ` David Marchand
2023-05-25  6:35       ` Ophir Munk
2023-05-18 15:54     ` Burakov, Anatoly
2023-05-25  6:43       ` Ophir Munk
2023-05-24 22:25     ` [PATCH v4] " Ophir Munk
2023-05-25 14:53       ` Burakov, Anatoly
2023-05-30 11:37         ` Ophir Munk
2023-05-26  9:55       ` David Marchand
2023-05-28 12:09         ` [EXT] " Alok Prasad
2023-05-30 13:32       ` Thomas Monjalon [this message]
2023-05-31  7:56         ` Ophir Munk
2023-05-31  7:52       ` [PATCH V5] " Ophir Munk
2023-05-31  8:41         ` [PATCH V6] " Ophir Munk
2023-06-05  8:52           ` [PATCH V7] " Ophir Munk
2023-06-05 10:50             ` [PATCH V8] " Ophir Munk
2023-06-05 16:50               ` Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3067045.U3zVgo479M@thomas \
    --to=thomas@monjalon.net \
    --cc=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    --cc=dsinghrawat@marvell.com \
    --cc=lmargalit@nvidia.com \
    --cc=matan@nvidia.com \
    --cc=ophirmu@nvidia.com \
    --cc=palok@marvell.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).