Skip to contentSkip to conversation

gnet_stats: kernel-api doc for gnet stats/estimator

PATCH Applied Thomas Graf 2 participants 2 messages Nov 30, 2004 – Dec 1, 2004

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gnet_stats: kernel-api doc for gnet stats/estimator

kernel-api documentation for gnet stats/estimator

Documentation/DocBook/kernel-api.tmpl +5 -0
diff -Nru linux-2.6.10-rc2-bk13.orig/Documentation/DocBook/kernel-api.tmpl linux-2.6.10-rc2-bk13/Documentation/DocBook/kernel-api.tmpl
@@ -133,6 +133,11 @@
      <sect1><title>Socket Filter</title>
 !Enet/core/filter.c
      </sect1>
+     <sect1><title>Generic Network Statistics</title>
+!Iinclude/linux/gen_stats.h
+!Enet/core/gen_stats.c
+!Enet/core/gen_estimator.c
+     </sect1>
   </chapter>
 
   <chapter id="netdev">
include/linux/gen_stats.h +5 -0
diff -Nru linux-2.6.10-rc2-bk13.orig/include/linux/gen_stats.h linux-2.6.10-rc2-bk13/include/linux/gen_stats.h
@@ -14,6 +14,7 @@
 #define TCA_STATS_MAX (__TCA_STATS_MAX - 1)
 
 /**
+ * struct gnet_stats_basic - byte/packet throughput statistics
  * @bytes: number of seen bytes
  * @packets: number of seen packets
  */
@@ -24,6 +25,7 @@
 };
 
 /**
+ * struct gnet_stats_rate_est - rate estimator
  * @bps: current byte rate
  * @pps: current packet rate
  */
@@ -34,10 +36,12 @@
 };
 
 /**
+ * struct gnet_stats_queue - queuing statistics
  * @qlen: queue length
  * @backlog: backlog size of queue
  * @drops: number of dropped packets
  * @requeues: number of requeues
+ * @overlimits: number of enqueues over the limit
  */
 struct gnet_stats_queue
 {
@@ -49,6 +53,7 @@
 };
 
 /**
+ * struct gnet_estimator - rate estimator configuration
  * @interval: sampling period
  * @ewma_log: the log of measurement window weight
  */
net/core/gen_estimator.c +35 -0
diff -Nru linux-2.6.10-rc2-bk13.orig/net/core/gen_estimator.c linux-2.6.10-rc2-bk13/net/core/gen_estimator.c
@@ -132,6 +132,21 @@
 	read_unlock(&est_lock);
 }
 
+/**
+ * gen_new_estimator - create a new rate estimator
+ * @bstats: basic statistics
+ * @rate_est: rate estimator statistics
+ * @stats_lock: statistics lock
+ * @opt: rate estimator configuration TLV
+ *
+ * Creates a new rate estimator with &bstats as source and &rate_est
+ * as destination. A new timer with the interval specified in the
+ * configuration TLV is created. Upon each interval, the latest statistics
+ * will be read from &bstats and the estimated rate will be stored in
+ * &rate_est with the statistics lock grabed during this period.
+ * 
+ * Returns 0 on success or a negative error code.
+ */
 int gen_new_estimator(struct gnet_stats_basic *bstats,
 	struct gnet_stats_rate_est *rate_est, spinlock_t *stats_lock, struct rtattr *opt)
 {
@@ -173,6 +188,14 @@
 	return 0;
 }
 
+/**
+ * gen_kill_estimator - remove a rate estimator
+ * @bstats: basic statistics
+ * @rate_est: rate estimator statistics
+ *
+ * Removes the rate estimator specified by &bstats and &rate_est
+ * and deletes the timer.
+ */
 void gen_kill_estimator(struct gnet_stats_basic *bstats,
 	struct gnet_stats_rate_est *rate_est)
 {
@@ -200,6 +223,18 @@
 	}
 }
 
+/**
+ * gen_replace_estimator - replace rate estimator configruation
+ * @bstats: basic statistics
+ * @rate_est: rate estimator statistics
+ * @stats_lock: statistics lock
+ * @opt: rate estimator configuration TLV
+ *
+ * Replaces the configuration of a rate estimator by calling
+ * gen_kill_estimator() and gen_new_estimator().
+ * 
+ * Returns 0 on success or a negative error code.
+ */
 int
 gen_replace_estimator(struct gnet_stats_basic *bstats,
 	struct gnet_stats_rate_est *rate_est, spinlock_t *stats_lock,
net/core/gen_stats.c +89 -1

132 lines not on this page · raw message