Understanding DPDK
algorithmics
Fast lookup algorithms
implemented inside DPDK libraries
HASH library
Used in FDB, IPv4 and IPv6 HOST tables
DPDK Hash library characteristics
Algorithm used is a modified Cuckoo hashing
Hash size is 32 bytes
Optimistic memory access time is 1
Pessimistic memory access time is 2
With random keys, this method allows the user to get around 90% of the table
utilization, without having to drop any stored entry or allocate more memory.
Big table is divided in many buckets
Cuckoo hashing algorithm is used to find another bucket
Cuckoo hashing collision resolution
x
y
New value = x,
Old value = y
h1(x)
h2(y)
Table 1 Table 2
Hash lookup example
TBD
Hash insert example
TBD
LPM library
Used in IPv4 and IPv6 ROUTE tables
DPDK LPM library characteristics
Uses modified DIR-24-8-BASIC algorithm
TBL24 contains 224 next hop entries = 16M * 2B = 32MB
Number of TBL8 could be up to 215 = 32K * 2B = 64K
Next hop value points to next hop id in case of 24-bit or less prefix and to TBL8
table otherwise
Route prefixes less than 24 are expanded into multiple entries inside TBL24
Number of prefixes longer than 24 is limited by the number of TBL8
Lookup algorithm
0
23
24
31
224 entries
TBL24
28 entries
TBL8
TBL8
28 entries
Next
hop?
Next hop
table
yes
no
LPM lookup example
192.168.1.1
192.168.2.1
192.168.1.2
192.168/16
...
192.168/16
192.168/16
TBL8
TBL24
192.168/16
192.168/16
192.168/16
...
192.168/16
Route entries:
192.168/16
192.168.1/24
192.168.1.1/32
192.168.1/24
192.168.1.1/32
192.168.1/24
192.168.1/24
192.168.1/24
TBL8
192.168.1/24
192.168.1/24
192.168.1/24
...
192.168.1/24
LPM insert example
TBD
ACL library
Used in IPv4 and IPv6 ACL tables
DPDK ACL library characteristics
Classification mechanisms:
Scalar
SSE
AVX2
Based on multi-bit tries (stride = 8 = 256 bits = 4 bytes )
Multi-bit trie
Root node (256
entries)
Node2 (256
entries)
Node1 (256
entries)
Node3 (256
entries)
ACL lookup example
TBD
References
DPDK Programmer’s Guide
Cuckoo Hashing Visualization
Jenkins hash function
Routing Lookups in Hardware at Memory Access Speeds
High Performance Switches and Routers book
MULTIBIT TRIES
My blog
Learning Network Programming

Understanding DPDK algorithmics

Editor's Notes

  • #5 If a space is occupied, the new value is inserted. While an old value is moved to the second table using a second hash function. The process is repeated in case if another collision happens until an empty space is found or timeout.