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 EF338A04FF; Wed, 27 Apr 2022 17:59:45 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D82F8427FA; Wed, 27 Apr 2022 17:59:44 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by mails.dpdk.org (Postfix) with ESMTP id C64144113F for ; Wed, 27 Apr 2022 17:59:42 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1651075183; x=1682611183; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=ZPn0D+BH2OhEPGS1LwxjF4Fe0UyO4RiErSoyDc5icVs=; b=atHHBHXHfSx8C6AQsWr/cwUPquVdC/k5hBfzQBy5tt7GM9ekNw2WhS/S xCehl+FEgJSBZ8tdlbeFhoOka16RL3XGt/5rzs2xrB5ddQbggVjI7Xcss P2xuOnbewoxJKMF0AEbgTSC5DKMTWY30XGRDzn6xsrpsxq2LxanmNJpu6 TSTTHWzWycai1gllluOZw7V+cL4Uw3NJtj30pFzN8tYm0CdPe8Y4aqkni HJuRS7LYufvI0UXLWDaiPiTRUvVANHVy/o0WuVVWtDGucaewcb0qnmLfq 9FBFiuqH6x1oo1z9PvaLhfxCwSaenF189P9slWQ91OKw3dw5svX8cgG1f A==; X-IronPort-AV: E=McAfee;i="6400,9594,10330"; a="291129326" X-IronPort-AV: E=Sophos;i="5.90,293,1643702400"; d="scan'208";a="291129326" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Apr 2022 08:48:28 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.90,293,1643702400"; d="scan'208";a="513739271" Received: from orsmsx603.amr.corp.intel.com ([10.22.229.16]) by orsmga003.jf.intel.com with ESMTP; 27 Apr 2022 08:48:27 -0700 Received: from orsmsx602.amr.corp.intel.com (10.22.229.15) by ORSMSX603.amr.corp.intel.com (10.22.229.16) 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 08:48:27 -0700 Received: from ORSEDG601.ED.cps.intel.com (10.7.248.6) by orsmsx602.amr.corp.intel.com (10.22.229.15) 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 08:48:27 -0700 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (104.47.70.109) by edgegateway.intel.com (134.134.137.102) 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 08:48:27 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HUU6d6F5qXQcMeCySxJH73vAdPv1JayoKWBJBoew/HL8CmukyiiTzXSZA9ofPbJge1k6lYMMCHp9/TyAmayAzgV0Pb5IFLuvdDjapSq8j6rb9ZFMuHrGFwhvPJgmbVQDGVh/bPQ9g7pQXlOjSXnF3JVo/R7hC7xXMdTZlaEFFl4Dx5jEd6awB4hXdNEB8PZj+VVOYFJ5FvHhjcKc3o0kNBIj/6Smp4AoGmY8nzCkkYmcY5MRt62BDPNnCrJ82hLdkMkKxEgQnQ/Eym47vB7XBu5fZx7YdAshhTYmgllBS5GAahKBq3435XOIFMsaR34TdrgchyaKvNzig6R69xpY0Q== 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=B5VBoSZaXr8qz248Z2YxAPChaA5MlCmHvbjYp6BloZ0=; b=lue1GR9JTeQ4j1OZ7DcbzTsAmkCbX0FO2CQ2/DM1t7rMw+ECzp3gSJvfUqXOVkD+yakvrKZCsd158EqFc76jU2+3du2wVckJZ3ZRZNKLVDkuETSrCEesAZNfy5R3yDhqUe0jvHOfyNz6BhgnwLFFAWMJcuDG0SU6vQY3in8nbSEEI3QJuz/Fugk6kjsk1PYEHzaNx7YYHfe5dRzNFfYv78G5Jz4z9I0o4b3iOUulEeOui4BkDvsnWFCnjC2OYF4/hb7/muxD3D9yJdN/VvcYvLNQIkr3fq98qbAkOWpWGIokg320XHWmpTdydmQU3DvPGGoMWLoouxzbviYmlUwP3A== 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 CY4PR11MB1589.namprd11.prod.outlook.com (2603:10b6:910:e::13) by BN6PR11MB3970.namprd11.prod.outlook.com (2603:10b6:405:7a::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5186.17; Wed, 27 Apr 2022 15:48:25 +0000 Received: from CY4PR11MB1589.namprd11.prod.outlook.com ([fe80::957b:7559:687e:bcb3]) by CY4PR11MB1589.namprd11.prod.outlook.com ([fe80::957b:7559:687e:bcb3%12]) with mapi id 15.20.5186.021; Wed, 27 Apr 2022 15:48:25 +0000 From: "Singh, Jasvinder" To: "Danilewicz, MarcinX" , "dev@dpdk.org" , "Dumitrescu, Cristian" CC: "Ajmera, Megha" Subject: RE: [PATCH v3] sched: enable/disable TC OV at runtime Thread-Topic: [PATCH v3] sched: enable/disable TC OV at runtime Thread-Index: AQHYWhiOG9eTM/bSFEWBG0FjmcQKKa0D5n7w Date: Wed, 27 Apr 2022 15:48:25 +0000 Message-ID: References: <20220407145153.238969-2-marcinx.danilewicz@intel.com> <20220427092357.491720-1-marcinx.danilewicz@intel.com> In-Reply-To: <20220427092357.491720-1-marcinx.danilewicz@intel.com> Accept-Language: en-GB, 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: 5a5e5e70-4e20-4138-7230-08da28655d7e x-ms-traffictypediagnostic: BN6PR11MB3970: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: aNP2lJkb7Z5lRAtdr2UZ9lX8DW+ejDtQUzhUkJNkkszrwNicstTBb02NJtjMCtBVxagtuOvluyPYti8tuLk8u/I5Q95HSH470G3E7De/p1OnAOdiXKRNoz3KTYlR8tC0azMncZll48IZqTAsZtmApj+34T3+xHE8bBOV+6uOr3R8gBucsfQKD0ll2+H1w/o6pLQ/aO8gcgBCqpqLLwC2Ueatr6QuRV6UyIkjORi6PVrZbu2lPu2giM+UkghzDmDrVcfAvMeGlBXRDBkwwuyBRKPe27sdseLOizXdfBxysw3cfNSrvtuSjQxFpiVKzd8g7Cnn8UIZXK6UqrB/ME6myl3FPymuRfXoMX7vKYrPpTY0oJwEApp3ExSsQsySXKYPRGUejiUqACvRnPzmBrt5aI+DeGCZaHrN0mOjCpv9MYxjTcagweUyj1qIXArvjOuNwkLsHVc2+UF2vYko6hU2/YGScIXufE9LpHHSVMlLly4eVAiuKqZgpM/Tm784I1O8rMJeLbogG98Hk16B1B1iADQuUyq4IyqrAnzyylg4O4TSMFTGRPOLnlXQIM5Ku+zHfUfiYKsxwaiGLb/1YOZ29zflNgPu+l2hbfjDefocizgO8RiTOt2yUzReigqDxK8HQwBcJvcVrLXJ61O9gPTfatxsbrRgswIc3kFd4vMY2imv8HvqLPzrmGx0EALoYfiUpKOruTJZlpG0M0UteGSh5Q== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CY4PR11MB1589.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(366004)(186003)(52536014)(30864003)(38100700002)(508600001)(110136005)(8676002)(66476007)(66946007)(4326008)(107886003)(33656002)(76116006)(66556008)(66446008)(64756008)(2906002)(8936002)(26005)(86362001)(55016003)(83380400001)(5660300002)(6636002)(316002)(53546011)(71200400001)(6506007)(7696005)(9686003)(82960400001)(122000001)(38070700005); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?M4Sr0zWoFGEbn6KJgK1S5hbRQ01tWu6vRH77LUi8M+/zEd7OOgc4yEc7GGku?= =?us-ascii?Q?ov7TvmLDbDK/lJrmd1/6qDaz+TsF2e6Bq5qPwdjEoXLJDUi7gSdQ3KLDpdc2?= =?us-ascii?Q?80dQZ0XaKbbqOczFFfepuj8xOd6wwN7UKBMxTrsoKDfh/VED6HMX3AIfkToo?= =?us-ascii?Q?JvLv+iEW4nOcI17EnbbwFkyQNKH9JrszJmsLin/da+RQ5Xp0/gXuRtO66QcR?= =?us-ascii?Q?YFFvOalWOQtO7UFsT0U6alVA2+OQwIaLNVU9Us6L31XfPLeWKE1bTxVHqj7/?= =?us-ascii?Q?Wh0YQGOeOn2rwgQ2erTG8P7IFF9T708l6CRvY0pj/C2BeRk4xKIzZrRhvAaF?= =?us-ascii?Q?T8tGGZ+oklMMOueDm2SwSkm5bvvM5Dxlsl2RaBTdUeJ40VPtrcIolF5sJBa5?= =?us-ascii?Q?sTlOfhLRGWpOmc1KfsrE8bPKprNbn1nkQHgdSmw6a1b5xVwgwcVdCXZPoPue?= =?us-ascii?Q?fUnP+iEBoAsXqJhN/lJMKYhqMmuc8mdsicHs23KnYSPgrGSeqAjJNIorg3ts?= =?us-ascii?Q?YmfrOLYHqCZcEXpS7RqLZ2ZJMGmRAY4lXjSrCGv5MA9WGTvfq8XVejrVgYQg?= =?us-ascii?Q?gDYZo9JptT82aGHsombfs9pqdRkDe46YYagrBHEWjwgzzboHQ+BChErdfA59?= =?us-ascii?Q?bz/bogwqQ3Wb1HHx3TLo4ibKd5lJUnJuAOs213uSttM3dIhKZwZog/+StrY3?= =?us-ascii?Q?d0cT//I+jOQKGbvLi6vzLOu+VQHY/zx/FaLdDsny+nrGPc27nUaZNZ30CAKg?= =?us-ascii?Q?CI3ppktcNQesc5dz0SIUWKXXH9lXeuN1/GoFFFRH3fWb/Aqi3GQdAxcC4BIQ?= =?us-ascii?Q?rHHwQjqrnEKYOIXhmA5uJ21M42/83pbLuhH2Zm6a4PTadoTVOjULx3lm1Dzv?= =?us-ascii?Q?E6C7lVbpubKmHj8O7be1iSKwxt9WxyNY3vTBxKhVKKqMqJZU+TcZ5k/JMaKB?= =?us-ascii?Q?LrTYPUX/bcW9kKeBs4TnxYdaMOF/mgkxZpgldGSznKb16tZmivq19A1DJiBY?= =?us-ascii?Q?GUUtZaIMV4WBOcvThOBqv3lH9vuCBa8mztWYWHlLBuMknC+fsNK2aJ7Mjczk?= =?us-ascii?Q?2ctD/Q2pgU5MdEDkl+3yiAduSpuTqMIHROBwj/Q4NGGcW/3H0fJ0oJoF5fPn?= =?us-ascii?Q?zoUKsJvEuuOAypyLTk7+WP7gHs6NLDNktG+GHHB5EcohJQjbDGOj99NVkyYK?= =?us-ascii?Q?XXKgI0DXcWEK7iug3thlckKTNrtaeaKBlcYSmyomWXzO95+sCJTxE6cZH3VO?= =?us-ascii?Q?hq0CAee9ykrmaxtH8I4VaIHa6F1m2YcAxW9j5xPJyIEsh4fZ41xWs3geeMrO?= =?us-ascii?Q?3asNpralKbLpMaMOL6ljnq4N5HAYhVi4ooXbOjESd0PAkSXq3+tWo00Crsys?= =?us-ascii?Q?ao2Wg0cW2nRnlOq1yh3Z9gy9CEuqVQs6+rxFZCrT1dq2LAmcsVh0F/scRIkA?= =?us-ascii?Q?WraZqG3qMHO9nR4yCshgfLFe4wShLHkzWj/q6UjQT46MSTLWgdxu6RX4oySQ?= =?us-ascii?Q?68xgPUQGihYEXhDPdbEevWYHl4GytRrZmVZLiwndeMZ7AcOgoNNwh5QYn71I?= =?us-ascii?Q?jPBdDsig+YIMuW5daMXAlrHV0gopA3kC3Yr3uNs5M7zb34uL6IC2RFAr1JBQ?= =?us-ascii?Q?Ab0ZItArfbOOn5FLWgtlGWlKNjcP6oF/EXOsMyI0NNZRwA2iP43x7GnZXf8f?= =?us-ascii?Q?QgbXFmmyWzWXnwky6sknD3a97fjNVq0xnGQ3SPGsW5wCFazpAg9e7RV6Gxi9?= =?us-ascii?Q?4aIIV3euOg=3D=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: CY4PR11MB1589.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5a5e5e70-4e20-4138-7230-08da28655d7e X-MS-Exchange-CrossTenant-originalarrivaltime: 27 Apr 2022 15:48:25.1409 (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: OKH6MsbnqzJfwm+9N/p9Pl/AgTs3WXcgrYsFlMCeqYvRYYhrsY+S8ZOLdpA99zojnSQrymefrvilS2768NTZtBGITcqV78X1As4Jf722rME= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR11MB3970 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 > -----Original Message----- > From: Danilewicz, MarcinX > Sent: Wednesday, April 27, 2022 10:24 AM > To: dev@dpdk.org; Singh, Jasvinder ; > Dumitrescu, Cristian > Cc: Ajmera, Megha > 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 *p= ort, > 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 **pkts, 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 Hi Marcin, I don't see any note on the changes made in this version with respect to pr= evious versions. Can you include them in future version? Also, I had some= comments on the first version of this patch, I don't see any response. =20