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 005EDA00C4; Mon, 30 May 2022 13:50:34 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 898BA42B7C; Mon, 30 May 2022 13:50:29 +0200 (CEST) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by mails.dpdk.org (Postfix) with ESMTP id 55CB342BB4 for ; Mon, 30 May 2022 13:50:27 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1653911427; x=1685447427; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=cdDiIfDxCaf3cpGgcZN2fA1JcdzOQKi3X6Uam/DnELo=; b=SaYGq+rzCcF3jtnvmLwW5v7fIO6n/ilQ+FgiqNSXeCtHFAwgEH+Fgxia B4dbTe/CV1xFpC79xVC+BYtEyM6uJHZPCJW9ggDHgSDItyarkm+tk4rkz 3edKwUursuqPevhlfsljHvOfPjYOS2VP7eBySVrQc0Usva6X4F0VKsvoI IzARK6vd6UIThmBnA0iXlg3/KhDEbdkMkDCOYfj4WWPDWlvWlJzG3npmG WfssQP4IxIQw6KS3DH4WoY6TgpWJu1lJxNqah3VTawbPgsHK7AVnui1Z4 /PErSgicoQhWWuQqTxq1fYaBE34bPmjQO/ZprUbjXEdaoqSISRGg2g/KG w==; X-IronPort-AV: E=McAfee;i="6400,9594,10362"; a="254854809" X-IronPort-AV: E=Sophos;i="5.91,262,1647327600"; d="scan'208";a="254854809" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 May 2022 04:50:25 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.91,262,1647327600"; d="scan'208";a="575900167" Received: from orsmsx606.amr.corp.intel.com ([10.22.229.19]) by orsmga007.jf.intel.com with ESMTP; 30 May 2022 04:50:24 -0700 Received: from orsmsx607.amr.corp.intel.com (10.22.229.20) by ORSMSX606.amr.corp.intel.com (10.22.229.19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27; Mon, 30 May 2022 04:50:23 -0700 Received: from orsedg603.ED.cps.intel.com (10.7.248.4) by orsmsx607.amr.corp.intel.com (10.22.229.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27 via Frontend Transport; Mon, 30 May 2022 04:50:23 -0700 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (104.47.56.173) by edgegateway.intel.com (134.134.137.100) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2308.27; Mon, 30 May 2022 04:50:22 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kwtBiLlUbqplx4L9gKWtxg3BJ9huP2ULffdLEoyaLTNHGxolhpCjriYFz6XuIZmY5B30HtOICknG5UpfvZWCa5N+6MF35WI++boi1eC7zMZc6+9Vz+zKso54yrITSObF0mvAzHF3obA7Ey8Wu3GntvmZLtAujX5oVufrBCmV4nu1M1OJdBC9AA3QNkYef0I5WD60s8dIiJF8ISWAWcONWiJEiQKyH9i3O3RZvCRPj4CrebnjrYiooB0ZSZ+R25s2QdKejTKST/nd3C/bNSHYk2RfPjgXkxxMyqYKsGPioKyGXz0QV0iiehe6kq01H1yPSBGPDoCO+0rNIKONV4eGXQ== 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=poGucs4vf4ONODVLZ3Z3T4txndEowfN8/mGtkwSY9vA=; b=Y0gcRk6mqF7IQup+rOirfDamviksTfEkRRG6HWj0L1OETGIg6P2ysxbrfjznRSZyLKN+2WtltmxTpi892TS/bV4nXJDLVloweS/mEuqejMmh6cCufb23luIfscG2TeVDIlZlMkT7VcWWq81OnowDpevG8wp1R4B9RS7BZjedOIA8Z2+nhEHdXMNiQJISrVSpEKRhaY2ni8X6r429cBLJDN1RofJzCtwv4t0isNJUtGQ77edM34spr5RlhnEsdLd2Ae9YOaPjZ2Z7B8Qj7VDMHRbLrXoXa5xunPsaWxm12pphTHBWlwhXcyB3yVuvMAbriPvG76wlmLERlVElnp71JA== 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 DM8PR11MB5670.namprd11.prod.outlook.com (2603:10b6:8:37::12) by DM5PR11MB1499.namprd11.prod.outlook.com (2603:10b6:4:8::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5293.13; Mon, 30 May 2022 11:50:13 +0000 Received: from DM8PR11MB5670.namprd11.prod.outlook.com ([fe80::89de:bffb:b66b:516b]) by DM8PR11MB5670.namprd11.prod.outlook.com ([fe80::89de:bffb:b66b:516b%7]) with mapi id 15.20.5293.019; Mon, 30 May 2022 11:50:13 +0000 From: "Dumitrescu, Cristian" To: Stephen Hemminger , "dev@dpdk.org" CC: "Singh, Jasvinder" , Wojciech Liguzinski Subject: RE: [PATCH v5 3/3] rte_pie: fix incorrect floating point math Thread-Topic: [PATCH v5 3/3] rte_pie: fix incorrect floating point math Thread-Index: AQHYcT74U7FVDhrco0CpHfzKRTciqa03VE/Q Date: Mon, 30 May 2022 11:50:13 +0000 Message-ID: References: <20220524184623.480646-1-stephen@networkplumber.org> <20220526202653.99796-1-stephen@networkplumber.org> <20220526202653.99796-4-stephen@networkplumber.org> In-Reply-To: <20220526202653.99796-4-stephen@networkplumber.org> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-version: 11.6.500.17 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: 9ccbe425-e00b-4ebe-4402-08da42328ea2 x-ms-traffictypediagnostic: DM5PR11MB1499: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: pHeufyRFdTaomo4DoIY8vXoi8ozb7Ij7Gb5Cf8xThweGTDusiggDtK3LDSs+STMlAryTNN18u8JUs4BT0UaArTcEzuJjorcwgTgBurJ2YGpmqPK8/PXYz1vPeN205Tw86PVGYKcN1qBO20clUMhe61t77T9G3BpzowhhjMowksv8fDpijBWfGnpYDmc77s+u7jYb70yrSMk123mVekPN2n7GKXgthsOX7GhjVGT3qA9UmGXFsvR0++QrYtgXN8h4LZ6lsvvfe88IjX5oW3hO77sRHF4UR0RAx4ipnslAPMMoiBW9JbewfRtX8UxDbItylj3UTdYN6ZBlIU80NCbLCITc+O34FFn/XN7OWMVKthijh3jetIEIyUpsX7C68ZpOvDS/1D3TsU1Na0g1q1JXfMUYkhm/3H+7mkwH/1hbKLuXPCPR5Xa0CF97TMsXaNHmOCLi7gbjUXhnCqkcjgG/1dKNl89KGnA7po6C1WMxSmIVEnXzzDw0puNYZnclAuQHLUKjiTEbkd+fCXou814JDPquS9oBp4jREF0L575SHmSftD7HXx8SzAljmon8p1JY040EZ1erDaCpWVUUMo7S0F1dhHRGsXnZuwbWdKvNB/7MMfG4cEpQM88nODGkGUW+zNU/Jiw3vLaeNPxhboZrXS71zLzpf3r+HA7hUCw+x96VGQ/yjT2tbFje2NU79YPv+ZtNSxTIY5uJADoR/V8bGQ== 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:(13230001)(366004)(316002)(82960400001)(110136005)(55016003)(54906003)(83380400001)(66556008)(66476007)(66446008)(64756008)(71200400001)(8676002)(6506007)(66946007)(76116006)(4326008)(53546011)(508600001)(52536014)(107886003)(186003)(86362001)(8936002)(5660300002)(9686003)(38070700005)(26005)(2906002)(122000001)(33656002)(38100700002)(7696005); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?3/U3pCv0fgRlJEQYVHGmB1O0zgItvI4n64EMvYetmIKcZUI4/wwd7ropATTU?= =?us-ascii?Q?NmI3sWzDq8K5D23/zy3Bdc6/Sdvid9UnY8aJsC8/wGpSxR2ezWTvccVyB500?= =?us-ascii?Q?RmAZydKjd/QfA3TPmlM8PPBXsAuc8ptSNFYDmPzFz7Ee67iYW4RKLUcU7Fa7?= =?us-ascii?Q?9quHLjOOw8vgOfruAzgD1q9cRBtH+VE2szfe0bLaKNjKdch1Mo2wQggIeprw?= =?us-ascii?Q?VniCSMNfoqVnfnn6l2+a+diY/4t8PLAKeBn9hu0wRmcLWFdlboYkCLKKzTh+?= =?us-ascii?Q?UbJ9LG9hwwvI3BKkBsC6/hR1YfvL8eCcgnkMwi5QfeDsvsqYrjIGHTiZx17K?= =?us-ascii?Q?xpol1Hqy1BrEfg2hwb/tmRNrS73YdXup7RifGr98zN/E4+GThuyqelhsmnRj?= =?us-ascii?Q?0OCrkghqJE4VTRgLrfnC8opxmxozgKPIUw/eo4WXe+VU6ZfbIv6s6PUKk4sN?= =?us-ascii?Q?q7ZU3aBew7eM5zeIhD3Tqov6VDckIGr0xEcU32PDE551Qkr2ovsaFbOMa59y?= =?us-ascii?Q?6DqatBGuCUUf2RhvMSamqL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us-ascii?Q?4E58auJpEfqDuzldzuw5zl6TYU0lsL9DxqLtXZbeWwxeiGOyuTgpcEmsM8Ew?= =?us-ascii?Q?PqFiZcAEIUX6bWgdFf6K5wjaI82CpodJXlR3vz/mrK2aqlBPfClpI8Im/ubm?= =?us-ascii?Q?aCk3HkKwjKcqDzZcfJc5atXzlErqMzVFWR0UHU2Pco2K7P801+YyBpFdcdBn?= =?us-ascii?Q?11CaVpLgsg+8v4JpogFBD5tki3vyIOcpAt72sKkOzlho+nz3I9DHB1O/TCt6?= =?us-ascii?Q?FJDMFxcZknixt9DR9an05Ot7Ipy58gMi8ayzwDeZB7Ot775P35WBzNxs3rS6?= =?us-ascii?Q?taweaM9bKLanX/s7hlfO9glIVjk6li0=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: DM8PR11MB5670.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9ccbe425-e00b-4ebe-4402-08da42328ea2 X-MS-Exchange-CrossTenant-originalarrivaltime: 30 May 2022 11:50:13.4987 (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: 1Lo5ZB8AS4vphtqbc/1DJoky+ElLLOAQECSfAwqrMD1Nj3heHj9uo+coKfdAeoMIBOkzAVkMN4/tuFuBiAsKk/fiqwFIvXtKTfQ/rtFLvZ4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR11MB1499 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: Stephen Hemminger > Sent: Thursday, May 26, 2022 9:27 PM > To: dev@dpdk.org > Cc: Stephen Hemminger ; Dumitrescu, > Cristian ; Singh, Jasvinder > ; Wojciech Liguzinski > > Subject: [PATCH v5 3/3] rte_pie: fix incorrect floating point math >=20 > The function rte_pie_drop was attempting to do a random probability > drop, but because of incorrect usage of fixed point divide > it would always return 1. >=20 > Change to use new rte_drand() instead. >=20 > Fixes: 44c730b0e379 ("sched: add PIE based congestion management") > Signed-off-by: Stephen Hemminger > --- > lib/sched/rte_pie.h | 5 +---- > 1 file changed, 1 insertion(+), 4 deletions(-) >=20 > diff --git a/lib/sched/rte_pie.h b/lib/sched/rte_pie.h > index 3e2c1ef46721..528f2ea878e8 100644 > --- a/lib/sched/rte_pie.h > +++ b/lib/sched/rte_pie.h > @@ -217,7 +217,6 @@ __rte_experimental > _rte_pie_drop(const struct rte_pie_config *pie_cfg, > struct rte_pie *pie) > { > - uint64_t rand_value; > uint64_t qdelay =3D pie_cfg->qdelay_ref / 2; >=20 > /* PIE is active but the queue is not congested: return 0 */ > @@ -240,9 +239,7 @@ _rte_pie_drop(const struct rte_pie_config *pie_cfg, > if (pie->accu_prob >=3D 8.5) > return 1; >=20 > - rand_value =3D rte_rand()/RTE_RAND_MAX; > - > - if ((double)rand_value < pie->drop_prob) { > + if (rte_drand() < pie->drop_prob) { > pie->accu_prob =3D 0; > return 1; > } > -- > 2.35.1 Hi Stephen, Thanks for your proposed fix. It looks good to me, but since Jasvinder hand= led the PIE integration, I am going to defer this for his review once he co= mes back from vacation, just to make sure I am not missing anything here. Regards, Cristian