Skip to content

dpdk: add patch removing redundant rsvd_tbl8s counter#620

Draft
maxime-leroy wants to merge 1 commit into
DPDK:mainfrom
maxime-leroy:dpdk_fix_fib_add_del
Draft

dpdk: add patch removing redundant rsvd_tbl8s counter#620
maxime-leroy wants to merge 1 commit into
DPDK:mainfrom
maxime-leroy:dpdk_fix_fib_add_del

Conversation

@maxime-leroy
Copy link
Copy Markdown
Collaborator

@maxime-leroy maxime-leroy commented May 19, 2026

Bring in a local DPDK patch that fixes a latent bug in the IPv6 FIB TRIE algorithm where rsvd_tbl8s drifts past zero on certain ADD/DEL patterns and wraps to UINT32_MAX, causing every subsequent long-prefix add to fail with -ENOSPC even though tbl8_pool_pos is far below number_tbl8s.

The bug surfaces when a covering parent prefix is deleted before its children: depth_diff at DEL time is computed against a different RIB state than at ADD time and the cumulative reservation accounting diverges. Replacing rsvd_tbl8s with the actual pool occupancy counter (tbl8_pool_pos for trie, cur_tbl8s for dir24_8) eliminates the asymmetry. The pre-allocation refusal semantics are preserved.

The patch is intended to be submitted upstream to dpdk-dev; it is carried locally until accepted so grout users get a working FIB6 under SRv6 churn.

Summary

Introduces a DPDK patch addressing an underflow bug in IPv6 FIB trie's pre-allocation reservation counter.

Problem

The rsvd_tbl8s counter in struct rte_trie_tbl (IPv6) drifts and underflows to UINT32_MAX when a covering parent prefix is deleted before its children. The counter is updated by depth_diff computed at each ADD/DEL from current RIB state via rte_rib6_get_nxt() and rte_rib6_lookup_parent(). Since the RIB is not invariant between ADD and later DEL, depth_diff at DEL time need not equal the value at ADD time. Example asymmetry:

  • ADD /28: depth_diff=1, rsvd_tbl8s += 1
  • ADD /48 (child of /28): depth_diff=2, rsvd_tbl8s += 2
  • DEL /28 (children alive): sibling found, depth_diff=0, rsvd_tbl8s -= 0
  • DEL /48: depth_diff=3, rsvd_tbl8s -= 3
  • Net: rsvd_tbl8s decreased by 1 per cycle

Over repeated cycles, the counter wraps to UINT32_MAX-N, causing the pre-check to unconditionally reject ADD operations for long prefixes even when actual pool occupancy (tbl8_pool_pos) is far below number_tbl8s. Observed in production with BGP SRv6 churn under FRR/zebra restart cycles, where parent locators (/40, /48) are deleted before child SIDs (/64, /128). After ~174 asymmetric cycles, rsvd_tbl8s wrapped to 4294967122 with tbl8_pool_pos at 39 of 262144.

Solution

Replace rsvd_tbl8s with actual pool occupancy counters:

  • trie: trie_modify() now compares dp->tbl8_pool_pos + depth_diff against dp->number_tbl8s. The tbl8_pool_pos counter is maintained natively by tbl8_get() and tbl8_put() and is always accurate by construction.
  • dir24_8: dir24_8_modify() now compares dp->cur_tbl8s against dp->number_tbl8s. The cur_tbl8s counter was added by commit 96c3d06a3578 and already tracks occupancy in tbl8_alloc() and tbl8_cleanup_and_free(), making rsvd_tbl8s redundant. The dir24_8 increment is symmetric (binary, 0 or 1 based on whether a /25-/32 sibling exists) and exhibits no underflow bug.

Changes

  • subprojects/dpdk-25.11.wrap: Added dpdk/fib6-remove-redundant-rsvd_tbl8s-counter.patch to diff_files list.
  • subprojects/packagefiles/dpdk/fib6-remove-redundant-rsvd_tbl8s-counter.patch (new file): Patch removes uint32_t rsvd_tbl8s field from struct rte_trie_tbl and struct dir24_8_tbl, removes all increment/decrement code paths for the counter, and simplifies goto-based early-success paths to direct return 0.

Review Change Stack

Bring in a local DPDK patch that fixes a latent bug in the IPv6 FIB
TRIE algorithm where rsvd_tbl8s drifts past zero on certain ADD/DEL
patterns and wraps to UINT32_MAX, causing every subsequent long-prefix
add to fail with -ENOSPC even though tbl8_pool_pos is far below
number_tbl8s.

The bug surfaces when a covering parent prefix is deleted before its
children: depth_diff at DEL time is computed against a different RIB
state than at ADD time and the cumulative reservation accounting
diverges. Replacing rsvd_tbl8s with the actual pool occupancy
counter (tbl8_pool_pos for trie, cur_tbl8s for dir24_8) eliminates
the asymmetry. The pre-allocation refusal semantics are preserved.

The patch is intended to be submitted upstream to dpdk-dev; it is
carried locally until accepted so grout users get a working FIB6
under SRv6 churn.

Signed-off-by: Maxime Leroy <maxime@leroys.fr>
@maxime-leroy maxime-leroy marked this pull request as draft May 19, 2026 13:26
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 19, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: ae3dd4d8-5031-4ea5-8198-2f4be712c136

📥 Commits

Reviewing files that changed from the base of the PR and between 0ab251b and 4c392cc.

📒 Files selected for processing (2)
  • subprojects/dpdk-25.11.wrap
  • subprojects/packagefiles/dpdk/fib6-remove-redundant-rsvd_tbl8s-counter.patch

📝 Walkthrough

Walkthrough

This PR updates DPDK patch files to remove the rsvd_tbl8s reservation counter from both the IPv4 dir24_8 table and IPv6 trie FIB data structures. The wrap file registers a new patch file that modifies two FIB table structs and updates their corresponding modify functions to use actual tbl8 occupancy counters (cur_tbl8s for dir24_8, tbl8_pool_pos + depth_diff for trie) for capacity checks instead of maintaining reserved counters. The refactoring eliminates the increment/decrement accounting code for rsvd_tbl8s on ADD and DEL operations and simplifies early-success return paths by removing goto-based control flow.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant