Top Banner
Fast binary and multi way prefix searches f or pachet forwarding Author: Yeim-Kuan Chang Publisher: COMPUTER NETWORKS, Volume 51, Issue 3, pp. 588-605, February 2007. (SC I) Presenter: Chen-Yu Chang Date: 2008/10/29
43

Fast binary and multiway prefix searches for pachet forwarding

Jan 12, 2016

Download

Documents

Trish

Fast binary and multiway prefix searches for pachet forwarding. Author: Yeim-Kuan Chang Publisher: COMPUTER NETWORKS, Volume 51, Issue 3, pp. 588-605, February 2007. (SCI) Presenter: Chen-Yu Chang Date: 2008/10/29. Outline. Introduction Proposed data structure The prefix representation - PowerPoint PPT Presentation
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Fast binary and multiway prefix searches for pachet forwarding

Fast binary and multiway prefix searches for pachet forwarding

Author: Yeim-Kuan ChangPublisher: COMPUTER NETWORKS, Volume 51, Issue 3, pp. 588-605, February 2007. (SCI) Presenter: Chen-Yu ChangDate: 2008/10/29

Page 2: Fast binary and multiway prefix searches for pachet forwarding

Outline

Introduction

Proposed data structure

The prefix representation

m-Way search tree using cache lines

Performance

Page 3: Fast binary and multiway prefix searches for pachet forwarding

Introduction

This paper proposed a new IP lookup algorithms called binary prefix search based on a new mechanism to sort the prefixes in the forwarding table.

The goal is to store the prefixes in a linear array, and thus a faster search speed and a smaller memory requirement can be achieved.

Page 4: Fast binary and multiway prefix searches for pachet forwarding

Outline

Introduction

Proposed data structure

The prefix representation

m-Way search tree using cache lines

Performance

Page 5: Fast binary and multiway prefix searches for pachet forwarding

Proposed data structure

It is known that the binary search works only for the sorted lists. Therefore, we must have a mechanism to compare prefixes.

We first introduce the definition of comparing two prefixes in order to sort a list of prefixes of various lengths based on the ternary format.

Page 6: Fast binary and multiway prefix searches for pachet forwarding

Proposed data structure

Definition 1 (Prefix comparison):

The inequality 0 < * < 1 is used to compare two prefixes

in the ternary format.

Page 7: Fast binary and multiway prefix searches for pachet forwarding

Proposed data structure

Let us study an example to see why performing a binary search on the list of sorted prefixes may encounter a failure.

Dst=01011000

12 3

Page 8: Fast binary and multiway prefix searches for pachet forwarding

Proposed data structure

We did not try to revise the binary search operation. What we did was to generate some auxiliary prefixes that inherit the routing information of the original LPM (e.g., F) and put them where the binary search operations can find them. ex. auxiliary prefix 01011000.

Therefore, it is feasible to split prefix F into two parts such that both sides of prefix O are covered. A simple solution is to remove all the enclosures by making the binary trie a full tree.

Page 9: Fast binary and multiway prefix searches for pachet forwarding

Proposed data structure

The full tree expansion. The full tree expansion splits the enclosure prefixes into

many longer ones and disjoints all the resulting prefixes.

Auxiliary prefix merges Many auxiliary prefixes may inherit the same routing

information of a common enclosure prefix. These prefixes can be merged into one. The merge operation is defined as follows.

Page 10: Fast binary and multiway prefix searches for pachet forwarding

Proposed data structure

Definition 2 (Prefix merge):

The prefix obtained by merging a set of consecutive prefixes is the longest common ancestor of these consecutive prefixes in the binary trie.

Page 11: Fast binary and multiway prefix searches for pachet forwarding

Proposed data structure

The full tree expansion

Page 12: Fast binary and multiway prefix searches for pachet forwarding

Proposed data structure

The full tree after the merge operations

Page 13: Fast binary and multiway prefix searches for pachet forwarding

Outline

Introduction

Proposed data structure

The prefix representation

m-Way search tree using cache lines

Performance

Page 14: Fast binary and multiway prefix searches for pachet forwarding

The prefix representation

There are two commonly used binary representations for the prefixes of different lengths in IPv4, namely, the mask format and the length format.

Matching can be done easily by the following steps. The IP part of the prefix is first XORed with the target IP address. Then the result is ANDed with the netmask (or right shifted 32 – length bits) if the mask (or length) format is used. If the final result is zero, then the match is found.

