From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 6D2E845AAF; Fri, 4 Oct 2024 13:05:50 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5D29C4027F; Fri, 4 Oct 2024 13:05:50 +0200 (CEST) Received: from mx0a-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id CADAB40268 for ; Fri, 4 Oct 2024 13:05:48 +0200 (CEST) Received: from pps.filterd (m0431384.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 493HvwpA001956; Fri, 4 Oct 2024 04:05:47 -0700 Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2047.outbound.protection.outlook.com [104.47.70.47]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 42204r9mqc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 04 Oct 2024 04:05:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=iY3oJsQg4XkZjeWPV8yUGXqkMMCziKAELnGZ63ciJ6SmCn+ik7ucVwb0otMZ/vsIcO1m7m4mlRvxP+2qep4lc092ITs+VVefP6zdjJ9zVMarVjA3hjHS16z5a/ObJtaVnsUMOk/x1zRpRp8tRXBbjKmooLvuIuI+yR2Q0ueG/wK2IZ3xUtcgwM5NZxQwZEqzOW0/0Y/IV/qfPu5wOYi9EGHIXtEAlD+yvHu3KQjp+IB6m3hp0VWa60wg7FELgugv/l6GX9qV9CVGGQSdsw+cV1pFyfjozPi/Y57P7PxtPBQJt9ySbGe05RiiGXO+igAageIuvWeWooBUCgT0OogEaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=jGiHS3jHlOa6HsUyF+L+WmeFKrlVSWp9tdd4JggjhTo=; b=X7bBFiYe65gPmYzXlWxSQbHfJLItKlICd8i5gmpfr/8OivfyEoEMjCbffSwNJvH3ZmJqMenAxhDy2zsX8dIWaex7wBEHsg6v9vUvfWi1mdU1yRxaF3nZC/k6hecSUpk+ikZLoQ9oT9QKPqN+TrVjlwHGE8RCaMeQsvVOhwp5ZU6kV8cysmpJnWytogaMn5zw6qvAvS8xMrSG/oHtmHZv1+Ok+qHC1wP3GlDoUcBO3ZzolOtbrg8L+akKII+UMU3l/FmFi6gqb19akGaqvxeSXVWECzTkI3pVYX6QJbu9tRJrh3SN4BXYIRXK+tfTBkDzMRG7QU85SC5JDPerWQU16A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=marvell.com; dmarc=pass action=none header.from=marvell.com; dkim=pass header.d=marvell.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=jGiHS3jHlOa6HsUyF+L+WmeFKrlVSWp9tdd4JggjhTo=; b=YehQ6AdCHj2Qow64XXaeIMCZI3yf3i0Ml8ki3nPWag8j0dFngLcQowUX7aEJZalluzs6RPx+W9WncDEHlec/eqRWh1zt1tesQ4CPL+UP2HHUXdONQH2741Xnt3wD8QeMZ+QLSVfZ9RrliqMnE6a4Wx/xiiEp3h4V5lvvC+QH9UE= Received: from SJ0PR18MB5161.namprd18.prod.outlook.com (2603:10b6:a03:438::6) by IA3PR18MB6312.namprd18.prod.outlook.com (2603:10b6:208:516::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.18; Fri, 4 Oct 2024 11:05:43 +0000 Received: from SJ0PR18MB5161.namprd18.prod.outlook.com ([fe80::de87:f6c:99c2:9625]) by SJ0PR18MB5161.namprd18.prod.outlook.com ([fe80::de87:f6c:99c2:9625%4]) with mapi id 15.20.8026.016; Fri, 4 Oct 2024 11:05:43 +0000 From: Amit Prakash Shukla To: Vidya Sagar Velumuri , "fengchengwen@huawei.com" , "kevin.laatz@intel.com" , "bruce.richardson@intel.com" CC: Jerin Jacob , Anoob Joseph , Aakash Sasidharan , Tejasree Kondoj , Gowrishankar Muthukrishnan , "dev@dpdk.org" Subject: Re: [EXTERNAL] [PATCH v2 2/2] test/dma: add functions to verify zero and one fill Thread-Topic: [EXTERNAL] [PATCH v2 2/2] test/dma: add functions to verify zero and one fill Thread-Index: AQHakjkzEgWC3RqyZ0SK+YSQgMZO77J3dhbp Date: Fri, 4 Oct 2024 11:05:43 +0000 Message-ID: References: <20240416123747.4133884-1-vvelumuri@marvell.com> <20240419090734.43613-1-vvelumuri@marvell.com> <20240419090734.43613-2-vvelumuri@marvell.com> In-Reply-To: <20240419090734.43613-2-vvelumuri@marvell.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: x-ms-publictraffictype: Email x-ms-traffictypediagnostic: SJ0PR18MB5161:EE_|IA3PR18MB6312:EE_ x-ms-office365-filtering-correlation-id: 5a890c32-8ee7-4974-b413-08dce4647da9 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; ARA:13230040|366016|1800799024|376014|38070700018; x-microsoft-antispam-message-info: =?iso-8859-1?Q?GigvArGucyBvkRPPBB0Vply2SXOkBZ1ygkus+LFQiKrhHCyV+vauD4Seb6?= =?iso-8859-1?Q?ERCO+lRPsZrjiOZG5eGmaaS0YkcBWrfO0LVX10CYkIKN2FlJRnN4+ZsqPL?= =?iso-8859-1?Q?T2UW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4kYVhdtHh2rleVro?= =?iso-8859-1?Q?DAIF4OQLvlMQbqXLI5LI5NT2Y9pC1qQRk2ZgPDM9KSNbJnG0Uc/4pBwMsV?= =?iso-8859-1?Q?a5QSGAaoxwB77J/w593YM/fYI5g5ok09DwyrLmT+jD/dxemepedh4jXhPS?= =?iso-8859-1?Q?3yV6VSqGWUoamDNoDgVESQfe426ibzPAEgv4+jfTJ8bBp4hOhec8CSo+2Y?= =?iso-8859-1?Q?P8BD4HAsTGQ1KSBO/zHW57/FPr5dG96lchLF26npFwOiu9BvcstO4J1Nxn?= =?iso-8859-1?Q?hNnfeCkdkrsDYIwO1g/htk6bH8t7mkUDYyptM3ClOT28YCApwK7sYG0yxT?= =?iso-8859-1?Q?CqkPP/YyICNqENM7ZLK8Mn8LZ7hZjwEfrzMSE8g+xgfgEurvrTVRPYf210?= =?iso-8859-1?Q?PzUqsQNaKPV6BYwU+xONbMO0Sj1Io3Tg=3D=3D?= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SJ0PR18MB5161.namprd18.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(366016)(1800799024)(376014)(38070700018); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?Q?QfuQXm0yaKwi9B8cVx6aU5z7m0/5yp+QWgCBBYSRDnpGeP9C5n3/bC8HLv?= =?iso-8859-1?Q?FbPxXL3ZVi+io32oR7dBA6NHmi4X2Uv3RwSlf1rihaQBKocwBQLvordhB9?= =?iso-8859-1?Q?NwvZ8FQ62bsxyC6cwhbplKAVuGKedqFcDdSMgLUEpzRDN5zjPIbcuidT5s?= =?iso-8859-1?Q?AZYJytyBFDhNfuAHMNqF5g3Qas2qXHnzTGcNvGCcxmDHH5tSLf7yA+Q9Ov?= =?iso-8859-1?Q?YQxccNHszoeuqE2Yhw+xXERnqRT7B9G3Qc/htneg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WlCsyT4P/bHibKLRYefeQJzOleMo4JWLy6vA0PlrD3u82PUB2QS9R+WK?= =?iso-8859-1?Q?dDb/mjDq4/e/V28iK3uzU60GemfGQVTtHivNmftXBy5ot0oNEcUPWdAQAN?= =?iso-8859-1?Q?bMEqdOKgqGk+RuQwraNxrSwckRewxmS6Tj2HSmz817vUaWo5hbchReVMN0?= =?iso-8859-1?Q?2TfNQc6rZ+ZcfLTUXE9PdSYsZuDiq3fInC16fjrZAYu2HBo4hzRsoVMrFL?= =?iso-8859-1?Q?Gmx0GUPKf3erpSH5IW11wxTXyqoOC353hPyo5rNPu+KyWEbPDxS+TPf3Ya?= =?iso-8859-1?Q?RNQvpOV5KQIkC57/RnWc4ofsojs6uDUIvZfIVSw920Zc5u4qJi6jsWnveg?= =?iso-8859-1?Q?mOjxMCPQHWdj6pj9NepGXQ8skMCx9rEiEB8xEeH74UPDqWbXYP1h9Sw4CQ?= =?iso-8859-1?Q?4l0YuExFX9ON2ZjC+VE4901Ek5rCo4Y9gAuIp9iYMdCCEw1KdPGEaVpzq5?= =?iso-8859-1?Q?cJakzJyVDRug8bjAxmMZMFjeqtk7immR/L?= Content-Type: multipart/alternative; boundary="_000_SJ0PR18MB5161C175AB5C109BAA54D90CC8722SJ0PR18MB5161namp_" MIME-Version: 1.0 X-OriginatorOrg: marvell.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: SJ0PR18MB5161.namprd18.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5a890c32-8ee7-4974-b413-08dce4647da9 X-MS-Exchange-CrossTenant-originalarrivaltime: 04 Oct 2024 11:05:43.5877 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 70e1fb47-1155-421d-87fc-2e58f638b6e0 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: gTiBz/7lxh33tHiau3CEkUkZcSWNrhU9gKAjQ94WRVmxWQS1xXCFeQzHeELINLNYVcDK1gmMq7vDjhFShck5U2W5DPKJ7JgkaoaCgSHkjao= X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA3PR18MB6312 X-Proofpoint-GUID: MmF0ARokl1UusXlMtnDcXOUeM_eRU-Nf X-Proofpoint-ORIG-GUID: MmF0ARokl1UusXlMtnDcXOUeM_eRU-Nf X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.687,Hydra:6.0.235,FMLib:17.0.607.475 definitions=2020-10-13_15,2020-10-13_02,2020-04-07_01 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org --_000_SJ0PR18MB5161C175AB5C109BAA54D90CC8722SJ0PR18MB5161namp_ Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable ________________________________ From: Vidya Sagar Velumuri Sent: Friday, April 19, 2024 2:37 PM To: fengchengwen@huawei.com ; kevin.laatz@intel.co= m ; bruce.richardson@intel.com Cc: Jerin Jacob ; Anoob Joseph ; Vi= dya Sagar Velumuri ; Aakash Sasidharan ; Tejasree Kondoj ; Gowrishankar Muthukr= ishnan ; dev@dpdk.org Subject: [EXTERNAL] [PATCH v2 2/2] test/dma: add functions to verify zero a= nd one fill Prioritize security for external emails: Confirm sender and content safety = before clicking links or opening attachments ---------------------------------------------------------------------- Add test cases to verify zero fill and one fill Signed-off-by: Vidya Sagar Velumuri diff --git a/app/test/test.h b/app/test/test.h index 15e23d297f..0ca6519f6e 100644 --- a/app/test/test.h +++ b/app/test/test.h @@ -27,6 +27,10 @@ #include +#ifndef ARRAY_SIZE +#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) +#endif + #define TEST_ASSERT RTE_TEST_ASSERT #define TEST_ASSERT_EQUAL RTE_TEST_ASSERT_EQUAL diff --git a/app/test/test_dmadev.c b/app/test/test_dmadev.c index 7462e90831..ec896a4905 100644 --- a/app/test/test_dmadev.c +++ b/app/test/test_dmadev.c @@ -869,42 +869,51 @@ test_completion_handling(int16_t dev_id, uint16_t vch= an) static int test_enqueue_fill(int16_t dev_id, uint16_t vchan) { + uint64_t pattern[3] =3D {0x0, 0xfedcba9876543210, 0xfffffffffffffff= f}; const unsigned int lengths[] =3D {8, 64, 1024, 50, 100, 89}; + unsigned int i, j, k; struct rte_mbuf *dst; char *dst_data; - uint64_t pattern =3D 0xfedcba9876543210; - unsigned int i, j; dst =3D rte_pktmbuf_alloc(pool); if (dst =3D=3D NULL) ERR_RETURN("Failed to allocate mbuf\n"); dst_data =3D rte_pktmbuf_mtod(dst, char *); - for (i =3D 0; i < RTE_DIM(lengths); i++) { - /* reset dst_data */ - memset(dst_data, 0, rte_pktmbuf_data_len(dst)); + for (k =3D 0; k < ARRAY_SIZE(pattern); k++) { + for (i =3D 0; i < RTE_DIM(lengths); i++) { + /* reset dst_data */ + memset(dst_data, 0, rte_pktmbuf_data_len(dst)); + + /* perform the fill operation */ + int id =3D rte_dma_fill(dev_id, vchan, pattern[k], + rte_pktmbuf_iova(dst), lengths[i], = RTE_DMA_OP_FLAG_SUBMIT); + if (id < 0) { + if (id =3D=3D -ENOTSUP) { + rte_pktmbuf_free(dst); + break; + } + ERR_RETURN("Error with rte_dma_fill\n"); + } + await_hw(dev_id, vchan); - /* perform the fill operation */ - int id =3D rte_dma_fill(dev_id, vchan, pattern, - rte_pktmbuf_iova(dst), lengths[i], RTE_DMA_= OP_FLAG_SUBMIT); - if (id < 0) - ERR_RETURN("Error with rte_dma_fill\n"); - await_hw(dev_id, vchan); + if (rte_dma_completed(dev_id, vchan, 1, NULL, NULL)= !=3D 1) + ERR_RETURN("Error: fill operation failed (l= ength: %u)\n", + lengths[i]); + /* check the data from the fill operation is correc= t */ + for (j =3D 0; j < lengths[i]; j++) { + char pat_byte =3D ((char *)&pattern[k])[j %= 8]; - if (rte_dma_completed(dev_id, vchan, 1, NULL, NULL) !=3D 1) - ERR_RETURN("Error: fill operation failed (length: %= u)\n", lengths[i]); - /* check the data from the fill operation is correct */ - for (j =3D 0; j < lengths[i]; j++) { - char pat_byte =3D ((char *)&pattern)[j % 8]; - if (dst_data[j] !=3D pat_byte) - ERR_RETURN("Error with fill operation (leng= ths =3D %u): got (%x), not (%x)\n", - lengths[i], dst_data[j], pa= t_byte); + if (dst_data[j] !=3D pat_byte) + ERR_RETURN("Error with fill operati= on (lengths =3D %u): got (%x), not (%x)\n", + lengths[i], dst_dat= a[j], pat_byte); + } + /* check that the data after the fill operation was= not written to */ + for (; j < rte_pktmbuf_data_len(dst); j++) + if (dst_data[j] !=3D 0) + ERR_RETURN("Error, fill operation w= rote too far (lengths =3D %u): got (%x), not (%x)\n", + lengths[i], dst_dat= a[j], 0); } - /* check that the data after the fill operation was not wri= tten to */ - for (; j < rte_pktmbuf_data_len(dst); j++) - if (dst_data[j] !=3D 0) - ERR_RETURN("Error, fill operation wrote too= far (lengths =3D %u): got (%x), not (%x)\n", - lengths[i], dst_data[j], 0)= ; } rte_pktmbuf_free(dst); -- 2.25.1 Acked-by: Amit Prakash Shukla Thanks --_000_SJ0PR18MB5161C175AB5C109BAA54D90CC8722SJ0PR18MB5161namp_ Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable


From: Vidya = Sagar Velumuri <vvelumuri@marvell.com>
Sent: Friday, April 19, 2024 2:37 PM
To: fengchengwen@huawei.com <fengchengwen@huawei.com>; ke= vin.laatz@intel.com <kevin.laatz@intel.com>; bruce.richardson@intel.c= om <bruce.richardson@intel.com>
Cc: Jerin Jacob <jerinj@marvell.com>; Anoob Joseph <an= oobj@marvell.com>; Vidya Sagar Velumuri <vvelumuri@marvell.com>; A= akash Sasidharan <asasidharan@marvell.com>; Tejasree Kondoj <kteja= sree@marvell.com>; Gowrishankar Muthukrishnan <gmuthukrishn@marvell.c= om>; dev@dpdk.org <dev@dpdk.org>
Subject: [EXTERNAL] [PATCH v2 2/2] test/dma: add functions to v= erify zero and one fill
 
Prioritize securit= y for external emails: Confirm sender and content safety before clicking li= nks or opening attachments

----------------------------------------------------------------------
Add test cases to verify zero fill and one fill

Signed-off-by: Vidya Sagar Velumuri <vvelumuri@marvell.com>
diff --git a/app/test/test.h b/app/test/test.h
index 15e23d297f..0ca6519f6e 100644
--- a/app/test/test.h
+++ b/app/test/test.h
@@ -27,6 +27,10 @@
 
 #include <rte_test.h>
 
+#ifndef ARRAY_SIZE
+#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
+#endif
+
 #define TEST_ASSERT RTE_TEST_ASSERT
 
 #define TEST_ASSERT_EQUAL RTE_TEST_ASSERT_EQUAL
diff --git a/app/test/test_dmadev.c b/app/test/test_dmadev.c
index 7462e90831..ec896a4905 100644
--- a/app/test/test_dmadev.c
+++ b/app/test/test_dmadev.c
@@ -869,42 +869,51 @@ test_completion_handling(int16_t dev_id, uint16_t vch= an)
 static int
 test_enqueue_fill(int16_t dev_id, uint16_t vchan)
 {
+       uint64_t pattern[3] =3D {0x0, 0xfedcb= a9876543210, 0xffffffffffffffff};
         const unsigned int lengths= [] =3D {8, 64, 1024, 50, 100, 89};
+       unsigned int i, j, k;
         struct rte_mbuf *dst;
         char *dst_data;
-       uint64_t pattern =3D 0xfedcba98765432= 10;
-       unsigned int i, j;
 
         dst =3D rte_pktmbuf_alloc(= pool);
         if (dst =3D=3D NULL)
            &nb= sp;    ERR_RETURN("Failed to allocate mbuf\n");          dst_data =3D rte_pktmbuf_m= tod(dst, char *);
 
-       for (i =3D 0; i < RTE_DIM(lengths)= ; i++) {
-            &n= bsp;  /* reset dst_data */
-            &n= bsp;  memset(dst_data, 0, rte_pktmbuf_data_len(dst));
+       for (k =3D 0; k < ARRAY_SIZE(patte= rn); k++) {
+            &n= bsp;  for (i =3D 0; i < RTE_DIM(lengths); i++) {
+            &n= bsp;          /* reset dst_dat= a */
+            &n= bsp;          memset(dst_data,= 0, rte_pktmbuf_data_len(dst));
+
+            &n= bsp;          /* perform the f= ill operation */
+            &n= bsp;          int id =3D rte_d= ma_fill(dev_id, vchan, pattern[k],
+            &n= bsp;            = ;            &n= bsp; rte_pktmbuf_iova(dst), lengths[i], RTE_DMA_OP_FLAG_SUBMIT);
+            &n= bsp;          if (id < 0) {=
+            &n= bsp;            = ;      if (id =3D=3D -ENOTSUP) {
+            &n= bsp;            = ;            &n= bsp; rte_pktmbuf_free(dst);
+            &n= bsp;            = ;            &n= bsp; break;
+            &n= bsp;            = ;      }
+            &n= bsp;            = ;      ERR_RETURN("Error with rte_dma_fill\n&= quot;);
+            &n= bsp;          }
+            &n= bsp;          await_hw(dev_id,= vchan);
 
-            &n= bsp;  /* perform the fill operation */
-            &n= bsp;  int id =3D rte_dma_fill(dev_id, vchan, pattern,
-            &n= bsp;            = ;      rte_pktmbuf_iova(dst), lengths[i], RTE_DMA_= OP_FLAG_SUBMIT);
-            &n= bsp;  if (id < 0)
-            &n= bsp;          ERR_RETURN("= ;Error with rte_dma_fill\n");
-            &n= bsp;  await_hw(dev_id, vchan);
+            &n= bsp;          if (rte_dma_comp= leted(dev_id, vchan, 1, NULL, NULL) !=3D 1)
+            &n= bsp;            = ;      ERR_RETURN("Error: fill operation fail= ed (length: %u)\n",
+            &n= bsp;            = ;            &n= bsp;    lengths[i]);
+            &n= bsp;          /* check the dat= a from the fill operation is correct */
+            &n= bsp;          for (j =3D 0; j = < lengths[i]; j++) {
+            &n= bsp;            = ;      char pat_byte =3D ((char *)&pattern[k])= [j % 8];
 
-            &n= bsp;  if (rte_dma_completed(dev_id, vchan, 1, NULL, NULL) !=3D 1)
-            &n= bsp;          ERR_RETURN("= ;Error: fill operation failed (length: %u)\n", lengths[i]);
-            &n= bsp;  /* check the data from the fill operation is correct */
-            &n= bsp;  for (j =3D 0; j < lengths[i]; j++) {
-            &n= bsp;          char pat_byte = =3D ((char *)&pattern)[j % 8];
-            &n= bsp;          if (dst_data[j] = !=3D pat_byte)
-            &n= bsp;            = ;      ERR_RETURN("Error with fill operation = (lengths =3D %u): got (%x), not (%x)\n",
-            &n= bsp;            = ;            &n= bsp;         lengths[i], dst_data[j= ], pat_byte);
+            &n= bsp;            = ;      if (dst_data[j] !=3D pat_byte)
+            &n= bsp;            = ;            &n= bsp; ERR_RETURN("Error with fill operation (lengths =3D %u): got (%x),= not (%x)\n",
+            &n= bsp;            = ;            &n= bsp;            = ;     lengths[i], dst_data[j], pat_byte);
+            &n= bsp;          }
+            &n= bsp;          /* check that th= e data after the fill operation was not written to */
+            &n= bsp;          for (; j < rt= e_pktmbuf_data_len(dst); j++)
+            &n= bsp;            = ;      if (dst_data[j] !=3D 0)
+            &n= bsp;            = ;            &n= bsp; ERR_RETURN("Error, fill operation wrote too far (lengths =3D %u):= got (%x), not (%x)\n",
+            &n= bsp;            = ;            &n= bsp;            = ;     lengths[i], dst_data[j], 0);
            &nb= sp;    }
-            &n= bsp;  /* check that the data after the fill operation was not written = to */
-            &n= bsp;  for (; j < rte_pktmbuf_data_len(dst); j++)
-            &n= bsp;          if (dst_data[j] = !=3D 0)
-            &n= bsp;            = ;      ERR_RETURN("Error, fill operation wrot= e too far (lengths =3D %u): got (%x), not (%x)\n",
-            &n= bsp;            = ;            &n= bsp;         lengths[i], dst_data[j= ], 0);
         }
 
         rte_pktmbuf_free(dst);
--
2.25.1

Acked-by: Amit Prakash Shukla <amitprakashs@marvell.com>

Thanks

--_000_SJ0PR18MB5161C175AB5C109BAA54D90CC8722SJ0PR18MB5161namp_--