250 likes | 530 Views
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.
E N D
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 Accept?
Packet Classification Forwarding Engine Packet Classification Policy Database (classifier) Rule Action ---- ---- ---- ---- ---- ---- Switch HEADER Action Incoming Packet
TCAM Architecture 0 0 1 0 2 0 3 1 4 0 0 5 6 1 7 1 0 8 9 1 TCAM Array deny 001110111111 deny Each entry is a word in {0,1,}W 1000000110 accept 1001011001000 deny row 3 001110 accept 11100100 Encoder deny 111001001 deny 0011100 accept 1010 deny 11111111111 accept Match lines Source Port 0011101000011100 Width W Packet Header
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?
TCAM Encoding Example • Reducing number of TCAM entries by exploiting TCAM • properties • Example: R=[1,6] • Basic encoding • with 6 entries 000 001 010 011 100 101 110 111
TCAM Encoding Example • Reducing number of TCAM entries by exploiting TCAM • properties • Example: R=[1,6] • Shorter encoding • with 4 entries 000 001 010 011 100 101 110 111
TCAM Encoding Example • Reducing number of TCAM entries by exploiting TCAM • properties • Example: R=[1,6] • Improved encoding • with only 3 entries 000 001 010 011 100 101 110 111
Past Work: Prefix Encoding • 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? • 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
General Functions • 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: Optimal prefix encoding • Optimal encoding 000 001 010 011
Range Functions • 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? 000 001 010 011 100 101 110 111
Optimal Encoding • 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: D
Algorithm Illustration • 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: T0 :[22,22] TW=5:(3,4) 1 T4:(3,3) T1 :[22,23] 0 T3:(2,3) 1 T2 :(2,3) T2 :[20,23] 1 T1 :(2,2) 0 T0 :(1,2) 22 31 0 R = [0,22]
Another Way to Look at it… • For simplicity, let’s focus on the simple extremal ranges [0,y] TW=5:(3,4) 1 T4:(3,3) 0 0 0 1 0 T3:(2,3) 1 start T2 :(2,3) A (a,a+1) B (b,b) C (c+1,c) 1 T1 :(2,2) 0 T0 :(1,2) 1 1 0 22 31 Deterministic Finite Automaton (DFA) R = [0,22]=[00000,10110]
Another Way to Look at it… • For simplicity, let’s focus on the simple extremal ranges [0,y] • Theorem: For a range , let be the number of blue transitions of the DFA in the processing of . • Then, . start 0 0 1 0 A (a,a+1) B (b,b) C (c+1,c) 1 1 Deterministic Finite Automaton (DFA)
Another Way to Look at it… • For simplicity, let’s focus on the simple extremal ranges [0,y] • 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. 1/2 1/2 1/2 A (a,a+1) B (b,b) C (c+1,c) 1/2 start 0 0 1 0 1/2 1/2 A (a,a+1) B (b,b) C (c+1,c) Corresponding Markov Chain 1 1 Deterministic Finite Automaton (DFA)
Average Expansion of Simple Extremal Ranges • Theorem: The average range expansion of simple extremal ranges [0,y] satisfies: • Corollary:
Outline Introduction Optimal Encoding of Extremal Ranges Average Expansion of Extremal Ranges Bounds on the Worst-Case Expansion
Bounds on the Worst-Case Expansion - Worst-case expansion over all ranges of W bits: = Optimality over all coding schemes for 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)