mempool: fix internal function documentation

Message ID 20231020144647.1682698-1-ferruh.yigit@amd.com (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers
Series mempool: fix internal function documentation |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/github-robot: build success github build: passed
ci/intel-Functional success Functional PASS
ci/iol-compile-amd64-testing success Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-unit-amd64-testing success Testing PASS
ci/iol-unit-arm64-testing success Testing PASS
ci/iol-compile-arm64-testing success Testing PASS
ci/iol-intel-Functional success Functional Testing PASS

Commit Message

Ferruh Yigit Oct. 20, 2023, 2:46 p.m. UTC
  static function `rte_mempool_do_generic_get()` returns zero on success,
not >=0 as its function comment documents.

Since this function called by public API, the comment causes confusion
on the public API return value.

Fixing the internal function documentation for return value.

Fixes: af75078fece3 ("first public release")
Cc: stable@dpdk.org

Reported-by: Mahesh Adulla <mahesh.adulla@amd.com>
Signed-off-by: Ferruh Yigit <ferruh.yigit@amd.com>
---
 .mailmap                  | 1 +
 lib/mempool/rte_mempool.h | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)
  

Comments

Morten Brørup Oct. 20, 2023, 4:08 p.m. UTC | #1
> From: Ferruh Yigit [mailto:ferruh.yigit@amd.com]
> Sent: Friday, 20 October 2023 16.47
> 
> static function `rte_mempool_do_generic_get()` returns zero on success,
> not >=0 as its function comment documents.
> 
> Since this function called by public API, the comment causes confusion
> on the public API return value.
> 
> Fixing the internal function documentation for return value.
> 
> Fixes: af75078fece3 ("first public release")
> Cc: stable@dpdk.org
> 
> Reported-by: Mahesh Adulla <mahesh.adulla@amd.com>
> Signed-off-by: Ferruh Yigit <ferruh.yigit@amd.com>
> ---

I agree that this is the current situation, and is relied upon elsewhere in DPDK.

Reviewed-by: Morten Brørup <mb@smartsharesystems.com>

However, the documentation for the mempool driver dequeue function type, rte_mempool_dequeue_t [1], does not specify allowed return values, so some future mempool driver might return a positive value. Please consider updating this too. (Also, the mempool driver enqueue/dequeue functions work on a bulk of objects, not "an object", as their documentation says.)

[1]: https://elixir.bootlin.com/dpdk/latest/source/lib/mempool/rte_mempool.h#L476
  
lihuisong (C) Oct. 21, 2023, 3:09 a.m. UTC | #2
Acked-by: Huisong Li <lihuisong@huawei.com>

在 2023/10/20 22:46, Ferruh Yigit 写道:
> static function `rte_mempool_do_generic_get()` returns zero on success,
> not >=0 as its function comment documents.
>
> Since this function called by public API, the comment causes confusion
> on the public API return value.
>
> Fixing the internal function documentation for return value.
>
> Fixes: af75078fece3 ("first public release")
> Cc: stable@dpdk.org
>
> Reported-by: Mahesh Adulla <mahesh.adulla@amd.com>
> Signed-off-by: Ferruh Yigit <ferruh.yigit@amd.com>
> ---
>   .mailmap                  | 1 +
>   lib/mempool/rte_mempool.h | 2 +-
>   2 files changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/.mailmap b/.mailmap
> index 3f5bab26a81f..bfe451980f1c 100644
> --- a/.mailmap
> +++ b/.mailmap
> @@ -836,6 +836,7 @@ Maciej Rabeda <maciej.rabeda@intel.com>
>   Maciej Szwed <maciej.szwed@intel.com>
>   Madhu Chittim <madhu.chittim@intel.com>
>   Madhuker Mythri <madhuker.mythri@oracle.com>
> +Mahesh Adulla <mahesh.adulla@amd.com>
>   Mahipal Challa <mchalla@marvell.com>
>   Mah Yock Gen <yock.gen.mah@intel.com>
>   Mairtin o Loingsigh <mairtin.oloingsigh@intel.com>
> diff --git a/lib/mempool/rte_mempool.h b/lib/mempool/rte_mempool.h
> index f70bf36080fb..86598bc639e6 100644
> --- a/lib/mempool/rte_mempool.h
> +++ b/lib/mempool/rte_mempool.h
> @@ -1484,7 +1484,7 @@ rte_mempool_put(struct rte_mempool *mp, void *obj)
>    * @param cache
>    *   A pointer to a mempool cache structure. May be NULL if not needed.
>    * @return
> - *   - >=0: Success; number of objects supplied.
> + *   - 0: Success; number of objects supplied.
>    *   - <0: Error; code of driver dequeue function.
>    */
>   static __rte_always_inline int
  
