From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <vipin.varghese@intel.com>
Received: from mga11.intel.com (mga11.intel.com [192.55.52.93])
 by dpdk.org (Postfix) with ESMTP id 1F0471C8FA
 for <dev@dpdk.org>; Thu,  5 Apr 2018 07:56:05 +0200 (CEST)
X-Amp-Result: SKIPPED(no attachment in message)
X-Amp-File-Uploaded: False
Received: from fmsmga007.fm.intel.com ([10.253.24.52])
 by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;
 04 Apr 2018 22:56:04 -0700
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.48,410,1517904000"; d="scan'208";a="29689712"
Received: from unknown (HELO localhost.localdomain) ([10.224.122.203])
 by fmsmga007.fm.intel.com with ESMTP; 04 Apr 2018 22:56:03 -0700
From: Vipin Varghese <vipin.varghese@intel.com>
To: dev@dpdk.org,
	harry.van.haaren@intel.com
Cc: jerin.jacob@caviumnetworks.com, Vipin Varghese <vipin.varghese@intel.com>
Date: Thu,  5 Apr 2018 11:26:30 +0530
Message-Id: <1522907790-484-1-git-send-email-vipin.varghese@intel.com>
X-Mailer: git-send-email 1.9.1
In-Reply-To: <1522927443-13796-1-git-send-email-vipin.varghese@intel.com>
References: <1522927443-13796-1-git-send-email-vipin.varghese@intel.com>
Subject: [dpdk-dev] [PATCH v3] event/sw: code refractor to reduce the fetch
	stall
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://dpdk.org/ml/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Thu, 05 Apr 2018 05:56:06 -0000

With rearranging the code to prefetch the contents before
loop check increases performance from single and multistage
atomic pipeline.

Signed-off-by: Vipin Varghese <vipin.varghese@intel.com>
Acked-by: Harry van Haaren <harry.van.haaren@intel.com>
---

Changes in V3:
 - fix compilation for initial element - Vipin
 - fix the time and date for email sent - Vipin

Changes in V2:
 - compilation fix for const flowid - Harry
 - Removal of sw_refill_pp_buf logic - Harry
---
 drivers/event/sw/sw_evdev_scheduler.c | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)

diff --git a/drivers/event/sw/sw_evdev_scheduler.c b/drivers/event/sw/sw_evdev_scheduler.c
index e3a41e0..5eb3157 100644
--- a/drivers/event/sw/sw_evdev_scheduler.c
+++ b/drivers/event/sw/sw_evdev_scheduler.c
@@ -44,12 +44,13 @@
 	uint32_t qid_id = qid->id;
 
 	iq_dequeue_burst(sw, &qid->iq[iq_num], qes, count);
-	for (i = 0; i < count; i++) {
-		const struct rte_event *qe = &qes[i];
-		const uint16_t flow_id = SW_HASH_FLOWID(qes[i].flow_id);
-		struct sw_fid_t *fid = &qid->fids[flow_id];
-		int cq = fid->cq;
 
+	const struct rte_event *qe = &qes[0];
+	uint16_t flow_id = SW_HASH_FLOWID(qes[0].flow_id);
+	struct sw_fid_t *fid = &qid->fids[flow_id];
+	int cq = fid->cq;
+
+	for (i = 0; i < count; i++) {
 		if (cq < 0) {
 			uint32_t cq_idx = qid->cq_next_tx++;
 			if (qid->cq_next_tx == qid->cq_num_mapped_cqs)
@@ -101,6 +102,14 @@
 					&sw->cq_ring_space[cq]);
 			p->cq_buf_count = 0;
 		}
+
+		if (likely(i+1 < count)) {
+			qe = (qes + i + 1);
+			flow_id = SW_HASH_FLOWID(qes[i + 1].flow_id);
+			fid = &qid->fids[flow_id];
+			cq = fid->cq;
+		}
+
 	}
 	iq_put_back(sw, &qid->iq[iq_num], blocked_qes, nb_blocked);
 
-- 
1.9.1