This Article 
 Bibliographic References 
 Add to: 
Space-Efficient TCAM-Based Classification Using Gray Coding
January 2012 (vol. 61 no. 1)
pp. 18-30
Anat Bremlerr-Barr, The Interdisciplinary Center
Danny Hendler, Ben-Gurion University
Ternary content-addressable memories (TCAMs) are increasingly used for high-speed packet classification. TCAMs compare packet headers against all rules in a classification database in parallel and thus provide high throughput unparalleled by software-based solutions. TCAMs are not well-suited, however, for representing rules that contain range fields. Such rules typically have to be represented (or encoded) by multiple TCAM entries. The resulting range expansion can dramatically reduce TCAM utilization. A TCAM range-encoding algorithm {\cal A} is database-independent if, for all ranges r, it encodes r independently of the database in which it appears; otherwise, we say that {\cal A} is database-dependent. Typically, when storing a classification database in TCAM, a few dozens of so-called extra bits in each TCAM entry remain unused. These extra bits are used by some (both database-dependent and database-independent) prior algorithms to reduce range expansion. The majority of real-life database ranges are short. We present a novel database-independent algorithm called Short Range Gray Encoding (SRGE) for the efficient representation of short range rules. SRGE encodes range endpoints as binary-reflected Gray codes and then represents the resulting range by a minimal set of ternary strings. To the best of our knowledge, SRGE is the first algorithm that achieves a reduction in range expansion in general, and a significant expansion reduction for short ranges in particular, without resorting to the use of extra bits. The “traditional” database-independent technique for representing range entries in TCAM is prefix expansion. As we show, SRGE significantly reduces the expansion of short ranges in comparison with prefix expansion. We also prove that the SRGE algorithm's range expansion is at least as good as that of prefix expansion for any range. Real-world classification databases contain a small number of unique long ranges, some of which appear in numerous rules. These long ranges cause high expansion which is not significantly reduced by any database-independent range encoding scheme that we are aware of, including SRGE. We introduce hybrid SRGE, a database-dependent encoding scheme that uses SRGE for reducing the expansion of short ranges and uses extra bits for reducing the expansion caused by long ones. Our comparative analysis establishes that hybrid SRGE utilizes TCAM more efficiently than previously published range-encoding algorithms. This work also makes a more theoretic contribution. Prefix expansion for ranges defined by W-bit endpoints has worst-case expansion ratio of 2W-2. It follows from the work of Schieber et al. [1] that the SRGE algorithm has a slightly better worst-case expansion ratio of 2W-4. We prove that any independent TCAM encoding scheme has worst-case expansion ratio of at least W.

