* [dpdk-dev] [PATCH v2 00/10] table: added table statistics
@ 2015-04-30 12:14 Michal Jastrzebski
2015-04-30 12:14 ` [dpdk-dev] [PATCH v2 01/10] table: added structure for storing table stats Michal Jastrzebski
` (10 more replies)
0 siblings, 11 replies; 14+ messages in thread
From: Michal Jastrzebski @ 2015-04-30 12:14 UTC (permalink / raw)
To: dev
From: Maciej Gajdzica <maciejx.t.gajdzica@intel.com>
Added statistics for every type of table. By default all table statistics
are disabled, user must activate them in config file.
Maciej Gajdzica (10):
table: added structure for storing table stats
table: added acl table stats
table: added array table stats
table: added hash_ext table stats
table: added hash_key16 table stats
table: added hash_key32 table stats
table: added hash_key8 table stats
table: added hash_lru table stats
table: added lpm_ipv6 table stats
table: added lpm table stats
config/common_bsdapp | 9 ++++++
config/common_linuxapp | 9 ++++++
lib/librte_table/rte_table.h | 25 +++++++++++++++
lib/librte_table/rte_table_acl.c | 35 +++++++++++++++++++++
lib/librte_table/rte_table_array.c | 34 +++++++++++++++++++-
lib/librte_table/rte_table_hash_ext.c | 44 ++++++++++++++++++++++++++
lib/librte_table/rte_table_hash_key16.c | 41 ++++++++++++++++++++++++
lib/librte_table/rte_table_hash_key32.c | 41 ++++++++++++++++++++++++
lib/librte_table/rte_table_hash_key8.c | 52 +++++++++++++++++++++++++++++++
lib/librte_table/rte_table_hash_lru.c | 44 ++++++++++++++++++++++++++
lib/librte_table/rte_table_lpm.c | 34 ++++++++++++++++++++
lib/librte_table/rte_table_lpm_ipv6.c | 34 ++++++++++++++++++++
12 files changed, 401 insertions(+), 1 deletion(-)
--
1.7.9.5
^ permalink raw reply [flat|nested] 14+ messages in thread
* [dpdk-dev] [PATCH v2 01/10] table: added structure for storing table stats
2015-04-30 12:14 [dpdk-dev] [PATCH v2 00/10] table: added table statistics Michal Jastrzebski
@ 2015-04-30 12:14 ` Michal Jastrzebski
2015-04-30 12:14 ` [dpdk-dev] [PATCH v2 02/10] table: added acl " Michal Jastrzebski
` (9 subsequent siblings)
10 siblings, 0 replies; 14+ messages in thread
From: Michal Jastrzebski @ 2015-04-30 12:14 UTC (permalink / raw)
To: dev
From: Maciej Gajdzica <maciejx.t.gajdzica@intel.com>
Added common structure for table statistics.
Signed-off-by: Maciej Gajdzica <maciejx.t.gajdzica@intel.com>
---
lib/librte_table/rte_table.h | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
diff --git a/lib/librte_table/rte_table.h b/lib/librte_table/rte_table.h
index d57bc33..9860b7b 100644
--- a/lib/librte_table/rte_table.h
+++ b/lib/librte_table/rte_table.h
@@ -58,6 +58,12 @@ extern "C" {
#include <rte_mbuf.h>
#include <rte_port.h>
+/** Lookup table statistics */
+struct rte_table_stats {
+ uint64_t n_pkts_in;
+ uint64_t n_pkts_lookup_miss;
+};
+
/**
* Lookup table create
*
@@ -186,6 +192,24 @@ typedef int (*rte_table_op_lookup)(
uint64_t *lookup_hit_mask,
void **entries);
+/**
+ * Lookup table stats read
+ *
+ * @param port
+ * 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 */
@@ -193,6 +217,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
^ permalink raw reply [flat|nested] 14+ messages in thread
* [dpdk-dev] [PATCH v2 02/10] table: added acl table stats
2015-04-30 12:14 [dpdk-dev] [PATCH v2 00/10] table: added table statistics Michal Jastrzebski
2015-04-30 12:14 ` [dpdk-dev] [PATCH v2 01/10] table: added structure for storing table stats Michal Jastrzebski
@ 2015-04-30 12:14 ` Michal Jastrzebski
2015-04-30 15:55 ` Stephen Hemminger
2015-04-30 12:14 ` [dpdk-dev] [PATCH v2 03/10] table: added array " Michal Jastrzebski
` (8 subsequent siblings)
10 siblings, 1 reply; 14+ messages in thread
From: Michal Jastrzebski @ 2015-04-30 12:14 UTC (permalink / raw)
To: dev
From: Maciej Gajdzica <maciejx.t.gajdzica@intel.com>
Added statistics for ACL table.
Signed-off-by: Maciej Gajdzica <maciejx.t.gajdzica@intel.com>
---
config/common_bsdapp | 1 +
config/common_linuxapp | 1 +
lib/librte_table/rte_table_acl.c | 35 +++++++++++++++++++++++++++++++++++
3 files changed, 37 insertions(+)
diff --git a/config/common_bsdapp b/config/common_bsdapp
index 238d178..096e09c 100644
--- a/config/common_bsdapp
+++ b/config/common_bsdapp
@@ -400,6 +400,7 @@ CONFIG_RTE_PORT_SINK_STATS_COLLECT=n
# Compile librte_table
#
CONFIG_RTE_LIBRTE_TABLE=y
+CONFIG_RTE_TABLE_ACL_STATS_COLLECT=n
#
# Compile librte_pipeline
diff --git a/config/common_linuxapp b/config/common_linuxapp
index 36a623d..d930808 100644
--- a/config/common_linuxapp
+++ b/config/common_linuxapp
@@ -407,6 +407,7 @@ CONFIG_RTE_PORT_SINK_STATS_COLLECT=n
# Compile librte_table
#
CONFIG_RTE_LIBRTE_TABLE=y
+CONFIG_RTE_TABLE_ACL_STATS_COLLECT=n
#
# Compile librte_pipeline
diff --git a/lib/librte_table/rte_table_acl.c b/lib/librte_table/rte_table_acl.c
index 4416311..194316d 100644
--- a/lib/librte_table/rte_table_acl.c
+++ b/lib/librte_table/rte_table_acl.c
@@ -43,7 +43,23 @@
#include "rte_table_acl.h"
#include <rte_ether.h>
+#ifdef RTE_TABLE_ACL_STATS_COLLECT
+
+#define RTE_TABLE_ACL_STATS_PKTS_IN_ADD(table, val) \
+ table->stats.n_pkts_in += val
+#define RTE_TABLE_ACL_STATS_PKTS_LOOKUP_MISS(table, val) \
+ table->stats.n_pkts_lookup_miss += val
+
+#else
+
+#define RTE_TABLE_ACL_STATS_PKTS_IN_ADD(table, val)
+#define RTE_TABLE_ACL_STATS_PKTS_LOOKUP_MISS(table, val)
+
+#endif
+
struct rte_table_acl {
+ struct rte_table_stats stats;
+
/* Low-level ACL table */
char name[2][RTE_ACL_NAMESIZE];
struct rte_acl_param acl_params; /* for creating low level acl table */
@@ -441,6 +457,9 @@ rte_table_acl_lookup(
uint64_t pkts_out_mask;
uint32_t n_pkts, i, j;
+ __rte_unused uint32_t n_pkts_in = __builtin_popcountll(pkts_mask);
+ RTE_TABLE_ACL_STATS_PKTS_IN_ADD(acl, n_pkts_in);
+
/* Input conversion */
for (i = 0, j = 0; i < (uint32_t)(RTE_PORT_IN_BURST_SIZE_MAX -
__builtin_clzll(pkts_mask)); i++) {
@@ -478,6 +497,21 @@ rte_table_acl_lookup(
}
*lookup_hit_mask = pkts_out_mask;
+ RTE_TABLE_ACL_STATS_PKTS_LOOKUP_MISS(acl, n_pkts_in - __builtin_popcountll(pkts_out_mask));
+
+ return 0;
+}
+
+static int
+rte_table_acl_stats_read(void *table, struct rte_table_stats *stats, int clear)
+{
+ struct rte_table_acl *acl = (struct rte_table_acl *) table;
+
+ if (stats != NULL)
+ memcpy(stats, &acl->stats, sizeof(acl->stats));
+
+ if (clear)
+ memset(&acl->stats, 0, sizeof(acl->stats));
return 0;
}
@@ -488,4 +522,5 @@ struct rte_table_ops rte_table_acl_ops = {
.f_add = rte_table_acl_entry_add,
.f_delete = rte_table_acl_entry_delete,
.f_lookup = rte_table_acl_lookup,
+ .f_stats = rte_table_acl_stats_read,
};
--
1.7.9.5
^ permalink raw reply [flat|nested] 14+ messages in thread
* [dpdk-dev] [PATCH v2 03/10] table: added array table stats
2015-04-30 12:14 [dpdk-dev] [PATCH v2 00/10] table: added table statistics Michal Jastrzebski
2015-04-30 12:14 ` [dpdk-dev] [PATCH v2 01/10] table: added structure for storing table stats Michal Jastrzebski
2015-04-30 12:14 ` [dpdk-dev] [PATCH v2 02/10] table: added acl " Michal Jastrzebski
@ 2015-04-30 12:14 ` Michal Jastrzebski
2015-04-30 12:14 ` [dpdk-dev] [PATCH v2 04/10] table: added hash_ext " Michal Jastrzebski
` (7 subsequent siblings)
10 siblings, 0 replies; 14+ messages in thread
From: Michal Jastrzebski @ 2015-04-30 12:14 UTC (permalink / raw)
To: dev
From: Maciej Gajdzica <maciejx.t.gajdzica@intel.com>
Added statistics for array table.
Signed-off-by: Maciej Gajdzica <maciejx.t.gajdzica@intel.com>
---
config/common_bsdapp | 1 +
config/common_linuxapp | 1 +
lib/librte_table/rte_table_array.c | 34 +++++++++++++++++++++++++++++++++-
3 files changed, 35 insertions(+), 1 deletion(-)
diff --git a/config/common_bsdapp b/config/common_bsdapp
index 096e09c..e31fba7 100644
--- a/config/common_bsdapp
+++ b/config/common_bsdapp
@@ -401,6 +401,7 @@ CONFIG_RTE_PORT_SINK_STATS_COLLECT=n
#
CONFIG_RTE_LIBRTE_TABLE=y
CONFIG_RTE_TABLE_ACL_STATS_COLLECT=n
+CONFIG_RTE_TABLE_ARRAY_STATS_COLLECT=n
#
# Compile librte_pipeline
diff --git a/config/common_linuxapp b/config/common_linuxapp
index d930808..6a6e33e 100644
--- a/config/common_linuxapp
+++ b/config/common_linuxapp
@@ -408,6 +408,7 @@ CONFIG_RTE_PORT_SINK_STATS_COLLECT=n
#
CONFIG_RTE_LIBRTE_TABLE=y
CONFIG_RTE_TABLE_ACL_STATS_COLLECT=n
+CONFIG_RTE_TABLE_ARRAY_STATS_COLLECT=n
#
# Compile librte_pipeline
diff --git a/lib/librte_table/rte_table_array.c b/lib/librte_table/rte_table_array.c
index c031070..3f25fa6 100644
--- a/lib/librte_table/rte_table_array.c
+++ b/lib/librte_table/rte_table_array.c
@@ -42,7 +42,23 @@
#include "rte_table_array.h"
+#ifdef RTE_TABLE_ARRAY_STATS_COLLECT
+
+#define RTE_TABLE_ARRAY_STATS_PKTS_IN_ADD(table, val) \
+ table->stats.n_pkts_in += val
+#define RTE_TABLE_ARRAY_STATS_PKTS_LOOKUP_MISS(table, val) \
+ table->stats.n_pkts_lookup_miss += val
+
+#else
+
+#define RTE_TABLE_ARRAY_STATS_PKTS_IN_ADD(table, val)
+#define RTE_TABLE_ARRAY_STATS_PKTS_LOOKUP_MISS(table, val)
+
+#endif
+
struct rte_table_array {
+ struct rte_table_stats stats;
+
/* Input parameters */
uint32_t entry_size;
uint32_t n_entries;
@@ -164,7 +180,8 @@ rte_table_array_lookup(
void **entries)
{
struct rte_table_array *t = (struct rte_table_array *) table;
-
+ __rte_unused uint32_t n_pkts_in = __builtin_popcountll(pkts_mask);
+ RTE_TABLE_ARRAY_STATS_PKTS_IN_ADD(t, n_pkts_in);
*lookup_hit_mask = pkts_mask;
if ((pkts_mask & (pkts_mask + 1)) == 0) {
@@ -196,10 +213,25 @@ rte_table_array_lookup(
return 0;
}
+static int
+rte_table_array_stats_read(void *table, struct rte_table_stats *stats, int clear)
+{
+ struct rte_table_array *array = (struct rte_table_array *) table;
+
+ if (stats != NULL)
+ memcpy(stats, &array->stats, sizeof(array->stats));
+
+ if (clear)
+ memset(&array->stats, 0, sizeof(array->stats));
+
+ return 0;
+}
+
struct rte_table_ops rte_table_array_ops = {
.f_create = rte_table_array_create,
.f_free = rte_table_array_free,
.f_add = rte_table_array_entry_add,
.f_delete = NULL,
.f_lookup = rte_table_array_lookup,
+ .f_stats = rte_table_array_stats_read,
};
--
1.7.9.5
^ permalink raw reply [flat|nested] 14+ messages in thread
* [dpdk-dev] [PATCH v2 04/10] table: added hash_ext table stats
2015-04-30 12:14 [dpdk-dev] [PATCH v2 00/10] table: added table statistics Michal Jastrzebski
` (2 preceding siblings ...)
2015-04-30 12:14 ` [dpdk-dev] [PATCH v2 03/10] table: added array " Michal Jastrzebski
@ 2015-04-30 12:14 ` Michal Jastrzebski
2015-04-30 12:14 ` [dpdk-dev] [PATCH v2 05/10] table: added hash_key16 " Michal Jastrzebski
` (6 subsequent siblings)
10 siblings, 0 replies; 14+ messages in thread
From: Michal Jastrzebski @ 2015-04-30 12:14 UTC (permalink / raw)
To: dev
From: Maciej Gajdzica <maciejx.t.gajdzica@intel.com>
Added statistics for hash ext table.
Signed-off-by: Maciej Gajdzica <maciejx.t.gajdzica@intel.com>
---
config/common_bsdapp | 1 +
config/common_linuxapp | 1 +
lib/librte_table/rte_table_hash_ext.c | 44 +++++++++++++++++++++++++++++++++
3 files changed, 46 insertions(+)
diff --git a/config/common_bsdapp b/config/common_bsdapp
index e31fba7..ba8598f 100644
--- a/config/common_bsdapp
+++ b/config/common_bsdapp
@@ -402,6 +402,7 @@ CONFIG_RTE_PORT_SINK_STATS_COLLECT=n
CONFIG_RTE_LIBRTE_TABLE=y
CONFIG_RTE_TABLE_ACL_STATS_COLLECT=n
CONFIG_RTE_TABLE_ARRAY_STATS_COLLECT=n
+CONFIG_RTE_TABLE_HASH_EXT_STATS_COLLECT=n
#
# Compile librte_pipeline
diff --git a/config/common_linuxapp b/config/common_linuxapp
index 6a6e33e..4a41a24 100644
--- a/config/common_linuxapp
+++ b/config/common_linuxapp
@@ -409,6 +409,7 @@ CONFIG_RTE_PORT_SINK_STATS_COLLECT=n
CONFIG_RTE_LIBRTE_TABLE=y
CONFIG_RTE_TABLE_ACL_STATS_COLLECT=n
CONFIG_RTE_TABLE_ARRAY_STATS_COLLECT=n
+CONFIG_RTE_TABLE_HASH_EXT_STATS_COLLECT=n
#
# Compile librte_pipeline
diff --git a/lib/librte_table/rte_table_hash_ext.c b/lib/librte_table/rte_table_hash_ext.c
index 66e416b..d9ff97b 100644
--- a/lib/librte_table/rte_table_hash_ext.c
+++ b/lib/librte_table/rte_table_hash_ext.c
@@ -74,6 +74,20 @@ do \
(bucket)->next = (bucket2)->next; \
while (0)
+#ifdef RTE_TABLE_HASH_EXT_STATS_COLLECT
+
+#define RTE_TABLE_HASH_EXT_STATS_PKTS_IN_ADD(table, val) \
+ table->stats.n_pkts_in += val
+#define RTE_TABLE_HASH_EXT_STATS_PKTS_LOOKUP_MISS(table, val) \
+ table->stats.n_pkts_lookup_miss += val
+
+#else
+
+#define RTE_TABLE_HASH_EXT_STATS_PKTS_IN_ADD(table, val)
+#define RTE_TABLE_HASH_EXT_STATS_PKTS_LOOKUP_MISS(table, val)
+
+#endif
+
struct grinder {
struct bucket *bkt;
uint64_t sig;
@@ -82,6 +96,8 @@ struct grinder {
};
struct rte_table_hash {
+ struct rte_table_stats stats;
+
/* Input parameters */
uint32_t key_size;
uint32_t entry_size;
@@ -440,6 +456,9 @@ static int rte_table_hash_ext_lookup_unoptimized(
struct rte_table_hash *t = (struct rte_table_hash *) table;
uint64_t pkts_mask_out = 0;
+ __rte_unused uint32_t n_pkts_in = __builtin_popcountll(pkts_mask);
+ RTE_TABLE_HASH_EXT_STATS_PKTS_IN_ADD(t, n_pkts_in);
+
for ( ; pkts_mask; ) {
struct bucket *bkt0, *bkt;
struct rte_mbuf *pkt;
@@ -484,6 +503,7 @@ static int rte_table_hash_ext_lookup_unoptimized(
}
*lookup_hit_mask = pkts_mask_out;
+ RTE_TABLE_HASH_EXT_STATS_PKTS_LOOKUP_MISS(t, n_pkts_in - __builtin_popcountll(pkts_mask_out));
return 0;
}
@@ -861,6 +881,9 @@ static int rte_table_hash_ext_lookup(
uint64_t pkts_mask_out = 0, pkts_mask_match_many = 0;
int status = 0;
+ __rte_unused uint32_t n_pkts_in = __builtin_popcountll(pkts_mask);
+ RTE_TABLE_HASH_EXT_STATS_PKTS_IN_ADD(t, n_pkts_in);
+
/* Cannot run the pipeline with less than 7 packets */
if (__builtin_popcountll(pkts_mask) < 7)
return rte_table_hash_ext_lookup_unoptimized(table, pkts,
@@ -973,6 +996,7 @@ static int rte_table_hash_ext_lookup(
}
*lookup_hit_mask = pkts_mask_out;
+ RTE_TABLE_HASH_EXT_STATS_PKTS_LOOKUP_MISS(t, n_pkts_in - __builtin_popcountll(pkts_mask_out));
return status;
}
@@ -990,6 +1014,9 @@ static int rte_table_hash_ext_lookup_dosig(
uint64_t pkts_mask_out = 0, pkts_mask_match_many = 0;
int status = 0;
+ __rte_unused uint32_t n_pkts_in = __builtin_popcountll(pkts_mask);
+ RTE_TABLE_HASH_EXT_STATS_PKTS_IN_ADD(t, n_pkts_in);
+
/* Cannot run the pipeline with less than 7 packets */
if (__builtin_popcountll(pkts_mask) < 7)
return rte_table_hash_ext_lookup_unoptimized(table, pkts,
@@ -1102,15 +1129,31 @@ static int rte_table_hash_ext_lookup_dosig(
}
*lookup_hit_mask = pkts_mask_out;
+ RTE_TABLE_HASH_EXT_STATS_PKTS_LOOKUP_MISS(t, n_pkts_in - __builtin_popcountll(pkts_mask_out));
return status;
}
+static int
+rte_table_hash_ext_stats_read(void *table, struct rte_table_stats *stats, int clear)
+{
+ struct rte_table_hash *t = (struct rte_table_hash *) table;
+
+ if (stats != NULL)
+ memcpy(stats, &t->stats, sizeof(t->stats));
+
+ if (clear)
+ memset(&t->stats, 0, sizeof(t->stats));
+
+ return 0;
+}
+
struct rte_table_ops rte_table_hash_ext_ops = {
.f_create = rte_table_hash_ext_create,
.f_free = rte_table_hash_ext_free,
.f_add = rte_table_hash_ext_entry_add,
.f_delete = rte_table_hash_ext_entry_delete,
.f_lookup = rte_table_hash_ext_lookup,
+ .f_stats = rte_table_hash_ext_stats_read,
};
struct rte_table_ops rte_table_hash_ext_dosig_ops = {
@@ -1119,4 +1162,5 @@ struct rte_table_ops rte_table_hash_ext_dosig_ops = {
.f_add = rte_table_hash_ext_entry_add,
.f_delete = rte_table_hash_ext_entry_delete,
.f_lookup = rte_table_hash_ext_lookup_dosig,
+ .f_stats = rte_table_hash_ext_stats_read,
};
--
1.7.9.5
^ permalink raw reply [flat|nested] 14+ messages in thread
* [dpdk-dev] [PATCH v2 05/10] table: added hash_key16 table stats
2015-04-30 12:14 [dpdk-dev] [PATCH v2 00/10] table: added table statistics Michal Jastrzebski
` (3 preceding siblings ...)
2015-04-30 12:14 ` [dpdk-dev] [PATCH v2 04/10] table: added hash_ext " Michal Jastrzebski
@ 2015-04-30 12:14 ` Michal Jastrzebski
2015-04-30 12:14 ` [dpdk-dev] [PATCH v2 06/10] table: added hash_key32 " Michal Jastrzebski
` (5 subsequent siblings)
10 siblings, 0 replies; 14+ messages in thread
From: Michal Jastrzebski @ 2015-04-30 12:14 UTC (permalink / raw)
To: dev
From: Maciej Gajdzica <maciejx.t.gajdzica@intel.com>
Added statistics for hash key16 table.
Signed-off-by: Maciej Gajdzica <maciejx.t.gajdzica@intel.com>
---
config/common_bsdapp | 1 +
config/common_linuxapp | 1 +
lib/librte_table/rte_table_hash_key16.c | 41 +++++++++++++++++++++++++++++++
3 files changed, 43 insertions(+)
diff --git a/config/common_bsdapp b/config/common_bsdapp
index ba8598f..6ce6057 100644
--- a/config/common_bsdapp
+++ b/config/common_bsdapp
@@ -403,6 +403,7 @@ CONFIG_RTE_LIBRTE_TABLE=y
CONFIG_RTE_TABLE_ACL_STATS_COLLECT=n
CONFIG_RTE_TABLE_ARRAY_STATS_COLLECT=n
CONFIG_RTE_TABLE_HASH_EXT_STATS_COLLECT=n
+CONFIG_RTE_TABLE_HASH_KEY16_STATS_COLLECT=n
#
# Compile librte_pipeline
diff --git a/config/common_linuxapp b/config/common_linuxapp
index 4a41a24..9c3868a 100644
--- a/config/common_linuxapp
+++ b/config/common_linuxapp
@@ -410,6 +410,7 @@ CONFIG_RTE_LIBRTE_TABLE=y
CONFIG_RTE_TABLE_ACL_STATS_COLLECT=n
CONFIG_RTE_TABLE_ARRAY_STATS_COLLECT=n
CONFIG_RTE_TABLE_HASH_EXT_STATS_COLLECT=n
+CONFIG_RTE_TABLE_HASH_KEY16_STATS_COLLECT=n
#
# Compile librte_pipeline
diff --git a/lib/librte_table/rte_table_hash_key16.c b/lib/librte_table/rte_table_hash_key16.c
index f87ea0e..37dde0b 100644
--- a/lib/librte_table/rte_table_hash_key16.c
+++ b/lib/librte_table/rte_table_hash_key16.c
@@ -46,6 +46,20 @@
#define RTE_BUCKET_ENTRY_VALID 0x1LLU
+#ifdef RTE_TABLE_HASH_KEY16_STATS_COLLECT
+
+#define RTE_TABLE_HASH_KEY16_STATS_PKTS_IN_ADD(table, val) \
+ table->stats.n_pkts_in += val
+#define RTE_TABLE_HASH_KEY16_STATS_PKTS_LOOKUP_MISS(table, val) \
+ table->stats.n_pkts_lookup_miss += val
+
+#else
+
+#define RTE_TABLE_HASH_KEY16_STATS_PKTS_IN_ADD(table, val)
+#define RTE_TABLE_HASH_KEY16_STATS_PKTS_LOOKUP_MISS(table, val)
+
+#endif
+
struct rte_bucket_4_16 {
/* Cache line 0 */
uint64_t signature[4 + 1];
@@ -61,6 +75,8 @@ struct rte_bucket_4_16 {
};
struct rte_table_hash {
+ struct rte_table_stats stats;
+
/* Input parameters */
uint32_t n_buckets;
uint32_t n_entries_per_bucket;
@@ -831,6 +847,9 @@ rte_table_hash_lookup_key16_lru(
uint32_t pkt11_index, pkt20_index, pkt21_index;
uint64_t pkts_mask_out = 0;
+ __rte_unused uint32_t n_pkts_in = __builtin_popcountll(pkts_mask);
+ RTE_TABLE_HASH_KEY16_STATS_PKTS_IN_ADD(f, n_pkts_in);
+
/* Cannot run the pipeline with less than 5 packets */
if (__builtin_popcountll(pkts_mask) < 5) {
for ( ; pkts_mask; ) {
@@ -845,6 +864,7 @@ rte_table_hash_lookup_key16_lru(
}
*lookup_hit_mask = pkts_mask_out;
+ RTE_TABLE_HASH_KEY16_STATS_PKTS_LOOKUP_MISS(f, n_pkts_in - __builtin_popcountll(pkts_mask_out));
return 0;
}
@@ -934,6 +954,7 @@ rte_table_hash_lookup_key16_lru(
bucket20, bucket21, pkts_mask_out, entries, f);
*lookup_hit_mask = pkts_mask_out;
+ RTE_TABLE_HASH_KEY16_STATS_PKTS_LOOKUP_MISS(f, n_pkts_in - __builtin_popcountll(pkts_mask_out));
return 0;
} /* rte_table_hash_lookup_key16_lru() */
@@ -954,6 +975,9 @@ rte_table_hash_lookup_key16_ext(
struct rte_bucket_4_16 *buckets[RTE_PORT_IN_BURST_SIZE_MAX];
uint64_t *keys[RTE_PORT_IN_BURST_SIZE_MAX];
+ __rte_unused uint32_t n_pkts_in = __builtin_popcountll(pkts_mask);
+ RTE_TABLE_HASH_KEY16_STATS_PKTS_IN_ADD(f, n_pkts_in);
+
/* Cannot run the pipeline with less than 5 packets */
if (__builtin_popcountll(pkts_mask) < 5) {
for ( ; pkts_mask; ) {
@@ -1080,15 +1104,31 @@ grind_next_buckets:
}
*lookup_hit_mask = pkts_mask_out;
+ RTE_TABLE_HASH_KEY16_STATS_PKTS_LOOKUP_MISS(f, n_pkts_in - __builtin_popcountll(pkts_mask_out));
return 0;
} /* rte_table_hash_lookup_key16_ext() */
+static int
+rte_table_hash_key16_stats_read(void *table, struct rte_table_stats *stats, int clear)
+{
+ struct rte_table_hash *t = (struct rte_table_hash *) table;
+
+ if (stats != NULL)
+ memcpy(stats, &t->stats, sizeof(t->stats));
+
+ if (clear)
+ memset(&t->stats, 0, sizeof(t->stats));
+
+ return 0;
+}
+
struct rte_table_ops rte_table_hash_key16_lru_ops = {
.f_create = rte_table_hash_create_key16_lru,
.f_free = rte_table_hash_free_key16_lru,
.f_add = rte_table_hash_entry_add_key16_lru,
.f_delete = rte_table_hash_entry_delete_key16_lru,
.f_lookup = rte_table_hash_lookup_key16_lru,
+ .f_stats = rte_table_hash_key16_stats_read,
};
struct rte_table_ops rte_table_hash_key16_ext_ops = {
@@ -1097,4 +1137,5 @@ struct rte_table_ops rte_table_hash_key16_ext_ops = {
.f_add = rte_table_hash_entry_add_key16_ext,
.f_delete = rte_table_hash_entry_delete_key16_ext,
.f_lookup = rte_table_hash_lookup_key16_ext,
+ .f_stats = rte_table_hash_key16_stats_read,
};
--
1.7.9.5
^ permalink raw reply [flat|nested] 14+ messages in thread
* [dpdk-dev] [PATCH v2 06/10] table: added hash_key32 table stats
2015-04-30 12:14 [dpdk-dev] [PATCH v2 00/10] table: added table statistics Michal Jastrzebski
` (4 preceding siblings ...)
2015-04-30 12:14 ` [dpdk-dev] [PATCH v2 05/10] table: added hash_key16 " Michal Jastrzebski
@ 2015-04-30 12:14 ` Michal Jastrzebski
2015-04-30 12:14 ` [dpdk-dev] [PATCH v2 07/10] table: added hash_key8 " Michal Jastrzebski
` (4 subsequent siblings)
10 siblings, 0 replies; 14+ messages in thread
From: Michal Jastrzebski @ 2015-04-30 12:14 UTC (permalink / raw)
To: dev
From: Maciej Gajdzica <maciejx.t.gajdzica@intel.com>
Added statistics for hash key32 table.
Signed-off-by: Maciej Gajdzica <maciejx.t.gajdzica@intel.com>
---
config/common_bsdapp | 1 +
config/common_linuxapp | 1 +
lib/librte_table/rte_table_hash_key32.c | 41 +++++++++++++++++++++++++++++++
3 files changed, 43 insertions(+)
diff --git a/config/common_bsdapp b/config/common_bsdapp
index 6ce6057..23f8d15 100644
--- a/config/common_bsdapp
+++ b/config/common_bsdapp
@@ -404,6 +404,7 @@ CONFIG_RTE_TABLE_ACL_STATS_COLLECT=n
CONFIG_RTE_TABLE_ARRAY_STATS_COLLECT=n
CONFIG_RTE_TABLE_HASH_EXT_STATS_COLLECT=n
CONFIG_RTE_TABLE_HASH_KEY16_STATS_COLLECT=n
+CONFIG_RTE_TABLE_HASH_KEY32_STATS_COLLECT=n
#
# Compile librte_pipeline
diff --git a/config/common_linuxapp b/config/common_linuxapp
index 9c3868a..e4bd7bc 100644
--- a/config/common_linuxapp
+++ b/config/common_linuxapp
@@ -411,6 +411,7 @@ CONFIG_RTE_TABLE_ACL_STATS_COLLECT=n
CONFIG_RTE_TABLE_ARRAY_STATS_COLLECT=n
CONFIG_RTE_TABLE_HASH_EXT_STATS_COLLECT=n
CONFIG_RTE_TABLE_HASH_KEY16_STATS_COLLECT=n
+CONFIG_RTE_TABLE_HASH_KEY32_STATS_COLLECT=n
#
# Compile librte_pipeline
diff --git a/lib/librte_table/rte_table_hash_key32.c b/lib/librte_table/rte_table_hash_key32.c
index 6790594..2a8781a 100644
--- a/lib/librte_table/rte_table_hash_key32.c
+++ b/lib/librte_table/rte_table_hash_key32.c
@@ -46,6 +46,20 @@
#define RTE_BUCKET_ENTRY_VALID 0x1LLU
+#ifdef RTE_TABLE_HASH_KEY32_STATS_COLLECT
+
+#define RTE_TABLE_HASH_KEY32_STATS_PKTS_IN_ADD(table, val) \
+ table->stats.n_pkts_in += val
+#define RTE_TABLE_HASH_KEY32_STATS_PKTS_LOOKUP_MISS(table, val) \
+ table->stats.n_pkts_lookup_miss += val
+
+#else
+
+#define RTE_TABLE_HASH_KEY32_STATS_PKTS_IN_ADD(table, val)
+#define RTE_TABLE_HASH_KEY32_STATS_PKTS_LOOKUP_MISS(table, val)
+
+#endif
+
struct rte_bucket_4_32 {
/* Cache line 0 */
uint64_t signature[4 + 1];
@@ -61,6 +75,8 @@ struct rte_bucket_4_32 {
};
struct rte_table_hash {
+ struct rte_table_stats stats;
+
/* Input parameters */
uint32_t n_buckets;
uint32_t n_entries_per_bucket;
@@ -850,6 +866,9 @@ rte_table_hash_lookup_key32_lru(
uint32_t pkt11_index, pkt20_index, pkt21_index;
uint64_t pkts_mask_out = 0;
+ __rte_unused uint32_t n_pkts_in = __builtin_popcountll(pkts_mask);
+ RTE_TABLE_HASH_KEY32_STATS_PKTS_IN_ADD(f, n_pkts_in);
+
/* Cannot run the pipeline with less than 5 packets */
if (__builtin_popcountll(pkts_mask) < 5) {
for ( ; pkts_mask; ) {
@@ -864,6 +883,7 @@ rte_table_hash_lookup_key32_lru(
}
*lookup_hit_mask = pkts_mask_out;
+ RTE_TABLE_HASH_KEY32_STATS_PKTS_LOOKUP_MISS(f, n_pkts_in - __builtin_popcountll(pkts_mask_out));
return 0;
}
@@ -954,6 +974,7 @@ rte_table_hash_lookup_key32_lru(
mbuf20, mbuf21, bucket20, bucket21, pkts_mask_out, entries, f);
*lookup_hit_mask = pkts_mask_out;
+ RTE_TABLE_HASH_KEY32_STATS_PKTS_LOOKUP_MISS(f, n_pkts_in - __builtin_popcountll(pkts_mask_out));
return 0;
} /* rte_table_hash_lookup_key32_lru() */
@@ -974,6 +995,9 @@ rte_table_hash_lookup_key32_ext(
struct rte_bucket_4_32 *buckets[RTE_PORT_IN_BURST_SIZE_MAX];
uint64_t *keys[RTE_PORT_IN_BURST_SIZE_MAX];
+ __rte_unused uint32_t n_pkts_in = __builtin_popcountll(pkts_mask);
+ RTE_TABLE_HASH_KEY32_STATS_PKTS_IN_ADD(f, n_pkts_in);
+
/* Cannot run the pipeline with less than 5 packets */
if (__builtin_popcountll(pkts_mask) < 5) {
for ( ; pkts_mask; ) {
@@ -1100,15 +1124,31 @@ grind_next_buckets:
}
*lookup_hit_mask = pkts_mask_out;
+ RTE_TABLE_HASH_KEY32_STATS_PKTS_LOOKUP_MISS(f, n_pkts_in - __builtin_popcountll(pkts_mask_out));
return 0;
} /* rte_table_hash_lookup_key32_ext() */
+static int
+rte_table_hash_key32_stats_read(void *table, struct rte_table_stats *stats, int clear)
+{
+ struct rte_table_hash *t = (struct rte_table_hash *) table;
+
+ if (stats != NULL)
+ memcpy(stats, &t->stats, sizeof(t->stats));
+
+ if (clear)
+ memset(&t->stats, 0, sizeof(t->stats));
+
+ return 0;
+}
+
struct rte_table_ops rte_table_hash_key32_lru_ops = {
.f_create = rte_table_hash_create_key32_lru,
.f_free = rte_table_hash_free_key32_lru,
.f_add = rte_table_hash_entry_add_key32_lru,
.f_delete = rte_table_hash_entry_delete_key32_lru,
.f_lookup = rte_table_hash_lookup_key32_lru,
+ .f_stats = rte_table_hash_key32_stats_read,
};
struct rte_table_ops rte_table_hash_key32_ext_ops = {
@@ -1117,4 +1157,5 @@ struct rte_table_ops rte_table_hash_key32_ext_ops = {
.f_add = rte_table_hash_entry_add_key32_ext,
.f_delete = rte_table_hash_entry_delete_key32_ext,
.f_lookup = rte_table_hash_lookup_key32_ext,
+ .f_stats =rte_table_hash_key32_stats_read,
};
--
1.7.9.5
^ permalink raw reply [flat|nested] 14+ messages in thread
* [dpdk-dev] [PATCH v2 07/10] table: added hash_key8 table stats
2015-04-30 12:14 [dpdk-dev] [PATCH v2 00/10] table: added table statistics Michal Jastrzebski
` (5 preceding siblings ...)
2015-04-30 12:14 ` [dpdk-dev] [PATCH v2 06/10] table: added hash_key32 " Michal Jastrzebski
@ 2015-04-30 12:14 ` Michal Jastrzebski
2015-04-30 12:14 ` [dpdk-dev] [PATCH v2 08/10] table: added hash_lru " Michal Jastrzebski
` (3 subsequent siblings)
10 siblings, 0 replies; 14+ messages in thread
From: Michal Jastrzebski @ 2015-04-30 12:14 UTC (permalink / raw)
To: dev
From: Maciej Gajdzica <maciejx.t.gajdzica@intel.com>
Added statistics for hash key8 table.
Signed-off-by: Maciej Gajdzica <maciejx.t.gajdzica@intel.com>
---
config/common_bsdapp | 1 +
config/common_linuxapp | 1 +
lib/librte_table/rte_table_hash_key8.c | 52 ++++++++++++++++++++++++++++++++
3 files changed, 54 insertions(+)
diff --git a/config/common_bsdapp b/config/common_bsdapp
index 23f8d15..bb1bbd1 100644
--- a/config/common_bsdapp
+++ b/config/common_bsdapp
@@ -405,6 +405,7 @@ CONFIG_RTE_TABLE_ARRAY_STATS_COLLECT=n
CONFIG_RTE_TABLE_HASH_EXT_STATS_COLLECT=n
CONFIG_RTE_TABLE_HASH_KEY16_STATS_COLLECT=n
CONFIG_RTE_TABLE_HASH_KEY32_STATS_COLLECT=n
+CONFIG_RTE_TABLE_HASH_KEY8_STATS_COLLECT=n
#
# Compile librte_pipeline
diff --git a/config/common_linuxapp b/config/common_linuxapp
index e4bd7bc..38b799d 100644
--- a/config/common_linuxapp
+++ b/config/common_linuxapp
@@ -412,6 +412,7 @@ CONFIG_RTE_TABLE_ARRAY_STATS_COLLECT=n
CONFIG_RTE_TABLE_HASH_EXT_STATS_COLLECT=n
CONFIG_RTE_TABLE_HASH_KEY16_STATS_COLLECT=n
CONFIG_RTE_TABLE_HASH_KEY32_STATS_COLLECT=n
+CONFIG_RTE_TABLE_HASH_KEY8_STATS_COLLECT=n
#
# Compile librte_pipeline
diff --git a/lib/librte_table/rte_table_hash_key8.c b/lib/librte_table/rte_table_hash_key8.c
index 6803eb2..aac22b1 100644
--- a/lib/librte_table/rte_table_hash_key8.c
+++ b/lib/librte_table/rte_table_hash_key8.c
@@ -44,6 +44,20 @@
#define RTE_TABLE_HASH_KEY_SIZE 8
+#ifdef RTE_TABLE_HASH_KEY8_STATS_COLLECT
+
+#define RTE_TABLE_HASH_KEY8_STATS_PKTS_IN_ADD(table, val) \
+ table->stats.n_pkts_in += val
+#define RTE_TABLE_HASH_KEY8_STATS_PKTS_LOOKUP_MISS(table, val) \
+ table->stats.n_pkts_lookup_miss += val
+
+#else
+
+#define RTE_TABLE_HASH_KEY8_STATS_PKTS_IN_ADD(table, val)
+#define RTE_TABLE_HASH_KEY8_STATS_PKTS_LOOKUP_MISS(table, val)
+
+#endif
+
struct rte_bucket_4_8 {
/* Cache line 0 */
uint64_t signature;
@@ -58,6 +72,8 @@ struct rte_bucket_4_8 {
};
struct rte_table_hash {
+ struct rte_table_stats stats;
+
/* Input parameters */
uint32_t n_buckets;
uint32_t n_entries_per_bucket;
@@ -846,6 +862,9 @@ rte_table_hash_lookup_key8_lru(
pkt11_index, pkt20_index, pkt21_index;
uint64_t pkts_mask_out = 0;
+ __rte_unused uint32_t n_pkts_in = __builtin_popcountll(pkts_mask);
+ RTE_TABLE_HASH_KEY8_STATS_PKTS_IN_ADD(f, n_pkts_in);
+
/* Cannot run the pipeline with less than 5 packets */
if (__builtin_popcountll(pkts_mask) < 5) {
for ( ; pkts_mask; ) {
@@ -860,6 +879,7 @@ rte_table_hash_lookup_key8_lru(
}
*lookup_hit_mask = pkts_mask_out;
+ RTE_TABLE_HASH_KEY8_STATS_PKTS_LOOKUP_MISS(f, n_pkts_in - __builtin_popcountll(pkts_mask_out));
return 0;
}
@@ -949,6 +969,7 @@ rte_table_hash_lookup_key8_lru(
bucket20, bucket21, pkts_mask_out, entries, f);
*lookup_hit_mask = pkts_mask_out;
+ RTE_TABLE_HASH_KEY8_STATS_PKTS_LOOKUP_MISS(f, n_pkts_in - __builtin_popcountll(pkts_mask_out));
return 0;
} /* rte_table_hash_lookup_key8_lru() */
@@ -967,6 +988,9 @@ rte_table_hash_lookup_key8_lru_dosig(
uint32_t pkt11_index, pkt20_index, pkt21_index;
uint64_t pkts_mask_out = 0;
+ __rte_unused uint32_t n_pkts_in = __builtin_popcountll(pkts_mask);
+ RTE_TABLE_HASH_KEY8_STATS_PKTS_IN_ADD(f, n_pkts_in);
+
/* Cannot run the pipeline with less than 5 packets */
if (__builtin_popcountll(pkts_mask) < 5) {
for ( ; pkts_mask; ) {
@@ -981,6 +1005,7 @@ rte_table_hash_lookup_key8_lru_dosig(
}
*lookup_hit_mask = pkts_mask_out;
+ RTE_TABLE_HASH_KEY8_STATS_PKTS_LOOKUP_MISS(f, n_pkts_in - __builtin_popcountll(pkts_mask_out));
return 0;
}
@@ -1070,6 +1095,7 @@ rte_table_hash_lookup_key8_lru_dosig(
bucket20, bucket21, pkts_mask_out, entries, f);
*lookup_hit_mask = pkts_mask_out;
+ RTE_TABLE_HASH_KEY8_STATS_PKTS_LOOKUP_MISS(f, n_pkts_in - __builtin_popcountll(pkts_mask_out));
return 0;
} /* rte_table_hash_lookup_key8_lru_dosig() */
@@ -1090,6 +1116,9 @@ rte_table_hash_lookup_key8_ext(
struct rte_bucket_4_8 *buckets[RTE_PORT_IN_BURST_SIZE_MAX];
uint64_t *keys[RTE_PORT_IN_BURST_SIZE_MAX];
+ __rte_unused uint32_t n_pkts_in = __builtin_popcountll(pkts_mask);
+ RTE_TABLE_HASH_KEY8_STATS_PKTS_IN_ADD(f, n_pkts_in);
+
/* Cannot run the pipeline with less than 5 packets */
if (__builtin_popcountll(pkts_mask) < 5) {
for ( ; pkts_mask; ) {
@@ -1216,6 +1245,7 @@ grind_next_buckets:
}
*lookup_hit_mask = pkts_mask_out;
+ RTE_TABLE_HASH_KEY8_STATS_PKTS_LOOKUP_MISS(f, n_pkts_in - __builtin_popcountll(pkts_mask_out));
return 0;
} /* rte_table_hash_lookup_key8_ext() */
@@ -1236,6 +1266,9 @@ rte_table_hash_lookup_key8_ext_dosig(
struct rte_bucket_4_8 *buckets[RTE_PORT_IN_BURST_SIZE_MAX];
uint64_t *keys[RTE_PORT_IN_BURST_SIZE_MAX];
+ __rte_unused uint32_t n_pkts_in = __builtin_popcountll(pkts_mask);
+ RTE_TABLE_HASH_KEY8_STATS_PKTS_IN_ADD(f, n_pkts_in);
+
/* Cannot run the pipeline with less than 5 packets */
if (__builtin_popcountll(pkts_mask) < 5) {
for ( ; pkts_mask; ) {
@@ -1362,15 +1395,31 @@ grind_next_buckets:
}
*lookup_hit_mask = pkts_mask_out;
+ RTE_TABLE_HASH_KEY8_STATS_PKTS_LOOKUP_MISS(f, n_pkts_in - __builtin_popcountll(pkts_mask_out));
return 0;
} /* rte_table_hash_lookup_key8_dosig_ext() */
+static int
+rte_table_hash_key8_stats_read(void *table, struct rte_table_stats *stats, int clear)
+{
+ struct rte_table_hash *t = (struct rte_table_hash *) table;
+
+ if (stats != NULL)
+ memcpy(stats, &t->stats, sizeof(t->stats));
+
+ if (clear)
+ memset(&t->stats, 0, sizeof(t->stats));
+
+ return 0;
+}
+
struct rte_table_ops rte_table_hash_key8_lru_ops = {
.f_create = rte_table_hash_create_key8_lru,
.f_free = rte_table_hash_free_key8_lru,
.f_add = rte_table_hash_entry_add_key8_lru,
.f_delete = rte_table_hash_entry_delete_key8_lru,
.f_lookup = rte_table_hash_lookup_key8_lru,
+ .f_stats = rte_table_hash_key8_stats_read,
};
struct rte_table_ops rte_table_hash_key8_lru_dosig_ops = {
@@ -1379,6 +1428,7 @@ struct rte_table_ops rte_table_hash_key8_lru_dosig_ops = {
.f_add = rte_table_hash_entry_add_key8_lru,
.f_delete = rte_table_hash_entry_delete_key8_lru,
.f_lookup = rte_table_hash_lookup_key8_lru_dosig,
+ .f_stats = rte_table_hash_key8_stats_read,
};
struct rte_table_ops rte_table_hash_key8_ext_ops = {
@@ -1387,6 +1437,7 @@ struct rte_table_ops rte_table_hash_key8_ext_ops = {
.f_add = rte_table_hash_entry_add_key8_ext,
.f_delete = rte_table_hash_entry_delete_key8_ext,
.f_lookup = rte_table_hash_lookup_key8_ext,
+ .f_stats = rte_table_hash_key8_stats_read,
};
struct rte_table_ops rte_table_hash_key8_ext_dosig_ops = {
@@ -1395,4 +1446,5 @@ struct rte_table_ops rte_table_hash_key8_ext_dosig_ops = {
.f_add = rte_table_hash_entry_add_key8_ext,
.f_delete = rte_table_hash_entry_delete_key8_ext,
.f_lookup = rte_table_hash_lookup_key8_ext_dosig,
+ .f_stats = rte_table_hash_key8_stats_read,
};
--
1.7.9.5
^ permalink raw reply [flat|nested] 14+ messages in thread
* [dpdk-dev] [PATCH v2 08/10] table: added hash_lru table stats
2015-04-30 12:14 [dpdk-dev] [PATCH v2 00/10] table: added table statistics Michal Jastrzebski
` (6 preceding siblings ...)
2015-04-30 12:14 ` [dpdk-dev] [PATCH v2 07/10] table: added hash_key8 " Michal Jastrzebski
@ 2015-04-30 12:14 ` Michal Jastrzebski
2015-04-30 12:14 ` [dpdk-dev] [PATCH v2 09/10] table: added lpm_ipv6 " Michal Jastrzebski
` (2 subsequent siblings)
10 siblings, 0 replies; 14+ messages in thread
From: Michal Jastrzebski @ 2015-04-30 12:14 UTC (permalink / raw)
To: dev
From: Maciej Gajdzica <maciejx.t.gajdzica@intel.com>
Added statistics for hash_lru table.
Signed-off-by: Maciej Gajdzica <maciejx.t.gajdzica@intel.com>
---
config/common_bsdapp | 1 +
config/common_linuxapp | 1 +
lib/librte_table/rte_table_hash_lru.c | 44 +++++++++++++++++++++++++++++++++
3 files changed, 46 insertions(+)
diff --git a/config/common_bsdapp b/config/common_bsdapp
index bb1bbd1..505eb51 100644
--- a/config/common_bsdapp
+++ b/config/common_bsdapp
@@ -406,6 +406,7 @@ CONFIG_RTE_TABLE_HASH_EXT_STATS_COLLECT=n
CONFIG_RTE_TABLE_HASH_KEY16_STATS_COLLECT=n
CONFIG_RTE_TABLE_HASH_KEY32_STATS_COLLECT=n
CONFIG_RTE_TABLE_HASH_KEY8_STATS_COLLECT=n
+CONFIG_RTE_TABLE_HASH_LRU_STATS_COLLECT=n
#
# Compile librte_pipeline
diff --git a/config/common_linuxapp b/config/common_linuxapp
index 38b799d..7201858 100644
--- a/config/common_linuxapp
+++ b/config/common_linuxapp
@@ -413,6 +413,7 @@ CONFIG_RTE_TABLE_HASH_EXT_STATS_COLLECT=n
CONFIG_RTE_TABLE_HASH_KEY16_STATS_COLLECT=n
CONFIG_RTE_TABLE_HASH_KEY32_STATS_COLLECT=n
CONFIG_RTE_TABLE_HASH_KEY8_STATS_COLLECT=n
+CONFIG_RTE_TABLE_HASH_LRU_STATS_COLLECT=n
#
# Compile librte_pipeline
diff --git a/lib/librte_table/rte_table_hash_lru.c b/lib/librte_table/rte_table_hash_lru.c
index c9a8afd..2f2156c 100644
--- a/lib/librte_table/rte_table_hash_lru.c
+++ b/lib/librte_table/rte_table_hash_lru.c
@@ -45,6 +45,20 @@
#define KEYS_PER_BUCKET 4
+#ifdef RTE_TABLE_HASH_LRU_STATS_COLLECT
+
+#define RTE_TABLE_HASH_LRU_STATS_PKTS_IN_ADD(table, val) \
+ table->stats.n_pkts_in += val
+#define RTE_TABLE_HASH_LRU_STATS_PKTS_LOOKUP_MISS(table, val) \
+ table->stats.n_pkts_lookup_miss += val
+
+#else
+
+#define RTE_TABLE_HASH_LRU_STATS_PKTS_IN_ADD(table, val)
+#define RTE_TABLE_HASH_LRU_STATS_PKTS_LOOKUP_MISS(table, val)
+
+#endif
+
struct bucket {
union {
struct bucket *next;
@@ -63,6 +77,8 @@ struct grinder {
};
struct rte_table_hash {
+ struct rte_table_stats stats;
+
/* Input parameters */
uint32_t key_size;
uint32_t entry_size;
@@ -368,6 +384,9 @@ static int rte_table_hash_lru_lookup_unoptimized(
struct rte_table_hash *t = (struct rte_table_hash *) table;
uint64_t pkts_mask_out = 0;
+ __rte_unused uint32_t n_pkts_in = __builtin_popcountll(pkts_mask);
+ RTE_TABLE_HASH_LRU_STATS_PKTS_IN_ADD(t, n_pkts_in);
+
for ( ; pkts_mask; ) {
struct bucket *bkt;
struct rte_mbuf *pkt;
@@ -412,6 +431,7 @@ static int rte_table_hash_lru_lookup_unoptimized(
}
*lookup_hit_mask = pkts_mask_out;
+ RTE_TABLE_HASH_LRU_STATS_PKTS_LOOKUP_MISS(t, n_pkts_in - __builtin_popcountll(pkts_mask_out));
return 0;
}
@@ -804,6 +824,9 @@ static int rte_table_hash_lru_lookup(
uint64_t pkts_mask_out = 0, pkts_mask_match_many = 0;
int status = 0;
+ __rte_unused uint32_t n_pkts_in = __builtin_popcountll(pkts_mask);
+ RTE_TABLE_HASH_LRU_STATS_PKTS_IN_ADD(t, n_pkts_in);
+
/* Cannot run the pipeline with less than 7 packets */
if (__builtin_popcountll(pkts_mask) < 7)
return rte_table_hash_lru_lookup_unoptimized(table, pkts,
@@ -916,6 +939,7 @@ static int rte_table_hash_lru_lookup(
}
*lookup_hit_mask = pkts_mask_out;
+ RTE_TABLE_HASH_LRU_STATS_PKTS_LOOKUP_MISS(t, n_pkts_in - __builtin_popcountll(pkts_mask_out));
return status;
}
@@ -933,6 +957,9 @@ static int rte_table_hash_lru_lookup_dosig(
uint64_t pkts_mask_out = 0, pkts_mask_match_many = 0;
int status = 0;
+ __rte_unused uint32_t n_pkts_in = __builtin_popcountll(pkts_mask);
+ RTE_TABLE_HASH_LRU_STATS_PKTS_IN_ADD(t, n_pkts_in);
+
/* Cannot run the pipeline with less than 7 packets */
if (__builtin_popcountll(pkts_mask) < 7)
return rte_table_hash_lru_lookup_unoptimized(table, pkts,
@@ -1045,15 +1072,31 @@ static int rte_table_hash_lru_lookup_dosig(
}
*lookup_hit_mask = pkts_mask_out;
+ RTE_TABLE_HASH_LRU_STATS_PKTS_LOOKUP_MISS(t, n_pkts_in - __builtin_popcountll(pkts_mask_out));
return status;
}
+static int
+rte_table_hash_lru_stats_read(void *table, struct rte_table_stats *stats, int clear)
+{
+ struct rte_table_hash *t = (struct rte_table_hash *) table;
+
+ if (stats != NULL)
+ memcpy(stats, &t->stats, sizeof(t->stats));
+
+ if (clear)
+ memset(&t->stats, 0, sizeof(t->stats));
+
+ return 0;
+}
+
struct rte_table_ops rte_table_hash_lru_ops = {
.f_create = rte_table_hash_lru_create,
.f_free = rte_table_hash_lru_free,
.f_add = rte_table_hash_lru_entry_add,
.f_delete = rte_table_hash_lru_entry_delete,
.f_lookup = rte_table_hash_lru_lookup,
+ .f_stats = rte_table_hash_lru_stats_read,
};
struct rte_table_ops rte_table_hash_lru_dosig_ops = {
@@ -1062,4 +1105,5 @@ struct rte_table_ops rte_table_hash_lru_dosig_ops = {
.f_add = rte_table_hash_lru_entry_add,
.f_delete = rte_table_hash_lru_entry_delete,
.f_lookup = rte_table_hash_lru_lookup_dosig,
+ .f_stats = rte_table_hash_lru_stats_read,
};
--
1.7.9.5
^ permalink raw reply [flat|nested] 14+ messages in thread
* [dpdk-dev] [PATCH v2 09/10] table: added lpm_ipv6 table stats
2015-04-30 12:14 [dpdk-dev] [PATCH v2 00/10] table: added table statistics Michal Jastrzebski
` (7 preceding siblings ...)
2015-04-30 12:14 ` [dpdk-dev] [PATCH v2 08/10] table: added hash_lru " Michal Jastrzebski
@ 2015-04-30 12:14 ` Michal Jastrzebski
2015-04-30 12:14 ` [dpdk-dev] [PATCH v2 10/10] table: added lpm " Michal Jastrzebski
2015-05-05 15:10 ` [dpdk-dev] [PATCH v2 00/10] table: added table statistics Dumitrescu, Cristian
10 siblings, 0 replies; 14+ messages in thread
From: Michal Jastrzebski @ 2015-04-30 12:14 UTC (permalink / raw)
To: dev
From: Maciej Gajdzica <maciejx.t.gajdzica@intel.com>
Added lpm ipv6 table statistics.
Signed-off-by: Maciej Gajdzica <maciejx.t.gajdzica@intel.com>
---
config/common_bsdapp | 1 +
config/common_linuxapp | 1 +
lib/librte_table/rte_table_lpm_ipv6.c | 34 +++++++++++++++++++++++++++++++++
3 files changed, 36 insertions(+)
diff --git a/config/common_bsdapp b/config/common_bsdapp
index 505eb51..acd4866 100644
--- a/config/common_bsdapp
+++ b/config/common_bsdapp
@@ -407,6 +407,7 @@ CONFIG_RTE_TABLE_HASH_KEY16_STATS_COLLECT=n
CONFIG_RTE_TABLE_HASH_KEY32_STATS_COLLECT=n
CONFIG_RTE_TABLE_HASH_KEY8_STATS_COLLECT=n
CONFIG_RTE_TABLE_HASH_LRU_STATS_COLLECT=n
+CONFIG_RTE_TABLE_LPM_IPV6_STATS_COLLECT=n
#
# Compile librte_pipeline
diff --git a/config/common_linuxapp b/config/common_linuxapp
index 7201858..740d769 100644
--- a/config/common_linuxapp
+++ b/config/common_linuxapp
@@ -414,6 +414,7 @@ CONFIG_RTE_TABLE_HASH_KEY16_STATS_COLLECT=n
CONFIG_RTE_TABLE_HASH_KEY32_STATS_COLLECT=n
CONFIG_RTE_TABLE_HASH_KEY8_STATS_COLLECT=n
CONFIG_RTE_TABLE_HASH_LRU_STATS_COLLECT=n
+CONFIG_RTE_TABLE_LPM_IPV6_STATS_COLLECT=n
#
# Compile librte_pipeline
diff --git a/lib/librte_table/rte_table_lpm_ipv6.c b/lib/librte_table/rte_table_lpm_ipv6.c
index ce4ddc0..11534a9 100644
--- a/lib/librte_table/rte_table_lpm_ipv6.c
+++ b/lib/librte_table/rte_table_lpm_ipv6.c
@@ -46,7 +46,23 @@
#define RTE_TABLE_LPM_MAX_NEXT_HOPS 256
+#ifdef RTE_TABLE_LPM_IPV6_STATS_COLLECT
+
+#define RTE_TABLE_LPM_IPV6_STATS_PKTS_IN_ADD(table, val) \
+ table->stats.n_pkts_in += val
+#define RTE_TABLE_LPM_IPV6_STATS_PKTS_LOOKUP_MISS(table, val) \
+ table->stats.n_pkts_lookup_miss += val
+
+#else
+
+#define RTE_TABLE_LPM_IPV6_STATS_PKTS_IN_ADD(table, val)
+#define RTE_TABLE_LPM_IPV6_STATS_PKTS_LOOKUP_MISS(table, val)
+
+#endif
+
struct rte_table_lpm_ipv6 {
+ struct rte_table_stats stats;
+
/* Input parameters */
uint32_t entry_size;
uint32_t entry_unique_size;
@@ -327,6 +343,9 @@ rte_table_lpm_ipv6_lookup(
uint64_t pkts_out_mask = 0;
uint32_t i;
+ __rte_unused uint32_t n_pkts_in = __builtin_popcountll(pkts_mask);
+ RTE_TABLE_LPM_IPV6_STATS_PKTS_IN_ADD(lpm, n_pkts_in);
+
pkts_out_mask = 0;
for (i = 0; i < (uint32_t)(RTE_PORT_IN_BURST_SIZE_MAX -
__builtin_clzll(pkts_mask)); i++) {
@@ -349,6 +368,20 @@ rte_table_lpm_ipv6_lookup(
}
*lookup_hit_mask = pkts_out_mask;
+ RTE_TABLE_LPM_IPV6_STATS_PKTS_LOOKUP_MISS(lpm, n_pkts_in - __builtin_popcountll(pkts_out_mask));
+ return 0;
+}
+
+static int
+rte_table_lpm_ipv6_stats_read(void *table, struct rte_table_stats *stats, int clear)
+{
+ struct rte_table_lpm_ipv6 *t = (struct rte_table_lpm_ipv6 *) table;
+
+ if (stats != NULL)
+ memcpy(stats, &t->stats, sizeof(t->stats));
+
+ if (clear)
+ memset(&t->stats, 0, sizeof(t->stats));
return 0;
}
@@ -359,4 +392,5 @@ struct rte_table_ops rte_table_lpm_ipv6_ops = {
.f_add = rte_table_lpm_ipv6_entry_add,
.f_delete = rte_table_lpm_ipv6_entry_delete,
.f_lookup = rte_table_lpm_ipv6_lookup,
+ .f_stats = rte_table_lpm_ipv6_stats_read,
};
--
1.7.9.5
^ permalink raw reply [flat|nested] 14+ messages in thread
* [dpdk-dev] [PATCH v2 10/10] table: added lpm table stats
2015-04-30 12:14 [dpdk-dev] [PATCH v2 00/10] table: added table statistics Michal Jastrzebski
` (8 preceding siblings ...)
2015-04-30 12:14 ` [dpdk-dev] [PATCH v2 09/10] table: added lpm_ipv6 " Michal Jastrzebski
@ 2015-04-30 12:14 ` Michal Jastrzebski
2015-05-05 15:10 ` [dpdk-dev] [PATCH v2 00/10] table: added table statistics Dumitrescu, Cristian
10 siblings, 0 replies; 14+ messages in thread
From: Michal Jastrzebski @ 2015-04-30 12:14 UTC (permalink / raw)
To: dev
From: Maciej Gajdzica <maciejx.t.gajdzica@intel.com>
Added lpm table statistics.
Signed-off-by: Maciej Gajdzica <maciejx.t.gajdzica@intel.com>
---
config/common_bsdapp | 1 +
config/common_linuxapp | 1 +
lib/librte_table/rte_table_lpm.c | 34 ++++++++++++++++++++++++++++++++++
3 files changed, 36 insertions(+)
diff --git a/config/common_bsdapp b/config/common_bsdapp
index acd4866..1d0f5b2 100644
--- a/config/common_bsdapp
+++ b/config/common_bsdapp
@@ -408,6 +408,7 @@ CONFIG_RTE_TABLE_HASH_KEY32_STATS_COLLECT=n
CONFIG_RTE_TABLE_HASH_KEY8_STATS_COLLECT=n
CONFIG_RTE_TABLE_HASH_LRU_STATS_COLLECT=n
CONFIG_RTE_TABLE_LPM_IPV6_STATS_COLLECT=n
+CONFIG_RTE_TABLE_LPM_STATS_COLLECT=n
#
# Compile librte_pipeline
diff --git a/config/common_linuxapp b/config/common_linuxapp
index 740d769..8b01ca9 100644
--- a/config/common_linuxapp
+++ b/config/common_linuxapp
@@ -415,6 +415,7 @@ CONFIG_RTE_TABLE_HASH_KEY32_STATS_COLLECT=n
CONFIG_RTE_TABLE_HASH_KEY8_STATS_COLLECT=n
CONFIG_RTE_TABLE_HASH_LRU_STATS_COLLECT=n
CONFIG_RTE_TABLE_LPM_IPV6_STATS_COLLECT=n
+CONFIG_RTE_TABLE_LPM_STATS_COLLECT=n
#
# Compile librte_pipeline
diff --git a/lib/librte_table/rte_table_lpm.c b/lib/librte_table/rte_table_lpm.c
index 64c684d..7d8f670 100644
--- a/lib/librte_table/rte_table_lpm.c
+++ b/lib/librte_table/rte_table_lpm.c
@@ -46,7 +46,23 @@
#define RTE_TABLE_LPM_MAX_NEXT_HOPS 256
+#ifdef RTE_TABLE_LPM_STATS_COLLECT
+
+#define RTE_TABLE_LPM_STATS_PKTS_IN_ADD(table, val) \
+ table->stats.n_pkts_in += val
+#define RTE_TABLE_LPM_STATS_PKTS_LOOKUP_MISS(table, val) \
+ table->stats.n_pkts_lookup_miss += val
+
+#else
+
+#define RTE_TABLE_LPM_STATS_PKTS_IN_ADD(table, val)
+#define RTE_TABLE_LPM_STATS_PKTS_LOOKUP_MISS(table, val)
+
+#endif
+
struct rte_table_lpm {
+ struct rte_table_stats stats;
+
/* Input parameters */
uint32_t entry_size;
uint32_t entry_unique_size;
@@ -313,6 +329,9 @@ rte_table_lpm_lookup(
uint64_t pkts_out_mask = 0;
uint32_t i;
+ __rte_unused uint32_t n_pkts_in = __builtin_popcountll(pkts_mask);
+ RTE_TABLE_LPM_STATS_PKTS_IN_ADD(lpm, n_pkts_in);
+
pkts_out_mask = 0;
for (i = 0; i < (uint32_t)(RTE_PORT_IN_BURST_SIZE_MAX -
__builtin_clzll(pkts_mask)); i++) {
@@ -335,6 +354,20 @@ rte_table_lpm_lookup(
}
*lookup_hit_mask = pkts_out_mask;
+ RTE_TABLE_LPM_STATS_PKTS_LOOKUP_MISS(lpm, n_pkts_in - __builtin_popcountll(pkts_out_mask));
+ return 0;
+}
+
+static int
+rte_table_lpm_stats_read(void *table, struct rte_table_stats *stats, int clear)
+{
+ struct rte_table_lpm *t = (struct rte_table_lpm *) table;
+
+ if (stats != NULL)
+ memcpy(stats, &t->stats, sizeof(t->stats));
+
+ if (clear)
+ memset(&t->stats, 0, sizeof(t->stats));
return 0;
}
@@ -345,4 +378,5 @@ struct rte_table_ops rte_table_lpm_ops = {
.f_add = rte_table_lpm_entry_add,
.f_delete = rte_table_lpm_entry_delete,
.f_lookup = rte_table_lpm_lookup,
+ .f_stats = rte_table_lpm_stats_read,
};
--
1.7.9.5
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [dpdk-dev] [PATCH v2 02/10] table: added acl table stats
2015-04-30 12:14 ` [dpdk-dev] [PATCH v2 02/10] table: added acl " Michal Jastrzebski
@ 2015-04-30 15:55 ` Stephen Hemminger
2015-05-18 10:57 ` Thomas Monjalon
0 siblings, 1 reply; 14+ messages in thread
From: Stephen Hemminger @ 2015-04-30 15:55 UTC (permalink / raw)
To: Michal Jastrzebski; +Cc: dev
On Thu, 30 Apr 2015 14:14:30 +0200
Michal Jastrzebski <michalx.k.jastrzebski@intel.com> wrote:
> From: Maciej Gajdzica <maciejx.t.gajdzica@intel.com>
>
> Added statistics for ACL table.
>
> Signed-off-by: Maciej Gajdzica <maciejx.t.gajdzica@intel.com>
> ---
> config/common_bsdapp | 1 +
> config/common_linuxapp | 1 +
> lib/librte_table/rte_table_acl.c | 35 +++++++++++++++++++++++++++++++++++
> 3 files changed, 37 insertions(+)
>
> diff --git a/config/common_bsdapp b/config/common_bsdapp
> index 238d178..096e09c 100644
> --- a/config/common_bsdapp
> +++ b/config/common_bsdapp
> @@ -400,6 +400,7 @@ CONFIG_RTE_PORT_SINK_STATS_COLLECT=n
> # Compile librte_table
> #
> CONFIG_RTE_LIBRTE_TABLE=y
> +CONFIG_RTE_TABLE_ACL_STATS_COLLECT=n
Sigh. More config options does not make DPDK better.
It makes more unsupportable for distros
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [dpdk-dev] [PATCH v2 00/10] table: added table statistics
2015-04-30 12:14 [dpdk-dev] [PATCH v2 00/10] table: added table statistics Michal Jastrzebski
` (9 preceding siblings ...)
2015-04-30 12:14 ` [dpdk-dev] [PATCH v2 10/10] table: added lpm " Michal Jastrzebski
@ 2015-05-05 15:10 ` Dumitrescu, Cristian
10 siblings, 0 replies; 14+ messages in thread
From: Dumitrescu, Cristian @ 2015-05-05 15:10 UTC (permalink / raw)
To: Jastrzebski, MichalX K, dev
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Michal Jastrzebski
> Sent: Thursday, April 30, 2015 1:14 PM
> To: dev@dpdk.org
> Subject: [dpdk-dev] [PATCH v2 00/10] table: added table statistics
>
> From: Maciej Gajdzica <maciejx.t.gajdzica@intel.com>
>
> Added statistics for every type of table. By default all table statistics
> are disabled, user must activate them in config file.
>
> Maciej Gajdzica (10):
> table: added structure for storing table stats
> table: added acl table stats
> table: added array table stats
> table: added hash_ext table stats
> table: added hash_key16 table stats
> table: added hash_key32 table stats
> table: added hash_key8 table stats
> table: added hash_lru table stats
> table: added lpm_ipv6 table stats
> table: added lpm table stats
>
> config/common_bsdapp | 9 ++++++
> config/common_linuxapp | 9 ++++++
> lib/librte_table/rte_table.h | 25 +++++++++++++++
> lib/librte_table/rte_table_acl.c | 35 +++++++++++++++++++++
> lib/librte_table/rte_table_array.c | 34 +++++++++++++++++++-
> lib/librte_table/rte_table_hash_ext.c | 44
> ++++++++++++++++++++++++++
> lib/librte_table/rte_table_hash_key16.c | 41
> ++++++++++++++++++++++++
> lib/librte_table/rte_table_hash_key32.c | 41
> ++++++++++++++++++++++++
> lib/librte_table/rte_table_hash_key8.c | 52
> +++++++++++++++++++++++++++++++
> lib/librte_table/rte_table_hash_lru.c | 44
> ++++++++++++++++++++++++++
> lib/librte_table/rte_table_lpm.c | 34 ++++++++++++++++++++
> lib/librte_table/rte_table_lpm_ipv6.c | 34 ++++++++++++++++++++
> 12 files changed, 401 insertions(+), 1 deletion(-)
>
> --
> 1.7.9.5
Acked by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [dpdk-dev] [PATCH v2 02/10] table: added acl table stats
2015-04-30 15:55 ` Stephen Hemminger
@ 2015-05-18 10:57 ` Thomas Monjalon
0 siblings, 0 replies; 14+ messages in thread
From: Thomas Monjalon @ 2015-05-18 10:57 UTC (permalink / raw)
To: Maciej Gajdzica; +Cc: dev
2015-04-30 08:55, Stephen Hemminger:
> > From: Maciej Gajdzica <maciejx.t.gajdzica@intel.com>
> >
> > Added statistics for ACL table.
> >
> > Signed-off-by: Maciej Gajdzica <maciejx.t.gajdzica@intel.com>
> > ---
> > config/common_bsdapp | 1 +
> > config/common_linuxapp | 1 +
[...]
> > # Compile librte_table
> > #
> > CONFIG_RTE_LIBRTE_TABLE=y
> > +CONFIG_RTE_TABLE_ACL_STATS_COLLECT=n
>
> Sigh. More config options does not make DPDK better.
> It makes more unsupportable for distros
+1
It is the same comment as for port statistics.
Please stop trying to add new config options.
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2015-05-18 12:29 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-30 12:14 [dpdk-dev] [PATCH v2 00/10] table: added table statistics Michal Jastrzebski
2015-04-30 12:14 ` [dpdk-dev] [PATCH v2 01/10] table: added structure for storing table stats Michal Jastrzebski
2015-04-30 12:14 ` [dpdk-dev] [PATCH v2 02/10] table: added acl " Michal Jastrzebski
2015-04-30 15:55 ` Stephen Hemminger
2015-05-18 10:57 ` Thomas Monjalon
2015-04-30 12:14 ` [dpdk-dev] [PATCH v2 03/10] table: added array " Michal Jastrzebski
2015-04-30 12:14 ` [dpdk-dev] [PATCH v2 04/10] table: added hash_ext " Michal Jastrzebski
2015-04-30 12:14 ` [dpdk-dev] [PATCH v2 05/10] table: added hash_key16 " Michal Jastrzebski
2015-04-30 12:14 ` [dpdk-dev] [PATCH v2 06/10] table: added hash_key32 " Michal Jastrzebski
2015-04-30 12:14 ` [dpdk-dev] [PATCH v2 07/10] table: added hash_key8 " Michal Jastrzebski
2015-04-30 12:14 ` [dpdk-dev] [PATCH v2 08/10] table: added hash_lru " Michal Jastrzebski
2015-04-30 12:14 ` [dpdk-dev] [PATCH v2 09/10] table: added lpm_ipv6 " Michal Jastrzebski
2015-04-30 12:14 ` [dpdk-dev] [PATCH v2 10/10] table: added lpm " Michal Jastrzebski
2015-05-05 15:10 ` [dpdk-dev] [PATCH v2 00/10] table: added table statistics Dumitrescu, Cristian
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).