1 layeredtrees: most specific prefix based pipelined design for on-chip ip address lookups 張 燕...

35
1 LayeredTrees: Most Specific Prefix based Pipelined Design for On-Chip IP Address Lookups 張 張 張 資資資資資資 Dept. of Computer Science & Information Engineering, 資資資資資資

Post on 21-Dec-2015

239 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: 1 LayeredTrees: Most Specific Prefix based Pipelined Design for On-Chip IP Address Lookups 張 燕 光 資訊工程學系 Dept. of Computer Science & Information Engineering,

1

LayeredTrees: Most Specific Prefix based

Pipelined Design for On-Chip IP Address Lookups

張 燕 光資訊工程學系

Dept. of Computer Science & Information Engineering,

國立成功大學National Cheng Kung University

Page 2: 1 LayeredTrees: Most Specific Prefix based Pipelined Design for On-Chip IP Address Lookups 張 燕 光 資訊工程學系 Dept. of Computer Science & Information Engineering,

成功大學資訊工程系 CIAL 實驗室2

OutlineIntroductionIP lookup review (1-D packet

classification)Data structures for IP lookupsBinary prefix searchLayered search treesParallel and Pipelined search engineConclusion

Page 3: 1 LayeredTrees: Most Specific Prefix based Pipelined Design for On-Chip IP Address Lookups 張 燕 光 資訊工程學系 Dept. of Computer Science & Information Engineering,

成功大學資訊工程系 CIAL 實驗室3

Internet: Mesh of Routers

The Internet Core

Edge Router

Campus Area Network

Page 4: 1 LayeredTrees: Most Specific Prefix based Pipelined Design for On-Chip IP Address Lookups 張 燕 光 資訊工程學系 Dept. of Computer Science & Information Engineering,

成功大學資訊工程系 CIAL 實驗室4

RFC 1812: Requirements for IPv4 Routers

Must perform an IP datagram forwarding decision, called forwarding, routing lookup, IP lookup, longest prefix match

Must send the datagram out to the appropriate interface (called switching)

Page 5: 1 LayeredTrees: Most Specific Prefix based Pipelined Design for On-Chip IP Address Lookups 張 燕 光 資訊工程學系 Dept. of Computer Science & Information Engineering,

成功大學資訊工程系 CIAL 實驗室5

Router Design Model

RISC processor

Search EngineEgress

Fast-path: data plane

On-ChipSRAM

Slow-path: control plane

Ingress ReceiveUnit

TransmitUnit

Page 6: 1 LayeredTrees: Most Specific Prefix based Pipelined Design for On-Chip IP Address Lookups 張 燕 光 資訊工程學系 Dept. of Computer Science & Information Engineering,

成功大學資訊工程系 CIAL 實驗室6

Lookup in an IP Router

Unicast destination address based lookup

Dstn Addr

Next Hop

--------

---- ----

--------

Dstn-prefix Next Hop

Forwarding Table

Next Hop Computation

Forwarding Engine

Incoming Packet

HEADER

Page 7: 1 LayeredTrees: Most Specific Prefix based Pipelined Design for On-Chip IP Address Lookups 張 燕 光 資訊工程學系 Dept. of Computer Science & Information Engineering,

成功大學資訊工程系 CIAL 實驗室7

AS 6447BGP Table Data

last updated at Wed, 23 Nov 2011 15:12:48 GMT

IPv4 BGP Reports    AS131072 APNIC R&D 385,044    AS6447 Route-Views.Oregon-ix.net

396,386 

IPv6 BGP Reports    AS131072 APNIC R&D 7,616    AS6447 Route-Views.Oregon-ix.net 7,581

Page 8: 1 LayeredTrees: Most Specific Prefix based Pipelined Design for On-Chip IP Address Lookups 張 燕 光 資訊工程學系 Dept. of Computer Science & Information Engineering,

成功大學資訊工程系 CIAL 實驗室8

Routing table example1.5.0.0/161.9.0.0/161.9.2.0/241.9.4.0/221.9.12.0/241.11.0.0/211.11.8.0/211.11.16.0/2

11.11.24.0/2

11.11.32.0/2

1

1.11.40.0/211.11.48.0/211.11.56.0/211.11.64.0/211.11.72.0/211.11.80.0/211.11.88.0/211.11.128.0/1

71.12.0.0/141.12.0.0/24

1.12.1.0/241.21.0.0/161.22.0.0/231.22.4.0/231.22.6.0/231.22.8.0/231.22.12.0/2

