From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 6E904A00C3;
	Wed, 21 Sep 2022 18:43:58 +0200 (CEST)
Received: from [217.70.189.124] (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id 25043410E8;
	Wed, 21 Sep 2022 18:43:58 +0200 (CEST)
Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com
 [67.231.148.174])
 by mails.dpdk.org (Postfix) with ESMTP id 99AC64067C
 for <dev@dpdk.org>; Wed, 21 Sep 2022 18:43:56 +0200 (CEST)
Received: from pps.filterd (m0045849.ppops.net [127.0.0.1])
 by mx0a-0016f401.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 28LA4nj6023657;
 Wed, 21 Sep 2022 09:43:55 -0700
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com;
 h=from : to : cc :
 subject : date : message-id : in-reply-to : references : mime-version :
 content-transfer-encoding : content-type; s=pfpt0220;
 bh=AwxaeYYcYPHkmxnYPHEdp+FnbowJE4zn1oXu7uguG5U=;
 b=Y6i5FlHk+i/1zuHPpkvIW3cRGZgwlHJK4o2o/3iRfnKNoVDzswsi5PZ8dhOSiBShCDj5
 MmuoMsqCY8xfPc7UxoadggLSf9NbMw1+k5Uv6C6KdvUOkuNtjOWNN3XBmCM8dxw8leJJ
 OfD/E0CFHC3HSLBnqT6bJRTKHt0Lq6x6A0x6VdQ3yyaa2938bUTV5FKkTjRIM0w0Qznk
 VuH1sdqpiKL94Vz4YNVoqAdJTRg/QQypcjc6vddi+W0jTTeX4RIhVgiqvm0KLvLVu9I9
 I6KzQ/k7ansUeyNb1zgygqQh+RzvLoTqIzlqaoZ5eIyUMJiPtPlPmRkVK4v6EhZBlThb NQ== 
Received: from dc5-exch01.marvell.com ([199.233.59.181])
 by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3jr0b71gc3-1
 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT);
 Wed, 21 Sep 2022 09:43:55 -0700
Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH01.marvell.com
 (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.2;
 Wed, 21 Sep 2022 09:43:54 -0700
Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com
 (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.2 via Frontend
 Transport; Wed, 21 Sep 2022 09:43:54 -0700
Received: from MININT-80QBFE8.corp.innovium.com (unknown [10.28.161.88])
 by maili.marvell.com (Postfix) with ESMTP id 963CB3F709D;
 Wed, 21 Sep 2022 09:43:49 -0700 (PDT)
From: <pbhagavatula@marvell.com>
To: <jerinj@marvell.com>, Sunil Kumar Kori <skori@marvell.com>, "Pavan
 Nikhilesh" <pbhagavatula@marvell.com>
CC: <dev@dpdk.org>, <jay.jayatheerthan@intel.com>, <erik.g.carrillo@intel.com>,
 <abhinandan.gujjar@intel.com>, <timothy.mcdaniel@intel.com>,
 <sthotton@marvell.com>, <hemant.agrawal@nxp.com>,
 <nipun.gupta@nxp.com>, <harry.van.haaren@intel.com>,
 <mattias.ronnblom@ericsson.com>, <liangma@liangbit.com>,
 <peter.mccarthy@intel.com>
Subject: [PATCH v2 2/3] examples: update event vector free routine
Date: Wed, 21 Sep 2022 22:13:41 +0530
Message-ID: <20220921164342.2174-2-pbhagavatula@marvell.com>
X-Mailer: git-send-email 2.25.1
In-Reply-To: <20220921164342.2174-1-pbhagavatula@marvell.com>
References: <20220816154932.10168-1-pbhagavatula@marvell.com>
 <20220921164342.2174-1-pbhagavatula@marvell.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Content-Type: text/plain
X-Proofpoint-ORIG-GUID: -_gl4HziIocSrlwkpOA9ZbMqwxNftaZB
X-Proofpoint-GUID: -_gl4HziIocSrlwkpOA9ZbMqwxNftaZB
X-Proofpoint-Virus-Version: vendor=baseguard
 engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.528,FMLib:17.11.122.1
 definitions=2022-09-21_09,2022-09-20_02,2022-06-22_01
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.29
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

From: Pavan Nikhilesh <pbhagavatula@marvell.com>

Update event vector free routine to account for element
offset while freeing elements.

Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
---
 app/test-eventdev/test_pipeline_common.c | 5 +++--
 examples/l2fwd-event/l2fwd_common.c      | 5 +++--
 examples/l3fwd/l3fwd_event.c             | 5 +++--
 3 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/app/test-eventdev/test_pipeline_common.c b/app/test-eventdev/test_pipeline_common.c
index 4f40d37659..f9a67b2a14 100644
--- a/app/test-eventdev/test_pipeline_common.c
+++ b/app/test-eventdev/test_pipeline_common.c
@@ -673,8 +673,9 @@ pipeline_vector_array_free(struct rte_event events[], uint16_t num)
 	uint16_t i;
 
 	for (i = 0; i < num; i++) {
-		rte_pktmbuf_free_bulk(events[i].vec->mbufs,
-				      events[i].vec->nb_elem);
+		rte_pktmbuf_free_bulk(
+			&events[i].vec->mbufs[events[i].vec->elem_offset],
+			events[i].vec->nb_elem);
 		rte_mempool_put(rte_mempool_from_obj(events[i].vec),
 				events[i].vec);
 	}
diff --git a/examples/l2fwd-event/l2fwd_common.c b/examples/l2fwd-event/l2fwd_common.c
index 41a0d3f22f..03983b3bd7 100644
--- a/examples/l2fwd-event/l2fwd_common.c
+++ b/examples/l2fwd-event/l2fwd_common.c
@@ -121,8 +121,9 @@ l2fwd_event_vector_array_free(struct rte_event events[], uint16_t num)
 	uint16_t i;
 
 	for (i = 0; i < num; i++) {
-		rte_pktmbuf_free_bulk(events[i].vec->mbufs,
-				      events[i].vec->nb_elem);
+		rte_pktmbuf_free_bulk(
+			&events[i].vec->mbufs[events[i].vec->elem_offset],
+			events[i].vec->nb_elem);
 		rte_mempool_put(rte_mempool_from_obj(events[i].vec),
 				events[i].vec);
 	}
diff --git a/examples/l3fwd/l3fwd_event.c b/examples/l3fwd/l3fwd_event.c
index 0b58475c85..3d60fd7d91 100644
--- a/examples/l3fwd/l3fwd_event.c
+++ b/examples/l3fwd/l3fwd_event.c
@@ -294,8 +294,9 @@ l3fwd_event_vector_array_free(struct rte_event events[], uint16_t num)
 	uint16_t i;
 
 	for (i = 0; i < num; i++) {
-		rte_pktmbuf_free_bulk(events[i].vec->mbufs,
-				      events[i].vec->nb_elem);
+		rte_pktmbuf_free_bulk(
+			&events[i].vec->mbufs[events[i].vec->elem_offset],
+			events[i].vec->nb_elem);
 		rte_mempool_put(rte_mempool_from_obj(events[i].vec),
 				events[i].vec);
 	}
-- 
2.25.1