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 1F584A0C58; Tue, 30 Nov 2021 08:15:36 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DA6344068F; Tue, 30 Nov 2021 08:15:35 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id 6BB6D4068B for ; Tue, 30 Nov 2021 08:15:34 +0100 (CET) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.1.2/8.16.1.2) with ESMTP id 1AU3f6XE017649 for ; Mon, 29 Nov 2021 23:15:33 -0800 Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2109.outbound.protection.outlook.com [104.47.70.109]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3cmtkpn0x9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 29 Nov 2021 23:15:33 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PHtwMv+uPKm8njMUTjhQz34BLKf5R8A6/2X8UYsdalEnck0v0NAqbjbPtlnm15G5MIm+WbzSGZsA8qBltli5qIt0I3Yrr1c5IBeKUAPrE0SPJROD568arL0PZE/gGK30WwGg+c9XTjbya+5H4YPZTDlrTFSxMxVKxfhvHQga0aRT/gifRAnAt7Q/S7RP3/dsJszyp3yWlckRZIE3WXBZsfMpwZYmSXOgqyprLMxCaNrXMO3O3ILHgBjLRayE7jHI7ZUxmqHWMzXB6wb4rtR1eVU1V8K7caSJFGTUyEgDcKalDjEct1pal60MuYHA6KlBRyZ90DE9w78FXgYaiBVckw== 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=PpZ5H58s3APZvQB3z98T3OAkhAAxtNHwzlHahACEn/E=; b=eg4IhKD/Fq2QyZuzetDUA8H7KtfH+fL4uIw5wo0t9l35M75lqo+f5qmNTO1lUreDR1YrEHp7bPsEX0LfmfKkY5K7c9Y0mzVKceU/wC7i+EThFe/xrNPwwvKeSwaVUySGARD9L3NvAAhjAsxPG2zpFCWnnGFvQcAPYLIRb0290sA0u3Kc67zYlDHvFVJIiXyGsxeNDhAWwo+JqX6AjsZe5qFDkTTV1PSnniRx9I6ZiT1evL3V6KkIwpCBw9cqevrmm8HcMOw4Tb5nZkuySiPCms8tsUIg5dbqjyJrCOijylpy3dfpLIXj8rsjHOrse1+6RRo+dQQ4C+a9i9U8hrAqNg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=marvell.com; dmarc=pass action=none header.from=marvell.com; dkim=pass header.d=marvell.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.onmicrosoft.com; s=selector1-marvell-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=PpZ5H58s3APZvQB3z98T3OAkhAAxtNHwzlHahACEn/E=; b=M8WQxxGpy7V1buOBNtfulE/qwpq1bNKLtzoERQasNip95OhTIMliqbKnVK5af8UaIsYcM/SY0nAbrGnNwMxKyKZotUwL4ktXfQpMqkePt8DHvedteJBH2tDIjqGVe1LlbsVC0c0L9UmAyYjDoUiXY9SSw7l98WgTgE2jmduaop0= Received: from CO6PR18MB3860.namprd18.prod.outlook.com (2603:10b6:5:34d::12) by MWHPR18MB1165.namprd18.prod.outlook.com (2603:10b6:300:a1::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4734.23; Tue, 30 Nov 2021 07:15:32 +0000 Received: from CO6PR18MB3860.namprd18.prod.outlook.com ([fe80::dc37:87a0:2de1:ffa0]) by CO6PR18MB3860.namprd18.prod.outlook.com ([fe80::dc37:87a0:2de1:ffa0%5]) with mapi id 15.20.4755.011; Tue, 30 Nov 2021 07:15:31 +0000 From: Sunil Kumar Kori To: Rakesh Kudurumalla , Nithin Kumar Dabilpuram , Kiran Kumar Kokkilagadda , Satha Koteswara Rao Kottidi CC: "dev@dpdk.org" , Rakesh Kudurumalla Subject: RE: [PATCH 2/2] common/cnxk: update meter algorithm in band profile Thread-Topic: [PATCH 2/2] common/cnxk: update meter algorithm in band profile Thread-Index: AQHX5bVzy1wXSgs5ikCV+0bmw186w6wbqJ1g Date: Tue, 30 Nov 2021 07:15:31 +0000 Message-ID: References: <20211130064147.1023321-1-rkudurumalla@marvell.com> <20211130064147.1023321-2-rkudurumalla@marvell.com> In-Reply-To: <20211130064147.1023321-2-rkudurumalla@marvell.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: b6275046-ceec-44bb-7818-08d9b3d13210 x-ms-traffictypediagnostic: MWHPR18MB1165: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:5797; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 09SXjdUMixwKGjf49Rar0cdTPSUHTR/CYifogDvmj0+/fZXj7wzUWSjTjlcePhyxSEJBPKeWkkQO1k2KnlgmuGEeOocWS9fTkO/HS37CpiUVmV5WzUmJHnujqfpaoTrK/Y7o4asv79ewBp76cpWrwIRK0Yj/F/1cJW31bkD4q4s0Sn0ErLVQbkyNTMGGojcq75zXmcb158AT4X/2NI8Hamh5rzNj0zXbsvRp0n2CCXeemL+xnxWIjT27hCVPE6gbBIEpjzPJ6v9yZlT3DSTbomr2x3KSLmFSYxPu3X8EGrvhpBKRAVRpQY/8YvLjOE+g7zwwTvCnMFailz8Q4Q431WPuRaqm2GEOymVBmGGz0K9MwVuFOgTh0eX9TTpm/XxibaNMqLz2xDp2eHC5RCgu/TF9/tDbHNvotxAB1yZ1SpHrMSlH8KUwB9Yvborfkn4t2SlYLntKE0x3xwwFLiqodUIBcyau//Ou2W9BRhG0CakgzRHlTdNB8Cb/r7O0cuJ7LHD14JMk/zAPbHsZsa8P1K5Mlr5tsQLf+FJNTS5uclqgJKSZiRn3tkQ90/KMMevZASBPXkVbPqa8B2ojo3Kp+XXhoZmZozp0kMKBnjqmvJVMolHoSjNHeVLvf2We6UNCfx2CD7ijdEtj9Dk9ahWvc2l5QnfPMrjnxfbfDvbcYvxR5jpQfAQA5HfIoI/eJMF09dCb9MwFhTns0d0U4T59zQ== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CO6PR18MB3860.namprd18.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(7696005)(186003)(4326008)(33656002)(38070700005)(55016003)(83380400001)(316002)(26005)(110136005)(71200400001)(8676002)(54906003)(86362001)(122000001)(9686003)(107886003)(508600001)(8936002)(66946007)(76116006)(66476007)(66446008)(66556008)(6506007)(52536014)(2906002)(5660300002)(15650500001)(38100700002)(6636002)(64756008); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?75UttMqq2gWc/qwoo0K+xGRDyz+ks57jhWitbgNefHmAe7irk5iDBeSGjjKQ?= =?us-ascii?Q?w/dJPb8IYFlUwIU1/QQE8gT9tsuLDWieMYnM88CUNUEKNvz3UkySyllHZ27u?= =?us-ascii?Q?XLpMqJG3y4TnzBdndLNF4EaUuVElA6xz6dIPfusBL7ugjlclbmA6POe4fs++?= =?us-ascii?Q?d9zCSbE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ugQYqenjwqgih?= =?us-ascii?Q?jWNVVnCryNm4fEP5VmdIVbkeK8gERwi4Di58QVwGwfzZaSCtDTT0ZUGBzM9j?= =?us-ascii?Q?xqM/L8vozlLGZHoOQ0suuPKF1ap5fIfUOwyOasZTuy49u1Tr36gOyXA6B6pg?= =?us-ascii?Q?wLemfaPnnVNZLJipVj86shvTLrPEDUoM7e9I2RK1kxNdP/sski1K58RZy5dB?= =?us-ascii?Q?VAexxHwtEIjeBIhsgiKERS4dCPZBp8Ob0bGjHz1cF85bu+Hrci9pmbyviPBp?= =?us-ascii?Q?5a1u0GiWJX8zgtV/IATIUU3s7+kbgVUCg0cFqNrIEL6fNyrKV6q5/rrlpR8m?= =?us-ascii?Q?fiNA/4rOeomxgzYmircpULUkOE5oOKzEbpOCYMgFre+PMQ1ZYTtUmSWic82U?= =?us-ascii?Q?ax6nEKC5FeQn2JRs2KcB01U5AT98/k/2JUIvWD4e66muZmtCMX+iz7Rj4VTc?= =?us-ascii?Q?F4u3Fo7z+SEm0XbJhJasMsxHlxYPD3ZRThZDGFdr2Q0GckFF6zURzCuNdenL?= =?us-ascii?Q?nJ5WG0figVRP2gsxbKqhfJSF8SEK5KlN2icMlkc18fGgwChHUhS+axR5vT++?= =?us-ascii?Q?hg=3D=3D?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: marvell.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: CO6PR18MB3860.namprd18.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: b6275046-ceec-44bb-7818-08d9b3d13210 X-MS-Exchange-CrossTenant-originalarrivaltime: 30 Nov 2021 07:15:31.7041 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 70e1fb47-1155-421d-87fc-2e58f638b6e0 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: ejU+Nj3iskY7WkV+G0+Rw+I3gTLJhg35hSF9BYpKhBxYWSHhHvtD29pfO0uOadHBahgA4Rjd35+cZLRLMTfNtA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR18MB1165 X-Proofpoint-GUID: yL-PVDYbRQ0Aq4JpAmzNKwFCaDuqfVZL X-Proofpoint-ORIG-GUID: yL-PVDYbRQ0Aq4JpAmzNKwFCaDuqfVZL X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.790,Hydra:6.0.425,FMLib:17.0.607.475 definitions=2021-11-30_05,2021-11-28_01,2020-04-07_01 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: Rakesh Kudurumalla >Sent: Tuesday, November 30, 2021 12:12 PM >To: Nithin Kumar Dabilpuram ; Kiran Kumar >Kokkilagadda ; Sunil Kumar Kori >; Satha Koteswara Rao Kottidi > >Cc: dev@dpdk.org; Rakesh Kudurumalla >Subject: [PATCH 2/2] common/cnxk: update meter algorithm in band profile > >Patch updates meter algorithm in nix band profile structure > >Signed-off-by: Rakesh Kudurumalla >--- > drivers/common/cnxk/hw/nix.h | 5 --- > drivers/common/cnxk/roc_nix_bpf.c | 61 +++++++++---------------------- > 2 files changed, 17 insertions(+), 49 deletions(-) > >diff --git a/drivers/common/cnxk/hw/nix.h b/drivers/common/cnxk/hw/nix.h >index dd2ebecc6a..6931f1d1d2 100644 >--- a/drivers/common/cnxk/hw/nix.h >+++ b/drivers/common/cnxk/hw/nix.h >@@ -2133,11 +2133,6 @@ struct nix_lso_format { > ((NIX_BPF_RATE_CONST * ((256 + (mantissa)) << (exponent))) / \ > (((1ull << (div_exp)) * 256 * policer_timeunit))) > >-/* Meter rate limits in Bits/Sec */ >-#define NIX_BPF_RATE_MIN NIX_BPF_RATE(1000000000, 0, 0, 0) >-#define NIX_BPF_RATE_MAX = \ >- NIX_BPF_RATE(1, NIX_BPF_MAX_RATE_EXPONENT, >NIX_BPF_MAX_RATE_MANTISSA, 0) >- > #define NIX_BPF_DEFAULT_ADJUST_MANTISSA 511 #define >NIX_BPF_DEFAULT_ADJUST_EXPONENT 0 > >diff --git a/drivers/common/cnxk/roc_nix_bpf.c >b/drivers/common/cnxk/roc_nix_bpf.c >index 6996a54be0..46ed91e87b 100644 >--- a/drivers/common/cnxk/roc_nix_bpf.c >+++ b/drivers/common/cnxk/roc_nix_bpf.c >@@ -38,48 +38,23 @@ meter_rate_to_nix(uint64_t value, uint64_t >*exponent_p, uint64_t *mantissa_p, > uint64_t *div_exp_p, uint32_t timeunit_p) { > uint64_t div_exp, exponent, mantissa; >- uint32_t time_us =3D timeunit_p; >+ uint32_t time_ns =3D timeunit_p; > > /* Boundary checks */ >- if (value < NIX_BPF_RATE_MIN || value > NIX_BPF_RATE_MAX) >+ if (value < NIX_BPF_RATE(time_ns, 0, 0, 0) || >+ value > NIX_BPF_RATE(time_ns, NIX_BPF_MAX_RATE_EXPONENT, >+ NIX_BPF_MAX_RATE_MANTISSA, 0)) > return 0; > >- if (value <=3D NIX_BPF_RATE(time_us, 0, 0, 0)) { >- /* Calculate rate div_exp and mantissa using >- * the following formula: >- * >- * value =3D (2E6 * (256 + mantissa) >- * / ((1 << div_exp) * 256)) >- */ >- div_exp =3D 0; >- exponent =3D 0; >- mantissa =3D NIX_BPF_MAX_RATE_MANTISSA; >- >- while (value < (NIX_BPF_RATE_CONST / (1 << div_exp))) >- div_exp +=3D 1; >- >- while (value < ((NIX_BPF_RATE_CONST * (256 + mantissa)) / >- ((1 << div_exp) * 256))) >- mantissa -=3D 1; >- } else { >- /* Calculate rate exponent and mantissa using >- * the following formula: >- * >- * value =3D (2E6 * ((256 + mantissa) << exponent)) / 256 >- * >- */ >- div_exp =3D 0; >- exponent =3D NIX_BPF_MAX_RATE_EXPONENT; >- mantissa =3D NIX_BPF_MAX_RATE_MANTISSA; >- >- while (value < (NIX_BPF_RATE_CONST * (1 << exponent))) >- exponent -=3D 1; >- >- while (value < >- ((NIX_BPF_RATE_CONST * ((256 + mantissa) << exponent)) >/ >- 256)) >- mantissa -=3D 1; >- } >+ div_exp =3D 0; >+ exponent =3D NIX_BPF_MAX_RATE_EXPONENT; >+ mantissa =3D NIX_BPF_MAX_RATE_MANTISSA; >+ >+ while (value < (NIX_BPF_RATE(time_ns, exponent, 0, 0))) >+ exponent -=3D 1; >+ >+ while (value < (NIX_BPF_RATE(time_ns, exponent, mantissa, 0))) >+ mantissa -=3D 1; > > if (div_exp > NIX_BPF_MAX_RATE_DIV_EXP || > exponent > NIX_BPF_MAX_RATE_EXPONENT || @@ -94,7 +69,7 >@@ meter_rate_to_nix(uint64_t value, uint64_t *exponent_p, uint64_t >*mantissa_p, > *mantissa_p =3D mantissa; > > /* Calculate real rate value */ >- return NIX_BPF_RATE(time_us, exponent, mantissa, div_exp); >+ return NIX_BPF_RATE(time_ns, exponent, mantissa, div_exp); > } > > static inline uint64_t >@@ -195,11 +170,7 @@ nix_precolor_conv_table_write(struct roc_nix >*roc_nix, uint64_t val, > int64_t *addr; > > addr =3D PLT_PTR_ADD(nix->base, off); >- /* FIXME: Currently writing to this register throwing kernel dump. >- * plt_write64(val, addr); >- */ >- PLT_SET_USED(val); >- PLT_SET_USED(addr); >+ plt_write64(val, addr); > } > > static uint8_t >@@ -665,6 +636,7 @@ roc_nix_bpf_config(struct roc_nix *roc_nix, uint16_t >id, > > aq->prof.lmode =3D cfg->lmode; > aq->prof.icolor =3D cfg->icolor; >+ aq->prof.meter_algo =3D cfg->alg; > aq->prof.pc_mode =3D cfg->pc_mode; > aq->prof.tnl_ena =3D cfg->tnl_ena; > aq->prof.gc_action =3D cfg->action[ROC_NIX_BPF_COLOR_GREEN]; >@@ -673,6 +645,7 @@ roc_nix_bpf_config(struct roc_nix *roc_nix, uint16_t >id, > > aq->prof_mask.lmode =3D ~(aq->prof_mask.lmode); > aq->prof_mask.icolor =3D ~(aq->prof_mask.icolor); >+ aq->prof_mask.meter_algo =3D ~(aq->prof_mask.meter_algo); > aq->prof_mask.pc_mode =3D ~(aq->prof_mask.pc_mode); > aq->prof_mask.tnl_ena =3D ~(aq->prof_mask.tnl_ena); > aq->prof_mask.gc_action =3D ~(aq->prof_mask.gc_action); >-- >2.25.1 Acked-by: Sunil Kumar Kori