[dpdk-dev] lcore: make semantics of lcore role function more intuitive

Message ID 5414097.qiRGovPonW@xps (mailing list archive)
State Not Applicable, archived
Headers

Checks

Context Check Description
ci/checkpatch warning coding style issues
ci/Intel-compilation success Compilation OK

Commit Message

Thomas Monjalon April 26, 2018, 2:54 p.m. UTC
  26/04/2018 16:44, Carrillo, Erik G:
> Thanks,  Anatoly and Thomas.  I had also considered the following chunk for the release notes:
> 
> diff --git a/doc/guides/rel_notes/release_18_05.rst b/doc/guides/rel_notes/release_18_05.rst
> index 04ff4fe..127a7e2 100644                                                   
> --- a/doc/guides/rel_notes/release_18_05.rst                                    
> +++ b/doc/guides/rel_notes/release_18_05.rst                                    
> @@ -72,6 +72,11 @@ API Changes                                                  
>     Also, make sure to start the actual text at the margin.                     
>     =========================================================                   
>                                                                                 
> +* **rte_lcore_has_role() return values changed**                               
> +                                                                               
> +  This function now returns 1 or 0 for true or false, respectively, rather        
> +  than 0 or <0 for success or failure to make use of the function more         
> +  intuitive.                                                                   
>                                                                                 
>  ABI Changes                                                                    
>  -----------
> 
> Do we want this note?  Also, it looks like the Doxygen documentation of the function in the header file didn't get updated.


Oh, you are right, this patch is not complete.
I've fixed it:
  

Comments

Carrillo, Erik G April 26, 2018, 2:56 p.m. UTC | #1
Great, thanks Thomas.

