+ All Categories
Home > Documents > On Finding an Optimal TCAM Encoding Scheme for Packet Classification Ori Rottenstreich (Technion,...

On Finding an Optimal TCAM Encoding Scheme for Packet Classification Ori Rottenstreich (Technion,...

Date post: 04-Jan-2016
Category:
Upload: alban-blankenship
View: 216 times
Download: 0 times
Share this document with a friend
22
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.)
Transcript
Page 1: On Finding an Optimal TCAM Encoding Scheme for Packet Classification Ori Rottenstreich (Technion, Israel) Joint work with Isaac Keslassy (Technion, Israel)

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.)

Page 2: On Finding an Optimal TCAM Encoding Scheme for Packet Classification Ori Rottenstreich (Technion, Israel) Joint work with Isaac Keslassy (Technion, Israel)

Network Structure

2

Accept?

Page 3: On Finding an Optimal TCAM Encoding Scheme for Packet Classification Ori Rottenstreich (Technion, Israel) Joint work with Isaac Keslassy (Technion, Israel)

Packet Classification

Action

--------

---- ----

--------

Rule ActionPolicy Database (classifier)

Packet Classification

Forwarding Engine

Incoming Packet

HEADER

Switch

3

Page 4: On Finding an Optimal TCAM Encoding Scheme for Packet Classification Ori Rottenstreich (Technion, Israel) Joint work with Isaac Keslassy (Technion, Israel)

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

Page 5: On Finding an Optimal TCAM Encoding Scheme for Packet Classification Ori Rottenstreich (Technion, Israel) Joint work with Isaac Keslassy (Technion, Israel)

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

Page 6: On Finding an Optimal TCAM Encoding Scheme for Packet Classification Ori Rottenstreich (Technion, Israel) Joint work with Isaac Keslassy (Technion, Israel)

• 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

Page 7: On Finding an Optimal TCAM Encoding Scheme for Packet Classification Ori Rottenstreich (Technion, Israel) Joint work with Isaac Keslassy (Technion, Israel)

• 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

Page 8: On Finding an Optimal TCAM Encoding Scheme for Packet Classification Ori Rottenstreich (Technion, Israel) Joint work with Isaac Keslassy (Technion, Israel)

• 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

Page 9: On Finding an Optimal TCAM Encoding Scheme for Packet Classification Ori Rottenstreich (Technion, Israel) Joint work with Isaac Keslassy (Technion, Israel)

• 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]

Page 10: On Finding an Optimal TCAM Encoding Scheme for Packet Classification Ori Rottenstreich (Technion, Israel) Joint work with Isaac Keslassy (Technion, Israel)

Outline

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

8

Page 11: On Finding an Optimal TCAM Encoding Scheme for Packet Classification Ori Rottenstreich (Technion, Israel) Joint work with Isaac Keslassy (Technion, Israel)

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

Page 12: On Finding an Optimal TCAM Encoding Scheme for Packet Classification Ori Rottenstreich (Technion, Israel) Joint work with Isaac Keslassy (Technion, Israel)

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

Page 13: On Finding an Optimal TCAM Encoding Scheme for Packet Classification Ori Rottenstreich (Technion, Israel) Joint work with Isaac Keslassy (Technion, Israel)

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

Page 14: On Finding an Optimal TCAM Encoding Scheme for Packet Classification Ori Rottenstreich (Technion, Israel) Joint work with Isaac Keslassy (Technion, Israel)

• 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]

Page 15: On Finding an Optimal TCAM Encoding Scheme for Packet Classification Ori Rottenstreich (Technion, Israel) Joint work with Isaac Keslassy (Technion, Israel)

• 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

Page 16: On Finding an Optimal TCAM Encoding Scheme for Packet Classification Ori Rottenstreich (Technion, Israel) Joint work with Isaac Keslassy (Technion, Israel)

•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

Page 17: On Finding an Optimal TCAM Encoding Scheme for Packet Classification Ori Rottenstreich (Technion, Israel) Joint work with Isaac Keslassy (Technion, Israel)

•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

Page 18: On Finding an Optimal TCAM Encoding Scheme for Packet Classification Ori Rottenstreich (Technion, Israel) Joint work with Isaac Keslassy (Technion, Israel)

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

• Corollary:

Average Expansion of Simple Extremal Ranges

15

Page 19: On Finding an Optimal TCAM Encoding Scheme for Packet Classification Ori Rottenstreich (Technion, Israel) Joint work with Isaac Keslassy (Technion, Israel)

Outline

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

16

Page 20: On Finding an Optimal TCAM Encoding Scheme for Packet Classification Ori Rottenstreich (Technion, Israel) Joint work with Isaac Keslassy (Technion, Israel)

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

Page 21: On Finding an Optimal TCAM Encoding Scheme for Packet Classification Ori Rottenstreich (Technion, Israel) Joint work with Isaac Keslassy (Technion, Israel)

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

Page 22: On Finding an Optimal TCAM Encoding Scheme for Packet Classification Ori Rottenstreich (Technion, Israel) Joint work with Isaac Keslassy (Technion, Israel)

Thank You


Recommended