Skip to content

gatekeeper: drop seqlock.h in favor of DPDK's rte_seqlock - #739

Open
sainimal1ba-hue wants to merge 1 commit into
AltraMayor:masterfrom
sainimal1ba-hue:drop-seqlock-h
Open

sainimal1ba-hue wants to merge 1 commit into
AltraMayor:masterfrom
sainimal1ba-hue:drop-seqlock-h

Conversation

@sainimal1ba-hue

@sainimal1ba-hue sainimal1ba-hue commented Nov 23, 2026 •

Copy link
Copy Markdown

include/seqlock.h is an old copy of the Linux kernel seqlock, adapted to rte_spinlock_t and legacy barriers. DPDK has had its own seqlocks in <rte_seqlock.h> since 22.11 (implemented using C11 atomics) and Gatekeeper has been using DPDK 23.11.

This PR moves the only users (the Ethernet header cache in the GK and GT blocks) to the rte_seqlock_*() API and removes include/seqlock.h. The locking scheme is unchanged: writers take a spinlock around the update and readers simply retry if the sequence has changed. The one difference is that DPDK takes the writer side spinlock with plain rte_spinlock_lock() rather than the HTM aware rte_spinlock_lock_tm().

Closes #738.

Gatekeeper's include/seqlock.h is an old copy of the Linux kernel's
sequence lock adapted to rte_spinlock_t and legacy barriers
(rte_rmb(), rte_smp_rmb(), rte_smp_wmb()).

DPDK provides sequence locks with <rte_seqlock.h> since version 22.11,
implemented with C11 atomics and rte_atomic_thread_fence(), and
Gatekeeper already uses DPDK 23.11.

This commit
1. replaces the seqlock_t field of struct ether_cache with
   rte_seqlock_t;
2. replaces calls to seqlock_init(), read_seqbegin(),
   read_seqretry(), write_seqlock(), and write_sequnlock() with
   rte_seqlock_init(), rte_seqlock_read_begin(),
   rte_seqlock_read_retry(), rte_seqlock_write_lock(), and
   rte_seqlock_write_unlock(); and
3. deletes include/seqlock.h.

Notice that DPDK's implementation takes the writer-side spinlock with
rte_spinlock_lock() instead of the HTM-aware rte_spinlock_lock_tm()
used by the deleted header.

This commit closes AltraMayor#738.

Signed-off-by: sainimal1ba-hue <[email protected]>
@AltraMayor AltraMayor added this to the Version 1.3 milestone Nov 24, 2026
@AltraMayor
AltraMayor self-requested a review November 24, 2026 12:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Can we get rid of include/seqlock.h?

2 participants