From: Maciej Gajdzica Date: Fri, 19 Jun 2015 10:28:34 +0000 (+0200) Subject: table: add stats structure and config option X-Git-Tag: spdx-start~8987 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=d517a160720f73229a018c69d5c7a4aee16fa47e;p=dpdk.git table: add stats structure and config option Added common structure for table statistics. Added config option to enable table stats collecting. Signed-off-by: Maciej Gajdzica Acked-by: Cristian Dumitrescu --- diff --git a/config/common_bsdapp b/config/common_bsdapp index bbe95a7caf..3ed884f73f 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 01ab5b3d9a..f859d07e86 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 6e51fe6865..c13d40d0e2 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