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 3DA81A04B1; Tue, 29 Sep 2020 23:19:41 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 260A41DAA9; Tue, 29 Sep 2020 23:19:38 +0200 (CEST) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by dpdk.org (Postfix) with ESMTP id EF3961DA99 for ; Tue, 29 Sep 2020 23:19:35 +0200 (CEST) IronPort-SDR: 9kz11mWTVxIhosQDTl+7P9QF0aNzpUDwrXBHw6tlcx+gZ9j31mum2gJhVXGsb+eti+Qj1NL8sb BBBuUGoKCq2Q== X-IronPort-AV: E=McAfee;i="6000,8403,9759"; a="226442067" X-IronPort-AV: E=Sophos;i="5.77,319,1596524400"; d="scan'208";a="226442067" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Sep 2020 14:19:33 -0700 IronPort-SDR: 7u/8W5C3ml6DCjuTJcdgWE4ybY1cjHPo+UWTt0IS5ykjkqijNQIYurt6DZkF2sLPs+ZbVXKMr+ HARA/j0av3XQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.77,319,1596524400"; d="scan'208";a="514030173" Received: from orsmsx601.amr.corp.intel.com ([10.22.229.14]) by fmsmga006.fm.intel.com with ESMTP; 29 Sep 2020 14:19:33 -0700 Received: from orsmsx608.amr.corp.intel.com (10.22.229.21) 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; Tue, 29 Sep 2020 14:19:32 -0700 Received: from orsmsx601.amr.corp.intel.com (10.22.229.14) by ORSMSX608.amr.corp.intel.com (10.22.229.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Tue, 29 Sep 2020 14:19:32 -0700 Received: from ORSEDG601.ED.cps.intel.com (10.7.248.6) 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 via Frontend Transport; Tue, 29 Sep 2020 14:19:32 -0700 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (104.47.59.176) 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.1713.5; Tue, 29 Sep 2020 14:19:30 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gIMEwDBziNXpQXJX1niITwYwSJcFtePyMYWXzCCSecQBMSDVn3zhsyyhjFL1lVFZcNJ63qeENLb2iRzIfJf2cnlf2yo29TOE8s97UMYRFVMEe1oyCo8qzE6OKT1BvgH5qI76/IS4NqxPZ6e1ai8dkB8Fss1DXs9Ra7UffErOYVyka1W5lIffze8i5DVYR30uHTfIcAtLwe1//oNpuRWni7GQWzzHU5k5J+WuDGGMEcQh0LknzxoNE6rYH7o+6E/3oYqx4l65vnvsxlOja4tVymzrqUv0k/AFEzwcxLxtGnsbUi9nmQ1JzIIROYbKHb+Xh30Gi43QZTvCsBt6eKi7bA== 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=/KJbFyVDhxk/JHBxnTF9sczS+MaoLQXSIp1pr8LNd2Q=; b=SzSDCQ5yddUoqK4p4ERuH4HaQGjFfYptmTz+WOzJaqLcDO8uA56KNTVa2Xyd3X43ox0f5l9M/BpU7bQAGLqp4tL4Kvm9LLNUxv4dG74WRMDXBL61FpKoiNwc1ueQE+D/yKnaCEctz4qtWErzDbGEEymTM4fgV8dHtp4QJ1udd9vueYIVDBdRtk2YHgzE8dfmgSkdBYh15sXtc9CAIHz1H0bRg0I0HZnM5wpaReZSbZLXZ0ecEzAPMr/nMFNElgaXkvyBlA5vy/RQSYRBIp7lg7npDXN9Ljuf3UvYHy2LdnOJviRgzL0EIjaoHFM4ei1YqiA5B5F2wmxsEuf5+VTUVQ== 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=/KJbFyVDhxk/JHBxnTF9sczS+MaoLQXSIp1pr8LNd2Q=; b=vfjH6sYmCsjZR5RPXavPwpfr6RBZSFETSv5hEvhk5uMdvjY4/KpSQUIDaAexwFRdDgKDBZ9a0edZiGIHbGXiaH6Q5MVACMnkL83m3MFv3+t7QWeAGze4FwCPZj3wJfB6hReP+F4gnRN73BFkYi+lzHDF14XN7vrDjKqlJBckDJs= Received: from CY4PR11MB1702.namprd11.prod.outlook.com (2603:10b6:903:2e::8) by CY4PR1101MB2261.namprd11.prod.outlook.com (2603:10b6:910:1f::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3433.32; Tue, 29 Sep 2020 21:19:04 +0000 Received: from CY4PR11MB1702.namprd11.prod.outlook.com ([fe80::ddb:33e0:ba2a:e390]) by CY4PR11MB1702.namprd11.prod.outlook.com ([fe80::ddb:33e0:ba2a:e390%4]) with mapi id 15.20.3412.029; Tue, 29 Sep 2020 21:19:04 +0000 From: "Dumitrescu, Cristian" To: "Dharmappa, Savinay" , "Singh, Jasvinder" , "dev@dpdk.org" Thread-Topic: [PATCH v4 3/9] sched: add subport profile add and config api Thread-Index: AQHWjM6KBc+Moj68ZkSyQvuEY7311qmAL8eA Date: Tue, 29 Sep 2020 21:19:03 +0000 Message-ID: References: <1600274633-371993-1-git-send-email-savinay.dharmappa@intel.com> <1600332159-26018-1-git-send-email-savinay.dharmappa@intel.com> <1600332159-26018-4-git-send-email-savinay.dharmappa@intel.com> In-Reply-To: <1600332159-26018-4-git-send-email-savinay.dharmappa@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-originating-ip: [109.79.102.18] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 8de1c9fb-d6ba-4a2b-4861-08d864bd4aef x-ms-traffictypediagnostic: CY4PR1101MB2261: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:125; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: Ez1uzqlitbGlPItn9UhubMGnAJLtwHE6GiaSoJ1rS6DQe6oJFRZ9Whv99Um0MMd6Sl7IUJhS81kxl5Lw1AbFoOS3M2blXGK1R8tRFDW8wzYKmz3h5k/XU786HM6f1Okovms2ay/cg7+5eae/4ruK8b0/wS1K7oqTvm33vjnFvsb/Q2syebXMN1FF2BBsNC9RpxomkW6eVhhBMuz7HN+fCXZQEe+zS6qFqsRNw2daVfVXD7qHMWCMNWJrelR410e0f2PJH/UPg41+4jC8WTA01enps3Zp8xZOSDJwaV+Rje4EVHEHuLt6RYFUpFl3hxmydvXzxIgUhE+W6cOpAVuLtg== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CY4PR11MB1702.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(346002)(39860400002)(366004)(376002)(396003)(136003)(52536014)(316002)(478600001)(9686003)(8936002)(33656002)(7696005)(2906002)(110136005)(186003)(83380400001)(5660300002)(64756008)(66446008)(66476007)(66556008)(66946007)(26005)(71200400001)(8676002)(76116006)(86362001)(55016002)(53546011)(6506007); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata: k7r3pq/QkIxvyKl1kpuzb4LdUyj+b4CYPYrpFFNAczwoDAknCtKMi0WBAc7vU0Is6SQufIG94M40KyOhe02zyAk0yRFeSVYMaqUGvxG5wCB7l89eqmVavCGJl8F7Rdc2Qv4aHLSIqfTHrYNyjuR8YrEm4zTSCgyB8W7AirkOECslidLct4FL2MkhEfJfjEpaFpFH0qz1uhWkVNVAdloHW1NwiEi7ACC5cyn+voTew1bdDzx2cDe+M/qZsfZCQLmDhGHpO5aI9kUQU0RPtLiRoef4JmVpuA9Cvl05ui3PuWPCHH9IqS6hdGIKKVhM6XEH2mn/dvyTZ+2Fkk+3qb7xkfhaEjoLyOx0fnZ4bJxVyTcZ/8xwLnO/oHRlpQ8o5HBifuM6jKm+J5g/Sdu/lmDo8MkOOjIh8Q9QycHrELStic6KKBKmIqqr48sItpnsJhf759+sED4jeYY/FasQNCEQxxL7d+6YUfmbhTCVUYNAFKH191hKdc4I5fRRfFH2Bot2EYluvT7jDbpElh0lSbRNxZieN9wRQ9Vzbx+HK03VdeNAMIVzFnVtnTer24eoUPmUnf5OAJPkWr4TwIIjWFmsonTE3ypF2cCM03IM7SHaLV1qdTFBCEXlg0T50fCYVDQWotzE97TkA4XC/HcwjdtSLA== 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: CY4PR11MB1702.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8de1c9fb-d6ba-4a2b-4861-08d864bd4aef X-MS-Exchange-CrossTenant-originalarrivaltime: 29 Sep 2020 21:19:04.0168 (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: Ygdm7slpPJlKyAZBNXgp9/hgdbIaFAZH1evQrPHLL8e4o0kDYKfAlYSLjoenGesFf/uCXpzX5wzOIguwSZsOLqawwu050bt99LCaJyAkC1k= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR1101MB2261 X-OriginatorOrg: intel.com Subject: Re: [dpdk-dev] [PATCH v4 3/9] 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" Hi Savinay, Trying to summarize the main points of what we discussed and agreed last w= eek for the benefit of all ... > -----Original Message----- > From: Dharmappa, Savinay > Sent: Thursday, September 17, 2020 9:43 AM > To: Singh, Jasvinder ; Dumitrescu, Cristian > ; dev@dpdk.org > Cc: Dharmappa, Savinay > Subject: [PATCH v4 3/9] 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 5fa7865..23aaec4 100644 > --- a/lib/librte_sched/rte_sched.c > +++ b/lib/librte_sched/rte_sched.c > @@ -174,6 +174,8 @@ struct rte_sched_subport { > /* Statistics */ > struct rte_sched_subport_stats stats __rte_cache_aligned; >=20 > + /* subport profile */ > + uint32_t profile; > /* Subport pipes */ > uint32_t n_pipes_per_subport_enabled; > uint32_t n_pipe_profiles; > @@ -1343,6 +1345,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, > @@ -1526,6 +1578,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, > + dst, sizeof(*dst)) =3D=3D 0) { > + RTE_LOG(ERR, SCHED, > + "%s: subport profile exists\n", __func__); > + return -EINVAL; > + } > + > + /* 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 hiearchica= l > + * 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); > + Please make sure the internal subport profile table is freed correctly, whi= ch is not the case currently. > +/** > * 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 sp= ecific > + * subport bandwidth profile as it doesn't have any impact on hiearchica= l > + * 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); This function should be melted into rte_sched_subport_config(), which shoul= d get an extra profile_id argument. This preserves the symmetry with rte_sched_pipe_config(), which is both an = init time and a run-time config update function, and also avoid user confus= ion and error prone situation when only rte_sched_subport_config() is calle= d while rte_sched_subport_profile_config() is not. First time rte_sched_subport_config() is called (init time), its params arg= ument should be non-NULL; this argument should be ignored (with NULL as the= recommended value) for any subsequent calls. A subport-internal init_done = flag could be maintained to distinguish between first and any subsequent ca= lls. This should also be documented in the argument description. > +/** > * 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; > }; > -- Need to increment the ABI version here, as new data structures and API func= tion changes took place, inline with the deprecation note. > 2.7.4