31.22.14.0/2

31.22.16.0/2

31.22.18.0/2

3

Page 9: 1 LayeredTrees: Most Specific Prefix based Pipelined Design for On-Chip IP Address Lookups 張 燕 光 資訊工程學系 Dept. of Computer Science & Information Engineering,

成功大學資訊工程系 CIAL 實驗室9

AS6447:UOREGON-IX - University of Oregon

Page 10: 1 LayeredTrees: Most Specific Prefix based Pipelined Design for On-Chip IP Address Lookups 張 燕 光 資訊工程學系 Dept. of Computer Science & Information Engineering,

成功大學資訊工程系 CIAL 實驗室10

Router A memory hungry search applicationRouter speed depends on the number of

memory accesses for each lookup operation, i.e., on the speed of memory

IPv6 is four times wider than IPv4 addressesNegative Impact: 4 x number of memory

accesses if CPU is 32 bits IPv6 routers is four times slower than IPv4

routers?Not really, but possible

Pipeline design may be a good solution

Page 11: 1 LayeredTrees: Most Specific Prefix based Pipelined Design for On-Chip IP Address Lookups 張 燕 光 資訊工程學系 Dept. of Computer Science & Information Engineering,

成功大學資訊工程系 CIAL 實驗室11

Example Forwarding Table Prefix Next-hop

P1 111* H1P2 10* H2P3 1010* H3P4 10101 H4

Longest prefix match(LPM), not exact matchProperties: prefixes are either disjoint or

enclosing (one completely covers another)Prefix enclosure makes (1) sorting prefixes

and (2) binary searching prefixes difficult.So, trie based schemes emerge naturally

Page 12: 1 LayeredTrees: Most Specific Prefix based Pipelined Design for On-Chip IP Address Lookups 張 燕 光 資訊工程學系 Dept. of Computer Science & Information Engineering,

成功大學資訊工程系 CIAL 實驗室12

Basic Data Structures for IP lookups

Page 13: 1 LayeredTrees: Most Specific Prefix based Pipelined Design for On-Chip IP Address Lookups 張 燕 光 資訊工程學系 Dept. of Computer Science & Information Engineering,

成功大學資訊工程系 CIAL 實驗室13

Prefix propertiesDisjoint prefixes:

Two prefixes are said to be disjoint if they do not share any address.

Prefix enclosure: A = bn-1…bj…bi* and B = bn-1…bj* and j > i. Prefix A is enclosed by B (B A) since the IP

address space covered by A is a subset of that covered by B, where is the enclosure operator.

A special case of overlapping.Prefix comparison

The inequality 0 < * < 1 is used to compare two prefixes in the ternary representation of prefixes.

Page 14: 1 LayeredTrees: Most Specific Prefix based Pipelined Design for On-Chip IP Address Lookups 張 燕 光 資訊工程學系 Dept. of Computer Science & Information Engineering,

成功大學資訊工程系 CIAL 實驗室14

Prefix propertiesThe most specific prefixes (MSP):

The prefixes that do not cover any others. Disjoint, so can be put in an array for binary search

Grouping prefixes in layers based on MSP.6-7 layers for IPv4 tables

1

2

3

1 1

2

4

1 1

2

3

1 1

2

5

4

1 1

2

3

1 1

2

1 1

2

3

1 1

2

1

Page 15: 1 LayeredTrees: Most Specific Prefix based Pipelined Design for On-Chip IP Address Lookups 張 燕 光 資訊工程學系 Dept. of Computer Science & Information Engineering,

成功大學資訊工程系 CIAL 實驗室15

Prefix Enclosure propertyDatabase

(year-month)AS6447(2000-4)

AS6447(2002-4)

AS6447(2005-4)

number of prefixes

79,530 124,798 163,535

Level-1 prefixes 73,891(92.9%)114,745 (91.9%)150,245 (91.9%)

Level-2 prefixes 4,874 (6.1%) 8,496 (6.8%) 11,135 (6.8%)

Level-3 prefixes 642 (0.8%) 1,290 (1%) 1,775 (1.1%)

Level-4 prefixes 104 (0.1%) 235 (0.2%) 329 (0.2%)

Level-5 prefixes 17 29 45

Level-6 prefixes 2 3 6

Page 16: 1 LayeredTrees: Most Specific Prefix based Pipelined Design for On-Chip IP Address Lookups 張 燕 光 資訊工程學系 Dept. of Computer Science & Information Engineering,

