dev.dpdk.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] Move the error check inside __mempool_check_cookies()
@ 2014-10-04 23:10 Keith Wiles
       [not found] ` <1412464229-125521-1-git-send-email-keith.wiles-CWA4WttNNZF54TAoqtyWWQ@public.gmane.org>
  0 siblings, 1 reply; 15+ messages in thread
From: Keith Wiles @ 2014-10-04 23:10 UTC (permalink / raw)
  To: dev-VfR2kkLFssw

Three places check for the return value from __mempool_get_bulk to be zero
and then call the debug routine __mempool_check_cookies(). The test is
not required if moved into the debug routine. Minor cleanup and mostly
does not effect performance, unless the is not removed by the compiler
in the case where teh debug routine is not defined.

Signed-off-by: Keith Wiles <keith.wiles-CWA4WttNNZF54TAoqtyWWQ@public.gmane.org>
---
 lib/librte_mempool/rte_mempool.h | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/lib/librte_mempool/rte_mempool.h b/lib/librte_mempool/rte_mempool.h
index 597cf4f..154fdd4 100644
--- a/lib/librte_mempool/rte_mempool.h
+++ b/lib/librte_mempool/rte_mempool.h
@@ -325,6 +325,9 @@ static inline void __mempool_check_cookies(const struct rte_mempool *mp,
 	void *obj;
 	void **obj_table;
 
+	if ( n < 0 )
+		return;
+
 	/* Force to drop the "const" attribute. This is done only when
 	 * DEBUG is enabled */
 	tmp = (void *) obj_table_const;
@@ -1029,8 +1032,7 @@ rte_mempool_mc_get_bulk(struct rte_mempool *mp, void **obj_table, unsigned n)
 {
 	int ret;
 	ret = __mempool_get_bulk(mp, obj_table, n, 1);
-	if (ret == 0)
-		__mempool_check_cookies(mp, obj_table, n, 1);
+	__mempool_check_cookies(mp, obj_table, n, 1);
 	return ret;
 }
 
@@ -1058,8 +1060,7 @@ rte_mempool_sc_get_bulk(struct rte_mempool *mp, void **obj_table, unsigned n)
 {
 	int ret;
 	ret = __mempool_get_bulk(mp, obj_table, n, 0);
-	if (ret == 0)
-		__mempool_check_cookies(mp, obj_table, n, 1);
+	__mempool_check_cookies(mp, obj_table, n, 1);
 	return ret;
 }
 
@@ -1091,8 +1092,7 @@ rte_mempool_get_bulk(struct rte_mempool *mp, void **obj_table, unsigned n)
 	int ret;
 	ret = __mempool_get_bulk(mp, obj_table, n,
 				 !(mp->flags & MEMPOOL_F_SC_GET));
-	if (ret == 0)
-		__mempool_check_cookies(mp, obj_table, n, 1);
+	__mempool_check_cookies(mp, obj_table, n, 1);
 	return ret;
 }
 
-- 
2.1.0

^ permalink raw reply related	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2014-10-07 16:33 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-04 23:10 [PATCH 1/2] Move the error check inside __mempool_check_cookies() Keith Wiles
     [not found] ` <1412464229-125521-1-git-send-email-keith.wiles-CWA4WttNNZF54TAoqtyWWQ@public.gmane.org>
2014-10-04 23:10   ` [PATCH 2/2] Adding the routines rte_pktmbuf_alloc_bulk() and rte_pktmbuf_free_bulk() Keith Wiles
     [not found]     ` <1412464229-125521-2-git-send-email-keith.wiles-CWA4WttNNZF54TAoqtyWWQ@public.gmane.org>
2014-10-06  8:56       ` Richardson, Bruce
     [not found]         ` <59AF69C657FD0841A61C55336867B5B03441BE9E-kPTMFJFq+rELt2AQoY/u9bfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2014-10-06 14:50           ` Wiles, Roger Keith
     [not found]             ` <5DD5FF6E-C045-4764-A5B1-877C88B023F5-CWA4WttNNZF54TAoqtyWWQ@public.gmane.org>
2014-10-06 14:53               ` Bruce Richardson
2014-10-06 15:54                 ` Ananyev, Konstantin
     [not found]                   ` <2601191342CEEE43887BDE71AB97725821390E75-kPTMFJFq+rEu0RiL9chJVbfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2014-10-06 16:13                     ` Wiles, Roger Keith
     [not found]                       ` <545592DF-3306-49F7-8685-10BD021B9854-CWA4WttNNZF54TAoqtyWWQ@public.gmane.org>
2014-10-06 19:45                         ` Wiles, Roger Keith
     [not found]                           ` <1AAECD5E-9A22-481D-9712-C75B8C1FAFC1-CWA4WttNNZF54TAoqtyWWQ@public.gmane.org>
2014-10-06 20:07                             ` Wiles, Roger Keith
     [not found]                               ` <844D44A2-27B2-47F9-BB6D-5A3A2F1757F6-CWA4WttNNZF54TAoqtyWWQ@public.gmane.org>
2014-10-07  9:09                                 ` Ananyev, Konstantin
     [not found]                                   ` <2601191342CEEE43887BDE71AB97725821391035-kPTMFJFq+rEu0RiL9chJVbfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2014-10-07 14:22                                     ` Wiles, Roger Keith
     [not found]                                       ` <1CB2412C-DC76-438D-A35F-BB03BA6A2A3A-CWA4WttNNZF54TAoqtyWWQ@public.gmane.org>
2014-10-07 15:42                                         ` Ananyev, Konstantin
     [not found]                                           ` <2601191342CEEE43887BDE71AB97725821391240-kPTMFJFq+rEu0RiL9chJVbfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2014-10-07 15:56                                             ` Wiles, Roger Keith
     [not found]                                               ` <388C030D-2E72-4B97-A909-F27DDB4055BE-CWA4WttNNZF54TAoqtyWWQ@public.gmane.org>
2014-10-07 16:33                                                 ` Ananyev, Konstantin
2014-10-04 23:17   ` [PATCH 1/2] Move the error check inside __mempool_check_cookies() Wiles, Roger Keith

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).