From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id 4108C2BF5 for ; Mon, 26 Jun 2017 12:43:34 +0200 (CEST) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga104.jf.intel.com with ESMTP; 26 Jun 2017 03:43:33 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.39,395,1493708400"; d="scan'208";a="103685960" Received: from irsmsx153.ger.corp.intel.com ([163.33.192.75]) by orsmga002.jf.intel.com with ESMTP; 26 Jun 2017 03:43:32 -0700 Received: from irsmsx108.ger.corp.intel.com ([169.254.11.133]) by IRSMSX153.ger.corp.intel.com ([169.254.9.74]) with mapi id 14.03.0319.002; Mon, 26 Jun 2017 11:43:31 +0100 From: "Dumitrescu, Cristian" To: Olivier Chirossel , "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH] [PATCH] lib/librte_sched: fix update tc_credits Actualy ( for small rate ) if tc_credits_per_period < packets length all packets are drop. also the credits presents before the updade are loose, because tc_credits is set to tc_credit Thread-Index: AdLuaQrbTGhT6c9ST4aKL8ES0Nfy3w== Date: Mon, 26 Jun 2017 10:43:31 +0000 Message-ID: <3EB4FA525960D640B5BDFFD6A3D891267BA7107F@IRSMSX108.ger.corp.intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiZTY0MWViNzktNGYyNy00N2M3LTg0NzUtNDUyNTc0ODhlZDY2IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE2LjUuOS4zIiwiVHJ1c3RlZExhYmVsSGFzaCI6InFmOUcxb0VjQjI1ODlKaVRnYUZXRHhFd1F2MWs1Y0NvamFicExEWG1BNGs9In0= x-ctpclassification: CTP_IC dlp-product: dlpe-windows dlp-version: 10.0.102.7 dlp-reaction: no-action x-originating-ip: [163.33.239.181] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH] [PATCH] lib/librte_sched: fix update tc_credits Actualy ( for small rate ) if tc_credits_per_period < packets length all packets are drop. also the credits presents before the updade are loose, because tc_credits is set to tc_credit 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: , X-List-Received-Date: Mon, 26 Jun 2017 10:43:36 -0000 > -----Original Message----- > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Olivier Chirossel > Sent: Monday, June 26, 2017 11:14 AM > To: dev@dpdk.org > Cc: Olivier Chirossel > Subject: [dpdk-dev] [PATCH] [PATCH] lib/librte_sched: fix update tc_credi= ts > Actualy ( for small rate ) if tc_credits_per_period < packets length all = packets > are drop. also the credits presents before the updade are loose, because > tc_credits is set to tc_credits... >=20 > --- > doc/guides/prog_guide/qos_framework.rst | 10 ++++-- > lib/librte_sched/rte_sched.c | 62 ++++++++++++++++++++++-----= ----- > - > 2 files changed, 50 insertions(+), 22 deletions(-) >=20 > diff --git a/doc/guides/prog_guide/qos_framework.rst > b/doc/guides/prog_guide/qos_framework.rst > index f3f60b8..e566ff9 100644 > --- a/doc/guides/prog_guide/qos_framework.rst > +++ b/doc/guides/prog_guide/qos_framework.rst > @@ -799,6 +799,9 @@ as described in :numref:`table_qos_10` and > :numref:`table_qos_11`. > | 4 | tc_credits | Bytes | Current upper limit for the num= ber of credits > that can be consumed by | > | | | | the current traffic class for t= he remainder of the > current | > | | | | enforcement period. = | > + | | | | when The credits is update (eve= ry tc_period) the > | > + | | | | tc_credits_per_period is added = to the value > (tc_credits) if the new | > + | | | | value is lower than tc_rate. el= se the value is set to > tc_rate. | > | | | | = | > +---+-----------------------+-------+--------------------------------= -------------------- > -------------------+ >=20 > @@ -819,8 +822,11 @@ as described in :numref:`table_qos_10` and > :numref:`table_qos_11`. > | | | = | > | | | if (time >=3D tc_time) { = | > | | | = | > - | | | tc_credits =3D tc_credits_per_period= ; | > - | | | = | > + | | | if (tc_credits + tc_credits_per_peri= od < tc_rate) { > | > + | | | tc_credits +=3D tc_credits_pe= r_period > | > + | | | else { = | > + | | | tc_credits =3D tc_rate = | > + | | | } = | > | | | tc_time =3D time + tc_period; = | > | | | = | > | | | } = | > diff --git a/lib/librte_sched/rte_sched.c b/lib/librte_sched/rte_sched.c > index 614705d..7d15eee 100644 > --- a/lib/librte_sched/rte_sched.c > +++ b/lib/librte_sched/rte_sched.c > @@ -83,6 +83,7 @@ struct rte_sched_subport { >=20 > /* Traffic classes (TCs) */ > uint64_t tc_time; /* time of next update */ > + uint32_t tc_rate[RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE]; > uint32_t > tc_credits_per_period[RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE]; > uint32_t tc_credits[RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE]; > uint32_t tc_period; > @@ -107,6 +108,7 @@ struct rte_sched_pipe_profile { > uint32_t tb_size; >=20 > /* Pipe traffic classes */ > + uint32_t tc_rate[RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE]; > uint32_t tc_period; > uint32_t > tc_credits_per_period[RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE]; > uint8_t tc_ov_weight; > @@ -566,11 +568,14 @@ rte_sched_port_config_pipe_profile_table(struct > rte_sched_port *port, struct rte > /* Traffic Classes */ > dst->tc_period =3D rte_sched_time_ms_to_bytes(src- > >tc_period, > params->rate); > - > - for (j =3D 0; j < RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE; j++) > + > + for (j =3D 0; j < RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE; j++) { > + dst->tc_rate[j] =3D src->tc_rate[j]; > dst->tc_credits_per_period[j] > =3D rte_sched_time_ms_to_bytes(src- > >tc_period, > src->tc_rate[j]); > + } > + >=20 > #ifdef RTE_SCHED_SUBPORT_TC_OV > dst->tc_ov_weight =3D src->tc_ov_weight; > @@ -836,6 +841,7 @@ rte_sched_subport_config(struct rte_sched_port > *port, > /* Traffic Classes (TCs) */ > s->tc_period =3D rte_sched_time_ms_to_bytes(params->tc_period, > port->rate); > for (i =3D 0; i < RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE; i++) { > + s->tc_rate[i] =3D params->tc_rate[i]; > s->tc_credits_per_period[i] > =3D rte_sched_time_ms_to_bytes(params->tc_period, > params->tc_rate[i]); > @@ -1478,6 +1484,7 @@ grinder_credits_update(struct rte_sched_port > *port, uint32_t pos) > struct rte_sched_pipe *pipe =3D grinder->pipe; > struct rte_sched_pipe_profile *params =3D grinder->pipe_params; > uint64_t n_periods; > + uint32_t j; >=20 > /* Subport TB */ > n_periods =3D (port->time - subport->tb_time) / subport->tb_period; > @@ -1493,19 +1500,27 @@ grinder_credits_update(struct rte_sched_port > *port, uint32_t pos) >=20 > /* Subport TCs */ > if (unlikely(port->time >=3D subport->tc_time)) { > - subport->tc_credits[0] =3D subport->tc_credits_per_period[0]; > - subport->tc_credits[1] =3D subport->tc_credits_per_period[1]; > - subport->tc_credits[2] =3D subport->tc_credits_per_period[2]; > - subport->tc_credits[3] =3D subport->tc_credits_per_period[3]; > + for (j =3D 0; j < RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE; j++) { > + if ((subport->tc_credits[j] + subport- > >tc_credits_per_period[j]) < subport->tc_rate[j]) { > + subport->tc_credits[j] +=3D subport- > >tc_credits_per_period[j]; > + } > + else { > + subport->tc_credits[j] =3D subport->tc_rate[j]; > + } > + } > subport->tc_time =3D port->time + subport->tc_period; > } >=20 > /* Pipe TCs */ > if (unlikely(port->time >=3D pipe->tc_time)) { > - pipe->tc_credits[0] =3D params->tc_credits_per_period[0]; > - pipe->tc_credits[1] =3D params->tc_credits_per_period[1]; > - pipe->tc_credits[2] =3D params->tc_credits_per_period[2]; > - pipe->tc_credits[3] =3D params->tc_credits_per_period[3]; > + for (j =3D 0; j < RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE; j++) { > + if ((pipe->tc_credits[j] + params- > >tc_credits_per_period[j]) < params->tc_rate[j]) { > + pipe->tc_credits[j] +=3D params->tc_credits_per_p= eriod[j]; > + } > + else { > + pipe->tc_credits[j] =3D params->tc_rate[j]; > + } > + } > pipe->tc_time =3D port->time + params->tc_period; > } > } > @@ -1555,6 +1570,7 @@ grinder_credits_update(struct rte_sched_port > *port, uint32_t pos) > struct rte_sched_pipe *pipe =3D grinder->pipe; > struct rte_sched_pipe_profile *params =3D grinder->pipe_params; > uint64_t n_periods; > + uint32_t j; >=20 > /* Subport TB */ > n_periods =3D (port->time - subport->tb_time) / subport->tb_period; > @@ -1571,22 +1587,28 @@ grinder_credits_update(struct rte_sched_port > *port, uint32_t pos) > /* Subport TCs */ > if (unlikely(port->time >=3D subport->tc_time)) { > subport->tc_ov_wm =3D grinder_tc_ov_credits_update(port, > pos); > - > - subport->tc_credits[0] =3D subport->tc_credits_per_period[0]; > - subport->tc_credits[1] =3D subport->tc_credits_per_period[1]; > - subport->tc_credits[2] =3D subport->tc_credits_per_period[2]; > - subport->tc_credits[3] =3D subport->tc_credits_per_period[3]; > - > + for (j =3D 0; j < RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE; j++) { > + if ((subport->tc_credits[j] + subport- > >tc_credits_per_period[j]) < subport->tc_rate[j]) { > + subport->tc_credits[j] +=3D subport- > >tc_credits_per_period[j]; > + } > + else { > + subport->tc_credits[j] =3D subport->tc_rate[j]; > + } > + } > subport->tc_time =3D port->time + subport->tc_period; > subport->tc_ov_period_id++; > } >=20 > /* Pipe TCs */ > if (unlikely(port->time >=3D pipe->tc_time)) { > - pipe->tc_credits[0] =3D params->tc_credits_per_period[0]; > - pipe->tc_credits[1] =3D params->tc_credits_per_period[1]; > - pipe->tc_credits[2] =3D params->tc_credits_per_period[2]; > - pipe->tc_credits[3] =3D params->tc_credits_per_period[3]; > + for (j =3D 0; j < RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE; j++) { > + if ((pipe->tc_credits[j] + params- > >tc_credits_per_period[j]) < params->tc_rate[j]) { > + pipe->tc_credits[j] +=3D params->tc_credits_per_p= eriod[j]; > + } > + else { > + pipe->tc_credits[j] =3D params->tc_rate[j]; > + } > + } > pipe->tc_time =3D port->time + params->tc_period; > } >=20 > -- > 2.7.4 Olivier, thank you for you patch, I will put it on my list of patches to re= view. Please add the Signed Off line, otherwise DPDK project cannot accept the pa= tch. Please also add a clear description of the problem you are trying to solve = in the patch or cover letter. Regards, Cristian