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 3868BA0C50; Fri, 16 Jul 2021 17:12:04 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id AC5A24067B; Fri, 16 Jul 2021 17:12:03 +0200 (CEST) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by mails.dpdk.org (Postfix) with ESMTP id 602AD40151 for ; Fri, 16 Jul 2021 17:12:00 +0200 (CEST) X-IronPort-AV: E=McAfee;i="6200,9189,10046"; a="274570107" X-IronPort-AV: E=Sophos;i="5.84,245,1620716400"; d="scan'208";a="274570107" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Jul 2021 08:11:59 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.84,245,1620716400"; d="scan'208";a="574338442" Received: from fmsmsx604.amr.corp.intel.com ([10.18.126.84]) by fmsmga001.fm.intel.com with ESMTP; 16 Jul 2021 08:11:59 -0700 Received: from fmsmsx607.amr.corp.intel.com (10.18.126.87) by fmsmsx604.amr.corp.intel.com (10.18.126.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.10; Fri, 16 Jul 2021 08:11:58 -0700 Received: from fmsmsx603.amr.corp.intel.com (10.18.126.83) by fmsmsx607.amr.corp.intel.com (10.18.126.87) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.10; Fri, 16 Jul 2021 08:11:58 -0700 Received: from FMSEDG603.ED.cps.intel.com (10.1.192.133) by fmsmsx603.amr.corp.intel.com (10.18.126.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.10 via Frontend Transport; Fri, 16 Jul 2021 08:11:58 -0700 Received: from NAM02-DM3-obe.outbound.protection.outlook.com (104.47.56.40) by edgegateway.intel.com (192.55.55.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2242.10; Fri, 16 Jul 2021 08:11:58 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NCFSbSIr25dqbYSvbpuTMiS4bgrS5mvN3zJDCwFPmiggS1k3m5Q5KBsec7baCzdAVfN2lRBOlhQMqKsOgnjXYn/V8ucGsIHgNJKi8jWQgdXDxywEN0CKmYqpBx/Er5uFAoN3bPQ/aY18JInQB2PBzw10Qx9fJbBqZP7rtPiL3KUHnfXf4g8PJ/M0eS0530xyl7ulHxgDPmeiuewSWiH0W5y2qDDplZTakvxWMUyPr+rO5+ze9G3Ahu6nP/FWNIpxAOD9Ft7XdWL816iS6ufqwYAm3l8P6GT01Zr5j4hY0oQKaUtS0rcX+s6ZjiVwR44rjRhgXCLPLY5tJ8TO5vy7xg== 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-SenderADCheck; bh=AG3V9GGB1fTJsM4LUo/gYf1DRIA5sQDugHQWZLDebX8=; b=LF3gQQcPgSoeVmpfgj4xQIchF++MxT17+3Hpe3wlVNm8+Avnj6DKrPpR2JzKVf3b0xilNYl6bdVSzHMG9+jFLt8awHJaBUtSQvyVHKtKPKrh0ooscX42D+Cy7Yxaps/EIJEibm2oRUEJl8unrYwY1IH0Ci8Fl/I/rELjnf09KaOR074CT/EGIqPAujvSkmkQZvwuBup7xNmMuwaCJrSWttPStfKuRp4sEmaGd34SSw9c9zyhlZ/SRjMOc/NQL9F4b3NfzH7UlBAlj70UuHXGA7RY8Q+oabNhWIGwpg1+hXcBzy0MOfsTDdJRGiH1ueUVQtpSIiiGL47gEG6PPA4Gkg== 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=AG3V9GGB1fTJsM4LUo/gYf1DRIA5sQDugHQWZLDebX8=; b=m7IMwFc9gLt9uvQuiVwfzNJqQ/kbggwkUplDHFacDzUtTPdOIUASuVMlu0pA9BlSkcgGUAs55FnnH7CY+yGAX3CRXtkLpVx2/clYxD6mlgRW4T9AXpPF+R5Hbo5LdfdyAtEyIWiGWK8nH7lyazUNPJektJPfiX8cxnzcKswLcQg= Received: from DM8PR11MB5670.namprd11.prod.outlook.com (2603:10b6:8:37::12) by DM8PR11MB5621.namprd11.prod.outlook.com (2603:10b6:8:38::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4331.24; Fri, 16 Jul 2021 15:11:56 +0000 Received: from DM8PR11MB5670.namprd11.prod.outlook.com ([fe80::4e4:c86b:b091:bc26]) by DM8PR11MB5670.namprd11.prod.outlook.com ([fe80::4e4:c86b:b091:bc26%3]) with mapi id 15.20.4331.026; Fri, 16 Jul 2021 15:11:56 +0000 From: "Dumitrescu, Cristian" To: "Liguzinski, WojciechX" , "dev@dpdk.org" , "Singh, Jasvinder" CC: "Dharmappa, Savinay" , "Ajmera, Megha" Thread-Topic: [RFC PATCH v4 1/3] sched: add PIE based congestion management Thread-Index: AQHXcXRuYkjgM5bpAkmN+sxO+IBGMatFqYAA Date: Fri, 16 Jul 2021 15:11:56 +0000 Message-ID: References: <20210621073506.96017-1-wojciechx.liguzinski@intel.com> <20210705080421.18736-1-wojciechx.liguzinski@intel.com> <20210705080421.18736-2-wojciechx.liguzinski@intel.com> In-Reply-To: <20210705080421.18736-2-wojciechx.liguzinski@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-version: 11.5.1.3 dlp-reaction: no-action dlp-product: dlpe-windows authentication-results: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 99f35f98-0cb1-4b3c-6095-08d9486c0d4a x-ms-traffictypediagnostic: DM8PR11MB5621: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:758; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: M/jL5/dEn7YhQmYBXMeNsC9+VJhWMuuRWwTUY5R7zHW0X8Vw+DHD9/A3yAm6Lp0e2TakM1wi6MSMozRcupAaNyQnLqFfXX/GFQVpkHCc2pas6VCeMzpiS6gSG+n+bm/F5WrG/4b0OAfA9ifmeyvD0k6Bqd7Xv6MiCHeVabhSZZJZs8sKBCUPLsyg/sReHLPOgFKvEH77Rwcfza5dG+1+igXcMZOYYcRLbclOait4J1LE6H5FqATwkkrLOgsrAU/85iYtsR626aZRXVtSxkkRgTHhIxeyI17CIWaWgNKz55Wo6092guIgTGVzH53ItFk35OCF9tW8djbcTr7Vp1oq+KKGjAK+LdDqOfByQgA8ta5DlQw8sX5MkKgAhjiAc6h2Ch467ewVAUWMT50qtz7timC3Kw5RmYiJH4Xl9ENOreaKgv4Ul3/aw6LKOXFRJ0W6Lvp5TR2A5wGXB2g3+3lYPwDb895KdbX/rSsr4zfGl82QTAcQ7m7AE1IRlQM0lQWPdzObL+1LglbYNBMlgrpq0u9Gy+ySM90xm1D8wvnSFO1tDjeNGLiEwcM5BSqhSaHFf1ZTDqRMdcTf4xeibmQXgvk+qsbDWFVKU/Zlqihf3kFqTRM83gSod7VNmsYty1zakcV6QswnHm/Q7DnjSrFxfKLQI2PCY2/1DP/Ksa7+ZJrqSfGBampJvG3bkgsf450gXqx3ovuBkWdi+VktO70ZOg== 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:(4636009)(366004)(6636002)(54906003)(52536014)(316002)(107886003)(83380400001)(508600001)(26005)(76116006)(6506007)(122000001)(38100700002)(5660300002)(110136005)(8676002)(53546011)(9686003)(33656002)(4326008)(7696005)(30864003)(86362001)(2906002)(55016002)(66446008)(64756008)(71200400001)(66556008)(66476007)(186003)(8936002)(66946007)(38070700004); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?6IHd+6fuX8VBa+VGeoBzgEaY8EK9g3ym3XBl2Sna/Pb7YU/41r1aOhmnr+H3?= =?us-ascii?Q?Xh8cGNn8+LxcdMIluQECK9op55upHfxVvMtro1rKuqTwI9yQ9BDynJqYG2J2?= =?us-ascii?Q?rVjXjAmr8LR/AMAzG8PKK2QwbE6+xLq/Z+DhamOvgNCX5xPE0XSCdzCWzYWZ?= =?us-ascii?Q?Iuvu/gmeaICFiuFPs7vwGysW2RPGYe6bxsIrRYLq15pUAES9dX0IQtvafATk?= =?us-ascii?Q?KiWWBjiGeJrypl9miB09hbmcelOtpW06prQa9W98AGnhnaiL1/PSdrzKziz+?= =?us-ascii?Q?iDSj/ih0h1cLkAHXwwUqo+qy5vo9MR0jylknwUxnpyE1bwtwMKmRT+wdX99d?= =?us-ascii?Q?8O0v2MvHglgAiYBI0uPmcb1kiWdgUOzeKGflx3MlIJ75JZCBMq7KjeibRfbX?= =?us-ascii?Q?+CLKwUgHo4w6IyDTf0dp/CEPYFnYYU/RFslEDuzah6kVClfNpxeYGw0xyzaP?= =?us-ascii?Q?J2U2FL4Htj8sttj4pn13VxLO/giICKDyn/9m3Uz9NfbNQEQbOdAecmBWFAW1?= =?us-ascii?Q?Su8F1ilqhB/DI2dgEu0cuCL0aIimislzWlxpcQwjxvWRTuhoK2jB+F7MQ/X7?= =?us-ascii?Q?BNFnyJDWUFLR1mt2dm1TdHHgGR0tqu1uFcycWRzZX5qAF1UVsnF8esRxWbGX?= =?us-ascii?Q?eZWimJc2e5Az4fmp+XIXkNIfMRhjUiJzk0G3JZdp4LhDhkxstSGe2tAtU+Xl?= =?us-ascii?Q?W0AbNgRhHG5AnpECVm1IZRTcj7160Xcey03wvyXwEtz9Mv+k3f9nNSqT8xlx?= =?us-ascii?Q?69K3+fjkEjB7fWeq/aktI/lGxkpFYH95fKQ0eHAPuuoLhTsbPU8k0xVqRhcb?= =?us-ascii?Q?pILUu49b70cJP6bXpkWGnf9b7wKGlM371sgrcIM7Zl94K4tZP43A61ncbxHF?= =?us-ascii?Q?1ZifNVV/xQrBkA3jD1onDKzmiWv8qYy7wpIcZPtbUiXpbq2v9qJvtTWpVgOI?= =?us-ascii?Q?ZKdbntGgEaLI580H1x07XOv+lEnjVqqHvb+lpGsekprHVvUa7lF66A/rqXoN?= =?us-ascii?Q?MPSH+UelHb08PwMiGJ0TI5iL3afYluoY2DtTn4UIYIFCoVTzHxHwXxLiZRlz?= =?us-ascii?Q?9b8wT43N/eSERaLbl7KN7tV9d8TlvuYTA4HEwBU2peDmhtBfbSn+rEK1FpC/?= =?us-ascii?Q?F8MjPEcxvuYOfV0vVsdPCiqAif+iwAl53AHJaZAjVim2bVl6x/ttEt3NajQC?= =?us-ascii?Q?1HWhwDIizZ0VDbx76+zB8KgB3XlwuwUhsWwUyxH1YvwqxIxv18ayb3v96e5q?= =?us-ascii?Q?khR2TaUAA50IHOkiw4QdKxW0V4QtNxbwDrYCaIvoYUx2yJ2t5OR8J3SfnGpk?= =?us-ascii?Q?Rbh5GQ4/AvS/qcelB1DFNPno?= 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: 99f35f98-0cb1-4b3c-6095-08d9486c0d4a X-MS-Exchange-CrossTenant-originalarrivaltime: 16 Jul 2021 15:11:56.4210 (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: /2xGVn6BZ3HCt5rOIbMLPfh1zHKoV2Nf3F66WYIVj8+aNYvCh35jZft6n7Rhb/6wPLLK+6anM/vN+S1uxYHHWA+SE9udSJc7ypSlySDSnUc= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM8PR11MB5621 X-OriginatorOrg: intel.com Subject: Re: [dpdk-dev] [RFC PATCH v4 1/3] sched: add PIE based congestion management 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 Sender: "dev" Hi Wojciech, > -----Original Message----- > From: Liguzinski, WojciechX > Sent: Monday, July 5, 2021 9:04 AM > To: dev@dpdk.org; Singh, Jasvinder ; > Dumitrescu, Cristian > Cc: Dharmappa, Savinay ; Ajmera, Megha > > Subject: [RFC PATCH v4 1/3] sched: add PIE based congestion management >=20 > Implement PIE based congestion management based on rfc8033 >=20 > Signed-off-by: Liguzinski, WojciechX > --- > drivers/net/softnic/rte_eth_softnic_tm.c | 6 +- > lib/sched/meson.build | 10 +- > lib/sched/rte_pie.c | 82 +++++ > lib/sched/rte_pie.h | 393 +++++++++++++++++++++++ > lib/sched/rte_sched.c | 229 +++++++++---- > lib/sched/rte_sched.h | 53 ++- > lib/sched/version.map | 3 + > 7 files changed, 685 insertions(+), 91 deletions(-) > create mode 100644 lib/sched/rte_pie.c > create mode 100644 lib/sched/rte_pie.h >=20 > diff --git a/drivers/net/softnic/rte_eth_softnic_tm.c > b/drivers/net/softnic/rte_eth_softnic_tm.c > index 90baba15ce..5b6c4e6d4b 100644 > --- a/drivers/net/softnic/rte_eth_softnic_tm.c > +++ b/drivers/net/softnic/rte_eth_softnic_tm.c > @@ -420,7 +420,7 @@ pmd_tm_node_type_get(struct rte_eth_dev *dev, > return 0; > } >=20 > -#ifdef RTE_SCHED_RED > +#ifdef RTE_SCHED_AQM > #define WRED_SUPPORTED 1 > #else > #define WRED_SUPPORTED 0 > @@ -2306,7 +2306,7 @@ tm_tc_wred_profile_get(struct rte_eth_dev *dev, > uint32_t tc_id) > return NULL; > } >=20 > -#ifdef RTE_SCHED_RED > +#ifdef RTE_SCHED_AQM >=20 > static void > wred_profiles_set(struct rte_eth_dev *dev, uint32_t subport_id) > @@ -2321,7 +2321,7 @@ wred_profiles_set(struct rte_eth_dev *dev, > uint32_t subport_id) > for (tc_id =3D 0; tc_id < RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE; > tc_id++) > for (color =3D RTE_COLOR_GREEN; color < RTE_COLORS; > color++) { > struct rte_red_params *dst =3D > - &pp->red_params[tc_id][color]; > + &pp->wred_params[tc_id][color]; Please do NOT rename red to wred in this patch set. > struct tm_wred_profile *src_wp =3D > tm_tc_wred_profile_get(dev, tc_id); > struct rte_tm_red_params *src =3D > diff --git a/lib/sched/rte_sched.c b/lib/sched/rte_sched.c > index cd87e688e4..afda39caf5 100644 > --- a/lib/sched/rte_sched.c > +++ b/lib/sched/rte_sched.c > @@ -89,8 +89,12 @@ struct rte_sched_queue { >=20 > struct rte_sched_queue_extra { > struct rte_sched_queue_stats stats; > -#ifdef RTE_SCHED_RED > - struct rte_red red; > +#ifdef RTE_SCHED_AQM > + RTE_STD_C11 > + union { > + struct rte_red red; > + struct rte_pie pie; > + }; > #endif > }; >=20 > @@ -183,8 +187,13 @@ struct rte_sched_subport { > /* Pipe queues size */ > uint16_t qsize[RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE]; >=20 > -#ifdef RTE_SCHED_RED > - struct rte_red_config > red_config[RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE][RTE_COLORS]; > + enum rte_sched_aqm_mode aqm; > +#ifdef RTE_SCHED_AQM > + RTE_STD_C11 > + union { > + struct rte_red_config > wred_config[RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE][RTE_COLORS]; > + struct rte_pie_config > pie_config[RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE]; > + }; > #endif Please use the proposed rte_sched_cman_params structure. >=20 > /* Scheduling loop detection */ > @@ -1078,6 +1087,91 @@ rte_sched_free_memory(struct rte_sched_port > *port, uint32_t n_subports) > rte_free(port); > } >=20 > +#ifdef RTE_SCHED_AQM > + > +static int > +rte_sched_red_config(struct rte_sched_port *port, > + struct rte_sched_subport *s, > + struct rte_sched_subport_params *params, > + uint32_t n_subports) > +{ > + uint32_t i; > + > + for (i =3D 0; i < RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE; i++) { > + > + uint32_t j; > + > + for (j =3D 0; j < RTE_COLORS; j++) { > + /* if min/max are both zero, then RED is disabled */ > + if ((params->wred_params[i][j].min_th | > + params->wred_params[i][j].max_th) =3D=3D 0) { > + continue; > + } > + > + if (rte_red_config_init(&s->wred_config[i][j], > + params->wred_params[i][j].wq_log2, > + params->wred_params[i][j].min_th, > + params->wred_params[i][j].max_th, > + params->wred_params[i][j].maxp_inv) !=3D 0) { > + rte_sched_free_memory(port, n_subports); > + > + RTE_LOG(NOTICE, SCHED, > + "%s: RED configuration init fails\n", > __func__); > + return -EINVAL; > + } > + } > + } > + s->aqm =3D RTE_SCHED_AQM_WRED; > + return 0; > +} > + > +static int > +rte_sched_pie_config(struct rte_sched_port *port, > + struct rte_sched_subport *s, > + struct rte_sched_subport_params *params, > + uint32_t n_subports) > +{ > + uint32_t i; > + > + for (i =3D 0; i < RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE; i++) { > + if (params->pie_params[i].tailq_th > params->qsize[i]) { > + RTE_LOG(NOTICE, SCHED, > + "%s: PIE tailq threshold incorrect\n", __func__); > + return -EINVAL; > + } > + > + if (rte_pie_config_init(&s->pie_config[i], > + params->pie_params[i].qdelay_ref, > + params->pie_params[i].dp_update_interval, > + params->pie_params[i].max_burst, > + params->pie_params[i].tailq_th) !=3D 0) { > + rte_sched_free_memory(port, n_subports); > + > + RTE_LOG(NOTICE, SCHED, > + "%s: PIE configuration init fails\n", __func__); > + return -EINVAL; > + } > + } > + s->aqm =3D RTE_SCHED_AQM_PIE; > + return 0; > +} > + > +static int > +rte_sched_aqm_config(struct rte_sched_port *port, > + struct rte_sched_subport *s, > + struct rte_sched_subport_params *params, > + uint32_t n_subports) > +{ > + if (params->aqm =3D=3D RTE_SCHED_AQM_WRED) > + return rte_sched_red_config(port, s, params, n_subports); > + > + else if (params->aqm =3D=3D RTE_SCHED_AQM_PIE) > + return rte_sched_pie_config(port, s, params, n_subports); > + > + return -EINVAL; > +} > +#endif > + > int > rte_sched_subport_config(struct rte_sched_port *port, > uint32_t subport_id, > @@ -1169,30 +1263,11 @@ 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 > -#ifdef RTE_SCHED_RED > - for (i =3D 0; i < RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE; i++) { > - uint32_t j; > - > - for (j =3D 0; j < RTE_COLORS; j++) { > - /* if min/max are both zero, then RED is disabled */ > - if ((params->red_params[i][j].min_th | > - params->red_params[i][j].max_th) =3D=3D 0) { > - continue; > - } > - > - if (rte_red_config_init(&s->red_config[i][j], > - params->red_params[i][j].wq_log2, > - params->red_params[i][j].min_th, > - params->red_params[i][j].max_th, > - params->red_params[i][j].maxp_inv) !=3D 0) > { > - rte_sched_free_memory(port, > n_subports); > - > - RTE_LOG(NOTICE, SCHED, > - "%s: RED configuration init fails\n", > - __func__); > - return -EINVAL; > - } > - } > +#ifdef RTE_SCHED_AQM > + status =3D rte_sched_aqm_config(port, s, params, > n_subports); > + if (status) { > + RTE_LOG(NOTICE, SCHED, "%s: AQM configuration > fails\n", __func__); > + return status; > } > #endif >=20 > @@ -1714,29 +1789,20 @@ rte_sched_port_update_subport_stats(struct > rte_sched_port *port, > subport->stats.n_bytes_tc[tc_index] +=3D pkt_len; > } >=20 > -#ifdef RTE_SCHED_RED > static inline void > rte_sched_port_update_subport_stats_on_drop(struct rte_sched_port > *port, > struct rte_sched_subport *subport, > uint32_t qindex, > struct rte_mbuf *pkt, > - uint32_t red) > -#else > -static inline void > -rte_sched_port_update_subport_stats_on_drop(struct rte_sched_port > *port, > - struct rte_sched_subport *subport, > - uint32_t qindex, > - struct rte_mbuf *pkt, > - __rte_unused uint32_t red) > -#endif > + __rte_unused uint32_t drops) Please rename drops with n_pkts_cman_dropped. > { > uint32_t tc_index =3D rte_sched_port_pipe_tc(port, qindex); > uint32_t pkt_len =3D pkt->pkt_len; >=20 > subport->stats.n_pkts_tc_dropped[tc_index] +=3D 1; > subport->stats.n_bytes_tc_dropped[tc_index] +=3D pkt_len; > -#ifdef RTE_SCHED_RED > - subport->stats.n_pkts_red_dropped[tc_index] +=3D red; > +#ifdef RTE_SCHED_AQM > + subport->stats.n_pkts_aqm_dropped[tc_index] +=3D drops; > #endif > } >=20 Due to the recommended generic field n_pkts_cman_dropped of the rte_sched_s= ubport_stats structure, you don't need the macro here anymore :) > @@ -1752,58 +1818,61 @@ rte_sched_port_update_queue_stats(struct > rte_sched_subport *subport, > qe->stats.n_bytes +=3D pkt_len; > } >=20 > -#ifdef RTE_SCHED_RED > -static inline void > -rte_sched_port_update_queue_stats_on_drop(struct rte_sched_subport > *subport, > - uint32_t qindex, > - struct rte_mbuf *pkt, > - uint32_t red) > -#else > static inline void > rte_sched_port_update_queue_stats_on_drop(struct rte_sched_subport > *subport, > uint32_t qindex, > struct rte_mbuf *pkt, > - __rte_unused uint32_t red) > -#endif > + __rte_unused uint32_t drops) Please rename drops with n_pkts_cman_dropped. > { > struct rte_sched_queue_extra *qe =3D subport->queue_extra + > qindex; > uint32_t pkt_len =3D pkt->pkt_len; >=20 > qe->stats.n_pkts_dropped +=3D 1; > qe->stats.n_bytes_dropped +=3D pkt_len; > -#ifdef RTE_SCHED_RED > - qe->stats.n_pkts_red_dropped +=3D red; > +#ifdef RTE_SCHED_AQM > + qe->stats.n_pkts_aqm_dropped +=3D drops; > #endif > } >=20 > #endif /* RTE_SCHED_COLLECT_STATS */ >=20 > -#ifdef RTE_SCHED_RED > +#ifdef RTE_SCHED_AQM >=20 > static inline int > -rte_sched_port_red_drop(struct rte_sched_port *port, > +rte_sched_port_aqm_drop(struct rte_sched_port *port, > struct rte_sched_subport *subport, > struct rte_mbuf *pkt, > uint32_t qindex, > uint16_t qlen) > { > struct rte_sched_queue_extra *qe; > - struct rte_red_config *red_cfg; > - struct rte_red *red; > uint32_t tc_index; > - enum rte_color color; >=20 > tc_index =3D rte_sched_port_pipe_tc(port, qindex); > - color =3D rte_sched_port_pkt_read_color(pkt); > - red_cfg =3D &subport->red_config[tc_index][color]; > + qe =3D subport->queue_extra + qindex; >=20 > - if ((red_cfg->min_th | red_cfg->max_th) =3D=3D 0) > - return 0; > + /* WRED */ > + if (subport->aqm =3D=3D RTE_SCHED_AQM_WRED) { > + struct rte_red_config *red_cfg; > + struct rte_red *red; > + enum rte_color color; >=20 > - qe =3D subport->queue_extra + qindex; > - red =3D &qe->red; > + color =3D rte_sched_port_pkt_read_color(pkt); > + red_cfg =3D &subport->wred_config[tc_index][color]; > + > + if ((red_cfg->min_th | red_cfg->max_th) =3D=3D 0) > + return 0; >=20 > - return rte_red_enqueue(red_cfg, red, qlen, port->time); > + red =3D &qe->red; > + > + return rte_red_enqueue(red_cfg, red, qlen, port->time); > + } > + > + /* PIE */ > + struct rte_pie_config *pie_cfg =3D &subport->pie_config[tc_index]; > + struct rte_pie *pie =3D &qe->pie; > + You don't want to declare new variables in the middle of the function, but = you do want to reduce their scope, so maybe use the else for this (although= not needed, since you call return on the if branch)? > + return rte_pie_enqueue(pie_cfg, pie, pkt->pkt_len, qlen, port- > >time_cpu_cycles); > } >=20 > static inline void > @@ -1811,14 +1880,29 @@ > rte_sched_port_set_queue_empty_timestamp(struct rte_sched_port > *port, > struct rte_sched_subport *subport, uint32_t qindex) > { > struct rte_sched_queue_extra *qe =3D subport->queue_extra + > qindex; > - struct rte_red *red =3D &qe->red; > + if (subport->aqm =3D=3D RTE_SCHED_AQM_WRED) { > + struct rte_red *red =3D &qe->red; > + > + rte_red_mark_queue_empty(red, port->time); > + } > +} > + Please rename this function to rte_sched_port_red_set_queue_empty_timestamp= () to reflect that it is RED-specific. > +static inline void > +rte_sched_port_pie_dequeue(struct rte_sched_subport *subport, > +uint32_t qindex, uint32_t pkt_len, uint64_t time) { > + struct rte_sched_queue_extra *qe =3D subport->queue_extra + > qindex; > + struct rte_pie *pie =3D &qe->pie; >=20 > - rte_red_mark_queue_empty(red, port->time); > + /* Update queue length */ > + pie->qlen -=3D 1; > + pie->qlen_bytes -=3D pkt_len; > + > + rte_pie_dequeue(pie, pkt_len, time); > } >=20 Please do the processing in this function only if CMAN is PIE (add an if st= atement), and remove the if statement from where it gets called. Also you need to define this function as do-nothing on the #else branch, ri= ght? > #else >=20 > -static inline int rte_sched_port_red_drop(struct rte_sched_port *port > __rte_unused, > +static inline int rte_sched_port_aqm_drop(struct rte_sched_port *port > __rte_unused, > struct rte_sched_subport *subport __rte_unused, > struct rte_mbuf *pkt __rte_unused, > uint32_t qindex __rte_unused, > @@ -1829,7 +1913,7 @@ static inline int rte_sched_port_red_drop(struct > rte_sched_port *port __rte_unus >=20 > #define rte_sched_port_set_queue_empty_timestamp(port, subport, > qindex) >=20 > -#endif /* RTE_SCHED_RED */ > +#endif /* RTE_SCHED_AQM */ >=20 > #ifdef RTE_SCHED_DEBUG >=20 > @@ -1925,7 +2009,7 @@ rte_sched_port_enqueue_qwa(struct > rte_sched_port *port, > qlen =3D q->qw - q->qr; >=20 > /* Drop the packet (and update drop stats) when queue is full */ > - if (unlikely(rte_sched_port_red_drop(port, subport, pkt, qindex, > qlen) || > + if (unlikely(rte_sched_port_aqm_drop(port, subport, pkt, qindex, > qlen) || > (qlen >=3D qsize))) { > rte_pktmbuf_free(pkt); > #ifdef RTE_SCHED_COLLECT_STATS > @@ -2398,6 +2482,7 @@ grinder_schedule(struct rte_sched_port *port, > { > struct rte_sched_grinder *grinder =3D subport->grinder + pos; > struct rte_sched_queue *queue =3D grinder->queue[grinder->qpos]; > + uint32_t qindex =3D grinder->qindex[grinder->qpos]; > struct rte_mbuf *pkt =3D grinder->pkt; > uint32_t pkt_len =3D pkt->pkt_len + port->frame_overhead; > uint32_t be_tc_active; > @@ -2417,15 +2502,19 @@ grinder_schedule(struct rte_sched_port *port, > (pkt_len * grinder->wrr_cost[grinder->qpos]) & > be_tc_active; >=20 > if (queue->qr =3D=3D queue->qw) { > - uint32_t qindex =3D grinder->qindex[grinder->qpos]; > - > rte_bitmap_clear(subport->bmp, qindex); > grinder->qmask &=3D ~(1 << grinder->qpos); > if (be_tc_active) > grinder->wrr_mask[grinder->qpos] =3D 0; > + > rte_sched_port_set_queue_empty_timestamp(port, > subport, qindex); > } >=20 > +#ifdef RTE_SCHED_AQM > + if (subport->aqm =3D=3D RTE_SCHED_AQM_PIE) > + rte_sched_port_pie_dequeue(subport, qindex, pkt_len, > port->time_cpu_cycles); As stated before, move the if statement within the function, and remove the= macro from here by defining this same function as do-nothing on the #else = branch above. > +#endif > + > /* Reset pipe loop detection */ > subport->pipe_loop =3D RTE_SCHED_PIPE_INVALID; > grinder->productive =3D 1; Regards, Cristian