[dpdk-dev] [PATCH v5 01/11] table: added structure for storing table stats and config option
Maciej Gajdzica
maciejx.t.gajdzica at intel.com
Fri Jun 19 12:28:34 CEST 2015
Added common structure for table statistics. Added config option to
enable table stats collecting.
Signed-off-by: Maciej Gajdzica <maciejx.t.gajdzica at intel.com>
---
config/common_bsdapp | 1 +
config/common_linuxapp | 1 +
lib/librte_table/rte_table.h | 25 +++++++++++++++++++++++++
3 files changed, 27 insertions(+)
diff --git a/config/common_bsdapp b/config/common_bsdapp
index c5036a4..1fc3a7c 100644
--- a/config/common_bsdapp
+++ b/config/common_bsdapp
@@ -389,6 +389,7 @@ CONFIG_RTE_PORT_STATS_COLLECT=n
# Compile librte_table
#
CONFIG_RTE_LIBRTE_TABLE=y
+CONFIG_RTE_TABLE_STATS_COLLECT=n
#
# Compile librte_pipeline
diff --git a/config/common_linuxapp b/config/common_linuxapp
index 1fc5176..31b46f1 100644
--- a/config/common_linuxapp
+++ b/config/common_linuxapp
@@ -396,6 +396,7 @@ CONFIG_RTE_PORT_STATS_COLLECT=n
# Compile librte_table
#
CONFIG_RTE_LIBRTE_TABLE=y
+CONFIG_RTE_TABLE_STATS_COLLECT=n
#
# Compile librte_pipeline
diff --git a/lib/librte_table/rte_table.h b/lib/librte_table/rte_table.h
index 6e51fe6..c13d40d 100644
--- a/lib/librte_table/rte_table.h
+++ b/lib/librte_table/rte_table.h
@@ -59,6 +59,12 @@ extern "C" {
struct rte_mbuf;
+/** Lookup table statistics */
+struct rte_table_stats {
+ uint64_t n_pkts_in;
+ uint64_t n_pkts_lookup_miss;
+};
+
/**
* Lookup table create
*
@@ -187,6 +193,24 @@ typedef int (*rte_table_op_lookup)(
uint64_t *lookup_hit_mask,
void **entries);
+/**
+ * Lookup table stats read
+ *
+ * @param table
+ * Handle to lookup table instance
+ * @param stats
+ * Handle to table stats struct to copy data
+ * @param clear
+ * Flag indicating that stats should be cleared after read
+ *
+ * @return
+ * Error code or 0 on success.
+ */
+typedef int (*rte_table_op_stats_read)(
+ void *table,
+ struct rte_table_stats *stats,
+ int clear);
+
/** Lookup table interface defining the lookup table operation */
struct rte_table_ops {
rte_table_op_create f_create; /**< Create */
@@ -194,6 +218,7 @@ struct rte_table_ops {
rte_table_op_entry_add f_add; /**< Entry add */
rte_table_op_entry_delete f_delete; /**< Entry delete */
rte_table_op_lookup f_lookup; /**< Lookup */
+ rte_table_op_stats_read f_stats; /**< Stats */
};
#ifdef __cplusplus
--
1.7.9.5
More information about the dev
mailing list