Download presentation
Presentation is loading. Please wait.
1
On the Code Length of TCAM Coding Schemes Ori Rottenstreich (Technion, Israel) Joint work with Isaac Keslassy (Technion, Israel) 1
2
Network Structure 2
3
Packet Classification Action ---- RuleAction Policy Database (classifier) Packet Classification Forwarding Engine Incoming Packet HEADERHEADER 3 Switch
4
The TCAM Architecture Encoder Match lines 0 1 2 3 4 6 5 7 8 9 deny accept deny accept deny accept 001110111111 1 00 0000110 10 010110 01000 001110 1110 010 0 11 10010 01 0011100 1010 11111111111 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 4 Width W
5
Range Rules RuleSource address Source port Dest- address Dest- port Prot ocol Action Rule 1 123.25.0.0/1680255.2.3.4/32 80TCP Accept Rule 2 13.24.35.0/24>1023255.2.127.4/315556 TCP Deny Rule 3 16.32.223.1420-50255.2.3.4/3150-70 UDP Accept Rule 4 22.2.3.41-6255.2.3.0/2120-22 TCP Limit Rule 5 255.2.3.412-809255.2.3.417-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?
6
Range Rule Representation in TCAM Coding objective: minimize the number of TCAM entries needed to code the range More TCAM entries represent more power consumption Some ranges are easy to represent Example: W=3: [4, 7] = {100,101,110,111} = 1 But what about [1,6] ? 6
7
Range [1,6] in tree of all elements with W=3 bits: (Internal) Coding of [1,6] 010011001110100101 111000 Known result: expansion in 2W-2 TCAM entries Here: 2W-2=4 TCAM entries 7
8
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?
9
External Coding 010011001110100101 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? 9
10
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 f p (W) as the minimal code length given all prefix coding schemes. 10
11
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 010011001110100101111000 R=[0,0]R=[0,1]R=[0,2]R=[0,3]R=[0,7] 11
12
Results KnownOur Contribution Optimality over all coding schemes 12 Optimality over prefix coding schemes which are the most common coding schemes
13
Optimality Proof Intuition a1a1 a2a2 a3a3 Assume W = 2 and R = [0,2]. If a 1 (01), a 3 (10) R are encoded in the same TCAM entry, it must be **. Therefore, a 2 (11) R also matches this entry. 000110 11 R 13 The range R = [0,2] cannot be coded in a single TCAM entry.
14
Hull Property We define the hull of a set of W -bit strings in the W - dimensional string space: Definition (Hull): Let (n, W) N 2, and consider n strings a 1, …, a n of W bits each, with a i = (a i 1, …, a i W ) for each i [1,n]. Then the hull of (a 1, …, a n ), denoted H(a 1, …, a n ), is the smallest cuboid containing a 1, …, a n in the W-dimensional string space, and is defined as 14 H(a 1, a 3 ) = H(10, 01) = {00, 01, 10, 11} 000110 11 R a1a1 a2a2 a3a3
15
Alternating Path and Independent Set Let n and W be positive integers and let α:{0,1} W →{0,1} be a classifier function. A n = (a 1, …, a 2n-1 ) is an alternating path if it satisfies the following conditions: Alternation: For i [1,2n-1], α(a 1 ) = α(a 3 ) = … = α(a 2n-1 ) = 1 α(a 2 ) = α(a 4 ) = … = α(a 2n-2 ) = 0 Hull: For any i 1, i 2, i 3 such that i 1 ≤ i 2 ≤ i 3 ≤2n-1, a i2 H(a i1, a i3 ) 15 In such an alternating path (a 1, a 3, a 5, …, a 2n-3, a 2n-1 ) is an independent set
16
Example a1a1 a2a2 a3a3 W = 2 and R = [0,2]. Alternation: α(a 1 ) = α(a 3 ) = 1, α(a 2 )=0. Hull: a 2 H(a 1, a 3 ). (a 1, a 2, a 3 ) is an alternating path and (a 1, a 3 ) is an independent set 000110 11 R 16
17
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
18
Extremal Range Code-Length Optimality Assume W=4. Let R = [0, c] = [0, {1010}]. Define: a 1 = 0101 a 2 = 1101 a 3 = 1001, a 4 = 1011 a 5 = c = 1010. Observe: a 1, a 3, a 5 ≤ c = 1010, a 2, a 4 > c = 1010. Alternation: α(a 1 ) = α(a 3 ) = α(a 5 )= 1, α(a 2 ) = α(a 4 )= 0. Hull: a i2 H(a i1, a i3 ) for i 1 ≤ i 2 ≤ i 3. (a 1, a 3, a 5 ) is an independent set. The range R = [0,{1010}] cannot be coded in less than 3 TCAM entries. 18
19
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(2 W -1)]. Define: a 1 = {01} W/2, a 2 = 11{01} W/2-1, a 3 = 10{01} W/2-1, a 4 = 1011{01} W/2-2, a 5 = 1010{01} W/2-2, …, a W+1 = c = {10} W/2 Observe: a 2k+1 ≤ c a 2k ≥ c. Alternation: α(a 2k+1 ) = 1, α(a 2k ) = 0. Hull: a i2 H(a i1, a i3 ) for i 1 ≤ i 2 ≤ i 3. (a 1, a 2, …, a W+1 ) is an alternating path and (a 1, a 3, …, a W+1 ) is an independent set. The upper bound of g(W) is tight. 19
20
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
21
Summary TCAM coding optimality g(W) (Extremal ranges, all coding schemes) f p (W) (All ranges, prefix coding schemes) New tools for TCAM: Independent sets and alternating paths 21
22
Thank You 22
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.