[PATCH v9] eal: add seqlock

Stephen Hemminger stephen at networkplumber.org
Wed Jun 1 00:45:36 CEST 2022


On Mon, 23 May 2022 16:23:46 +0200
Mattias Rönnblom <mattias.ronnblom at ericsson.com> wrote:

> +/**
> + * The RTE seqcount type.
> + */
> +typedef struct {
> +	uint32_t sn; /**< A sequence number for the protected data. */
> +} rte_seqcount_t;

Don't need structure for only one element.

typedef uint32_t rte_seqcount_t;

+	if (unlikely(begin_sn != end_sn))
+		return true;
+
+	return false;

Prefer to avoid conditional if possible (compiler will optimize it as):

        return begin_sn == end_sn;


More information about the dev mailing list