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 5B1BEA04C9; Mon, 14 Sep 2020 06:37:56 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 2A4EA2C36; Mon, 14 Sep 2020 06:37:55 +0200 (CEST) Received: from EUR02-AM5-obe.outbound.protection.outlook.com (mail-eopbgr00066.outbound.protection.outlook.com [40.107.0.66]) by dpdk.org (Postfix) with ESMTP id 15643FFA; Mon, 14 Sep 2020 06:37:54 +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=qELBpSSJJDrWiYtctHqLwID5DB6S+95fahBAoC75y+A=; b=T3Du5dcmD0ipzaE71o0ToP9q02WXiIcg/eVfuizwfdHBUO2xcJmwe9LAubOPWCgZm1emIso3xZ6jmbNbLOcyg9v4GHmU/+4MQ1opHNlpjQVkaGSdMOqLT/deRj1+UZv4QUvD+iiF1Q0RxqsNOJFn/U90HBNH1pnSifTMN3uwKEE= Received: from DB6PR0501CA0009.eurprd05.prod.outlook.com (2603:10a6:4:8f::19) by DBBPR08MB4680.eurprd08.prod.outlook.com (2603:10a6:10:f2::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3370.17; Mon, 14 Sep 2020 04:37:53 +0000 Received: from DB5EUR03FT044.eop-EUR03.prod.protection.outlook.com (2603:10a6:4:8f:cafe::43) by DB6PR0501CA0009.outlook.office365.com (2603:10a6:4:8f::19) 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:37:53 +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 DB5EUR03FT044.mail.protection.outlook.com (10.152.21.167) 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:37:52 +0000 Received: ("Tessian outbound 7a6fb63c1e64:v64"); Mon, 14 Sep 2020 04:37:52 +0000 X-CR-MTA-TID: 64aa7808 Received: from 347e1cc3c046.3 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 918F13FF-9CB6-4D34-BE2F-817392736293.1; Mon, 14 Sep 2020 04:37:47 +0000 Received: from EUR03-AM5-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 347e1cc3c046.3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Mon, 14 Sep 2020 04:37:47 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IlT9hGViBh9DDEdj++eEhkDFQZa6/bwBPrcYeVcQLD9+zPLaABOpJsfLkrmE9tGOBFcnX1noLiitqjyvEifBFcfNNbYl60CNaFCtDyK1NmuCoSuIooj99fvNY8NrK4+g7xxuXVdSh3yVWAVZKrzTBVIKrEFPCnwUyrRVZGxbMUys8fL2lDY+6XgfP58h1tC8DN10gl5FAhD5ShAnYLg/km9rYAxQrnf7RESu0s0uUf0Av/fETItJCTIjmOv07/nxC5yUnFIVBW+ipO17Pgr8DQ0vHBjb2j8366vqFQAnYFkm16sY8EivknXq5eKNL08BZkS0PmVXyJngADC3VaZ/+g== 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=qELBpSSJJDrWiYtctHqLwID5DB6S+95fahBAoC75y+A=; b=Fndm64LKMOg9o+9VVO5Y6f4p3pzGKyoWu6c2ENa3mM3hy77IQB5r/e6lVktyMQzQt/GJT8OSl4I0zWqsNLGT+cJGX5W+lG4FgjmpN8cpu6cg/Ilj1UfMpFIJVtWlEZK77Z7lTrjKoq/Xz9WHgAkNQX8S8qYRf9CotqOIO3EwCSnnCtJepx+7PK6yrRFqvtl+v/tj393OBIBULKPjeeuWI2F67K9fmUCXoljChhUbSTMfW8VShoNxjHexoCmElVd2cenOQfuD6RMzLWBfL8tlX5qC3ahhOOdypJn14B5u4I94gfB+1u5G6Se0TQidSjJOVIcnfJkF33kdm+bzTovalw== 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=qELBpSSJJDrWiYtctHqLwID5DB6S+95fahBAoC75y+A=; b=T3Du5dcmD0ipzaE71o0ToP9q02WXiIcg/eVfuizwfdHBUO2xcJmwe9LAubOPWCgZm1emIso3xZ6jmbNbLOcyg9v4GHmU/+4MQ1opHNlpjQVkaGSdMOqLT/deRj1+UZv4QUvD+iiF1Q0RxqsNOJFn/U90HBNH1pnSifTMN3uwKEE= Received: from DBAPR08MB5814.eurprd08.prod.outlook.com (2603:10a6:10:1b1::6) by DB8PR08MB4953.eurprd08.prod.outlook.com (2603:10a6:10:ef::12) 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:37:46 +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:37:46 +0000 From: Honnappa Nagarahalli To: Feifei Wang , Konstantin Ananyev , Olivier Matz , Gavin Hu CC: "dev@dpdk.org" , nd , Feifei Wang , "stable@dpdk.org" , "david.marchand@redhat.com" , Honnappa Nagarahalli , nd Thread-Topic: [PATCH v3 5/6] test/ring: fix wrong size used in memcmp Thread-Index: AQHWiFZD7r0nh53Huk2MslJWXXFgdKlnkFGw Date: Mon, 14 Sep 2020 04:37:46 +0000 Message-ID: References: <20200729063105.11299-1-feifei.wang2@arm.com> <20200911161002.19816-1-feifei.wang2@arm.com> <20200911161002.19816-6-feifei.wang2@arm.com> In-Reply-To: <20200911161002.19816-6-feifei.wang2@arm.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ts-tracking-id: FC883A1B55C8634C900A140617D4655C.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: e46fc955-be38-4e22-ebc6-08d85867f17e x-ms-traffictypediagnostic: DB8PR08MB4953:|DBBPR08MB4680: x-ms-exchange-transport-forked: True X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true nodisclaimer: true x-ms-oob-tlc-oobclassifiers: OLM:1728;OLM:1728; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: zV7+O0zp2Se9BmFU9yARGHCt6+UyfoqJjDL0koLnL8RFgOKJziwQwqeSr7+InJHpZNjxWg0Ou6jaGFyCtF5aKxNBRdQqwcWxntr9lr54onb8yX5xeMneHNFdVbXPp5mOatdLuk1ZLoGZ5vVyiug3agC8Aehj2wasAKN8hf37WeV147gVrCKkFc/pgJ/AINiYiybyPHFmQbv4oQq5RqMcRUpgrP411+G3FjJClVizLQzLeQxXl18erPcicTVHZxMrqSvV1YlBAbOZoGJdejC4SGw2qlIXyU5I8flP0YOAQqtF+YFvtDL4m6vPf9ivYC26 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)(396003)(376002)(39850400004)(346002)(366004)(136003)(52536014)(26005)(2906002)(55016002)(186003)(316002)(478600001)(83380400001)(4326008)(8936002)(9686003)(66446008)(8676002)(6506007)(86362001)(66946007)(5660300002)(64756008)(66556008)(33656002)(110136005)(66476007)(7696005)(71200400001)(76116006)(6636002)(54906003); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata: kcTfJGUgtxtA6o/4AhKpiGUlxyretT9HDdkROXX/YPBpsG4wkyKqFBGmzE7CpwZJq5sfbRel+iePA3L+qDfC+TWMYUTQhOVFbWY/6rdp1aBcbgXi9mahBqruMY9MKO2llj8av3XYhki4YqvBmO/MpNKRdpG9OkqSOXmfHOSospJy/eeSUttvcZtxeK+SkTLXphXdzkYtCUDBAEEFE3OS2dVWxI01FTHVnZ4S598syfmET32La+sX+oCXU8v6mb+y5eQNhVw+yL9DREgTCDkkWs4htcRgB0WttRSqKP//6f/FngEQvofiW2peUGB+bb2YqwzPHp1u1GT6/RaQwJx9MWTJqbbhOF2SarJ36GWwm+tz+Ntri0djOe2zrXBH12ddo93y4waG7Vjw1JwWy9brIL621xU56+1WYP1vpwY3M3slqIloOHGepWT4I2m7mhamo1+lFPZk8CLS6PzqFUF5lFNSJ1KEiFdTWPMalvWGMwbtVwPZmDeSYpG2SUE7sTueQ+o0ULb4Dj780p6vO56mZDdLlE/qbMv4NndUTov3CCn3Nu9Hor1tX6zgD1CwRyd7Z5NVRd3nAkEMafSkCgd2X3xlSkkALzs6I0BFbvWNrCMsKZvKvr5Ox9EgRFW2Uc3AibeXJv70Ai1SPWCZ3D2PHw== Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR08MB4953 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: DB5EUR03FT044.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: 335ad94d-ff83-4a6a-3c3b-08d85867ed92 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: VhlYN+ciaZdS9fvvcNsdPsQHmC3HdVhejhMT+Jk+3s0ZJcaB4eEQVSYW6OEycR5sWKZFDCu5BTIhGIiGQwDh+w5BOfYyKHh3fMj/3Yrin/e4l64v7gjT8XKF4q/1xc2gj3I1buayJmo8WXZ8POZm5fI8G6TpnpisSJ06rUMvQNKczu6wE8kSIzjAa+0Lj+50Ir3gbXRe6zKmqhCSXMRlyvvDW6RGJfjQsoTPdEZJV+ud+qlcJewj45ObEB36Lgj5D6GeEZhw7V2N3BeSjdKs2yzf9PWaeYBL1fMMBtUbILRkyZk1xScnLvUeJi36BTY11//TMnDpINs6qoucUFdMnfHNqvEvg7wV1smkQftmSo3oQTkLC6TdQsAP6J3br2JjTxoTrCiIBVvSOpSE2flmJQ== 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)(136003)(39850400004)(396003)(376002)(346002)(46966005)(6506007)(70206006)(4326008)(450100002)(186003)(6636002)(70586007)(7696005)(26005)(2906002)(47076004)(81166007)(83380400001)(82310400003)(86362001)(82740400003)(356005)(8676002)(54906003)(336012)(9686003)(110136005)(33656002)(316002)(5660300002)(52536014)(55016002)(8936002)(478600001); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Sep 2020 04:37:52.9337 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e46fc955-be38-4e22-ebc6-08d85867f17e 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: DB5EUR03FT044.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR08MB4680 Subject: Re: [dpdk-dev] [PATCH v3 5/6] test/ring: fix wrong size used in memcmp 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 > When using memcmp function to check data, the third param should be the > size of all elements, rather than the number of the elements. >=20 > Furthermore, do code clean up by moving repeated code inside > 'test_ring_mem_cmp' function to validate data and print information of > enqueue/dequeue elements if validation fails. This patch is fixing 2 things. But only the memcmp issue need to be backpor= ted to stable. I would prefer to split this into 2 and mark only the memcmp= commit to be backported. Hi David, Do you have a different opinion here? >=20 > Fixes: a9fe152363e2 ("test/ring: add custom element size functional tests= ") > Cc: honnappa.nagarahalli@arm.com > Cc: stable@dpdk.org >=20 > Signed-off-by: Feifei Wang > Reviewed-by: Ruifeng Wang > Reviewed-by: Phil Yang > Reviewed-by: Dharmik Thakkar > --- > app/test/test_ring.c | 59 ++++++++++++++++++++------------------------ > 1 file changed, 27 insertions(+), 32 deletions(-) >=20 > diff --git a/app/test/test_ring.c b/app/test/test_ring.c index > 811adc523..4a2bd39fc 100644 > --- a/app/test/test_ring.c > +++ b/app/test/test_ring.c > @@ -258,6 +258,21 @@ test_ring_mem_init(void *obj, unsigned int count, in= t > esize) > ((uint32_t *)obj)[i] =3D i; > } >=20 > +static int > +test_ring_mem_cmp(void *src, void *dst, unsigned int size) { > + int ret; > + > + ret =3D memcmp(src, dst, size); > + if (ret) { > + rte_hexdump(stdout, "src", src, size); > + rte_hexdump(stdout, "dst", dst, size); > + printf("data after dequeue is not the same\n"); > + } > + > + return ret; > +} > + > static void > test_ring_print_test_string(const char *istr, unsigned int api_type, int= esize) > { @@ -383,7 +398,7 @@ test_ring_burst_bulk_tests1(unsigned int test_idx) > struct rte_ring *r; > void **src =3D NULL, **cur_src =3D NULL, **dst =3D NULL, **cur_dst =3D = NULL; > int ret; > - unsigned int i, j; > + unsigned int i, j, temp_sz; > int rand; > const unsigned int rsz =3D RING_SIZE - 1; >=20 > @@ -444,7 +459,11 @@ test_ring_burst_bulk_tests1(unsigned int test_idx) > TEST_RING_VERIFY(rte_ring_empty(r)); >=20 > /* check data */ > - TEST_RING_VERIFY(memcmp(src, dst, rsz) =3D=3D 0); > + temp_sz =3D rsz * sizeof(void *); > + if (esize[i] !=3D -1) > + temp_sz =3D rsz * esize[i]; > + TEST_RING_VERIFY(test_ring_mem_cmp(src, dst, > + temp_sz) =3D=3D 0); > } >=20 > /* Free memory before test completed */ @@ -538,12 +557,8 > @@ test_ring_burst_bulk_tests2(unsigned int test_idx) > cur_dst =3D test_ring_inc_ptr(cur_dst, esize[i], MAX_BULK); >=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"); > + if (test_ring_mem_cmp(src, dst, RTE_PTR_DIFF(cur_dst, dst))) > goto fail; > - } >=20 > /* Free memory before test completed */ > rte_ring_free(r); > @@ -614,12 +629,8 @@ test_ring_burst_bulk_tests3(unsigned int test_idx) > } >=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"); > + if (test_ring_mem_cmp(src, dst, RTE_PTR_DIFF(cur_dst, dst))) > goto fail; > - } >=20 > /* Free memory before test completed */ > rte_ring_free(r); > @@ -747,12 +758,8 @@ test_ring_burst_bulk_tests4(unsigned int test_idx) > 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"); > + if (test_ring_mem_cmp(src, dst, RTE_PTR_DIFF(cur_dst, dst))) > goto fail; > - } >=20 > /* Free memory before test completed */ > rte_ring_free(r); > @@ -857,12 +864,8 @@ test_ring_basic_ex(void) > } >=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"); > + if (test_ring_mem_cmp(src, dst, RTE_PTR_DIFF(cur_src, src))) > goto fail_test; > - } >=20 > /* Following tests use the configured flags to decide > * SP/SC or MP/MC. > @@ -909,12 +912,8 @@ test_ring_basic_ex(void) > cur_dst =3D test_ring_inc_ptr(cur_dst, esize[i], 2); >=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"); > + if (test_ring_mem_cmp(src, dst, RTE_PTR_DIFF(cur_dst, dst))) > goto fail_test; > - } >=20 > rte_ring_free(rp); > rte_free(src); > @@ -1047,12 +1046,8 @@ test_ring_with_exact_size(void) > } >=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"); > + if (test_ring_mem_cmp(src, dst, RTE_PTR_DIFF(cur_dst, dst))) > goto test_fail; > - } >=20 > rte_free(src_orig); > rte_free(dst_orig); > -- > 2.17.1