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 058E443EB1; Fri, 19 Apr 2024 17:16:04 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C9D15402D9; Fri, 19 Apr 2024 17:16:03 +0200 (CEST) Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2070.outbound.protection.outlook.com [40.107.220.70]) by mails.dpdk.org (Postfix) with ESMTP id 19EFA402D4 for ; Fri, 19 Apr 2024 17:16:02 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=e8n9R91AZbH8r0OGKZW5PpB9jnRDd+ZKuDvxKoN4pznSi9XIrQl8QNjwwQPEAnU/yceJamA5ykvpZJRX8BIvOCHyXtbPD/7pv05lMZ5HawYwsPsXwivop0aOfVGStcfhlADNLuqiI8AJIhJ1PP7GPiRhkpScz+RpYYYu3E4uX7lXitQHGXa+5+vZWUUnEjOlGeMeMUCfKRueCclKQYEubMPv/QUpYfpY/nTGZe6V6NYT1/B9BFkHYFX5UWtTFY+ut78Nasbddae7zHuw+i3v92PfOkJCbfexf4t6uo7txJJ8QjUz9cpV6OtdGIcFcmPLidNhd+ZkaHV2zVAVWabPGg== 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=zj7j4NXC8PzN3AOgbakuJhw/l1JXTmE1YVpIkEDQs80=; b=X4sTRf+cVGDu0BncCkB+NEuBgvxSrzm3M7HN04tdefHXckbdcV4tbWY2NhUT7rblY5WYNjyx/ixXgllAVN8lnvD2ne4mtBs3gziBHfRE/76cTvPfo4yOi/r6otO4oKvQPaFTKc8Q+RYd9GLdsXr31HtrRVe/CL4L+6HCgzC+MRii2IZTfVr1mdMXOHezQtbuZIGgcI5SsKu2/pEN2XoZvVtRkgufhsMsCpR3ScUqDa8Y7WslauVQUSQaNnEenn4L2lS5L+zFEHYbSzwGW5Znb6g7HWvRYozLKUvowasfWXBJtUDtZ8yl3PnfRcGZrd6XSii2By1aq8YLFmVNLKswgw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=zj7j4NXC8PzN3AOgbakuJhw/l1JXTmE1YVpIkEDQs80=; b=aKGZeIRq8csND1JoRD34GTfnSPxYCg64D/JdqwO6SrGW3dltbIp7Qg3jgtPZCsVQuLbK8gjKTBvLyLAfPHukkVwUU3ZAiE7IVaFbRw7HSnboXlLHYQZN9oBdsfu8zk0SQIQV/rave/LRMxqn6Lv2QT4/IK2NCe3hSzRRjSLHjus= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; Received: from CH2PR12MB4294.namprd12.prod.outlook.com (2603:10b6:610:a9::11) by MN0PR12MB5980.namprd12.prod.outlook.com (2603:10b6:208:37f::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7452.50; Fri, 19 Apr 2024 15:15:57 +0000 Received: from CH2PR12MB4294.namprd12.prod.outlook.com ([fe80::282f:29d3:cac1:cde3]) by CH2PR12MB4294.namprd12.prod.outlook.com ([fe80::282f:29d3:cac1:cde3%7]) with mapi id 15.20.7472.044; Fri, 19 Apr 2024 15:15:57 +0000 Message-ID: Date: Fri, 19 Apr 2024 16:15:53 +0100 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v7] ethdev: fix strict aliasing lead to link cannot be up To: Chengwen Feng , thomas@monjalon.net Cc: dev@dpdk.org, huangdengdui@huawei.com, mb@smartsharesystems.com, stephen@networkplumber.org, roretzla@linux.microsoft.com References: <20240411030749.41874-1-fengchengwen@huawei.com> <20240418072818.2074-1-fengchengwen@huawei.com> Content-Language: en-US From: Ferruh Yigit Autocrypt: addr=ferruh.yigit@amd.com; keydata= xsFNBGJDD3EBEAC/M7Tk/DfQSmP1K96vyzdhfSBzlCaGtcxNXorq4fALruqVsD3oi0yfyEz9 4YN8x7py0o9EL8ZdpOX0skc0AMCDAaw033uWhCn0GLMeGRKUbfOAPvL6ecSDvGD7CJIO9j0J eZUvasBgPdM/435PEr9DmC6Ggzdzt8IuG4PoLi5jpFSfcqxZFCCxLUDEo/w0nuguk2FTuYJg B2zEZ4JTBZrw7hIHiFh8D8hr6YA6a5uTofq1tr+l048lbtdFUl8TR0aIExVzE4Z8qKZlcE+9 RQaewjK5Al1jLE4sHdmd3GN+IvgDF3D/fLsi25SKJDeGSdeHkOmaX0qGeM4WKIfU6iARRCiQ N3AmBIxZ/A7UXBKLaOyZ+/i3sE6Wb53nrO4i8+0K2Qwyh6LjTeiJAIjYKN43ppxz3DaI+QwQ vI+uyHr4Gg0Da9EPPz/YyKauSeOZCfCB5gIfICO0j6x0SCl8uQ2nLpjxcZkf0gjcwUzP3h+S 3x6NfDji9YEij0zczW/dcSpGgZ6vsFpPrtnP9ZXy6J53yp0kJtOJoOlkEFFdU2yCZnCDseum CoudmGLZVvS0/DzHDJejq+3kK3FDGktZBOxZIIpal+nFqS7lVgOZc4+huVv3jyhzoAUOEyXA XK5j6o7g8STUY+z33QNnHpdLvecMwuzmvqy0jR54yAbZ64mB9QARAQABzSNGZXJydWggWWln aXQgPGZlcnJ1aC55aWdpdEBhbWQuY29tPsLBlwQTAQgAQQIbAwULCQgHAgYVCgkICwIEFgID AQIeAQIXgAIZARYhBEm7aYjps5XGsPHCElRTPtCK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MTe2YScp9dIV7fsS5tpDwIs7BZNVM1l3NAdK+DLHqNxKuyO 8Zk= In-Reply-To: <20240418072818.2074-1-fengchengwen@huawei.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-ClientProxiedBy: LO2P265CA0246.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:8a::18) To CH2PR12MB4294.namprd12.prod.outlook.com (2603:10b6:610:a9::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH2PR12MB4294:EE_|MN0PR12MB5980:EE_ X-MS-Office365-Filtering-Correlation-Id: a108945d-98ed-4f2a-65b8-08dc60839cd8 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: hL7UOPtDh2Q+PHWpHvxwMX2OkxogqQctueC4YgRznPfdDZP/b4bm/R4zFZ+oDxk0qEICxedKwo9ztL3xpjlX8X1X0fpSA3K8HChK3eeisSolyyYg7leTzh2ucyrO2w7/wz5QATeVqKvBe+BXUfPUIYcCqGk08VLrOhWA/SkguKNdewTQz5wl2cse1x/KWcStzlUJwM0CeEpFP3ApTlrfrlaBRKSv4/+vGiGbeUeEWKV3Z8eS6LLfQrueEc5XpDmEXTkUrGqT0n/POU1hGaF+jz0Aw676sTsLhoac9hD62H6Cn8n6KQK+lYv66Vmjx71k+IwVN/j/zxGGyFNsGWc3OEihX5w+dRPK9YNKRp/9h6cQN6cSVZxsxS0qASgtV3Okf6MNoGy+i6sm7wd5qcgFeHSx/fU1KttlU64EOHUuPNG73Br8OOWXzGkncJ8JsOvYHSL+Mp4fgFNd571Mh668aSZvC+XKhYNqDblQEHxPHs4iQYwGScL/dcKSULMunt8SUU9S9U2BJgDd04x/JEPpYJBlYc0kUSkedZX/sofa3Hnkp5HTWu48fcf+S4sn8wXF3ZbSbQA+sJt/wLnQCo+m693fYM2wNUVYzehfqX+924exXXw2yEq+9BfT1PTavQEPOOSw55kLsfEDUsIjLYukU3UjTAQ7KVYV6cPFYCUeqfE= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CH2PR12MB4294.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(366007)(1800799015)(376005); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?UE55Y1AzT0s4UUZCbFRLR3YzZjBnclBadm53SnpOOGRFS2FtaWVzN1phVGg5?= =?utf-8?B?ZkxON3VoNFlSRU1uTWlMUEdIc2lRMHVFWDhrMzVKWFI0RlovMmJRbEwrWU55?= =?utf-8?B?T0JaVlFycE5SMTQzOWpWSHlycFpaYzNFM2h6SFRBdzV4UURrb3BYanpnQ0Vv?= =?utf-8?B?UjVRWFRXL0tIUGdCdW9UQXVQUVJNa3JDRlYvZXUwWnpLck5JMitHWjNwV3JM?= =?utf-8?B?RHJndlVKNlczcVJxbG80VmluSTdoamdMOThOTEV6WWRQQ0NjM2ZXQ1pyNlBE?= =?utf-8?B?dEIxMVVTU0FnMU1CMzNkOHNkTzVUMTVPc1dCZVRSOXIxWjFOTnZEZkhUWkMw?= =?utf-8?B?T3ZVS25oVTVLc1FwcEVvRlF4Z1M2a3Vwc0tyTUVEZlJHSjJ3Q3JCYVN0MWVl?= =?utf-8?B?WEZ6WjAzbkpSa3ZyZXBmcVhOVkNSUkxBYncvWWNxbmlyNlZtQ3pLZjh0cjh3?= =?utf-8?B?QnJWZzZlZlJnY2s1dTBUa0JxVk1uUVJpcXkrQjhheGRTYm5XWllETTNHejUz?= =?utf-8?B?QmZvTnZ1c3NnTTRzdVIrME4vcU9VTnFYWGtXSHRaR1VzSSswVFc3LzR1akZl?= =?utf-8?B?QWgxWXEwMnJYSXcrOWpJTVExVE9ZZE1wcFlQNHZMVm9nUmdNeCsvckJMNnFr?= =?utf-8?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mhhU0JJ?= =?utf-8?B?TFNJdnVmb2E5cEgwblVoQkV2dGNnTHRjbys0eklJWVUwdWFrNlBKblp6NGR3?= =?utf-8?B?aDJ5L3U2WTFwcVpSOTdUUjV0N1VkbnJwRFFMR25DNVJzRmtNRHc0OFhYWEYz?= =?utf-8?B?Zk9OUE0rK1NvRUl4eDZMTVNZRG9FK3lWdElPaGtRcU5hN0IvR2p0dVQzWmp1?= =?utf-8?B?MkRDc0l2RVEycHRJcFZhbnNJV0Vqdm45bzFiazFxRmlNTE9zanBLZkRnSWxk?= =?utf-8?B?N3VXeHFFaUIrSkFWRzdIKzMwZEtLN2JzVzZMVWhWL1BBNHRVRkQ1Rm5IdFl3?= =?utf-8?B?UURFVjZVZWtsNEhTOUhNOS9ndVNTdjJMVmUvWjVJMUJSRkcwNktFMDJMejFM?= =?utf-8?B?cGlZV3RnTzhIODhwdUVHLzVKaFlZckliL0VRTDhUQVJUUGNZRTBjNzZyYkYz?= =?utf-8?B?T2EybGxKZ0NrWURzbG9vVG1KaldFcVI5TWtrU2pyZDgzMkdBbFNxYkV2THdN?= =?utf-8?B?UHd5ZnNEdUltU25JcTh6Uk0xdlJKaUttck9xNllSNEdPUjJXa3RWMmJSRHpC?= =?utf-8?Q?4tbiP2hxT7LU/+PvmcGhO+WAb?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: a108945d-98ed-4f2a-65b8-08dc60839cd8 X-MS-Exchange-CrossTenant-AuthSource: CH2PR12MB4294.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Apr 2024 15:15:57.0460 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Zm/HhkLSOJqFlLZZbMfCf8lWGe27tyl5hLOBkyH0ampm7nl4dgQ+XEPYd+nOQ33j X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN0PR12MB5980 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 4/18/2024 8:28 AM, Chengwen Feng wrote: > @@ -1701,12 +1696,10 @@ static inline void > rte_eth_linkstatus_get(const struct rte_eth_dev *dev, > struct rte_eth_link *link) > { > - RTE_ATOMIC(uint64_t) *src = (uint64_t __rte_atomic *)&(dev->data->dev_link); > - uint64_t *dst = (uint64_t *)link; > - > - RTE_BUILD_BUG_ON(sizeof(*link) != sizeof(uint64_t)); > - > - *dst = rte_atomic_load_explicit(src, rte_memory_order_seq_cst); > + rte_atomic_store_explicit(&link->val64, > + rte_atomic_load_explicit(&dev->data->dev_link.val64, > + rte_memory_order_seq_cst), > + rte_memory_order_seq_cst); > Hi Chengwen, Overall looks good to me, but to increase readability what do you think to extract function call in the function param, like ``` struct rte_eth_link new_link; new_link->val64 = rte_atomic_load_explicit(..dev_link.val64, ..); rte_atomic_store_explicit(&link->val64, new_link->val64, ..); ```