Fast Incremental Updates on Ternary-CAMs for Routing Lookups and Packet Classification Devavrat Shah...

27
Fast Incremental Updates on Ternary-CAMs for Routing Lookups and Packet Classification Devavrat Shah and Pankaj Gupta Department of Computer Science Stanford University { devavrat , pankaj }@stanford.edu August 17, 2000 Hot Interconnects 8

Transcript of Fast Incremental Updates on Ternary-CAMs for Routing Lookups and Packet Classification Devavrat Shah...

Page 1: Fast Incremental Updates on Ternary-CAMs for Routing Lookups and Packet Classification Devavrat Shah and Pankaj Gupta Department of Computer Science Stanford.

Fast Incremental Updates on Ternary-

CAMs for Routing Lookups and Packet

Classification

Devavrat Shah and Pankaj GuptaDepartment of Computer

Science Stanford University

{devavrat, pankaj}@stanford.edu

http://www.stanford.edu/~pankaj

August 17, 2000

Hot Interconnects 8High PerformanceSwitching and RoutingTelecom Center Workshop: Sept 4, 1997.

Page 2: Fast Incremental Updates on Ternary-CAMs for Routing Lookups and Packet Classification Devavrat Shah and Pankaj Gupta Department of Computer Science Stanford.

2

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 3: Fast Incremental Updates on Ternary-CAMs for Routing Lookups and Packet Classification Devavrat Shah and Pankaj Gupta Department of Computer Science Stanford.

3

IP Lookup = Longest Prefix Matching

103.23.122/23 171.3.2.22

103.23/16

101.1/16

101.20/13

100/9

171.3.2.4

120.33.32.98

320.3.3.1

10.0.0.111

Prefix Next-hop

Forwarding Table

Find the longest prefix matching the incoming destination address

103.23.122.7 171.3.2.22

Page 4: Fast Incremental Updates on Ternary-CAMs for Routing Lookups and Packet Classification Devavrat Shah and Pankaj Gupta Department of Computer Science Stanford.

4

Requirements of a Route Lookup Scheme

• High Speed : tens of millions per sec

• Low storage : ~100K entries• Fast updates: few thousands per

second, but ideally at lookup speed

Page 5: Fast Incremental Updates on Ternary-CAMs for Routing Lookups and Packet Classification Devavrat Shah and Pankaj Gupta Department of Computer Science Stanford.

5

Route Lookup Schemes

• Various algorithms : come to tutorial tomorrow if interested

• This paper is about ternary CAMs

Page 6: Fast Incremental Updates on Ternary-CAMs for Routing Lookups and Packet Classification Devavrat Shah and Pankaj Gupta Department of Computer Science Stanford.

6

Content-addressable Memory (CAM)

• Fully associative memory• Exact match (fixed-length) search

operation in a single clock cycle

TCAM: stores a 0, 1 or X in each cell: useful for wildcard matching

Page 7: Fast Incremental Updates on Ternary-CAMs for Routing Lookups and Packet Classification Devavrat Shah and Pankaj Gupta Department of Computer Science Stanford.

7

PriorityEncoder

Location 0

1

2

3

4

5

6

103.23.122.7 P1

P1 103.23.122/23 171.3.2.22

P2

P3

P4

P5

103.23/16

101.1/16

101.20/13

100/9

171.3.2.4

120.33.32.98

320.3.3.1

10.0.0.111

Route Lookup Using TCAM

Prefix Next-hop1

1

0

0

0

0

0

To find the longest prefix cheaply, need to keep entries sorted in order of decreasing prefix lengths

Page 8: Fast Incremental Updates on Ternary-CAMs for Routing Lookups and Packet Classification Devavrat Shah and Pankaj Gupta Department of Computer Science Stanford.

8

31 bit Prefixes

30 bit Prefixes

10 bit Prefixes

9 bit Prefixes

8 bit Prefixes

General TCAM Configuration For

Longest Prefix Matching

Prefix-length ordering constraint (PLO)

32 bit Prefixes

Page 9: Fast Incremental Updates on Ternary-CAMs for Routing Lookups and Packet Classification Devavrat Shah and Pankaj Gupta Department of Computer Science Stanford.

9

Incremental Update Problem

• Updates: 1. Insert a new prefix2. Delete an old prefix

• Problem: how to keep the sorting invariant (e.g., the PLO) under updates

Page 10: Fast Incremental Updates on Ternary-CAMs for Routing Lookups and Packet Classification Devavrat Shah and Pankaj Gupta Department of Computer Science Stanford.

10

Target Update Rate ?

• Many are happy with a few hundred thousand per second

• Others want (and claim) single clock-cycle updates

• Our goal: make them as fast as possible (ideally single-cycle)

Page 11: Fast Incremental Updates on Ternary-CAMs for Routing Lookups and Packet Classification Devavrat Shah and Pankaj Gupta Department of Computer Science Stanford.

11

32 bit Prefix

31 bit Prefix

30 bit Prefix

9 bit Prefix

8 bit Prefix

10 bit Prefix

Empty Space

Common Solution: O(N)

Add new 30-bit prefix

M N

Problem: How to manage the empty space for best update time and TCAM utilization?

Page 12: Fast Incremental Updates on Ternary-CAMs for Routing Lookups and Packet Classification Devavrat Shah and Pankaj Gupta Department of Computer Science Stanford.

12

32 bit Prefix

31 bit Prefix

30 bit Prefix

9 bit Prefix

8 bit Prefix

Better Average Update Rate

