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 0B28045D30; Mon, 18 Nov 2024 08:05:02 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id EA57140DFD; Mon, 18 Nov 2024 08:05:01 +0100 (CET) Received: from AS8PR04CU009.outbound.protection.outlook.com (mail-westeuropeazon11011008.outbound.protection.outlook.com [52.101.70.8]) by mails.dpdk.org (Postfix) with ESMTP id D94134066D; Mon, 18 Nov 2024 08:04:59 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=xprlOAEnJlVqfEpBieKDbe7/iOTMGcPjyLxcWW4Fzu6NHB2mLr8WNasS2we5okF7V8izjDZ/ofD1Ed+vdZr6QiZ6I/Dco1MNXkdF520/v2oBh0d2IZVkz1nP+X295dm7yHXIYRfcDm2F8GiNPCR6U02IWaGPNXhtIQul1TnZTHFrpSLl8GknpF2F3ng/brDB2japD/o2FUb9iTt4JHWe4X1tQVxSz61m7G8Eg41Rj/ZBJULGqu3lYd3lTKjF8vdmx0yPwcSpKfBkLm+tcCfcvTxaxldpJJFvEln82AoOiSBG2y6Zp2xthmjM9Fk61M2wBeXJWGAe15pXJ3fL9pM+qQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=XPrRJ79xrjj5BBwuiyYxGPGVTU4eHd/6d4YnMCLJ8Es=; b=uwmwepGz4ycMcU/44aKkv6CPw6Dh+VaQeV14puAi4nehJl8WkYlahNGDvWW6iLgXw0U4fMPjj9e/jfyO9tMhX6uM7cFMnNUs73YfI72GmvDHwFD6G5BwqN7KCZe9c83jt3fYcGYn9khUFiPQUoinyXyCdAoXNIVar7qDVePwu0MzbBzIwgmXVm7UG4nijojpXKXW+pPRMHWafHC0THxwsigKPKukqv08/YCqkAbm4omkBQS7basKa6IjYlZq5UHkoS3z/9pHO1vllBOMK5UhSXdUs81Aja/pXJGcWDrnpZnxQRPihmHXsI7y2yP2b90fTD2HHSXnbacgpsaiGzo2yA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com; s=selector1-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=XPrRJ79xrjj5BBwuiyYxGPGVTU4eHd/6d4YnMCLJ8Es=; b=QadUwebQjES4V6niltUg6ta/Kf4bu4KoDokOl4NJqCGTKtXSxylqGiVHbwQmekO5iAeQDQJLuh564uPmiyL07gTsaUaEqwAo5jvlnq5BKLdrKRCm3YHBQ0n7JRz5Es5CF6ITfbqvpLqfmOYcWyDSnSrE5cmGBrZC2lg9NNVbVSvGd8WeMjCCdv4EBscll1UPIZbHyVORsnizVWGukPimJ7V1fIah6CFXcYJ6xPnCfG+bNBl/Gkq1uI4GdWFOis8fG5l66Td3xyzOA2M7RmloGBHhoU2ycgOoqtH3m8MEjL+ZAhjzuz/GwpUZ0SOYX2KH8YLftJKDB6InI8w/MqvOXA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=oss.nxp.com; Received: from PAXPR04MB9328.eurprd04.prod.outlook.com (2603:10a6:102:2b6::15) by AS4PR04MB9690.eurprd04.prod.outlook.com (2603:10a6:20b:4fd::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8158.22; Mon, 18 Nov 2024 07:04:57 +0000 Received: from PAXPR04MB9328.eurprd04.prod.outlook.com ([fe80::367:d59:375:fb87]) by PAXPR04MB9328.eurprd04.prod.outlook.com ([fe80::367:d59:375:fb87%5]) with mapi id 15.20.8158.019; Mon, 18 Nov 2024 07:04:57 +0000 Message-ID: <25ed9d3d-7a68-e294-10b0-94c72745d768@oss.nxp.com> Date: Mon, 18 Nov 2024 12:34:45 +0530 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.5.0 Subject: Re: [PATCH 16/16] net/dpaa2: fix bitmask truncation Content-Language: en-US To: Stephen Hemminger , dev@dpdk.org Cc: nipun.gupta@nxp.com, stable@dpdk.org, Hemant Agrawal , Sachin Saxena , Nipun Gupta References: <20241115060738.313190-1-stephen@networkplumber.org> <20241115060738.313190-17-stephen@networkplumber.org> From: Hemant Agrawal In-Reply-To: <20241115060738.313190-17-stephen@networkplumber.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: SI2PR02CA0023.apcprd02.prod.outlook.com (2603:1096:4:195::11) To PAXPR04MB9328.eurprd04.prod.outlook.com (2603:10a6:102:2b6::15) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9328:EE_|AS4PR04MB9690:EE_ X-MS-Office365-Filtering-Correlation-Id: 820c858a-3f32-41b4-48f7-08dd079f4f7c X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|1800799024|366016; X-Microsoft-Antispam-Message-Info: =?utf-8?B?REpOSnlaSVl4bE9iM0FuS0xSMC9BOWludzB6MDJUN0tEYy9mU0xNRmI3NGpQ?= =?utf-8?B?M1UyQ09tTTZKOXhQWkdpQnBXZ3grVDhIK09xVmE3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dEUm5MNHB1dnhUYXJnTEN1Lzk0a2lVMlcwcmNjYi9i?= =?utf-8?B?VDhndldIdzlzWENqbEI5ODdWbUdUTFRidy9hVGVoUG91bE5iYVVMWjh2clJM?= =?utf-8?B?cEd3RWM1WEJsY3lPRW1lZG5qNVNoWWpoMmJDajlBNnlTSSs3UHlOdFVnMjRm?= =?utf-8?B?dmswWW9aclJqTVNaV2RpR1lxY1M3a2Jxc0RzQmtxRFpzY1ZKcGtjc3NsRzlK?= =?utf-8?B?aDNLQmtpd2h1R05UVCtQTno0bWdkanFDMDFLWksrRGU2WWJPazlLemt3SHFM?= =?utf-8?B?c0NkcCtjOTY5L2hyclRlQzNCTDFqNnZVQ25UUHhKaGh0RU16YUkzVG9CRXRR?= =?utf-8?B?MTFVNDJKQXc2bnNWbzNIZG1VNzJwQmIyOUJnVlJmUnVrTWFwbVd0WFpFZHV1?= =?utf-8?B?OXh5YmhHZVozbjhjdUxuVUZVRksxUExzTWNBWTMvZVgyUk94WjdnYWptOUVG?= =?utf-8?B?ampsLzBnbnFGbVF0M3VieENnQmlVSGRCWVdIc2loaWtHUE1ueGRWbmpkckVM?= =?utf-8?B?TFVhaHIvdnpQNjZRaEttUitRc0haSG5tWWV6N1BNYUJ3VC94Q2puQjZLOTFF?= =?utf-8?B?Z3BHMTVqV2E3Yk1oREZ3dVRQS1ZUcXpndC9wMFlNa0lIL2t1Vk1Jd1YwM3Ji?= =?utf-8?B?ekhvSTMvOXVFdVpLTVl0Q2w1QUk5RDhvUGtXSEpXRjFsYTB3U2RYeDhCc0oz?= =?utf-8?Q?jNJ/KEFb2McPkv2jyKXl?= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PAXPR04MB9328.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(376014)(1800799024)(366016); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-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U0hHTHNTeStiMExaMUdJbTZXaU9wQndlMElPYmd3Wm05Z0h6R29iUm0yYjlO?= =?utf-8?B?bkJmTWk5cXJSNkFpSk00Z09aeDAvRHhJc3pxZ0UxZjNDb0l6K2RlaDhJVk9X?= =?utf-8?B?VzhwUFlWcjVkV3RtZjJWaDAwSi9yNEIyVWJ0U2pMbXFLeVpSSm9qbUJDREV6?= =?utf-8?B?emw2LzdZZE9LWlFrR291TkxIanV0Nm1zTHAwdHNja1N6dStxREJibDU4MXZK?= =?utf-8?B?ZmpuUU1NeTM0MmJ0SXU0eTE2N1dwTXd6VUJFQVBCOGcrUTAyd0Z2K1g2Qm5V?= =?utf-8?B?ZXhCU2I5aHpQRmsyYndwRXhRV3lMTTRCaVNPc0NHYUxvSitVZTlNQWMwR3M1?= =?utf-8?B?UDRuMUFrM0tlcjBYUTVpd2gvUkE2WWxDZS9CT0ppS2l6V2IxeUFJbnBjMjJY?= =?utf-8?B?NWc9PQ==?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 820c858a-3f32-41b4-48f7-08dd079f4f7c X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9328.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Nov 2024 07:04:57.3589 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: H+uL929X6JSU2Hy3xeEuWkVHYjlH61ivXjoAf5T/d9Gh0pOVBeHRbQhzbeAirWSHi+uJLbLwSXxGnJOLZNxWHA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS4PR04MB9690 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 Acked-by: Hemant Agrawal On 15-11-2024 11:35, Stephen Hemminger wrote: > The dqrr_held mask is 64 bit but updates were getting truncated > because 1 is of type int (32 bit) and the result shift of int is of > type int (32 bit); therefore any value >= 32 would get truncated. > > Link: https://pvs-studio.com/en/blog/posts/cpp/1183/ > > Fixes: 2d3788631862 ("net/dpaa2: support atomic queues") > Cc: nipun.gupta@nxp.com > Cc: stable@dpdk.org > > Signed-off-by: Stephen Hemminger > --- > drivers/net/dpaa2/dpaa2_rxtx.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/drivers/net/dpaa2/dpaa2_rxtx.c b/drivers/net/dpaa2/dpaa2_rxtx.c > index e3b6c7e460..e253bccecd 100644 > --- a/drivers/net/dpaa2/dpaa2_rxtx.c > +++ b/drivers/net/dpaa2/dpaa2_rxtx.c > @@ -933,7 +933,7 @@ dpaa2_dev_process_atomic_event(struct qbman_swp *swp __rte_unused, > dqrr_index = qbman_get_dqrr_idx(dq); > *dpaa2_seqn(ev->mbuf) = dqrr_index + 1; > DPAA2_PER_LCORE_DQRR_SIZE++; > - DPAA2_PER_LCORE_DQRR_HELD |= 1 << dqrr_index; > + DPAA2_PER_LCORE_DQRR_HELD |= UINT64_C(1) << dqrr_index; > DPAA2_PER_LCORE_DQRR_MBUF(dqrr_index) = ev->mbuf; > } > > @@ -1317,7 +1317,7 @@ dpaa2_dev_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) > flags[loop] = QBMAN_ENQUEUE_FLAG_DCA | > dqrr_index; > DPAA2_PER_LCORE_DQRR_SIZE--; > - DPAA2_PER_LCORE_DQRR_HELD &= ~(1 << dqrr_index); > + DPAA2_PER_LCORE_DQRR_HELD &= ~(UINT64_C(1) << dqrr_index); > *dpaa2_seqn(*bufs) = DPAA2_INVALID_MBUF_SEQN; > } > > @@ -1575,7 +1575,7 @@ dpaa2_set_enqueue_descriptor(struct dpaa2_queue *dpaa2_q, > dq_idx = *dpaa2_seqn(m) - 1; > qbman_eq_desc_set_dca(eqdesc, 1, dq_idx, 0); > DPAA2_PER_LCORE_DQRR_SIZE--; > - DPAA2_PER_LCORE_DQRR_HELD &= ~(1 << dq_idx); > + DPAA2_PER_LCORE_DQRR_HELD &= ~(UINT64_C(1) << dq_idx); > } > *dpaa2_seqn(m) = DPAA2_INVALID_MBUF_SEQN; > }