DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Morten Brørup" <mb@smartsharesystems.com>
To: "Honnappa Nagarahalli" <honnappa.nagarahalli@arm.com>,
	<olivier.matz@6wind.com>, <konstantin.v.ananyev@yandex.ru>
Cc: <dev@dpdk.org>, <ruifeng.wang@arm.com>,
	<kamalakshitha.aligeri@arm.com>, <wathsala.vithanage@arm.com>,
	<nd@arm.com>, <thomas@monjalon.net>
Subject: RE: [PATCH 3/4] eal: add API to check if lcore id is valid
Date: Wed, 7 Jun 2023 12:19:00 +0200	[thread overview]
Message-ID: <98CBD80474FA8B44BF855DF32C47DC35D8799A@smartserver.smartshare.dk> (raw)
In-Reply-To: <20230309045738.1261000-4-honnappa.nagarahalli@arm.com>

> From: Honnappa Nagarahalli [mailto:honnappa.nagarahalli@arm.com]
> Sent: Thursday, 9 March 2023 05.58
> 
> Simple API to check if the lcore ID does not exceed the
> maximum number of lcores configured.
> 
> Signed-off-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
> Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
> ---
>  lib/eal/include/rte_lcore.h | 14 ++++++++++++++
>  1 file changed, 14 insertions(+)
> 
> diff --git a/lib/eal/include/rte_lcore.h b/lib/eal/include/rte_lcore.h
> index 6a355e9986..cf99919a02 100644
> --- a/lib/eal/include/rte_lcore.h
> +++ b/lib/eal/include/rte_lcore.h
> @@ -38,6 +38,20 @@ enum rte_lcore_role_t {
>  	ROLE_NON_EAL,
>  };
> 
> +/**
> + * Check if the lcore ID is valid
> + *
> + * @param lcore_id
> + *   The identifier of the lcore.
> + *
> + * @return
> + *   True if the given lcore ID is between 0 and RTE_MAX_LCORE-1.
> + */
> +static inline int rte_lcore_id_is_valid(unsigned int lcore_id)
> +{
> +	return (lcore_id < RTE_MAX_LCORE);
> +}
> +
>  /**
>   * Get a lcore's role.
>   *
> --
> 2.25.1
> 

Isn't LCORE_ID_ANY considered valid in some contexts?

I don't think this function adds any value; it only makes the lcore_id interpretation more opaque. Having this comparison, i.e. (lcore_id < RTE_MAX_LCORE), directly in the source code makes it more easily readable than a call to this function.

So, NAK from me.


  reply	other threads:[~2023-06-07 10:19 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-09  4:57 [PATCH 0/4] Small corrections in mempool Honnappa Nagarahalli
2023-03-09  4:57 ` [PATCH 1/4] mempool: clarify mempool cache flush API behavior Honnappa Nagarahalli
2023-06-07 10:03   ` Morten Brørup
2023-03-09  4:57 ` [PATCH 2/4] mempool: clarify comments for mempool cache implementation Honnappa Nagarahalli
2023-06-07 10:10   ` Morten Brørup
2023-03-09  4:57 ` [PATCH 3/4] eal: add API to check if lcore id is valid Honnappa Nagarahalli
2023-06-07 10:19   ` Morten Brørup [this message]
2023-06-07 15:05     ` Stephen Hemminger
2023-03-09  4:57 ` [PATCH 4/4] mempool: use lcore API to check if lcore ID " Honnappa Nagarahalli
2023-03-09  9:39   ` Konstantin Ananyev
2023-03-10  4:01     ` Honnappa Nagarahalli
2023-03-10 14:06       ` Konstantin Ananyev
2023-06-07  9:35 ` [PATCH 0/4] Small corrections in mempool 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=98CBD80474FA8B44BF855DF32C47DC35D8799A@smartserver.smartshare.dk \
    --to=mb@smartsharesystems.com \
    --cc=dev@dpdk.org \
    --cc=honnappa.nagarahalli@arm.com \
    --cc=kamalakshitha.aligeri@arm.com \
    --cc=konstantin.v.ananyev@yandex.ru \
    --cc=nd@arm.com \
    --cc=olivier.matz@6wind.com \
    --cc=ruifeng.wang@arm.com \
    --cc=thomas@monjalon.net \
    --cc=wathsala.vithanage@arm.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).