Skip to contentSkip to conversation

ipv4: Remove fib_hash.

PATCH In review David Miller 3 participants 8 messages Feb 1, 2011 – Feb 2, 2011

Subsystems (3)
lore
Share & tools
lore

David Miller

author maintainer
#0 lore raw

PATCH 1/1 ipv4: Remove fib_hash.

The time has finally come to remove the hash based routing table implementation in ipv4.

FIB Trie is mature, well tested, and I've done an audit of it's code to confirm that it implements insert, delete, and lookup with the same identical semantics as fib_hash did.

If there are any semantic differences found in fib_trie, we should simply fix them.

I've placed the trie statistic config option under advanced router configuration.

---
 net/ipv4/Kconfig    |   38 +--
 net/ipv4/Makefile   |    4 +-
 net/ipv4/fib_hash.c | 1061 ---------------------------------------------------
 3 files changed, 2 insertions(+), 1101 deletions(-)
 delete mode 100644 net/ipv4/fib_hash.c
net/ipv4/Kconfig +1 -37
index 8949a05..cbb505b 100644
@@ -55,45 +55,9 @@ config IP_ADVANCED_ROUTER
 
 	  If unsure, say N here.
 
-choice
-	prompt "Choose IP: FIB lookup algorithm (choose FIB_HASH if unsure)"
-	depends on IP_ADVANCED_ROUTER
-	default ASK_IP_FIB_HASH
-
-config ASK_IP_FIB_HASH
-	bool "FIB_HASH"
-	---help---
-	  Current FIB is very proven and good enough for most users.
-
-config IP_FIB_TRIE
-	bool "FIB_TRIE"
-	---help---
-	  Use new experimental LC-trie as FIB lookup algorithm.
-	  This improves lookup performance if you have a large
-	  number of routes.
-
-	  LC-trie is a longest matching prefix lookup algorithm which
-	  performs better than FIB_HASH for large routing tables.
-	  But, it consumes more memory and is more complex.
-
-	  LC-trie is described in:
-
-	  IP-address lookup using LC-tries. Stefan Nilsson and Gunnar Karlsson
-	  IEEE Journal on Selected Areas in Communications, 17(6):1083-1092,
-	  June 1999
-
-	  An experimental study of compression methods for dynamic tries
-	  Stefan Nilsson and Matti Tikkanen. Algorithmica, 33(1):19-33, 2002.
-	  <http://www.csc.kth.se/~snilsson/software/dyntrie2/>
-
-endchoice
-
-config IP_FIB_HASH
-	def_bool ASK_IP_FIB_HASH || !IP_ADVANCED_ROUTER
-
 config IP_FIB_TRIE_STATS
 	bool "FIB TRIE statistics"
-	depends on IP_FIB_TRIE
+	depends on IP_ADVANCED_ROUTER
 	---help---
 	  Keep track of statistics on structure of FIB TRIE table.
 	  Useful for testing and measuring TRIE performance.
net/ipv4/Makefile +1 -3
index 4978d22..0dc772d 100644
@@ -10,12 +10,10 @@ obj-y     := route.o inetpeer.o protocol.o \
 	     tcp_minisocks.o tcp_cong.o \
 	     datagram.o raw.o udp.o udplite.o \
 	     arp.o icmp.o devinet.o af_inet.o  igmp.o \
-	     fib_frontend.o fib_semantics.o \
+	     fib_frontend.o fib_semantics.o fib_trie.o \
 	     inet_fragment.o
 
 obj-$(CONFIG_SYSCTL) += sysctl_net_ipv4.o
-obj-$(CONFIG_IP_FIB_HASH) += fib_hash.o
-obj-$(CONFIG_IP_FIB_TRIE) += fib_trie.o
 obj-$(CONFIG_PROC_FS) += proc.o
 obj-$(CONFIG_IP_MULTIPLE_TABLES) += fib_rules.o
 obj-$(CONFIG_IP_MROUTE) += ipmr.o
net/ipv4/fib_hash.c deleted +0 -1061

1,061 lines not on this page · raw message

Signature · 1 line
1.7.4
Acked-by on v1 1/1
#1 lore raw
Quoted 8 lines · On Tue, 01 Feb 2011 15:19:41 -0800 (PST) David Miller <[email protected]>…

The time has finally come to remove the hash based routing table implementation in ipv4.

FIB Trie is mature, well tested, and I've done an audit of it's code to confirm that it implements insert, delete, and lookup with the same identical semantics as fib_hash did.

Quoted 7 lines

If there are any semantic differences found in fib_trie, we should simply fix them.

I've placed the trie statistic config option under advanced router configuration.

Vyatta has been shipping FIB TRIE for over 3 years with reported bugs.

#2 lore raw
Quoted 14 lines · On Tue, 1 Feb 2011 15:26:03 -0800 Stephen Hemminger <[email protected]>…
Quoted 11 lines · On Tue, 01 Feb 2011 15:19:41 -0800 (PST) David Miller <[email protected]>…

The time has finally come to remove the hash based routing table implementation in ipv4.

FIB Trie is mature, well tested, and I've done an audit of it's code to confirm that it implements insert, delete, and lookup with the same identical semantics as fib_hash did.

If there are any semantic differences found in fib_trie, we should simply fix them.

Quoted 7 lines
Quoted 4 lines

I've placed the trie statistic config option under advanced router configuration.

Vyatta has been shipping FIB TRIE for over 3 years with reported bugs.

