From: "Singh, Jasvinder" <jasvinder.singh@intel.com>
To: "Danilewicz, MarcinX" <marcinx.danilewicz@intel.com>,
"dev@dpdk.org" <dev@dpdk.org>
Cc: "Ajmera, Megha" <megha.ajmera@intel.com>,
"Dumitrescu, Cristian" <cristian.dumitrescu@intel.com>
Subject: RE: [dpdk][PATCH 1/2] sched: enable/disable TC OV at runtime
Date: Fri, 8 Apr 2022 12:50:54 +0000 [thread overview]
Message-ID: <CY4PR11MB1589EE427E3876A588AFC360E0E99@CY4PR11MB1589.namprd11.prod.outlook.com> (raw)
In-Reply-To: <20220407145153.238969-1-marcinx.danilewicz@intel.com>
> -----Original Message-----
> From: Marcin Danilewicz <marcinx.danilewicz@intel.com>
> Sent: Thursday, April 7, 2022 3:52 PM
> To: dev@dpdk.org
> Cc: Ajmera, Megha <megha.ajmera@intel.com>
> Subject: [dpdk][PATCH 1/2] sched: enable/disable TC OV at runtime
>
> From: Megha Ajmera <megha.ajmera@intel.com>
>
> Added new API to enable or disable TC over subscription for best effort
> traffic class at subport level.
>
> By default TC OV is disabled for subport.
>
> Signed-off-by: Megha Ajmera <megha.ajmera@intel.com>
>
> diff --git a/lib/sched/rte_sched.c b/lib/sched/rte_sched.c index
> ec74bee939..1d05089d00 100644
> --- a/lib/sched/rte_sched.c
> +++ b/lib/sched/rte_sched.c
> @@ -155,6 +155,7 @@ struct rte_sched_subport {
> uint64_t tc_credits[RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE];
>
> /* TC oversubscription */
> + uint8_t is_tc_ov_enabled;
> uint64_t tc_ov_wm;
> uint64_t tc_ov_wm_min;
> uint64_t tc_ov_wm_max;
> @@ -1165,6 +1166,45 @@ rte_sched_cman_config(struct rte_sched_port
> *port, } #endif
>
> +int
> +rte_sched_subport_tc_ov_config(struct rte_sched_port *port,
> + uint32_t subport_id,
> + bool tc_ov_enable)
> +{
> + struct rte_sched_subport *s;
> + struct rte_sched_subport_profile *profile;
> +
> + 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__);
> + return -EINVAL;
> + }
> +
> + s = port->subports[subport_id];
> + s->is_tc_ov_enabled = tc_ov_enable;
> +
> + if (s->is_tc_ov_enabled) {
> + /* TC oversubscription */
> + s->tc_ov_wm_min = port->mtu;
> + s->tc_ov_period_id = 0;
> + s->tc_ov = 0;
> + s->tc_ov_n = 0;
> + s->tc_ov_rate = 0;
> +
> + profile = port->subport_profiles + s->profile;
> + s->tc_ov_wm_max = rte_sched_time_ms_to_bytes(profile-
> >tc_period,
> + s->pipe_tc_be_rate_max);
> + s->tc_ov_wm = s->tc_ov_wm_max;
> + }
> + return 0;
> +}
This API should be invoked immediately after subport config function because during pipe configuration, subport tc_ov parameters are updated based on the pipe best effort tc parameters. With this condition, won't it be good to add tc_ov_enable/disable flag to subport params instead of adding new API?
> +
> int
> rte_sched_subport_config(struct rte_sched_port *port,
> uint32_t subport_id,
> @@ -1317,12 +1357,8 @@ rte_sched_subport_config(struct rte_sched_port
> *port,
> for (i = 0; i < RTE_SCHED_PORT_N_GRINDERS; i++)
> s->grinder_base_bmp_pos[i] =
> RTE_SCHED_PIPE_INVALID;
>
> - /* TC oversubscription */
> - s->tc_ov_wm_min = port->mtu;
> - s->tc_ov_period_id = 0;
> - s->tc_ov = 0;
> - s->tc_ov_n = 0;
> - s->tc_ov_rate = 0;
> + /* TC over-subscription is disabled by default */
> + s->is_tc_ov_enabled = 0;
> }
>
> {
> @@ -1342,9 +1378,6 @@ rte_sched_subport_config(struct rte_sched_port
> *port,
> else
> profile->tc_credits_per_period[i] = 0;
>
> - s->tc_ov_wm_max = rte_sched_time_ms_to_bytes(profile-
> >tc_period,
> - s-
> >pipe_tc_be_rate_max);
> - s->tc_ov_wm = s->tc_ov_wm_max;
> s->profile = subport_profile_id;
>
> }
> @@ -1417,17 +1450,20 @@ rte_sched_pipe_config(struct rte_sched_port
> *port,
> double pipe_tc_be_rate =
> (double) params-
> >tc_credits_per_period[RTE_SCHED_TRAFFIC_CLASS_BE]
> / (double) params->tc_period;
> - uint32_t tc_be_ov = s->tc_ov;
>
> - /* Unplug pipe from its subport */
> - s->tc_ov_n -= params->tc_ov_weight;
> - s->tc_ov_rate -= pipe_tc_be_rate;
> - s->tc_ov = s->tc_ov_rate > subport_tc_be_rate;
> + if (s->is_tc_ov_enabled) {
> + uint32_t tc_be_ov = s->tc_ov;
>
> - if (s->tc_ov != tc_be_ov) {
> - RTE_LOG(DEBUG, SCHED,
> - "Subport %u Best-effort TC oversubscription
> is OFF (%.4lf >= %.4lf)\n",
> - subport_id, subport_tc_be_rate, s-
> >tc_ov_rate);
> + /* Unplug pipe from its subport */
> + s->tc_ov_n -= params->tc_ov_weight;
> + s->tc_ov_rate -= pipe_tc_be_rate;
> + s->tc_ov = s->tc_ov_rate > subport_tc_be_rate;
> +
> + if (s->tc_ov != tc_be_ov) {
> + RTE_LOG(DEBUG, SCHED,
> + "Subport %u Best-effort TC
> oversubscription is OFF (%.4lf >= %.4lf)\n",
> + subport_id, subport_tc_be_rate, s-
> >tc_ov_rate);
> + }
> }
>
> /* Reset the pipe */
> @@ -1460,19 +1496,22 @@ rte_sched_pipe_config(struct rte_sched_port
> *port,
> double pipe_tc_be_rate =
> (double) params-
> >tc_credits_per_period[RTE_SCHED_TRAFFIC_CLASS_BE]
> / (double) params->tc_period;
> - uint32_t tc_be_ov = s->tc_ov;
>
> - s->tc_ov_n += params->tc_ov_weight;
> - s->tc_ov_rate += pipe_tc_be_rate;
> - s->tc_ov = s->tc_ov_rate > subport_tc_be_rate;
> + if (s->is_tc_ov_enabled) {
> + uint32_t tc_be_ov = s->tc_ov;
>
> - 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);
> + s->tc_ov_n += params->tc_ov_weight;
> + s->tc_ov_rate += pipe_tc_be_rate;
> + s->tc_ov = s->tc_ov_rate > subport_tc_be_rate;
> +
> + 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);
> + }
> + p->tc_ov_period_id = s->tc_ov_period_id;
> + p->tc_ov_credits = s->tc_ov_wm;
> }
> - p->tc_ov_period_id = s->tc_ov_period_id;
> - p->tc_ov_credits = s->tc_ov_wm;
> }
>
prev parent reply other threads:[~2022-04-08 12:50 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-07 14:51 Marcin Danilewicz
2022-04-07 14:51 ` [dpdk][PATCH 2/2] sched: fix to manage " Marcin Danilewicz
2022-04-14 9:53 ` Thomas Monjalon
2022-04-27 9:23 ` [PATCH v3] sched: enable/disable " Marcin Danilewicz
2022-04-27 15:48 ` Singh, Jasvinder
2022-05-09 20:05 ` Dumitrescu, Cristian
2022-05-10 6:40 ` Ajmera, Megha
2022-05-10 9:09 ` Dumitrescu, Cristian
2022-05-24 13:33 ` Marcin Danilewicz
2022-05-24 14:52 ` Stephen Hemminger
2022-05-26 23:12 ` Danilewicz, MarcinX
2022-05-24 13:38 ` [PATCH v4] sched: enable traffic class oversubscription conditionally Marcin Danilewicz
2022-05-24 13:43 ` Marcin Danilewicz
2022-05-24 14:30 ` Dumitrescu, Cristian
2022-05-25 14:18 ` Danilewicz, MarcinX
2022-05-27 0:09 ` Danilewicz, MarcinX
2022-05-27 0:09 ` [PATCH v5] " Marcin Danilewicz
2022-05-30 8:45 ` [PATCH v6] " Marcin Danilewicz
2022-05-30 10:35 ` Dumitrescu, Cristian
2022-05-30 11:59 ` Danilewicz, MarcinX
2022-05-30 10:54 ` Dumitrescu, Cristian
2022-05-30 12:02 ` Danilewicz, MarcinX
2022-05-30 10:58 ` Dumitrescu, Cristian
2022-05-30 12:04 ` Danilewicz, MarcinX
2022-05-30 11:55 ` [PATCH v7] " Marcin Danilewicz
2022-05-30 12:14 ` Dumitrescu, Cristian
2022-05-30 13:34 ` Danilewicz, MarcinX
2022-05-30 13:55 ` Dumitrescu, Cristian
2022-05-30 14:05 ` Danilewicz, MarcinX
2022-05-30 13:38 ` [PATCH v8] " Marcin Danilewicz
2022-05-30 18:47 ` [PATCH v9] " Marcin Danilewicz
2022-05-30 21:13 ` Dumitrescu, Cristian
2022-05-31 9:49 ` [PATCH v10] " Marcin Danilewicz
2022-05-31 13:09 ` Dumitrescu, Cristian
2022-05-31 16:42 ` Thomas Monjalon
2022-05-31 18:45 ` Danilewicz, MarcinX
2022-04-08 12:50 ` Singh, Jasvinder [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CY4PR11MB1589EE427E3876A588AFC360E0E99@CY4PR11MB1589.namprd11.prod.outlook.com \
--to=jasvinder.singh@intel.com \
--cc=cristian.dumitrescu@intel.com \
--cc=dev@dpdk.org \
--cc=marcinx.danilewicz@intel.com \
--cc=megha.ajmera@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).