> -----Original Message-----
> From: Thomas Monjalon [mailto:thomas@monjalon.net]
> Sent: Thursday, April 26, 2018 9:55 AM
> To: Carrillo, Erik G <erik.g.carrillo@intel.com>
> Cc: Burakov, Anatoly <anatoly.burakov@intel.com>; dev@dpdk.org; Neil
> Horman <nhorman@tuxdriver.com>; Mcnamara, John
> <john.mcnamara@intel.com>; Kovacevic, Marko
> <marko.kovacevic@intel.com>; Robert Sanford <rsanford@akamai.com>;
> olivier.matz@6wind.com; shreyansh.jain@nxp.com
> Subject: Re: [dpdk-dev] [PATCH] lcore: make semantics of lcore role function
> more intuitive
> 
> 26/04/2018 16:44, Carrillo, Erik G:
> > Thanks,  Anatoly and Thomas.  I had also considered the following chunk for
> the release notes:
> >
> > diff --git a/doc/guides/rel_notes/release_18_05.rst
> b/doc/guides/rel_notes/release_18_05.rst
> > index 04ff4fe..127a7e2 100644
> > --- a/doc/guides/rel_notes/release_18_05.rst
> > +++ b/doc/guides/rel_notes/release_18_05.rst
> > @@ -72,6 +72,11 @@ API Changes
> >     Also, make sure to start the actual text at the margin.
> >
> =========================================================
> >
> > +* **rte_lcore_has_role() return values changed**
> > +
> > +  This function now returns 1 or 0 for true or false, respectively, rather
> > +  than 0 or <0 for success or failure to make use of the function more
> > +  intuitive.
> >
> >  ABI Changes
> >  -----------
> >
> > Do we want this note?  Also, it looks like the Doxygen documentation of
> the function in the header file didn't get updated.
> 
> 
> Oh, you are right, this patch is not complete.
> I've fixed it:
> 
> --- a/doc/guides/rel_notes/release_18_05.rst
> +++ b/doc/guides/rel_notes/release_18_05.rst
> @@ -161,6 +161,12 @@ API Changes
>    announced at least one release before the ABI change is made. There are
> no
>    ABI breaking changes planned.
> 
> +* eal: ``rte_lcore_has_role()`` return value changed.
> +
> +  This function now returns true or false, respectively, rather  than 0
> + or <0 for success or failure.
> +  It makes use of the function more intuitive.
> +
>  * mempool: capability flags and related functions have been removed.
> 
>    Flags ``MEMPOOL_F_CAPA_PHYS_CONTIG`` and diff --git
> a/lib/librte_eal/common/include/rte_lcore.h
> b/lib/librte_eal/common/include/rte_lcore.h
> index 334a0629e..1a2f37eaa 100644
> --- a/lib/librte_eal/common/include/rte_lcore.h
> +++ b/lib/librte_eal/common/include/rte_lcore.h
> @@ -311,7 +311,7 @@ rte_ctrl_thread_create(pthread_t *thread, const char
> *name,
>   * @param role
>   *   The role to be checked against.
>   * @return
> - *   On success, return 0; otherwise return a negative value.
> + *   Boolean value: positive if test is true; otherwise returns 0.
>   */
> 
> Thanks Erik!
>
  
Stephen Hemminger April 26, 2018, 3:37 p.m. UTC | #2
On Thu, 26 Apr 2018 14:56:19 +0000
"Carrillo, Erik G" <erik.g.carrillo@intel.com> wrote:

> Great, thanks Thomas.
> 
> > -----Original Message-----
> > From: Thomas Monjalon [mailto:thomas@monjalon.net]
> > Sent: Thursday, April 26, 2018 9:55 AM
> > To: Carrillo, Erik G <erik.g.carrillo@intel.com>
> > Cc: Burakov, Anatoly <anatoly.burakov@intel.com>; dev@dpdk.org; Neil
> > Horman <nhorman@tuxdriver.com>; Mcnamara, John
> > <john.mcnamara@intel.com>; Kovacevic, Marko
> > <marko.kovacevic@intel.com>; Robert Sanford <rsanford@akamai.com>;
> > olivier.matz@6wind.com; shreyansh.jain@nxp.com
> > Subject: Re: [dpdk-dev] [PATCH] lcore: make semantics of lcore role function
> > more intuitive
> > 
> > 26/04/2018 16:44, Carrillo, Erik G:  
> > > Thanks,  Anatoly and Thomas.  I had also considered the following chunk for  
> > the release notes:  
> > >
> > > diff --git a/doc/guides/rel_notes/release_18_05.rst  
> > b/doc/guides/rel_notes/release_18_05.rst  
> > > index 04ff4fe..127a7e2 100644
> > > --- a/doc/guides/rel_notes/release_18_05.rst
> > > +++ b/doc/guides/rel_notes/release_18_05.rst
> > > @@ -72,6 +72,11 @@ API Changes
> > >     Also, make sure to start the actual text at the margin.
> > >  
> > =========================================================  
> > >
> > > +* **rte_lcore_has_role() return values changed**
> > > +
> > > +  This function now returns 1 or 0 for true or false, respectively, rather
> > > +  than 0 or <0 for success or failure to make use of the function more
> > > +  intuitive.
> > >
> > >  ABI Changes
> > >  -----------
> > >
> > > Do we want this note?  Also, it looks like the Doxygen documentation of  
> > the function in the header file didn't get updated.
> > 
> > 
> > Oh, you are right, this patch is not complete.
> > I've fixed it:
> > 
> > --- a/doc/guides/rel_notes/release_18_05.rst
> > +++ b/doc/guides/rel_notes/release_18_05.rst
> > @@ -161,6 +161,12 @@ API Changes
> >    announced at least one release before the ABI change is made. There are
> > no
> >    ABI breaking changes planned.
> > 
> > +* eal: ``rte_lcore_has_role()`` return value changed.
> > +
> > +  This function now returns true or false, respectively, rather  than 0
> > + or <0 for success or failure.
> > +  It makes use of the function more intuitive.
> > +
> >  * mempool: capability flags and related functions have been removed.
> > 
> >    Flags ``MEMPOOL_F_CAPA_PHYS_CONTIG`` and diff --git
> > a/lib/librte_eal/common/include/rte_lcore.h
> > b/lib/librte_eal/common/include/rte_lcore.h
> > index 334a0629e..1a2f37eaa 100644
> > --- a/lib/librte_eal/common/include/rte_lcore.h
> > +++ b/lib/librte_eal/common/include/rte_lcore.h
> > @@ -311,7 +311,7 @@ rte_ctrl_thread_create(pthread_t *thread, const char
> > *name,
> >   * @param role
> >   *   The role to be checked against.
> >   * @return
> > - *   On success, return 0; otherwise return a negative value.
> > + *   Boolean value: positive if test is true; otherwise returns 0.
> >   */
> > 
> > Thanks Erik!
> >   
> 

Usually the  safest way to introduce this is introduce a new function
with a different name. Then retire the old one.
  

Patch

--- a/doc/guides/rel_notes/release_18_05.rst
+++ b/doc/guides/rel_notes/release_18_05.rst
@@ -161,6 +161,12 @@  API Changes
   announced at least one release before the ABI change is made. There are no
   ABI breaking changes planned.
 
+* eal: ``rte_lcore_has_role()`` return value changed.
+
+  This function now returns true or false, respectively, rather
+  than 0 or <0 for success or failure.
+  It makes use of the function more intuitive.
+
 * mempool: capability flags and related functions have been removed.
 
   Flags ``MEMPOOL_F_CAPA_PHYS_CONTIG`` and
diff --git a/lib/librte_eal/common/include/rte_lcore.h b/lib/librte_eal/common/include/rte_lcore.h
index 334a0629e..1a2f37eaa 100644
--- a/lib/librte_eal/common/include/rte_lcore.h
+++ b/lib/librte_eal/common/include/rte_lcore.h
@@ -311,7 +311,7 @@  rte_ctrl_thread_create(pthread_t *thread, const char *name,
  * @param role
  *   The role to be checked against.
  * @return
- *   On success, return 0; otherwise return a negative value.
+ *   Boolean value: positive if test is true; otherwise returns 0.
  */

Thanks Erik!