From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from dpdk.org (dpdk.org [92.243.14.124])
	by inbox.dpdk.org (Postfix) with ESMTP id D7339A04F9;
	Thu,  2 Jan 2020 17:31:59 +0100 (CET)
Received: from [92.243.14.124] (localhost [127.0.0.1])
	by dpdk.org (Postfix) with ESMTP id 2F7AB1C0C3;
	Thu,  2 Jan 2020 17:31:59 +0100 (CET)
Received: from mga17.intel.com (mga17.intel.com [192.55.52.151])
 by dpdk.org (Postfix) with ESMTP id 687E71C07C
 for <dev@dpdk.org>; Thu,  2 Jan 2020 17:31:57 +0100 (CET)
X-Amp-Result: SKIPPED(no attachment in message)
X-Amp-File-Uploaded: False
Received: from orsmga001.jf.intel.com ([10.7.209.18])
 by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;
 02 Jan 2020 08:31:55 -0800
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.69,387,1571727600"; d="scan'208";a="302007865"
Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203])
 by orsmga001.jf.intel.com with ESMTP; 02 Jan 2020 08:31:55 -0800
Received: from FMSEDG001.ED.cps.intel.com (10.1.192.133) by
 FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS)
 id 14.3.439.0; Thu, 2 Jan 2020 08:31:54 -0800
Received: from NAM02-CY1-obe.outbound.protection.outlook.com (104.47.37.59) by
 edgegateway.intel.com (192.55.55.68) with Microsoft SMTP Server
 (TLS) id 14.3.439.0; Thu, 2 Jan 2020 08:31:53 -0800
ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none;
 b=dZG155zyGJJVkgsMFiSVJhLp94YKrtPfCq4b4X6/pSayYqD8pds/AQa02xDU6gewUCMNBpq2JLpfTePNYPgY5J3/x0W4g4XUwKuvI+n8ALgtIj65UCswtaeRQyAqEuOxJ3/QKgMikvF/REmiwIL0cbrqVUdXhY/XB7Qx6vOaaU3ukbKeR2we3w/4JWUOl1yVWYHbFCOykxq2OkG5PDoHKV6b1k+iXmvcXXHfSl1xLjmmVLtmiF+ufg9GpHWZe1k2CHpX8/26oI9baZpb4aoQlXaTwFXf5LqSOAIcRtq4GJGuYp9u1GzE5hPuJ2J089MzZJ5RpvOXjigOcSRLOeziUw==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; 
 s=arcselector9901;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
 bh=ApUhNfF7Th6HFmyUkUOwbfQh3si53kPlNxtEIqISh2I=;
 b=Nij3iDGEWfxc/AdAv3tMrZ5MUx1EVM2nlv4BBO/rbOyfBah9hYx3MjGuFoKOhD0lL+4Itw5TYCHhT6sRUTosvnwbOEBwxNQqBtO5VZizptE/X9+ASV87DMMd/8PkgYXsLKa9eF7eV8IUCs4gITmqWkQJj2bXPVwpUKZQZ74tzOUaRB2Yliv6ZozjhJYumGAhZRFJ4i5qqBBJw2b6lFkko9FsvXp7Ec6P9xxc45r9etygsCNWdDBtyxlqRRhn/MQEyZTlgiK4VHsHlURSU6NFZEo4EggY1LLJVB84vL1X9OI7GVvczGXsaj5WZEAl0GesuhxzN5frWPKSV8bxstcN/g==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass
 smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com;
 dkim=pass header.d=intel.com; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; 
 s=selector2-intel-onmicrosoft-com;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
 bh=ApUhNfF7Th6HFmyUkUOwbfQh3si53kPlNxtEIqISh2I=;
 b=Wit/lkFjjmBhAIdEA/W4rCruE3cF5mrp+RqnZolVw/B5IPCuAVZrctf+vbrvYfDsgqzEGeEeQfsvpf8bIqQ+vHEB5L7OEcJtFOo6laErBqQo3+e6unpqxrunfQcwmnnhFHMXHXK1hy8thB4L0teaP7LYhVbRpKdMTcPSpBoUp3k=
Received: from SN6PR11MB2558.namprd11.prod.outlook.com (52.135.94.19) by
 SN6PR11MB2959.namprd11.prod.outlook.com (52.135.127.213) with Microsoft SMTP
 Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id
 15.20.2602.12; Thu, 2 Jan 2020 16:31:52 +0000
Received: from SN6PR11MB2558.namprd11.prod.outlook.com
 ([fe80::4d86:362a:13c3:8386]) by SN6PR11MB2558.namprd11.prod.outlook.com
 ([fe80::4d86:362a:13c3:8386%7]) with mapi id 15.20.2602.012; Thu, 2 Jan 2020
 16:31:52 +0000
From: "Ananyev, Konstantin" <konstantin.ananyev@intel.com>
To: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>,
 "olivier.matz@6wind.com" <olivier.matz@6wind.com>, "sthemmin@microsoft.com"
 <sthemmin@microsoft.com>, "jerinj@marvell.com" <jerinj@marvell.com>,
 "Richardson, Bruce" <bruce.richardson@intel.com>, "david.marchand@redhat.com"
 <david.marchand@redhat.com>, "pbhagavatula@marvell.com"
 <pbhagavatula@marvell.com>
CC: "dev@dpdk.org" <dev@dpdk.org>, "dharmik.thakkar@arm.com"
 <dharmik.thakkar@arm.com>, "ruifeng.wang@arm.com" <ruifeng.wang@arm.com>,
 "gavin.hu@arm.com" <gavin.hu@arm.com>, "nd@arm.com" <nd@arm.com>
Thread-Topic: [PATCH v7 03/17] test/ring: add functional tests for
 rte_ring_xxx_elem APIs
