From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 69DB9A034E; Wed, 22 Dec 2021 11:01:15 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 21F9941141; Wed, 22 Dec 2021 11:01:06 +0100 (CET) Received: from mail-pj1-f50.google.com (mail-pj1-f50.google.com [209.85.216.50]) by mails.dpdk.org (Postfix) with ESMTP id 6DB0A40DDA for ; Wed, 22 Dec 2021 09:26:08 +0100 (CET) Received: by mail-pj1-f50.google.com with SMTP id o63-20020a17090a0a4500b001b1c2db8145so5081281pjo.5 for ; Wed, 22 Dec 2021 00:26:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id; bh=x1t887iqTL8RuXli8tDpdNoO16BBjWsDxvBa3012NoM=; b=QNTBjgaabH7aYw7pGVkK6IrWq8w/oITe+M5a3C2+4ltIQ025vfvD0uXikygkzTGqoF p+++BPkJ0ZGfBsibfI58aL6jMPmW0GMafy6bIAAdkHWiCgneijIUX9pRHTuiStIPR63k 5qy+PIFTTPjYNeK46hBQnmo0AXlvD7FaWgxZ8bt76YQbV6oZzLr/EOsmm1fR2K6Ousfm DDz16WgDfTyeeLehq0FWkRNBfxAU9zBuRQC5IsRQAkPsQgEBQjLu5UYN26J02PnK7wvM LuZTxQDg6GhTgF3Meu2Y3sqWpnUyU79VyufMB2fS4SdpJTE1d4mkAp4zjd5SiRzYmG8t E61g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=x1t887iqTL8RuXli8tDpdNoO16BBjWsDxvBa3012NoM=; b=1qUjtdUsXzg37dNjPp2W8AKEn0YrVMZm7D7ZmWrJJktNr5EJuYDtUJsRO2sX4yOadI f8ee1HH9Prize+/kmHlj7cLt4D8b6uwGmXQi7wCDzwbTGbNKG7jAGF5h48qSJIvchOCK ym1/uI9c3FDEjR0DPBxMbol6LMH1BVMuc81eA9ac1bI9LIoHT1S30E3HvDhJfAQ5VJFC y5/meVsCTJZRQ4d6aCRWbJq3lLYP0/OmpDlf1pu0NBZjLSYHhFaBxoB3hN4fHSgsH26c we85wYgGuz5g4ZPoTea77wyAKpKO9Nt1XW18xTJlurWuOGOowtCDPHU1/QSuo2DBP47O sdAw== X-Gm-Message-State: AOAM530+HoNM2sHQ0p8MdEI/V1Y+jOWZ840vinIMlJdfR0+58l4EkC9W GuVI35Iyiq5Rtvq+hj5v1Ng= X-Google-Smtp-Source: ABdhPJxVuWtXFAM8rGjGVrHJQTalsqq1ypEIZM4HR3lDoCH/Y4dkh3U58Pydg2KgPmLdhmFcHBv9DQ== X-Received: by 2002:a17:902:9891:b0:148:a2e8:2c3a with SMTP id s17-20020a170902989100b00148a2e82c3amr1779480plp.137.1640161567639; Wed, 22 Dec 2021 00:26:07 -0800 (PST) Received: from localhost.localdomain ([223.223.179.210]) by smtp.gmail.com with ESMTPSA id m2sm1430172pjh.36.2021.12.22.00.26.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Dec 2021 00:26:07 -0800 (PST) From: Zhiheng Chen To: Olivier Matz , Andrew Rybchenko Cc: dev@dpdk.org, Zhiheng Chen Subject: [PATCH v2] mempool: fix the description of some function return values Date: Wed, 22 Dec 2021 08:25:50 +0000 Message-Id: <20211222082550.436-1-chenzhiheng0227@gmail.com> X-Mailer: git-send-email 2.17.1 X-Mailman-Approved-At: Wed, 22 Dec 2021 11:01:03 +0100 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Compared to patch version 1, this version updates the descriptions of underlying functions. 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 --- lib/mempool/rte_mempool.h | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/lib/mempool/rte_mempool.h b/lib/mempool/rte_mempool.h index 1e7a3c1527..3b52bd6737 100644 --- a/lib/mempool/rte_mempool.h +++ b/lib/mempool/rte_mempool.h @@ -737,8 +737,8 @@ rte_mempool_ops_alloc(struct rte_mempool *mp); * @param n * Number of objects to get. * @return - * - 0: Success; got n objects. - * - <0: Error; code of dequeue function. + * - >=0: Success; number of objects supplied. + * - -ENOBUFS: Not enough entries in the mempool; no object is retrieved. */ static inline int rte_mempool_ops_dequeue_bulk(struct rte_mempool *mp, @@ -1453,7 +1453,7 @@ rte_mempool_put(struct rte_mempool *mp, void *obj) * A pointer to a mempool cache structure. May be NULL if not needed. * @return * - >=0: Success; number of objects supplied. - * - <0: Error; code of ring dequeue function. + * - -ENOBUFS: Not enough entries in the mempool; no object is retrieved. */ static __rte_always_inline int rte_mempool_do_generic_get(struct rte_mempool *mp, void **obj_table, @@ -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. * @@ -1534,8 +1534,8 @@ rte_mempool_do_generic_get(struct rte_mempool *mp, void **obj_table, * @param cache * 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. + * - >=0: Success; number of objects supplied. + * - -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. * @@ -1568,8 +1568,8 @@ rte_mempool_generic_get(struct rte_mempool *mp, void **obj_table, * @param n * 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. + * - >=0: Success; number of objects supplied. + * - -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) -- 2.32.0