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 B874B4545B; Fri, 14 Jun 2024 14:22:02 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4863F4060B; Fri, 14 Jun 2024 14:22:02 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.13]) by mails.dpdk.org (Postfix) with ESMTP id C432040264 for ; Fri, 14 Jun 2024 14:21:59 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1718367720; x=1749903720; h=message-id:date:subject:to:cc:references:from: in-reply-to:content-transfer-encoding:mime-version; bh=FiZvXmXUKzFgDZQF6IDP14Kz88O9+7xupjvyK6wkfAo=; b=kxPR8yYzaX4tvolmUXcPwkb9R3HJd2Qs51fFBqMaRXBDCpSX/j/YlikH tSbcnA0uKbxmyjNQ/lzjAdZa3SftZT3oH94vPEgERMh1m9ebWqW4hI5CF 5gATjPwS0fwtx/D2vtPGjMitYHPNSx9S1LEoU0qNK5ldx8fNZry677KLB /rVrSHb/xpABcJUj3YoPBrg25bk2XybFFF7a3MyNm3EBMWjHGsexVXB3p agBfoKj2WyyuKNAivxxUrsRXM97usOw/4aJAAcUBvmOPuuKaBDMDjODZr az8c08cpvcyxWlIsJ7qrL5kTNpkpVATPBYV0S7MX/Dn6WLrW9nUiUPlCC g==; X-CSE-ConnectionGUID: WZzcRjSJSg+Jd6eFiq9lJA== X-CSE-MsgGUID: IX3y267uT8OdldbTx62PmQ== X-IronPort-AV: E=McAfee;i="6700,10204,11102"; a="18170940" X-IronPort-AV: E=Sophos;i="6.08,237,1712646000"; d="scan'208";a="18170940" Received: from orviesa004.jf.intel.com ([10.64.159.144]) by fmvoesa107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Jun 2024 05:21:59 -0700 X-CSE-ConnectionGUID: YLTe/f0mQ/OcU3eTbmSXlQ== X-CSE-MsgGUID: gQgOuD9SSwG5iynTkt1EoQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,237,1712646000"; d="scan'208";a="45604700" Received: from orsmsx602.amr.corp.intel.com ([10.22.229.15]) by orviesa004.jf.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 14 Jun 2024 05:21:59 -0700 Received: from orsmsx610.amr.corp.intel.com (10.22.229.23) by ORSMSX602.amr.corp.intel.com (10.22.229.15) 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:21:58 -0700 Received: from orsmsx611.amr.corp.intel.com (10.22.229.24) by ORSMSX610.amr.corp.intel.com (10.22.229.23) 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:21:58 -0700 Received: from ORSEDG602.ED.cps.intel.com (10.7.248.7) by orsmsx611.amr.corp.intel.com (10.22.229.24) 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:21:58 -0700 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (104.47.59.168) by edgegateway.intel.com (134.134.137.103) 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:21:57 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QOksPEaGr2LLo8KcqZB68A4M4b1444PwnCCW2TDm+690OLjAYQRjr/NXcflnC6nS8grvSwgCw2WR07QZEzLdaO6UdOeMe9csfx+lbNWcBZYe107hUbq6i/SfGHxRdu0EeFk/xMSCKAppCHNbp1EkIz9FoRZ/8b2Ycm/Tk81NQtgpy6SZ9Z1iErk6KqmczQo564/j5FJrcZTNf6Q8QPiNYlFGvbl/Oi/5ugVBCfbzs9qcdH1SNJrrIxpt+1Useplbl6rDFY1AvStiyNx0qWi9/uQK8UWGo18OTMu+BSlyg4JJvqogt2HabKR0Dl8FAkFGqXWOOiVeTLz7QmKhoBgXVQ== 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=BRLwXSgX13M4iUZ1ouJwYKYxAdndDfic+Bx+QCl1yHY=; b=QxntfXznhWphc+2lDR+/2bEfJBqhWxhzavyDpZMHZVr3yQDE4HQQt0Pmv4GlTl0ywrgo2GPaGhhK+avq75rtCX+HEMpg0X+KN2M2HrwAyD5lWrUPGcv/N8wxIoIV8VLQyXlj98Oo4zwZfAqTFh3lnB9mxEqK+GXaAxsarZTfbKmJ86UNh8Sq/57+IuRUiVT5q0AJaa+UOIKOO2JD48+GZpGvb3invaCVpxvFTcYzA5h17fKQj/7QU0vKcDS78J1K0rrc+KH4yiZaSeY4aqSdFEdnqHGyAOqyfklatfBCdSdCj4zPozRWpn+HmBfQlOHUid4eylY8xF4aSE8Q1eyEvQ== 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 DS7PR11MB7808.namprd11.prod.outlook.com (2603:10b6:8:ee::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.25; Fri, 14 Jun 2024 12:21:51 +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:21:50 +0000 Message-ID: <8ee43aae-0c1b-4233-9f23-d771bb4a6385@intel.com> Date: Fri, 14 Jun 2024 14:21:44 +0200 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v3 09/22] common/idpf: refactor size check macro To: Soumyadeep Hore , CC: References: <20240604080611.2197835-1-soumyadeep.hore@intel.com> <20240612035257.2245824-1-soumyadeep.hore@intel.com> <20240612035257.2245824-10-soumyadeep.hore@intel.com> Content-Language: en-US From: "Burakov, Anatoly" In-Reply-To: <20240612035257.2245824-10-soumyadeep.hore@intel.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: ZR2P278CA0064.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:52::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_|DS7PR11MB7808:EE_ X-MS-Office365-Filtering-Correlation-Id: b697641b-bf91-4712-2d03-08dc8c6c9179 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?akxSNWl0TC9VdDBxWDhualdoc3BIYlF2dE94U0pGdkN0dlhlM0NVTm5XSFV1?= =?utf-8?B?OHd6azJIamtqN2ZLMG5qV2JBTFRROWdTN3h3a3VQYzllc0FpQjNkK0tGYzRV?= =?utf-8?B?Q1BzK0g3S3J5M09adEZyQkV5VFFIQ1pwRmlUZVErbXcwS0lpYStDSlFqMnJa?= =?utf-8?B?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QUdwMVAyR1oxblI4?= =?utf-8?B?MTVOd0tUTUpqUnNXeXBrbDA2cEFVU2ZlbzhtSkdNVVlZcnRsM2VSMCtjQU95?= =?utf-8?B?K2FxYzAxanRNQWs4cktWRVVyaHRFZCtUY05qamFLREFYQkpycnE0V1Qrc2l6?= =?utf-8?B?V3FsQ0F3Vm1mK1pzbkpQZjYzSWJrdzZ6N2R5Q2dnZ293RTJ2cmZIdnY0b29w?= =?utf-8?B?a1BobkVvTnJiL1I0Mzg1ZmFiRjdXZ2FTYlNKc0l0WDA3Vm1LbjBuWVcraEJw?= =?utf-8?B?SlJVenI0Ym9mcDd6TlF0bU5nbGsrZnNqanFQbFMyWENEeXpXMWwyT1lObUxx?= =?utf-8?B?dlNqcm9xWlFWNHFFWEhlTUJiZ2UyaDZ2WXBmQ2lqYmxJNUxja2E5bHh1aVho?= =?utf-8?B?WGJQUE9lWjBjVUJTSDR0eUZWM0Y5THQ3a3hWaVNLWmxJc2FvRUUrVDNnV3g2?= =?utf-8?B?NlkvT2NJQzZ2TndCUHZNQ3Z6MDVkS3VJdmxXcFovYllZLzNsMWMxWVZzRWt2?= =?utf-8?B?VXZKYXZlbExxU0ZQcHVOR2ZoeUQ3djdjZU5qZmVrTmxsMHZIemd6L1RWZlh0?= =?utf-8?B?M2JKR2pCb2R1RjhSelNwQVJFK1ZrdXlNWjIyM00xU3NoQ1JyUnlQUkdsbi94?= =?utf-8?B?MFZJc0czS0t3MThpQVNpS25IaDBoTjdSTytFa1h2TGhIWGw2ZktwT2d1S1lJ?= =?utf-8?Q?Oux+unfEqKX6Gu9otc=3D?= 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-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1ppdTBxS08wZTA3TEtQVnNQcVdKMDc3MVNEeWlvWkNQV3ptZElOQjlU?= =?utf-8?B?b3V2bVdScDcxdDhqcmdZQ2puWHFtQW5oZ1luYjFhSGpsZmlTaUh4RkxaU3Fp?= =?utf-8?B?WHBrREEzbGlyNCtGZFdwZ0dJdW9WYit4MWY4SFlFLzh5N0lMdFBPNDRuSXhi?= =?utf-8?B?a1pOYnYyQ2lXQWhvSitrTDgydjR6Ri84cHpNcVFCdHl4T3lZV2hYU0RaeFcz?= =?utf-8?B?ZmNjczk4aDJZNzBOQlZaOGt2WmZnQUloUTZ1Yk5DcERESzVHT25HaWNjUjZV?= =?utf-8?B?a3IwRFJsWWpweUN3MEdwSkk5VHU2b1VUcDZXWVE5RXA2WGZwYkJob04xazI3?= =?utf-8?B?MTFyZzNYZEVVMW16RzgvN0REYi9pU2tNeW1sTzhDUi9ncGlZTThadEVIUWdh?= =?utf-8?B?akE9PQ==?= X-MS-Exchange-CrossTenant-Network-Message-Id: b697641b-bf91-4712-2d03-08dc8c6c9179 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:21:50.5740 (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: QtGNg4OBNyMQJQhRYdZQRPDlPe9KYL15ASZQc6Af2NBWF/7RmOoHI6KQ7gfxzAe+4E1J/1Z21KQnN2ICfmdNoiTGlRmm5PJhFygA+ls9100= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR11MB7808 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: > Instead of using 'divide by 0' to check the struct length, > use the static_assert macro > > Signed-off-by: Soumyadeep Hore > --- > drivers/common/idpf/base/virtchnl2.h | 13 +++++-------- > 1 file changed, 5 insertions(+), 8 deletions(-) > > diff --git a/drivers/common/idpf/base/virtchnl2.h b/drivers/common/idpf/base/virtchnl2.h > index 1f59730297..f8b97f2e06 100644 > --- a/drivers/common/idpf/base/virtchnl2.h > +++ b/drivers/common/idpf/base/virtchnl2.h > @@ -41,15 +41,12 @@ > /* State Machine error - Command sequence problem */ > #define VIRTCHNL2_STATUS_ERR_ESM 201 > > -/* These macros are used to generate compilation errors if a structure/union > - * is not exactly the correct length. It gives a divide by zero error if the > - * structure/union is not of the correct size, otherwise it creates an enum > - * that is never used. > +/* This macro is used to generate compilation errors if a structure > + * is not exactly the correct length. > */ > -#define VIRTCHNL2_CHECK_STRUCT_LEN(n, X) enum virtchnl2_static_assert_enum_##X \ > - { virtchnl2_static_assert_##X = (n)/((sizeof(struct X) == (n)) ? 1 : 0) } > -#define VIRTCHNL2_CHECK_UNION_LEN(n, X) enum virtchnl2_static_asset_enum_##X \ > - { virtchnl2_static_assert_##X = (n)/((sizeof(union X) == (n)) ? 1 : 0) } > +#define VIRTCHNL2_CHECK_STRUCT_LEN(n, X) \ > + static_assert((n) == sizeof(struct X), \ > + "Structure length does not match with the expected value") > It appears that the patch also removed CHECK_UNION_LEN macro (presumably because it is unused and no longer needed). Would be good to add this to commit message. > /* New major set of opcodes introduced and so leaving room for > * old misc opcodes to be added in future. Also these opcodes may only -- Thanks, Anatoly