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 0F55AA0C43; Tue, 19 Oct 2021 12:09:22 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2FE7C4113C; Tue, 19 Oct 2021 12:09:12 +0200 (CEST) Received: from shelob.oktetlabs.ru (shelob.oktetlabs.ru [91.220.146.113]) by mails.dpdk.org (Postfix) with ESMTP id 1CC2B41143 for ; Tue, 19 Oct 2021 12:09:10 +0200 (CEST) Received: by shelob.oktetlabs.ru (Postfix, from userid 122) id D9CFE7F6FD; Tue, 19 Oct 2021 13:09:09 +0300 (MSK) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on shelob.oktetlabs.ru X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=ALL_TRUSTED, DKIM_ADSP_DISCARD autolearn=no autolearn_force=no version=3.4.2 Received: from aros.oktetlabs.ru (aros.oktetlabs.ru [192.168.38.17]) by shelob.oktetlabs.ru (Postfix) with ESMTP id DA7A17F6F9; Tue, 19 Oct 2021 13:08:49 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 shelob.oktetlabs.ru DA7A17F6F9 Authentication-Results: shelob.oktetlabs.ru/DA7A17F6F9; dkim=none; dkim-atps=neutral From: Andrew Rybchenko To: Olivier Matz , David Marchand , Ray Kinsella Cc: dev@dpdk.org Date: Tue, 19 Oct 2021 13:08:43 +0300 Message-Id: <20211019100845.1632332-5-andrew.rybchenko@oktetlabs.ru> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20211019100845.1632332-1-andrew.rybchenko@oktetlabs.ru> References: <20211018144907.1145028-1-andrew.rybchenko@oktetlabs.ru> <20211019100845.1632332-1-andrew.rybchenko@oktetlabs.ru> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v2 4/6] mempool: make header size calculation internal 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 Sender: "dev" Add RTE_ prefix to helper macro to calculate mempool header size and make it internal. Old macro is still available, but deprecated. Signed-off-by: Andrew Rybchenko --- app/test/test_mempool.c | 2 +- doc/guides/rel_notes/deprecation.rst | 4 ++++ doc/guides/rel_notes/release_21_11.rst | 3 +++ lib/mempool/rte_mempool.c | 6 +++--- lib/mempool/rte_mempool.h | 10 +++++++--- 5 files changed, 18 insertions(+), 7 deletions(-) diff --git a/app/test/test_mempool.c b/app/test/test_mempool.c index ffe69e2d03..8ecd0f10b8 100644 --- a/app/test/test_mempool.c +++ b/app/test/test_mempool.c @@ -111,7 +111,7 @@ test_mempool_basic(struct rte_mempool *mp, int use_external_cache) printf("get private data\n"); if (rte_mempool_get_priv(mp) != (char *)mp + - MEMPOOL_HEADER_SIZE(mp, mp->cache_size)) + RTE_MEMPOOL_HEADER_SIZE(mp, mp->cache_size)) GOTO_ERR(ret, out); #ifndef RTE_EXEC_ENV_FREEBSD /* rte_mem_virt2iova() not supported on bsd */ diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst index 45239ca56e..bc3aca8ef1 100644 --- a/doc/guides/rel_notes/deprecation.rst +++ b/doc/guides/rel_notes/deprecation.rst @@ -39,6 +39,10 @@ Deprecation Notices ``__atomic_thread_fence`` must be used for patches that need to be merged in 20.08 onwards. This change will not introduce any performance degradation. +* mempool: Helper macro ``MEMPOOL_HEADER_SIZE()`` is deprecated and will + be removed in DPDK 22.11. The replacement macro + ``RTE_MEMPOOL_HEADER_SIZE()`` is internal only. + * mbuf: The mbuf offload flags ``PKT_*`` will be renamed as ``RTE_MBUF_F_*``. A compatibility layer will be kept until DPDK 22.11, except for the flags that are already deprecated (``PKT_RX_L4_CKSUM_BAD``, ``PKT_RX_IP_CKSUM_BAD``, diff --git a/doc/guides/rel_notes/release_21_11.rst b/doc/guides/rel_notes/release_21_11.rst index 9a0e3832a3..e95ddb93a6 100644 --- a/doc/guides/rel_notes/release_21_11.rst +++ b/doc/guides/rel_notes/release_21_11.rst @@ -224,6 +224,9 @@ API Changes * mempool: The mempool flags ``MEMPOOL_F_*`` will be deprecated in the future. Newly added flags with ``RTE_MEMPOOL_F_`` prefix should be used instead. +* mempool: Helper macro ``MEMPOOL_HEADER_SIZE()`` is deprecated. + The replacement macro ``RTE_MEMPOOL_HEADER_SIZE()`` is internal only. + * net: Renamed ``s_addr`` and ``d_addr`` fields of ``rte_ether_hdr`` structure to ``src_addr`` and ``dst_addr``, respectively. diff --git a/lib/mempool/rte_mempool.c b/lib/mempool/rte_mempool.c index 638eaa5fa2..4e3a15e49c 100644 --- a/lib/mempool/rte_mempool.c +++ b/lib/mempool/rte_mempool.c @@ -861,7 +861,7 @@ rte_mempool_create_empty(const char *name, unsigned n, unsigned elt_size, goto exit_unlock; } - mempool_size = MEMPOOL_HEADER_SIZE(mp, cache_size); + mempool_size = RTE_MEMPOOL_HEADER_SIZE(mp, cache_size); mempool_size += private_data_size; mempool_size = RTE_ALIGN_CEIL(mempool_size, RTE_MEMPOOL_ALIGN); @@ -877,7 +877,7 @@ rte_mempool_create_empty(const char *name, unsigned n, unsigned elt_size, /* init the mempool structure */ mp = mz->addr; - memset(mp, 0, MEMPOOL_HEADER_SIZE(mp, cache_size)); + memset(mp, 0, RTE_MEMPOOL_HEADER_SIZE(mp, cache_size)); ret = strlcpy(mp->name, name, sizeof(mp->name)); if (ret < 0 || ret >= (int)sizeof(mp->name)) { rte_errno = ENAMETOOLONG; @@ -901,7 +901,7 @@ rte_mempool_create_empty(const char *name, unsigned n, unsigned elt_size, * The local_cache points to just past the elt_pa[] array. */ mp->local_cache = (struct rte_mempool_cache *) - RTE_PTR_ADD(mp, MEMPOOL_HEADER_SIZE(mp, 0)); + RTE_PTR_ADD(mp, RTE_MEMPOOL_HEADER_SIZE(mp, 0)); /* Init all default caches. */ if (cache_size != 0) { diff --git a/lib/mempool/rte_mempool.h b/lib/mempool/rte_mempool.h index 979ab071cb..11ef60247e 100644 --- a/lib/mempool/rte_mempool.h +++ b/lib/mempool/rte_mempool.h @@ -310,17 +310,21 @@ struct rte_mempool { #endif /** - * Calculate the size of the mempool header. + * @internal Calculate the size of the mempool header. * * @param mp * Pointer to the memory pool. * @param cs * Size of the per-lcore cache. */ -#define MEMPOOL_HEADER_SIZE(mp, cs) \ +#define RTE_MEMPOOL_HEADER_SIZE(mp, cs) \ (sizeof(*(mp)) + (((cs) == 0) ? 0 : \ (sizeof(struct rte_mempool_cache) * RTE_MAX_LCORE))) +/** Deprecated. Use RTE_MEMPOOL_HEADER_SIZE() for internal purposes only. */ +#define MEMPOOL_HEADER_SIZE(mp, cs) \ + RTE_DEPRECATED(RTE_MEMPOOL_HEADER_SIZE(mp, cs)) + /* return the header of a mempool object (internal) */ static inline struct rte_mempool_objhdr * rte_mempool_get_header(void *obj) @@ -1737,7 +1741,7 @@ void rte_mempool_audit(struct rte_mempool *mp); static inline void *rte_mempool_get_priv(struct rte_mempool *mp) { return (char *)mp + - MEMPOOL_HEADER_SIZE(mp, mp->cache_size); + RTE_MEMPOOL_HEADER_SIZE(mp, mp->cache_size); } /** -- 2.30.2