Thread-Index: AQHVtvB05AIL1u+3/UGhXZRhDoUYw6fXmQ/g
Date: Thu, 2 Jan 2020 16:31:51 +0000
Message-ID: <SN6PR11MB2558F2FEDB0D4D1BC55AF6C19A200@SN6PR11MB2558.namprd11.prod.outlook.com>
References: <20190906190510.11146-1-honnappa.nagarahalli@arm.com>
 <20191220044524.32910-1-honnappa.nagarahalli@arm.com>
 <20191220044524.32910-4-honnappa.nagarahalli@arm.com>
In-Reply-To: <20191220044524.32910-4-honnappa.nagarahalli@arm.com>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNTc2MDU3YTktNjQ5Yi00YWZmLWE2ZjgtZGZlYTIyNzBhYzFiIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiVWhHekRWK2tZQ3BCUkdPZXhZMHlRcVVTQ1hIS2pcL0NPXC8yOERrckF6UkFoNDhkWlwvRlM3a2ZjY1pXS3duazlKdiJ9
dlp-product: dlpe-windows
dlp-reaction: no-action
dlp-version: 11.2.0.6
x-ctpclassification: CTP_NT
authentication-results: spf=none (sender IP is )
 smtp.mailfrom=konstantin.ananyev@intel.com; 
x-originating-ip: [192.198.151.189]
x-ms-publictraffictype: Email
x-ms-office365-filtering-correlation-id: f24bd4d1-8635-4d44-e814-08d78fa145ef
x-ms-traffictypediagnostic: SN6PR11MB2959:
x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr
x-ms-exchange-transport-forked: True
x-microsoft-antispam-prvs: <SN6PR11MB295916CD4DE24EACE3BE76639A200@SN6PR11MB2959.namprd11.prod.outlook.com>
x-ms-oob-tlc-oobclassifiers: OLM:9508;
x-forefront-prvs: 0270ED2845
x-forefront-antispam-report: SFV:NSPM;
 SFS:(10019020)(39860400002)(346002)(396003)(366004)(376002)(136003)(189003)(199004)(51234002)(7696005)(33656002)(66946007)(66556008)(66476007)(76116006)(64756008)(66446008)(4326008)(7416002)(2906002)(6506007)(86362001)(30864003)(54906003)(110136005)(81166006)(81156014)(8936002)(26005)(8676002)(186003)(316002)(71200400001)(478600001)(52536014)(9686003)(5660300002)(55016002)(21314003)(579004);
 DIR:OUT; SFP:1102; SCL:1; SRVR:SN6PR11MB2959;
 H:SN6PR11MB2558.namprd11.prod.outlook.com; FPR:; SPF:None; LANG:en;
 PTR:InfoNoRecords; MX:1; A:1; 
x-ms-exchange-senderadcheck: 1
x-microsoft-antispam: BCL:0;
x-microsoft-antispam-message-info: Oo+4WXNQeXBedlZDyNjCFLAdFCW7NimpPq6KjRmmoyHWBTrztTVWSSrpQDd9q7HrbClnlPHraO/FhDOUaQBguyKc5ijsqZNwySzhi1XzQ5zbOxbAMT7vu5/uUHw+AJ4afwFqIwCRZjL2D8tUWzwLFGozyC3QqVbIfVgIroznHdOtdeupdX2FSmu9Htn0t7tQc9bg6uVEV0B73+70omk33lejF1tjiiyZEPoIigis5i9dtdjSKKgZPmN8G19lH3f4K+NiZlRriXwxDzOeveeN4YZGlD81nsN1PGyVRkk8Za/RzVSaBWf+GaK7PSP52fgGjQKd5ymxJlVM86KP1ndMwa1ZjSkf8ee/zLFzsnUxXkKyrOr2kEtfQWVaIMFRz+MCpTf3kM9SgjYTurBDZZwEI/vn7cHqw6+BVmkY7P8suM9ZsLqrQa31UzortsM2S3Oqx6rPOkndrglw9L+IiNhemZ78GAwSLmALu5u1l0UkIJ40HTjg8cNaJHu56S4IwWC5FW8dE2vSDNrvlx/POEv3zA==
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
X-MS-Exchange-CrossTenant-Network-Message-Id: f24bd4d1-8635-4d44-e814-08d78fa145ef
X-MS-Exchange-CrossTenant-originalarrivaltime: 02 Jan 2020 16:31:51.9423 (UTC)
X-MS-Exchange-CrossTenant-fromentityheader: Hosted
X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d
X-MS-Exchange-CrossTenant-mailboxtype: HOSTED
X-MS-Exchange-CrossTenant-userprincipalname: mdRrtIgY2MCn3Hdx/N4gelCId7EjhEnf2Kqq1mcewOU7U15pADWk5NSIobPhtzhfOmQx2z+4PQ8Lqu/1oHjOmo9EOJwrAPVEzriMPKWiROo=
X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR11MB2959
X-OriginatorOrg: intel.com
Subject: Re: [dpdk-dev] [PATCH v7 03/17] test/ring: add functional tests for
 rte_ring_xxx_elem APIs
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>


Hi Honnappa,

> Add basic infrastructure to test rte_ring_xxx_elem APIs. Add
> test cases for testing burst and bulk tests.
>=20
> Signed-off-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
> Reviewed-by: Gavin Hu <gavin.hu@arm.com>
> ---
>  app/test/test_ring.c | 466 ++++++++++++++++++++-----------------------
>  app/test/test_ring.h | 203 +++++++++++++++++++
>  2 files changed, 419 insertions(+), 250 deletions(-)
>  create mode 100644 app/test/test_ring.h
>=20
> diff --git a/app/test/test_ring.c b/app/test/test_ring.c
> index aaf1e70ad..e7a8b468b 100644
> --- a/app/test/test_ring.c
> +++ b/app/test/test_ring.c
> @@ -23,11 +23,13 @@
>  #include <rte_branch_prediction.h>
>  #include <rte_malloc.h>
>  #include <rte_ring.h>
> +#include <rte_ring_elem.h>
>  #include <rte_random.h>
>  #include <rte_errno.h>
>  #include <rte_hexdump.h>
>=20
>  #include "test.h"
> +#include "test_ring.h"
>=20
>  /*
>   * Ring
> @@ -67,6 +69,50 @@ static rte_atomic32_t synchro;
>=20
>  #define	TEST_RING_FULL_EMTPY_ITER	8
>=20
> +static int esize[] =3D {-1, 4, 8, 16};
> +
> +static void
> +test_ring_mem_init(void *obj, unsigned int count, int esize)
> +{
> +	unsigned int i;
> +
> +	/* Legacy queue APIs? */
> +	if (esize =3D=3D -1)
> +		for (i =3D 0; i < count; i++)
> +			((void **)obj)[i] =3D (void *)(unsigned long)i;
> +	else
> +		for (i =3D 0; i < (count * esize / sizeof(uint32_t)); i++)
> +			((uint32_t *)obj)[i] =3D i;
> +}
> +
> +static void
> +test_ring_print_test_string(const char *istr, unsigned int api_type, int=
 esize)
> +{
> +	printf("\n%s: ", istr);
> +
> +	if (esize =3D=3D -1)
> +		printf("legacy APIs: ");
> +	else
> +		printf("elem APIs: element size %dB ", esize);
> +
> +	if (api_type =3D=3D TEST_RING_IGNORE_API_TYPE)
> +		return;
> +
> +	if ((api_type & TEST_RING_N) =3D=3D TEST_RING_N)
> +		printf(": default enqueue/dequeue: ");
> +	else if ((api_type & TEST_RING_S) =3D=3D TEST_RING_S)
> +		printf(": SP/SC: ");
> +	else if ((api_type & TEST_RING_M) =3D=3D TEST_RING_M)
> +		printf(": MP/MC: ");
> +
> +	if ((api_type & TEST_RING_SL) =3D=3D TEST_RING_SL)
> +		printf("single\n");
> +	else if ((api_type & TEST_RING_BL) =3D=3D TEST_RING_BL)
> +		printf("bulk\n");
> +	else if ((api_type & TEST_RING_BR) =3D=3D TEST_RING_BR)
> +		printf("burst\n");
> +}
> +
>  /*
>   * helper routine for test_ring_basic
>   */
> @@ -314,286 +360,203 @@ test_ring_basic(struct rte_ring *r)
>  	return -1;
>  }
>=20
> +/*
> + * Burst and bulk operations with sp/sc, mp/mc and default (during creat=
ion)
> + */
>  static int
> -test_ring_burst_basic(struct rte_ring *r)
> +test_ring_burst_bulk_tests(unsigned int api_type)
>  {
> +	struct rte_ring *r;
>  	void **src =3D NULL, **cur_src =3D NULL, **dst =3D NULL, **cur_dst =3D =
NULL;
>  	int ret;
> -	unsigned i;
> +	unsigned int i, j;
> +	unsigned int num_elems;
>=20
> -	/* alloc dummy object pointers */
> -	src =3D malloc(RING_SIZE*2*sizeof(void *));
> -	if (src =3D=3D NULL)
> -		goto fail;
> -
> -	for (i =3D 0; i < RING_SIZE*2 ; i++) {
> -		src[i] =3D (void *)(unsigned long)i;
> -	}
> -	cur_src =3D src;
> +	for (i =3D 0; i < RTE_DIM(esize); i++) {
> +		test_ring_print_test_string("Test standard ring", api_type,
> +						esize[i]);
>=20
> -	/* alloc some room for copied objects */
> -	dst =3D malloc(RING_SIZE*2*sizeof(void *));
> -	if (dst =3D=3D NULL)
> -		goto fail;
> +		/* Create the ring */
> +		TEST_RING_CREATE("test_ring_burst_bulk_tests", esize[i],
> +					RING_SIZE, SOCKET_ID_ANY, 0, r);
>=20
> -	memset(dst, 0, RING_SIZE*2*sizeof(void *));
> -	cur_dst =3D dst;
> -
> -	printf("Test SP & SC basic functions \n");
> -	printf("enqueue 1 obj\n");
> -	ret =3D rte_ring_sp_enqueue_burst(r, cur_src, 1, NULL);
> -	cur_src +=3D 1;
> -	if (ret !=3D 1)
> -		goto fail;
> -
> -	printf("enqueue 2 objs\n");
> -	ret =3D rte_ring_sp_enqueue_burst(r, cur_src, 2, NULL);
> -	cur_src +=3D 2;
> -	if (ret !=3D 2)
> -		goto fail;
> -
> -	printf("enqueue MAX_BULK objs\n");
> -	ret =3D rte_ring_sp_enqueue_burst(r, cur_src, MAX_BULK, NULL);
> -	cur_src +=3D MAX_BULK;
> -	if (ret !=3D MAX_BULK)
> -		goto fail;
> -
> -	printf("dequeue 1 obj\n");
> -	ret =3D rte_ring_sc_dequeue_burst(r, cur_dst, 1, NULL);
> -	cur_dst +=3D 1;
> -	if (ret !=3D 1)
> -		goto fail;
> -
> -	printf("dequeue 2 objs\n");
> -	ret =3D rte_ring_sc_dequeue_burst(r, cur_dst, 2, NULL);
> -	cur_dst +=3D 2;
> -	if (ret !=3D 2)
> -		goto fail;
> +		/* alloc dummy object pointers */
> +		src =3D test_ring_calloc(RING_SIZE * 2, esize[i]);
> +		if (src =3D=3D NULL)
> +			goto fail;
> +		test_ring_mem_init(src, RING_SIZE * 2, esize[i]);
> +		cur_src =3D src;
>=20
> -	printf("dequeue MAX_BULK objs\n");
> -	ret =3D rte_ring_sc_dequeue_burst(r, cur_dst, MAX_BULK, NULL);
> -	cur_dst +=3D MAX_BULK;
> -	if (ret !=3D MAX_BULK)
> -		goto fail;
> +		/* alloc some room for copied objects */
> +		dst =3D test_ring_calloc(RING_SIZE * 2, esize[i]);
> +		if (dst =3D=3D NULL)
> +			goto fail;
> +		cur_dst =3D dst;
>=20
> -	/* check data */
> -	if (memcmp(src, dst, cur_dst - dst)) {
> -		rte_hexdump(stdout, "src", src, cur_src - src);
> -		rte_hexdump(stdout, "dst", dst, cur_dst - dst);
> -		printf("data after dequeue is not the same\n");
> -		goto fail;
> -	}
> +		printf("enqueue 1 obj\n");
> +		TEST_RING_ENQUEUE(r, cur_src, esize[i], 1, ret, api_type);
> +		if (ret !=3D 1)
> +			goto fail;
> +		TEST_RING_INCP(cur_src, esize[i], 1);
>=20
> -	cur_src =3D src;
> -	cur_dst =3D dst;
> +		printf("enqueue 2 objs\n");
> +		TEST_RING_ENQUEUE(r, cur_src, esize[i], 2, ret, api_type);
> +		if (ret !=3D 2)
> +			goto fail;
> +		TEST_RING_INCP(cur_src, esize[i], 2);
>=20
> -	printf("Test enqueue without enough memory space \n");
> -	for (i =3D 0; i< (RING_SIZE/MAX_BULK - 1); i++) {
> -		ret =3D rte_ring_sp_enqueue_burst(r, cur_src, MAX_BULK, NULL);
> -		cur_src +=3D MAX_BULK;
> +		printf("enqueue MAX_BULK objs\n");
> +		TEST_RING_ENQUEUE(r, cur_src, esize[i], MAX_BULK, ret,
> +						api_type);
>  		if (ret !=3D MAX_BULK)
>  			goto fail;
> -	}
> -
> -	printf("Enqueue 2 objects, free entries =3D MAX_BULK - 2  \n");
> -	ret =3D rte_ring_sp_enqueue_burst(r, cur_src, 2, NULL);
> -	cur_src +=3D 2;
> -	if (ret !=3D 2)
> -		goto fail;
> +		TEST_RING_INCP(cur_src, esize[i], MAX_BULK);
>=20
> -	printf("Enqueue the remaining entries =3D MAX_BULK - 2  \n");
> -	/* Always one free entry left */
> -	ret =3D rte_ring_sp_enqueue_burst(r, cur_src, MAX_BULK, NULL);
> -	cur_src +=3D MAX_BULK - 3;
> -	if (ret !=3D MAX_BULK - 3)
> -		goto fail;
> -
> -	printf("Test if ring is full  \n");
> -	if (rte_ring_full(r) !=3D 1)
> -		goto fail;
> +		printf("dequeue 1 obj\n");
> +		TEST_RING_DEQUEUE(r, cur_dst, esize[i], 1, ret, api_type);
> +		if (ret !=3D 1)
> +			goto fail;
> +		TEST_RING_INCP(cur_dst, esize[i], 1);
>=20
> -	printf("Test enqueue for a full entry  \n");
> -	ret =3D rte_ring_sp_enqueue_burst(r, cur_src, MAX_BULK, NULL);
> -	if (ret !=3D 0)
> -		goto fail;
> +		printf("dequeue 2 objs\n");
> +		TEST_RING_DEQUEUE(r, cur_dst, esize[i], 2, ret, api_type);
> +		if (ret !=3D 2)
> +			goto fail;
> +		TEST_RING_INCP(cur_dst, esize[i], 2);
>=20
> -	printf("Test dequeue without enough objects \n");
> -	for (i =3D 0; i<RING_SIZE/MAX_BULK - 1; i++) {
> -		ret =3D rte_ring_sc_dequeue_burst(r, cur_dst, MAX_BULK, NULL);
> -		cur_dst +=3D MAX_BULK;
> +		printf("dequeue MAX_BULK objs\n");
> +		TEST_RING_DEQUEUE(r, cur_dst, esize[i], MAX_BULK, ret,
> +						api_type);
>  		if (ret !=3D MAX_BULK)
>  			goto fail;
> -	}
> -
> -	/* Available memory space for the exact MAX_BULK entries */
> -	ret =3D rte_ring_sc_dequeue_burst(r, cur_dst, 2, NULL);
> -	cur_dst +=3D 2;
> -	if (ret !=3D 2)
> -		goto fail;
> -
> -	ret =3D rte_ring_sc_dequeue_burst(r, cur_dst, MAX_BULK, NULL);
> -	cur_dst +=3D MAX_BULK - 3;
> -	if (ret !=3D MAX_BULK - 3)
> -		goto fail;
> -
> -	printf("Test if ring is empty \n");
> -	/* Check if ring is empty */
> -	if (1 !=3D rte_ring_empty(r))
> -		goto fail;
> -
> -	/* check data */
> -	if (memcmp(src, dst, cur_dst - dst)) {
> -		rte_hexdump(stdout, "src", src, cur_src - src);
> -		rte_hexdump(stdout, "dst", dst, cur_dst - dst);
> -		printf("data after dequeue is not the same\n");
> -		goto fail;
> -	}
> +		TEST_RING_INCP(cur_dst, esize[i], MAX_BULK);
>=20
> -	cur_src =3D src;
> -	cur_dst =3D dst;
> -
> -	printf("Test MP & MC basic functions \n");
> -
> -	printf("enqueue 1 obj\n");
> -	ret =3D rte_ring_mp_enqueue_burst(r, cur_src, 1, NULL);
> -	cur_src +=3D 1;
> -	if (ret !=3D 1)
> -		goto fail;
> -
> -	printf("enqueue 2 objs\n");
> -	ret =3D rte_ring_mp_enqueue_burst(r, cur_src, 2, NULL);
> -	cur_src +=3D 2;
> -	if (ret !=3D 2)
> -		goto fail;
> -
> -	printf("enqueue MAX_BULK objs\n");
> -	ret =3D rte_ring_mp_enqueue_burst(r, cur_src, MAX_BULK, NULL);
> -	cur_src +=3D MAX_BULK;
> -	if (ret !=3D MAX_BULK)
> -		goto fail;
> -
> -	printf("dequeue 1 obj\n");
> -	ret =3D rte_ring_mc_dequeue_burst(r, cur_dst, 1, NULL);
> -	cur_dst +=3D 1;
> -	if (ret !=3D 1)
> -		goto fail;
> -
> -	printf("dequeue 2 objs\n");
> -	ret =3D rte_ring_mc_dequeue_burst(r, cur_dst, 2, NULL);
> -	cur_dst +=3D 2;
> -	if (ret !=3D 2)
> -		goto fail;
> -
> -	printf("dequeue MAX_BULK objs\n");
> -	ret =3D rte_ring_mc_dequeue_burst(r, cur_dst, MAX_BULK, NULL);
> -	cur_dst +=3D MAX_BULK;
> -	if (ret !=3D MAX_BULK)
> -		goto fail;
> -
> -	/* check data */
> -	if (memcmp(src, dst, cur_dst - dst)) {
> -		rte_hexdump(stdout, "src", src, cur_src - src);
> -		rte_hexdump(stdout, "dst", dst, cur_dst - dst);
> -		printf("data after dequeue is not the same\n");
> -		goto fail;
> -	}
> -
> -	cur_src =3D src;
> -	cur_dst =3D dst;
> +		/* check data */
> +		if (memcmp(src, dst, cur_dst - dst)) {
> +			rte_hexdump(stdout, "src", src, cur_src - src);
> +			rte_hexdump(stdout, "dst", dst, cur_dst - dst);
> +			printf("data after dequeue is not the same\n");
> +			goto fail;
> +		}
> +
> +		cur_src =3D src;
> +		cur_dst =3D dst;
> +
> +		printf("fill and empty the ring\n");
> +		for (j =3D 0; j < RING_SIZE / MAX_BULK; j++) {
> +			TEST_RING_ENQUEUE(r, cur_src, esize[i], MAX_BULK,
> +							ret, api_type);
> +			if (ret !=3D MAX_BULK)
> +				goto fail;
> +			TEST_RING_INCP(cur_src, esize[i], MAX_BULK);
> +
> +			TEST_RING_DEQUEUE(r, cur_dst, esize[i], MAX_BULK,
> +							ret, api_type);
> +			if (ret !=3D MAX_BULK)
> +				goto fail;
> +			TEST_RING_INCP(cur_dst, esize[i], MAX_BULK);
> +		}
>=20
> -	printf("fill and empty the ring\n");
> -	for (i =3D 0; i<RING_SIZE/MAX_BULK; i++) {
> -		ret =3D rte_ring_mp_enqueue_burst(r, cur_src, MAX_BULK, NULL);
> -		cur_src +=3D MAX_BULK;
> -		if (ret !=3D MAX_BULK)
> +		/* check data */
> +		if (memcmp(src, dst, cur_dst - dst)) {
> +			rte_hexdump(stdout, "src", src, cur_src - src);
> +			rte_hexdump(stdout, "dst", dst, cur_dst - dst);
> +			printf("data after dequeue is not the same\n");
>  			goto fail;
> -		ret =3D rte_ring_mc_dequeue_burst(r, cur_dst, MAX_BULK, NULL);
> -		cur_dst +=3D MAX_BULK;
> -		if (ret !=3D MAX_BULK)
> +		}
> +
> +		cur_src =3D src;
> +		cur_dst =3D dst;
> +
> +		printf("Test enqueue without enough memory space\n");
> +		for (j =3D 0; j < (RING_SIZE/MAX_BULK - 1); j++) {
> +			TEST_RING_ENQUEUE(r, cur_src, esize[i], MAX_BULK,
> +							ret, api_type);
> +			if (ret !=3D MAX_BULK)
> +				goto fail;
> +			TEST_RING_INCP(cur_src, esize[i], MAX_BULK);
> +		}
> +
> +		printf("Enqueue 2 objects, free entries =3D MAX_BULK - 2\n");
> +		TEST_RING_ENQUEUE(r, cur_src, esize[i], 2, ret, api_type);
> +		if (ret !=3D 2)
>  			goto fail;
> -	}
> -
> -	/* check data */
> -	if (memcmp(src, dst, cur_dst - dst)) {
> -		rte_hexdump(stdout, "src", src, cur_src - src);
> -		rte_hexdump(stdout, "dst", dst, cur_dst - dst);
> -		printf("data after dequeue is not the same\n");
> -		goto fail;
> -	}
> -
> -	cur_src =3D src;
> -	cur_dst =3D dst;
> -
> -	printf("Test enqueue without enough memory space \n");
> -	for (i =3D 0; i<RING_SIZE/MAX_BULK - 1; i++) {
> -		ret =3D rte_ring_mp_enqueue_burst(r, cur_src, MAX_BULK, NULL);
> -		cur_src +=3D MAX_BULK;
> -		if (ret !=3D MAX_BULK)
> +		TEST_RING_INCP(cur_src, esize[i], 2);
> +
> +
> +		printf("Enqueue the remaining entries =3D MAX_BULK - 3\n");
> +		/* Bulk APIs enqueue exact number of elements */
> +		if ((api_type & TEST_RING_BL) =3D=3D TEST_RING_BL)
> +			num_elems =3D MAX_BULK - 3;
> +		else
> +			num_elems =3D MAX_BULK;
> +		/* Always one free entry left */
> +		TEST_RING_ENQUEUE(r, cur_src, esize[i], num_elems,
> +						ret, api_type);
> +		if (ret !=3D MAX_BULK - 3)
>  			goto fail;
> -	}
> -
> -	/* Available memory space for the exact MAX_BULK objects */
> -	ret =3D rte_ring_mp_enqueue_burst(r, cur_src, 2, NULL);
> -	cur_src +=3D 2;
> -	if (ret !=3D 2)
> -		goto fail;
> +		TEST_RING_INCP(cur_src, esize[i], MAX_BULK - 3);
>=20
> -	ret =3D rte_ring_mp_enqueue_burst(r, cur_src, MAX_BULK, NULL);
> -	cur_src +=3D MAX_BULK - 3;
> -	if (ret !=3D MAX_BULK - 3)
> -		goto fail;
> +		printf("Test if ring is full\n");
> +		if (rte_ring_full(r) !=3D 1)
> +			goto fail;
>=20
> +		printf("Test enqueue for a full entry\n");
> +		TEST_RING_ENQUEUE(r, cur_src, esize[i], MAX_BULK,
> +						ret, api_type);
> +		if (ret !=3D 0)
> +			goto fail;
>=20
> -	printf("Test dequeue without enough objects \n");
> -	for (i =3D 0; i<RING_SIZE/MAX_BULK - 1; i++) {
> -		ret =3D rte_ring_mc_dequeue_burst(r, cur_dst, MAX_BULK, NULL);
> -		cur_dst +=3D MAX_BULK;
> -		if (ret !=3D MAX_BULK)
> +		printf("Test dequeue without enough objects\n");
> +		for (j =3D 0; j < RING_SIZE / MAX_BULK - 1; j++) {
> +			TEST_RING_DEQUEUE(r, cur_dst, esize[i], MAX_BULK,
> +							ret, api_type);
> +			if (ret !=3D MAX_BULK)
> +				goto fail;
> +			TEST_RING_INCP(cur_dst, esize[i], MAX_BULK);
> +		}
> +
> +		/* Available memory space for the exact MAX_BULK entries */
> +		TEST_RING_DEQUEUE(r, cur_dst, esize[i], 2, ret, api_type);
> +		if (ret !=3D 2)
>  			goto fail;
> -	}
> +		TEST_RING_INCP(cur_dst, esize[i], 2);
> +
> +		/* Bulk APIs enqueue exact number of elements */
> +		if ((api_type & TEST_RING_BL) =3D=3D TEST_RING_BL)
> +			num_elems =3D MAX_BULK - 3;
> +		else
> +			num_elems =3D MAX_BULK;
> +		TEST_RING_DEQUEUE(r, cur_dst, esize[i], num_elems,
> +						ret, api_type);
> +		if (ret !=3D MAX_BULK - 3)
> +			goto fail;
> +		TEST_RING_INCP(cur_dst, esize[i], MAX_BULK - 3);
>=20
> -	/* Available objects - the exact MAX_BULK */
> -	ret =3D rte_ring_mc_dequeue_burst(r, cur_dst, 2, NULL);
> -	cur_dst +=3D 2;
> -	if (ret !=3D 2)
> -		goto fail;
> +		printf("Test if ring is empty\n");
> +		/* Check if ring is empty */
> +		if (rte_ring_empty(r) !=3D 1)
> +			goto fail;
>=20
> -	ret =3D rte_ring_mc_dequeue_burst(r, cur_dst, MAX_BULK, NULL);
> -	cur_dst +=3D MAX_BULK - 3;
> -	if (ret !=3D MAX_BULK - 3)
> -		goto fail;
> +		/* check data */
> +		if (memcmp(src, dst, cur_dst - dst)) {
> +			rte_hexdump(stdout, "src", src, cur_src - src);
> +			rte_hexdump(stdout, "dst", dst, cur_dst - dst);
> +			printf("data after dequeue is not the same\n");
> +			goto fail;
> +		}
>=20
> -	/* check data */
> -	if (memcmp(src, dst, cur_dst - dst)) {
> -		rte_hexdump(stdout, "src", src, cur_src - src);
> -		rte_hexdump(stdout, "dst", dst, cur_dst - dst);
> -		printf("data after dequeue is not the same\n");
> -		goto fail;
> +		/* Free memory before test completed */
> +		rte_ring_free(r);
> +		rte_free(src);
> +		rte_free(dst);
>  	}
>=20
> -	cur_src =3D src;
> -	cur_dst =3D dst;
> -
> -	printf("Covering rte_ring_enqueue_burst functions \n");
> -
> -	ret =3D rte_ring_enqueue_burst(r, cur_src, 2, NULL);
> -	cur_src +=3D 2;
> -	if (ret !=3D 2)
> -		goto fail;
> -
> -	ret =3D rte_ring_dequeue_burst(r, cur_dst, 2, NULL);
> -	cur_dst +=3D 2;
> -	if (ret !=3D 2)
> -		goto fail;
> -
> -	/* Free memory before test completed */
> -	free(src);
> -	free(dst);
>  	return 0;
> -
> - fail:
> -	free(src);
> -	free(dst);
> +fail:
> +	rte_ring_free(r);
> +	rte_free(src);
> +	rte_free(dst);
>  	return -1;
>  }
>=20
> @@ -810,6 +773,7 @@ test_ring_with_exact_size(void)
>  static int
>  test_ring(void)
>  {
> +	unsigned int i, j;
>  	struct rte_ring *r =3D NULL;
>=20
>  	/* some more basic operations */
> @@ -828,9 +792,11 @@ test_ring(void)
>  		goto test_fail;
>  	}
>=20
> -	/* burst operations */
> -	if (test_ring_burst_basic(r) < 0)
> -		goto test_fail;
> +	/* Burst and bulk operations with sp/sc, mp/mc and default */
> +	for (j =3D TEST_RING_BL; j <=3D TEST_RING_BR; j <<=3D 1)
> +		for (i =3D TEST_RING_N; i <=3D TEST_RING_M; i <<=3D 1)
> +			if (test_ring_burst_bulk_tests(i | j) < 0)
> +				goto test_fail;
>=20
>  	/* basic operations */
>  	if (test_ring_basic(r) < 0)
> diff --git a/app/test/test_ring.h b/app/test/test_ring.h
> new file mode 100644
> index 000000000..19ef1b399
> --- /dev/null
> +++ b/app/test/test_ring.h
> @@ -0,0 +1,203 @@
> +/* SPDX-License-Identifier: BSD-3-Clause
> + * Copyright(c) 2019 Arm Limited
> + */
> +
> +#include <rte_malloc.h>
> +#include <rte_ring.h>
> +#include <rte_ring_elem.h>
> +
> +/* API type to call
> + * N - Calls default APIs
> + * S - Calls SP or SC API
> + * M - Calls MP or MC API
> + */
> +#define TEST_RING_N 1
> +#define TEST_RING_S 2
> +#define TEST_RING_M 4
> +
> +/* API type to call
> + * SL - Calls single element APIs
> + * BL - Calls bulk APIs
> + * BR - Calls burst APIs
> + */
> +#define TEST_RING_SL 8
> +#define TEST_RING_BL 16
> +#define TEST_RING_BR 32
> +
> +#define TEST_RING_IGNORE_API_TYPE ~0U
> +
> +#define TEST_RING_INCP(obj, esize, n) do { \
> +	/* Legacy queue APIs? */ \
> +	if ((esize) =3D=3D -1) \
> +		obj =3D ((void **)obj) + n; \
> +	else \
> +		obj =3D (void **)(((uint32_t *)obj) + \
> +					(n * esize / sizeof(uint32_t))); \
> +} while (0)
> +
> +#define TEST_RING_CREATE(name, esize, count, socket_id, flags, r) do { \
> +	/* Legacy queue APIs? */ \
> +	if ((esize) =3D=3D -1) \
> +		r =3D rte_ring_create((name), (count), (socket_id), (flags)); \
> +	else \
> +		r =3D rte_ring_create_elem((name), (esize), (count), \
> +						(socket_id), (flags)); \
> +} while (0)
> +
> +#define TEST_RING_ENQUEUE(r, obj, esize, n, ret, api_type) do { \
> +	/* Legacy queue APIs? */ \
> +	if ((esize) =3D=3D -1) \
> +		switch (api_type) { \
> +		case (TEST_RING_N | TEST_RING_SL): \
> +			ret =3D rte_ring_enqueue(r, obj); \
> +			break; \
> +		case (TEST_RING_S | TEST_RING_SL): \
> +			ret =3D rte_ring_sp_enqueue(r, obj); \
> +			break; \
> +		case (TEST_RING_M | TEST_RING_SL): \
> +			ret =3D rte_ring_mp_enqueue(r, obj); \
> +			break; \
> +		case (TEST_RING_N | TEST_RING_BL): \
> +			ret =3D rte_ring_enqueue_bulk(r, obj, n, NULL); \
> +			break; \
> +		case (TEST_RING_S | TEST_RING_BL): \
> +			ret =3D rte_ring_sp_enqueue_bulk(r, obj, n, NULL); \
> +			break; \
> +		case (TEST_RING_M | TEST_RING_BL): \
> +			ret =3D rte_ring_mp_enqueue_bulk(r, obj, n, NULL); \
> +			break; \
> +		case (TEST_RING_N | TEST_RING_BR): \
> +			ret =3D rte_ring_enqueue_burst(r, obj, n, NULL); \
> +			break; \
> +		case (TEST_RING_S | TEST_RING_BR): \
> +			ret =3D rte_ring_sp_enqueue_burst(r, obj, n, NULL); \
> +			break; \
> +		case (TEST_RING_M | TEST_RING_BR): \
> +			ret =3D rte_ring_mp_enqueue_burst(r, obj, n, NULL); \
> +		} \
> +	else \
> +		switch (api_type) { \
> +		case (TEST_RING_N | TEST_RING_SL): \
> +			ret =3D rte_ring_enqueue_elem(r, obj, esize); \
> +			break; \
> +		case (TEST_RING_S | TEST_RING_SL): \
> +			ret =3D rte_ring_sp_enqueue_elem(r, obj, esize); \
> +			break; \
> +		case (TEST_RING_M | TEST_RING_SL): \
> +			ret =3D rte_ring_mp_enqueue_elem(r, obj, esize); \
> +			break; \
> +		case (TEST_RING_N | TEST_RING_BL): \
> +			ret =3D rte_ring_enqueue_bulk_elem(r, obj, esize, n, \
> +								NULL); \
> +			break; \
> +		case (TEST_RING_S | TEST_RING_BL): \
> +			ret =3D rte_ring_sp_enqueue_bulk_elem(r, obj, esize, n, \
> +								NULL); \
> +			break; \
> +		case (TEST_RING_M | TEST_RING_BL): \
> +			ret =3D rte_ring_mp_enqueue_bulk_elem(r, obj, esize, n, \
> +								NULL); \
> +			break; \
> +		case (TEST_RING_N | TEST_RING_BR): \
> +			ret =3D rte_ring_enqueue_burst_elem(r, obj, esize, n, \
> +								NULL); \
> +			break; \
> +		case (TEST_RING_S | TEST_RING_BR): \
> +			ret =3D rte_ring_sp_enqueue_burst_elem(r, obj, esize, n, \
> +								NULL); \
> +			break; \
> +		case (TEST_RING_M | TEST_RING_BR): \
> +			ret =3D rte_ring_mp_enqueue_burst_elem(r, obj, esize, n, \
> +								NULL); \
> +		} \
> +} while (0)
> +
> +#define TEST_RING_DEQUEUE(r, obj, esize, n, ret, api_type) do { \
> +	/* Legacy queue APIs? */ \
> +	if ((esize) =3D=3D -1) \
> +		switch (api_type) { \
> +		case (TEST_RING_N | TEST_RING_SL): \
> +			ret =3D rte_ring_dequeue(r, obj); \
> +			break; \
> +		case (TEST_RING_S | TEST_RING_SL): \
> +			ret =3D rte_ring_sc_dequeue(r, obj); \
> +			break; \
> +		case (TEST_RING_M | TEST_RING_SL): \
> +			ret =3D rte_ring_mc_dequeue(r, obj); \
> +			break; \
> +		case (TEST_RING_N | TEST_RING_BL): \
> +			ret =3D rte_ring_dequeue_bulk(r, obj, n, NULL); \
> +			break; \
> +		case (TEST_RING_S | TEST_RING_BL): \
> +			ret =3D rte_ring_sc_dequeue_bulk(r, obj, n, NULL); \
> +			break; \
> +		case (TEST_RING_M | TEST_RING_BL): \
> +			ret =3D rte_ring_mc_dequeue_bulk(r, obj, n, NULL); \
> +			break; \
> +		case (TEST_RING_N | TEST_RING_BR): \
> +			ret =3D rte_ring_dequeue_burst(r, obj, n, NULL); \
> +			break; \
> +		case (TEST_RING_S | TEST_RING_BR): \
> +			ret =3D rte_ring_sc_dequeue_burst(r, obj, n, NULL); \
> +			break; \
> +		case (TEST_RING_M | TEST_RING_BR): \
> +			ret =3D rte_ring_mc_dequeue_burst(r, obj, n, NULL); \
> +		} \
> +	else \
> +		switch (api_type) { \
> +		case (TEST_RING_N | TEST_RING_SL): \
> +			ret =3D rte_ring_dequeue_elem(r, obj, esize); \
> +			break; \
> +		case (TEST_RING_S | TEST_RING_SL): \
> +			ret =3D rte_ring_sc_dequeue_elem(r, obj, esize); \
> +			break; \
> +		case (TEST_RING_M | TEST_RING_SL): \
> +			ret =3D rte_ring_mc_dequeue_elem(r, obj, esize); \
> +			break; \
> +		case (TEST_RING_N | TEST_RING_BL): \
> +			ret =3D rte_ring_dequeue_bulk_elem(r, obj, esize, n, \
> +								NULL); \
> +			break; \
> +		case (TEST_RING_S | TEST_RING_BL): \
> +			ret =3D rte_ring_sc_dequeue_bulk_elem(r, obj, esize, n, \
> +								NULL); \
> +			break; \
> +		case (TEST_RING_M | TEST_RING_BL): \
> +			ret =3D rte_ring_mc_dequeue_bulk_elem(r, obj, esize, n, \
> +								NULL); \
> +			break; \
> +		case (TEST_RING_N | TEST_RING_BR): \
> +			ret =3D rte_ring_dequeue_burst_elem(r, obj, esize, n, \
> +								NULL); \
> +			break; \
> +		case (TEST_RING_S | TEST_RING_BR): \
> +			ret =3D rte_ring_sc_dequeue_burst_elem(r, obj, esize, n, \
> +								NULL); \
> +			break; \
> +		case (TEST_RING_M | TEST_RING_BR): \
> +			ret =3D rte_ring_mc_dequeue_burst_elem(r, obj, esize, n, \
> +								NULL); \
> +		} \
> +} while (0)