成功大學資訊工程系 CIAL 實驗室16

Prefix Enclosure propertyLayer distribution

90.84%

7.68% 1.22% 0.21% 0.03% 0.01% 0.00%

273944

23171 3690 628 101 16 2

0

50000

100000

150000

200000

250000

300000

0.00%

10.00%

20.00%

30.00%

40.00%

50.00%

60.00%

70.00%

80.00%

90.00%

100.00%

layer 0 layer 1 layer 2 layer 3 layer 4 layer 5 layer 6

# of prefixespercentage

layer number

Layer Distribution

table AS6447(300K entries)

Page 17: 1 LayeredTrees: Most Specific Prefix based Pipelined Design for On-Chip IP Address Lookups 張 燕 光 資訊工程學系 Dept. of Computer Science & Information Engineering,

成功大學資訊工程系 CIAL 實驗室17

Prefix properties

Prefix length

Num

ber

Page 18: 1 LayeredTrees: Most Specific Prefix based Pipelined Design for On-Chip IP Address Lookups 張 燕 光 資訊工程學系 Dept. of Computer Science & Information Engineering,

成功大學資訊工程系 CIAL 實驗室18

Prefix

Prefix Next-hop

P1 111* H1

P2 10* H2

P3 1010* H3

P4 10101 H4P1 is disjoint from the other three prefixes.P2 P3 P4Longest prefix match(LPM), not exact matchenclosure makes (1) sorting prefixes and (2) binary

searching prefixes difficult

Forwarding table example

Page 19: 1 LayeredTrees: Most Specific Prefix based Pipelined Design for On-Chip IP Address Lookups 張 燕 光 資訊工程學系 Dept. of Computer Science & Information Engineering,

成功大學資訊工程系 CIAL 實驗室19

Example Forwarding Table Prefix Next-hop

P1 111* H1P2 10* H2P3 1010* H3P4 10101 H4

Longest prefix match(LPM), not exact matchPrefix enclosure makes (1) sorting prefixes and (2)

binary searching prefixes difficult.So, trie based schemes emerge naturally

Page 20: 1 LayeredTrees: Most Specific Prefix based Pipelined Design for On-Chip IP Address Lookups 張 燕 光 資訊工程學系 Dept. of Computer Science & Information Engineering,

成功大學資訊工程系 CIAL 實驗室20

PrefixLength format: bn-1…b0/l (l is prefix length)

In IPv4, d3.d2.d1.d0/l , 140.116.82.36/24 .Mask format: bn-1…b0/mn-1…m0 (prefix length is l)

mj = 1 for all n – 1 j n – l, and mj =0 otherwise. d3.d2.d1.d0/ m3.m2.m1.m0, 140.116.82.36/1...100000000

Ternary format: bn-1…bn-l+1*…* (prefix length is l)bj = 0 or 1 for n – 1 j n – l. If tk is *, then tj must also be * for all j < k. A single don’t care bit can be used to denote a series of

don’t care bits, e.g., 1* denotes 1**** in the 5-bit address space. 140.0.0.0/8 = 10001100*

Page 21: 1 LayeredTrees: Most Specific Prefix based Pipelined Design for On-Chip IP Address Lookups 張 燕 光 資訊工程學系 Dept. of Computer Science & Information Engineering,

成功大學資訊工程系 CIAL 實驗室21

Prefix(n+1)-bit format: bn-1…bn-l10…0 (l is prefix len)

for the prefix bn-1…bn-l* of length l in ternary format, there is one trailing ‘1’ followed by n – l 0’s.

or(n+1)-bit format: bn-1…bn-l01…1

for the prefix bn-1…bn-l* of length l in ternary format, there is one trailing ‘0’ followed by n – l 1’s.

Page 22: 1 LayeredTrees: Most Specific Prefix based Pipelined Design for On-Chip IP Address Lookups 張 燕 光 資訊工程學系 Dept. of Computer Science & Information Engineering,

成功大學資訊工程系 CIAL 實驗室22

5-bit Prefixes: bn-1…bn-l10…0

11111

11110

11101

11100

1110*

1111*

111**

00011

00010

00001

00000

0000*

0001*

000**

*****

0****

00***

000111

000101

000011

000001

000010

000110

000100

001000

111111

111101

111011

111001

111010

111110

111100

11***

111000

6-bit binary address space000000 is not used