NO reported bugs!!

author maintainer
#3 lore raw

From: Stephen Hemminger <[email protected]>
Date: Tue, 1 Feb 2011 15:33:32 -0800

Quoted 20 lines
Quoted 17 lines · On Tue, 1 Feb 2011 15:26:03 -0800 Stephen Hemminger <[email protected]>…
Quoted 14 lines · On Tue, 01 Feb 2011 15:19:41 -0800 (PST) David Miller <[email protected]>…

The time has finally come to remove the hash based routing table implementation in ipv4.

FIB Trie is mature, well tested, and I've done an audit of it's code to confirm that it implements insert, delete, and lookup with the same identical semantics as fib_hash did.

If there are any semantic differences found in fib_trie, we should simply fix them.

I've placed the trie statistic config option under advanced router configuration.

Quoted 6 lines
Quoted 4 lines
Quoted 1 line

Vyatta has been shipping FIB TRIE for over 3 years with reported bugs.

NO reported bugs!!

Understood. :-)

Thanks for reviewing Stephen.

#4 lore raw
In reply to David Miller
Quoted 7 lines · David Miller

The time has finally come to remove the hash based routing table implementation in ipv4.

FIB Trie is mature, well tested, and I've done an audit of it's code to confirm that it implements insert, delete, and lookup with the same identical semantics as fib_hash did.

Quoted 8 lines

If there are any semantic differences found in fib_trie, we should simply fix them.

I've placed the trie statistic config option under advanced router configuration.

---

Hmm... I know having to maintain two implementations is time consuming, but I know fib_trie is bigger :

# size net/ipv4/fib_*.o
   text	   data	    bss	    dec	    hex	filename
   7252	    120	      0	   7372	   1ccc	net/ipv4/fib_frontend.o
   7279	     16	      4	   7299	   1c83	net/ipv4/fib_hash.o
   1479	      0	      0	   1479	    5c7	net/ipv4/fib_rules.o
   7885	      0	   2080	   9965	   26ed	net/ipv4/fib_semantics.o
  16222	     16	     16	  16254	   3f7e	net/ipv4/fib_trie.o

In my tests, I know that fib_trie is more expensive for typical routing tables for hosts (no more than a dozen or entries), in latencies results, mostly because of icache misses, but also dcache ones.

Thanks

author maintainer
#5 lore raw

From: Eric Dumazet <[email protected]>
Date: Wed, 02 Feb 2011 01:48:13 +0100

Quoted 11 lines

Hmm... I know having to maintain two implementations is time consuming, but I know fib_trie is bigger :

# size net/ipv4/fib_*.o
   text	   data	    bss	    dec	    hex	filename
   7252	    120	      0	   7372	   1ccc	net/ipv4/fib_frontend.o
   7279	     16	      4	   7299	   1c83	net/ipv4/fib_hash.o
   1479	      0	      0	   1479	    5c7	net/ipv4/fib_rules.o
   7885	      0	   2080	   9965	   26ed	net/ipv4/fib_semantics.o
  16222	     16	     16	  16254	   3f7e	net/ipv4/fib_trie.o
Quoted 3 lines

In my tests, I know that fib_trie is more expensive for typical routing tables for hosts (no more than a dozen or entries), in latencies results, mostly because of icache misses, but also dcache ones.

It's mostly the rebalancing code that takes up the space.

The lookup path is on the same order of magnitude as the fib hash stuff was.

In any event, we have several months to hash out any regressions and I think if I didn't do this removal nobody would work on it so... :-)

#6 lore raw
Quoted 18 lines · On Tue, 01 Feb 2011 18:15:42 -0800 (PST) David Miller <[email protected]>…

From: Eric Dumazet <[email protected]>
Date: Wed, 02 Feb 2011 01:48:13 +0100

Quoted 11 lines

Hmm... I know having to maintain two implementations is time consuming, but I know fib_trie is bigger :

# size net/ipv4/fib_*.o
   text	   data	    bss	    dec	    hex	filename
   7252	    120	      0	   7372	   1ccc	net/ipv4/fib_frontend.o
   7279	     16	      4	   7299	   1c83	net/ipv4/fib_hash.o
   1479	      0	      0	   1479	    5c7	net/ipv4/fib_rules.o
   7885	      0	   2080	   9965	   26ed	net/ipv4/fib_semantics.o
  16222	     16	     16	  16254	   3f7e	net/ipv4/fib_trie.o
Quoted 3 lines

In my tests, I know that fib_trie is more expensive for typical routing tables for hosts (no more than a dozen or entries), in latencies results, mostly because of icache misses, but also dcache ones.

Quoted 7 lines

It's mostly the rebalancing code that takes up the space.

The lookup path is on the same order of magnitude as the fib hash stuff was.

In any event, we have several months to hash out any regressions and I think if I didn't do this removal nobody would work on it so... :-)

For the case of small devices, what about keeping fib_hash as option under CONFIG_EMBEDDED. And remove all the magic resizing of hash table. Get back to something with really small size.

author maintainer
#7 lore raw

From: Stephen Hemminger <[email protected]>
Date: Wed, 2 Feb 2011 08:29:21 -0800

Quoted 3 lines

For the case of small devices, what about keeping fib_hash as option under CONFIG_EMBEDDED. And remove all the magic resizing of hash table. Get back to something with really small size.

That's still going to be ~20,000 lines of code kept in the tree duplicating functionality.

Sorry, no.