DPDK patches and discussions
 help / color / mirror / Atom feed
From: Santosh Shukla <santosh.shukla@caviumnetworks.com>
To: olivier.matz@6wind.com, dev@dpdk.org
Cc: thomas@monjalon.net, jerin.jacob@caviumnetworks.com,
	hemant.agrawal@nxp.com,
	Santosh Shukla <santosh.shukla@caviumnetworks.com>
Subject: [dpdk-dev] [PATCH v4 1/7] mempool: fix flags data type
Date: Tue, 15 Aug 2017 11:37:37 +0530	[thread overview]
Message-ID: <20170815060743.21076-2-santosh.shukla@caviumnetworks.com> (raw)
In-Reply-To: <20170815060743.21076-1-santosh.shukla@caviumnetworks.com>

mp->flags is int and mempool API updates unsigned int
value in 'flags', so fix the 'flags' data type.

Patch also does mp->flags cleanup like:
* Remove redundant 'flags' API description from
  - __rte_mempool_generic_put
  - __rte_mempool_generic_get

* Remove unused 'flags' param from
  - rte_mempool_generic_put
  - rte_mempool_generic_get

* Fix mempool var data types int mempool.c
  - mz_flags is int, Change it to unsigned int.

Fixes: af75078fec ("first public release")
Fixes: 454a0a7009 ("mempool: use cache in single producer or consumer mode")
Fixes: d6f78df6fe ("mempool: use bit flags for multi consumers and producers")
Fixes: d1d914ebbc ("mempool: allocate in several memory chunks by default")

Signed-off-by: Santosh Shukla <santosh.shukla@caviumnetworks.com>
---
 lib/librte_mempool/rte_mempool.c |  4 ++--
 lib/librte_mempool/rte_mempool.h | 23 +++++------------------
 test/test/test_mempool.c         | 18 +++++++++---------
 test/test/test_mempool_perf.c    |  4 ++--
 4 files changed, 18 insertions(+), 31 deletions(-)

