From: Ferruh Yigit <ferruh.yigit@amd.com>
To: Chengwen Feng <fengchengwen@huawei.com>, thomas@monjalon.net
Cc: dev@dpdk.org, huangdengdui@huawei.com, mb@smartsharesystems.com,
stephen@networkplumber.org, roretzla@linux.microsoft.com
Subject: Re: [PATCH v7] ethdev: fix strict aliasing lead to link cannot be up
Date: Fri, 19 Apr 2024 16:15:53 +0100 [thread overview]
Message-ID: <b3f0138b-50ee-4f80-a2e3-77df25d59f96@amd.com> (raw)
In-Reply-To: <20240418072818.2074-1-fengchengwen@huawei.com>
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, ..);
```
next prev parent reply other threads:[~2024-04-19 15:16 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-11 3:07 [PATCH] " Chengwen Feng
2024-04-11 6:53 ` Morten Brørup
2024-04-11 6:58 ` Morten Brørup
2024-04-11 11:57 ` fengchengwen
2024-04-11 12:44 ` Morten Brørup
2024-04-11 12:04 ` [PATCH v3] " Chengwen Feng
2024-04-11 12:44 ` Morten Brørup
2024-04-12 3:27 ` fengchengwen
2024-04-12 7:24 ` Morten Brørup
2024-04-11 15:05 ` [PATCH] " Stephen Hemminger
2024-04-12 8:16 ` fengchengwen
2024-04-12 8:49 ` [PATCH v4] " Chengwen Feng
2024-04-13 8:04 ` [PATCH v5] " Chengwen Feng
2024-04-13 8:48 ` [PATCH v6] " Chengwen Feng
2024-04-15 13:15 ` Morten Brørup
2024-04-18 7:28 ` [PATCH v7] " Chengwen Feng
2024-04-19 15:15 ` Ferruh Yigit [this message]
2024-04-19 15:25 ` Ferruh Yigit
2024-04-22 6:42 ` fengchengwen
2024-04-22 6:38 ` [PATCH v8] " Chengwen Feng
2024-04-22 10:54 ` Ferruh Yigit
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=b3f0138b-50ee-4f80-a2e3-77df25d59f96@amd.com \
--to=ferruh.yigit@amd.com \
--cc=dev@dpdk.org \
--cc=fengchengwen@huawei.com \
--cc=huangdengdui@huawei.com \
--cc=mb@smartsharesystems.com \
--cc=roretzla@linux.microsoft.com \
--cc=stephen@networkplumber.org \
--cc=thomas@monjalon.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).