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 inbox.dpdk.org (Postfix) with ESMTP id 67127A04B5;
	Wed, 16 Sep 2020 18:46:54 +0200 (CEST)
Received: from [92.243.14.124] (localhost [127.0.0.1])
	by dpdk.org (Postfix) with ESMTP id ECBD61D418;
	Wed, 16 Sep 2020 18:45:14 +0200 (CEST)
Received: from mga06.intel.com (mga06.intel.com [134.134.136.31])
 by dpdk.org (Postfix) with ESMTP id 20B541D160
 for <dev@dpdk.org>; Wed, 16 Sep 2020 18:44:54 +0200 (CEST)
IronPort-SDR: f1bqY3svk0EGd38NRmDaYGob53jWXfHUcaIYw9OPc13qPtq4SXRjTJ7eertKM5zvBiDGNTWzxP
 P6QrzqTpMGpA==
X-IronPort-AV: E=McAfee;i="6000,8403,9746"; a="221069982"
X-IronPort-AV: E=Sophos;i="5.76,433,1592895600"; d="scan'208";a="221069982"
X-Amp-Result: SKIPPED(no attachment in message)
X-Amp-File-Uploaded: False
Received: from orsmga004.jf.intel.com ([10.7.209.38])
 by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;
 16 Sep 2020 09:44:49 -0700
IronPort-SDR: b43uPvsemGC6R5UxNekv4andTtqaYKgF/hMiZtewbsoPucdO5iBNm0BCQfIDelrvuYaiYMOcPi
 IS71UYMhbgOA==
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.76,433,1592895600"; d="scan'208";a="451925201"
Received: from silpixa00400629.ir.intel.com ([10.237.214.135])
 by orsmga004.jf.intel.com with ESMTP; 16 Sep 2020 09:44:48 -0700
From: Savinay Dharmappa <savinay.dharmappa@intel.com>
To: jasvinder.singh@intel.com,
	cristian.dumitrescu@intel.com,
	dev@dpdk.org
Cc: savinay.dharmappa@intel.com
Date: Wed, 16 Sep 2020 17:43:52 +0100
Message-Id: <1600274633-371993-9-git-send-email-savinay.dharmappa@intel.com>
X-Mailer: git-send-email 2.7.4
In-Reply-To: <1600274633-371993-1-git-send-email-savinay.dharmappa@intel.com>
References: <1599763717-135002-1-git-send-email-savinay.dharmappa@intel.com>
 <1600274633-371993-1-git-send-email-savinay.dharmappa@intel.com>
Subject: [dpdk-dev] [PATCH v3 8/9] app/test_sched: add dynamic config of
	subport
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>

Modify the test_sched application to build the hierarchical scheduler
with default subport bandwidth profile. It also allows to configure
a subport with different subport bandwidth profile dynamically

Signed-off-by: Savinay Dharmappa <savinay.dharmappa@intel.com>
---
 app/test/test_sched.c | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/app/test/test_sched.c b/app/test/test_sched.c
index fc31080..8d1eb25 100644
--- a/app/test/test_sched.c
+++ b/app/test/test_sched.c
@@ -21,6 +21,7 @@
 #define PIPE            1
 #define TC              2
 #define QUEUE           0
+#define MAX_SCHED_SUBPORT_PROFILES  8
 
 static struct rte_sched_pipe_params pipe_profile[] = {
 	{ /* Profile #0 */
@@ -36,15 +37,20 @@ static struct rte_sched_pipe_params pipe_profile[] = {
 	},
 };
 
-static struct rte_sched_subport_params subport_param[] = {
+static struct rte_sched_subport_profile_params
+		subport_profile[] = {
 	{
 		.tb_rate = 1250000000,
 		.tb_size = 1000000,
-
 		.tc_rate = {1250000000, 1250000000, 1250000000, 1250000000,
 			1250000000, 1250000000, 1250000000, 1250000000, 1250000000,
 			1250000000, 1250000000, 1250000000, 1250000000},
 		.tc_period = 10,
+	},
+};
+
+static struct rte_sched_subport_params subport_param[] = {
+	{
 		.n_pipes_per_subport_enabled = 1024,
 		.qsize = {32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32},
 		.pipe_profiles = pipe_profile,
@@ -59,6 +65,9 @@ static struct rte_sched_port_params port_param = {
 	.mtu = 1522,
 	.frame_overhead = RTE_SCHED_FRAME_OVERHEAD_DEFAULT,
 	.n_subports_per_port = 1,
+	.n_subport_profiles = 1,
+	.subport_profiles = subport_profile,
+	.n_max_subport_profiles = MAX_SCHED_SUBPORT_PROFILES,
 	.n_pipes_per_subport = 1024,
 };
 
@@ -66,6 +75,7 @@ static struct rte_sched_port_params port_param = {
 #define MBUF_DATA_SZ     (2048 + RTE_PKTMBUF_HEADROOM)
 #define MEMPOOL_CACHE_SZ 0
 #define SOCKET           0
+#define DEFAULT_PROFILE  0
 
 
 static struct rte_mempool *
@@ -141,6 +151,10 @@ test_sched(void)
 	err = rte_sched_subport_config(port, SUBPORT, subport_param);
 	TEST_ASSERT_SUCCESS(err, "Error config sched, err=%d\n", err);
 
+	err = rte_sched_subport_profile_config(port, SUBPORT,
+						DEFAULT_PROFILE);
+	TEST_ASSERT_SUCCESS(err, "Error config sched, err=%d\n", err);
+
 	for (pipe = 0; pipe < subport_param[0].n_pipes_per_subport_enabled; pipe++) {
 		err = rte_sched_pipe_config(port, SUBPORT, pipe, 0);
 		TEST_ASSERT_SUCCESS(err, "Error config sched pipe %u, err=%d\n", pipe, err);
-- 
2.7.4