DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] service: add new `rte_service_lcore_count_services` API
@ 2017-08-23 11:16 Pavan Nikhilesh
  2017-08-28 10:55 ` Van Haaren, Harry
  0 siblings, 1 reply; 3+ messages in thread
From: Pavan Nikhilesh @ 2017-08-23 11:16 UTC (permalink / raw)
  To: harry.van.haaren; +Cc: dev, Pavan Nikhilesh

This new API returns the number of services that are running on a specific
service core. It allows an application to decide which service core to run
a new service on.

Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
---
 lib/librte_eal/common/include/rte_service.h | 12 ++++++++++++
 lib/librte_eal/common/rte_service.c         | 11 +++++++++++
 2 files changed, 23 insertions(+)

diff --git a/lib/librte_eal/common/include/rte_service.h b/lib/librte_eal/common/include/rte_service.h
index 7c6f738..5f0904f 100644
--- a/lib/librte_eal/common/include/rte_service.h
+++ b/lib/librte_eal/common/include/rte_service.h
@@ -374,6 +374,18 @@ int32_t rte_service_lcore_list(uint32_t array[], uint32_t n);
  * @warning
  * @b EXPERIMENTAL: this API may change without prior notice
  *
+ * Get the numer of services running on the supplied lcore.
+ *
+ * @param Lcore Id of the service core.
+ * @retval >=0 Number of services registered to this core.
+ * @retval -EINVAL The provided lcore is not a service core.
+ */
+int32_t rte_service_lcore_count_services(uint32_t lcore);
+
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice
+ *
  * Dumps any information available about the service. If service is NULL,
  * dumps info for all services.
  */
diff --git a/lib/librte_eal/common/rte_service.c b/lib/librte_eal/common/rte_service.c
index 7efb76d..ddaed22 100644
--- a/lib/librte_eal/common/rte_service.c
+++ b/lib/librte_eal/common/rte_service.c
@@ -397,6 +397,17 @@ rte_service_lcore_list(uint32_t array[], uint32_t n)
 }
 
 int32_t
+rte_service_lcore_count_services(uint32_t lcore)
+{
+	struct core_state *cs = &lcore_states[lcore];
+
+	if (!cs->is_service_core)
+		return -EINVAL;
+
+	return __builtin_popcountll(cs->service_mask);
+}
+
+int32_t
 rte_service_start_with_defaults(void)
 {
 	/* create a default mapping from cores to services, then start the
-- 
2.7.4

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-dev] [PATCH] service: add new `rte_service_lcore_count_services` API
  2017-08-23 11:16 [dpdk-dev] [PATCH] service: add new `rte_service_lcore_count_services` API Pavan Nikhilesh
@ 2017-08-28 10:55 ` Van Haaren, Harry
  2017-08-28 11:06   ` Pavan Nikhilesh Bhagavatula
  0 siblings, 1 reply; 3+ messages in thread
From: Van Haaren, Harry @ 2017-08-28 10:55 UTC (permalink / raw)
  To: Pavan Nikhilesh; +Cc: dev

> From: Pavan Nikhilesh [mailto:pbhagavatula@caviumnetworks.com]
> Sent: Wednesday, August 23, 2017 12:17 PM
> To: Van Haaren, Harry <harry.van.haaren@intel.com>
> Cc: dev@dpdk.org; Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
> Subject: [dpdk-dev] [PATCH] service: add new `rte_service_lcore_count_services` API
> 
> This new API returns the number of services that are running on a specific
> service core. It allows an application to decide which service core to run
> a new service on.
> 
> Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>

Hi,

Thanks - yes a useful addition to the API. Comments inline below, apart from that, thanks for the addition!

-H

> ---
>  lib/librte_eal/common/include/rte_service.h | 12 ++++++++++++
>  lib/librte_eal/common/rte_service.c         | 11 +++++++++++
>  2 files changed, 23 insertions(+)
> 
> diff --git a/lib/librte_eal/common/include/rte_service.h
> b/lib/librte_eal/common/include/rte_service.h
> index 7c6f738..5f0904f 100644
> --- a/lib/librte_eal/common/include/rte_service.h
> +++ b/lib/librte_eal/common/include/rte_service.h
> @@ -374,6 +374,18 @@ int32_t rte_service_lcore_list(uint32_t array[], uint32_t n);
>   * @warning
>   * @b EXPERIMENTAL: this API may change without prior notice
>   *
> + * Get the numer of services running on the supplied lcore.
> + *
> + * @param Lcore Id of the service core.
> + * @retval >=0 Number of services registered to this core.
> + * @retval -EINVAL The provided lcore is not a service core.
> + */
> +int32_t rte_service_lcore_count_services(uint32_t lcore);

Perhaps -ENOTSUP would be clearer for "not a service core"?
Then -EINVAL becomes available to indicate an invalid lcore-id pass in?

> +
> +/**
> + * @warning
> + * @b EXPERIMENTAL: this API may change without prior notice
> + *
>   * Dumps any information available about the service. If service is NULL,
>   * dumps info for all services.
>   */
> diff --git a/lib/librte_eal/common/rte_service.c b/lib/librte_eal/common/rte_service.c
> index 7efb76d..ddaed22 100644
> --- a/lib/librte_eal/common/rte_service.c
> +++ b/lib/librte_eal/common/rte_service.c
> @@ -397,6 +397,17 @@ rte_service_lcore_list(uint32_t array[], uint32_t n)
>  }
> 
>  int32_t
> +rte_service_lcore_count_services(uint32_t lcore)
> +{

/* need to error check lcore here, return -EINVAL if not valid. */

> +	struct core_state *cs = &lcore_states[lcore];
> +
> +	if (!cs->is_service_core)
> +		return -EINVAL;

/* suggesting to use -ENOTSUP instead here */

> +
> +	return __builtin_popcountll(cs->service_mask);
> +}
> +
> +int32_t
>  rte_service_start_with_defaults(void)
>  {
>  	/* create a default mapping from cores to services, then start the
> --
> 2.7.4

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-dev] [PATCH] service: add new `rte_service_lcore_count_services` API
  2017-08-28 10:55 ` Van Haaren, Harry