Page 23: 1 LayeredTrees: Most Specific Prefix based Pipelined Design for On-Chip IP Address Lookups 張 燕 光 資訊工程學系 Dept. of Computer Science & Information Engineering,

成功大學資訊工程系 CIAL 實驗室23

5-bit Prefixes: bn-1…bn-l01…1

11111

11110

11101

11100

1110*

1111*

111**

00011

00010

00001

00000

0000*

0001*

000**

*****

0****

00***

000111

000101

000011

000001

000010

000110

000100

111101

111011

111001

111010

111110

111100

11***

111000

6-bit binary address space111111 is not used

110111

000000

Page 24: 1 LayeredTrees: Most Specific Prefix based Pipelined Design for On-Chip IP Address Lookups 張 燕 光 資訊工程學系 Dept. of Computer Science & Information Engineering,

成功大學資訊工程系 CIAL 實驗室24

Binary Trie (Radix Trie)

P1 111* H1

P2 10* H2

P3 1010* H3

P4 10101 H4P2

P3

P4

P1

A

B

C

G

D

F

H

E

1

0

0

1 1

1

1

Lookup 10111

Add P5=1110*

I

0

P5

next-hop-ptr (if prefix)

left-ptr right-ptr

Trie node

Page 25: 1 LayeredTrees: Most Specific Prefix based Pipelined Design for On-Chip IP Address Lookups 張 燕 光 資訊工程學系 Dept. of Computer Science & Information Engineering,

成功大學資訊工程系 CIAL 實驗室25

Binary Trie: Leaf PushingP1

111* H1

P2

10* H2

P3

1010* H3

P4

10101

H4

P5

1110 H5

P4

P1

Disjoint, but duplication

P5

P2

P2

P3

Page 26: 1 LayeredTrees: Most Specific Prefix based Pipelined Design for On-Chip IP Address Lookups 張 燕 光 資訊工程學系 Dept. of Computer Science & Information Engineering,

成功大學資訊工程系 CIAL 實驗室26

Binomial spanning tree

1000

1100

1110

1111

01

2

3

A 4-cube and its corresponding binomial spanning tree.

3

2

1

0

1000

1100

1110 1111

0000

0000

Page 27: 1 LayeredTrees: Most Specific Prefix based Pipelined Design for On-Chip IP Address Lookups 張 燕 光 資訊工程學系 Dept. of Computer Science & Information Engineering,

成功大學資訊工程系 CIAL 實驗室27

Perfect code: Hamming code (7, 4) 7-cube example:

0000000

1000000 0100000 0010000 0001000 0000100 0000010 0000001

24(16) one-level binomial spanning trees

= 7-cube

Page 28: 1 LayeredTrees: Most Specific Prefix based Pipelined Design for On-Chip IP Address Lookups 張 燕 光 資訊工程學系 Dept. of Computer Science & Information Engineering,

成功大學資訊工程系 CIAL 實驗室28

r = received codeSyndrome s = (s2 s1 s0) = r. H7T Corrected code = r + ErrorPattern[s]

Perfect code: Hamming code (7, 4)1 1 0 1 1 0 0

1 0 1 1 0 1 0

0 1 1 1 0 0 1

H7 = G7 =

1 0 0 0 1 1 00 1 0 0 1 0 10 0 1 0 0 1 10 0 0 1 1 1 1

(a) Parity-check and generator matrices of Hamming code (7, 4).

(c) Decoding table

000 0000-000001 0000-001010 0000-010011 0010-000100 0000-100101 0100-000110 1000-000111 0001-000

Syndrome ErrorPatternInner product Transpose

Page 29: 1 LayeredTrees: Most Specific Prefix based Pipelined Design for On-Chip IP Address Lookups 張 燕 光 資訊工程學系 Dept. of Computer Science & Information Engineering,

成功大學資訊工程系 CIAL 實驗室29

Perfect code: Hamming code (7, 4) u Codeword0000 0000-0000001 0001-1110010 0010-0110011 0011-1000100 0100-1010101 0101-0100110 0110-1100111 0111-0011000 1000-1101001 1001-0011010 1010-1011011 1011-0101100 1100-0111101 1101-1001110 1110-0001111 1111-111

Generate 16 Codewords: u. G7

7-bit address space (7-cube)

Page 30: 1 LayeredTrees: Most Specific Prefix based Pipelined Design for On-Chip IP Address Lookups 張 燕 光 資訊工程學系 Dept. of Computer Science & Information Engineering,