diff --git a/lib/librte_mempool/rte_mempool.c b/lib/librte_mempool/rte_mempool.c
index 6fc3c9c7c..237665c65 100644
--- a/lib/librte_mempool/rte_mempool.c
+++ b/lib/librte_mempool/rte_mempool.c
@@ -515,7 +515,7 @@ rte_mempool_populate_virt(struct rte_mempool *mp, char *addr,
 int
 rte_mempool_populate_default(struct rte_mempool *mp)
 {
-	int mz_flags = RTE_MEMZONE_1GB|RTE_MEMZONE_SIZE_HINT_ONLY;
+	unsigned int mz_flags = RTE_MEMZONE_1GB|RTE_MEMZONE_SIZE_HINT_ONLY;
 	char mz_name[RTE_MEMZONE_NAMESIZE];
 	const struct rte_memzone *mz;
 	size_t size, total_elt_sz, align, pg_sz, pg_shift;
@@ -742,7 +742,7 @@ rte_mempool_create_empty(const char *name, unsigned n, unsigned elt_size,
 	struct rte_tailq_entry *te = NULL;
 	const struct rte_memzone *mz = NULL;
 	size_t mempool_size;
-	int mz_flags = RTE_MEMZONE_1GB|RTE_MEMZONE_SIZE_HINT_ONLY;
+	unsigned int mz_flags = RTE_MEMZONE_1GB|RTE_MEMZONE_SIZE_HINT_ONLY;
 	struct rte_mempool_objsz objsz;
 	unsigned lcore_id;
 	int ret;
diff --git a/lib/librte_mempool/rte_mempool.h b/lib/librte_mempool/rte_mempool.h
index 76b5b3b15..bd7be2319 100644
--- a/lib/librte_mempool/rte_mempool.h
+++ b/lib/librte_mempool/rte_mempool.h
@@ -226,7 +226,7 @@ struct rte_mempool {
 	};
 	void *pool_config;               /**< optional args for ops alloc. */
 	const struct rte_memzone *mz;    /**< Memzone where pool is alloc'd. */
-	int flags;                       /**< Flags of the mempool. */
+	unsigned int flags;              /**< Flags of the mempool. */
 	int socket_id;                   /**< Socket id passed at create. */
 	uint32_t size;                   /**< Max size of the mempool. */
 	uint32_t cache_size;
@@ -1034,9 +1034,6 @@ rte_mempool_default_cache(struct rte_mempool *mp, unsigned lcore_id)
  *   positive.
  * @param cache
  *   A pointer to a mempool cache structure. May be NULL if not needed.
- * @param flags
- *   The flags used for the mempool creation.
- *   Single-producer (MEMPOOL_F_SP_PUT flag) or multi-producers.
  */
 static __rte_always_inline void
 __mempool_generic_put(struct rte_mempool *mp, void * const *obj_table,
@@ -1096,14 +1093,10 @@ __mempool_generic_put(struct rte_mempool *mp, void * const *obj_table,
  *   The number of objects to add in the mempool from the obj_table.
  * @param cache
  *   A pointer to a mempool cache structure. May be NULL if not needed.
- * @param flags
- *   The flags used for the mempool creation.
- *   Single-producer (MEMPOOL_F_SP_PUT flag) or multi-producers.
  */
 static __rte_always_inline void
 rte_mempool_generic_put(struct rte_mempool *mp, void * const *obj_table,
-			unsigned n, struct rte_mempool_cache *cache,
-			__rte_unused int flags)
+			unsigned n, struct rte_mempool_cache *cache)
 {
 	__mempool_check_cookies(mp, obj_table, n, 0);
 	__mempool_generic_put(mp, obj_table, n, cache);
@@ -1129,7 +1122,7 @@ rte_mempool_put_bulk(struct rte_mempool *mp, void * const *obj_table,
 {
 	struct rte_mempool_cache *cache;
 	cache = rte_mempool_default_cache(mp, rte_lcore_id());
-	rte_mempool_generic_put(mp, obj_table, n, cache, mp->flags);
+	rte_mempool_generic_put(mp, obj_table, n, cache);
 }
 
 /**
@@ -1160,9 +1153,6 @@ rte_mempool_put(struct rte_mempool *mp, void *obj)
  *   The number of objects to get, must be strictly positive.
  * @param cache
  *   A pointer to a mempool cache structure. May be NULL if not needed.
- * @param flags
- *   The flags used for the mempool creation.
- *   Single-consumer (MEMPOOL_F_SC_GET flag) or multi-consumers.
  * @return
  *   - >=0: Success; number of objects supplied.
  *   - <0: Error; code of ring dequeue function.
@@ -1241,16 +1231,13 @@ __mempool_generic_get(struct rte_mempool *mp, void **obj_table,
  *   The number of objects to get from mempool to obj_table.
  * @param cache
  *   A pointer to a mempool cache structure. May be NULL if not needed.
- * @param flags
- *   The flags used for the mempool creation.
- *   Single-consumer (MEMPOOL_F_SC_GET flag) or multi-consumers.
  * @return
  *   - 0: Success; objects taken.
  *   - -ENOENT: 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, unsigned n,
-			struct rte_mempool_cache *cache, __rte_unused int flags)
+			struct rte_mempool_cache *cache)
 {
 	int ret;
 	ret = __mempool_generic_get(mp, obj_table, n, cache);
@@ -1286,7 +1273,7 @@ rte_mempool_get_bulk(struct rte_mempool *mp, void **obj_table, unsigned n)
 {
 	struct rte_mempool_cache *cache;
 	cache = rte_mempool_default_cache(mp, rte_lcore_id());
-	return rte_mempool_generic_get(mp, obj_table, n, cache, mp->flags);
+	return rte_mempool_generic_get(mp, obj_table, n, cache);
 }
 
 /**
diff --git a/test/test/test_mempool.c b/test/test/test_mempool.c
index 0a4423954..47dc3ac5f 100644
--- a/test/test/test_mempool.c
+++ b/test/test/test_mempool.c
@@ -129,7 +129,7 @@ test_mempool_basic(struct rte_mempool *mp, int use_external_cache)
 	rte_mempool_dump(stdout, mp);
 
 	printf("get an object\n");
-	if (rte_mempool_generic_get(mp, &obj, 1, cache, 0) < 0)
+	if (rte_mempool_generic_get(mp, &obj, 1, cache) < 0)
 		GOTO_ERR(ret, out);
 	rte_mempool_dump(stdout, mp);
 
@@ -152,21 +152,21 @@ test_mempool_basic(struct rte_mempool *mp, int use_external_cache)
 #endif
 
 	printf("put the object back\n");
-	rte_mempool_generic_put(mp, &obj, 1, cache, 0);
+	rte_mempool_generic_put(mp, &obj, 1, cache);
 	rte_mempool_dump(stdout, mp);
 
 	printf("get 2 objects\n");
-	if (rte_mempool_generic_get(mp, &obj, 1, cache, 0) < 0)
+	if (rte_mempool_generic_get(mp, &obj, 1, cache) < 0)
 		GOTO_ERR(ret, out);
-	if (rte_mempool_generic_get(mp, &obj2, 1, cache, 0) < 0) {
-		rte_mempool_generic_put(mp, &obj, 1, cache, 0);
+	if (rte_mempool_generic_get(mp, &obj2, 1, cache) < 0) {
+		rte_mempool_generic_put(mp, &obj, 1, cache);
 		GOTO_ERR(ret, out);
 	}
 	rte_mempool_dump(stdout, mp);
 
 	printf("put the objects back\n");
-	rte_mempool_generic_put(mp, &obj, 1, cache, 0);
-	rte_mempool_generic_put(mp, &obj2, 1, cache, 0);
+	rte_mempool_generic_put(mp, &obj, 1, cache);
+	rte_mempool_generic_put(mp, &obj2, 1, cache);
 	rte_mempool_dump(stdout, mp);
 
 	/*
@@ -178,7 +178,7 @@ test_mempool_basic(struct rte_mempool *mp, int use_external_cache)
 		GOTO_ERR(ret, out);
 
 	for (i = 0; i < MEMPOOL_SIZE; i++) {
-		if (rte_mempool_generic_get(mp, &objtable[i], 1, cache, 0) < 0)
+		if (rte_mempool_generic_get(mp, &objtable[i], 1, cache) < 0)
 			break;
 	}
 
@@ -200,7 +200,7 @@ test_mempool_basic(struct rte_mempool *mp, int use_external_cache)
 				ret = -1;
 		}
 
-		rte_mempool_generic_put(mp, &objtable[i], 1, cache, 0);
+		rte_mempool_generic_put(mp, &objtable[i], 1, cache);
 	}
 
 	free(objtable);
diff --git a/test/test/test_mempool_perf.c b/test/test/test_mempool_perf.c
index 07b28c066..3b8f7de7c 100644
--- a/test/test/test_mempool_perf.c
+++ b/test/test/test_mempool_perf.c
@@ -186,7 +186,7 @@ per_lcore_mempool_test(void *arg)
 				ret = rte_mempool_generic_get(mp,
 							      &obj_table[idx],
 							      n_get_bulk,
-							      cache, 0);
+							      cache);
 				if (unlikely(ret < 0)) {
 					rte_mempool_dump(stdout, mp);
 					/* in this case, objects are lost... */
@@ -200,7 +200,7 @@ per_lcore_mempool_test(void *arg)
 			while (idx < n_keep) {
 				rte_mempool_generic_put(mp, &obj_table[idx],
 							n_put_bulk,
-							cache, 0);
+							cache);
 				idx += n_put_bulk;
 			}
 		}
-- 
2.11.0

  reply	other threads:[~2017-08-15  6:08 UTC|newest]

Thread overview: 116+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-21 17:32 [dpdk-dev] [PATCH 0/4] Infrastructure to support octeontx HW mempool manager Santosh Shukla
2017-06-21 17:32 ` [dpdk-dev] [PATCH 1/4] mempool: get the external mempool capability Santosh Shukla
2017-07-03 16:37   ` Olivier Matz
2017-07-05  6:41     ` santosh
2017-07-10 13:55       ` Olivier Matz
2017-07-10 16:09         ` santosh
2017-06-21 17:32 ` [dpdk-dev] [PATCH 2/4] mempool: detect physical contiguous object in pool Santosh Shukla
2017-07-03 16:37   ` Olivier Matz
2017-07-05  7:07     ` santosh
2017-06-21 17:32 ` [dpdk-dev] [PATCH 3/4] mempool: introduce block size align flag Santosh Shukla
2017-07-03 16:37   ` Olivier Matz
2017-07-05  7:35     ` santosh
2017-07-10 13:15       ` Olivier Matz
2017-07-10 16:22         ` santosh
2017-06-21 17:32 ` [dpdk-dev] [PATCH 4/4] mempool: update range info to pool Santosh Shukla
2017-07-13  9:32 ` [dpdk-dev] [PATCH v2 0/6] Infrastructure to support octeontx HW mempool manager Santosh Shukla
2017-07-13  9:32   ` [dpdk-dev] [PATCH v2 1/6] mempool: fix flags data type Santosh Shukla
2017-07-13  9:32   ` [dpdk-dev] [PATCH v2 2/6] mempool: get the mempool capability Santosh Shukla
2017-07-13  9:32   ` [dpdk-dev] [PATCH v2 3/6] mempool: detect physical contiguous object in pool Santosh Shukla
2017-07-13  9:32   ` [dpdk-dev] [PATCH v2 4/6] mempool: add mempool arg in xmem size and usage Santosh Shukla
2017-07-13  9:32   ` [dpdk-dev] [PATCH v2 5/6] mempool: introduce block size align flag Santosh Shukla
2017-07-13  9:32   ` [dpdk-dev] [PATCH v2 6/6] mempool: update range info to pool Santosh Shukla
2017-07-18  6:07   ` [dpdk-dev] [PATCH v2 0/6] Infrastructure to support octeontx HW mempool manager santosh
2017-07-20 13:47   ` [dpdk-dev] [PATCH v3 " Santosh Shukla
2017-07-20 13:47     ` [dpdk-dev] [PATCH v3 1/6] mempool: fix flags data type Santosh Shukla
2017-07-20 13:47     ` [dpdk-dev] [PATCH v3 2/6] mempool: get the mempool capability Santosh Shukla
2017-07-20 13:47     ` [dpdk-dev] [PATCH v3 3/6] mempool: detect physical contiguous object in pool Santosh Shukla
2017-07-20 13:47     ` [dpdk-dev] [PATCH v3 4/6] mempool: add mempool arg in xmem size and usage Santosh Shukla
2017-07-20 13:47     ` [dpdk-dev] [PATCH v3 5/6] mempool: introduce block size align flag Santosh Shukla
2017-07-20 13:47     ` [dpdk-dev] [PATCH v3 6/6] mempool: update range info to pool Santosh Shukla
2017-08-15  6:07     ` [dpdk-dev] [PATCH v4 0/7] Infrastructure to support octeontx HW mempool manager Santosh Shukla
2017-08-15  6:07       ` Santosh Shukla [this message]
2017-09-04 14:11         ` [dpdk-dev] [PATCH v4 1/7] mempool: fix flags data type Olivier MATZ
2017-09-04 14:18           ` santosh
2017-08-15  6:07       ` [dpdk-dev] [PATCH v4 2/7] mempool: add mempool arg in xmem size and usage Santosh Shukla
2017-09-04 14:22         ` Olivier MATZ
2017-09-04 14:33           ` santosh
2017-09-04 14:46             ` Olivier MATZ
2017-09-04 14:58               ` santosh
2017-09-04 15:23                 ` Olivier MATZ
2017-09-04 15:52                   ` santosh
2017-08-15  6:07       ` [dpdk-dev] [PATCH v4 3/7] doc: remove mempool api change notice Santosh Shukla
2017-08-15  6:07       ` [dpdk-dev] [PATCH v4 4/7] mempool: get the mempool capability Santosh Shukla
2017-09-04 14:32         ` Olivier MATZ
2017-09-04 14:44           ` santosh
2017-09-04 15:56             ` Olivier MATZ
2017-09-04 16:29               ` santosh
2017-08-15  6:07       ` [dpdk-dev] [PATCH v4 5/7] mempool: detect physical contiguous object in pool Santosh Shukla
2017-09-04 14:43         ` Olivier MATZ
2017-09-04 14:47           ` santosh
2017-09-04 16:00             ` Olivier MATZ
2017-08-15  6:07       ` [dpdk-dev] [PATCH v4 6/7] mempool: introduce block size align flag Santosh Shukla
2017-09-04 16:20         ` Olivier MATZ
2017-09-04 17:45           ` santosh
2017-09-07  7:27             ` Olivier MATZ
2017-09-07  7:37               ` santosh
2017-08-15  6:07       ` [dpdk-dev] [PATCH v4 7/7] mempool: update range info to pool Santosh Shukla
2017-09-06 11:28       ` [dpdk-dev] [PATCH v5 0/8] Infrastructure to support octeontx HW mempool manager Santosh Shukla
2017-09-06 11:28         ` [dpdk-dev] [PATCH v5 1/8] mempool: remove unused flags argument Santosh Shukla
2017-09-07  7:41           ` Olivier MATZ
2017-09-06 11:28         ` [dpdk-dev] [PATCH v5 2/8] mempool: change flags from int to unsigned int Santosh Shukla
2017-09-07  7:43           ` Olivier MATZ
2017-09-06 11:28         ` [dpdk-dev] [PATCH v5 3/8] mempool: add flags arg in xmem size and usage Santosh Shukla
2017-09-07  7:46           ` Olivier MATZ
2017-09-07  7:49             ` santosh
2017-09-06 11:28         ` [dpdk-dev] [PATCH v5 4/8] doc: remove mempool notice Santosh Shukla
2017-09-07  7:47           ` Olivier MATZ
2017-09-06 11:28         ` [dpdk-dev] [PATCH v5 5/8] mempool: get the mempool capability Santosh Shukla
2017-09-07  7:59           ` Olivier MATZ
2017-09-07  8:15             ` santosh
2017-09-07  8:39               ` Olivier MATZ
2017-09-06 11:28         ` [dpdk-dev] [PATCH v5 6/8] mempool: detect physical contiguous object in pool Santosh Shukla
2017-09-07  8:05           ` Olivier MATZ
2017-09-06 11:28         ` [dpdk-dev] [PATCH v5 7/8] mempool: introduce block size align flag Santosh Shukla
2017-09-07  8:13           ` Olivier MATZ
2017-09-07  8:27             ` santosh
2017-09-07  8:57               ` Olivier MATZ
2017-09-06 11:28         ` [dpdk-dev] [PATCH v5 8/8] mempool: update range info to pool Santosh Shukla
2017-09-07  8:30           ` Olivier MATZ
2017-09-07  8:56             ` santosh
2017-09-07  9:09               ` Olivier MATZ
2017-09-07 15:30         ` [dpdk-dev] [PATCH v6 0/8] Infrastructure to support octeontx HW mempool manager Santosh Shukla
2017-09-07 15:30           ` [dpdk-dev] [PATCH v6 1/8] mempool: remove unused flags argument Santosh Shukla
2017-09-07 15:30           ` [dpdk-dev] [PATCH v6 2/8] mempool: change flags from int to unsigned int Santosh Shukla
2017-09-07 15:30           ` [dpdk-dev] [PATCH v6 3/8] mempool: add flags arg in xmem size and usage Santosh Shukla
2017-09-25 11:24             ` Olivier MATZ
2017-09-07 15:30           ` [dpdk-dev] [PATCH v6 4/8] doc: remove mempool notice Santosh Shukla
2017-09-07 15:30           ` [dpdk-dev] [PATCH v6 5/8] mempool: get the mempool capability Santosh Shukla
2017-09-25 11:26             ` Olivier MATZ
2017-09-07 15:30           ` [dpdk-dev] [PATCH v6 6/8] mempool: detect physical contiguous object in pool Santosh Shukla
2017-09-07 15:30           ` [dpdk-dev] [PATCH v6 7/8] mempool: introduce block size align flag Santosh Shukla
2017-09-22 12:59             ` Hemant Agrawal
2017-09-25 11:32             ` Olivier MATZ
2017-09-25 22:08               ` santosh
2017-09-07 15:30           ` [dpdk-dev] [PATCH v6 8/8] mempool: notify memory area to pool Santosh Shukla
2017-09-25 11:41             ` Olivier MATZ
2017-09-25 22:18               ` santosh
2017-09-29  4:53                 ` santosh
2017-09-29  8:20                   ` Olivier MATZ
2017-09-29  8:25                     ` santosh
2017-09-13  9:58           ` [dpdk-dev] [PATCH v6 0/8] Infrastructure to support octeontx HW mempool manager santosh
2017-09-19  8:26             ` santosh
2017-10-01  9:28           ` [dpdk-dev] [PATCH v7 " Santosh Shukla
2017-10-01  9:28             ` [dpdk-dev] [PATCH v7 1/8] mempool: remove unused flags argument Santosh Shukla
2017-10-01  9:28             ` [dpdk-dev] [PATCH v7 2/8] mempool: change flags from int to unsigned int Santosh Shukla
2017-10-01  9:28             ` [dpdk-dev] [PATCH v7 3/8] mempool: add flags arg in xmem size and usage Santosh Shukla
2017-10-01  9:28             ` [dpdk-dev] [PATCH v7 4/8] doc: remove mempool notice Santosh Shukla
2017-10-01  9:28             ` [dpdk-dev] [PATCH v7 5/8] mempool: get the mempool capability Santosh Shukla
2017-10-01  9:29             ` [dpdk-dev] [PATCH v7 6/8] mempool: detect physical contiguous object in pool Santosh Shukla
2017-10-01  9:29             ` [dpdk-dev] [PATCH v7 7/8] mempool: introduce block size align flag Santosh Shukla
2017-10-02  8:35               ` santosh
2017-10-02 14:26               ` Olivier MATZ
2017-10-01  9:29             ` [dpdk-dev] [PATCH v7 8/8] mempool: notify memory area to pool Santosh Shukla
2017-10-02  8:36               ` santosh
2017-10-02 14:27               ` Olivier MATZ
2017-10-06 20:00             ` [dpdk-dev] [PATCH v7 0/8] Infrastructure to support octeontx HW mempool manager Thomas Monjalon

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=20170815060743.21076-2-santosh.shukla@caviumnetworks.com \
    --to=santosh.shukla@caviumnetworks.com \
    --cc=dev@dpdk.org \
    --cc=hemant.agrawal@nxp.com \
    --cc=jerin.jacob@caviumnetworks.com \
    --cc=olivier.matz@6wind.com \
    --cc=thomas@monjalon.net \
    /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).