View
219
Download
0
Tags:
Embed Size (px)
Citation preview
On the Code Length of TCAM Coding Schemes
Ori Rottenstreich (Technion, Israel)
Joint work with Isaac Keslassy (Technion, Israel)
1
Packet Classification
Action
--------
---- ----
--------
Rule ActionPolicy Database (classifier)
Packet Classification
Forwarding Engine
Incoming Packet
HEADER
3
Switch
The 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
4Width W
Range Rules
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 Limit
Rule 5 255.2.3.4 12-809 255.2.3.4 17-190 ICMP Log
Range rule = rule that contains range field Usually source-port or dest-port
5
How many TCAM entries are required for representing one range field?
Range Rule Representation in TCAM
Coding objective: minimize the number of TCAM entries needed to code the rangeMore TCAM entries represent more power
consumption
Some ranges are easy to representExample: W=3:
[4, 7] = {100,101,110,111} = 1
But what about [1,6]?
6
Range [1,6] in tree of all elements with W=3 bits:
(Internal) Coding of [1,6]
010 011001 110100 101
10* 11001*001
111000
Known result: expansion in 2W-2 TCAM entries Here: 2W-2=4 TCAM entries
0 1 2 3 4 5 6 7
7
Upper Bounds on the TCAM Range Expansion
2W-2 (Srinivasan et al., 1998)
2W-4 (Bremler-Barr et al., 2007)
2W-5 (Roth, 2009)
W (Rottenstreich et al., 2010; Cohen et al., 2010)
???
8
Is W also the lower bound?
External Coding
010 011001 110100 101
***
111000
111000
Reduced number of TCAM entries: exploiting TCAM entry order by coding range complimentary as well
Recent result: expansion in W TCAM entries Here: W=3 TCAM entries (instead of 4) Is this new coding scheme
optimal? 0 1 2 3 4 5 6 7
9
Basic Definitions
Let be the number of TCAM entries required for representing the range R using the coding scheme .
We define the range code length f(W) as the best achievable code length for W-bit ranges given all coding schemes
Likewise, we define fp(W) as the minimal code length given all prefix coding schemes.
[0,2 1]
( ) min max ( )][
Wcode range R
f W n R
10
Basic Definitions (2)
We define the range code length g(W) as the best achievable code length for extremal W-bit ranges given all coding schemes
{[0, ] | [0,2 ]}1( ) min max ( )][
Wcode range R y y
g W n R
010 011001 110100 101 111000
0 1 2 3 4 5 6 7
R=[0,0]R=[0,1]R=[0,2]R=[0,3]R=[0,7]
11
Results
Known Our Contribution
1( )
2
Wg W
1
( )2
Wg W
( ) ( )pf W f W W ( )pf W WOptimality over all coding schemes
12
Optimality over prefix coding schemeswhich are the most common coding
schemes
Optimality Proof Intuition
a1 a2a3
Assume W = 2 and R = [0,2].
If a1(01), a3(10) R are encoded in the same TCAM
entry, it must be **.
Therefore, a2(11) R also matches this entry.
00 01 10 11
R
13
The range R = [0,2] cannot be coded in a single TCAM entry.
11
1
( ,..., ) { ( ,..., ) {0,1} |
[1, ], { ,..., }}
n WW
nj j j
H a a x x x
j W x a a
Hull Property
We define the hull of a set of W -bit strings in the W -dimensional string space:
Definition (Hull): Let (n, W) N2, and consider n strings a1, …, an of W bits each, with ai = (ai
1, …, aiW) for each
i [1,n]. Then the hull of (a1, …, an), denoted H(a1, …, an), is the
smallest cuboid containing a1, …, an in the W-dimensional string space, and is defined as
14
H(a1, a3) = H(10, 01) = }00 ,01 ,10 ,11{
00 01 10 11
R
a1 a2a3
Alternating Path and Independent Set
Let n and W be positive integers and let α:{0,1}W→{0,1} be
a classifier function.
An = (a1, …, a2n-1) is an alternating path if it satisfies the following conditions:
Alternation: For i [1,2n-1],
α(a1) = α(a3) = … = α(a2n-1) = 1
α(a2) = α(a4) = … = α(a2n-2) = 0
Hull: For any i1, i2, i3 such that i1 ≤ i2 ≤ i3 ≤2n-1, ai2 H(ai1, ai3)
15
In such an alternating path )a1, a3, a5, … , a2n-3, a2n-1 (is an
independent set
Example
a1 a2a3
W = 2 and R = [0,2].
Alternation: α(a1) = α(a3) = 1, α(a2)=0.
Hull: a2 H(a1, a3).
)a1, a2, a3 (is an alternating path and )a1, a3 (is an independent set
00 01 10 11
R
16
Alternating Path and Independent Set
Theorem: A classifier function with an independent set of size n cannot be coded in less than n TCAM entries.
17
Extremal Range Code-Length Optimality
Assume W=4.
Let R = [0, c] = [0, {1010}] .
Define: a1 = 0101
a2 = 1101
a3 = 1001,
a4 = 1011
a5 = c = 1010. Observe: a1, a3, a5 ≤ c = 1010,
a2, a4 > c = 1010. Alternation: α(a1) = α(a3) = α(a5)= 1, α(a2) = α(a4)= 0.
Hull: ai2 H(ai1, ai3) for i1 ≤ i2 ≤ i3 .
)a1, a3, a5 (is an independent set.The range R = [0,{1010}] cannot be coded in less than 3 TCAM entries.
18
Extremal Range Code-Length Optimality
We showed optimality for g(W) with W=2 and W=4, let’s show it for any even W.
Let R = [0, c] = [0, {10}W] = [0,2/3(2W-1)].
Define: a1 = {01}W/2, a2 = 11{01}W/2-1, a3 = 10{01}W/2-1,
a4 = 1011{01}W/2-2, a5 = 1010{01}W/2-2,
…, aW+1 = c = {10}W/2
Observe: a2k+1 ≤ c
a2k ≥ c. Alternation: α(a2k+1) = 1, α(a2k) = 0.
Hull: ai2 H(ai1, ai3) for i1 ≤ i2 ≤ i3. (a1, a2, …, aW+1) is an alternating path and (a1, a3 , … ,
aW+1) is an independent set.
The upper bound of g(W) is tight.
19
General Range Code-Length Optimality
In this paper, we present a range R that cannot be coded in less than W prefix TCAM entries, whether the first TCAM entry encodes the range R (internal coding) or its complementary (external coding).
Future Direction:
• Coding scheme optimality over all coding schemes
20
Summary
TCAM coding optimality• g(W) (Extremal ranges, all coding schemes)
• fp(W) (All ranges, prefix coding schemes)
New tools for TCAM: Independent sets and alternating paths
21