Add new 30-bit prefix

Worst case is still O(N)

Page 13: Fast Incremental Updates on Ternary-CAMs for Routing Lookups and Packet Classification Devavrat Shah and Pankaj Gupta Department of Computer Science Stanford.

13

32 bit Prefix

31 bit Prefix

30 bit Prefix

9 bit Prefix

8 bit Prefix

10 bit Prefix

Empty Space

An L-solution (L=32)

Add

Two prefixes of same length can be in any order

Page 14: Fast Incremental Updates on Ternary-CAMs for Routing Lookups and Packet Classification Devavrat Shah and Pankaj Gupta Department of Computer Science Stanford.

14

Routing Table for Simulation

Mae-East

Entries 43344

Insertion 34204

Deletion 4140

Snapshot + 3-hour updates on the original table

Source: www.merit.edu - March 1, 2000

Page 15: Fast Incremental Updates on Ternary-CAMs for Routing Lookups and Packet Classification Devavrat Shah and Pankaj Gupta Department of Computer Science Stanford.

15

Performance of L-solution

# Entries

Avg

#m

em

ory

wri

tes

Page 16: Fast Incremental Updates on Ternary-CAMs for Routing Lookups and Packet Classification Devavrat Shah and Pankaj Gupta Department of Computer Science Stanford.

16

Outline of Rest of the Talk

• Algorithm PLO_OPT: worst case L/2 memory shifts (provably optimal)

• Algorithm CAO_OPT: even better (conjectured to be optimal)

Page 17: Fast Incremental Updates on Ternary-CAMs for Routing Lookups and Packet Classification Devavrat Shah and Pankaj Gupta Department of Computer Science Stanford.

17

32 bit Prefix

31 bit Prefix

9 bit Prefix

8 bit Prefix

20 bit Prefix

21 bit Prefix

Empty Space

PLO_OPT

Worst-case L/2

Add

Page 18: Fast Incremental Updates on Ternary-CAMs for Routing Lookups and Packet Classification Devavrat Shah and Pankaj Gupta Department of Computer Science Stanford.

18

PLO_OPT (MAE-EAST)

Page 19: Fast Incremental Updates on Ternary-CAMs for Routing Lookups and Packet Classification Devavrat Shah and Pankaj Gupta Department of Computer Science Stanford.

19

Better Algorithm ?

• PLO_OPT is optimal under the PLO constraint

• Question: can we relax the constraint and still achieve correct lookup operation?

Page 20: Fast Incremental Updates on Ternary-CAMs for Routing Lookups and Packet Classification Devavrat Shah and Pankaj Gupta Department of Computer Science Stanford.

20

Yes: PLO Constraint is More Restrictive Than

Needed

8

15

29

31

P1

P2

P3

P4

P1 10/8

P2 10.64/15

P3 10.1.1.128/29

P4 10.1.1.130/31

Maximal chain P2 has no ordering constraint with P3 or P4P4 < P3 < P1, P2 < P1

Chain ancestor Ordering Constraint

Page 21: Fast Incremental Updates on Ternary-CAMs for Routing Lookups and Packet Classification Devavrat Shah and Pankaj Gupta Department of Computer Science Stanford.

21

Algorithm CAO_OPT

• Maintain free space pool in the “middle” of the maximal chain

• Basic idea: for every prefix, the longest chain that this prefix belongs to should be split around the free space pool as equally as possible

Page 22: Fast Incremental Updates on Ternary-CAMs for Routing Lookups and Packet Classification Devavrat Shah and Pankaj Gupta Department of Computer Science Stanford.

22

CAO_OPT: Example

P1

P2P3

P4

P1 10/8

P2 10.64/15

P3 10.1.1.128/29

P4 10.1.1.130/31

P4 < P3 < P1, P2 < P1

Page 23: Fast Incremental Updates on Ternary-CAMs for Routing Lookups and Packet Classification Devavrat Shah and Pankaj Gupta Department of Computer Science Stanford.

23

CAO_OPT: Updates

• Insertion : find the maximal chain to which new entry belongs and insert it such that this chain is distributed as equally as possible around the free space : D/2 operations

• Deletion : reverse operation with update possibly using another chain

Page 24: Fast Incremental Updates on Ternary-CAMs for Routing Lookups and Packet Classification Devavrat Shah and Pankaj Gupta Department of Computer Science Stanford.

24

Auxiliary Data Structure

• Trie of prefixes with two additional fields per node

• Update operation takes L memory writes in software and D/2 in TCAM

Page 25: Fast Incremental Updates on Ternary-CAMs for Routing Lookups and Packet Classification Devavrat Shah and Pankaj Gupta Department of Computer Science Stanford.

25

Maximal-chain Length (D) Distribution

Nu

mb

er

of

chain

s

Chain Length

Page 26: Fast Incremental Updates on Ternary-CAMs for Routing Lookups and Packet Classification Devavrat Shah and Pankaj Gupta Department of Computer Science Stanford.

26

CAO_OPT (MAE-EAST)

# Entries

Avg

#m

em

ory

w

rite

s

Page 27: Fast Incremental Updates on Ternary-CAMs for Routing Lookups and Packet Classification Devavrat Shah and Pankaj Gupta Department of Computer Science Stanford.

27

Algorithm CAO_OPT PLO_OPT L-soln

Mean 1.015 4.098 7.27

Variance 0.01 2.03 4.09

Worst Case

3 12 21

Summary of Simulation Results

Hence, can achieve 1-2 cycle updates