From patchwork Wed Sep 2 09:07:08 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Savinay Dharmappa X-Patchwork-Id: 76306 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 1B288A04B7; Wed, 2 Sep 2020 11:07:53 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 8E94B1C0CE; Wed, 2 Sep 2020 11:07:28 +0200 (CEST) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 033F24C99 for ; Wed, 2 Sep 2020 11:07:23 +0200 (CEST) IronPort-SDR: JyJ9ZMtjAiNezfbBUXy3RRrnNCgfBqUeDy9e9X1BeLBw5NSO29+bOvK1POEyJk4y/LHnui7z42 GOjuX2vdrUPQ== X-IronPort-AV: E=McAfee;i="6000,8403,9731"; a="154857634" X-IronPort-AV: E=Sophos;i="5.76,381,1592895600"; d="scan'208";a="154857634" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Sep 2020 02:07:18 -0700 IronPort-SDR: jSUnb3OhlZ2u3/ameT8Vi36ODQ/bHUHpreBeIE+xjVoqptFjxv6G4mbu1vDoAVAvum8CY6xpyF 7RHmJCreBX7Q== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.76,381,1592895600"; d="scan'208";a="301757176" Received: from unknown (HELO silpixa00400629.ir.intel.com) ([10.237.214.135]) by orsmga006.jf.intel.com with ESMTP; 02 Sep 2020 02:07:16 -0700 From: Savinay Dharmappa To: cristian.dumitrescu@intel.com, jasvinder.singh@intel.com, dev@dpdk.org Cc: savinay.dharmappa@intel.com Date: Wed, 2 Sep 2020 10:07:08 +0100 Message-Id: <1599037631-199836-1-git-send-email-savinay.dharmappa@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1594837677-313175-3-git-send-email-savinay.dharmappa@intel.com> References: <1594837677-313175-3-git-send-email-savinay.dharmappa@intel.com> Subject: [dpdk-dev] [PATCH v1 1/4] example/qos_sched: subport bandwidth dynmaic conf X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" qos sched application uses the new apis introduced as part of dynamic configuration of subport bandwidth to configure the deafult subport bandwidth profile while buidling the hirerachical scheduler. Signed-off-by: Savinay Dharmappa Signed-off-by: Savinay Dharmappa --- examples/qos_sched/cfg_file.c | 158 ++++++++++++++++++++++++----------------- examples/qos_sched/cfg_file.h | 4 ++ examples/qos_sched/init.c | 24 +++++-- examples/qos_sched/main.h | 1 + examples/qos_sched/profile.cfg | 3 + 5 files changed, 120 insertions(+), 70 deletions(-) diff --git a/examples/qos_sched/cfg_file.c b/examples/qos_sched/cfg_file.c index f078e4f..9e1341c 100644 --- a/examples/qos_sched/cfg_file.c +++ b/examples/qos_sched/cfg_file.c @@ -53,8 +53,11 @@ cfg_load_pipe(struct rte_cfgfile *cfg, struct rte_sched_pipe_params *pipe_params if (!cfg || !pipe_params) return -1; - profiles = rte_cfgfile_num_sections(cfg, "pipe profile", sizeof("pipe profile") - 1); - subport_params[0].n_pipe_profiles = profiles; + profiles = rte_cfgfile_num_sections(cfg, "pipe profile", + sizeof("pipe profile") - 1); + port_params.n_subport_profiles = profiles; + + printf(" profiles = %d", profiles); for (j = 0; j < profiles; j++) { char pipe_name[32]; @@ -143,6 +146,93 @@ cfg_load_pipe(struct rte_cfgfile *cfg, struct rte_sched_pipe_params *pipe_params } int +cfg_load_subport_profile(struct rte_cfgfile *cfg, + struct rte_sched_subport_profile_params *subport_profile) +{ + int i; + const char *entry; + int profiles; + + if (!cfg || !subport_profile) + return -1; + + profiles = rte_cfgfile_num_sections(cfg, "subport profile", + sizeof("subport profile") - 1); + subport_params[0].n_pipe_profiles = profiles; + + for (i = 0; i < profiles; i++) { + char sec_name[32]; + snprintf(sec_name, sizeof(sec_name), "subport profile %d", i); + + entry = rte_cfgfile_get_entry(cfg, sec_name, "tb rate"); + if (entry) + subport_profile[i].tb_rate = (uint64_t)atoi(entry); + + entry = rte_cfgfile_get_entry(cfg, sec_name, "tb size"); + if (entry) + subport_profile[i].tb_size = (uint64_t)atoi(entry); + + entry = rte_cfgfile_get_entry(cfg, sec_name, "tc period"); + if (entry) + subport_profile[i].tc_period = (uint64_t)atoi(entry); + + entry = rte_cfgfile_get_entry(cfg, sec_name, "tc 0 rate"); + if (entry) + subport_profile[i].tc_rate[0] = (uint64_t)atoi(entry); + + entry = rte_cfgfile_get_entry(cfg, sec_name, "tc 1 rate"); + if (entry) + subport_profile[i].tc_rate[1] = (uint64_t)atoi(entry); + + entry = rte_cfgfile_get_entry(cfg, sec_name, "tc 2 rate"); + if (entry) + subport_profile[i].tc_rate[2] = (uint64_t)atoi(entry); + + entry = rte_cfgfile_get_entry(cfg, sec_name, "tc 3 rate"); + if (entry) + subport_profile[i].tc_rate[3] = (uint64_t)atoi(entry); + + entry = rte_cfgfile_get_entry(cfg, sec_name, "tc 4 rate"); + if (entry) + subport_profile[i].tc_rate[4] = (uint64_t)atoi(entry); + + entry = rte_cfgfile_get_entry(cfg, sec_name, "tc 5 rate"); + if (entry) + subport_profile[i].tc_rate[5] = (uint64_t)atoi(entry); + + entry = rte_cfgfile_get_entry(cfg, sec_name, "tc 6 rate"); + if (entry) + subport_profile[i].tc_rate[6] = (uint64_t)atoi(entry); + + entry = rte_cfgfile_get_entry(cfg, sec_name, "tc 7 rate"); + if (entry) + subport_profile[i].tc_rate[7] = (uint64_t)atoi(entry); + + entry = rte_cfgfile_get_entry(cfg, sec_name, "tc 8 rate"); + if (entry) + subport_profile[i].tc_rate[8] = (uint64_t)atoi(entry); + + entry = rte_cfgfile_get_entry(cfg, sec_name, "tc 9 rate"); + if (entry) + subport_profile[i].tc_rate[9] = (uint64_t)atoi(entry); + + entry = rte_cfgfile_get_entry(cfg, sec_name, "tc 10 rate"); + if (entry) + subport_profile[i].tc_rate[10] = (uint64_t)atoi(entry); + + entry = rte_cfgfile_get_entry(cfg, sec_name, "tc 11 rate"); + if (entry) + subport_profile[i].tc_rate[11] = (uint64_t)atoi(entry); + + entry = rte_cfgfile_get_entry(cfg, sec_name, "tc 12 rate"); + if (entry) + subport_profile[i].tc_rate[12] = (uint64_t)atoi(entry); + } + + return 0; +} + +int cfg_load_subport(struct rte_cfgfile *cfg, struct rte_sched_subport_params *subport_params) { const char *entry; @@ -267,70 +357,6 @@ cfg_load_subport(struct rte_cfgfile *cfg, struct rte_sched_subport_params *subpo } } - entry = rte_cfgfile_get_entry(cfg, sec_name, "tb rate"); - if (entry) - subport_params[i].tb_rate = (uint64_t)atoi(entry); - - entry = rte_cfgfile_get_entry(cfg, sec_name, "tb size"); - if (entry) - subport_params[i].tb_size = (uint64_t)atoi(entry); - - entry = rte_cfgfile_get_entry(cfg, sec_name, "tc period"); - if (entry) - subport_params[i].tc_period = (uint64_t)atoi(entry); - - entry = rte_cfgfile_get_entry(cfg, sec_name, "tc 0 rate"); - if (entry) - subport_params[i].tc_rate[0] = (uint64_t)atoi(entry); - - entry = rte_cfgfile_get_entry(cfg, sec_name, "tc 1 rate"); - if (entry) - subport_params[i].tc_rate[1] = (uint64_t)atoi(entry); - - entry = rte_cfgfile_get_entry(cfg, sec_name, "tc 2 rate"); - if (entry) - subport_params[i].tc_rate[2] = (uint64_t)atoi(entry); - - entry = rte_cfgfile_get_entry(cfg, sec_name, "tc 3 rate"); - if (entry) - subport_params[i].tc_rate[3] = (uint64_t)atoi(entry); - - entry = rte_cfgfile_get_entry(cfg, sec_name, "tc 4 rate"); - if (entry) - subport_params[i].tc_rate[4] = (uint64_t)atoi(entry); - - entry = rte_cfgfile_get_entry(cfg, sec_name, "tc 5 rate"); - if (entry) - subport_params[i].tc_rate[5] = (uint64_t)atoi(entry); - - entry = rte_cfgfile_get_entry(cfg, sec_name, "tc 6 rate"); - if (entry) - subport_params[i].tc_rate[6] = (uint64_t)atoi(entry); - - entry = rte_cfgfile_get_entry(cfg, sec_name, "tc 7 rate"); - if (entry) - subport_params[i].tc_rate[7] = (uint64_t)atoi(entry); - - entry = rte_cfgfile_get_entry(cfg, sec_name, "tc 8 rate"); - if (entry) - subport_params[i].tc_rate[8] = (uint64_t)atoi(entry); - - entry = rte_cfgfile_get_entry(cfg, sec_name, "tc 9 rate"); - if (entry) - subport_params[i].tc_rate[9] = (uint64_t)atoi(entry); - - entry = rte_cfgfile_get_entry(cfg, sec_name, "tc 10 rate"); - if (entry) - subport_params[i].tc_rate[10] = (uint64_t)atoi(entry); - - entry = rte_cfgfile_get_entry(cfg, sec_name, "tc 11 rate"); - if (entry) - subport_params[i].tc_rate[11] = (uint64_t)atoi(entry); - - entry = rte_cfgfile_get_entry(cfg, sec_name, "tc 12 rate"); - if (entry) - subport_params[i].tc_rate[12] = (uint64_t)atoi(entry); - int n_entries = rte_cfgfile_section_num_entries(cfg, sec_name); struct rte_cfgfile_entry entries[n_entries]; diff --git a/examples/qos_sched/cfg_file.h b/examples/qos_sched/cfg_file.h index 2eccf1c..0dc458a 100644 --- a/examples/qos_sched/cfg_file.h +++ b/examples/qos_sched/cfg_file.h @@ -14,4 +14,8 @@ int cfg_load_pipe(struct rte_cfgfile *cfg, struct rte_sched_pipe_params *pipe); int cfg_load_subport(struct rte_cfgfile *cfg, struct rte_sched_subport_params *subport); +int cfg_load_subport_profile(struct rte_cfgfile *cfg, + struct rte_sched_subport_profile_params + *subport_profile); + #endif diff --git a/examples/qos_sched/init.c b/examples/qos_sched/init.c index 9626c15..541adb7 100644 --- a/examples/qos_sched/init.c +++ b/examples/qos_sched/init.c @@ -196,15 +196,20 @@ static struct rte_sched_pipe_params pipe_profiles[MAX_SCHED_PIPE_PROFILES] = { }, }; -struct rte_sched_subport_params subport_params[MAX_SCHED_SUBPORTS] = { +static struct rte_sched_subport_profile_params + subport_profile[MAX_SCHED_SUBPORT_PROFILES] = { { .tb_rate = 1250000000, .tb_size = 1000000, - .tc_rate = {1250000000, 1250000000, 1250000000, 1250000000, 1250000000, 1250000000, 1250000000, 1250000000, 1250000000, 1250000000, 1250000000, 1250000000, 1250000000}, .tc_period = 10, + }, +}; + +struct rte_sched_subport_params subport_params[MAX_SCHED_SUBPORTS] = { + { .n_pipes_per_subport_enabled = 4096, .qsize = {64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64}, .pipe_profiles = pipe_profiles, @@ -289,6 +294,9 @@ struct rte_sched_port_params port_params = { .mtu = 6 + 6 + 4 + 4 + 2 + 1500, .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 = MAX_SCHED_PIPES, }; @@ -320,8 +328,15 @@ app_init_sched_port(uint32_t portid, uint32_t socketid) for (subport = 0; subport < port_params.n_subports_per_port; subport ++) { err = rte_sched_subport_config(port, subport, &subport_params[subport]); if (err) { - rte_exit(EXIT_FAILURE, "Unable to config sched subport %u, err=%d\n", - subport, err); + rte_exit(EXIT_FAILURE, "Unable to config schedi " + "subport %u, err=%d\n", subport, err); + } + + err = rte_sched_subport_profile_config(port, subport, 0); + if (err) { + rte_exit(EXIT_FAILURE, "failed to configure " + "profile err=%d\n", err); + } uint32_t n_pipes_per_subport = @@ -354,6 +369,7 @@ app_load_cfg_profile(const char *profile) cfg_load_port(file, &port_params); cfg_load_subport(file, subport_params); + cfg_load_subport_profile(file, subport_profile); cfg_load_pipe(file, pipe_profiles); rte_cfgfile_close(file); diff --git a/examples/qos_sched/main.h b/examples/qos_sched/main.h index 23bc418..0d6815a 100644 --- a/examples/qos_sched/main.h +++ b/examples/qos_sched/main.h @@ -51,6 +51,7 @@ extern "C" { #define MAX_SCHED_SUBPORTS 8 #define MAX_SCHED_PIPES 4096 #define MAX_SCHED_PIPE_PROFILES 256 +#define MAX_SCHED_SUBPORT_PROFILES 8 #ifndef APP_COLLECT_STAT #define APP_COLLECT_STAT 1 diff --git a/examples/qos_sched/profile.cfg b/examples/qos_sched/profile.cfg index 61b8b70..4486d27 100644 --- a/examples/qos_sched/profile.cfg +++ b/examples/qos_sched/profile.cfg @@ -26,6 +26,9 @@ number of subports per port = 1 number of pipes per subport = 4096 queue sizes = 64 64 64 64 64 64 64 64 64 64 64 64 64 +subport 0-8 = 0 ; These subports are configured with subport profile 0 + +[subport profile 0] tb rate = 1250000000 ; Bytes per second tb size = 1000000 ; Bytes From patchwork Wed Sep 2 09:07:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Savinay Dharmappa X-Patchwork-Id: 76303 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 22024A04B7; Wed, 2 Sep 2020 11:07:25 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 3102C1C07B; Wed, 2 Sep 2020 11:07:24 +0200 (CEST) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 693A64C99 for ; Wed, 2 Sep 2020 11:07:22 +0200 (CEST) IronPort-SDR: C2TrvwvS8BYX3Im5913oBiMOd/I2fTelNzzU9LycwNnM9/AMHXK+vqr0qAk6jwZKpPpRgKNEHw HQSd+xetbXsg== X-IronPort-AV: E=McAfee;i="6000,8403,9731"; a="154857636" X-IronPort-AV: E=Sophos;i="5.76,381,1592895600"; d="scan'208";a="154857636" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Sep 2020 02:07:19 -0700 IronPort-SDR: dXkD/J6yKMHmdd9gLwUscV2GSWLazFFC7tOEejf40cCzgOxqF97x1xHkiTJoZUJKFlDkLnfGuP 1Wl5Q4ZrmOqQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.76,381,1592895600"; d="scan'208";a="301757185" Received: from unknown (HELO silpixa00400629.ir.intel.com) ([10.237.214.135]) by orsmga006.jf.intel.com with ESMTP; 02 Sep 2020 02:07:17 -0700 From: Savinay Dharmappa To: cristian.dumitrescu@intel.com, jasvinder.singh@intel.com, dev@dpdk.org Cc: savinay.dharmappa@intel.com Date: Wed, 2 Sep 2020 10:07:09 +0100 Message-Id: <1599037631-199836-2-git-send-email-savinay.dharmappa@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1599037631-199836-1-git-send-email-savinay.dharmappa@intel.com> References: <1594837677-313175-3-git-send-email-savinay.dharmappa@intel.com> <1599037631-199836-1-git-send-email-savinay.dharmappa@intel.com> Subject: [dpdk-dev] [PATCH v1 2/4] example/ip_pipeline: subport bandwidth dynmaic conf X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" ip_pipeline application uses the new apis introduced as part of dynamic configuration of subport bandwidth to configure the deafult subport bandwidth profile while buidling the hirerachical scheduler Signed-off-by: Savinay Dharmappa --- examples/ip_pipeline/cli.c | 10 ++++++---- examples/ip_pipeline/tmgr.c | 28 +++++++++++++++++++++++++--- examples/ip_pipeline/tmgr.h | 3 ++- 3 files changed, 33 insertions(+), 8 deletions(-) diff --git a/examples/ip_pipeline/cli.c b/examples/ip_pipeline/cli.c index d79699e..e192275 100644 --- a/examples/ip_pipeline/cli.c +++ b/examples/ip_pipeline/cli.c @@ -406,7 +406,8 @@ cmd_tmgr_subport_profile(char **tokens, char *out, size_t out_size) { - struct rte_sched_subport_params p; + struct rte_sched_subport_params params; + struct rte_sched_subport_profile_params p; int status, i; if (n_tokens != 35) { @@ -440,7 +441,8 @@ cmd_tmgr_subport_profile(char **tokens, return; } - if (parser_read_uint32(&p.n_pipes_per_subport_enabled, tokens[20]) != 0) { + if (parser_read_uint32(¶ms.n_pipes_per_subport_enabled, + tokens[20]) != 0) { snprintf(out, out_size, MSG_ARG_INVALID, "n_pipes_per_subport"); return; } @@ -451,12 +453,12 @@ cmd_tmgr_subport_profile(char **tokens, } for (i = 0; i < RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE; i++) - if (parser_read_uint16(&p.qsize[i], tokens[22 + i]) != 0) { + if (parser_read_uint16(¶ms.qsize[i], tokens[22 + i]) != 0) { snprintf(out, out_size, MSG_ARG_INVALID, "qsize"); return; } - status = tmgr_subport_profile_add(&p); + status = tmgr_subport_profile_add(&p, ¶ms); if (status != 0) { snprintf(out, out_size, MSG_CMD_FAIL, tokens[0]); return; diff --git a/examples/ip_pipeline/tmgr.c b/examples/ip_pipeline/tmgr.c index 91ccbf6..c609102 100644 --- a/examples/ip_pipeline/tmgr.c +++ b/examples/ip_pipeline/tmgr.c @@ -11,6 +11,9 @@ static struct rte_sched_subport_params subport_profile[TMGR_SUBPORT_PROFILE_MAX]; +static struct rte_sched_subport_profile_params + profile_params[TMGR_SUBPORT_PROFILE_MAX]; + static uint32_t n_subport_profiles; static struct rte_sched_pipe_params @@ -44,15 +47,20 @@ tmgr_port_find(const char *name) } int -tmgr_subport_profile_add(struct rte_sched_subport_params *p) +tmgr_subport_profile_add(struct rte_sched_subport_profile_params *p, + struct rte_sched_subport_params *params) { /* Check input params */ - if (p == NULL || - p->n_pipes_per_subport_enabled == 0) + if (p == NULL || params == NULL || + params->n_pipes_per_subport_enabled == 0) return -1; /* Save profile */ memcpy(&subport_profile[n_subport_profiles], + params, + sizeof(*params)); + + memcpy(&profile_params[n_subport_profiles], p, sizeof(*p)); @@ -103,6 +111,9 @@ tmgr_port_create(const char *name, struct tmgr_port_params *params) p.mtu = params->mtu; p.frame_overhead = params->frame_overhead; p.n_subports_per_port = params->n_subports_per_port; + p.n_subport_profiles = n_subport_profiles; + p.subport_profiles = profile_params; + p.n_max_subport_profiles = TMGR_SUBPORT_PROFILE_MAX; p.n_pipes_per_subport = TMGR_PIPE_SUBPORT_MAX; s = rte_sched_port_config(&p); @@ -126,6 +137,13 @@ tmgr_port_create(const char *name, struct tmgr_port_params *params) return NULL; } + status = rte_sched_subport_profile_config(s, i, 0); + + if (status) { + rte_sched_port_free(s); + return NULL; + } + for (j = 0; j < subport_profile[0].n_pipes_per_subport_enabled; j++) { status = rte_sched_pipe_config( s, @@ -182,6 +200,10 @@ tmgr_subport_config(const char *port_name, subport_id, &subport_profile[subport_profile_id]); + if (!status) + status = rte_sched_subport_profile_config(port->s, subport_id, + subport_profile_id); + return status; } diff --git a/examples/ip_pipeline/tmgr.h b/examples/ip_pipeline/tmgr.h index ee50cf7..b19fb23 100644 --- a/examples/ip_pipeline/tmgr.h +++ b/examples/ip_pipeline/tmgr.h @@ -48,7 +48,8 @@ struct tmgr_port_params { }; int -tmgr_subport_profile_add(struct rte_sched_subport_params *p); +tmgr_subport_profile_add(struct rte_sched_subport_profile_params *p, + struct rte_sched_subport_params *params); int tmgr_pipe_profile_add(struct rte_sched_pipe_params *p); From patchwork Wed Sep 2 09:07:10 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Savinay Dharmappa X-Patchwork-Id: 76305 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 370ECA04B7; Wed, 2 Sep 2020 11:07:43 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 6D5B71C0BF; Wed, 2 Sep 2020 11:07:27 +0200 (CEST) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id B46951C066 for ; Wed, 2 Sep 2020 11:07:23 +0200 (CEST) IronPort-SDR: WU+G6H7i4nNZAF7TpvWW/gFaiHTqMgX23Vk/qhKbFy+In6kDlnp2Bfq/XxYuSPEO4q6Rb/nVcH m8YWy+L+kg7Q== X-IronPort-AV: E=McAfee;i="6000,8403,9731"; a="154857641" X-IronPort-AV: E=Sophos;i="5.76,381,1592895600"; d="scan'208";a="154857641" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Sep 2020 02:07:20 -0700 IronPort-SDR: khSI21qYyWT0VyZSJEXYilFzdEpfP0VOwh9KBbvR4ByApqQ0GW74zUMfq/fiYPonKqeb28XqrT ppgZV/fkZyUw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.76,381,1592895600"; d="scan'208";a="301757195" Received: from unknown (HELO silpixa00400629.ir.intel.com) ([10.237.214.135]) by orsmga006.jf.intel.com with ESMTP; 02 Sep 2020 02:07:19 -0700 From: Savinay Dharmappa To: cristian.dumitrescu@intel.com, jasvinder.singh@intel.com, dev@dpdk.org Cc: savinay.dharmappa@intel.com Date: Wed, 2 Sep 2020 10:07:10 +0100 Message-Id: <1599037631-199836-3-git-send-email-savinay.dharmappa@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1599037631-199836-1-git-send-email-savinay.dharmappa@intel.com> References: <1594837677-313175-3-git-send-email-savinay.dharmappa@intel.com> <1599037631-199836-1-git-send-email-savinay.dharmappa@intel.com> Subject: [dpdk-dev] [PATCH v1 3/4] drivers/softnic: subport bandwidth profile config X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" softnic driver uses the new apis introduced as part of dynamic configuration of subport bandwidth to configure the deafult subport bandwidth profile while buidling the hirerachical scheduler. Signed-off-by: Savinay Dharmappa --- drivers/net/softnic/rte_eth_softnic_internals.h | 9 + drivers/net/softnic/rte_eth_softnic_tm.c | 222 +++++++++++++++++++----- 2 files changed, 186 insertions(+), 45 deletions(-) diff --git a/drivers/net/softnic/rte_eth_softnic_internals.h b/drivers/net/softnic/rte_eth_softnic_internals.h index 6eec43b..cc50037 100644 --- a/drivers/net/softnic/rte_eth_softnic_internals.h +++ b/drivers/net/softnic/rte_eth_softnic_internals.h @@ -164,10 +164,19 @@ TAILQ_HEAD(softnic_link_list, softnic_link); #ifndef TM_MAX_PIPE_PROFILE #define TM_MAX_PIPE_PROFILE 256 #endif + +#ifndef TM_MAX_SUBPORT_PROFILE +#define TM_MAX_SUBPORT_PROFILE 256 +#endif + struct tm_params { struct rte_sched_port_params port_params; struct rte_sched_subport_params subport_params[TM_MAX_SUBPORTS]; + struct rte_sched_subport_profile_params + subport_profiles[TM_MAX_SUBPORT_PROFILE]; + uint32_t n_subport_profiles; + uint32_t subport_to_profile[TM_MAX_SUBPORT_PROFILE]; struct rte_sched_pipe_params pipe_profiles[TM_MAX_PIPE_PROFILE]; uint32_t n_pipe_profiles; diff --git a/drivers/net/softnic/rte_eth_softnic_tm.c b/drivers/net/softnic/rte_eth_softnic_tm.c index 80a470c..881f025 100644 --- a/drivers/net/softnic/rte_eth_softnic_tm.c +++ b/drivers/net/softnic/rte_eth_softnic_tm.c @@ -98,6 +98,13 @@ softnic_tmgr_port_create(struct pmd_internals *p, return NULL; } + status = rte_sched_subport_profile_config(sched, + subport_id, t->subport_to_profile[subport_id]); + if (status) { + rte_sched_port_free(sched); + return NULL; + } + /* Pipe */ for (pipe_id = 0; pipe_id < n_pipes_per_subport; pipe_id++) { int pos = subport_id * TM_MAX_PIPES_PER_SUBPORT + pipe_id; @@ -1043,6 +1050,25 @@ tm_shared_shaper_get_tc(struct rte_eth_dev *dev, } static int +subport_profile_exists(struct rte_eth_dev *dev, + struct rte_sched_subport_profile_params *sp, + uint32_t *subport_profile_id) +{ + struct pmd_internals *p = dev->data->dev_private; + struct tm_params *t = &p->soft.tm.params; + uint32_t i; + + for (i = 0; i < t->n_subport_profiles; i++) + if (memcmp(&t->subport_profiles[i], sp, sizeof(*sp)) == 0) { + if (subport_profile_id) + *subport_profile_id = i; + return 1; + } + + return 0; +} + +static int update_subport_tc_rate(struct rte_eth_dev *dev, struct tm_node *nt, struct tm_shared_shaper *ss, @@ -1050,26 +1076,27 @@ update_subport_tc_rate(struct rte_eth_dev *dev, { struct pmd_internals *p = dev->data->dev_private; uint32_t tc_id = tm_node_tc_id(dev, nt); - struct tm_node *np = nt->parent_node; - struct tm_node *ns = np->parent_node; uint32_t subport_id = tm_node_subport_id(dev, ns); - - struct rte_sched_subport_params subport_params; - + struct rte_sched_subport_profile_params subport_profile; struct tm_shaper_profile *sp_old = tm_shaper_profile_search(dev, ss->shaper_profile_id); + uint32_t subport_profile_id; /* Derive new subport configuration. */ - memcpy(&subport_params, - &p->soft.tm.params.subport_params[subport_id], - sizeof(subport_params)); - subport_params.tc_rate[tc_id] = sp_new->params.peak.rate; + memcpy(&subport_profile, + &p->soft.tm.params.subport_profiles[subport_id], + sizeof(subport_profile)); + subport_profile.tc_rate[tc_id] = sp_new->params.peak.rate; + + if (subport_profile_exists(dev, &subport_profile, + &subport_profile_id) == 0) + return -1; /* Update the subport configuration. */ - if (rte_sched_subport_config(SCHED(p), - subport_id, &subport_params)) + if (rte_sched_subport_profile_config(SCHED(p), + subport_id, subport_profile_id)) return -1; /* Commit changes. */ @@ -1078,9 +1105,9 @@ update_subport_tc_rate(struct rte_eth_dev *dev, ss->shaper_profile_id = sp_new->shaper_profile_id; sp_new->n_users++; - memcpy(&p->soft.tm.params.subport_params[subport_id], - &subport_params, - sizeof(subport_params)); + memcpy(&p->soft.tm.params.subport_profiles[subport_id], + &subport_profile, + sizeof(subport_profile)); return 0; } @@ -2190,6 +2217,108 @@ pipe_profiles_generate(struct rte_eth_dev *dev) return 0; } +static struct rte_sched_subport_profile_params * +subport_profile_get(struct rte_eth_dev *dev, struct tm_node *np) +{ + struct pmd_internals *p = dev->data->dev_private; + struct tm_params *t = &p->soft.tm.params; + uint32_t subport_id = tm_node_subport_id(dev, np->parent_node); + + return &t->subport_profiles[subport_id]; +} + +static void +subport_profile_mark(struct rte_eth_dev *dev, + uint32_t subport_id, + uint32_t subport_profile_id) +{ + struct pmd_internals *p = dev->data->dev_private; + struct tm_params *t = &p->soft.tm.params; + + t->subport_to_profile[subport_id] = subport_profile_id; +} + +static void +subport_profile_install(struct rte_eth_dev *dev, + struct rte_sched_subport_profile_params *sp, + uint32_t subport_profile_id) +{ + struct pmd_internals *p = dev->data->dev_private; + struct tm_params *t = &p->soft.tm.params; + + memcpy(&t->subport_profiles[subport_profile_id], sp, sizeof(*sp)); + t->n_subport_profiles++; +} + +static int +subport_profile_free_exists(struct rte_eth_dev *dev, + uint32_t *subport_profile_id) +{ + struct pmd_internals *p = dev->data->dev_private; + struct tm_params *t = &p->soft.tm.params; + + if (t->n_subport_profiles < TM_MAX_SUBPORT_PROFILE) { + *subport_profile_id = t->n_subport_profiles; + return 1; + } + + return 0; +} + +static void +subport_profile_build(struct tm_node *np, + struct rte_sched_subport_profile_params *sp) +{ + memset(sp, 0, sizeof(*sp)); + + /* Pipe */ + sp->tb_rate = np->shaper_profile->params.peak.rate; + sp->tb_size = np->shaper_profile->params.peak.size; + + /* Traffic Class (TC) */ + sp->tc_period = SUBPORT_TC_PERIOD; +} + +static int +subport_profiles_generate(struct rte_eth_dev *dev) +{ + struct pmd_internals *p = dev->data->dev_private; + struct tm_hierarchy *h = &p->soft.tm.h; + struct tm_node_list *nl = &h->nodes; + struct tm_node *ns; + uint32_t subport_id; + + /* Objective: Fill in the following fields in struct tm_params: + * - subport_profiles + * - n_subport_profiles + * - subport_to_profile + */ + + subport_id = 0; + TAILQ_FOREACH(ns, nl, node) { + if (ns->level != TM_NODE_LEVEL_SUBPORT) + continue; + + struct rte_sched_subport_profile_params sp; + uint32_t pos; + + subport_profile_build(ns, &sp); + + if (!subport_profile_exists(dev, &sp, &pos)) { + if (!subport_profile_free_exists(dev, &pos)) + return -1; + + subport_profile_install(dev, &sp, pos); + } + + subport_profile_mark(dev, subport_id, pos); + + subport_id++; + } + + return 0; +} + static struct tm_wred_profile * tm_tc_wred_profile_get(struct rte_eth_dev *dev, uint32_t tc_id) { @@ -2447,6 +2576,15 @@ hierarchy_commit_check(struct rte_eth_dev *dev, struct rte_tm_error *error) rte_strerror(EINVAL)); } + /* Not too many subport profiles. */ + if (subport_profiles_generate(dev)) + return -rte_tm_error_set(error, + EINVAL, + RTE_TM_ERROR_TYPE_UNSPECIFIED, + NULL, + rte_strerror(EINVAL)); + + /* Not too many pipe profiles. */ if (pipe_profiles_generate(dev)) return -rte_tm_error_set(error, @@ -2528,6 +2666,8 @@ hierarchy_blueprints_create(struct rte_eth_dev *dev) .frame_overhead = root->shaper_profile->params.pkt_length_adjust, .n_subports_per_port = root->n_children, + .n_subport_profiles = t->n_subport_profiles, + .subport_profiles = t->subport_profiles, .n_pipes_per_subport = TM_MAX_PIPES_PER_SUBPORT, }; @@ -2548,28 +2688,11 @@ hierarchy_blueprints_create(struct rte_eth_dev *dev) ss->shaper_profile_id) : n->shaper_profile; tc_rate[i] = sp->params.peak.rate; + t->subport_profiles[subport_id].tc_rate[i] = tc_rate[i]; } t->subport_params[subport_id] = (struct rte_sched_subport_params) { - .tb_rate = n->shaper_profile->params.peak.rate, - .tb_size = n->shaper_profile->params.peak.size, - - .tc_rate = {tc_rate[0], - tc_rate[1], - tc_rate[2], - tc_rate[3], - tc_rate[4], - tc_rate[5], - tc_rate[6], - tc_rate[7], - tc_rate[8], - tc_rate[9], - tc_rate[10], - tc_rate[11], - tc_rate[12], - }, - .tc_period = SUBPORT_TC_PERIOD, .n_pipes_per_subport_enabled = h->n_tm_nodes[TM_NODE_LEVEL_PIPE] / h->n_tm_nodes[TM_NODE_LEVEL_SUBPORT], @@ -2829,30 +2952,39 @@ update_subport_rate(struct rte_eth_dev *dev, struct pmd_internals *p = dev->data->dev_private; uint32_t subport_id = tm_node_subport_id(dev, ns); - struct rte_sched_subport_params subport_params; + struct rte_sched_subport_profile_params *profile0 = + subport_profile_get(dev, ns); + struct rte_sched_subport_profile_params profile1; + uint32_t subport_profile_id; - /* Derive new subport configuration. */ - memcpy(&subport_params, - &p->soft.tm.params.subport_params[subport_id], - sizeof(subport_params)); - subport_params.tb_rate = sp->params.peak.rate; - subport_params.tb_size = sp->params.peak.size; + /* Derive new pipe profile. */ + memcpy(&profile1, profile0, sizeof(profile1)); + profile1.tb_rate = sp->params.peak.rate; + profile1.tb_size = sp->params.peak.size; + + /* Since implementation does not allow adding more subport profiles + * after port configuration, the pipe configuration can be successfully + * updated only if the new profile is also part of the existing set of + * pipe profiles. + */ + if (subport_profile_exists(dev, &profile1, &subport_profile_id) == 0) + return -1; /* Update the subport configuration. */ - if (rte_sched_subport_config(SCHED(p), subport_id, - &subport_params)) + if (rte_sched_subport_profile_config(SCHED(p), subport_id, + subport_profile_id)) return -1; + subport_profile_mark(dev, subport_id, subport_profile_id); /* Commit changes. */ ns->shaper_profile->n_users--; - ns->shaper_profile = sp; ns->params.shaper_profile_id = sp->shaper_profile_id; sp->n_users++; - memcpy(&p->soft.tm.params.subport_params[subport_id], - &subport_params, - sizeof(subport_params)); + memcpy(&p->soft.tm.params.subport_profiles[subport_id], + &profile1, + sizeof(profile1)); return 0; } From patchwork Wed Sep 2 09:07:11 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Savinay Dharmappa X-Patchwork-Id: 76304 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 675C2A04B7; Wed, 2 Sep 2020 11:07:32 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id B18831C0AC; Wed, 2 Sep 2020 11:07:25 +0200 (CEST) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 37D484C99 for ; Wed, 2 Sep 2020 11:07:23 +0200 (CEST) IronPort-SDR: ivt82F8evfzI9a1leF1+x6G85352j5JR9xD10sqKTqi61GU1q6CLZRejqdf/xrvCrQ7s3zR6hI okuX+pg7Czug== X-IronPort-AV: E=McAfee;i="6000,8403,9731"; a="154857643" X-IronPort-AV: E=Sophos;i="5.76,381,1592895600"; d="scan'208";a="154857643" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Sep 2020 02:07:22 -0700 IronPort-SDR: mQfE+4Ux3P4HkUNOqLVtBnXka1R9on/mqc14djEoKdMj4oKMpvb4XAsZygkGAT31/505DJmXkn tD7DS9verImQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.76,381,1592895600"; d="scan'208";a="301757201" Received: from unknown (HELO silpixa00400629.ir.intel.com) ([10.237.214.135]) by orsmga006.jf.intel.com with ESMTP; 02 Sep 2020 02:07:21 -0700 From: Savinay Dharmappa To: cristian.dumitrescu@intel.com, jasvinder.singh@intel.com, dev@dpdk.org Cc: savinay.dharmappa@intel.com Date: Wed, 2 Sep 2020 10:07:11 +0100 Message-Id: <1599037631-199836-4-git-send-email-savinay.dharmappa@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1599037631-199836-1-git-send-email-savinay.dharmappa@intel.com> References: <1594837677-313175-3-git-send-email-savinay.dharmappa@intel.com> <1599037631-199836-1-git-send-email-savinay.dharmappa@intel.com> Subject: [dpdk-dev] [PATCH v1 4/4] app/test_sched: subport bandwidth profile config X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" test_sched application uses the new apis introduced as part of dynamic configuration of subport bandwidth to configure the deafult subport bandwidth profile while buidling the hirerachical scheduler Signed-off-by: Savinay Dharmappa --- app/test/test_sched.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/app/test/test_sched.c b/app/test/test_sched.c index fc31080..99d7f87 100644 --- a/app/test/test_sched.c +++ b/app/test/test_sched.c @@ -36,15 +36,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 +64,8 @@ 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_pipes_per_subport = 1024, }; @@ -66,6 +73,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 +149,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);