DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] mempool: fix the description of some function return values
@ 2021-12-18 17:14 Zhiheng Chen
  2021-12-21 10:16 ` Morten Brørup
  0 siblings, 1 reply; 3+ messages in thread
From: Zhiheng Chen @ 2021-12-18 17:14 UTC (permalink / raw)
  To: Olivier Matz, Andrew Rybchenko; +Cc: dev, Zhiheng Chen

In rte_mempool_ring.c, the committer uses the symbol ENOBUFS to describe the return value of function common_ring_sc_dequeue, but in rte_mempool.h, the symbol ENOENT is used to describe the return value of function rte_mempool_get. If the user of dpdk uses the symbol ENOENT as the judgment condition of the return value, it may cause some abnormal phenomena in their own programs, such as when the mempool space is exhausted.

Fixes: ea5dd2744b90 ("mempool: cache optimisations")

Signed-off-by: Zhiheng Chen <chenzhiheng0227@gmail.com>
---
 lib/mempool/rte_mempool.h | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/lib/mempool/rte_mempool.h b/lib/mempool/rte_mempool.h
index 1e7a3c1527..2a7d3455ef 100644
--- a/lib/mempool/rte_mempool.h
+++ b/lib/mempool/rte_mempool.h
@@ -1521,7 +1521,7 @@ rte_mempool_do_generic_get(struct rte_mempool *mp, void **obj_table,
  * Get several objects from the mempool.
  *
  * If cache is enabled, objects will be retrieved first from cache,
- * subsequently from the common pool. Note that it can return -ENOENT when
+ * subsequently from the common pool. Note that it can return -ENOBUFS when
  * the local cache and common pool are empty, even if cache from other
  * lcores are full.
  *
@@ -1535,7 +1535,7 @@ rte_mempool_do_generic_get(struct rte_mempool *mp, void **obj_table,
  *   A pointer to a mempool cache structure. May be NULL if not needed.
  * @return
  *   - 0: Success; objects taken.
- *   - -ENOENT: Not enough entries in the mempool; no object is retrieved.
+ *   - -ENOBUFS: Not enough entries in the mempool; no object is retrieved.
  */
 static __rte_always_inline int
 rte_mempool_generic_get(struct rte_mempool *mp, void **obj_table,
@@ -1557,7 +1557,7 @@ rte_mempool_generic_get(struct rte_mempool *mp, void **obj_table,
  * mempool creation time (see flags).
  *
  * If cache is enabled, objects will be retrieved first from cache,
- * subsequently from the common pool. Note that it can return -ENOENT when
+ * subsequently from the common pool. Note that it can return -ENOBUFS when
  * the local cache and common pool are empty, even if cache from other
  * lcores are full.
  *
@@ -1569,7 +1569,7 @@ rte_mempool_generic_get(struct rte_mempool *mp, void **obj_table,
  *   The number of objects to get from the mempool to obj_table.
  * @return
  *   - 0: Success; objects taken
- *   - -ENOENT: Not enough entries in the mempool; no object is retrieved.
+ *   - -ENOBUFS: Not enough entries in the mempool; no object is retrieved.
  */
 static __rte_always_inline int
 rte_mempool_get_bulk(struct rte_mempool *mp, void **obj_table, unsigned int n)
@@ -1588,7 +1588,7 @@ rte_mempool_get_bulk(struct rte_mempool *mp, void **obj_table, unsigned int n)
  * mempool creation (see flags).
  *
  * If cache is enabled, objects will be retrieved first from cache,
- * subsequently from the common pool. Note that it can return -ENOENT when
+ * subsequently from the common pool. Note that it can return -ENOBUFS when
  * the local cache and common pool are empty, even if cache from other
  * lcores are full.
  *
@@ -1598,7 +1598,7 @@ rte_mempool_get_bulk(struct rte_mempool *mp, void **obj_table, unsigned int n)
  *   A pointer to a void * pointer (object) that will be filled.
  * @return
  *   - 0: Success; objects taken.
- *   - -ENOENT: Not enough entries in the mempool; no object is retrieved.
+ *   - -ENOBUFS: Not enough entries in the mempool; no object is retrieved.
  */
 static __rte_always_inline int
 rte_mempool_get(struct rte_mempool *mp, void **obj_p)
@@ -1777,7 +1777,7 @@ void rte_mempool_list_dump(FILE *f);
  *   The pointer to the mempool matching the name, or NULL if not found.
  *   NULL on error
  *   with rte_errno set appropriately. Possible rte_errno values include:
- *    - ENOENT - required entry not available to return.
+ *    - ENOBUFS - required entry not available to return.
  *
  */
 struct rte_mempool *rte_mempool_lookup(const char *name);
-- 
2.32.0


^ permalink raw reply	[flat|nested] 3+ messages in thread
* RE: [PATCH] mempool: fix the description of some function return values
@ 2021-12-22  1:42 zhiheng chen
  0 siblings, 0 replies; 3+ messages in thread
From: zhiheng chen @ 2021-12-22  1:42 UTC (permalink / raw)
  To: mb; +Cc: andrew.rybchenko, chenzhiheng0227, dev, olivier.matz

[-- Attachment #1: Type: text/plain, Size: 79 bytes --]

Thanks for your suggestions and time, I will update the underlying functions.


[-- Attachment #2: Type: text/html, Size: 467 bytes --]

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

end of thread, other threads:[~2021-12-22 10:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-18 17:14 [PATCH] mempool: fix the description of some function return values Zhiheng Chen
2021-12-21 10:16 ` Morten Brørup
2021-12-22  1:42 zhiheng chen

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