From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id A1658A04C7; Mon, 14 Sep 2020 16:05:23 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 7A400E07; Mon, 14 Sep 2020 16:05:23 +0200 (CEST) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id E779B160 for ; Mon, 14 Sep 2020 16:05:20 +0200 (CEST) IronPort-SDR: 5drRcZ+Kmu34AFLAf9VilngQLY/i/mUx5l5muhJ8e4lC1PRw5DbtvdFtFwciBiUxYZtMmX3Z0P eIUmsiL8FcAA== X-IronPort-AV: E=McAfee;i="6000,8403,9743"; a="159120445" X-IronPort-AV: E=Sophos;i="5.76,426,1592895600"; d="scan'208";a="159120445" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Sep 2020 07:05:19 -0700 IronPort-SDR: 0oxO/ljgMO0WQlt674JgSyO1NvforSQ2f0nR/4PBPanTgS8fxKF7PgZg04OWOyND2E/UBQykJ3 zGwV2u4OBXlQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.76,426,1592895600"; d="scan'208";a="450892154" Received: from orsmsx601.amr.corp.intel.com ([10.22.229.14]) by orsmga004.jf.intel.com with ESMTP; 14 Sep 2020 07:05:19 -0700 Received: from orsmsx601.amr.corp.intel.com (10.22.229.14) by ORSMSX601.amr.corp.intel.com (10.22.229.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Mon, 14 Sep 2020 07:05:19 -0700 Received: from orsmsx151.amr.corp.intel.com (10.22.226.38) by orsmsx601.amr.corp.intel.com (10.22.229.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.1713.5 via Frontend Transport; Mon, 14 Sep 2020 07:05:19 -0700 Received: from ORSEDG602.ED.cps.intel.com (10.7.248.7) by ORSMSX151.amr.corp.intel.com (10.22.226.38) with Microsoft SMTP Server (TLS) id 14.3.439.0; Mon, 14 Sep 2020 07:05:19 -0700 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (104.47.59.169) by edgegateway.intel.com (134.134.137.103) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.1713.5; Mon, 14 Sep 2020 07:05:18 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NXzb/W/iKOd4wT+eunE2oJIPnpWrpbM5rdqmjuzZcSAxc94Re4L4k4TSJroRGSeVaErP3KXAnB+ZxkfGuE+ugicV9STiC4r/KXpS9llv5mOoQPu10ZMRusCAYyMqZoSivGdJ3u9vFwYNo4PasLXknuuyszN+KAA2HRirurEvQNNdArnFvM54H2KtvJ8J8uB6K/cn/4fP4fBysIwjXDNm9s2oHD1OjLC1pHSj2v5G9sD2WSZVFVrldpblBjk3Xv4p81bIrxmEw/XQKKOM9YPCzLr29TGiZHdgb7GcvODn03zx0sNIHNKo7xiipIJe+tW42NYfvjtnx4PaIoW9zmlNgw== 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=m6Hndp9/v+VTuum+8NPV2KslXwVsC//66tlCRe5SSnE=; b=bSn7DuvESaUmsZzbMKr5+cRt79FtJxH6fHufWqOIsQixZCXVV9Wlj7AkDY4SBQJFdPg41J4azoAhrVEan8roOGuJ8QfUuwRmtqIt/IXbQjzz0yU2a7kJ/TFmvjYGmNCH6T8znN636c9m8We6RwtOHhixS7I4H7sOcWa7GkVWSpYs0h/KHDyzL4Kob2Ca7wvb/6cemf5fz9OLP8ubgiKGxALrGZDfUGQP5o5w55FDE7S56oDkrB7dYQpFR+zfT3L/GpYe89BzQMlnlsvmf56ao1MFvAlyV2RHEH2oC0CBXd+KnMePo1MB9Luf8+ByHogc0GovfR0uMlTCvUPRvEm3dQ== 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=m6Hndp9/v+VTuum+8NPV2KslXwVsC//66tlCRe5SSnE=; b=TtqnlT3HGVfneywlymSAYGJgDu1nlHUfcikMG/AuVuXxrO4eCemGWbJm5vKPsQtB1QZaN13xmQ2lz/o5E196Jm0bwsSTE+7MOHpwwgYEKEwTpNwTtZbIY/C0C+3dMT4Dm0Co9tLrEJU3aGHmbUTCGiBVx57Or0j48E6CfjpDiHw= Received: from BYAPR11MB3352.namprd11.prod.outlook.com (2603:10b6:a03:1d::26) by BY5PR11MB4321.namprd11.prod.outlook.com (2603:10b6:a03:1bf::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3370.16; Mon, 14 Sep 2020 14:05:17 +0000 Received: from BYAPR11MB3352.namprd11.prod.outlook.com ([fe80::96:1e18:b4ab:1af8]) by BYAPR11MB3352.namprd11.prod.outlook.com ([fe80::96:1e18:b4ab:1af8%6]) with mapi id 15.20.3370.019; Mon, 14 Sep 2020 14:05:17 +0000 From: "Singh, Jasvinder" To: "Dharmappa, Savinay" , "Dumitrescu, Cristian" , "dev@dpdk.org" Thread-Topic: [PATCH v2 03/10] sched: add subport profile add and config api Thread-Index: AQHWh6MMLB6Z8U3GWEmlDrFSxSVG2aloL6ug Date: Mon, 14 Sep 2020 14:05:17 +0000 Message-ID: References: <1599037006-3931-1-git-send-email-savinay.dharmappa@intel.com> <1599763717-135002-1-git-send-email-savinay.dharmappa@intel.com> <1599763717-135002-4-git-send-email-savinay.dharmappa@intel.com> In-Reply-To: <1599763717-135002-4-git-send-email-savinay.dharmappa@intel.com> Accept-Language: en-GB, 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-originating-ip: [51.37.138.153] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: b94667a9-f44a-4d6d-857f-08d858b735b7 x-ms-traffictypediagnostic: BY5PR11MB4321: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:175; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: VcnVf0L+ZXC33NNg4YnpJgsW7J9ZbDVv4TsYSB79FfDPW86R6dAVv1KCuqO7V2EVAAlgPi7qW1ymVR16DFm6bmeR51yY0G4YQmgRZ80BzkeyqXaiX0vIco50CSoOT1pFdPLm8VJBe34H+wf0bIvjhjApT0Bg5jfJc3Jgdap8zL/STq+/at2lI2QGsX3DEdL3SpBWaFw1DJw1BHsLP++9jqfvIhLDVjpmulgMJwoEqPYDTWBPJP0v4NZSgfpJS5t5aFVBrSk0oJaFuFSRZnLu7lb9UfDjMjzwO35bhiCNEhZPUUY5oFzB69msMRHjCi3A x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BYAPR11MB3352.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(396003)(136003)(346002)(39860400002)(376002)(366004)(9686003)(7696005)(55016002)(26005)(66476007)(66556008)(64756008)(66446008)(86362001)(6506007)(53546011)(66946007)(76116006)(110136005)(83380400001)(5660300002)(478600001)(52536014)(186003)(8676002)(8936002)(316002)(71200400001)(33656002)(2906002); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata: z944ukm/WmKzOuB8xtp7SoBp/BKVSZ/ROCFrx5gP7Fj6NzvwuuOV7aZhehuhVSBPJ6GSOEGMVRjhZIGNWPZ3QAwNPPOE14HGibto6t1dzV+JrJJib1IdYXwzVjIPegLxHhezPtD1DR4djE/r+yINPUp9X4rFSs7WLWobhPmYMfqUEsPeXgDs547wvHX6ESBmQ5vR6QfIux3ducR2krAZaIYz+T9ZYPnSFv+JRCVPPpyzg/qiUcfswEq9BuLwQr3Wwa/F04zSIoHaTsOdJba5jppegH6JmCDkhT0YdXz4252YdDAGQ6pzD0PZlHbPDtRfNRVqV8Wu5Qs+9VAJgD046IWkIhCd3dIsGzg+6t+xbknto73UXKf/dJfF1GHD6/VFtiio4kPEnmbqxOhujWO5Dp/CEBz0baVCV6A8i0goYARqCnQbrBekhMeN5UNTNJo77aFIFOO906LcMZu9oVvlQiXAT9yKHTKcBhV1o5LGN3kRDhbrTO8VGf+nHvMbY6eVq/0g/CkRyc4uqSrGGFsbKPednNCHKjuqDm/zovJGnS7zgCI79F4H6ecdjFdyE4tjvZrzeBCmVsbTcjoxLOImRjlw1ZDNMgO42JgnHglYpDY/DinjbqezTUdZCnKliEx7cbZDshLKMDpQolioN07pTg== 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: BYAPR11MB3352.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: b94667a9-f44a-4d6d-857f-08d858b735b7 X-MS-Exchange-CrossTenant-originalarrivaltime: 14 Sep 2020 14:05:17.4895 (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: JsJCj5IE53phFzBEgzMJxtOM8F9BRKNmVoK/MLZ1CoWDVCHdjs5L1srbCw2cTRUnrSTwAoPqzvaZ9X9bI/6hO4CXMnZ8tIJVW14Q/Ib/dfA= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR11MB4321 X-OriginatorOrg: intel.com Subject: Re: [dpdk-dev] [PATCH v2 03/10] sched: add subport profile add and config api 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" > -----Original Message----- > From: Dharmappa, Savinay > Sent: Thursday, September 10, 2020 7:49 PM > To: Singh, Jasvinder ; Dumitrescu, Cristian > ; dev@dpdk.org > Cc: Dharmappa, Savinay > Subject: [PATCH v2 03/10] sched: add subport profile add and config api >=20 > Add apis to add new subport profile and configure it. >=20 > Signed-off-by: Savinay Dharmappa > Signed-off-by: Jasvinder Singh > --- > lib/librte_sched/rte_sched.c | 118 > +++++++++++++++++++++++++++++++++ > lib/librte_sched/rte_sched.h | 45 +++++++++++++ > lib/librte_sched/rte_sched_version.map | 2 + > 3 files changed, 165 insertions(+) >=20 > diff --git a/lib/librte_sched/rte_sched.c b/lib/librte_sched/rte_sched.c = index > ec6e6bf..ba5700a 100644 > --- a/lib/librte_sched/rte_sched.c > +++ b/lib/librte_sched/rte_sched.c > @@ -175,6 +175,8 @@ struct rte_sched_subport { > /* Statistics */ > struct rte_sched_subport_stats stats __rte_cache_aligned; >=20 > + /* subport profile flag */ > + uint32_t profile; > /* Subport pipes */ > uint32_t n_pipes_per_subport_enabled; > uint32_t n_pipe_profiles; > @@ -1344,6 +1346,56 @@ rte_sched_subport_config(struct rte_sched_port > *port, } >=20 > int > +rte_sched_subport_profile_config(struct rte_sched_port *port, > + uint32_t subport_id, > + uint32_t profile_id) > +{ > + int i; > + struct rte_sched_subport_profile *params; > + uint32_t n_subports =3D subport_id + 1; > + struct rte_sched_subport *s; > + > + 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__); > + > + rte_sched_free_memory(port, n_subports); > + return -EINVAL; > + } > + > + params =3D port->subport_profiles + profile_id; > + > + s =3D port->subports[subport_id]; > + > + s->tb_credits =3D params->tb_size / 2; > + > + s->tc_time =3D port->time + params->tc_period; > + > + for (i =3D 0; i < RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE; i++) > + if (s->qsize[i]) > + s->tc_credits[i] =3D > + params->tc_credits_per_period[i]; > + else > + params->tc_credits_per_period[i] =3D 0; > + > +#ifdef RTE_SCHED_SUBPORT_TC_OV > + s->tc_ov_wm_max =3D rte_sched_time_ms_to_bytes(params- > >tc_period, > + s->pipe_tc_be_rate_max); > +#endif > + s->profile =3D profile_id; > + > + rte_sched_port_log_subport_profile(port, profile_id); > + > + return 0; > +} > + > +int > rte_sched_pipe_config(struct rte_sched_port *port, > uint32_t subport_id, > uint32_t pipe_id, > @@ -1527,6 +1579,72 @@ rte_sched_subport_pipe_profile_add(struct > rte_sched_port *port, > return 0; > } >=20 > +int > +rte_sched_port_subport_profile_add(struct rte_sched_port *port, > + struct rte_sched_subport_profile_params *params, > + uint32_t *subport_profile_id) > +{ > + int status; > + uint32_t i; > + struct rte_sched_subport_profile *dst; > + > + /* Port */ > + if (port =3D=3D NULL) { > + RTE_LOG(ERR, SCHED, "%s: " > + "Incorrect value for parameter port\n", __func__); > + return -EINVAL; > + } > + > + if (params =3D=3D NULL) { > + RTE_LOG(ERR, SCHED, "%s: " > + "Incorrect value for parameter profile\n", __func__); > + return -EINVAL; > + } > + > + if (subport_profile_id =3D=3D NULL) { > + RTE_LOG(ERR, SCHED, "%s: " > + "Incorrect value for parameter subport_profile_id\n", > + __func__); > + return -EINVAL; > + } > + > + dst =3D port->subport_profiles + port->n_subport_profiles; > + > + /* Subport profiles exceeds the max limit */ > + if (port->n_subport_profiles >=3D port->n_max_subport_profiles) { > + RTE_LOG(ERR, SCHED, "%s: " > + "Number of subport profiles exceeds the max limit\n", > + __func__); > + return -EINVAL; > + } > + > + status =3D subport_profile_check(params, port->rate); > + if (status !=3D 0) { > + RTE_LOG(ERR, SCHED, > + "%s: subport profile check failed(%d)\n", __func__, status); > + return -EINVAL; > + } > + > + rte_sched_subport_profile_convert(params, dst, port->rate); > + > + /* Subport profile should not exists */ > + for (i =3D 0; i < port->n_subport_profiles; i++) > + if (memcmp(port->subport_profiles + i, > + params, sizeof(*params)) =3D=3D 0) { > + RTE_LOG(ERR, SCHED, > + "%s: subport profile exists\n", __func__); > + return -EINVAL; > + } > + Savinay, Comparing port->subport_profiles with params is wrong as they are = different structures, need to compare port->subport_profiles with dst.=20 > + /* Subport profile commit */ > + *subport_profile_id =3D port->n_subport_profiles; > + port->n_subport_profiles++; > + > + rte_sched_port_log_subport_profile(port, *subport_profile_id); > + > + return 0; > +} > + > static inline uint32_t > rte_sched_port_qindex(struct rte_sched_port *port, > uint32_t subport, > diff --git a/lib/librte_sched/rte_sched.h b/lib/librte_sched/rte_sched.h = index > 39339b7..a7c2638 100644 > --- a/lib/librte_sched/rte_sched.h > +++ b/lib/librte_sched/rte_sched.h > @@ -337,6 +337,29 @@ rte_sched_subport_pipe_profile_add(struct > rte_sched_port *port, > uint32_t *pipe_profile_id); >=20 > /** > + * @warning > + * @b EXPERIMENTAL: this API may change without prior notice. > + * > + * Hierarchical scheduler subport bandwidth profile add > + * Note that this function is safe to use in runtime for adding new > + * subport bandwidth profile as it doesn't have any impact on > +hiearchical > + * structure of the scheduler. > + * @param port > + * Handle to port scheduler instance > + * @param struct rte_sched_subport_profile > + * Subport bandwidth profile > + * @param subport_profile_d > + * Subport profile id > + * @return > + * 0 upon success, error code otherwise > + */ > +__rte_experimental > +int > +rte_sched_port_subport_profile_add(struct rte_sched_port *port, > + struct rte_sched_subport_profile_params *profile, > + uint32_t *subport_profile_id); > + > +/** > * Hierarchical scheduler subport configuration > * > * @param port > @@ -354,6 +377,28 @@ rte_sched_subport_config(struct rte_sched_port > *port, > struct rte_sched_subport_params *params); >=20 > /** > + * @warning > + * @b EXPERIMENTAL: this API may change without prior notice. > + * > + * Hierarchical scheduler subport profile configuration > + * Note that this function is safe to use in runtime for applying any > +specific > + * subport bandwidth profile as it doesn't have any impact on > +hiearchical > + * structure of the scheduler. > + * @param port > + * Handle to port scheduler instance > + * @param subport_id > + * Subport ID > + * @param profile_d > + * Subport profile id > + * @return > + * 0 upon success, error code otherwise > + */ > +__rte_experimental > +int > +rte_sched_subport_profile_config(struct rte_sched_port *port, > + uint32_t subport_id, > + uint32_t profile_id); > +/** > * Hierarchical scheduler pipe configuration > * > * @param port > diff --git a/lib/librte_sched/rte_sched_version.map > b/lib/librte_sched/rte_sched_version.map > index 3faef6f..e64335f 100644 > --- a/lib/librte_sched/rte_sched_version.map > +++ b/lib/librte_sched/rte_sched_version.map > @@ -28,4 +28,6 @@ EXPERIMENTAL { > global: >=20 > rte_sched_subport_pipe_profile_add; > + rte_sched_port_subport_profile_add; > + rte_sched_subport_profile_config; > }; > -- > 2.7.4