Re: [PATCH 1/3] fib_trie: move statistics to debugfs

2008-02-18 Thread Stephen Hemminger
On Sun, 17 Feb 2008 22:26:55 -0800 (PST)
David Miller <[EMAIL PROTECTED]> wrote:

> From: Stephen Hemminger <[EMAIL PROTECTED]>
> Date: Wed, 13 Feb 2008 11:58:06 -0800
> 
> > Don't want /proc/net/fib_trie and /proc/net/fib_triestat to become
> > permanent kernel space ABI issues, so move to the safer confines of debugfs.
> > 
> > Signed-off-by: Stephen Hemminger <[EMAIL PROTECTED]>
> 
> Stephen, the cat is already out of the bag.  We already export this
> thing so if you want to export different stuff you'll have to provide
> it via some other means, somewhere else.
> 
> Thanks.

Are we stuck with the format problems?
  * crappy tree printout
  * not printing other tables
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/3] fib_trie: move statistics to debugfs

2008-02-17 Thread David Miller
From: Stephen Hemminger <[EMAIL PROTECTED]>
Date: Wed, 13 Feb 2008 11:58:06 -0800

> Don't want /proc/net/fib_trie and /proc/net/fib_triestat to become
> permanent kernel space ABI issues, so move to the safer confines of debugfs.
> 
> Signed-off-by: Stephen Hemminger <[EMAIL PROTECTED]>

Stephen, the cat is already out of the bag.  We already export this
thing so if you want to export different stuff you'll have to provide
it via some other means, somewhere else.

Thanks.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/3] fib_trie: move statistics to debugfs

2008-02-13 Thread Stephen Hemminger
Don't want /proc/net/fib_trie and /proc/net/fib_triestat to become
permanent kernel space ABI issues, so move to the safer confines of debugfs.

Signed-off-by: Stephen Hemminger <[EMAIL PROTECTED]>

---
 net/ipv4/Kconfig|9 ++-
 net/ipv4/fib_trie.c |  127 +---
 2 files changed, 86 insertions(+), 50 deletions(-)

--- a/net/ipv4/Kconfig  2008-02-13 10:58:51.0 -0800
+++ b/net/ipv4/Kconfig  2008-02-13 10:59:06.0 -0800
@@ -85,11 +85,12 @@ 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
+config IP_FIB_TRIE_DEBUG
+   bool "FIB TRIE debugging information"
+   depends on IP_FIB_TRIE && DEBUG_FS
---help---
- Keep track of statistics on structure of FIB TRIE table.
+ Provides interface for looking at internal structure, and
+ statistics on for the  FIB TRIE table.
  Useful for testing and measuring TRIE performance.
 
 config IP_MULTIPLE_TABLES
--- a/net/ipv4/fib_trie.c   2008-02-13 10:58:51.0 -0800
+++ b/net/ipv4/fib_trie.c   2008-02-13 11:33:43.0 -0800
@@ -68,6 +68,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -126,7 +127,8 @@ struct tnode {
struct node *child[0];
 };
 
-#ifdef CONFIG_IP_FIB_TRIE_STATS
+#ifdef CONFIG_IP_FIB_TRIE_DEBUG
+
 struct trie_use_stats {
unsigned int gets;
unsigned int backtrack;
@@ -135,7 +137,6 @@ struct trie_use_stats {
unsigned int null_node_hit;
unsigned int resize_node_skipped;
 };
-#endif
 
 struct trie_stat {
unsigned int totdepth;
@@ -146,10 +147,11 @@ struct trie_stat {
unsigned int prefixes;
unsigned int nodesizes[MAX_STAT_DEPTH];
 };
+#endif
 
 struct trie {
struct node *trie;
-#ifdef CONFIG_IP_FIB_TRIE_STATS
+#ifdef CONFIG_IP_FIB_TRIE_DEBUG
struct trie_use_stats stats;
 #endif
 };
@@ -588,7 +590,7 @@ static struct node *resize(struct trie *
 
if (IS_ERR(tn)) {
tn = old_tn;
-#ifdef CONFIG_IP_FIB_TRIE_STATS
+#ifdef CONFIG_IP_FIB_TRIE_DEBUG
t->stats.resize_node_skipped++;
 #endif
break;
@@ -631,7 +633,7 @@ static struct node *resize(struct trie *
tn = halve(t, tn);
if (IS_ERR(tn)) {
tn = old_tn;
-#ifdef CONFIG_IP_FIB_TRIE_STATS
+#ifdef CONFIG_IP_FIB_TRIE_DEBUG
t->stats.resize_node_skipped++;
 #endif
break;
@@ -1341,7 +1343,7 @@ static int check_leaf(struct trie *t, st
err = fib_semantic_match(&li->falh, flp, res,
 htonl(l->key), mask, plen);
 
-#ifdef CONFIG_IP_FIB_TRIE_STATS
+#ifdef CONFIG_IP_FIB_TRIE_DEBUG
if (err <= 0)
t->stats.semantic_match_passed++;
else
@@ -1376,7 +1378,7 @@ static int fn_trie_lookup(struct fib_tab
if (!n)
goto failed;
 
-#ifdef CONFIG_IP_FIB_TRIE_STATS
+#ifdef CONFIG_IP_FIB_TRIE_DEBUG
t->stats.gets++;
 #endif
 
@@ -1403,7 +1405,7 @@ static int fn_trie_lookup(struct fib_tab
n = tnode_get_child(pn, cindex);
 
if (n == NULL) {
-#ifdef CONFIG_IP_FIB_TRIE_STATS
+#ifdef CONFIG_IP_FIB_TRIE_DEBUG
t->stats.null_node_hit++;
 #endif
goto backtrace;
@@ -1546,7 +1548,7 @@ backtrace:
pn = parent;
chopped_off = 0;
 
-#ifdef CONFIG_IP_FIB_TRIE_STATS
+#ifdef CONFIG_IP_FIB_TRIE_DEBUG
t->stats.backtrack++;
 #endif
goto backtrace;
@@ -2022,7 +2024,8 @@ struct fib_table *fib_hash_table(u32 id)
return tb;
 }
 
-#ifdef CONFIG_PROC_FS
+#ifdef CONFIG_IP_FIB_TRIE_DEBUG
+
 /* Depth first Trie walk iterator */
 struct fib_trie_iter {
struct seq_net_private p;
@@ -2147,7 +2150,7 @@ static void trie_collect_stats(struct tr
 }
 
 /*
- * This outputs /proc/net/fib_triestats
+ * This outputs debugfs/fib/triestats
  */
 static void trie_show_stats(struct seq_file *seq, struct trie_stat *stat)
 {
@@ -2189,7 +2192,6 @@ static void trie_show_stats(struct seq_f
seq_printf(seq, "Total size: %u  kB\n", (bytes + 1023) / 1024);
 }
 
-#ifdef CONFIG_IP_FIB_TRIE_STATS
 static void trie_show_usage(struct seq_file *seq,
const struct trie_use_stats *stats)
 {
@@ -2204,7 +2206,7 @@ static void trie_show_usage(struct seq_f
seq_printf(seq, "skipped node resize = %u\n\n",
   stats->resize_node_skipped);
 }
-#endif /*  CONFIG_IP_FIB_TRIE_STATS */
+
 
 static void fib_trie_show(struct seq_file *seq, const char *name,
  struct trie *trie)
@@ -2214,9 +2216,7 @@ static void fib_trie_show(struct seq_fil
trie_col