From patchwork Sat Dec 18 17:14:21 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhiheng Chen X-Patchwork-Id: 105303 Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 03D46A034C; Tue, 21 Dec 2021 10:05:33 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8D41E410E4; Tue, 21 Dec 2021 10:05:28 +0100 (CET) Received: from mail-pj1-f45.google.com (mail-pj1-f45.google.com [209.85.216.45]) by mails.dpdk.org (Postfix) with ESMTP id 1B5B84013F for ; Sat, 18 Dec 2021 18:15:33 +0100 (CET) Received: by mail-pj1-f45.google.com with SMTP id a11-20020a17090a854b00b001b11aae38d6so5913855pjw.2 for ; Sat, 18 Dec 2021 09:15:33 -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=lSHOPz8d17gYR/TSoncqamxxukg96uIYd7jz5aKvfHg=; b=LhmDm/LFS3PT1qgLhGkhwGF9+UrOpQRFdCcAbEz0PmuVYRMz1+aN9zMn1jPBcPmt3j JwyHOu1mFEC63s3l/vi+K6ikJD0oyzsG6wsUJikd6Ka73/E052YDfvtpLC3BgFLxkFV8 LJr+tKFouRlUeOj6u798ttSZebLtWDv6dB5exk/1dUTlwR+GQeTaLucQ0R/okgoMJthl EN9utEfFk6U0zdl2qp3q6NLsmC/+4HkwTo9UDRtR3la7pr0vEeowz3WZrOnrQrfxdXj0 T4ktmCEzkE/9FbokQFNmGMZX5FbNLB2YElW8SzZ8ScPGKigy9dwF5JckTQJyxVenzgIb lLvw== 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=lSHOPz8d17gYR/TSoncqamxxukg96uIYd7jz5aKvfHg=; b=Q3DrVA/baZcUHGrUKKnYQLpsmTir4l72LrY1N1mBWY5q8y1/Qx/pxvtuHzbr1Jxyga izc96mjFGlqfIjUTfc0eT/iIavcbw/v39LJl32rp11gWvKKFE5g659Wi3CKMxosGON3m TWdPY+khkPwPrrJJCON3Ioggx9DcslNlAIPDl8aHK7CyyV9zO4DLJkTdDm7kFrp5OMcE uZo58JE59heMSI/A9/8v8xq6Dp1Nwi0W9basjGJh9XqlUkVF/UK1fI39B/RIreyPgjoX E/rNNRSrZZrlRWyxQ/E9Z6LOrYlB4hUczHDGfz7H862eLF0WyN80iDnNFp5j6mZMj62q iD5g== X-Gm-Message-State: AOAM530i48/wHKWbmgLZDgtv9arjaas6qv2AME33vYlFHjJGCplapV7B bymwWggTBb/eaPVr+yKDLJw= X-Google-Smtp-Source: ABdhPJzzI/xZbeXdxYoILM4xVrdlz3msYky6a/PDPW1ckvCHQr0p49Olip0+55UiNWcTl4qQpiNu0A== X-Received: by 2002:a17:90b:1e41:: with SMTP id pi1mr3648296pjb.239.1639847732254; Sat, 18 Dec 2021 09:15:32 -0800 (PST) Received: from localhost.localdomain ([223.223.179.210]) by smtp.gmail.com with ESMTPSA id g22sm14724553pfj.29.2021.12.18.09.15.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Dec 2021 09:15:31 -0800 (PST) From: Zhiheng Chen To: Olivier Matz , Andrew Rybchenko Cc: dev@dpdk.org, Zhiheng Chen Subject: [PATCH] mempool: fix the description of some function return values Date: Sat, 18 Dec 2021 17:14:21 +0000 Message-Id: <20211218171421.8082-1-chenzhiheng0227@gmail.com> X-Mailer: git-send-email 2.17.1 X-Mailman-Approved-At: Tue, 21 Dec 2021 10:05:26 +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 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 | 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);