From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from dpdk.org (dpdk.org [92.243.14.124])
	by dpdk.space (Postfix) with ESMTP id 31062A045E
	for <public@inbox.dpdk.org>; Tue, 28 May 2019 14:15:23 +0200 (CEST)
Received: from [92.243.14.124] (localhost [127.0.0.1])
	by dpdk.org (Postfix) with ESMTP id 0E84A1B9F3;
	Tue, 28 May 2019 14:08:53 +0200 (CEST)
Received: from mga09.intel.com (mga09.intel.com [134.134.136.24])
 by dpdk.org (Postfix) with ESMTP id 8BDD81B99B
 for <dev@dpdk.org>; Tue, 28 May 2019 14:08:40 +0200 (CEST)
X-Amp-Result: SKIPPED(no attachment in message)
X-Amp-File-Uploaded: False
Received: from fmsmga001.fm.intel.com ([10.253.24.23])
 by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;
 28 May 2019 05:08:40 -0700
X-ExtLoop1: 1
Received: from lkrakowx-mobl.ger.corp.intel.com ([10.103.104.99])
 by fmsmga001.fm.intel.com with ESMTP; 28 May 2019 05:08:38 -0700
From: Lukasz Krakowiak <lukaszx.krakowiak@intel.com>
To: cristian.dumitrescu@intel.com
Cc: dev@dpdk.org, Jasvinder Singh <jasvinder.singh@intel.com>,
 Abraham Tovar <abrahamx.tovar@intel.com>,
 Lukasz Krakowiak <lukaszx.krakowiak@intel.com>
Date: Tue, 28 May 2019 14:05:46 +0200
Message-Id: <20190528120553.2992-21-lukaszx.krakowiak@intel.com>
X-Mailer: git-send-email 2.19.2.windows.1
In-Reply-To: <20190528120553.2992-1-lukaszx.krakowiak@intel.com>
References: <20190528120553.2992-1-lukaszx.krakowiak@intel.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Subject: [dpdk-dev] [PATCH 20/27] sched: update grinder handle function
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://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
Sender: "dev" <dev-bounces@dpdk.org>

From: Jasvinder Singh <jasvinder.singh@intel.com>

Update grinder handle function implementation of the scheduler to allow
configuration flexiblity for pipe traffic classes and queues, and subport
level configuration of the pipe parameters.

Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
Signed-off-by: Abraham Tovar <abrahamx.tovar@intel.com>
Signed-off-by: Lukasz Krakowiak <lukaszx.krakowiak@intel.com>
---
 lib/librte_sched/rte_sched.c | 49 +++++++++++++++++++-----------------
 1 file changed, 26 insertions(+), 23 deletions(-)

diff --git a/lib/librte_sched/rte_sched.c b/lib/librte_sched/rte_sched.c
index 34b85af20..0c5479426 100644
--- a/lib/librte_sched/rte_sched.c
+++ b/lib/librte_sched/rte_sched.c
@@ -2495,7 +2495,7 @@ grinder_wrr(struct rte_sched_subport *subport, uint32_t pos)
 }
 
 
-#define grinder_evict(port, pos)
+#define grinder_evict(subport, pos)
 
 static inline void
 grinder_prefetch_pipe(struct rte_sched_subport *subport, uint32_t pos)
@@ -2507,9 +2507,9 @@ grinder_prefetch_pipe(struct rte_sched_subport *subport, uint32_t pos)
 }
 
 static inline void
-grinder_prefetch_tc_queue_arrays(struct rte_sched_port *port, uint32_t pos)
+grinder_prefetch_tc_queue_arrays(struct rte_sched_subport *subport, uint32_t pos)
 {
-	struct rte_sched_grinder *grinder = port->subport->grinder + pos;
+	struct rte_sched_grinder *grinder = subport->grinder + pos;
 	struct rte_sched_pipe *pipe = grinder->pipe;
 	struct rte_sched_queue *queue;
 	uint32_t tc_index = grinder->tc_index, i;
@@ -2532,8 +2532,8 @@ grinder_prefetch_tc_queue_arrays(struct rte_sched_port *port, uint32_t pos)
 		rte_prefetch0(grinder->be.qbase[i] + qr[i]);
 	}
 
