[PATCH v8 1/8] net/af_packet: fix frame status memory ordering
Stephen Hemminger
stephen at networkplumber.org
Wed Dec 2 18:26:58 CET 2026
On Wed, 2 Dec 2026 09:17:57 -0800
Scott Mitchell <scott.k.mitch1 at gmail.com> wrote:
>
> +/* tp_status hands a frame between the kernel and us; order frame accesses */
> +static inline uint32_t
> +tpacket_read_status(struct tpacket2_hdr *ppd)
> +{
> + return rte_atomic_load_explicit((RTE_ATOMIC(uint32_t) *)&ppd->tp_status,
> + rte_memory_order_acquire);
> +}
> +
> +static inline void
> +tpacket_write_status(struct tpacket2_hdr *ppd, uint32_t status)
> +{
> + rte_atomic_store_explicit((RTE_ATOMIC(uint32_t) *)&ppd->tp_status, status,
> + rte_memory_order_release);
> +}
> +
For me, it reads easier if you use __rte_atomic which is alias for _Atomic which is
the type qualifier. This is in a bunch of other places in DPDK already:
/* tp_status hands a frame between the kernel and us; order frame accesses */
static inline uint32_t
tpacket_read_status(struct tpacket2_hdr *ppd)
{
return rte_atomic_load_explicit((uint32_t __rte_atomic *)&ppd->tp_status,
rte_memory_order_acquire);
}
static inline void
tpacket_write_status(struct tpacket2_hdr *ppd, uint32_t status)
{
rte_atomic_store_explicit((uint32_t __rte_atomic *)&ppd->tp_status, status,
rte_memory_order_release);
}
More information about the stable
mailing list