[RFC 0/5] fib: lookup across a group of FIBs

Maxime Leroy maxime at leroys.fr
Tue Nov 24 19:04:10 CET 2026


A burst may carry packets of several VRFs. An application keeping one
FIB per VRF then calls rte_fib_lookup_bulk() once per packet, or
regroups the burst per VRF before the lookup.

This RFC adds a group of FIBs: FIBs created with the same type, flags
and next hop size join a group, and rte_fib_group_lookup_bulk() looks
up each address in its own FIB with one call, given one dataplane
pointer per address (rte_fib_get_dp()). In DIR24-8 the TBL24 sits at a
fixed offset from that pointer, so the lookup does the same memory
accesses as a lookup in a single FIB. The FIBs stay independent: each
one is created when its VRF is, sized on its own, and freed with it.

It is an alternative to the multi-VRF FIB discussed with Vladimir,
for applications that keep one FIB per VRF.

Usage:

    grp = rte_fib_group_create(&grp_conf);
    conf.group = grp;
    fib = rte_fib_create(name, socket_id, &conf);
    ...
    rte_fib_group_lookup_bulk(grp, dps, ips, next_hops, n);

Lookup cost with "dpdk-test-fib -- -f <routes> -e 8 -G 4 -v s1":
4 FIBs with a full view each (1,075,223 routes), a random FIB per
address, scalar lookup, cycles per address, median of 3 runs on a
laptop with --no-huge:

                          test-fib order   random order
  group lookup                 40.2            39.5
  one call per address         59.5           105.2

"test-fib order" is the default of the tool, where the addresses follow
the route file. "random order" is the same 10M addresses shuffled and
read with -t, which needs patch 4 (also sent alone as a fix):

    dpdk-test-fib -- -f <routes> -l 10000000 -u addrs.txt
    shuf addrs.txt > shuffled.txt
    dpdk-test-fib -- -f <routes> -t shuffled.txt -e 8 -G 4 -v s1

"one call per address" is rte_fib_lookup_bulk() called on the FIB of
each address with one address, what an application does without a
group lookup.

The AVX-512 lookup (-v v --force-max-simd-bitwidth=512) is faster in
the test-fib order (30.2) but not in random order (39.9).

Open questions:
- ABI: the group field extends struct rte_fib_conf (40 to 48 bytes),
  so the ABI check of the CI will fail. Keep the field for 27.11, or
  add a FIB to a group with a new experimental call?
- IPv4 DIR24-8 only. The IPv6 trie embeds its TBL24 the same way and
  could follow.
- All the FIBs of a group use the same algorithm.
- The application must stop passing the dataplane pointer of a FIB
  before freeing it, as for its other RCU protected structures.

This series does not depend on the tbl8 pool RFC, sent separately.
Patches 1-2 (zero initialization of the FIB configs) are the same in
both RFCs. The two series touch the same place of dir24_8.c, so the
second one applied needs a rebase.

Maxime Leroy (5):
  app/graph: zero-initialize FIB config structs
  node: zero-initialize FIB config structs
  fib: add group of FIBs with bulk lookup across them
  app/test-fib: fix byte order of addresses read from file
  app/test-fib: add lookup across a group of FIBs

 app/graph/l3fwd.c                 |   4 +-
 app/test-fib/main.c               | 157 +++++++++++++++++++++-
 app/test/test_fib.c               | 216 ++++++++++++++++++++++++++++++
 doc/guides/prog_guide/fib_lib.rst |   6 +
 lib/fib/dir24_8.c                 |  70 ++++++++++
 lib/fib/dir24_8.h                 |  63 +++++++++
 lib/fib/dir24_8_avx512.c          |  82 ++++++++++++
 lib/fib/dir24_8_avx512.h          |  32 +++++
 lib/fib/rte_fib.c                 | 125 +++++++++++++++++
 lib/fib/rte_fib.h                 |  88 ++++++++++++
 lib/node/ip4_lookup_fib.c         |   2 +-
 lib/node/ip6_lookup_fib.c         |   2 +-
 12 files changed, 842 insertions(+), 5 deletions(-)

-- 
2.43.0



More information about the dev mailing list