My thought to avoid test-code duplication was a bit different.
Instead of adding extra enums/parameters and then do switch on them,
my intention was something like that:

1. mv  test_ring_perf.c test_ring_perf.h
2. Inside test_ring_perf.h change rte_ring_ create/enqueue/dequeue function
    calls to some not-defined function/macros invocations.=20
   With similar name, same number of parameters, and same semantics.
   Also change 'void *burst[..]' to 'RING_ELEM[...]';
3. For each test configuration we want to have (default, 4B, 8B, 16B)=20
    create a new .c file where we:
    - define used in test_ring_perf.h macros(/function)
   - include test_ring_perf.h
   -  REGISTER_TEST_COMMAND(<test_name>, test_ring_perf);

As an example:
test_ring_perf.h:
...
static int
enqueue_bulk(void *p)
{
        ...
        RING_ELEM burst[MAX_BURST];

        memset(burst, 0, sizeof(burst));
        ....
        const uint64_t sp_start =3D rte_rdtsc();
        for (i =3D 0; i < iterations; i++)
                while (RING_SP_ENQUEUE_BULK(r, burst, size, NULL) =3D=3D 0)
                        rte_pause();
        const uint64_t sp_end =3D rte_rdtsc();

        const uint64_t mp_start =3D rte_rdtsc();
        for (i =3D 0; i < iterations; i++)
                while (RING_MP_ENQUEUE_BULK(r, burst, size, NULL) =3D=3D 0)
                        rte_pause();
        const uint64_t mp_end =3D rte_rdtsc();
        ....

Then in test_ring_perf.c:

....
#define RING_ELEM	void *
...
#define RING_SP_ENQUEUE_BULK(ring, buf, size, spc)  \
       rte_ring_sp_enqueue_bulk(ring, buf, size, spc)
....

#include "test_ring_perf.h"
REGISTER_TEST_COMMAND(ring_perf_autotest, test_ring_perf);


In test_ring_elem16B_perf.c:
....
#define RING_ELEM	__uint128_t
#define RING_SP_ENQUEUE_BULK(ring, buf, size, spc)  \=09
	rte_ring_sp_enqueue_bulk_elem(ring, buf, sizeof(RING_ELEM), size, spc)
....
#include "test_ring_perf.h"
REGISTER_TEST_COMMAND(ring_perf_elem16B_autotest, test_ring_perf);

In test_ring_elem4B_per.c:

....
#define RING_ELEM	uint32_t
#define RING_SP_ENQUEUE_BULK(ring, buf, size, spc)  \=09
	rte_ring_sp_enqueue_bulk_elem(ring, buf, sizeof(RING_ELEM), size, spc)
....
#include "test_ring_perf.h"
REGISTER_TEST_COMMAND(ring_perf_elem4B_autotest, test_ring_perf);

And so on.

> +
> +/* This function is placed here as it is required for both
> + * performance and functional tests.
> + */
> +static __rte_always_inline void *
> +test_ring_calloc(unsigned int rsize, int esize)
> +{
> +	unsigned int sz;
> +	void *p;
> +
> +	/* Legacy queue APIs? */
> +	if (esize =3D=3D -1)
> +		sz =3D sizeof(void *);
> +	else
> +		sz =3D esize;
> +
> +	p =3D rte_zmalloc(NULL, rsize * sz, RTE_CACHE_LINE_SIZE);
> +	if (p =3D=3D NULL)
> +		printf("Failed to allocate memory\n");
> +
> +	return p;
> +}
> --
> 2.17.1