From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 96BB8A04B5; Wed, 30 Sep 2020 21:27:53 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 3D03A1D5B7; Wed, 30 Sep 2020 21:26:17 +0200 (CEST) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by dpdk.org (Postfix) with ESMTP id D3A531D43F for ; Wed, 30 Sep 2020 21:25:59 +0200 (CEST) IronPort-SDR: 1jlZ/C5I4rkGnO2xbdXRicLSFYIhMIf9cuffgHZ5HPhsC9l8x3ANCX47qHsqux1ZNT9RFp562T RvmEaN91o6rA== X-IronPort-AV: E=McAfee;i="6000,8403,9760"; a="141933443" X-IronPort-AV: E=Sophos;i="5.77,322,1596524400"; d="scan'208";a="141933443" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Sep 2020 12:25:59 -0700 IronPort-SDR: TCKCr87hnSKhdtEA22bT6QKerH5noxITKvXEiqXQbQlQ68w37LQJMOtHjWs7jjnhH8ENY6BMyB WxVjiUGia4cQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.77,322,1596524400"; d="scan'208";a="308273018" Received: from silpixa00400629.ir.intel.com ([10.237.214.112]) by orsmga003.jf.intel.com with ESMTP; 30 Sep 2020 12:25:57 -0700 From: Savinay Dharmappa To: cristian.dumitrescu@intel.com, jasvinder.singh@intel.com, dev@dpdk.org Cc: savinay.dharmappa@intel.com Date: Wed, 30 Sep 2020 20:24:31 +0100 Message-Id: <20200930192434.47793-7-savinay.dharmappa@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200930192434.47793-1-savinay.dharmappa@intel.com> References: <1600332159-26018-1-git-send-email-savinay.dharmappa@intel.com> <20200930192434.47793-1-savinay.dharmappa@intel.com> Subject: [dpdk-dev] [PATCH v5 6/9] example/ip_pipeline: add dynamic config of subport 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" Modify the ip_pipeline 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 --- examples/ip_pipeline/cli.c | 17 +++++------ examples/ip_pipeline/tmgr.c | 57 ++++++++++++++++++++++++------------- examples/ip_pipeline/tmgr.h | 7 ++++- 3 files changed, 52 insertions(+), 29 deletions(-) diff --git a/examples/ip_pipeline/cli.c b/examples/ip_pipeline/cli.c index dafc95ae9..b4d95bb1d 100644 --- a/examples/ip_pipeline/cli.c +++ b/examples/ip_pipeline/cli.c @@ -406,7 +406,7 @@ cmd_tmgr_subport_profile(char **tokens, char *out, size_t out_size) { - struct rte_sched_subport_params p; + struct tmgr_subport sp; int status, i; if (n_tokens != 35) { @@ -414,23 +414,23 @@ cmd_tmgr_subport_profile(char **tokens, return; } - if (parser_read_uint64(&p.tb_rate, tokens[3]) != 0) { + if (parser_read_uint64(&sp.pp.tb_rate, tokens[3]) != 0) { snprintf(out, out_size, MSG_ARG_INVALID, "tb_rate"); return; } - if (parser_read_uint64(&p.tb_size, tokens[4]) != 0) { + if (parser_read_uint64(&sp.pp.tb_size, tokens[4]) != 0) { snprintf(out, out_size, MSG_ARG_INVALID, "tb_size"); return; } for (i = 0; i < RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE; i++) - if (parser_read_uint64(&p.tc_rate[i], tokens[5 + i]) != 0) { + if (parser_read_uint64(&sp.pp.tc_rate[i], tokens[5 + i]) != 0) { snprintf(out, out_size, MSG_ARG_INVALID, "tc_rate"); return; } - if (parser_read_uint64(&p.tc_period, tokens[18]) != 0) { + if (parser_read_uint64(&sp.pp.tc_period, tokens[18]) != 0) { snprintf(out, out_size, MSG_ARG_INVALID, "tc_period"); return; } @@ -440,7 +440,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(&sp.p.n_pipes_per_subport_enabled, + tokens[20]) != 0) { snprintf(out, out_size, MSG_ARG_INVALID, "n_pipes_per_subport"); return; } @@ -451,12 +452,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(&sp.p.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(&sp); 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 91ccbf60f..446df8fe2 100644 --- a/examples/ip_pipeline/tmgr.c +++ b/examples/ip_pipeline/tmgr.c @@ -8,8 +8,15 @@ #include "tmgr.h" -static struct rte_sched_subport_params - subport_profile[TMGR_SUBPORT_PROFILE_MAX]; +struct subport_profile_params { + struct rte_sched_subport_params + params[TMGR_SUBPORT_PROFILE_MAX]; + + struct rte_sched_subport_profile_params + profile[TMGR_SUBPORT_PROFILE_MAX]; +}; + +static struct subport_profile_params subport_profile; static uint32_t n_subport_profiles; @@ -44,17 +51,21 @@ tmgr_port_find(const char *name) } int -tmgr_subport_profile_add(struct rte_sched_subport_params *p) +tmgr_subport_profile_add(struct tmgr_subport *params) { /* Check input params */ - if (p == NULL || - p->n_pipes_per_subport_enabled == 0) + if (params == NULL || + params->p.n_pipes_per_subport_enabled == 0) return -1; /* Save profile */ - memcpy(&subport_profile[n_subport_profiles], - p, - sizeof(*p)); + memcpy(&subport_profile.params[n_subport_profiles], + ¶ms->p, + sizeof(params->p)); + + memcpy(&subport_profile.profile[n_subport_profiles], + ¶ms->pp, + sizeof(params->pp)); n_subport_profiles++; @@ -103,30 +114,35 @@ 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 = subport_profile.profile; + p.n_max_subport_profiles = TMGR_SUBPORT_PROFILE_MAX; p.n_pipes_per_subport = TMGR_PIPE_SUBPORT_MAX; s = rte_sched_port_config(&p); if (s == NULL) return NULL; - subport_profile[0].pipe_profiles = pipe_profile; - subport_profile[0].n_pipe_profiles = n_pipe_profiles; - subport_profile[0].n_max_pipe_profiles = TMGR_PIPE_PROFILE_MAX; + subport_profile.params[0].pipe_profiles = pipe_profile; + subport_profile.params[0].n_pipe_profiles = n_pipe_profiles; + subport_profile.params[0].n_max_pipe_profiles = TMGR_PIPE_PROFILE_MAX; for (i = 0; i < params->n_subports_per_port; i++) { int status; - status = rte_sched_subport_config( + status = rte_dynamic_sched_subport_config( s, i, - &subport_profile[0]); + &subport_profile.params[0], 0); if (status) { rte_sched_port_free(s); return NULL; } - for (j = 0; j < subport_profile[0].n_pipes_per_subport_enabled; j++) { + for (j = 0; j < + subport_profile.params[0].n_pipes_per_subport_enabled; j++) { + status = rte_sched_pipe_config( s, i, @@ -177,10 +193,11 @@ tmgr_subport_config(const char *port_name, return -1; /* Resource config */ - status = rte_sched_subport_config( + status = rte_dynamic_sched_subport_config( port->s, subport_id, - &subport_profile[subport_profile_id]); + NULL, + subport_profile_id); return status; } @@ -203,10 +220,10 @@ tmgr_pipe_config(const char *port_name, if ((port == NULL) || (subport_id >= port->n_subports_per_port) || (pipe_id_first >= - subport_profile[subport_id].n_pipes_per_subport_enabled) || - (pipe_id_last >= - subport_profile[subport_id].n_pipes_per_subport_enabled) || - (pipe_id_first > pipe_id_last) || + subport_profile.params[subport_id].n_pipes_per_subport_enabled) + || (pipe_id_last >= + subport_profile.params[subport_id].n_pipes_per_subport_enabled) + || (pipe_id_first > pipe_id_last) || (pipe_profile_id >= n_pipe_profiles)) return -1; diff --git a/examples/ip_pipeline/tmgr.h b/examples/ip_pipeline/tmgr.h index ee50cf7cc..b651ede4a 100644 --- a/examples/ip_pipeline/tmgr.h +++ b/examples/ip_pipeline/tmgr.h @@ -31,6 +31,11 @@ struct tmgr_port { uint32_t n_subports_per_port; }; +struct tmgr_subport { + struct rte_sched_subport_params p; + struct rte_sched_subport_profile_params pp; +}; + TAILQ_HEAD(tmgr_port_list, tmgr_port); int @@ -48,7 +53,7 @@ struct tmgr_port_params { }; int -tmgr_subport_profile_add(struct rte_sched_subport_params *p); +tmgr_subport_profile_add(struct tmgr_subport *sp); int tmgr_pipe_profile_add(struct rte_sched_pipe_params *p); -- 2.17.1