[dpdk-dev] app/test: fix refcnt_mbuf_ring size

Message ID 1468821354-23612-1-git-send-email-jerin.jacob@caviumnetworks.com (mailing list archive)
State Accepted, archived
Headers

Commit Message

Jerin Jacob July 18, 2016, 5:55 a.m. UTC
  rte_ring_create expects the size of the ring to
be a power of 2. REFCNT_RING_SIZE value is not
power of 2 in-case if RTE_MAX_LCORE == 96.
Fix it by aligning the size to next power of 2 value.

Fixes: af75078f ("first public release")

Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
---
 app/test/test_mbuf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Olivier Matz July 21, 2016, 1:41 p.m. UTC | #1
Hi Jerin,

On 07/18/2016 07:55 AM, Jerin Jacob wrote:
> rte_ring_create expects the size of the ring to
> be a power of 2. REFCNT_RING_SIZE value is not
> power of 2 in-case if RTE_MAX_LCORE == 96.
> Fix it by aligning the size to next power of 2 value.
> 
> Fixes: af75078f ("first public release")
> 
> Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
> ---
>  app/test/test_mbuf.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/app/test/test_mbuf.c b/app/test/test_mbuf.c
> index 684ad80..c0823ea 100644
> --- a/app/test/test_mbuf.c
> +++ b/app/test/test_mbuf.c
> @@ -809,7 +809,7 @@ test_refcnt_mbuf(void)
>  
>  	if (refcnt_mbuf_ring == NULL &&
>  			(refcnt_mbuf_ring = rte_ring_create("refcnt_mbuf_ring",
> -			REFCNT_RING_SIZE, SOCKET_ID_ANY,
> +			rte_align32pow2(REFCNT_RING_SIZE), SOCKET_ID_ANY,
>  			RING_F_SP_ENQ)) == NULL) {
>  		printf("%s: cannot allocate " MAKE_STRING(refcnt_mbuf_ring)
>  		    "\n", __func__);
> 

Acked-by: Olivier Matz <olivier.matz@6wind.com>
  
Thomas Monjalon July 21, 2016, 9:51 p.m. UTC | #2
> > rte_ring_create expects the size of the ring to
> > be a power of 2. REFCNT_RING_SIZE value is not
> > power of 2 in-case if RTE_MAX_LCORE == 96.
> > Fix it by aligning the size to next power of 2 value.
> > 
> > Fixes: af75078f ("first public release")
> > 
> > Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
> 
> Acked-by: Olivier Matz <olivier.matz@6wind.com>

Applied, thanks
  

Patch

diff --git a/app/test/test_mbuf.c b/app/test/test_mbuf.c
index 684ad80..c0823ea 100644
--- a/app/test/test_mbuf.c
+++ b/app/test/test_mbuf.c
@@ -809,7 +809,7 @@  test_refcnt_mbuf(void)
 
 	if (refcnt_mbuf_ring == NULL &&
 			(refcnt_mbuf_ring = rte_ring_create("refcnt_mbuf_ring",
-			REFCNT_RING_SIZE, SOCKET_ID_ANY,
+			rte_align32pow2(REFCNT_RING_SIZE), SOCKET_ID_ANY,
 			RING_F_SP_ENQ)) == NULL) {
 		printf("%s: cannot allocate " MAKE_STRING(refcnt_mbuf_ring)
 		    "\n", __func__);