DPDK patches and discussions
 help / color / mirror / Atom feed
* rte_lcore_has_role() return value
@ 2025-05-19  9:59 Morten Brørup
  2025-05-19 14:01 ` Pavan Nikhilesh Bhagavatula
  0 siblings, 1 reply; 5+ messages in thread
From: Morten Brørup @ 2025-05-19  9:59 UTC (permalink / raw)
  To: Pavan Nikhilesh Bhagavatula; +Cc: dev

Pavan,

The rte_lcore_has_role() documentation says it returns bool.

Its implementation returns a true value (-1) if given a non-compliant lcore_id, e.g. LCORE_ID_ANY.

I think it should behave like rte_lcore_is_enabled(), i.e. return false if given a non-compliant lcore_id, e.g. LCORE_ID_ANY.

Use case:
A control thread in an application might or might not register itself, and the registration might not succeed.

At exit of this control thread, it should unregister itself if registered.

Fixing rte_lcore_has_role() as suggested would simplify the application from this:

	if (rte_lcore_id() != LCORE_ID_ANY &&
			rte_eal_lcore_role(rte_lcore_id()) == ROLE_NON_EAL)
		rte_thread_unregister();

To this:

	if (rte_lcore_has_role(rte_lcore_id(), ROLE_NON_EAL))
		rte_thread_unregister();

-Morten


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

* RE: rte_lcore_has_role() return value
  2025-05-19  9:59 rte_lcore_has_role() return value Morten Brørup
@ 2025-05-19 14:01 ` Pavan Nikhilesh Bhagavatula
  2025-05-19 14:15   ` Pavan Nikhilesh Bhagavatula
  0 siblings, 1 reply; 5+ messages in thread
From: Pavan Nikhilesh Bhagavatula @ 2025-05-19 14:01 UTC (permalink / raw)
  To: Morten Brørup, Varghese, Vipin; +Cc: dev

Hi Morten, 

Looks like this is meant for Vipin.

+Vipin

Thanks,
Pavan.

> Pavan,
> 
> The rte_lcore_has_role() documentation says it returns bool.
> 
> Its implementation returns a true value (-1) if given a non-compliant lcore_id,
> e.g. LCORE_ID_ANY.
> 
> I think it should behave like rte_lcore_is_enabled(), i.e. return false if given a
> non-compliant lcore_id, e.g. LCORE_ID_ANY.
> 
> Use case:
> A control thread in an application might or might not register itself, and the
> registration might not succeed.
> 
> At exit of this control thread, it should unregister itself if registered.
> 
> Fixing rte_lcore_has_role() as suggested would simplify the application from
> this:
> 
> 	if (rte_lcore_id() != LCORE_ID_ANY &&
> 			rte_eal_lcore_role(rte_lcore_id()) == ROLE_NON_EAL)
> 		rte_thread_unregister();
> 
> To this:
> 
> 	if (rte_lcore_has_role(rte_lcore_id(), ROLE_NON_EAL))
> 		rte_thread_unregister();
> 
> -Morten


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

* RE: rte_lcore_has_role() return value
  2025-05-19 14:01 ` Pavan Nikhilesh Bhagavatula
@ 2025-05-19 14:15   ` Pavan Nikhilesh Bhagavatula
  2025-06-03  6:07     ` Varghese, Vipin
  0 siblings, 1 reply; 5+ messages in thread
From: Pavan Nikhilesh Bhagavatula @ 2025-05-19 14:15 UTC (permalink / raw)
  To: Morten Brørup; +Cc: dev

My bad, I got it confused with lcore topology patches.

I will look into this.

Thanks,
Pavan.

> -----Original Message-----
> From: Pavan Nikhilesh Bhagavatula
> Sent: Monday, May 19, 2025 7:32 PM
> To: Morten Brørup <mb@smartsharesystems.com>; Varghese, Vipin
> <vipin.varghese@amd.com>
> Cc: dev <dev@dpdk.org>
> Subject: RE: rte_lcore_has_role() return value
> 
> Hi Morten,
> 
> Looks like this is meant for Vipin.
> 
> +Vipin
> 
> Thanks,
> Pavan.
> 
> > Pavan,
> >
> > The rte_lcore_has_role() documentation says it returns bool.
> >
> > Its implementation returns a true value (-1) if given a non-compliant
> lcore_id,
> > e.g. LCORE_ID_ANY.
> >
> > I think it should behave like rte_lcore_is_enabled(), i.e. return false if given a
> > non-compliant lcore_id, e.g. LCORE_ID_ANY.
> >
> > Use case:
> > A control thread in an application might or might not register itself, and the
> > registration might not succeed.
> >
> > At exit of this control thread, it should unregister itself if registered.
> >
> > Fixing rte_lcore_has_role() as suggested would simplify the application from
> > this:
> >
> > 	if (rte_lcore_id() != LCORE_ID_ANY &&
> > 			rte_eal_lcore_role(rte_lcore_id()) == ROLE_NON_EAL)
> > 		rte_thread_unregister();
> >
> > To this:
> >
> > 	if (rte_lcore_has_role(rte_lcore_id(), ROLE_NON_EAL))
> > 		rte_thread_unregister();
> >
> > -Morten


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