Ferruh Yigit Oct. 23, 2023, 9:07 a.m. UTC | #3
On 10/20/2023 5:08 PM, Morten Brørup wrote:
>> From: Ferruh Yigit [mailto:ferruh.yigit@amd.com]
>> Sent: Friday, 20 October 2023 16.47
>>
>> static function `rte_mempool_do_generic_get()` returns zero on success,
>> not >=0 as its function comment documents.
>>
>> Since this function called by public API, the comment causes confusion
>> on the public API return value.
>>
>> Fixing the internal function documentation for return value.
>>
>> Fixes: af75078fece3 ("first public release")
>> Cc: stable@dpdk.org
>>
>> Reported-by: Mahesh Adulla <mahesh.adulla@amd.com>
>> Signed-off-by: Ferruh Yigit <ferruh.yigit@amd.com>
>> ---
> 
> I agree that this is the current situation, and is relied upon elsewhere in DPDK.
> 
> Reviewed-by: Morten Brørup <mb@smartsharesystems.com>
> 
> However, the documentation for the mempool driver dequeue function type, rte_mempool_dequeue_t [1], does not specify allowed return values, so some future mempool driver might return a positive value. Please consider updating this too. (Also, the mempool driver enqueue/dequeue functions work on a bulk of objects, not "an object", as their documentation says.)
> 

Hi Morten,

Yes, mempool_ops are missing API parameter documentation, although this
is not directly related with this patch, I can update
'rte_mempool_dequeue_t' while I am around.


> [1]: https://elixir.bootlin.com/dpdk/latest/source/lib/mempool/rte_mempool.h#L476
>
  

Patch

diff --git a/.mailmap b/.mailmap
index 3f5bab26a81f..bfe451980f1c 100644
--- a/.mailmap
+++ b/.mailmap
@@ -836,6 +836,7 @@  Maciej Rabeda <maciej.rabeda@intel.com>
 Maciej Szwed <maciej.szwed@intel.com>
 Madhu Chittim <madhu.chittim@intel.com>
 Madhuker Mythri <madhuker.mythri@oracle.com>
+Mahesh Adulla <mahesh.adulla@amd.com>
 Mahipal Challa <mchalla@marvell.com>
 Mah Yock Gen <yock.gen.mah@intel.com>
 Mairtin o Loingsigh <mairtin.oloingsigh@intel.com>
diff --git a/lib/mempool/rte_mempool.h b/lib/mempool/rte_mempool.h
index f70bf36080fb..86598bc639e6 100644
--- a/lib/mempool/rte_mempool.h
+++ b/lib/mempool/rte_mempool.h
@@ -1484,7 +1484,7 @@  rte_mempool_put(struct rte_mempool *mp, void *obj)
  * @param cache
  *   A pointer to a mempool cache structure. May be NULL if not needed.
  * @return
- *   - >=0: Success; number of objects supplied.
+ *   - 0: Success; number of objects supplied.
  *   - <0: Error; code of driver dequeue function.
  */
 static __rte_always_inline int