IP lookup via Longest Prefix Match (LPM) is critical for packet forwarding. Unfortunately, conventional lookup algorithms are inefficient for IPv6 Forwarding Information Bases (FIBs), which are characterized by a set of long prefixes with diverse lengths. We observe that LPM inherently represents a two-dimensional (2D) search problem over both prefix values and prefix lengths, but existing algorithms mostly treat LPM as two separate levels of one-dimensional (1D) searches, causing poor lookup performance and high memory overhead. This paper presents PlanB, a novel scheme for high-speed IPv6 lookup. We transform the 2D LPM into an equivalent 1D search problem over elementary intervals, thereby unifying the search across prefix value and lengths. We then adapt a flat-array-based B-tree structure to the needs of LPM to propose the linearized $B^+$-tree, based on which we introduce an efficient search algorithm tailored to the properties of the transformed space. To maximize performance, we integrate PlanB with vectorization, batching, branch-free logic, and loop unrolling to fully exploit CPU parallelism. Extensive evaluation shows that PlanB achieves single-core performance of 390 Million Lookups Per Sec (MLPS) with real-world IPv6 FIBs on AMD processor, and scales to full-12-core performance of 3.4 Billion Lookups Per Sec (BLPS). This is 1.6$\times$$\sim$14$\times$ higher than state-of-the-art software-based schemes (PopTrie, CP-Trie, Neurotrie and HBS).
翻译:摘要:通过最长前缀匹配(LPM)进行的IP查找是数据包转发的关键。然而,传统查找算法对于IPv6转发信息库(FIB)效率低下,后者以一组长度多样的长前缀为特征。我们观察到,LPM本质上是一个涉及前缀值和前缀长度的二维(2D)搜索问题,但现有算法大多将LPM视为两个独立的一维(1D)搜索层级,导致查找性能差且内存开销高。本文提出PlanB,一种用于高速IPv6查找的新方案。我们将二维LPM转化为基本区间上的等效一维搜索问题,从而统一了前缀值和长度的搜索。随后,我们根据LPM需求调整了基于扁平数组的B树结构,提出线性化$B^+$-树,并基于此引入一种适应变换后空间特性的高效搜索算法。为最大化性能,我们结合向量化、批处理、无分支逻辑和循环展开技术,充分利用CPU并行性。广泛评估表明,PlanB在AMD处理器上使用真实IPv6 FIB可实现单核性能达3.9亿次查找/秒(MLPS),并可扩展至满12核的34亿次查找/秒(BLPS),性能较当前最先进的软件方案(PopTrie、CP-Trie、Neurotrie和HBS)提升1.6倍至14倍。