* RE: rte_lcore_has_role() return value
  2025-05-19 14:15   ` Pavan Nikhilesh Bhagavatula
@ 2025-06-03  6:07     ` Varghese, Vipin
  2025-06-03  6:34       ` Morten Brørup
  0 siblings, 1 reply; 5+ messages in thread
From: Varghese, Vipin @ 2025-06-03  6:07 UTC (permalink / raw)
  To: Pavan Nikhilesh Bhagavatula, Morten Brørup; +Cc: dev

[Public]

Hi @Morten Brørup

Would you need me to check this under `rte_topology` pcoming patches?

> -----Original Message-----
> From: Pavan Nikhilesh Bhagavatula <pbhagavatula@marvell.com>
> Sent: Monday, May 19, 2025 7:46 PM
> To: Morten Brørup <mb@smartsharesystems.com>
> Cc: dev <dev@dpdk.org>
> Subject: RE: rte_lcore_has_role() return value
>
> Caution: This message originated from an External Source. Use proper caution
> when opening attachments, clicking links, or responding.
>
>
> My bad, I got it confused with lcore topology patches.
>
> I will look into this.
>
> Thanks,
> Pavan.
>
> > -----Original Message-----
> > From: Pavan Nikhilesh Bhagavatula
> > Sent: Monday, May 19, 2025 7:32 PM
> > To: Morten Brørup <mb@smartsharesystems.com>; Varghese, Vipin
> > <vipin.varghese@amd.com>
> > Cc: dev <dev@dpdk.org>
> > Subject: RE: rte_lcore_has_role() return value
> >
> > Hi Morten,
> >
> > Looks like this is meant for Vipin.
> >
> > +Vipin
> >
> > Thanks,
> > Pavan.
> >
> > > Pavan,
> > >
> > > The rte_lcore_has_role() documentation says it returns bool.
> > >
> > > Its implementation returns a true value (-1) if given a
> > > non-compliant
> > lcore_id,
> > > e.g. LCORE_ID_ANY.
> > >
> > > I think it should behave like rte_lcore_is_enabled(), i.e. return
> > > false if given a non-compliant lcore_id, e.g. LCORE_ID_ANY.
> > >
> > > Use case:
> > > A control thread in an application might or might not register
> > > itself, and the registration might not succeed.
> > >
> > > At exit of this control thread, it should unregister itself if registered.
> > >
> > > Fixing rte_lcore_has_role() as suggested would simplify the
> > > application from
> > > this:
> > >
> > >     if (rte_lcore_id() != LCORE_ID_ANY &&
> > >                     rte_eal_lcore_role(rte_lcore_id()) == ROLE_NON_EAL)
> > >             rte_thread_unregister();
> > >
> > > To this:
> > >
> > >     if (rte_lcore_has_role(rte_lcore_id(), ROLE_NON_EAL))
> > >             rte_thread_unregister();
> > >
> > > -Morten


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

* RE: rte_lcore_has_role() return value
  2025-06-03  6:07     ` Varghese, Vipin
@ 2025-06-03  6:34       ` Morten Brørup
  0 siblings, 0 replies; 5+ messages in thread
From: Morten Brørup @ 2025-06-03  6:34 UTC (permalink / raw)
  To: Varghese, Vipin, Pavan Nikhilesh Bhagavatula; +Cc: dev

Hi Vipin,

No need. Pavan fixed it already:
https://patchwork.dpdk.org/project/dpdk/patch/20250520201726.7420-1-pbhagavatula@marvell.com/

-Morten

> From: Varghese, Vipin [mailto:Vipin.Varghese@amd.com]
> Sent: Tuesday, 3 June 2025 08.08
> 
> [Public]
> 
> Hi @Morten Brørup
> 
> Would you need me to check this under `rte_topology` pcoming patches?
> 
> > From: Pavan Nikhilesh Bhagavatula <pbhagavatula@marvell.com>
> > Sent: Monday, May 19, 2025 7:46 PM
> >
> > Caution: This message originated from an External Source. Use proper
> caution
> > when opening attachments, clicking links, or responding.
> >
> >
> > My bad, I got it confused with lcore topology patches.
> >
> > I will look into this.
> >
> > Thanks,
> > Pavan.
> >
> > > From: Pavan Nikhilesh Bhagavatula
> > > Sent: Monday, May 19, 2025 7:32 PM
> > >
> > > Hi Morten,
> > >
> > > Looks like this is meant for Vipin.
> > >
> > > +Vipin
> > >
> > > Thanks,
> > > Pavan.
> > >
> > > > Pavan,
> > > >
> > > > The rte_lcore_has_role() documentation says it returns bool.
> > > >
> > > > Its implementation returns a true value (-1) if given a
> > > > non-compliant
> > > lcore_id,
> > > > e.g. LCORE_ID_ANY.
> > > >
> > > > I think it should behave like rte_lcore_is_enabled(), i.e. return
> > > > false if given a non-compliant lcore_id, e.g. LCORE_ID_ANY.
> > > >
> > > > Use case:
> > > > A control thread in an application might or might not register
> > > > itself, and the registration might not succeed.
> > > >
> > > > At exit of this control thread, it should unregister itself if
> registered.
> > > >
> > > > Fixing rte_lcore_has_role() as suggested would simplify the
> > > > application from
> > > > this:
> > > >
> > > >     if (rte_lcore_id() != LCORE_ID_ANY &&
> > > >                     rte_eal_lcore_role(rte_lcore_id()) ==
> ROLE_NON_EAL)
> > > >             rte_thread_unregister();
> > > >
> > > > To this:
> > > >
> > > >     if (rte_lcore_has_role(rte_lcore_id(), ROLE_NON_EAL))
> > > >             rte_thread_unregister();
> > > >
> > > > -Morten


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

end of thread, other threads:[~2025-06-03  6:34 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-05-19  9:59 rte_lcore_has_role() return value Morten Brørup
2025-05-19 14:01 ` Pavan Nikhilesh Bhagavatula
2025-05-19 14:15   ` Pavan Nikhilesh Bhagavatula
2025-06-03  6:07     ` Varghese, Vipin
2025-06-03  6:34       ` Morten Brørup

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