@ 2017-08-28 11:06   ` Pavan Nikhilesh Bhagavatula
  0 siblings, 0 replies; 3+ messages in thread
From: Pavan Nikhilesh Bhagavatula @ 2017-08-28 11:06 UTC (permalink / raw)
  To: Van Haaren, Harry; +Cc: dev

On Mon, Aug 28, 2017 at 10:55:05AM +0000, Van Haaren, Harry wrote:
> > From: Pavan Nikhilesh [mailto:pbhagavatula@caviumnetworks.com]
> > Sent: Wednesday, August 23, 2017 12:17 PM
> > To: Van Haaren, Harry <harry.van.haaren@intel.com>
> > Cc: dev@dpdk.org; Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
> > Subject: [dpdk-dev] [PATCH] service: add new `rte_service_lcore_count_services` API
> >
> > This new API returns the number of services that are running on a specific
> > service core. It allows an application to decide which service core to run
> > a new service on.
> >
> > Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
>
> Hi,

Hi Harry,

>
> Thanks - yes a useful addition to the API. Comments inline below, apart from that, thanks for the addition!
>
> -H

Thanks for the inputs, will modify the return types appropriately.
>
> > ---
> >  lib/librte_eal/common/include/rte_service.h | 12 ++++++++++++
> >  lib/librte_eal/common/rte_service.c         | 11 +++++++++++
> >  2 files changed, 23 insertions(+)
> >
> > diff --git a/lib/librte_eal/common/include/rte_service.h
> > b/lib/librte_eal/common/include/rte_service.h
> > index 7c6f738..5f0904f 100644
> > --- a/lib/librte_eal/common/include/rte_service.h
> > +++ b/lib/librte_eal/common/include/rte_service.h
> > @@ -374,6 +374,18 @@ int32_t rte_service_lcore_list(uint32_t array[], uint32_t n);
> >   * @warning
> >   * @b EXPERIMENTAL: this API may change without prior notice
> >   *
> > + * Get the numer of services running on the supplied lcore.
> > + *
> > + * @param Lcore Id of the service core.
> > + * @retval >=0 Number of services registered to this core.
> > + * @retval -EINVAL The provided lcore is not a service core.
> > + */
> > +int32_t rte_service_lcore_count_services(uint32_t lcore);
>
> Perhaps -ENOTSUP would be clearer for "not a service core"?
> Then -EINVAL becomes available to indicate an invalid lcore-id pass in?
>
> > +
> > +/**
> > + * @warning
> > + * @b EXPERIMENTAL: this API may change without prior notice
> > + *
> >   * Dumps any information available about the service. If service is NULL,
> >   * dumps info for all services.
> >   */
> > diff --git a/lib/librte_eal/common/rte_service.c b/lib/librte_eal/common/rte_service.c
> > index 7efb76d..ddaed22 100644
> > --- a/lib/librte_eal/common/rte_service.c
> > +++ b/lib/librte_eal/common/rte_service.c
> > @@ -397,6 +397,17 @@ rte_service_lcore_list(uint32_t array[], uint32_t n)
> >  }
> >
> >  int32_t
> > +rte_service_lcore_count_services(uint32_t lcore)
> > +{
>
> /* need to error check lcore here, return -EINVAL if not valid. */
>
> > +	struct core_state *cs = &lcore_states[lcore];
> > +
> > +	if (!cs->is_service_core)
> > +		return -EINVAL;
>
> /* suggesting to use -ENOTSUP instead here */
>
> > +
> > +	return __builtin_popcountll(cs->service_mask);
> > +}
> > +
> > +int32_t
> >  rte_service_start_with_defaults(void)
> >  {
> >  	/* create a default mapping from cores to services, then start the
> > --
> > 2.7.4
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-08-28 11:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-23 11:16 [dpdk-dev] [PATCH] service: add new `rte_service_lcore_count_services` API Pavan Nikhilesh
2017-08-28 10:55 ` Van Haaren, Harry
2017-08-28 11:06   ` Pavan Nikhilesh Bhagavatula

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).