Page 15: Fast binary and multiway prefix searches for pachet forwarding

The prefix representation

Ex:

prefix = 192.168.0.0/16(11000000.10101000.00000000.00000000)

IP = 192.168.3.1 (11000000.10101000.00000011.00000001)

XOR

→ (00000000.00000000.00000011.00000001)

mask (11111111.11111111.00000000.00000000) AND

→ (00000000.00000000.00000000.00000000)

Match

Page 16: Fast binary and multiway prefix searches for pachet forwarding

The prefix representation

Comparing two prefixescase1:

P1:m1.m2.m3.m4/mask1 (192.168.0.0/255.255.0.0)

P2:n1.n2.n3.n4/mask2 (192.132.32.0/255.255.255.0)

mask1 <= mask2

m1.m2.m3.m4&mask1 → 192.168.0.0

(11000000.10101000.00000000.00000000)

n1.n2.n3.n4&mask1 → 192.132.0.0

(11000000.10000100.00000000.00000000)

P2<P1

Page 17: Fast binary and multiway prefix searches for pachet forwarding

The prefix representation

Comparing two prefixescase2:

P1:m1.m2.m3.m4/mask1 (192.168.0.0/255.255.0.0)

P2:n1.n2.n3.n4/mask2 (192.168.32.0/255.255.255.0)

mask1 <= mask2

m1.m2.m3.m4&mask1 → 192.168.0.0

(11000000.10101000.00000000.00000000)

n1.n2.n3.n4&mask1 → 192.168.0.0

(11000000.10101000.00000000.00000000)

Equal Checking if the(31-len1)th bit of n1.n2.n3.n4 is 0 or 1.

0 → P2<P1

1 → P1<P2

Page 18: Fast binary and multiway prefix searches for pachet forwarding

The prefix representation

We define the binary representation of a prefix in an n-bit address space as follows.

Definition 3 (Definition of (n + 1)-bit prefix representation in the n-bit address space).

For a prefix of length i, bn-1 . . . Bn-i*, where bj = 0 or 1 for n-1 j n-i, its binary representation is b≧ ≧ n-1 . . . Bn-i 10 . . . 0 with n i trailing zeros.

ex: (8-bit address space) 01* → 011000000 01010*→ 010101000

Page 19: Fast binary and multiway prefix searches for pachet forwarding

The prefix representation

However, for the 32-bit address space, It needs two 32-bit binary comparison operations in the worst case since only 32-bit arithmetic and logic operations are available in current 32-bit processors.

It also means that two 32-bit memory reads are needed if the size of registers is 32 bits. In addition, two 32-bit words are needed to store a prefix using 33-bit representation. To solve the above problems, an optimized 32- bit representation is proposed.

Page 20: Fast binary and multiway prefix searches for pachet forwarding

The prefix representation

However, by investigating the routing tables of current routers available on the Internet, there is a small number of prefixes whose lengths are 31 or 32.

Therefore, unless the prefixes of lengths 31 and 32 are filtered out, distinguishing two prefixes by using only 32 bits is the main problem to be solved.

Page 21: Fast binary and multiway prefix searches for pachet forwarding

The prefix representation

Problem of removing the least significant bit

ex: P1=01001100/Port1 → 010011001 P2=01001*/Port2 → 010011000

The first 8 bits cannot distinguish P1 from P2. In general, when two prefixes have the same first 8 bits, one of them must be of length 8, and the other may be of any length except 8. We call one of these two prefixes as the buddy prefix of the other.

Page 22: Fast binary and multiway prefix searches for pachet forwarding

The prefix representation

Every time a prefix is matched against the target IP, we need to do prefix a further check if its buddy also exists on its left or right side. This additional check significantly slows down the search process.

We solve this problem by means of the following rule: Only the prefix of length n-1 is allowed to have a buddy prefix of length n coexisting in n-bit address space.

Page 23: Fast binary and multiway prefix searches for pachet forwarding

The prefix representation

Definition 4

(Definition of prefix conversion in the n-bit address space). (a) shows that when A=bn-1 . . . b10/n/p1 exists, it is first

converted to bn-1 . . . b10/n-1/p1. If prefix bn-1 . . . b10/n-1/p2 already exists, it will be converted to B = bn-1 . . . b11/n/p2. Otherwise, prefix B = bn-1. . .b11/ n/p2 will be created, where p2 is the port number of the longest prefix that covers B.

