<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Thank you for pointing out my problem, I will fix it in the next version<br class=""><div><br class=""><blockquote type="cite" class=""><div class="">2021年12月22日 下午7:45,Morten Brørup <<a href="mailto:mb@smartsharesystems.com" class="">mb@smartsharesystems.com</a>> 写道:</div><br class="Apple-interchange-newline"><div class=""><meta charset="UTF-8" class=""><blockquote type="cite" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-decoration: none;" class="">From: Zhiheng Chen [<a href="mailto:chenzhiheng0227@gmail.com" class="">mailto:chenzhiheng0227@gmail.com</a>]<br class="">Sent: Wednesday, 22 December 2021 09.26<br class=""><br class="">Compared to patch version 1, this version updates the descriptions<br class="">of underlying functions.<br class=""></blockquote><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">Some comments inline below, regarding the return value of success.</span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">You should also update the description of the dequeue function prototype on line 451, so no one implements an alternative dequeue operation that returns anything else than -ENOBUFS as error value.</span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">@Olivier, @Andrew: Do we want to impose this restriction on the API?</span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">Otherwise, the patch should take the opposite direction, and update the descriptions of high level functions - i.e. rte_mempool_generic_get(), rte_mempool_get_bulk(), rte_mempool_get(), etc. - to reflect that any error value <0 can be returned, originating from the underlying function.</span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><blockquote type="cite" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><br class="">In rte_mempool_ring.c, the committer uses the symbol ENOBUFS to<br class="">describe the return value of function common_ring_sc_dequeue,<br class="">but in rte_mempool.h, the symbol ENOENT is used to describe<br class="">the return value of function rte_mempool_get. If the user of<br class="">dpdk uses the symbol ENOENT as the judgment condition of<br class="">the return value, it may cause some abnormal phenomena<br class="">in their own programs, such as when the mempool space is exhausted.<br class=""><br class="">Fixes: ea5dd2744b90 ("mempool: cache optimisations")<br class=""><br class="">Signed-off-by: Zhiheng Chen <<a href="mailto:chenzhiheng0227@gmail.com" class="">chenzhiheng0227@gmail.com</a>><br class="">---<br class="">lib/mempool/rte_mempool.h | 22 +++++++++++-----------<br class="">1 file changed, 11 insertions(+), 11 deletions(-)<br class=""><br class="">diff --git a/lib/mempool/rte_mempool.h b/lib/mempool/rte_mempool.h<br class="">index 1e7a3c1527..3b52bd6737 100644<br class="">--- a/lib/mempool/rte_mempool.h<br class="">+++ b/lib/mempool/rte_mempool.h<br class="">@@ -737,8 +737,8 @@ rte_mempool_ops_alloc(struct rte_mempool *mp);<br class=""> * @param n<br class=""> * Number of objects to get.<br class=""> * @return<br class="">- * - 0: Success; got n objects.<br class="">- * - <0: Error; code of dequeue function.<br class="">+ * - >=0: Success; number of objects supplied.<br class="">+ * - -ENOBUFS: Not enough entries in the mempool; no object is<br class="">retrieved.<br class=""></blockquote><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">NAK regarding success: Return value 0 is correct, >=0 cannot happen.</span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><blockquote type="cite" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""> */<br class="">static inline int<br class="">rte_mempool_ops_dequeue_bulk(struct rte_mempool *mp,<br class="">@@ -1453,7 +1453,7 @@ rte_mempool_put(struct rte_mempool *mp, void<br class="">*obj)<br class=""> * A pointer to a mempool cache structure. May be NULL if not<br class="">needed.<br class=""> * @return<br class=""> * - >=0: Success; number of objects supplied.<br class=""></blockquote><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">This is also wrong. It should be:</span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">-* - >=0: Success; number of objects supplied.</span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">+* - 0: Success; got n objects.</span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><blockquote type="cite" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-decoration: none;" class="">- * - <0: Error; code of ring dequeue function.<br class="">+ * - -ENOBUFS: Not enough entries in the mempool; no object is<br class="">retrieved.<br class=""> */<br class="">static __rte_always_inline int<br class="">rte_mempool_do_generic_get(struct rte_mempool *mp, void **obj_table,<br class="">@@ -1521,7 +1521,7 @@ rte_mempool_do_generic_get(struct rte_mempool<br class="">*mp, void **obj_table,<br class=""> * Get several objects from the mempool.<br class=""> *<br class=""> * If cache is enabled, objects will be retrieved first from cache,<br class="">- * subsequently from the common pool. Note that it can return -ENOENT<br class="">when<br class="">+ * subsequently from the common pool. Note that it can return -ENOBUFS<br class="">when<br class=""> * the local cache and common pool are empty, even if cache from other<br class=""> * lcores are full.<br class=""> *<br class="">@@ -1534,8 +1534,8 @@ rte_mempool_do_generic_get(struct rte_mempool<br class="">*mp, void **obj_table,<br class=""> * @param cache<br class=""> * A pointer to a mempool cache structure. May be NULL if not<br class="">needed.<br class=""> * @return<br class="">- * - 0: Success; objects taken.<br class="">- * - -ENOENT: Not enough entries in the mempool; no object is<br class="">retrieved.<br class="">+ * - >=0: Success; number of objects supplied.<br class="">+ * - -ENOBUFS: Not enough entries in the mempool; no object is<br class="">retrieved.<br class=""></blockquote><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">NAK regarding success: Return value 0 is correct, >=0 cannot happen.</span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><blockquote type="cite" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""> */<br class="">static __rte_always_inline int<br class="">rte_mempool_generic_get(struct rte_mempool *mp, void **obj_table,<br class="">@@ -1557,7 +1557,7 @@ rte_mempool_generic_get(struct rte_mempool *mp,<br class="">void **obj_table,<br class=""> * mempool creation time (see flags).<br class=""> *<br class=""> * If cache is enabled, objects will be retrieved first from cache,<br class="">- * subsequently from the common pool. Note that it can return -ENOENT<br class="">when<br class="">+ * subsequently from the common pool. Note that it can return -ENOBUFS<br class="">when<br class=""> * the local cache and common pool are empty, even if cache from other<br class=""> * lcores are full.<br class=""> *<br class="">@@ -1568,8 +1568,8 @@ rte_mempool_generic_get(struct rte_mempool *mp,<br class="">void **obj_table,<br class=""> * @param n<br class=""> * The number of objects to get from the mempool to obj_table.<br class=""> * @return<br class="">- * - 0: Success; objects taken<br class="">- * - -ENOENT: Not enough entries in the mempool; no object is<br class="">retrieved.<br class="">+ * - >=0: Success; number of objects supplied.<br class="">+ * - -ENOBUFS: Not enough entries in the mempool; no object is<br class="">retrieved.<br class=""></blockquote><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">NAK regarding success: Return value 0 is correct, >=0 cannot happen.</span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><blockquote type="cite" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""> */<br class="">static __rte_always_inline int<br class="">rte_mempool_get_bulk(struct rte_mempool *mp, void **obj_table,<br class="">unsigned int n)<br class="">@@ -1588,7 +1588,7 @@ rte_mempool_get_bulk(struct rte_mempool *mp, void<br class="">**obj_table, unsigned int n)<br class=""> * mempool creation (see flags).<br class=""> *<br class=""> * If cache is enabled, objects will be retrieved first from cache,<br class="">- * subsequently from the common pool. Note that it can return -ENOENT<br class="">when<br class="">+ * subsequently from the common pool. Note that it can return -ENOBUFS<br class="">when<br class=""> * the local cache and common pool are empty, even if cache from other<br class=""> * lcores are full.<br class=""> *<br class="">@@ -1598,7 +1598,7 @@ rte_mempool_get_bulk(struct rte_mempool *mp, void<br class="">**obj_table, unsigned int n)<br class=""> * A pointer to a void * pointer (object) that will be filled.<br class=""> * @return<br class=""> * - 0: Success; objects taken.<br class="">- * - -ENOENT: Not enough entries in the mempool; no object is<br class="">retrieved.<br class="">+ * - -ENOBUFS: Not enough entries in the mempool; no object is<br class="">retrieved.<br class=""> */<br class="">static __rte_always_inline int<br class="">rte_mempool_get(struct rte_mempool *mp, void **obj_p)<br class="">--<br class="">2.32.0</blockquote></div></blockquote></div><br class=""></body></html>