[1] B. Schieber, D. Geist, and A. Zaks, "Computing the Minimum dnf Representation of Boolean Functions Defined by Intervals," Discrete Applied Math., vol. 149, pp. 154-173, 2005.
[2] D.E. Taylor, "Survey and Taxonomy of Packet Classification Techniques," ACM Computer Surverys, vol. 37, pp. 238-275, 2005.
[3] P. Gupta and N. McKeown, "Algorithms for Packet Classification," IEEE Network, vol. 15, no. 2, p. 24, Mar./Apr. 2001.
[4] G. Varghese, Network Algorithmics: An Interdisciplinary Approach to Designing Fast Networked Devices. Morgan Kaufmann, 2005.
[5] F. Baboescu, S. Singh, and G. Varghese, "Packet Classification for Core Routers: Is There an Alternative to Cams," Proc. IEEE INFOCOM, 2003.
[6] V. Srinivasan, G. Varghese, S. Suri, and M. Waldvogel, "Fast and Scalable Layer Four Switching," Proc. ACM SIGCOMM '98, pp. 191-202, Sept. 1998.
[7] H. Liu, "Efficient Mapping of Range Classifier into Ternary-Cam," Proc. Symp. High Performance Interconnects, 2002.
[8] J. van Lunteren and T. Engbersen, "Fast and Scalable Packet Classification," IEEE J. Selected Areas in Comm., vol. 21, no. 4, pp. 560-571, May 2003.
[9] S. Venkatachary, K. Lakshminarayanan, and A. Rangarajan, "Algorithms for Advanced Packet Classification with Ternary Cams," Proc. ACM SIGCOMM '05, 2005.
[10] F. Yu and R.H. Katz, "Efficient Multi-Match Packet Classification with TCAM," Proc. Symp. High Performance Interconnects (HOTI '04), 2004.
[11] Y.-K. Kim, C.-C. Su, and Y.-C. Lin, "Efficient Gray Code Based Range Encoding Schemes for Packet Classification in TCAM," Proc. Global Telecomm. Conf. (Globecom), pp. 1834-1839, 2007.
[12] D. Taylor, E. Spitznagel, and J. Turner, "Packet Classification Using Extended TCAMs," Proc. IEEE Int'l Conf. Network Protocols (ICNP '03), 2003.
[13] H. Che, Z.J. Wang, K. Zheng, and B. Liu, "DRES: Dynamic Range Encoding Scheme for TCAM Coprocessors," IEEE Trans. Computers, vol. 57, no. 7, pp. 902-915, July 2008.
[14] R.P. Draves, C. King, S. Venkatachary, and B.D. Zill, "Constructing Optimal IP Routing Tables," Proc. IEEE INFOCOM, Mar. 1999.
[15] Q. Dong, S. Banerjee, J. Wang, D. Agrawal, and A. Shukla, "Packet Classifiers in Ternary Cams Can Be Smaller," Proc. Int'l Conf. Measurement and Modeling of Computer Systems (SIGMETRICS '06), pp. 311-322, 2006.
[16] C.R. Meiners, A.X. Liu, and E. Torng, "TCAM Razor: A Systematic Approach towards Minimizing Packet Classifiers in TCAMs," Proc. IEEE Int'l Conf. Network Protocols (ICNP '07), 2007.
[17] S. Suri, T. Sandholm, and P.R. Warkhede, "Compressing Two-Dimensional Routing Tables," Algorithmica, vol. 35, no. 4, pp. 287-300, 2003.
[18] C. Meiners, A. Liu, and E. Torng, "Topological Transformation Approaches to Optimizing TCAM-Based Packet Processing Systems," Proc. ACM SIGCOMM, 2008.
[19] C.R. Meiners, A.X. Liu, and E. Torng, "Bit Weaving: A Non-Prefix Approach to Compressing Packet Classifiers in Tcams," Proc. IEEE Int'l Conf. Network Protocols (ICNP '09), pp. 93-102, 2009.
[20] A.X. Liu, C.R. Meiners, and Y. Zhou, "All-Match Based Complete Redundancy Removal for Packet Classifiers in TCAMs," Proc. IEEE INFOCOM, Apr. 2008.
[21] A.X. Liu, E. Torng, and C. Meiners, "Firewall Compressor: An Algorithm for Minimizing Firewall Policies," Proc. IEEE INFOCOM, Apr. 2008.
[22] A.X. Liu and M.G. Gouda, "Complete Redundancy Detection in Firewalls," Proc. 19th Ann. IFIP Conf. Data and Applications Security, pp. 196-209, Aug. 2005.
[23] A.X. Liu and M.G. Gouda, "Complete Redundancy Removal for Packet Classifiers in Tcams," IEEE Trans. Parallel and Distributed Systems, vol. 21, no. 4, pp. 424-437, Apr. 2010.
[24] C.R. Meiners, A.X. Liu, and E. Torng, "Topological Transformation Approaches to Optimizing Tcam-Based Packet Classification Systems," Proc. Int'l Joint Conf. Measurement and Modeling of Computer Systems (SIGMETRICS '09), pp. 73-84, 2009.
[25] K. Zheng, H. Che, Z. Wang, B. Liu, and X. Zhang, "DPPC-RE: TCAM-Based Distributed Parallel Packet Classification with Range Encoding," IEEE Trans. Computers, vol. 55, no. 8, pp. 947-961, Aug. 2006.
[26] K. Zheng, C.C. Hu, H.B. Lu, and B. Liu, "An Ultra High Throughput and Power Efficient Tcam-Based ip Lookup Engine," Proc. IEEE INFOCOM, 2004.
[27] "Ports Numbers," numbers , 2006.
[28] J.S. Turner and D.E. Taylor, "Classbench: A Packet Classification Benchmark," Proc. IEEE INFOCOM, 2005.
[29] D.E. Taylor and J.S. Turner, "Classbench: A Packet Classification Benchmark," IEEE/ACM Trans. Networking, vol. 15, no. 3, pp. 499-511, June 2007.

Index Terms:
TCAM, packet classification, range encoding, Gray code.
Anat Bremlerr-Barr, Danny Hendler, "Space-Efficient TCAM-Based Classification Using Gray Coding," IEEE Transactions on Computers, vol. 61, no. 1, pp. 18-30, Jan. 2012, doi:10.1109/TC.2010.267
Usage of this product signifies your acceptance of the Terms of Use.