DPDK patches and discussions
 help / color / mirror / Atom feed
From: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
To: Olivier Matz <olivier.matz@6wind.com>, Ray Kinsella <mdr@ashroe.eu>
Cc: David Marchand <david.marchand@redhat.com>, dev@dpdk.org
Subject: [dpdk-dev] [PATCH v3 4/6] mempool: make header size calculation internal
Date: Tue, 19 Oct 2021 20:40:20 +0300	[thread overview]
Message-ID: <20211019174022.2036272-5-andrew.rybchenko@oktetlabs.ru> (raw)
In-Reply-To: <20211019174022.2036272-1-andrew.rybchenko@oktetlabs.ru>

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 <andrew.rybchenko@oktetlabs.ru>
---
 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 4ec236d239..0962bf06cf 100644
--- a/app/test/test_mempool.c
+++ b/app/test/test_mempool.c
@@ -113,7 +113,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 7db4cb38c0..5f780bbf9f 100644
--- a/doc/guides/rel_notes/release_21_11.rst
+++ b/doc/guides/rel_notes/release_21_11.rst
@@ -233,6 +233,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 4bb851f79b..c988ebd87a 100644
--- a/lib/mempool/rte_mempool.c
+++ b/lib/mempool/rte_mempool.c
@@ -888,7 +888,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);
 
@@ -904,7 +904,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;
@@ -928,7 +928,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 2657417edc..81646ee35d 100644
--- a/lib/mempool/rte_mempool.h
+++ b/lib/mempool/rte_mempool.h
@@ -312,17 +312,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(MEMPOOL_HEADER_SIZE) 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)
@@ -1739,7 +1743,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


  parent reply	other threads:[~2021-10-19 17:41 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-18 14:49 [dpdk-dev] [PATCH 0/6] mempool: cleanup namespace Andrew Rybchenko
2021-10-18 14:49 ` [dpdk-dev] [PATCH 1/6] mempool: avoid flags documentation in the next line Andrew Rybchenko
2021-10-18 14:49 ` [dpdk-dev] [PATCH 2/6] mempool: add namespace prefix to flags Andrew Rybchenko
2021-10-19  8:52   ` David Marchand
2021-10-19  9:40     ` Thomas Monjalon
2021-10-18 14:49 ` [dpdk-dev] [PATCH 3/6] mempool: add namespace to internal but still visible API Andrew Rybchenko
2021-10-19  8:47   ` David Marchand
2021-10-19  9:10     ` Andrew Rybchenko
2021-10-18 14:49 ` [dpdk-dev] [PATCH 4/6] mempool: make header size calculation internal Andrew Rybchenko
2021-10-19  8:48   ` David Marchand
2021-10-19  8:59     ` Andrew Rybchenko
2021-10-18 14:49 ` [dpdk-dev] [PATCH 5/6] mempool: add namespace to driver register macro Andrew Rybchenko
2021-10-19  8:49   ` David Marchand
2021-10-19  9:04     ` Andrew Rybchenko
2021-10-19  9:23       ` Andrew Rybchenko
2021-10-19  9:27       ` David Marchand
2021-10-19  9:38         ` Andrew Rybchenko
2021-10-19  9:42         ` Thomas Monjalon
2021-10-18 14:49 ` [dpdk-dev] [PATCH 6/6] mempool: deprecate unused defines Andrew Rybchenko
2021-10-19 10:08 ` [dpdk-dev] [PATCH v2 0/6] mempool: cleanup namespace Andrew Rybchenko
2021-10-19 10:08   ` [dpdk-dev] [PATCH v2 1/6] mempool: avoid flags documentation in the next line Andrew Rybchenko
2021-10-19 16:13     ` Olivier Matz
2021-10-19 10:08   ` [dpdk-dev] [PATCH v2 2/6] mempool: add namespace prefix to flags Andrew Rybchenko
2021-10-19 16:13     ` Olivier Matz
2021-10-19 16:15       ` Olivier Matz
2021-10-19 17:45       ` Andrew Rybchenko
2021-10-19 10:08   ` [dpdk-dev] [PATCH v2 3/6] mempool: add namespace to internal but still visible API Andrew Rybchenko
2021-10-19 16:14     ` Olivier Matz
2021-10-19 10:08   ` [dpdk-dev] [PATCH v2 4/6] mempool: make header size calculation internal Andrew Rybchenko
2021-10-19 16:14     ` Olivier Matz
2021-10-19 17:23       ` Andrew Rybchenko
2021-10-19 10:08   ` [dpdk-dev] [PATCH v2 5/6] mempool: add namespace to driver register macro Andrew Rybchenko
2021-10-19 16:16     ` Olivier Matz
2021-10-19 10:08   ` [dpdk-dev] [PATCH v2 6/6] mempool: deprecate unused defines Andrew Rybchenko
2021-10-19 16:21     ` Olivier Matz
2021-10-19 17:23       ` Andrew Rybchenko
2021-10-19 17:40 ` [dpdk-dev] [PATCH v3 0/6] mempool: cleanup namespace Andrew Rybchenko
2021-10-19 17:40   ` [dpdk-dev] [PATCH v3 1/6] mempool: avoid flags documentation in the next line Andrew Rybchenko
2021-10-19 17:40   ` [dpdk-dev] [PATCH v3 2/6] mempool: add namespace prefix to flags Andrew Rybchenko
2021-10-19 20:03     ` David Marchand
2021-10-20  7:50       ` Andrew Rybchenko
2021-10-19 17:40   ` [dpdk-dev] [PATCH v3 3/6] mempool: add namespace to internal but still visible API Andrew Rybchenko
2021-10-19 17:40   ` Andrew Rybchenko [this message]
2021-10-20  6:55     ` [dpdk-dev] [PATCH v3 4/6] mempool: make header size calculation internal Olivier Matz
2021-10-19 17:40   ` [dpdk-dev] [PATCH v3 5/6] mempool: add namespace to driver register macro Andrew Rybchenko
2021-10-20  6:57     ` Olivier Matz
2021-10-19 17:40   ` [dpdk-dev] [PATCH v3 6/6] mempool: deprecate unused defines Andrew Rybchenko
2021-10-20  7:08     ` Olivier Matz
2021-10-19 20:09   ` [dpdk-dev] [PATCH v3 0/6] mempool: cleanup namespace David Marchand
2021-10-20  7:52     ` David Marchand
2021-10-20  7:54       ` Andrew Rybchenko
2021-10-20  7:52     ` Andrew Rybchenko
2021-10-20  8:07       ` David Marchand

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211019174022.2036272-5-andrew.rybchenko@oktetlabs.ru \
    --to=andrew.rybchenko@oktetlabs.ru \
    --cc=david.marchand@redhat.com \
    --cc=dev@dpdk.org \
    --cc=mdr@ashroe.eu \
    --cc=olivier.matz@6wind.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).