24
Fast Updating Algorithms for TCAMs Devavrat Shah Pankaj Gupta IEEE MICRO, Jan.-Feb. 2001

Fast Updating Algorithms for TCAMs Devavrat Shah Pankaj Gupta IEEE MICRO, Jan.-Feb. 2001

Embed Size (px)

Citation preview

Page 1: Fast Updating Algorithms for TCAMs Devavrat Shah Pankaj Gupta IEEE MICRO, Jan.-Feb. 2001

Fast Updating Algorithms for TCAMs

Devavrat ShahPankaj Gupta

IEEE MICRO, Jan.-Feb. 2001

Page 2: Fast Updating Algorithms for TCAMs Devavrat Shah Pankaj Gupta IEEE MICRO, Jan.-Feb. 2001

Outline Background Introduction to TCAMs Provided algorithms Simulation Conclusion and discussion

Page 3: Fast Updating Algorithms for TCAMs Devavrat Shah Pankaj Gupta IEEE MICRO, Jan.-Feb. 2001

Background A collection of rules is called a policy

database or a classifier Packet classification

To find a best matching rule Identification of the flow Generalization of the routing lookup

Routers must keep pace with link speeds

Page 4: Fast Updating Algorithms for TCAMs Devavrat Shah Pankaj Gupta IEEE MICRO, Jan.-Feb. 2001

Intro. to TCAMs Fully associative memory

Parallel search for every element in the array Take three logic states

0, 1, or don’t-care X Store each field as a (var, mask) pair

(10000, 11000) represents the 5-bit prefix 10* Store forwarding table entries in order of

decreasing prefix lengths (priorities) The lower address has higher priority

Page 5: Fast Updating Algorithms for TCAMs Devavrat Shah Pankaj Gupta IEEE MICRO, Jan.-Feb. 2001

Intro. to TCAMs (cont’d) Increasingly being deployed

Simplicity and speed (10 ns per clock) Forwarding table updates complicate

keeping the list of prefixes in sorted order

Page 6: Fast Updating Algorithms for TCAMs Devavrat Shah Pankaj Gupta IEEE MICRO, Jan.-Feb. 2001

Intro. to TCAMs (cont’d)

Page 7: Fast Updating Algorithms for TCAMs Devavrat Shah Pankaj Gupta IEEE MICRO, Jan.-Feb. 2001

Intro. to TCAMs (cont’d) If a new prefix

103.23.128/18 is added to the table There’s no empty

space between prefixes P1 and P2!

There are two intuitive solutions below.

Page 8: Fast Updating Algorithms for TCAMs Devavrat Shah Pankaj Gupta IEEE MICRO, Jan.-Feb. 2001

Intuitive solution 1 Shift prefixes P2 to

P5 downward by one location each

This costs O(N), where N is the # of prefixes

Page 9: Fast Updating Algorithms for TCAMs Devavrat Shah Pankaj Gupta IEEE MICRO, Jan.-Feb. 2001

Intuitive solution 2 Keeps a few empty

memory locations at all X nonempty ones

Degenerates to O(N) if empty space is filled up

Wastes precious CAM space

Page 10: Fast Updating Algorithms for TCAMs Devavrat Shah Pankaj Gupta IEEE MICRO, Jan.-Feb. 2001

Provided algorithm 1 Two prefixes of the

same length don’t need to be ordered Prefix-length

ordering constraint Referred to here as

L-algorithm, which can be optimized to L/2

Page 11: Fast Updating Algorithms for TCAMs Devavrat Shah Pankaj Gupta IEEE MICRO, Jan.-Feb. 2001

Provided algorithm 1 (cont’d) Keep all the

unused entries in the center

Swap at most L/2 entries to obtain an unused entry

The arrangement of Fig. 4 can again improve the time

Page 12: Fast Updating Algorithms for TCAMs Devavrat Shah Pankaj Gupta IEEE MICRO, Jan.-Feb. 2001

Provided algorithm 2 PLO constraint is more

restrictive The constraint can be

relaxed to only overlapping prefixes Prefixes that lie on the

same chain of the trie need to be ordered

Chain-ancestor ordering constraint

Page 13: Fast Updating Algorithms for TCAMs Devavrat Shah Pankaj Gupta IEEE MICRO, Jan.-Feb. 2001

Provided algorithm 2 (cont’d) There’s an ordering

constraint between pi and pj iff one is a prefix of the other ex. 103.23.3/24 and

103.23/16 Decrease the update

to D/2, where D is the max length of any chain in the trie

Page 14: Fast Updating Algorithms for TCAMs Devavrat Shah Pankaj Gupta IEEE MICRO, Jan.-Feb. 2001

Provided algorithm 2 (cont’d)

Terminology LC(p) len(LC(p)) rootpath(p) ancestor of p prefix-child of p hcld(p) HCN(p)

Page 15: Fast Updating Algorithms for TCAMs Devavrat Shah Pankaj Gupta IEEE MICRO, Jan.-Feb. 2001

Insertion Case I. Assume q is to be

inserted above the pool One empty entry can be

created by moving prefixes on LC(q) downward one by one, starting from pj to the border of the pool

The movement is less than D/2, where D is len(LC(q))

Page 16: Fast Updating Algorithms for TCAMs Devavrat Shah Pankaj Gupta IEEE MICRO, Jan.-Feb. 2001

Insertion (cont’d) Case II. Assume q is to be

inserted below the pool One empty entry can be

created by moving prefixes on HCN(q) upward one by one, starting from pj to the border of the pool

Again, the movement is less than D/2

pj

pi

Pi + 1

Page 17: Fast Updating Algorithms for TCAMs Devavrat Shah Pankaj Gupta IEEE MICRO, Jan.-Feb. 2001

Deletion Two exceptions

compared with insertion1. It works in reverse2. It works on the chain that

has prefix p adjacent to the free space pool

The new unused entry is rippled by moving prefixes downward on the chain

Page 18: Fast Updating Algorithms for TCAMs Devavrat Shah Pankaj Gupta IEEE MICRO, Jan.-Feb. 2001

Auxiliary trie data structure To determine LC(p) and HCN(p) quickly,

the following additional fields in every trie node are maintained wt(p): the weight of each node p wt_ptr(p): the child with the highest weight hcld_ptr(p): the child at the highest location

The weight of each node 1 1

2

4

1 2

32

Page 19: Fast Updating Algorithms for TCAMs Devavrat Shah Pankaj Gupta IEEE MICRO, Jan.-Feb. 2001

Simulation

Page 20: Fast Updating Algorithms for TCAMs Devavrat Shah Pankaj Gupta IEEE MICRO, Jan.-Feb. 2001

Simulation (cont’d)

Page 21: Fast Updating Algorithms for TCAMs Devavrat Shah Pankaj Gupta IEEE MICRO, Jan.-Feb. 2001

Simulation (cont’d)

Page 22: Fast Updating Algorithms for TCAMs Devavrat Shah Pankaj Gupta IEEE MICRO, Jan.-Feb. 2001

Simulation (cont’d)

Page 23: Fast Updating Algorithms for TCAMs Devavrat Shah Pankaj Gupta IEEE MICRO, Jan.-Feb. 2001

Simulation (cont’d)

Page 24: Fast Updating Algorithms for TCAMs Devavrat Shah Pankaj Gupta IEEE MICRO, Jan.-Feb. 2001

Conclusion and discussion The PLO_OPT algorithm improves update

speed by a factor of two over the best-known solution

The CAO_OPT algorithm completes one prefix update in slightly greater than one memory movement per update operation

Some disadvantages of TCAMs More prices, more power consumption, less

capacity, dealing with prefixes only