From patchwork Wed Sep 2 08:56:43 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Savinay Dharmappa X-Patchwork-Id: 76298 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 210BBA04B7; Wed, 2 Sep 2020 10:58:19 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id B53F21C066; Wed, 2 Sep 2020 10:58:18 +0200 (CEST) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 94AEC4C99 for ; Wed, 2 Sep 2020 10:58:16 +0200 (CEST) IronPort-SDR: SiAI7bK/oCNh7xkXLAtjw0ACluYgBGeLCMR4WQPbrdVOIVuR5C56/s3K2CHIpsOVu6LvQ+3qMP T0QOhsIkkQhA== X-IronPort-AV: E=McAfee;i="6000,8403,9731"; a="158346005" X-IronPort-AV: E=Sophos;i="5.76,381,1592895600"; d="scan'208";a="158346005" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Sep 2020 01:58:14 -0700 IronPort-SDR: tCvPih42+tyA8QbUW0tqlLjxPT50ok+OsrghTed7Ux2tsHTIQ0UkoOiA46tv2yAEmu0Ldxa5jb sTyXtF6EAOug== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.76,381,1592895600"; d="scan'208";a="477557326" Received: from unknown (HELO silpixa00400629.ir.intel.com) ([10.237.214.135]) by orsmga005.jf.intel.com with ESMTP; 02 Sep 2020 01:58:11 -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 09:56:43 +0100 Message-Id: <1599037006-3931-1-git-send-email-savinay.dharmappa@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1594837677-313175-2-git-send-email-savinay.dharmappa@intel.com> References: <1594837677-313175-2-git-send-email-savinay.dharmappa@intel.com> Subject: [dpdk-dev] [PATCH v1 1/4] sched: add dynamic config of subport bandwidth profile 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" This patch modifies the subport level data structures and add internal functions to create subport profile table. Signed-off-by: Savinay Dharmappa Signed-off-by: Jasvinder Singh --- lib/librte_sched/rte_sched.c | 173 +++++++++++++++++++++++++++++++++++++++---- lib/librte_sched/rte_sched.h | 37 ++++++--- 2 files changed, 185 insertions(+), 25 deletions(-) diff --git a/lib/librte_sched/rte_sched.c b/lib/librte_sched/rte_sched.c index c0983dd..c82e09c 100644 --- a/lib/librte_sched/rte_sched.c +++ b/lib/librte_sched/rte_sched.c @@ -2,6 +2,7 @@ * Copyright(c) 2010-2014 Intel Corporation */ +#include #include #include @@ -101,6 +102,16 @@ enum grinder_state { e_GRINDER_READ_MBUF }; +struct rte_sched_subport_profile { + /* Token bucket (TB) */ + uint64_t tb_period; + uint64_t tb_credits_per_period; + uint64_t tb_size; + + uint64_t tc_credits_per_period[RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE]; + uint64_t tc_period; +}; + struct rte_sched_grinder { /* Pipe cache */ uint16_t pcache_qmask[RTE_SCHED_GRINDER_PCACHE_SIZE]; @@ -139,18 +150,13 @@ struct rte_sched_grinder { }; struct rte_sched_subport { - /* Token bucket (TB) */ + uint64_t tb_time; /* time of last update */ - uint64_t tb_period; - uint64_t tb_credits_per_period; - uint64_t tb_size; uint64_t tb_credits; /* Traffic classes (TCs) */ uint64_t tc_time; /* time of next update */ - uint64_t tc_credits_per_period[RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE]; uint64_t tc_credits[RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE]; - uint64_t tc_period; /* TC oversubscription */ uint64_t tc_ov_wm; @@ -164,6 +170,8 @@ struct rte_sched_subport { /* Statistics */ struct rte_sched_subport_stats stats __rte_cache_aligned; + /* subport profile flag */ + uint32_t profile; /* Subport pipes */ uint32_t n_pipes_per_subport_enabled; uint32_t n_pipe_profiles; @@ -212,6 +220,8 @@ struct rte_sched_port { uint16_t pipe_queue[RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE]; uint8_t pipe_tc[RTE_SCHED_QUEUES_PER_PIPE]; uint8_t tc_queue[RTE_SCHED_QUEUES_PER_PIPE]; + uint32_t n_subport_profiles; + uint32_t n_max_subport_profiles; uint64_t rate; uint32_t mtu; uint32_t frame_overhead; @@ -229,6 +239,7 @@ struct rte_sched_port { uint32_t subport_id; /* Large data structures */ + struct rte_sched_subport_profile *subport_profiles; struct rte_sched_subport *subports[0] __rte_cache_aligned; } __rte_cache_aligned; @@ -375,6 +386,56 @@ pipe_profile_check(struct rte_sched_pipe_params *params, } static int +subport_profile_check(struct rte_sched_subport_profile_params *params, + uint64_t rate) +{ + uint32_t i; + + /* Check user parameters */ + if (params == NULL) { + RTE_LOG(ERR, SCHED, + "%s: Incorrect value for parameter params\n", __func__); + return -EINVAL; + } + + if (params->tb_rate == 0 || params->tb_rate > rate) { + RTE_LOG(ERR, SCHED, + "%s: Incorrect value for tb rate\n", __func__); + return -EINVAL; + } + + if (params->tb_size == 0) { + RTE_LOG(ERR, SCHED, + "%s: Incorrect value for tb size\n", __func__); + return -EINVAL; + } + + for (i = 0; i < RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE; i++) { + uint64_t tc_rate = params->tc_rate[i]; + + if (tc_rate == 0 || (tc_rate > params->tb_rate)) { + RTE_LOG(ERR, SCHED, + "%s: Incorrect value for tc rate\n", __func__); + return -EINVAL; + } + } + + if (params->tc_rate[RTE_SCHED_TRAFFIC_CLASS_BE] == 0) { + RTE_LOG(ERR, SCHED, + "%s: Incorrect tc rate(best effort)\n", __func__); + return -EINVAL; + } + + if (params->tc_period == 0) { + RTE_LOG(ERR, SCHED, + "%s: Incorrect value for tc period\n", __func__); + return -EINVAL; + } + + return 0; +} + +static int rte_sched_port_check_params(struct rte_sched_port_params *params) { if (params == NULL) { @@ -517,13 +578,14 @@ rte_sched_port_log_pipe_profile(struct rte_sched_subport *subport, uint32_t i) struct rte_sched_pipe_profile *p = subport->pipe_profiles + i; RTE_LOG(DEBUG, SCHED, "Low level config for pipe profile %u:\n" - " Token bucket: period = %"PRIu64", credits per period = %"PRIu64", size = %"PRIu64"\n" - " Traffic classes: period = %"PRIu64",\n" - " credits per period = [%"PRIu64", %"PRIu64", %"PRIu64", %"PRIu64 - ", %"PRIu64", %"PRIu64", %"PRIu64", %"PRIu64", %"PRIu64", %"PRIu64 - ", %"PRIu64", %"PRIu64", %"PRIu64"]\n" - " Best-effort traffic class oversubscription: weight = %hhu\n" - " WRR cost: [%hhu, %hhu, %hhu, %hhu]\n", + "Token bucket: period = %"PRIu64", credits per period = %"PRIu64"" + " size = %"PRIu64",\n" + " Traffic classes: period = %"PRIu64",\n" + " credits per period = [%"PRIu64", %"PRIu64", %"PRIu64", %"PRIu64"" + ", %"PRIu64", %"PRIu64", %"PRIu64", %"PRIu64", %"PRIu64", %"PRIu64"" + ", %"PRIu64", %"PRIu64", %"PRIu64"]\n" + " Best-effort traffic class oversubscription: weight = %hhu\n" + " WRR cost: [%hhu, %hhu, %hhu, %hhu]\n", i, /* Token bucket */ @@ -554,6 +616,42 @@ rte_sched_port_log_pipe_profile(struct rte_sched_subport *subport, uint32_t i) p->wrr_cost[0], p->wrr_cost[1], p->wrr_cost[2], p->wrr_cost[3]); } +static void +rte_sched_port_log_subport_profile(struct rte_sched_port *port, uint32_t i) +{ + struct rte_sched_subport_profile *p = port->subport_profiles + i; + + RTE_LOG(DEBUG, SCHED, "Low level config for subport profile %u:\n" + "Token bucket: period = %"PRIu64", credits per period = %"PRIu64",\ + size = %"PRIu64"\n" + "Traffic classes: period = %"PRIu64",\n" + "credits per period = [%"PRIu64", %"PRIu64", %"PRIu64", %"PRIu64 + " %"PRIu64", %"PRIu64", %"PRIu64", %"PRIu64", %"PRIu64", %"PRIu64 + " %"PRIu64", %"PRIu64", %"PRIu64"]\n", + i, + + /* Token bucket */ + p->tb_period, + p->tb_credits_per_period, + p->tb_size, + + /* Traffic classes */ + p->tc_period, + p->tc_credits_per_period[0], + p->tc_credits_per_period[1], + p->tc_credits_per_period[2], + p->tc_credits_per_period[3], + p->tc_credits_per_period[4], + p->tc_credits_per_period[5], + p->tc_credits_per_period[6], + p->tc_credits_per_period[7], + p->tc_credits_per_period[8], + p->tc_credits_per_period[9], + p->tc_credits_per_period[10], + p->tc_credits_per_period[11], + p->tc_credits_per_period[12]); +} + static inline uint64_t rte_sched_time_ms_to_bytes(uint64_t time_ms, uint64_t rate) { @@ -623,6 +721,37 @@ rte_sched_pipe_profile_convert(struct rte_sched_subport *subport, } static void +rte_sched_subport_profile_convert(struct rte_sched_subport_profile_params *src, + struct rte_sched_subport_profile *dst, + uint64_t rate) +{ + uint32_t i; + + /* Token Bucket */ + if (src->tb_rate == rate) { + dst->tb_credits_per_period = 1; + dst->tb_period = 1; + } else { + double tb_rate = (double) src->tb_rate + / (double) rate; + double d = RTE_SCHED_TB_RATE_CONFIG_ERR; + + rte_approx_64(tb_rate, d, &dst->tb_credits_per_period, + &dst->tb_period); + } + + dst->tb_size = src->tb_size; + + /* Traffic Classes */ + dst->tc_period = rte_sched_time_ms_to_bytes(src->tc_period, rate); + + for (i = 0; i < RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE; i++) + dst->tc_credits_per_period[i] + = rte_sched_time_ms_to_bytes(src->tc_period, + src->tc_rate[i]); +} + +static void rte_sched_subport_config_pipe_profile_table(struct rte_sched_subport *subport, struct rte_sched_subport_params *params, uint32_t rate) { @@ -646,6 +775,24 @@ rte_sched_subport_config_pipe_profile_table(struct rte_sched_subport *subport, } } +static void +rte_sched_port_config_subport_profile_table(struct rte_sched_port *port, + struct rte_sched_port_params *params, + uint64_t rate) +{ + uint32_t i; + + for (i = 0; i < port->n_subport_profiles; i++) { + struct rte_sched_subport_profile_params *src + = params->subport_profiles + i; + struct rte_sched_subport_profile *dst + = port->subport_profiles + i; + + rte_sched_subport_profile_convert(src, dst, rate); + rte_sched_port_log_subport_profile(port, i); + } +} + static int rte_sched_subport_check_params(struct rte_sched_subport_params *params, uint32_t n_max_pipes_per_subport, diff --git a/lib/librte_sched/rte_sched.h b/lib/librte_sched/rte_sched.h index 8a5a93c..e7514bb 100644 --- a/lib/librte_sched/rte_sched.h +++ b/lib/librte_sched/rte_sched.h @@ -149,18 +149,6 @@ struct rte_sched_pipe_params { * byte. */ struct rte_sched_subport_params { - /** Token bucket rate (measured in bytes per second) */ - uint64_t tb_rate; - - /** Token bucket size (measured in credits) */ - uint64_t tb_size; - - /** Traffic class rates (measured in bytes per second) */ - uint64_t tc_rate[RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE]; - - /** Enforcement period for rates (measured in milliseconds) */ - uint64_t tc_period; - /** Number of subport pipes. * The subport can enable/allocate fewer pipes than the maximum * number set through struct port_params::n_max_pipes_per_subport, @@ -192,6 +180,20 @@ struct rte_sched_subport_params { #endif }; +struct rte_sched_subport_profile_params { + /** Token bucket rate (measured in bytes per second) */ + uint64_t tb_rate; + + /** Token bucket size (measured in credits) */ + uint64_t tb_size; + + /** Traffic class rates (measured in bytes per second) */ + uint64_t tc_rate[RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE]; + + /** Enforcement period for rates (measured in milliseconds) */ + uint64_t tc_period; +}; + /** Subport statistics */ struct rte_sched_subport_stats { /** Number of packets successfully written */ @@ -254,6 +256,17 @@ struct rte_sched_port_params { /** Number of subports */ uint32_t n_subports_per_port; + /** subport profile table. + * Every pipe is configured using one of the profiles from this table. + */ + struct rte_sched_subport_profile_params *subport_profiles; + + /** Profiles in the pipe profile table */ + uint32_t n_subport_profiles; + + /** Max allowed profiles in the pipe profile table */ + uint32_t n_max_subport_profiles; + /** Maximum number of subport pipes. * This parameter is used to reserve a fixed number of bits * in struct rte_mbuf::sched.queue_id for the pipe_id for all From patchwork Wed Sep 2 08:56:44 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Savinay Dharmappa X-Patchwork-Id: 76299 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 82610A04B7; Wed, 2 Sep 2020 10:58:31 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 6371F1C0B0; Wed, 2 Sep 2020 10:58:31 +0200 (CEST) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id 5288A1C0AC for ; Wed, 2 Sep 2020 10:58:29 +0200 (CEST) IronPort-SDR: R5PEeT7c4mkimhgxNjMFhZXuPZBpYcTtU0MAMfLGsHIAPSuS1S8GV8XNVy+7epTYr1W9aVj3y/ 1/Gol0OvGmkg== X-IronPort-AV: E=McAfee;i="6000,8403,9731"; a="242173513" X-IronPort-AV: E=Sophos;i="5.76,381,1592895600"; d="scan'208";a="242173513" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Sep 2020 01:58:25 -0700 IronPort-SDR: RSW7MVc7S7zdXG4SXzzwwMX9JJEvc+NL7qXZskWbL/8tbuYhk38rNCRwod/8AFfi/0KFBwNTEW 1tblPCy+0qpw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.76,381,1592895600"; d="scan'208";a="477557368" Received: from unknown (HELO silpixa00400629.ir.intel.com) ([10.237.214.135]) by orsmga005.jf.intel.com with ESMTP; 02 Sep 2020 01:58:24 -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 09:56:44 +0100 Message-Id: <1599037006-3931-2-git-send-email-savinay.dharmappa@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1599037006-3931-1-git-send-email-savinay.dharmappa@intel.com> References: <1594837677-313175-2-git-send-email-savinay.dharmappa@intel.com> <1599037006-3931-1-git-send-email-savinay.dharmappa@intel.com> Subject: [dpdk-dev] [PATCH v1 2/4] sched: add dynamic config of subport bandwidth profile 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" This patch builds the subport profile table during port configuration. Since the tb_period,tb_size,tc_period, tb_credits_per_period and tc_credits_per_period are updated in subport profile table, references to them are removed from subport configuration. Signed-off-by: Savinay Dharmappa Signed-off-by: Jasvinder Singh --- lib/librte_sched/rte_sched.c | 154 +++++++++++++------------------------------ 1 file changed, 47 insertions(+), 107 deletions(-) diff --git a/lib/librte_sched/rte_sched.c b/lib/librte_sched/rte_sched.c index c82e09c..c1846d0 100644 --- a/lib/librte_sched/rte_sched.c +++ b/lib/librte_sched/rte_sched.c @@ -438,6 +438,8 @@ subport_profile_check(struct rte_sched_subport_profile_params *params, static int rte_sched_port_check_params(struct rte_sched_port_params *params) { + uint32_t i; + if (params == NULL) { RTE_LOG(ERR, SCHED, "%s: Incorrect value for parameter params\n", __func__); @@ -474,6 +476,29 @@ rte_sched_port_check_params(struct rte_sched_port_params *params) return -EINVAL; } + if (params->subport_profiles == NULL || + params->n_subport_profiles == 0 || + params->n_max_subport_profiles == 0 || + params->n_subport_profiles > params->n_max_subport_profiles) { + RTE_LOG(ERR, SCHED, + "%s: Incorrect value for subport profiles\n", __func__); + return -EINVAL; + } + + for (i = 0; i < params->n_subport_profiles; i++) { + struct rte_sched_subport_profile_params *p = + params->subport_profiles + i; + int status; + + status = subport_profile_check(p, params->rate); + if (status != 0) { + RTE_LOG(ERR, SCHED, + "%s: subport profile check failed(%d)\n", + __func__, status); + return -EINVAL; + } + } + /* n_pipes_per_subport: non-zero, power of 2 */ if (params->n_pipes_per_subport == 0 || !rte_is_power_of_2(params->n_pipes_per_subport)) { @@ -807,18 +832,6 @@ rte_sched_subport_check_params(struct rte_sched_subport_params *params, return -EINVAL; } - if (params->tb_rate == 0 || params->tb_rate > rate) { - RTE_LOG(ERR, SCHED, - "%s: Incorrect value for tb rate\n", __func__); - return -EINVAL; - } - - if (params->tb_size == 0) { - RTE_LOG(ERR, SCHED, - "%s: Incorrect value for tb size\n", __func__); - return -EINVAL; - } - /* qsize: if non-zero, power of 2, * no bigger than 32K (due to 16-bit read/write pointers) */ @@ -832,32 +845,12 @@ rte_sched_subport_check_params(struct rte_sched_subport_params *params, } } - for (i = 0; i < RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE; i++) { - uint64_t tc_rate = params->tc_rate[i]; - uint16_t qsize = params->qsize[i]; - - if ((qsize == 0 && tc_rate != 0) || - (qsize != 0 && tc_rate == 0) || - (tc_rate > params->tb_rate)) { - RTE_LOG(ERR, SCHED, - "%s: Incorrect value for tc rate\n", __func__); - return -EINVAL; - } - } - - if (params->qsize[RTE_SCHED_TRAFFIC_CLASS_BE] == 0 || - params->tc_rate[RTE_SCHED_TRAFFIC_CLASS_BE] == 0) { + if (params->qsize[RTE_SCHED_TRAFFIC_CLASS_BE] == 0) { RTE_LOG(ERR, SCHED, "%s: Incorrect qsize or tc rate(best effort)\n", __func__); return -EINVAL; } - if (params->tc_period == 0) { - RTE_LOG(ERR, SCHED, - "%s: Incorrect value for tc period\n", __func__); - return -EINVAL; - } - /* n_pipes_per_subport: non-zero, power of 2 */ if (params->n_pipes_per_subport_enabled == 0 || params->n_pipes_per_subport_enabled > n_max_pipes_per_subport || @@ -939,7 +932,7 @@ struct rte_sched_port * rte_sched_port_config(struct rte_sched_port_params *params) { struct rte_sched_port *port = NULL; - uint32_t size0, size1; + uint32_t size0, size1, size2; uint32_t cycles_per_byte; uint32_t i, j; int status; @@ -954,10 +947,21 @@ rte_sched_port_config(struct rte_sched_port_params *params) size0 = sizeof(struct rte_sched_port); size1 = params->n_subports_per_port * sizeof(struct rte_sched_subport *); + size2 = params->n_max_subport_profiles * + sizeof(struct rte_sched_subport_profile); /* Allocate memory to store the data structures */ - port = rte_zmalloc_socket("qos_params", size0 + size1, RTE_CACHE_LINE_SIZE, - params->socket); + port = rte_zmalloc_socket("qos_params", size0 + size1, + RTE_CACHE_LINE_SIZE, params->socket); + if (port == NULL) { + RTE_LOG(ERR, SCHED, "%s: Memory allocation fails\n", __func__); + + return NULL; + } + + /* Allocate memory to store the subport profile */ + port->subport_profiles = rte_zmalloc_socket("subport_profile", size2, + RTE_CACHE_LINE_SIZE, params->socket); if (port == NULL) { RTE_LOG(ERR, SCHED, "%s: Memory allocation fails\n", __func__); @@ -966,6 +970,8 @@ rte_sched_port_config(struct rte_sched_port_params *params) /* User parameters */ port->n_subports_per_port = params->n_subports_per_port; + port->n_subport_profiles = params->n_subport_profiles; + port->n_max_subport_profiles = params->n_max_subport_profiles; port->n_pipes_per_subport = params->n_pipes_per_subport; port->n_pipes_per_subport_log2 = __builtin_ctz(params->n_pipes_per_subport); @@ -996,6 +1002,9 @@ rte_sched_port_config(struct rte_sched_port_params *params) port->time_cpu_bytes = 0; port->time = 0; + /* Subport profile table */ + rte_sched_port_config_subport_profile_table(port, params, port->rate); + cycles_per_byte = (rte_get_tsc_hz() << RTE_SCHED_TIME_SHIFT) / params->rate; port->inv_cycles_per_byte = rte_reciprocal_value(cycles_per_byte); @@ -1054,48 +1063,6 @@ rte_sched_port_free(struct rte_sched_port *port) } static void -rte_sched_port_log_subport_config(struct rte_sched_port *port, uint32_t i) -{ - struct rte_sched_subport *s = port->subports[i]; - - RTE_LOG(DEBUG, SCHED, "Low level config for subport %u:\n" - " Token bucket: period = %"PRIu64", credits per period = %"PRIu64 - ", size = %"PRIu64"\n" - " Traffic classes: period = %"PRIu64"\n" - " credits per period = [%"PRIu64", %"PRIu64", %"PRIu64", %"PRIu64 - ", %"PRIu64", %"PRIu64", %"PRIu64", %"PRIu64", %"PRIu64", %"PRIu64 - ", %"PRIu64", %"PRIu64", %"PRIu64"]\n" - " Best effort traffic class oversubscription: wm min = %"PRIu64 - ", wm max = %"PRIu64"\n", - i, - - /* Token bucket */ - s->tb_period, - s->tb_credits_per_period, - s->tb_size, - - /* Traffic classes */ - s->tc_period, - s->tc_credits_per_period[0], - s->tc_credits_per_period[1], - s->tc_credits_per_period[2], - s->tc_credits_per_period[3], - s->tc_credits_per_period[4], - s->tc_credits_per_period[5], - s->tc_credits_per_period[6], - s->tc_credits_per_period[7], - s->tc_credits_per_period[8], - s->tc_credits_per_period[9], - s->tc_credits_per_period[10], - s->tc_credits_per_period[11], - s->tc_credits_per_period[12], - - /* Best effort traffic class oversubscription */ - s->tc_ov_wm_min, - s->tc_ov_wm_max); -} - -static void rte_sched_free_memory(struct rte_sched_port *port, uint32_t n_subports) { uint32_t i; @@ -1168,33 +1135,7 @@ rte_sched_subport_config(struct rte_sched_port *port, /* Port */ port->subports[subport_id] = s; - /* Token Bucket (TB) */ - if (params->tb_rate == port->rate) { - s->tb_credits_per_period = 1; - s->tb_period = 1; - } else { - double tb_rate = ((double) params->tb_rate) / ((double) port->rate); - double d = RTE_SCHED_TB_RATE_CONFIG_ERR; - - rte_approx_64(tb_rate, d, &s->tb_credits_per_period, &s->tb_period); - } - - s->tb_size = params->tb_size; s->tb_time = port->time; - s->tb_credits = s->tb_size / 2; - - /* Traffic Classes (TCs) */ - s->tc_period = rte_sched_time_ms_to_bytes(params->tc_period, port->rate); - for (i = 0; i < RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE; i++) { - if (params->qsize[i]) - s->tc_credits_per_period[i] - = rte_sched_time_ms_to_bytes(params->tc_period, - params->tc_rate[i]); - } - s->tc_time = port->time + s->tc_period; - for (i = 0; i < RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE; i++) - if (params->qsize[i]) - s->tc_credits[i] = s->tc_credits_per_period[i]; /* compile time checks */ RTE_BUILD_BUG_ON(RTE_SCHED_PORT_N_GRINDERS == 0); @@ -1284,8 +1225,6 @@ rte_sched_subport_config(struct rte_sched_port *port, #ifdef RTE_SCHED_SUBPORT_TC_OV /* TC oversubscription */ s->tc_ov_wm_min = port->mtu; - s->tc_ov_wm_max = rte_sched_time_ms_to_bytes(params->tc_period, - s->pipe_tc_be_rate_max); s->tc_ov_wm = s->tc_ov_wm_max; s->tc_ov_period_id = 0; s->tc_ov = 0; @@ -1293,7 +1232,8 @@ rte_sched_subport_config(struct rte_sched_port *port, s->tc_ov_rate = 0; #endif - rte_sched_port_log_subport_config(port, subport_id); + return 0; +} return 0; } From patchwork Wed Sep 2 08:56:45 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Savinay Dharmappa X-Patchwork-Id: 76300 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 EAB10A04B7; Wed, 2 Sep 2020 10:58:38 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 9945E1C0B7; Wed, 2 Sep 2020 10:58:32 +0200 (CEST) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id 630571C0AC for ; Wed, 2 Sep 2020 10:58:30 +0200 (CEST) IronPort-SDR: z98CMACtdqvMzOENdQNMMi3Z3d61wvSDiCbhbneU9j9etagVoRVHEwEgls5uQjSRRXegcHhCVf PNJKHBjcNP3Q== X-IronPort-AV: E=McAfee;i="6000,8403,9731"; a="242173515" X-IronPort-AV: E=Sophos;i="5.76,381,1592895600"; d="scan'208";a="242173515" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Sep 2020 01:58:27 -0700 IronPort-SDR: SC1glCaeRE1qhdguDtymc/oyde0HvA8U9PwsnmLVXnfIwBR47t4kJWFExjjPbvhhgrZMYZKb5K BSWZ7HJV44EQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.76,381,1592895600"; d="scan'208";a="477557379" Received: from unknown (HELO silpixa00400629.ir.intel.com) ([10.237.214.135]) by orsmga005.jf.intel.com with ESMTP; 02 Sep 2020 01:58:26 -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 09:56:45 +0100 Message-Id: <1599037006-3931-3-git-send-email-savinay.dharmappa@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1599037006-3931-1-git-send-email-savinay.dharmappa@intel.com> References: <1594837677-313175-2-git-send-email-savinay.dharmappa@intel.com> <1599037006-3931-1-git-send-email-savinay.dharmappa@intel.com> Subject: [dpdk-dev] [PATCH v1 3/4] sched: add dynamic config of subport bandwidth profile 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" This patch add public APIs to add new subport profile and to configure them. Signed-off-by: Savinay Dharmappa Signed-off-by: Jasvinder Singh --- lib/librte_sched/rte_sched.c | 115 ++++++++++++++++++++++++++++++++++++++++++- lib/librte_sched/rte_sched.h | 45 +++++++++++++++++ 2 files changed, 158 insertions(+), 2 deletions(-) diff --git a/lib/librte_sched/rte_sched.c b/lib/librte_sched/rte_sched.c index c1846d0..770c8bd 100644 --- a/lib/librte_sched/rte_sched.c +++ b/lib/librte_sched/rte_sched.c @@ -1212,8 +1212,8 @@ rte_sched_subport_config(struct rte_sched_port *port, s->bmp = rte_bitmap_init(n_subport_pipe_queues, s->bmp_array, bmp_mem_size); if (s->bmp == NULL) { - RTE_LOG(ERR, SCHED, - "%s: Subport bitmap init error\n", __func__); + RTE_LOG(ERR, SCHED, "%s: " + "Subport bitmap init error\n", __func__); rte_sched_free_memory(port, n_subports); return -EINVAL; @@ -1235,6 +1235,52 @@ rte_sched_subport_config(struct rte_sched_port *port, return 0; } +int +rte_sched_subport_profile_config(struct rte_sched_port *port, + uint32_t subport_id, + uint32_t profile_id) +{ + int i; + struct rte_sched_subport_profile *params; + uint32_t n_subports = subport_id + 1; + struct rte_sched_subport *s; + + if (port == NULL) { + RTE_LOG(ERR, SCHED, "%s: " + "Incorrect value for parameter port\n", __func__); + return -EINVAL; + } + + if (subport_id >= port->n_subports_per_port) { + RTE_LOG(ERR, SCHED, "%s: " + "Incorrect value for parameter subport id\n", __func__); + + rte_sched_free_memory(port, n_subports); + return -EINVAL; + } + + params = port->subport_profiles + profile_id; + + s = port->subports[subport_id]; + + s->tb_credits = params->tb_size / 2; + + s->tc_time = port->time + params->tc_period; + + for (i = 0; i < RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE; i++) + if (s->qsize[i]) + s->tc_credits[i] = params->tc_credits_per_period[i]; + else + params->tc_credits_per_period[i] = 0; + +#ifdef RTE_SCHED_SUBPORT_TC_OV + s->tc_ov_wm_max = rte_sched_time_ms_to_bytes(params->tc_period, + s->pipe_tc_be_rate_max); +#endif + s->profile = profile_id; + + rte_sched_port_log_subport_profile(port, profile_id); + return 0; } @@ -1422,6 +1468,71 @@ rte_sched_subport_pipe_profile_add(struct rte_sched_port *port, return 0; } +int +rte_sched_port_subport_profile_add(struct rte_sched_port *port, + struct rte_sched_subport_profile_params *params, + uint32_t *subport_profile_id) +{ + int status; + uint32_t i; + struct rte_sched_subport_profile *dst; + + /* Port */ + if (port == NULL) { + RTE_LOG(ERR, SCHED, "%s: " + "Incorrect value for parameter port\n", __func__); + return -EINVAL; + } + + if (params == NULL) { + RTE_LOG(ERR, SCHED, "%s: " + "Incorrect value for parameter profile\n", __func__); + return -EINVAL; + } + + if (subport_profile_id == NULL) { + RTE_LOG(ERR, SCHED, "%s: " + "Incorrect value for parametersubport_profile_id\n", + __func__); + return -EINVAL; + } + + dst = port->subport_profiles + port->n_subport_profiles; + + /* Subport profiles exceeds the max limit */ + if (port->n_subport_profiles >= port->n_max_subport_profiles) { + RTE_LOG(ERR, SCHED, "%s: " + "Number of subport profiles exceeds the max limit", __func__); + return -EINVAL; + } + + status = subport_profile_check(params, port->rate); + if (status != 0) { + RTE_LOG(ERR, SCHED, "%s: " + "subport profile check failed(%d)\n", __func__, status); + return -EINVAL; + } + + rte_sched_subport_profile_convert(params, dst, port->rate); + + /* Subport profile should not exists */ + for (i = 0; i < port->n_subport_profiles; i++) + if (memcmp(port->subport_profiles + i, + params, sizeof(*params)) == 0) { + RTE_LOG(ERR, SCHED, + "%s: subport profile exists\n", __func__); + return -EINVAL; + } + + /* Subport profile commit */ + *subport_profile_id = port->n_subport_profiles; + port->n_subport_profiles++; + + rte_sched_port_log_subport_profile(port, *subport_profile_id); + + return 0; +} + static inline uint32_t rte_sched_port_qindex(struct rte_sched_port *port, uint32_t subport, diff --git a/lib/librte_sched/rte_sched.h b/lib/librte_sched/rte_sched.h index e7514bb..7623919 100644 --- a/lib/librte_sched/rte_sched.h +++ b/lib/librte_sched/rte_sched.h @@ -325,6 +325,29 @@ rte_sched_subport_pipe_profile_add(struct rte_sched_port *port, uint32_t *pipe_profile_id); /** + * @warning + * @b EXPERIMENTAL: this API may change without prior notice. + * + * Hierarchical scheduler subport bandwidth profile add + * Note that this function is safe to use in runtime for adding new + * subport bandwidth profile as it doesn't have any impact on hiearchical + * structure of the scheduler. + * @param port + * Handle to port scheduler instance + * @param struct rte_sched_subport_profile + * Subport bandwidth profile + * @param subport_profile_d + * Subport profile id + * @return + * 0 upon success, error code otherwise + */ +__rte_experimental +int +rte_sched_port_subport_profile_add(struct rte_sched_port *port, + struct rte_sched_subport_profile_params *profile, + uint32_t *subport_profile_id); + +/** * Hierarchical scheduler subport configuration * * @param port @@ -342,6 +365,28 @@ rte_sched_subport_config(struct rte_sched_port *port, struct rte_sched_subport_params *params); /** + * @warning + * @b EXPERIMENTAL: this API may change without prior notice. + * + * Hierarchical scheduler subport profile configuration + * Note that this function is safe to use in runtime for applying any specific + * subport bandwidth profile as it doesn't have any impact on hiearchical + * structure of the scheduler. + * @param port + * Handle to port scheduler instance + * @param subport_id + * Subport ID + * @param profile_d + * Subport profile id + * @return + * 0 upon success, error code otherwise + */ +__rte_experimental +int +rte_sched_subport_profile_config(struct rte_sched_port *port, + uint32_t subport_id, + uint32_t profile_id); +/** * Hierarchical scheduler pipe configuration * * @param port From patchwork Wed Sep 2 08:56:46 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Savinay Dharmappa X-Patchwork-Id: 76301 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 97C2EA04B7; Wed, 2 Sep 2020 10:58:47 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id C70431C0C2; Wed, 2 Sep 2020 10:58:33 +0200 (CEST) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id B9EFF1C0AD for ; Wed, 2 Sep 2020 10:58:30 +0200 (CEST) IronPort-SDR: 4WOBZ/VMb9vgSuWjSY1qcHCMR5BiU1D7JXr1Fpdt3Cjohw2WBNosc/1ycvfd3ZbucfGe7PYINl 2Xm35wRpH0iQ== X-IronPort-AV: E=McAfee;i="6000,8403,9731"; a="242173526" X-IronPort-AV: E=Sophos;i="5.76,381,1592895600"; d="scan'208";a="242173526" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Sep 2020 01:58:28 -0700 IronPort-SDR: ndORjxPPHhLpOHhyhUFedtQ9XiawStzeRbF3hNzpOso1HR8EZ7k7XNEQsmFlzmm2yunNJmwduL p+jLmJQlgp4w== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.76,381,1592895600"; d="scan'208";a="477557392" Received: from unknown (HELO silpixa00400629.ir.intel.com) ([10.237.214.135]) by orsmga005.jf.intel.com with ESMTP; 02 Sep 2020 01:58:27 -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 09:56:46 +0100 Message-Id: <1599037006-3931-4-git-send-email-savinay.dharmappa@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1599037006-3931-1-git-send-email-savinay.dharmappa@intel.com> References: <1594837677-313175-2-git-send-email-savinay.dharmappa@intel.com> <1599037006-3931-1-git-send-email-savinay.dharmappa@intel.com> Subject: [dpdk-dev] [PATCH v1 4/4] sched: add dynamic config of subport bandwidth profile 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" This patch modifies the way credits are updated. Credits are updated by fetching parameters from subport profile table. Signed-off-by: Savinay Dharmappa Signed-off-by: Jasvinder Singh --- lib/librte_sched/rte_sched.c | 62 ++++++++++++++++++++++------------ lib/librte_sched/rte_sched_version.map | 2 ++ 2 files changed, 43 insertions(+), 21 deletions(-) diff --git a/lib/librte_sched/rte_sched.c b/lib/librte_sched/rte_sched.c index 770c8bd..cfbcf5c 100644 --- a/lib/librte_sched/rte_sched.c +++ b/lib/librte_sched/rte_sched.c @@ -124,6 +124,7 @@ struct rte_sched_grinder { uint32_t productive; uint32_t pindex; struct rte_sched_subport *subport; + struct rte_sched_subport_profile *subport_params; struct rte_sched_pipe *pipe; struct rte_sched_pipe_profile *pipe_params; @@ -1291,6 +1292,7 @@ rte_sched_pipe_config(struct rte_sched_port *port, int32_t pipe_profile) { struct rte_sched_subport *s; + struct rte_sched_subport_profile *sp; struct rte_sched_pipe *p; struct rte_sched_pipe_profile *params; uint32_t n_subports = subport_id + 1; @@ -1331,14 +1333,16 @@ rte_sched_pipe_config(struct rte_sched_port *port, return -EINVAL; } + sp = port->subport_profiles + s->profile; + /* Handle the case when pipe already has a valid configuration */ p = s->pipe + pipe_id; if (p->tb_time) { params = s->pipe_profiles + p->profile; double subport_tc_be_rate = - (double) s->tc_credits_per_period[RTE_SCHED_TRAFFIC_CLASS_BE] - / (double) s->tc_period; + (double) sp->tc_credits_per_period[RTE_SCHED_TRAFFIC_CLASS_BE] + / (double) sp->tc_period; double pipe_tc_be_rate = (double) params->tc_credits_per_period[RTE_SCHED_TRAFFIC_CLASS_BE] / (double) params->tc_period; @@ -1380,8 +1384,8 @@ rte_sched_pipe_config(struct rte_sched_port *port, { /* Subport best effort tc oversubscription */ double subport_tc_be_rate = - (double) s->tc_credits_per_period[RTE_SCHED_TRAFFIC_CLASS_BE] - / (double) s->tc_period; + (double) sp->tc_credits_per_period[RTE_SCHED_TRAFFIC_CLASS_BE] + / (double) sp->tc_period; double pipe_tc_be_rate = (double) params->tc_credits_per_period[RTE_SCHED_TRAFFIC_CLASS_BE] / (double) params->tc_period; @@ -1393,8 +1397,9 @@ rte_sched_pipe_config(struct rte_sched_port *port, if (s->tc_ov != tc_be_ov) { RTE_LOG(DEBUG, SCHED, - "Subport %u Best effort TC oversubscription is ON (%.4lf < %.4lf)\n", - subport_id, subport_tc_be_rate, s->tc_ov_rate); + "Subport %u Best effort TC oversubscription is ON " + "(%.4lf < %.4lf)\n", + subport_id, subport_tc_be_rate, s->tc_ov_rate); } p->tc_ov_period_id = s->tc_ov_period_id; p->tc_ov_credits = s->tc_ov_wm; @@ -2168,14 +2173,18 @@ grinder_credits_update(struct rte_sched_port *port, struct rte_sched_grinder *grinder = subport->grinder + pos; struct rte_sched_pipe *pipe = grinder->pipe; struct rte_sched_pipe_profile *params = grinder->pipe_params; + struct rte_sched_subport_profile *subport_params = + grinder->subport_params; uint64_t n_periods; uint32_t i; /* Subport TB */ - n_periods = (port->time - subport->tb_time) / subport->tb_period; - subport->tb_credits += n_periods * subport->tb_credits_per_period; - subport->tb_credits = RTE_MIN(subport->tb_credits, subport->tb_size); - subport->tb_time += n_periods * subport->tb_period; + n_periods = (port->time - subport->tb_time) / subport_params->tb_period; + subport->tb_credits += n_periods * + subport_params->tb_credits_per_period; + subport->tb_credits = RTE_MIN(subport->tb_credits, + subport_params->tb_size); + subport->tb_time += n_periods * subport_params->tb_period; /* Pipe TB */ n_periods = (port->time - pipe->tb_time) / params->tb_period; @@ -2186,9 +2195,10 @@ grinder_credits_update(struct rte_sched_port *port, /* Subport TCs */ if (unlikely(port->time >= subport->tc_time)) { for (i = 0; i < RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE; i++) - subport->tc_credits[i] = subport->tc_credits_per_period[i]; + subport->tc_credits[i] = + subport_params->tc_credits_per_period[i]; - subport->tc_time = port->time + subport->tc_period; + subport->tc_time = port->time + subport_params->tc_period; } /* Pipe TCs */ @@ -2206,6 +2216,8 @@ static inline uint64_t grinder_tc_ov_credits_update(struct rte_sched_port *port, struct rte_sched_subport *subport) { + struct rte_sched_subport_profile *subport_params = + grinder->subport_params; uint64_t tc_ov_consumption[RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE]; uint64_t tc_consumption = 0, tc_ov_consumption_max; uint64_t tc_ov_wm = subport->tc_ov_wm; @@ -2216,16 +2228,17 @@ grinder_tc_ov_credits_update(struct rte_sched_port *port, for (i = 0; i < RTE_SCHED_TRAFFIC_CLASS_BE; i++) { tc_ov_consumption[i] = - subport->tc_credits_per_period[i] - subport->tc_credits[i]; + subport_params->tc_credits_per_period[i] - + subport->tc_credits[i]; tc_consumption += tc_ov_consumption[i]; } tc_ov_consumption[RTE_SCHED_TRAFFIC_CLASS_BE] = - subport->tc_credits_per_period[RTE_SCHED_TRAFFIC_CLASS_BE] - + subport_params->tc_credits_per_period[RTE_SCHED_TRAFFIC_CLASS_BE] - subport->tc_credits[RTE_SCHED_TRAFFIC_CLASS_BE]; tc_ov_consumption_max = - subport->tc_credits_per_period[RTE_SCHED_TRAFFIC_CLASS_BE] - + subport_params->tc_credits_per_period[RTE_SCHED_TRAFFIC_CLASS_BE] - tc_consumption; if (tc_ov_consumption[RTE_SCHED_TRAFFIC_CLASS_BE] > @@ -2251,14 +2264,18 @@ grinder_credits_update(struct rte_sched_port *port, struct rte_sched_grinder *grinder = subport->grinder + pos; struct rte_sched_pipe *pipe = grinder->pipe; struct rte_sched_pipe_profile *params = grinder->pipe_params; + struct rte_sched_subport_profile *subport_params = + grinder->subport_params; uint64_t n_periods; uint32_t i; /* Subport TB */ - n_periods = (port->time - subport->tb_time) / subport->tb_period; - subport->tb_credits += n_periods * subport->tb_credits_per_period; - subport->tb_credits = RTE_MIN(subport->tb_credits, subport->tb_size); - subport->tb_time += n_periods * subport->tb_period; + n_periods = (port->time - subport->tb_time) / subport_params->tb_period; + subport->tb_credits += n_periods * + subport_params->tb_credits_per_period; + subport->tb_credits = RTE_MIN(subport->tb_credits, + subport_params->tb_size); + subport->tb_time += n_periods * subport_params->tb_period; /* Pipe TB */ n_periods = (port->time - pipe->tb_time) / params->tb_period; @@ -2271,9 +2288,10 @@ grinder_credits_update(struct rte_sched_port *port, subport->tc_ov_wm = grinder_tc_ov_credits_update(port, subport); for (i = 0; i < RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE; i++) - subport->tc_credits[i] = subport->tc_credits_per_period[i]; + subport->tc_credits[i] = + subport_params->tc_credits_per_period[i]; - subport->tc_time = port->time + subport->tc_period; + subport->tc_time = port->time + subport_params->tc_period; subport->tc_ov_period_id++; } @@ -2796,6 +2814,8 @@ grinder_handle(struct rte_sched_port *port, struct rte_sched_pipe *pipe = grinder->pipe; grinder->pipe_params = subport->pipe_profiles + pipe->profile; + grinder->subport_params = port->subport_profiles + + subport->profile; grinder_prefetch_tc_queue_arrays(subport, pos); grinder_credits_update(port, subport, pos); diff --git a/lib/librte_sched/rte_sched_version.map b/lib/librte_sched/rte_sched_version.map index cefd990..c02a223 100644 --- a/lib/librte_sched/rte_sched_version.map +++ b/lib/librte_sched/rte_sched_version.map @@ -28,4 +28,6 @@ EXPERIMENTAL { global: rte_sched_subport_pipe_profile_add; + rte_sched_port_subport_profile_add; + rte_sched_subport_profile_config; };