From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id DC7A5A04C9; Mon, 14 Sep 2020 06:26:55 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id E999BE07; Mon, 14 Sep 2020 06:26:54 +0200 (CEST) Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-eopbgr150041.outbound.protection.outlook.com [40.107.15.41]) by dpdk.org (Postfix) with ESMTP id 3AEDE160 for ; Mon, 14 Sep 2020 06:26:53 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=x+iV3ODsEhsJaCRE8aW7TTRE5b7qMRlPTp27iKBNQ1U=; b=Ji0Kv+P95a6ILPS6mUTs54K+VUaSlHG3/uPr0RPQg6Jcd+SYBEZN3zzPBhbpwgot1Uxd3QoOtnZZljOJgN7BI8hhBwioaNZSwD3dYScbzu0NJdkzPo1TmC9RQXqDhQD0W8i2FpQu8mRSpKZfdokmDEm8c0NN26Y9yLNzoAKMwtA= Received: from AM5P194CA0024.EURP194.PROD.OUTLOOK.COM (2603:10a6:203:8f::34) by AM6PR08MB4801.eurprd08.prod.outlook.com (2603:10a6:20b:c1::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3370.16; Mon, 14 Sep 2020 04:26:51 +0000 Received: from VE1EUR03FT029.eop-EUR03.prod.protection.outlook.com (2603:10a6:203:8f:cafe::67) by AM5P194CA0024.outlook.office365.com (2603:10a6:203:8f::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3370.16 via Frontend Transport; Mon, 14 Sep 2020 04:26:51 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dpdk.org; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;dpdk.org; dmarc=bestguesspass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by VE1EUR03FT029.mail.protection.outlook.com (10.152.18.107) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3370.16 via Frontend Transport; Mon, 14 Sep 2020 04:26:51 +0000 Received: ("Tessian outbound a0bffebca527:v64"); Mon, 14 Sep 2020 04:26:51 +0000 X-CR-MTA-TID: 64aa7808 Received: from 9908964cc61b.2 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 23E538C4-4FD5-4D24-9B58-AAE829ED2923.1; Mon, 14 Sep 2020 04:26:46 +0000 Received: from EUR05-AM6-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 9908964cc61b.2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Mon, 14 Sep 2020 04:26:46 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KLxZMp0BU0210mhPkLEgY73EWd7X6MOGkkEEmt5dHle32LebZE+K71mMYyGDWU9OPoAvKLEqEkXNDYuYJgP94SlLEQAhW5LF5XAuBdtPIIhV10Mu6rhaFDULrL27KkSSHZ6nP4eCffc8cwv6BDd7cwoHsGmuhF0lnZ1pF8rh9NBchDVisRYN7PiV8wUmj54weXVUclzSbLbMEFCnKbnAcNRsFb01VSSUAoq6fWk60t3ZGnWqM61adhYLt++aXj4QwBRk7bymc7RWcnfl6ePzuafJsplp3ygkNvkgyY/Z2ApQhh2N+E7Ozg5MEiDv/j6M0U9cPFc0SPvN0ui7+59FOw== 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=x+iV3ODsEhsJaCRE8aW7TTRE5b7qMRlPTp27iKBNQ1U=; b=ELvFZ0OZxdoVoCvxxXv7HH05bhNgzjkYaREiOm2XnqeYsiuisw1ik3BHOvG+XLCN2MshVN89mQTpBVLrjYd5kaFsXsAGRbs1WoJ/34sbVLgGfAaQOyAsmTLh+nUpFUOfEscLk8YrBr3nnUBv8WLijVmrq18jfKbD8u1qLRZHBxXYBVgJllk+xv5IMUuraInPUGyKe/b+A8NAIaqXJjpH9bpFfhwArfTnbdaaZvhY+wXd4+xZbHVRXo+HrxZ78ISKTunKPgL1+NsY9GF7GG2hveouxdBM3xAGUtpycim6TSSqsp4f2rhrgQMudiLCF5nuUCgVE5F1bjTjbdJ+pfmnsQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=x+iV3ODsEhsJaCRE8aW7TTRE5b7qMRlPTp27iKBNQ1U=; b=Ji0Kv+P95a6ILPS6mUTs54K+VUaSlHG3/uPr0RPQg6Jcd+SYBEZN3zzPBhbpwgot1Uxd3QoOtnZZljOJgN7BI8hhBwioaNZSwD3dYScbzu0NJdkzPo1TmC9RQXqDhQD0W8i2FpQu8mRSpKZfdokmDEm8c0NN26Y9yLNzoAKMwtA= Received: from DBAPR08MB5814.eurprd08.prod.outlook.com (2603:10a6:10:1b1::6) by DB7PR08MB3882.eurprd08.prod.outlook.com (2603:10a6:10:7d::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3370.16; Mon, 14 Sep 2020 04:26:43 +0000 Received: from DBAPR08MB5814.eurprd08.prod.outlook.com ([fe80::408a:40fb:7402:c805]) by DBAPR08MB5814.eurprd08.prod.outlook.com ([fe80::408a:40fb:7402:c805%6]) with mapi id 15.20.3370.019; Mon, 14 Sep 2020 04:26:43 +0000 From: Honnappa Nagarahalli To: Feifei Wang , Konstantin Ananyev CC: "dev@dpdk.org" , nd , Feifei Wang , Honnappa Nagarahalli , nd Thread-Topic: [PATCH v3 1/6] test/ring: add check to validate dequeued objects Thread-Index: AQHWiFYqAUtInXir50SlIaFo3C/tRqlnjZ0Q Date: Mon, 14 Sep 2020 04:26:43 +0000 Message-ID: References: <20200729063105.11299-1-feifei.wang2@arm.com> <20200911161002.19816-1-feifei.wang2@arm.com> <20200911161002.19816-2-feifei.wang2@arm.com> In-Reply-To: <20200911161002.19816-2-feifei.wang2@arm.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ts-tracking-id: 9E317116154B8847A1338DF4DE375880.0 x-checkrecipientchecked: true Authentication-Results-Original: arm.com; dkim=none (message not signed) header.d=none;arm.com; dmarc=none action=none header.from=arm.com; x-originating-ip: [217.140.110.7] x-ms-publictraffictype: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: d8df10d0-204f-4124-71bc-08d85866672b x-ms-traffictypediagnostic: DB7PR08MB3882:|AM6PR08MB4801: x-ms-exchange-transport-forked: True X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true nodisclaimer: true x-ms-oob-tlc-oobclassifiers: OLM:514;OLM:514; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: HG0uQMKYpeXL/RQK8nvxnAyGnkJt14JyMTrRw8vOZ0SBzsFnI+uo9GLOxmZVei3YKYd3z6+wPWs3T6V/Jw2KOXO0MBynnEsY622JHHX/cMvWwuv6x+xYUyDYYKSFcVL18lTUtRy83AOQZSnxUgatjoNoX4m57BS8VRlwy6IZBWAl6FptZiQ2hAbzTnzY48lQcwFRQpLMT+t9KtdLtK73BIZikVkrh6wprgstWJQbueJlEmscvVDSDIvHvewIDz5zjR70opVFR7fRAgz1g7RIGKSmmhOpR7v+qAm2PyiFdH4g8MIc7tdG3WwGy2baeHYXn6c1f6PJJ73uoLbO8qlmXg== X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DBAPR08MB5814.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(346002)(39850400004)(376002)(396003)(366004)(136003)(54906003)(478600001)(110136005)(86362001)(71200400001)(5660300002)(64756008)(66946007)(83380400001)(66446008)(76116006)(66476007)(66556008)(33656002)(52536014)(7696005)(2906002)(316002)(26005)(186003)(6506007)(15650500001)(55016002)(9686003)(8676002)(4326008)(8936002); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata: 8hzvYrQRrqVmn5kbDlms/+F5tEV4JmCZhlD7edTewaAoM+iB2yQn3x0qiEjaSL1IbPo26lVE4NRwf/lgtuS+pS/fDQ8kHPfQ3fYPVSLVLosfCKCJbKnjhHNoKtMxlrpU4lL3rXyRyt98mcZZGoel9A7UGukdgfu6gAaoE3WxT9uEJ50XiPPavbd/xqLS8TcAo3RoVkfs0feviw/VZuxaKwMMprPNRx5Kyc5fDz7HLqSNFZIH2dBehwvPJMBWznox8Ljc3Y3qG9cTuid5q7crpT1COsnwkqAYPE5RoroHQaEwrpizXz+WhzJ7hc3Dd5WUyexXzRbKTa2hHBg017LWwdoWPkyctIST6b49p/AEg8aj78OEn/L+1ktNEszm135plYMO7AKvYrAkZGAqUACm7q6Ury4k4tVX4R4WNk3oQ7F4nGkPGp421M3fsu6nI49EObhVJMtMOQZ32SZYh+ggiC1z+0NxzA81IP8hFB1plx75S/TzwR1iZ8tUIrx4OH/Z8R8o6zpLiOL2WfyyDCkF0lI4gJFYietS6Io0ADPRiK3rabgwl1HQN+kRNz8kydCW5zMFNOb/23UXHxQJQseEOEhEwb2omlG4Csuu5uA1u1exLxGlIzF1OD+iphDGU7IjbKRbXPHi+L6PyNSwwG/Fag== Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR08MB3882 Original-Authentication-Results: arm.com; dkim=none (message not signed) header.d=none;arm.com; dmarc=none action=none header.from=arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: VE1EUR03FT029.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: 8afcfb40-141f-4333-01d5-08d858666295 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: bK5FRja8IOo36Oz7DbaQQ3Llc0iBdmRLRvw46/+qvT59MJfHTkyA7YO7d3JtRmcGgJNIZTpVXiUqrOSi3KAime+nAMLUSYONEFOpiXa4j0Oz6B2Xzls4Txq9KgPZj4GmY0X1qMG5pBzSYbWwZ+SR6WbUacChHbVq8wafFzyicC6FeEsSYG/Tci4io/8TLGio/w3KQkmPKWVL9tiohy3DnF/GAOva16QVgyUC5IBBwF7ipOZV0ncl/s6elgDygBYAtx4YHHN4lwDYZiEiPoam7AfalenntUDbTL+zCqz8oU4BZxLA1KK1WdIfqD6OerES9yxnxO9GPkS1OTEsCMB86qiTSnnKtFhNrH9is74XIwDHysSZhwOKP56kXtuX16EXMDjQNJjhIh6bVDGIgIFueQ== X-Forefront-Antispam-Report: CIP:63.35.35.123; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:64aa7808-outbound-1.mta.getcheckrecipient.com; PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com; CAT:NONE; SFS:(4636009)(39850400004)(376002)(346002)(396003)(136003)(46966005)(7696005)(82740400003)(47076004)(55016002)(81166007)(356005)(26005)(8936002)(6506007)(4326008)(83380400001)(9686003)(82310400003)(186003)(478600001)(33656002)(86362001)(54906003)(8676002)(15650500001)(5660300002)(110136005)(336012)(70206006)(52536014)(36906005)(2906002)(70586007)(316002); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Sep 2020 04:26:51.2225 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d8df10d0-204f-4124-71bc-08d85866672b X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[63.35.35.123]; Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: VE1EUR03FT029.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB4801 Subject: Re: [dpdk-dev] [PATCH v3 1/6] test/ring: add check to validate dequeued objects X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" >=20 > Add check in test_ring_basic_ex and test_ring_with_exact_size for single > element enqueue and dequeue operations to validate the dequeued objects. >=20 > Signed-off-by: Feifei Wang > Reviewed-by: Ruifeng Wang > Reviewed-by: Phil Yang > Reviewed-by: Dharmik Thakkar Looks good. Reviewed-by: Honnappa Nagarahalli > --- > app/test/test_ring.c | 135 +++++++++++++++++++++++++++++++------------ > 1 file changed, 99 insertions(+), 36 deletions(-) >=20 > diff --git a/app/test/test_ring.c b/app/test/test_ring.c index > 0ae97d341..6e48cc0b1 100644 > --- a/app/test/test_ring.c > +++ b/app/test/test_ring.c > @@ -780,15 +780,9 @@ test_ring_basic_ex(void) > int ret =3D -1; > unsigned int i, j; > struct rte_ring *rp =3D NULL; > - void *obj =3D NULL; > + void **src =3D NULL, **cur_src =3D NULL, **dst =3D NULL, **cur_dst =3D = NULL; >=20 > for (i =3D 0; i < RTE_DIM(esize); i++) { > - obj =3D test_ring_calloc(RING_SIZE, esize[i]); > - if (obj =3D=3D NULL) { > - printf("%s: failed to alloc memory\n", __func__); > - goto fail_test; > - } > - > rp =3D test_ring_create("test_ring_basic_ex", esize[i], RING_SIZE, > SOCKET_ID_ANY, > RING_F_SP_ENQ | RING_F_SC_DEQ); > @@ -797,6 +791,23 @@ test_ring_basic_ex(void) > goto fail_test; > } >=20 > + /* alloc dummy object pointers */ > + src =3D test_ring_calloc(RING_SIZE, esize[i]); > + if (src =3D=3D NULL) { > + printf("%s: failed to alloc src memory\n", __func__); > + goto fail_test; > + } > + test_ring_mem_init(src, RING_SIZE, esize[i]); > + cur_src =3D src; > + > + /* alloc some room for copied objects */ > + dst =3D test_ring_calloc(RING_SIZE, esize[i]); > + if (dst =3D=3D NULL) { > + printf("%s: failed to alloc dst memory\n", __func__); > + goto fail_test; > + } > + cur_dst =3D dst; > + > if (rte_ring_lookup("test_ring_basic_ex") !=3D rp) { > printf("%s: failed to find ring\n", __func__); > goto fail_test; > @@ -812,8 +823,9 @@ test_ring_basic_ex(void) > rte_ring_free_count(rp)); >=20 > for (j =3D 0; j < RING_SIZE; j++) { > - test_ring_enqueue(rp, obj, esize[i], 1, > + test_ring_enqueue(rp, cur_src, esize[i], 1, > TEST_RING_THREAD_DEF | > TEST_RING_ELEM_SINGLE); > + cur_src =3D test_ring_inc_ptr(cur_src, esize[i], 1); > } >=20 > if (rte_ring_full(rp) !=3D 1) { > @@ -823,8 +835,9 @@ test_ring_basic_ex(void) > } >=20 > for (j =3D 0; j < RING_SIZE; j++) { > - test_ring_dequeue(rp, obj, esize[i], 1, > + test_ring_dequeue(rp, cur_dst, esize[i], 1, > TEST_RING_THREAD_DEF | > TEST_RING_ELEM_SINGLE); > + cur_dst =3D test_ring_inc_ptr(cur_dst, esize[i], 1); > } >=20 > if (rte_ring_empty(rp) !=3D 1) { > @@ -833,52 +846,80 @@ test_ring_basic_ex(void) > goto fail_test; > } >=20 > + /* check data */ > + if (memcmp(src, dst, cur_src - src)) { > + 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; > + } > + > /* Following tests use the configured flags to decide > * SP/SC or MP/MC. > */ > + /* reset memory of dst */ > + memset(dst, 0, RTE_PTR_DIFF(cur_src, src)); > + > + /* reset cur_src and cur_dst */ > + cur_src =3D src; > + cur_dst =3D dst; > + > /* Covering the ring burst operation */ > - ret =3D test_ring_enqueue(rp, obj, esize[i], 2, > + ret =3D test_ring_enqueue(rp, cur_src, esize[i], 2, > TEST_RING_THREAD_DEF | > TEST_RING_ELEM_BURST); > if (ret !=3D 2) { > printf("%s: rte_ring_enqueue_burst fails\n", __func__); > goto fail_test; > } > + cur_src =3D test_ring_inc_ptr(cur_src, esize[i], 2); >=20 > - ret =3D test_ring_dequeue(rp, obj, esize[i], 2, > + ret =3D test_ring_dequeue(rp, cur_dst, esize[i], 2, > TEST_RING_THREAD_DEF | > TEST_RING_ELEM_BURST); > if (ret !=3D 2) { > printf("%s: rte_ring_dequeue_burst fails\n", __func__); > goto fail_test; > } > + cur_dst =3D test_ring_inc_ptr(cur_dst, esize[i], 2); >=20 > /* Covering the ring bulk operation */ > - ret =3D test_ring_enqueue(rp, obj, esize[i], 2, > + ret =3D test_ring_enqueue(rp, cur_src, esize[i], 2, > TEST_RING_THREAD_DEF | > TEST_RING_ELEM_BULK); > if (ret !=3D 2) { > printf("%s: rte_ring_enqueue_bulk fails\n", __func__); > goto fail_test; > } > + cur_src =3D test_ring_inc_ptr(cur_src, esize[i], 2); >=20 > - ret =3D test_ring_dequeue(rp, obj, esize[i], 2, > + ret =3D test_ring_dequeue(rp, cur_dst, esize[i], 2, > TEST_RING_THREAD_DEF | > TEST_RING_ELEM_BULK); > if (ret !=3D 2) { > printf("%s: rte_ring_dequeue_bulk fails\n", __func__); > goto fail_test; > } > + cur_dst =3D test_ring_inc_ptr(cur_dst, esize[i], 2); > + > + /* 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; > + } >=20 > rte_ring_free(rp); > - rte_free(obj); > + rte_free(src); > + rte_free(dst); > rp =3D NULL; > - obj =3D NULL; > + src =3D NULL; > + dst =3D NULL; > } >=20 > return 0; >=20 > fail_test: > rte_ring_free(rp); > - if (obj !=3D NULL) > - rte_free(obj); > - > + rte_free(src); > + rte_free(dst); > return -1; > } >=20 > @@ -889,8 +930,8 @@ static int > test_ring_with_exact_size(void) > { > struct rte_ring *std_r =3D NULL, *exact_sz_r =3D NULL; > - void *obj_orig; > - void *obj; > + void **src_orig =3D NULL, **dst_orig =3D NULL; > + void **src =3D NULL, **cur_src =3D NULL, **dst =3D NULL, **cur_dst =3D = NULL; > const unsigned int ring_sz =3D 16; > unsigned int i, j; > int ret =3D -1; > @@ -900,14 +941,6 @@ test_ring_with_exact_size(void) > TEST_RING_IGNORE_API_TYPE, > esize[i]); >=20 > - /* alloc object pointers. Allocate one extra object > - * and create an unaligned address. > - */ > - obj_orig =3D test_ring_calloc(17, esize[i]); > - if (obj_orig =3D=3D NULL) > - goto test_fail; > - obj =3D ((char *)obj_orig) + 1; > - > std_r =3D test_ring_create("std", esize[i], ring_sz, > rte_socket_id(), > RING_F_SP_ENQ | RING_F_SC_DEQ); > @@ -925,6 +958,22 @@ test_ring_with_exact_size(void) > goto test_fail; > } >=20 > + /* alloc object pointers. Allocate one extra object > + * and create an unaligned address. > + */ > + src_orig =3D test_ring_calloc(17, esize[i]); > + if (src_orig =3D=3D NULL) > + goto test_fail; > + test_ring_mem_init(src_orig, 17, esize[i]); > + src =3D (void **)((uintptr_t)src_orig + 1); > + cur_src =3D src; > + > + dst_orig =3D test_ring_calloc(17, esize[i]); > + if (dst_orig =3D=3D NULL) > + goto test_fail; > + dst =3D (void **)((uintptr_t)dst_orig + 1); > + cur_dst =3D dst; > + > /* > * Check that the exact size ring is bigger than the > * standard ring > @@ -941,33 +990,36 @@ test_ring_with_exact_size(void) > * than the standard ring. (16 vs 15 elements) > */ > for (j =3D 0; j < ring_sz - 1; j++) { > - test_ring_enqueue(std_r, obj, esize[i], 1, > + test_ring_enqueue(std_r, cur_src, esize[i], 1, > TEST_RING_THREAD_DEF | > TEST_RING_ELEM_SINGLE); > - test_ring_enqueue(exact_sz_r, obj, esize[i], 1, > + test_ring_enqueue(exact_sz_r, cur_src, esize[i], 1, > TEST_RING_THREAD_DEF | > TEST_RING_ELEM_SINGLE); > + cur_src =3D test_ring_inc_ptr(cur_src, esize[i], 1); > } > - ret =3D test_ring_enqueue(std_r, obj, esize[i], 1, > + ret =3D test_ring_enqueue(std_r, cur_src, esize[i], 1, > TEST_RING_THREAD_DEF | > TEST_RING_ELEM_SINGLE); > if (ret !=3D -ENOBUFS) { > printf("%s: error, unexpected successful enqueue\n", > __func__); > goto test_fail; > } > - ret =3D test_ring_enqueue(exact_sz_r, obj, esize[i], 1, > + ret =3D test_ring_enqueue(exact_sz_r, cur_src, esize[i], 1, > TEST_RING_THREAD_DEF | > TEST_RING_ELEM_SINGLE); > if (ret =3D=3D -ENOBUFS) { > printf("%s: error, enqueue failed\n", __func__); > goto test_fail; > } > + cur_src =3D test_ring_inc_ptr(cur_src, esize[i], 1); >=20 > /* check that dequeue returns the expected number of > elements */ > - ret =3D test_ring_dequeue(exact_sz_r, obj, esize[i], ring_sz, > + ret =3D test_ring_dequeue(exact_sz_r, cur_dst, esize[i], ring_sz, > TEST_RING_THREAD_DEF | > TEST_RING_ELEM_BURST); > if (ret !=3D (int)ring_sz) { > printf("%s: error, failed to dequeue expected nb of > elements\n", > __func__); > goto test_fail; > } > + cur_dst =3D test_ring_inc_ptr(cur_dst, esize[i], ring_sz); >=20 > /* check that the capacity function returns expected value */ > if (rte_ring_get_capacity(exact_sz_r) !=3D ring_sz) { @@ -976,10 > +1028,20 @@ test_ring_with_exact_size(void) > goto test_fail; > } >=20 > - rte_free(obj_orig); > + /* 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 test_fail; > + } > + > + rte_free(src_orig); > + rte_free(dst_orig); > rte_ring_free(std_r); > rte_ring_free(exact_sz_r); > - obj_orig =3D NULL; > + src_orig =3D NULL; > + dst_orig =3D NULL; > std_r =3D NULL; > exact_sz_r =3D NULL; > } > @@ -987,7 +1049,8 @@ test_ring_with_exact_size(void) > return 0; >=20 > test_fail: > - rte_free(obj_orig); > + rte_free(src_orig); > + rte_free(dst_orig); > rte_ring_free(std_r); > rte_ring_free(exact_sz_r); > return -1; > -- > 2.17.1