-	grinder_wrr_load(port->subport, pos);
-	grinder_wrr(port->subport, pos);
+	grinder_wrr_load(subport, pos);
+	grinder_wrr(subport, pos);
 }
 
 static inline void
@@ -2580,9 +2580,9 @@ grinder_prefetch_mbuf(struct rte_sched_subport *subport, uint32_t pos)
 }
 
 static inline uint32_t
-grinder_handle(struct rte_sched_port *port, uint32_t pos)
+grinder_handle(struct rte_sched_port *port,
+	struct rte_sched_subport *subport, uint32_t pos)
 {
-	struct rte_sched_subport *subport = port->subport;
 	struct rte_sched_grinder *grinder = subport->grinder + pos;
 
 	switch (grinder->state) {
@@ -2603,9 +2603,9 @@ grinder_handle(struct rte_sched_port *port, uint32_t pos)
 	{
 		struct rte_sched_pipe *pipe = grinder->pipe;
 
-		grinder->pipe_params = port->pipe_profiles + pipe->profile;
-		grinder_prefetch_tc_queue_arrays(port, pos);
-		grinder_credits_update(port, port->subport, pos);
+		grinder->pipe_params = subport->pipe_profiles + pipe->profile;
+		grinder_prefetch_tc_queue_arrays(subport, pos);
+		grinder_credits_update(port, subport, pos);
 
 		grinder->state = e_GRINDER_PREFETCH_MBUF;
 		return 0;
@@ -2626,38 +2626,40 @@ grinder_handle(struct rte_sched_port *port, uint32_t pos)
 		result = grinder_schedule(port, subport, pos);
 
 		/* Look for next packet within the same TC */
-		if (result && grinder->qmask) {
-			grinder_wrr(port->subport, pos);
-			grinder_prefetch_mbuf(port->subport, pos);
+		if (result &&
+			(grinder->tc_index == RTE_SCHED_TRAFFIC_CLASS_BE) &&
+			(grinder->be.qmask)) {
+			grinder_wrr(subport, pos);
+			grinder_prefetch_mbuf(subport, pos);
 
 			return 1;
 		}
-		grinder_wrr_store(port->subport, pos);
+		grinder_wrr_store(subport, pos);
 
 		/* Look for another active TC within same pipe */
-		if (grinder_next_tc(port->subport, pos)) {
-			grinder_prefetch_tc_queue_arrays(port, pos);
+		if (grinder_next_tc(subport, pos)) {
+			grinder_prefetch_tc_queue_arrays(subport, pos);
 
 			grinder->state = e_GRINDER_PREFETCH_MBUF;
 			return result;
 		}
 
 		if (grinder->productive == 0 &&
-		    port->pipe_loop == RTE_SCHED_PIPE_INVALID)
-			port->pipe_loop = grinder->pindex;
+		    subport->pipe_loop == RTE_SCHED_PIPE_INVALID)
+			subport->pipe_loop = grinder->pindex;
 
-		grinder_evict(port, pos);
+		grinder_evict(subport, pos);
 
 		/* Look for another active pipe */
-		if (grinder_next_pipe(port->subport, pos)) {
-			grinder_prefetch_pipe(port->subport, pos);
+		if (grinder_next_pipe(subport, pos)) {
+			grinder_prefetch_pipe(subport, pos);
 
 			grinder->state = e_GRINDER_PREFETCH_TC_QUEUE_ARRAYS;
 			return result;
 		}
 
 		/* No active pipe found */
-		port->busy_grinders--;
+		subport->busy_grinders--;
 
 		grinder->state = e_GRINDER_PREFETCH_PIPE;
 		return result;
@@ -2717,7 +2719,8 @@ rte_sched_port_dequeue(struct rte_sched_port *port, struct rte_mbuf **pkts, uint
 
 	/* Take each queue in the grinder one step further */
 	for (i = 0, count = 0; ; i++)  {
-		count += grinder_handle(port, i & (RTE_SCHED_PORT_N_GRINDERS - 1));
+		count += grinder_handle(port, port->subport,
+			i & (RTE_SCHED_PORT_N_GRINDERS - 1));
 		if ((count == n_pkts) ||
 		    rte_sched_port_exceptions(port, i >= RTE_SCHED_PORT_N_GRINDERS)) {
 			break;
-- 
2.20.1