Page 24: Fast binary and multiway prefix searches for pachet forwarding

The prefix representation

(b) shows that when A = bn-1 . . . b11/n/p1 exists, prefix B = bn-1 . . . b10/n-1/p2 is created when B does not exist, and p2 is the port number of the longest prefix that covers B.

Page 25: Fast binary and multiway prefix searches for pachet forwarding

The prefix representation

(c) shows that if only A=bn-1. . .b10/n-1/p1 exists, no conversion is needed.

Page 26: Fast binary and multiway prefix searches for pachet forwarding

The prefix representation

If both bn-1 . . . b10/n -1/p1 and bn-1 . . . b11/n/p2 exist after conversion, the latter is stored as 0 . . . 0/p2.

Page 27: Fast binary and multiway prefix searches for pachet forwarding

The prefix representation

How to match?1. Computing the position of the least significant set bit.

If the LSB is on bit 0, the length of the prefix is n-1,

and thus we need to check if its buddy prefix of length

n also exit.

2.Let i be the position of LSB, we compute

(P XOR IP)>>(i+1).

If it is zero, then prefix P matches IP.

Page 28: Fast binary and multiway prefix searches for pachet forwarding

The prefix representation

Ex:

(E XOR 00010111) >> 4

00001111 >> 4

→ 00000000

Match

(F XOR 01001100) >> 3

00010000 >> 3

→ 00000010

Not Match

Page 29: Fast binary and multiway prefix searches for pachet forwarding

Outline

Introduction

Proposed data structure

The prefix representation

m-Way search tree using cache lines

Performance

Page 30: Fast binary and multiway prefix searches for pachet forwarding

m-Way search tree using cache lines The entry format in the segmentation table.

Format field Number field Index field/Prefix field Port field

The basic element in the sequential list.

Page 31: Fast binary and multiway prefix searches for pachet forwarding

m-Way search tree using cache lines Format 0 (k=0 or 1)

(k=0) If there is no prefix of length longer than 16 in the segment, the lookup operation should return the default port number.

(k=1) If there is only one prefix of length longer than 16 in the segment, the proposed 16-bit representation for the prefix and the corresponding port number are stored in the entry of the 16-bit segmentation table.

Page 32: Fast binary and multiway prefix searches for pachet forwarding

m-Way search tree using cache lines Format 1 (2≦k ≦10)

Page 33: Fast binary and multiway prefix searches for pachet forwarding

m-Way search tree using cache lines Format 2 (11≦k ≦32)

Page 34: Fast binary and multiway prefix searches for pachet forwarding

m-Way search tree using cache lines Format 3 (33≦k ≦120)

Page 35: Fast binary and multiway prefix searches for pachet forwarding

m-Way search tree using cache lines Format 4 (121≦k ≦186)

Page 36: Fast binary and multiway prefix searches for pachet forwarding

m-Way search tree using cache lines The numbers of prefix in different segment formats

Page 37: Fast binary and multiway prefix searches for pachet forwarding

Outline

Introduction

Proposed data structure

The prefix representation

m-Way search tree using cache lines

Performance

Page 38: Fast binary and multiway prefix searches for pachet forwarding

Performance

The numbers of endpoints and prefixes needed in the range search and proposed prefix search for the Oix-120k routing table.

Page 39: Fast binary and multiway prefix searches for pachet forwarding

Performance the worst-case numbers of memory accesses, the

search time, the update time, and the amount of memory required for various schemes using the Oix-120k table.

Page 40: Fast binary and multiway prefix searches for pachet forwarding

Performance

Average lookup times in ls and amount of memory in KB required for the range searches and the proposed prefix searches with a 16-bit segmentation table.

Page 41: Fast binary and multiway prefix searches for pachet forwarding

Performance

Normalized average lookup times in ls and amount of memory in KB for the binary prefix searches (BPS) over the binary range searches (BRS) using IPv6 tables

Page 42: Fast binary and multiway prefix searches for pachet forwarding

Performance

Integrated performance analysis

Ns: the maximum number of lookups that a lookup

scheme can sustain in 1s.

Nu: update packets to be processed in the same 1s.

Ts: Search time in microsecond.

Tu: Update time in microsecond.

Page 43: Fast binary and multiway prefix searches for pachet forwarding

Performance

Ts x Ns + Tu x Nu = 1,000,000 (Assume Nu=α x Ns)

→ Ns = 1,000,000 / (Ts + α x Tu) Ratio = Ns / Mem