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 148FDA04B5; Thu, 10 Sep 2020 20:50:27 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 4FE651C12A; Thu, 10 Sep 2020 20:49:11 +0200 (CEST) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by dpdk.org (Postfix) with ESMTP id 695BF1C122 for ; Thu, 10 Sep 2020 20:49:00 +0200 (CEST) IronPort-SDR: PUyN8xB+1jBly59IdFfb/M69pUk+Mh/AvXpZatCMO97V5P20MAYg8mhjbJOgHRmbA7AgX1T936 iQZFmy5V7yWQ== X-IronPort-AV: E=McAfee;i="6000,8403,9740"; a="138130694" X-IronPort-AV: E=Sophos;i="5.76,413,1592895600"; d="scan'208";a="138130694" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Sep 2020 11:48:59 -0700 IronPort-SDR: FGWgyTVl8XfraNaYSxYMfplHKDUy0X57Q9qZquGqWLIoznvkxEbdChvrdUuCORjASp0rp35S/d rbnmbDCHG2kA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.76,413,1592895600"; d="scan'208";a="344371152" Received: from silpixa00400629.ir.intel.com ([10.237.214.135]) by orsmga007.jf.intel.com with ESMTP; 10 Sep 2020 11:48:58 -0700 From: Savinay Dharmappa To: jasvinder.singh@intel.com, cristian.dumitrescu@intel.com, dev@dpdk.org Cc: savinay.dharmappa@intel.com Date: Thu, 10 Sep 2020 19:48:37 +0100 Message-Id: <1599763717-135002-11-git-send-email-savinay.dharmappa@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1599763717-135002-1-git-send-email-savinay.dharmappa@intel.com> References: <1599037006-3931-1-git-send-email-savinay.dharmappa@intel.com> <1599763717-135002-1-git-send-email-savinay.dharmappa@intel.com> Subject: [dpdk-dev] [PATCH v2 10/10] sched: remove the redundant code 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" Remove redundant data structure fields references from functions and subport level data structures. It also update the release and deprecation note. Signed-off-by: Savinay Dharmappa --- doc/guides/rel_notes/deprecation.rst | 6 -- doc/guides/rel_notes/release_20_11.rst | 4 ++ lib/librte_sched/rte_sched.c | 115 +-------------------------------- lib/librte_sched/rte_sched.h | 12 ---- 4 files changed, 6 insertions(+), 131 deletions(-) diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst index 279eccb..3926c3c 100644 --- a/doc/guides/rel_notes/deprecation.rst +++ b/doc/guides/rel_notes/deprecation.rst @@ -311,12 +311,6 @@ Deprecation Notices in "rte_sched.h". These changes are aligned to improvements suggested in the RFC https://mails.dpdk.org/archives/dev/2018-November/120035.html. -* sched: To allow dynamic configuration of the subport bandwidth profile, - changes will be made to data structures ``rte_sched_subport_params``, - ``rte_sched_port_params`` and new data structure, API functions will be - defined in ``rte_sched.h``. These changes are aligned as suggested in the - RFC https://mails.dpdk.org/archives/dev/2020-July/175161.html - * metrics: The function ``rte_metrics_init`` will have a non-void return in order to notify errors instead of calling ``rte_exit``. diff --git a/doc/guides/rel_notes/release_20_11.rst b/doc/guides/rel_notes/release_20_11.rst index df227a1..51c4568 100644 --- a/doc/guides/rel_notes/release_20_11.rst +++ b/doc/guides/rel_notes/release_20_11.rst @@ -84,6 +84,10 @@ API Changes Also, make sure to start the actual text at the margin. ======================================================= +* sched: The subport bandwidth configuration parameters such as tb_rate, + tc_rate, tc_period etc., are moved from subport level data structure to + new a data structure. This allows to configure a subport with different + subport bandwidth configuration dynamically. ABI Changes ----------- diff --git a/lib/librte_sched/rte_sched.c b/lib/librte_sched/rte_sched.c index 9ff67e0..6edc622 100644 --- a/lib/librte_sched/rte_sched.c +++ b/lib/librte_sched/rte_sched.c @@ -153,16 +153,11 @@ 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; @@ -838,18 +833,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) */ @@ -863,29 +846,8 @@ 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) { - 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__); + if (params->qsize[RTE_SCHED_TRAFFIC_CLASS_BE] == 0) { + RTE_LOG(ERR, SCHED, "%s: Incorrect qsize\n", __func__); return -EINVAL; } @@ -1102,48 +1064,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; @@ -1216,33 +1136,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); @@ -1332,17 +1226,12 @@ 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; s->tc_ov_n = 0; s->tc_ov_rate = 0; #endif - - rte_sched_port_log_subport_config(port, subport_id); - return 0; } diff --git a/lib/librte_sched/rte_sched.h b/lib/librte_sched/rte_sched.h index a7c2638..7623919 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, -- 2.7.4