From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id A78AFA0507; Wed, 27 Apr 2022 11:36:56 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 64BFD40E78; Wed, 27 Apr 2022 11:36:56 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by mails.dpdk.org (Postfix) with ESMTP id 7446B40691 for ; Wed, 27 Apr 2022 11:36:54 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1651052214; x=1682588214; h=from:to:subject:date:message-id:references:in-reply-to: content-transfer-encoding:mime-version; bh=iyVKth5MOUCkZFY+cpFDWueRx9GVnpFP8619uxdQEKA=; b=Ls/MrMJXVfkUJTfnUdsHg3yASuwXL/UHkjIXhJHCEQm0JFvfGQWhwk13 idaFs7oZUAwH+YVtDRxYqyah5oa1AIv+lPGDPylYo1SUPKjYHYyiJUlrb rLMcRD3d1POhGFR6R0U5TXak3Pikh/925DhwgYatU7jk9dgPRLhm3xnuX ZEyJwjHtu2tUVFEMAMu3ojSMMI9CMIK9qRyJw+05ffnojsJ9HgCONmVmA 0OwNSjKF3+L7ixHA8bgWf8WrIBA5EyoabwxEdFO4AQcWeug0vAvTWf/EC +Hv2e5qvOUDnkwPbDsrWdiikT8Suoy5XQlWzc8m7/gAciYrQsXsPQjFmN w==; X-IronPort-AV: E=McAfee;i="6400,9594,10329"; a="291025216" X-IronPort-AV: E=Sophos;i="5.90,292,1643702400"; d="scan'208";a="291025216" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Apr 2022 02:36:53 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.90,292,1643702400"; d="scan'208";a="539783652" Received: from fmsmsx606.amr.corp.intel.com ([10.18.126.86]) by orsmga002.jf.intel.com with ESMTP; 27 Apr 2022 02:36:53 -0700 Received: from fmsmsx601.amr.corp.intel.com (10.18.126.81) by fmsmsx606.amr.corp.intel.com (10.18.126.86) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27; Wed, 27 Apr 2022 02:36:52 -0700 Received: from fmsedg601.ED.cps.intel.com (10.1.192.135) by fmsmsx601.amr.corp.intel.com (10.18.126.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27 via Frontend Transport; Wed, 27 Apr 2022 02:36:52 -0700 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (104.47.56.170) by edgegateway.intel.com (192.55.55.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2308.27; Wed, 27 Apr 2022 02:36:52 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=beToFNt03CEQtdpmKf/SVrxiw2ES8EAXzNBIYCqES9VN+hJHyR2JcuAKTLdUnxnq5GJzaY+dex1O+J2MG0fcV6+3Byiwn7/ISV+hBFvT8G+DxMPuXHMEOahVm9cwGmHf0lpRTC7fS8vABYBTjxXzsS3840qtLWaPG6ha/jiXiGnOX9SzZ1Bs5e6vrO3GbAFD8BVG/Bh5axX5swFCY3WhFqXUU525yMVa2YF7UuSixO9D4fPqSULReU3/Q813QvajySxWqTWYoFitkDrbtVSXlrLc4Y8rEomFBtEXel0g+sk6s8JDFbJDPkN0zQY6sI5T9IbsaTz5ZxeoAoqqfr5wug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=90vtb3OQB7iITcmvvvfVxz7E4cFfhv0Xg3/Tie02Otw=; b=MnQQVazXDSp2/lmxl8seqzAZy7HpZUo2OPR1aMb2/FZK1lE4F93Q0u9HaXdhC+skJHzJwNw1wFV1cLvyiGYyvurWcv2L7OdJ22sEHEx1wy24uhkRIjljcxaRoPJDQ4+xBjQ67nxreAKsmfOr3qjVAIBeHRvKS/ft0wE+WnJOuOF8O4uB8dy63MbDLep5lMihPqPgxD1GCoN8umkR8Orbb+vP4tf7yBf/Kd2sxaPN1+0K0sptcfHHX4xfA02I4XtobVPhb8OtsHD2utdO+t5OgcQQWIzUdt20lnoRvuacVttGrDPklDLZMg+w9gQojK6CB7dZnTb/fmZJbr6yamnqWA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Received: from DM8PR11MB5670.namprd11.prod.outlook.com (2603:10b6:8:37::12) by CY4PR11MB1768.namprd11.prod.outlook.com (2603:10b6:903:11b::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5186.13; Wed, 27 Apr 2022 09:36:50 +0000 Received: from DM8PR11MB5670.namprd11.prod.outlook.com ([fe80::5dc9:53d7:3ece:fa2d]) by DM8PR11MB5670.namprd11.prod.outlook.com ([fe80::5dc9:53d7:3ece:fa2d%2]) with mapi id 15.20.5186.021; Wed, 27 Apr 2022 09:36:50 +0000 From: "Dumitrescu, Cristian" To: "Danilewicz, MarcinX" , "dev@dpdk.org" Subject: RE: [PATCH v3] sched: enable/disable TC OV at runtime Thread-Topic: [PATCH v3] sched: enable/disable TC OV at runtime Thread-Index: AQHYWhUYjAKP/cdvoEWc0/B3jtyvYK0Df+XQ Date: Wed, 27 Apr 2022 09:36:50 +0000 Message-ID: References: <20220427085848.491395-1-marcinx.danilewicz@intel.com> In-Reply-To: <20220427085848.491395-1-marcinx.danilewicz@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-version: 11.6.401.20 dlp-reaction: no-action dlp-product: dlpe-windows authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 882b938c-419f-40c4-54a0-08da283174e3 x-ms-traffictypediagnostic: CY4PR11MB1768:EE_ x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: BdceO9SMqql6iyDp6u/rKFJg5nRzBuagIa4VhvVhzydUXzqV9qv9PmXnC6wt2XZxGg1L5DHm3ZCCYq7dlp37uEe+GilCWaArXwQXjqG3ibzj3oZSb3eWkhnLTrvW1AXRVQiXHQDJWh9Y1McbRhjcJtI9amvZ7cv3ek45NMARo+N+0mfKLTdXuzFo5pQrO8xAmKthKp+fNoJkICpaeGZcxr/gjxXkb0MovfXqf+k1Yp+ZJs/4R9NuSLCCZ0FsRV/zSPjf76kCvds/A0KPQXCsz7yCUhHp4xMd0NGKQmbxV6p9Gnb+Y09GEL8LXLlKDgPt68q3Q/NJJWA/p9AdDG6k2pz+l5jO3cNViq5lItWVNFG4yrYWDr7bSkCMG1AaNJA6q7jquEjNsOnQRd/bxkQOLP1t2uIgCUNojKFX3Zzy6GZK2b+sFqrXw5S20nIlrEWBSdzNyXEHuQ5dgwkiwdX0EgjvRKZpAt/LRli1ahKtysz1XBQKoi2vrVMEXK7E72xgErSJOlRdfJbhGVrI0/eqL6Foc8reotluY+Qukib12k72vYUEnUVZeywQm5Fmcs4OWUAJJyHr3mgaD3qjFmJ6TnazdtMj3imhGuBdLQdX0uynf/0v5T0T4lnRKxN/iHMGqMAa94VYBIWOa8DvE7O/61+J6W8uSrEUBkzV+ri1SSKWh4OwmCOlrhWM+o3f3oP1g984HB1FKg4ZLLLqxjxWBQ== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM8PR11MB5670.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(366004)(66556008)(64756008)(66946007)(76116006)(186003)(508600001)(66476007)(66446008)(71200400001)(26005)(7696005)(6506007)(316002)(33656002)(8676002)(53546011)(122000001)(2906002)(55016003)(110136005)(9686003)(82960400001)(86362001)(8936002)(52536014)(30864003)(5660300002)(83380400001)(38100700002)(38070700005); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?JeQA3wSorhdKlAu+XSllFAIY5nl3zaKL0895Zt6HMgJRxws26NtL8qX1HclV?= =?us-ascii?Q?TMnsjryic6dpAiQ9qHVJlVQRLDAgKxd28b00+AXzn7am3maLp4kiZC+2tWR9?= =?us-ascii?Q?vbKakmbtoqwkvCpoEZW1Jk/Jz1w5rmAgQyaksTIMGeXy45W3XtmbXHpi9laF?= =?us-ascii?Q?S+CaSaA/t2Qx2apw8yjku3ko5QWLSy22Td8qxaitMPlxR2hp1UL37/ulguba?= =?us-ascii?Q?MdRYxSYupWCRFpniPs9lPNJMEOA9a4dOQuGpiCpvJQBmU8vBlibwpT1U2HVO?= =?us-ascii?Q?Gcehn0LNCVV+/zWLyAxgagUmOWfOINu7Qy6Piu/50dtE0BVuehl9Wk3m1MVQ?= =?us-ascii?Q?818p4lSIwaJuAWS9K/bfpSjeUCdDz+uytd4y7rofY2SoUghGLZUQZ299DU4H?= =?us-ascii?Q?8HfB0jH9oTEPVXPfU5QqhiBZLa/pskjPUGhO3GFTjG7gfySo7TQvr6Jc/qBj?= =?us-ascii?Q?kXUZLSexgvEyG2+LcvfvLeyCJwGy2CUEHS2z/3VAw7r71IJUayviEgH5wiTe?= =?us-ascii?Q?wG7rgXRCopa4BgjssN9dtYeU3ErVlo4w1AAa8DnWg/bVjzan6zfIz3siDyE/?= =?us-ascii?Q?g46vX8ndvnX21koQyIiyn0pLBqCCQygRNkD0GLopasjg3cNOh4j8Jt2cjVv0?= =?us-ascii?Q?Y5SzqG3ciLbPtfMKGa2xFKYt6fttTTNtMRs4A6Vd5oyL/AvEUfg9vgl5yWL3?= =?us-ascii?Q?WuloTRUwHgcFzH3j1ini3uUGWxoMdTACPxY70LOekJHI4KluEcxwoFJ+GxHJ?= =?us-ascii?Q?BhAcYRgc9yakJ3d1sfqQQYFmj3OMGnbH3KRym4RhaOa6k1EE7zTeFGmvglq5?= =?us-ascii?Q?eiLDb3+EWgluHnRtmvitf4pQTlT4SUoaaiQYaX4/rCTjUex7XCt78haohgF4?= =?us-ascii?Q?jICgzi9301VEutGE9s8W+XRNkKaD4Jk6xLkmLb2F14LGWtyBraKDemGEyDO5?= =?us-ascii?Q?x2fuLqYnRf6t15W7zG3pS1xeB347MmJHYc31ie2TNp1CM1MkBgzPowFxQ2A3?= =?us-ascii?Q?R3659qn1StUKdZ6qO3LGXrXx5eBZcJ8Kyb+fUV0frD1cU3jHbwsBUsjk38u/?= =?us-ascii?Q?SiJZ7xAG1+gY1rLTZD0zftxTAQHAD4QN84YmcPJOEwLl4s+xNE2TinffvO7Y?= =?us-ascii?Q?4wl1m6ajrozZhIOwpgs3MCvWwZZoZsUNZrPj+D/dQlEzk8eu/CwBo1Icu1ky?= =?us-ascii?Q?/zppzFKqKP1XCgr5vUwkICOzFsDRLDK/cs5PUhb51DkcmtdsCGIRxwU0JcvM?= =?us-ascii?Q?mQtzsSON9zb0OGxxhBK2haRJzOLLYmCTjAdQAy3lpq97T87kMN4SV+Rd2ncL?= =?us-ascii?Q?q8L0C2Oc94d3lZjMLBlfgZEqUE6qLdzJ+PrDiammVxkGU81zTJALUVnaAXLe?= =?us-ascii?Q?n3ZTvcdt1E9TH95XhGHrB0Bnq0Xkqo9bVKGg/8sdiSdiGzNzufjE5qztBtrG?= =?us-ascii?Q?thqAwCaps3rkjmU6XUyOd/0wq6CixB6UHtEkpcDDE0fk6igfnYi4Ho2E2Pqi?= =?us-ascii?Q?Dg2+PSV4DBbcoA/5HIaybNjLSagqG8KICWWJN2q7EymDP0nG091IqSAo3Aaz?= =?us-ascii?Q?YmNzf9z6RroI0L/G0a28vzN18uk+9UBj8xXgRGr2B/KHa6nzo5cx1Eie6lxF?= =?us-ascii?Q?Vdx77dWHIDDSq6jRqas4LBOcbMSTJwgUNbkRH6fDRAAuBpl8ls0JjKqUQC+y?= =?us-ascii?Q?dXdCmaXON4eO8v382KDsVwkY3ZMp+c1iDUnQwteMoeS4G3U6VDnpJko8k09a?= =?us-ascii?Q?bIyMM2XKehi0NUtkCtV7DH9QX9oMWGg=3D?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DM8PR11MB5670.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 882b938c-419f-40c4-54a0-08da283174e3 X-MS-Exchange-CrossTenant-originalarrivaltime: 27 Apr 2022 09:36:50.5441 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: ymd/+/V4LIq/AIlzRoewYPoDq6mtUODQpAqS8sZMWJMY3rW+WfRAtA3Qj97+cL7kG9S+9Ce22cFG3CBBegZHdO72jz/J+V36tEO+6Pv3Nsg= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR11MB1768 X-OriginatorOrg: intel.com X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Marcin, Every time you send a new version, you need to copy the maintainers and the= other relevant people, otherwise there is a high chance we are not going t= o see your patch, thanks! I only saw this one due to pure chance ;) Regards, Cristian > -----Original Message----- > From: Marcin Danilewicz > Sent: Wednesday, April 27, 2022 9:59 AM > To: dev@dpdk.org > Subject: [PATCH v3] sched: enable/disable TC OV at runtime >=20 > Added new API to enable or disable TC over subscription for best > effort traffic class at subport level. > Added changes after review and increased throughput. >=20 > By default TC OV is disabled. >=20 > Signed-off-by: Marcin Danilewicz > --- > lib/sched/rte_sched.c | 189 +++++++++++++++++++++++++++++++++++------- > lib/sched/rte_sched.h | 18 ++++ > lib/sched/version.map | 3 + > 3 files changed, 178 insertions(+), 32 deletions(-) >=20 > diff --git a/lib/sched/rte_sched.c b/lib/sched/rte_sched.c > index ec74bee939..6e7d81df46 100644 > --- a/lib/sched/rte_sched.c > +++ b/lib/sched/rte_sched.c > @@ -213,6 +213,9 @@ struct rte_sched_subport { > uint8_t *bmp_array; > struct rte_mbuf **queue_array; > uint8_t memory[0] __rte_cache_aligned; > + > + /* TC oversubscription activation */ > + int is_tc_ov_enabled; > } __rte_cache_aligned; >=20 > struct rte_sched_port { > @@ -1165,6 +1168,45 @@ rte_sched_cman_config(struct rte_sched_port > *port, > } > #endif >=20 > +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 =3D=3D NULL) { > + RTE_LOG(ERR, SCHED, > + "%s: Incorrect value for parameter port\n", __func__); > + return -EINVAL; > + } > + > + if (subport_id >=3D port->n_subports_per_port) { > + RTE_LOG(ERR, SCHED, > + "%s: Incorrect value for parameter subport id\n", > __func__); > + return -EINVAL; > + } > + > + s =3D port->subports[subport_id]; > + s->is_tc_ov_enabled =3D tc_ov_enable ? 1 : 0; > + > + if (s->is_tc_ov_enabled) { > + /* TC oversubscription */ > + s->tc_ov_wm_min =3D port->mtu; > + s->tc_ov_period_id =3D 0; > + s->tc_ov =3D 0; > + s->tc_ov_n =3D 0; > + s->tc_ov_rate =3D 0; > + > + profile =3D port->subport_profiles + s->profile; > + s->tc_ov_wm_max =3D rte_sched_time_ms_to_bytes(profile- > >tc_period, > + s->pipe_tc_be_rate_max); > + s->tc_ov_wm =3D s->tc_ov_wm_max; > + } > + return 0; > +} > + > int > rte_sched_subport_config(struct rte_sched_port *port, > uint32_t subport_id, > @@ -1254,6 +1296,9 @@ rte_sched_subport_config(struct rte_sched_port > *port, > s->n_pipe_profiles =3D params->n_pipe_profiles; > s->n_max_pipe_profiles =3D params->n_max_pipe_profiles; >=20 > + /* TC over-subscription is disabled by default */ > + s->is_tc_ov_enabled =3D 0; > + > #ifdef RTE_SCHED_CMAN > if (params->cman_params !=3D NULL) { > s->cman_enabled =3D true; > @@ -1316,13 +1361,6 @@ rte_sched_subport_config(struct rte_sched_port > *port, >=20 > for (i =3D 0; i < RTE_SCHED_PORT_N_GRINDERS; i++) > s->grinder_base_bmp_pos[i] =3D > RTE_SCHED_PIPE_INVALID; > - > - /* TC oversubscription */ > - s->tc_ov_wm_min =3D port->mtu; > - s->tc_ov_period_id =3D 0; > - s->tc_ov =3D 0; > - s->tc_ov_n =3D 0; > - s->tc_ov_rate =3D 0; > } >=20 > { > @@ -1342,9 +1380,6 @@ rte_sched_subport_config(struct rte_sched_port > *port, > else > profile->tc_credits_per_period[i] =3D 0; >=20 > - s->tc_ov_wm_max =3D rte_sched_time_ms_to_bytes(profile- > >tc_period, > - s- > >pipe_tc_be_rate_max); > - s->tc_ov_wm =3D s->tc_ov_wm_max; > s->profile =3D subport_profile_id; >=20 > } > @@ -1417,17 +1452,20 @@ rte_sched_pipe_config(struct rte_sched_port > *port, > double pipe_tc_be_rate =3D > (double) params- > >tc_credits_per_period[RTE_SCHED_TRAFFIC_CLASS_BE] > / (double) params->tc_period; > - uint32_t tc_be_ov =3D s->tc_ov; >=20 > - /* Unplug pipe from its subport */ > - s->tc_ov_n -=3D params->tc_ov_weight; > - s->tc_ov_rate -=3D pipe_tc_be_rate; > - s->tc_ov =3D s->tc_ov_rate > subport_tc_be_rate; > + if (s->is_tc_ov_enabled) { > + uint32_t tc_be_ov =3D s->tc_ov; >=20 > - if (s->tc_ov !=3D tc_be_ov) { > - RTE_LOG(DEBUG, SCHED, > - "Subport %u Best-effort TC oversubscription is > OFF (%.4lf >=3D %.4lf)\n", > - subport_id, subport_tc_be_rate, s- > >tc_ov_rate); > + /* Unplug pipe from its subport */ > + s->tc_ov_n -=3D params->tc_ov_weight; > + s->tc_ov_rate -=3D pipe_tc_be_rate; > + s->tc_ov =3D s->tc_ov_rate > subport_tc_be_rate; > + > + if (s->tc_ov !=3D tc_be_ov) { > + RTE_LOG(DEBUG, SCHED, > + "Subport %u Best-effort TC > oversubscription is OFF (%.4lf >=3D %.4lf)\n", > + subport_id, subport_tc_be_rate, s- > >tc_ov_rate); > + } > } >=20 > /* Reset the pipe */ > @@ -1460,19 +1498,22 @@ rte_sched_pipe_config(struct rte_sched_port > *port, > double pipe_tc_be_rate =3D > (double) params- > >tc_credits_per_period[RTE_SCHED_TRAFFIC_CLASS_BE] > / (double) params->tc_period; > - uint32_t tc_be_ov =3D s->tc_ov; >=20 > - s->tc_ov_n +=3D params->tc_ov_weight; > - s->tc_ov_rate +=3D pipe_tc_be_rate; > - s->tc_ov =3D s->tc_ov_rate > subport_tc_be_rate; > + if (s->is_tc_ov_enabled) { > + uint32_t tc_be_ov =3D s->tc_ov; > + > + s->tc_ov_n +=3D params->tc_ov_weight; > + s->tc_ov_rate +=3D pipe_tc_be_rate; > + s->tc_ov =3D s->tc_ov_rate > subport_tc_be_rate; >=20 > - if (s->tc_ov !=3D 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); > + if (s->tc_ov !=3D 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 =3D s->tc_ov_period_id; > + p->tc_ov_credits =3D s->tc_ov_wm; > } > - p->tc_ov_period_id =3D s->tc_ov_period_id; > - p->tc_ov_credits =3D s->tc_ov_wm; > } >=20 > return 0; > @@ -2318,6 +2359,45 @@ grinder_credits_update(struct rte_sched_port > *port, > pipe->tb_credits =3D RTE_MIN(pipe->tb_credits, params->tb_size); > pipe->tb_time +=3D n_periods * params->tb_period; >=20 > + /* Subport TCs */ > + if (unlikely(port->time >=3D subport->tc_time)) { > + for (i =3D 0; i < RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE; i++) > + subport->tc_credits[i] =3D sp->tc_credits_per_period[i]; > + > + subport->tc_time =3D port->time + sp->tc_period; > + } > + > + /* Pipe TCs */ > + if (unlikely(port->time >=3D pipe->tc_time)) { > + for (i =3D 0; i < RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE; i++) > + pipe->tc_credits[i] =3D params->tc_credits_per_period[i]; > + pipe->tc_time =3D port->time + params->tc_period; > + } > +} > + > +static inline void > +grinder_credits_update_with_tc_ov(struct rte_sched_port *port, > + struct rte_sched_subport *subport, uint32_t pos) > +{ > + struct rte_sched_grinder *grinder =3D subport->grinder + pos; > + struct rte_sched_pipe *pipe =3D grinder->pipe; > + struct rte_sched_pipe_profile *params =3D grinder->pipe_params; > + struct rte_sched_subport_profile *sp =3D grinder->subport_params; > + uint64_t n_periods; > + uint32_t i; > + > + /* Subport TB */ > + n_periods =3D (port->time - subport->tb_time) / sp->tb_period; > + subport->tb_credits +=3D n_periods * sp->tb_credits_per_period; > + subport->tb_credits =3D RTE_MIN(subport->tb_credits, sp->tb_size); > + subport->tb_time +=3D n_periods * sp->tb_period; > + > + /* Pipe TB */ > + n_periods =3D (port->time - pipe->tb_time) / params->tb_period; > + pipe->tb_credits +=3D n_periods * params->tb_credits_per_period; > + pipe->tb_credits =3D RTE_MIN(pipe->tb_credits, params->tb_size); > + pipe->tb_time +=3D n_periods * params->tb_period; > + > /* Subport TCs */ > if (unlikely(port->time >=3D subport->tc_time)) { > subport->tc_ov_wm =3D > @@ -2348,6 +2428,39 @@ grinder_credits_update(struct rte_sched_port > *port, > static inline int > grinder_credits_check(struct rte_sched_port *port, > struct rte_sched_subport *subport, uint32_t pos) > +{ > + struct rte_sched_grinder *grinder =3D subport->grinder + pos; > + struct rte_sched_pipe *pipe =3D grinder->pipe; > + struct rte_mbuf *pkt =3D grinder->pkt; > + uint32_t tc_index =3D grinder->tc_index; > + uint64_t pkt_len =3D pkt->pkt_len + port->frame_overhead; > + uint64_t subport_tb_credits =3D subport->tb_credits; > + uint64_t subport_tc_credits =3D subport->tc_credits[tc_index]; > + uint64_t pipe_tb_credits =3D pipe->tb_credits; > + uint64_t pipe_tc_credits =3D pipe->tc_credits[tc_index]; > + int enough_credits; > + > + /* Check pipe and subport credits */ > + enough_credits =3D (pkt_len <=3D subport_tb_credits) && > + (pkt_len <=3D subport_tc_credits) && > + (pkt_len <=3D pipe_tb_credits) && > + (pkt_len <=3D pipe_tc_credits); > + > + if (!enough_credits) > + return 0; > + > + /* Update pipe and subport credits */ > + subport->tb_credits -=3D pkt_len; > + subport->tc_credits[tc_index] -=3D pkt_len; > + pipe->tb_credits -=3D pkt_len; > + pipe->tc_credits[tc_index] -=3D pkt_len; > + > + return 1; > +} > + > +static inline int > +grinder_credits_check_with_tc_ov(struct rte_sched_port *port, > + struct rte_sched_subport *subport, uint32_t pos) > { > struct rte_sched_grinder *grinder =3D subport->grinder + pos; > struct rte_sched_pipe *pipe =3D grinder->pipe; > @@ -2403,8 +2516,16 @@ grinder_schedule(struct rte_sched_port *port, > uint32_t pkt_len =3D pkt->pkt_len + port->frame_overhead; > uint32_t be_tc_active; >=20 > - if (!grinder_credits_check(port, subport, pos)) > - return 0; > + switch (subport->is_tc_ov_enabled) { > + case 1: > + if (!grinder_credits_check_with_tc_ov(port, subport, pos)) > + return 0; > + break; > + case 0: > + if (!grinder_credits_check(port, subport, pos)) > + return 0; > + break; > + } >=20 > /* Advance port time */ > port->time +=3D pkt_len; > @@ -2770,7 +2891,11 @@ grinder_handle(struct rte_sched_port *port, > subport->profile; >=20 > grinder_prefetch_tc_queue_arrays(subport, pos); > - grinder_credits_update(port, subport, pos); > + > + if (unlikely(subport->is_tc_ov_enabled)) > + grinder_credits_update_with_tc_ov(port, subport, pos); > + else > + grinder_credits_update(port, subport, pos); >=20 > grinder->state =3D e_GRINDER_PREFETCH_MBUF; > return 0; > diff --git a/lib/sched/rte_sched.h b/lib/sched/rte_sched.h > index 5ece64e527..94febe1d94 100644 > --- a/lib/sched/rte_sched.h > +++ b/lib/sched/rte_sched.h > @@ -579,6 +579,24 @@ rte_sched_port_enqueue(struct rte_sched_port *port, > struct rte_mbuf **pkts, uint > int > rte_sched_port_dequeue(struct rte_sched_port *port, struct rte_mbuf **pk= ts, > uint32_t n_pkts); >=20 > +/** > + * Hierarchical scheduler subport TC OV enable/disable config. > + * Note that this function is safe to use at runtime > + * to enable/disable TC OV for subport. > + * > + * @param port > + * Handle to port scheduler instance > + * @param subport_id > + * Subport ID > + * @param tc_ov_enable > + * Boolean flag to enable/disable TC OV > + * @return > + * 0 upon success, error code otherwise > + */ > +__rte_experimental > +int > +rte_sched_subport_tc_ov_config(struct rte_sched_port *port, uint32_t > subport_id, bool tc_ov_enable); > + > #ifdef __cplusplus > } > #endif > diff --git a/lib/sched/version.map b/lib/sched/version.map > index d22c07fc9f..c6e994d8df 100644 > --- a/lib/sched/version.map > +++ b/lib/sched/version.map > @@ -34,4 +34,7 @@ EXPERIMENTAL { > # added in 21.11 > rte_pie_rt_data_init; > rte_pie_config_init; > + > + # added in 22.03 > + rte_sched_subport_tc_ov_config; > }; > -- > 2.25.1 >=20 > -------------------------------------------------------------- > Intel Research and Development Ireland Limited > Registered in Ireland > Registered Office: Collinstown Industrial Park, Leixlip, County Kildare > Registered Number: 308263 >=20 >=20 > This e-mail and any attachments may contain confidential material for the= sole > use of the intended recipient(s). Any review or distribution by others is > strictly prohibited. If you are not the intended recipient, please contac= t the > sender and delete all copies.