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 BB3114545B; Fri, 14 Jun 2024 14:16:41 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4FFED402D3; Fri, 14 Jun 2024 14:16:41 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.16]) by mails.dpdk.org (Postfix) with ESMTP id D5B4740264 for ; Fri, 14 Jun 2024 14:16:39 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1718367400; x=1749903400; h=message-id:date:subject:to:cc:references:from: in-reply-to:content-transfer-encoding:mime-version; bh=RnEe4TguCzBYU9gIv0FoRTS1ZTGygerChXn+4h/S9F0=; b=lYQbpJDOmMqT6+3JcITXkfPR0TzPKlT166l59Byj+bHSEuzK4w/MYUfl oitenMQr21M0KTsoE7DZxUfpX+KLwBJH0rnfz8RZfKjHErRgiiieb3/Fz Ec0ACVNE5+VimG2ag67i8AMBjI9YTv40lZfAw1LPUf/Y0fPGU227IIMMD 8Lw5PA+aEAVswXwf508HLcH66yj5dujDcmijZ9ipOnQ0j+Qy32QW3qzij DKuO+qBfCL2xbS60XNceLluHqOGi+jMFgL1qTdkG3g9EGjnkN9Iw+FWey dHtWyAD4uf1sKVfKD20YTH0LYAxVt7QSkQXzfHqGBnYm1isG4GhGeCr0i g==; X-CSE-ConnectionGUID: ZJxXpBDET26B91E7uVomSg== X-CSE-MsgGUID: +Js9NslNQMW1Fbc/JmopMg== X-IronPort-AV: E=McAfee;i="6700,10204,11102"; a="12074337" X-IronPort-AV: E=Sophos;i="6.08,237,1712646000"; d="scan'208";a="12074337" Received: from orviesa002.jf.intel.com ([10.64.159.142]) by fmvoesa110.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Jun 2024 05:16:38 -0700 X-CSE-ConnectionGUID: 1uk8EVNuQzSJrp2JquHfAw== X-CSE-MsgGUID: WtyTlDEtSeCjGgyuyCTFgg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,237,1712646000"; d="scan'208";a="71258089" Received: from fmsmsx603.amr.corp.intel.com ([10.18.126.83]) by orviesa002.jf.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 14 Jun 2024 05:16:38 -0700 Received: from fmsmsx611.amr.corp.intel.com (10.18.126.91) by fmsmsx603.amr.corp.intel.com (10.18.126.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Fri, 14 Jun 2024 05:16:38 -0700 Received: from fmsmsx603.amr.corp.intel.com (10.18.126.83) by fmsmsx611.amr.corp.intel.com (10.18.126.91) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Fri, 14 Jun 2024 05:16:37 -0700 Received: from FMSEDG603.ED.cps.intel.com (10.1.192.133) by fmsmsx603.amr.corp.intel.com (10.18.126.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39 via Frontend Transport; Fri, 14 Jun 2024 05:16:37 -0700 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (104.47.55.172) by edgegateway.intel.com (192.55.55.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Fri, 14 Jun 2024 05:16:37 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=F3hGC16+kaaByYiz7viShtw9p95AQPbg2VdFKNTei5BplcT18Ar53D/sa5GbGckDE3T0GCHgca67/cwSgJn22zE5PrsZvZkKsBM6HldegYJQV4dJmVJbMXy3bR0sVhQh8SJGGETVNyQt2WqIdjmpsqZIAHcvYNju+fYi4kzdIfBDRt3xcn3CL2XVRM35c+mLvTHnZdD/Fc9VizdifsAcSPq5orcazl3NhyE0bjbZAIbiTduN8K/MgLVsyRk1l+lruxTtNaRXWhzOdi89xslf+6BNStGKOBEIo7XDP7m1B1glS5QiJsUBk+9yNKXdrppYD8CLCBMsOIQrIy+WPWbtXQ== 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=ZxN9d4Pi4t5av9frA91MOuVHLov46xlSoYbNM+PQ+lk=; b=iXF6m3O5WzY+Gl1KGr+Cl2KYPF4OF1rJvrBOQJQEs6ZLa3juz9MR9R+Sa9Ly0vnEt3Zy2Di0qmEkgp5bevPUWf0FRGBHRE02IjLRsIijRC0FrqrnnwcDeGE25uCOWjQyLoaspfe5oPItMVbqulEa3geE+gYDMmCl/i+vrFoL2yH6YD6ip/ENvQ7Dl78nxznAAhSSBPTqEcLP8mWp2nX2ktCth1stGMdhcqCULaTUUR+OO/weA1b2PhOw3ZyloMmC2Woo9Ac7CjCYJJFnnel8hLpIk7WURZ1FojsqkTygnZ1WwjPtQFGYDI3DTGcrRqUmJ+PKCZQ6pb0mXNUOUXvZHw== 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 Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from DM4PR11MB6502.namprd11.prod.outlook.com (2603:10b6:8:89::7) by MW3PR11MB4652.namprd11.prod.outlook.com (2603:10b6:303:5a::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7633.37; Fri, 14 Jun 2024 12:16:29 +0000 Received: from DM4PR11MB6502.namprd11.prod.outlook.com ([fe80::21e4:2d98:c498:2d7a]) by DM4PR11MB6502.namprd11.prod.outlook.com ([fe80::21e4:2d98:c498:2d7a%5]) with mapi id 15.20.7677.024; Fri, 14 Jun 2024 12:16:29 +0000 Message-ID: <8a04e1a1-e13d-422c-8387-00877cc45e30@intel.com> Date: Fri, 14 Jun 2024 14:16:24 +0200 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v3 05/22] common/idpf: avoid defensive programming To: Soumyadeep Hore , CC: References: <20240604080611.2197835-1-soumyadeep.hore@intel.com> <20240612035257.2245824-1-soumyadeep.hore@intel.com> <20240612035257.2245824-6-soumyadeep.hore@intel.com> Content-Language: en-US From: "Burakov, Anatoly" In-Reply-To: <20240612035257.2245824-6-soumyadeep.hore@intel.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: DUZPR01CA0060.eurprd01.prod.exchangelabs.com (2603:10a6:10:469::18) To DM4PR11MB6502.namprd11.prod.outlook.com (2603:10b6:8:89::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM4PR11MB6502:EE_|MW3PR11MB4652:EE_ X-MS-Office365-Filtering-Correlation-Id: b03b3557-49b4-4154-3dad-08dc8c6bd231 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230037|366013|376011|1800799021; X-Microsoft-Antispam-Message-Info: =?utf-8?B?U3M2ZUVhdUtoVzVYZGllb1ZLdUdRZ2hjMHJZdXY2VVB1Tk5YK2p3L29jd1dM?= =?utf-8?B?SWR4ZEFmTzlYVVVMRldKbDVqZDNwaFI0M3BCbzZ4MGREZmlFUFZTdVVNOGVY?= =?utf-8?B?eGhsdjA0RXl1YzJET1EzdUpiWmZrWDhJcGc2dno1V2QrSExTM0Znd2pjRjZN?= =?utf-8?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a2dn?= =?utf-8?B?SWpGRVdCUktrdUNHcTk0c1Vnb2IzV011NEgrQ3JBeWpuNW5yTlFGNWRoV0g1?= =?utf-8?B?cTNJc1RsRjNDUHBlRlMzcnRWMTZXbFl3KzNnaEI3V3Y3a25vZEhiZXVlTDZl?= =?utf-8?B?YUhaUWZVNlZiYlh3T1FxR3BxOU5qVlZ6SXFMQUNLUjg1dUFhZE5sL3h1M1J3?= =?utf-8?B?QTRRMzJMU0xzaWYzTXBzUHJMOGdVeG4rZjRNNE5rWi90MHBMN0Z6RGg1VXJU?= =?utf-8?B?QWJBcXZjeThEWEJERU1UcG5OSmNDLzYxLysrbm0yZEVOTkpZQXlJNUswK1lU?= =?utf-8?B?YVZQbmRVZ01scVhtbXA3QWF1U2lMMVMxcWhVamcyTGlTQkROUzFyWUxiNGtX?= =?utf-8?B?Qy91dTNkZVlpUk42eHcvTDg3MFJlVEMvaThDUW82c0IwMUJtYnVxU2hVejlM?= =?utf-8?B?b09EV0pHYjg3djcyU2FQQ28yaHVvVzY5bE9oN08zVDhNekcyaTNRSG5XeVNt?= =?utf-8?B?bldGVG9ZQURSamQvYVNpdW85TEc1ZkZ2dDZ1S3llWldmSlhESStaS2h3Zkxi?= =?utf-8?B?aUFscnd4bnNUMFBKUE9KZFh4eTBlMjlTNzhCd0lBN04rZytvcEVUUHZQVklW?= =?utf-8?B?Tjh3V2VRbEM2RTJubERsbUU5a1hjcEMvVi95Z2poaXFPUFFmTXlwZ2xaekxs?= =?utf-8?Q?GtZ3NGNy3hQaLDcixrh6uIu+GUy+vYAPrdOXaXs?= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM4PR11MB6502.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230037)(366013)(376011)(1800799021); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?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NjhVNm94NVl0ZXNjMjJR?= =?utf-8?B?VlZGYW9LdVd4SllKekR5eHdXckdWNHJraExweDk1a096ZGs0a3ZEVGRwUDJP?= =?utf-8?B?Sm1rYVNISlc2SHZaRU1JWVFrZ09vK2ZLeDMwTldrcjk0SGNRVk40aTU5azRF?= =?utf-8?B?L0ZGUC94L0YwRUpFd1dXTGpoRXRGL0w5czhwTmt5Vnhoc0lWblNneUU4WGtW?= =?utf-8?B?ZUQybjRTMmhJZkI5K1ZKOFpoRStwWVlpUmxTYmRJRzExWmx0clptSStxTysx?= =?utf-8?B?enB4Y0VrakVFQXUwWUNoQ2xNNVhMSFROczRjMFNwT2gxRWF2Z29Jak0yQzh2?= =?utf-8?B?MFFFVURla280dTduZ1NYZityeWlKeVBlaXFKR3Y0WkZEQkUzSHlHRjFycFlK?= =?utf-8?B?U2c9PQ==?= X-MS-Exchange-CrossTenant-Network-Message-Id: b03b3557-49b4-4154-3dad-08dc8c6bd231 X-MS-Exchange-CrossTenant-AuthSource: DM4PR11MB6502.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Jun 2024 12:16:29.6676 (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: Oc8Ju7hrvxZ4Fi8E+B2DYX1wYAYuRdxfj/tM4u+Xh34ZwlXLw8mFQNy9Ebkt5lETxcLyT7iKgvg3RnvxwkyW+cLyG/FkyqWEb2kbWyhfb30= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW3PR11MB4652 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 On 6/12/2024 5:52 AM, Soumyadeep Hore wrote: > Based on the upstream feedback, driver should not use any > defensive programming strategy by checking for NULL pointers > and other conditional checks unnecessarily in the code flow > to fall back, instead fail and fix the bug in a proper way. > > Some of the checks are identified and removed/wrapped > in this patch: > - As the control queue is freed and deleted from the list after the > idpf_ctlq_shutdown call, there is no need to have the ring_size > check in idpf_ctlq_shutdown. > - From the upstream perspective shared code is part of the Linux > driver and it doesn't make sense to add zero 'len' and 'buf_size' > check in idpf_ctlq_add as to start with, driver provides valid > sizes, if not it is a bug. > - Remove cq NULL and zero ring_size check wherever possible as > the IDPF driver code flow does not pass any NULL cq pointer to > the control queue callbacks. If it passes then it is a bug and > should be fixed rather than checking for NULL pointer and falling > back which is not the right way. It seems that the commit log calls out changes that weren't made in this patch? > > Signed-off-by: Soumyadeep Hore > --- > drivers/common/idpf/base/idpf_controlq.c | 4 ---- > 1 file changed, 4 deletions(-) > > diff --git a/drivers/common/idpf/base/idpf_controlq.c b/drivers/common/idpf/base/idpf_controlq.c > index bada75abfc..b5ba9c3bd0 100644 > --- a/drivers/common/idpf/base/idpf_controlq.c > +++ b/drivers/common/idpf/base/idpf_controlq.c > @@ -98,9 +98,6 @@ static void idpf_ctlq_shutdown(struct idpf_hw *hw, struct idpf_ctlq_info *cq) > { > idpf_acquire_lock(&cq->cq_lock); > > - if (!cq->ring_size) > - goto shutdown_sq_out; > - > #ifdef SIMICS_BUILD > wr32(hw, cq->reg.head, 0); > wr32(hw, cq->reg.tail, 0); > @@ -115,7 +112,6 @@ static void idpf_ctlq_shutdown(struct idpf_hw *hw, struct idpf_ctlq_info *cq) > /* Set ring_size to 0 to indicate uninitialized queue */ > cq->ring_size = 0; > > -shutdown_sq_out: > idpf_release_lock(&cq->cq_lock); > idpf_destroy_lock(&cq->cq_lock); > } -- Thanks, Anatoly