[PATCH] ethdev: fix strict aliasing lead to link cannot be up
Morten Brørup
mb at smartsharesystems.com
Thu Apr 11 14:44:42 CEST 2024
> From: fengchengwen [mailto:fengchengwen at huawei.com]
> Sent: Thursday, 11 April 2024 13.58
[...]
> Plus: yes, this patch mixes atomic and non-atomic access, but the main
> reason is that we want to simplify the implementation.
Yes, your design in patch v3 follows the current standard design pattern for atomics in DPDK.
I agree with you on this.
Thank you for describing the alternative, though.
> If we want to separate it clearly,
> maybe we should defined as this:
> struct rte_eth_link {
> union {
> RTE_ATOMIC(uint64_t) atomic64; /**< used for atomic64
> read/write */
> struct {
> uint64_t val64;
> };
> struct {
> uint32_t link_speed; /**< RTE_ETH_SPEED_NUM_ */
> uint16_t link_duplex : 1; /**<
> RTE_ETH_LINK_[HALF/FULL]_DUPLEX */
> uint16_t link_autoneg : 1; /**<
> RTE_ETH_LINK_[AUTONEG/FIXED] */
> uint16_t link_status : 1; /**< RTE_ETH_LINK_[DOWN/UP]
> */
> };
> };
> };
PS: More review comments provided in reply to the v3 patch.
More information about the dev
mailing list