on finding an optimal tcam encoding scheme for packet classification ori rottenstreich (technion,...

Post on 04-Jan-2016

215 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

On Finding an Optimal TCAM Encoding Scheme

for Packet Classification

Ori Rottenstreich (Technion, Israel)

Joint work with

Isaac Keslassy (Technion, Israel)

Avinatan Hassidim (Google Israel & Bar-Ilan Univ.)

Haim Kaplan (Tel Aviv Univ.)

Ely Porat (Bar-Ilan Univ.)

Network Structure

2

Accept?

Packet Classification

Action

--------

---- ----

--------

Rule ActionPolicy Database (classifier)

Packet Classification

Forwarding Engine

Incoming Packet

HEADER

Switch

3

TCAM Architecture

Enc

oder

Match lines

0

1

2

3

4

6

5

7

8

9

deny

accept

accept

denydeny

deny

denyaccept

deny

accept

00111011111110000001101001011001000

00111011100100

1110010010011100101011111111111

0011101000011100

0

0

0

1

0

1

0

1

0

1

row 3

Each entry is a word in {0,1,}W

Packet Header

TCAM Array

Source Port

Width W 4

Rule Source address

Source port

Dest.address

Dest.Port

Protocol

Action

Rule 1 123.25.0.0/16 80 255.2.3.4/32 80 TCP Accept

Rule 2 13.24.35.0/24 >1023 255.2.127.4/31 5556 TCP Deny

Rule 3 16.32.223.14 20-50 255.2.3.4/31 50-70 UDP Accept

Rule 4 22.2.3.4 1-6 255.2.3.0/21 20-22 TCP Deny

Range Rules

• Range rule = rule that contains range field Usually source-port or destination-port

• How many entries are required to represent one range field?

5

• Reducing number of TCAM entries by exploiting TCAM

properties• Example: R=[1,6]

TCAM Encoding Example

010 011001 110100 101 111000

0 1 2 3 4 5 6 7

6

Basic encoding

with 6 entries

• Reducing number of TCAM entries by exploiting TCAM

properties• Example: R=[1,6]

TCAM Encoding Example

010 011001 110100 101

001

111000

0 1 2 3 4 5 6 7

6

01* 10* 110

Shorter encoding

with 4 entries

• Reducing number of TCAM entries by exploiting TCAM

properties• Example: R=[1,6]

TCAM Encoding Example

010 011001 110100 101

***

111000

111000

0 1 2 3 4 5 6 7

6

Improved encoding

with only 3 entries

• Definition: An encoding in which in all entries “*”-s appear only as a suffix

• Example: Encoding of the range R = [0,2]

• Property: For a general function F, it is easy to find an optimal prefix encoding

• TCAM enables non-prefix encoding

• Can we use this TCAM property to do better than past algorithms?

Past Work: Prefix Encoding

7

Prefix encoding Non-prefix encoding

[Suri et al. ’03]

Outline

Introduction Optimal Encoding of Extremal Ranges Average Expansion of Extremal Ranges Bounds on the Worst-Case Expansion

8

Given a function F, we define• - The size of a smallest encoding of F. • - The size of a smallest prefix encoding of F.

• Property: For a general function F, the equality

does not necessarily hold.

• Example:

General Functions

9

010 011001000

0 1 2 3 Optimal

encodingOptimal prefix

encoding

Given a range R, does necessarily ?

• Extremal ranges = Ranges that start or end a sub-tree (e.g. [0,2] or [4,6] in tree [0,7])• Real life database: 97% of all rules are extremal ranges

• Theorem: For an extremal range R,

• Corollary: Finding an optimal encoding of extremal ranges is easy

• Open Question: Non–extremal ranges?

Range Functions

10

010 011001 110100 101 111000

0 1 2 3 4 5 6 7

Given a subtree T and a range R, we define

• - The size of a smallest encoding of R∩T with a last entry of

• - The size of a smallest encoding of R∩T with a last entry of

• Example: If and then

• and •

• Property:

Optimal Encoding

11

D

• Illustration of the algorithm for the extremal range R=[0,22]

• Values are calculated recursively for T0,…,T5

• The range R can be encoded in entries:

Algorithm Illustration

1

1

1

0

0

T0 :(1,2)

T1 :(2,2)

T2 :(2,3)

T3:(2,3)

T4:(3,3)

TW=5:(3,4)

0 22 31

R = [0,22] 12

T0 :[22,22]

T1 :[22,23]

T2 :[20,23]

• For simplicity, let’s focus on the simple extremal ranges [0,y]

Another Way to Look at it…

13

1

1

1

0

0

T0 :(1,2)

T1 :(2,2)

T2 :(2,3)

T3:(2,3)

T4:(3,3)

TW=5:(3,4)

0 22 31

R = [0,22]=[00000,10110]

A

(a,a+1)

C

(c+1,c)

B

(b,b)

0 0

1 1

1 0

Deterministic Finite Automaton (DFA)

start

•Theorem: For a range , let be the number of blue transitions of the DFA in the processing of .

Then, .

• For simplicity, let’s focus on the simple extremal ranges [0,y]

Another Way to Look at it…

14

A

(a,a+1)

C

(c+1,c)

B

(b,b)

0 0

1 1

1 0

Deterministic Finite Automaton (DFA)

start

•Theorem: For a range , let be the number of blue transitions of the DFA in the processing of .

Then, .

•Corollary: is affected by the average number of blue transitions (among the first W transitions) in the Markov Chain derived from the DFA.

• For simplicity, let’s focus on the simple extremal ranges [0,y]

Another Way to Look at it…

14

A

(a,a+1)

C

(c+1,c)

B

(b,b)

0 0

1 1

1 0

Deterministic Finite Automaton (DFA)

start1/2 1/2

A

(a,a+1)

C

(c+1,c)

B

(b,b)

1/2 1/2

1/2 1/2 Corresponding Markov Chain

• Theorem: The average range expansion of simple extremal ranges [0,y] satisfies:

• Corollary:

Average Expansion of Simple Extremal Ranges

15

Outline

Introduction Optimal Encoding of Extremal Ranges Average Expansion of Extremal Ranges Bounds on the Worst-Case Expansion

16

Known Our Contribution

1-D Ranges

2-D Ranges

Bounds on the Worst-Case Expansion

17

- Worst-case expansion over all ranges of W bits:

=

=Optimality over all coding schemesfor 1-D ranges

Optimality over all coding schemes for 2-D ranges

Concluding Remarks

• Optimal encoding of extremal ranges

• Formula for the average range expansion of simple extremal ranges

• Tight worst-case bounds r(W) (1-D ranges, all coding schemes) r2(W) (2-D ranges, all coding schemes)

18

Thank You

top related