成功大學資訊工程系 CIAL 實驗室30

Perfect code: Golay code (23, 12) 212 3-level binomial spanning treesC(23,0)+C(23, 1)+C(23,2)+C(23,3)

= 1 + 23 + 23*22/2 +3*22*21/(3*2) = 24 + 23*11 + 23*11*7 = 24 + 253*8 = 24 + 2024 = 2048 = 211

Page 31: 1 LayeredTrees: Most Specific Prefix based Pipelined Design for On-Chip IP Address Lookups 張 燕 光 資訊工程學系 Dept. of Computer Science & Information Engineering,

成功大學資訊工程系 CIAL 實驗室31

RangesWhy ranges?

Prefixes can also be represented by ranges.The source/destination port fields of rule tables for

packet classification are ranges.Prefixes are special cases of ranges.Prefix bn-1…bn-l* of length l is the range of addresses

from bn-1…bn-l0…0 to bn-1…bn-l1…0, denoted as [bn-1…bn-l0…0, bn-1…bn-l1…0].

Overlapping:Two ranges are overlapping if they are not disjoint.

Partially overlapping:Two ranges are partially overlapping if they are neither

disjoint nor enclosing.

Page 32: 1 LayeredTrees: Most Specific Prefix based Pipelined Design for On-Chip IP Address Lookups 張 燕 光 資訊工程學系 Dept. of Computer Science & Information Engineering,

成功大學資訊工程系 CIAL 實驗室32

Elementary Intervals for Ranges Definition: Let the set of k elementary

intervals constructed from a set R of ranges in the address space of 0 … N – 1 be X = {Xi | Xi = [ei, fi], for i = 1 to k}.

X must satisfy the following: 1) e1 = 0 and fk = N – 1,

2) fi = ei+1 – 1 for i = 1 to k – 1,

3) all addresses in Xi are covered by the same subset of R (called the range matching set of Xi) denoted by EIi, and

4) EIi EIi+1, for i = 1 to k – 1.

Page 33: 1 LayeredTrees: Most Specific Prefix based Pipelined Design for On-Chip IP Address Lookups 張 燕 光 資訊工程學系 Dept. of Computer Science & Information Engineering,

成功大學資訊工程系 CIAL 實驗室33

Elementary Intervals for RangesGraphical view

EI7

{P4,P9}X7

[32, 39]

EI8

{P4}X8

[40, 47]

EI9

{P4,P6,P7}

X9

[48, 51]

EI10

{P4,P6}X10

[52, 54]

EI11

{P4,P6,P8}

X11

[55, 55]

EI12

{P4,P6}X12

[56, 63]

EI4

{P2}X4

[16, 21]

EI5

{P2,P5}X5

[22, 23]

EI6

{P2}X6

[24, 31]

EI2

{P1,P3}X2

[4, 7]

EI3

{P1}X3

[8, 15]

EI1

{P1}X1

[0, 3]

P1 [0 , 15]P2 [16, 31]P3 [4 , 7]P4 [32, 63]P5 [22, 23]P6 [48, 63]P7 [48, 51]P8 [55, 55]P9 [32, 39] P4

P1 P2P3 P5

P6P7 P8P9

Page 34: 1 LayeredTrees: Most Specific Prefix based Pipelined Design for On-Chip IP Address Lookups 張 燕 光 資訊工程學系 Dept. of Computer Science & Information Engineering,

成功大學資訊工程系 CIAL 實驗室34

Elementary Intervals for RangesID Prefix Range Minus-1 Traditional

start finish start finishP1 000000/2 [0, 15] - 15 0 15P2 010000/2 [16, 31] 15 31 16 31P3 000100/4 [4, 7] 3 7 4 7P4 100000/1 [32, 63] 31 - 32 63P5 010110/5 [22, 23] 21 23 22 23P6 110000/2 [48, 63] 47 - 48 63P7 110000/4 [48, 51] 47 51 48 51P8 110111/6 [55, 55] 54 55 55 55P9 100000/3 [32, 39] 31 39 32 39

Page 35: 1 LayeredTrees: Most Specific Prefix based Pipelined Design for On-Chip IP Address Lookups 張 燕 光 資訊工程學系 Dept. of Computer Science & Information Engineering,

成功大學資訊工程系 CIAL 實驗室35

ConclusionsLayered Tree for dynamic routing table

On-chip memoryParallel and Pipeline architecture

Achieve the throughput of 120 Gbps