[PATCH v2 1/4] net/af_packet: fix thread safety and frame calculations

Stephen Hemminger stephen at networkplumber.org
Wed Jan 28 17:59:28 CET 2026


On Wed, 28 Jan 2026 01:36:04 -0800
scott.k.mitch1 at gmail.com wrote:

> +/**
> + * Read tp_status from packet mmap ring. Matches kernel's READ_ONCE() with smp_rmb()
> + * ordering in af_packet.c __packet_get_status.
> + */
> +static inline uint32_t
> +tpacket_read_status(const volatile void *tp_status)
> +{
> +	rte_smp_rmb();
> +	return *((const volatile unaligned_uint32_t *)tp_status);
> +}

Wouldn't rte_compiler_barrier() be better choice here.
You are really only trying to keep compiler from optimzing the access.

And tp_status is aligned in ring isn't it?


More information about the stable mailing list