From patchwork Wed Sep 16 16:43:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Savinay Dharmappa X-Patchwork-Id: 77922 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 5BD56A04B5; Wed, 16 Sep 2020 18:46:45 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id CBCBC1D412; Wed, 16 Sep 2020 18:45:12 +0200 (CEST) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id 46BF11D182 for ; Wed, 16 Sep 2020 18:44:54 +0200 (CEST) IronPort-SDR: uxksagQife+nRa2LebvLOGuiG7CPXxrWHJ8mSck23jq+QOIicsJ2H5T2R1zUH/nXqXJRP6xbi0 ULg3Jd6kZ1Kg== X-IronPort-AV: E=McAfee;i="6000,8403,9746"; a="221069968" X-IronPort-AV: E=Sophos;i="5.76,433,1592895600"; d="scan'208";a="221069968" 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:46 -0700 IronPort-SDR: ZWKSKvSkRWipwTp4ItpZIUJ8TZPFBrZNusKsbHkgzhaMPCICz5/11+6pszppmFZkt2RFBhZjpf ZOkIy2JnDHNQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.76,433,1592895600"; d="scan'208";a="451925170" Received: from silpixa00400629.ir.intel.com ([10.237.214.135]) by orsmga004.jf.intel.com with ESMTP; 16 Sep 2020 09:44:45 -0700 From: Savinay Dharmappa To: jasvinder.singh@intel.com, cristian.dumitrescu@intel.com, dev@dpdk.org Cc: savinay.dharmappa@intel.com Date: Wed, 16 Sep 2020 17:43:50 +0100 Message-Id: <1600274633-371993-7-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 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 | 14 ++++++++------ examples/ip_pipeline/tmgr.c | 26 ++++++++++++++++++++++++-- examples/ip_pipeline/tmgr.h | 3 ++- 3 files changed, 34 insertions(+), 9 deletions(-) diff --git a/examples/ip_pipeline/cli.c b/examples/ip_pipeline/cli.c index d79699e..7eccde3 100644 --- a/examples/ip_pipeline/cli.c +++ b/examples/ip_pipeline/cli.c @@ -407,6 +407,7 @@ cmd_tmgr_subport_profile(char **tokens, size_t out_size) { struct rte_sched_subport_params p; + struct rte_sched_subport_profile_params pp; int status, i; if (n_tokens != 35) { @@ -414,23 +415,23 @@ cmd_tmgr_subport_profile(char **tokens, return; } - if (parser_read_uint64(&p.tb_rate, tokens[3]) != 0) { + if (parser_read_uint64(&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(&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(&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(&pp.tc_period, tokens[18]) != 0) { snprintf(out, out_size, MSG_ARG_INVALID, "tc_period"); return; } @@ -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(&p.n_pipes_per_subport_enabled, + tokens[20]) != 0) { snprintf(out, out_size, MSG_ARG_INVALID, "n_pipes_per_subport"); return; } @@ -456,7 +458,7 @@ cmd_tmgr_subport_profile(char **tokens, return; } - status = tmgr_subport_profile_add(&p); + status = tmgr_subport_profile_add(&p, &pp); 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..5c3df92 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,10 +47,11 @@ 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_params *p, + struct rte_sched_subport_profile_params *pp) { /* Check input params */ - if (p == NULL || + if (p == NULL || pp == NULL || p->n_pipes_per_subport_enabled == 0) return -1; @@ -56,6 +60,10 @@ tmgr_subport_profile_add(struct rte_sched_subport_params *p) p, sizeof(*p)); + memcpy(&profile_params[n_subport_profiles], + pp, + sizeof(*pp)); + n_subport_profiles++; return 0; @@ -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..8c14523 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_params *p, + struct rte_sched_subport_profile_params *pp); int tmgr_pipe_profile_add(struct rte_sched_pipe_params *p);