* [dpdk-dev] [PATCH v5 00/11] table: added table statistics
@ 2015-06-19 10:28 Maciej Gajdzica
2015-06-19 10:28 ` [dpdk-dev] [PATCH v5 01/11] table: added structure for storing table stats and config option Maciej Gajdzica
` (11 more replies)
0 siblings, 12 replies; 14+ messages in thread
From: Maciej Gajdzica @ 2015-06-19 10:28 UTC (permalink / raw)
To: dev
Added statistics for every type of table. By default all table statistics
are disabled, user must activate them in config file.
Changes in v2:
- added missing signoffs
Changes in v3:
- removed new config options to enable/disable stats
- using RTE_LOG_LEVEL instead
Changes in v4:
- created single config option for all table statistics
Changes in v5:
- added missing CONFIG_ prefix to defines in config files
- added stub table stats
Maciej Gajdzica (11):
table: added structure for storing table stats and config option
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
table: added stub table stats
config/common_bsdapp | 1 +
config/common_linuxapp | 1 +
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 +++++++++++++++++++
lib/librte_table/rte_table_stub.c | 56 ++++++++++++++++++++++++++++++-
13 files changed, 440 insertions(+), 2 deletions(-)
--
1.7.9.5
^ permalink raw reply [flat|nested] 14+ messages in thread
* [dpdk-dev] [PATCH v5 01/11] table: added structure for storing table stats and config option
2015-06-19 10:28 [dpdk-dev] [PATCH v5 00/11] table: added table statistics Maciej Gajdzica
@ 2015-06-19 10:28 ` Maciej Gajdzica
2015-06-19 10:28 ` [dpdk-dev] [PATCH v5 02/11] table: added acl table stats Maciej Gajdzica
` (10 subsequent siblings)
11 siblings, 0 replies; 14+ messages in thread
From: Maciej Gajdzica @ 2015-06-19 10:28 UTC (permalink / raw)
To: dev
Added common structure for table statistics. Added config option to
enable table stats collecting.
Signed-off-by: Maciej Gajdzica <maciejx.t.gajdzica@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
^ permalink raw reply [flat|nested] 14+ messages in thread
* [dpdk-dev] [PATCH v5 02/11] table: added acl table stats
2015-06-19 10:28 [dpdk-dev] [PATCH v5 00/11] table: added table statistics Maciej Gajdzica
2015-06-19 10:28 ` [dpdk-dev] [PATCH v5 01/11] table: added structure for storing table stats and config option Maciej Gajdzica
@ 2015-06-19 10:28 ` Maciej Gajdzica
2015-06-19 10:28 ` [dpdk-dev] [PATCH v5 03/11] table: added array " Maciej Gajdzica
` (9 subsequent siblings)
11 siblings, 0 replies; 14+ messages in thread
From: Maciej Gajdzica @ 2015-06-19 10:28 UTC (permalink / raw)
To: dev
Added statistics for ACL table.
Signed-off-by: Maciej Gajdzica <maciejx.t.gajdzica@intel.com>
---
lib/librte_table/rte_table_acl.c | 35 +++++++++++++++++++++++++++++++++++
1 file changed, 35 insertions(+)
diff --git a/lib/librte_table/rte_table_acl.c b/lib/librte_table/rte_table_acl.c
index 4416311..f02de3e 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_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 v5 03/11] table: added array table stats
2015-06-19 10:28 [dpdk-dev] [PATCH v5 00/11] table: added table statistics Maciej Gajdzica
2015-06-19 10:28 ` [dpdk-dev] [PATCH v5 01/11] table: added structure for storing table stats and config option Maciej Gajdzica
2015-06-19 10:28 ` [dpdk-dev] [PATCH v5 02/11] table: added acl table stats Maciej Gajdzica
@ 2015-06-19 10:28 ` Maciej Gajdzica
2015-06-19 10:28 ` [dpdk-dev] [PATCH v5 04/11] table: added hash_ext " Maciej Gajdzica
` (8 subsequent siblings)
11 siblings, 0 replies; 14+ messages in thread
From: Maciej Gajdzica @ 2015-06-19 10:28 UTC (permalink / raw)
To: dev
Added statistics for array table.
Signed-off-by: Maciej Gajdzica <maciejx.t.gajdzica@intel.com>
---
lib/librte_table/rte_table_array.c | 34 +++++++++++++++++++++++++++++++++-
1 file changed, 33 insertions(+), 1 deletion(-)
diff --git a/lib/librte_table/rte_table_array.c b/lib/librte_table/rte_table_array.c
index c031070..d75cc25 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_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 v5 04/11] table: added hash_ext table stats
2015-06-19 10:28 [dpdk-dev] [PATCH v5 00/11] table: added table statistics Maciej Gajdzica
` (2 preceding siblings ...)
2015-06-19 10:28 ` [dpdk-dev] [PATCH v5 03/11] table: added array " Maciej Gajdzica
@ 2015-06-19 10:28 ` Maciej Gajdzica
2015-06-19 10:28 ` [dpdk-dev] [PATCH v5 05/11] table: added hash_key16 " Maciej Gajdzica
` (7 subsequent siblings)
11 siblings, 0 replies; 14+ messages in thread
From: Maciej Gajdzica @ 2015-06-19 10:28 UTC (permalink / raw)
To: dev
Added statistics for hash ext table.
Signed-off-by: Maciej Gajdzica <maciejx.t.gajdzica@intel.com>
---
lib/librte_table/rte_table_hash_ext.c | 44 +++++++++++++++++++++++++++++++++
1 file changed, 44 insertions(+)
diff --git a/lib/librte_table/rte_table_hash_ext.c b/lib/librte_table/rte_table_hash_ext.c
index 66e416b..3c12273 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_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 v5 05/11] table: added hash_key16 table stats
2015-06-19 10:28 [dpdk-dev] [PATCH v5 00/11] table: added table statistics Maciej Gajdzica
` (3 preceding siblings ...)
2015-06-19 10:28 ` [dpdk-dev] [PATCH v5 04/11] table: added hash_ext " Maciej Gajdzica
@ 2015-06-19 10:28 ` Maciej Gajdzica
2015-06-19 10:28 ` [dpdk-dev] [PATCH v5 06/11] table: added hash_key32 " Maciej Gajdzica
` (6 subsequent siblings)
11 siblings, 0 replies; 14+ messages in thread
From: Maciej Gajdzica @ 2015-06-19 10:28 UTC (permalink / raw)
To: dev
Added statistics for hash key16 table.
Signed-off-by: Maciej Gajdzica <maciejx.t.gajdzica@intel.com>
---
lib/librte_table/rte_table_hash_key16.c | 41 +++++++++++++++++++++++++++++++
1 file changed, 41 insertions(+)
diff --git a/lib/librte_table/rte_table_hash_key16.c b/lib/librte_table/rte_table_hash_key16.c
index f87ea0e..b936323 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_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 v5 06/11] table: added hash_key32 table stats
2015-06-19 10:28 [dpdk-dev] [PATCH v5 00/11] table: added table statistics Maciej Gajdzica
` (4 preceding siblings ...)
2015-06-19 10:28 ` [dpdk-dev] [PATCH v5 05/11] table: added hash_key16 " Maciej Gajdzica
@ 2015-06-19 10:28 ` Maciej Gajdzica
2015-06-19 10:28 ` [dpdk-dev] [PATCH v5 07/11] table: added hash_key8 " Maciej Gajdzica
` (5 subsequent siblings)
11 siblings, 0 replies; 14+ messages in thread
From: Maciej Gajdzica @ 2015-06-19 10:28 UTC (permalink / raw)
To: dev
Added statistics for hash key32 table.
Signed-off-by: Maciej Gajdzica <maciejx.t.gajdzica@intel.com>
---
lib/librte_table/rte_table_hash_key32.c | 41 +++++++++++++++++++++++++++++++
1 file changed, 41 insertions(+)
diff --git a/lib/librte_table/rte_table_hash_key32.c b/lib/librte_table/rte_table_hash_key32.c
index 6790594..c230629 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_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 v5 07/11] table: added hash_key8 table stats
2015-06-19 10:28 [dpdk-dev] [PATCH v5 00/11] table: added table statistics Maciej Gajdzica
` (5 preceding siblings ...)
2015-06-19 10:28 ` [dpdk-dev] [PATCH v5 06/11] table: added hash_key32 " Maciej Gajdzica
@ 2015-06-19 10:28 ` Maciej Gajdzica
2015-06-19 10:28 ` [dpdk-dev] [PATCH v5 08/11] table: added hash_lru " Maciej Gajdzica
` (4 subsequent siblings)
11 siblings, 0 replies; 14+ messages in thread
From: Maciej Gajdzica @ 2015-06-19 10:28 UTC (permalink / raw)
To: dev
Added statistics for hash key8 table.
Signed-off-by: Maciej Gajdzica <maciejx.t.gajdzica@intel.com>
---
lib/librte_table/rte_table_hash_key8.c | 52 ++++++++++++++++++++++++++++++++
1 file changed, 52 insertions(+)
diff --git a/lib/librte_table/rte_table_hash_key8.c b/lib/librte_table/rte_table_hash_key8.c
index 6803eb2..374e3e3 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_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 v5 08/11] table: added hash_lru table stats
2015-06-19 10:28 [dpdk-dev] [PATCH v5 00/11] table: added table statistics Maciej Gajdzica
` (6 preceding siblings ...)
2015-06-19 10:28 ` [dpdk-dev] [PATCH v5 07/11] table: added hash_key8 " Maciej Gajdzica
@ 2015-06-19 10:28 ` Maciej Gajdzica
2015-06-19 10:28 ` [dpdk-dev] [PATCH v5 09/11] table: added lpm_ipv6 " Maciej Gajdzica
` (3 subsequent siblings)
11 siblings, 0 replies; 14+ messages in thread
From: Maciej Gajdzica @ 2015-06-19 10:28 UTC (permalink / raw)
To: dev
Added statistics for hash_lru table.
Signed-off-by: Maciej Gajdzica <maciejx.t.gajdzica@intel.com>
---
lib/librte_table/rte_table_hash_lru.c | 44 +++++++++++++++++++++++++++++++++
1 file changed, 44 insertions(+)
diff --git a/lib/librte_table/rte_table_hash_lru.c b/lib/librte_table/rte_table_hash_lru.c
index c9a8afd..c4b6079 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_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 v5 09/11] table: added lpm_ipv6 table stats
2015-06-19 10:28 [dpdk-dev] [PATCH v5 00/11] table: added table statistics Maciej Gajdzica
` (7 preceding siblings ...)
2015-06-19 10:28 ` [dpdk-dev] [PATCH v5 08/11] table: added hash_lru " Maciej Gajdzica
@ 2015-06-19 10:28 ` Maciej Gajdzica
2015-06-19 10:28 ` [dpdk-dev] [PATCH v5 10/11] table: added lpm " Maciej Gajdzica
` (2 subsequent siblings)
11 siblings, 0 replies; 14+ messages in thread
From: Maciej Gajdzica @ 2015-06-19 10:28 UTC (permalink / raw)
To: dev
Added lpm ipv6 table statistics.
Signed-off-by: Maciej Gajdzica <maciejx.t.gajdzica@intel.com>
---
lib/librte_table/rte_table_lpm_ipv6.c | 34 +++++++++++++++++++++++++++++++++
1 file changed, 34 insertions(+)
diff --git a/lib/librte_table/rte_table_lpm_ipv6.c b/lib/librte_table/rte_table_lpm_ipv6.c
index ce4ddc0..ce7fa02 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_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 v5 10/11] table: added lpm table stats
2015-06-19 10:28 [dpdk-dev] [PATCH v5 00/11] table: added table statistics Maciej Gajdzica
` (8 preceding siblings ...)
2015-06-19 10:28 ` [dpdk-dev] [PATCH v5 09/11] table: added lpm_ipv6 " Maciej Gajdzica
@ 2015-06-19 10:28 ` Maciej Gajdzica
2015-06-19 10:28 ` [dpdk-dev] [PATCH v5 11/11] table: added stub " Maciej Gajdzica
2015-06-23 10:27 ` [dpdk-dev] [PATCH v5 00/11] table: added table statistics Dumitrescu, Cristian
11 siblings, 0 replies; 14+ messages in thread
From: Maciej Gajdzica @ 2015-06-19 10:28 UTC (permalink / raw)
To: dev
Added lpm table statistics.
Signed-off-by: Maciej Gajdzica <maciejx.t.gajdzica@intel.com>
---
lib/librte_table/rte_table_lpm.c | 34 ++++++++++++++++++++++++++++++++++
1 file changed, 34 insertions(+)
diff --git a/lib/librte_table/rte_table_lpm.c b/lib/librte_table/rte_table_lpm.c
index 64c684d..300e680 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_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
* [dpdk-dev] [PATCH v5 11/11] table: added stub table stats
2015-06-19 10:28 [dpdk-dev] [PATCH v5 00/11] table: added table statistics Maciej Gajdzica
` (9 preceding siblings ...)
2015-06-19 10:28 ` [dpdk-dev] [PATCH v5 10/11] table: added lpm " Maciej Gajdzica
@ 2015-06-19 10:28 ` Maciej Gajdzica
2015-06-23 10:27 ` [dpdk-dev] [PATCH v5 00/11] table: added table statistics Dumitrescu, Cristian
11 siblings, 0 replies; 14+ messages in thread
From: Maciej Gajdzica @ 2015-06-19 10:28 UTC (permalink / raw)
To: dev
Added stub table statistics.
Signed-off-by: Maciej Gajdzica <maciejx.t.gajdzica@intel.com>
---
lib/librte_table/rte_table_stub.c | 56 ++++++++++++++++++++++++++++++++++++-
1 file changed, 55 insertions(+), 1 deletion(-)
diff --git a/lib/librte_table/rte_table_stub.c b/lib/librte_table/rte_table_stub.c
index 876b7e4..c1065ef 100644
--- a/lib/librte_table/rte_table_stub.c
+++ b/lib/librte_table/rte_table_stub.c
@@ -31,16 +31,50 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include <string.h>
+
#include <rte_mbuf.h>
+#include <rte_malloc.h>
#include "rte_table_stub.h"
+#ifdef RTE_TABLE_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_stub {
+ struct rte_table_stats stats;
+};
+
static void *
rte_table_stub_create(__rte_unused void *params,
__rte_unused int socket_id,
__rte_unused uint32_t entry_size)
{
- return (void *) 1;
+ struct rte_table_stub *stub;
+ uint32_t size;
+
+ size = sizeof(struct rte_table_stub);
+ stub = rte_zmalloc_socket("TABLE", size, RTE_CACHE_LINE_SIZE,
+ socket_id);
+ if (stub == NULL) {
+ RTE_LOG(ERR, TABLE,
+ "%s: Cannot allocate %u bytes for stub table\n",
+ __func__, size);
+ return NULL;
+ }
+
+ return stub;
}
static int
@@ -51,7 +85,26 @@ rte_table_stub_lookup(
uint64_t *lookup_hit_mask,
__rte_unused void **entries)
{
+ __rte_unused struct rte_table_stub *stub = (struct rte_table_stub *) table;
+ __rte_unused uint32_t n_pkts_in = __builtin_popcountll(pkts_mask);
+
+ RTE_TABLE_LPM_STATS_PKTS_IN_ADD(stub, n_pkts_in);
*lookup_hit_mask = 0;
+ RTE_TABLE_LPM_STATS_PKTS_LOOKUP_MISS(stub, n_pkts_in);
+
+ return 0;
+}
+
+static int
+rte_table_stub_stats_read(void *table, struct rte_table_stats *stats, int clear)
+{
+ struct rte_table_stub *t = (struct rte_table_stub *) table;
+
+ if (stats != NULL)
+ memcpy(stats, &t->stats, sizeof(t->stats));
+
+ if (clear)
+ memset(&t->stats, 0, sizeof(t->stats));
return 0;
}
@@ -62,4 +115,5 @@ struct rte_table_ops rte_table_stub_ops = {
.f_add = NULL,
.f_delete = NULL,
.f_lookup = rte_table_stub_lookup,
+ .f_stats = rte_table_stub_stats_read,
};
--
1.7.9.5
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [dpdk-dev] [PATCH v5 00/11] table: added table statistics
2015-06-19 10:28 [dpdk-dev] [PATCH v5 00/11] table: added table statistics Maciej Gajdzica
` (10 preceding siblings ...)
2015-06-19 10:28 ` [dpdk-dev] [PATCH v5 11/11] table: added stub " Maciej Gajdzica
@ 2015-06-23 10:27 ` Dumitrescu, Cristian
2015-06-23 21:04 ` Thomas Monjalon
11 siblings, 1 reply; 14+ messages in thread
From: Dumitrescu, Cristian @ 2015-06-23 10:27 UTC (permalink / raw)
To: Gajdzica, MaciejX T, dev
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Maciej Gajdzica
> Sent: Friday, June 19, 2015 11:29 AM
> To: dev@dpdk.org
> Subject: [dpdk-dev] [PATCH v5 00/11] table: added table statistics
>
> Added statistics for every type of table. By default all table statistics
> are disabled, user must activate them in config file.
>
> Changes in v5:
> - added missing CONFIG_ prefix to defines in config files
> - added stub table stats
>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [dpdk-dev] [PATCH v5 00/11] table: added table statistics
2015-06-23 10:27 ` [dpdk-dev] [PATCH v5 00/11] table: added table statistics Dumitrescu, Cristian
@ 2015-06-23 21:04 ` Thomas Monjalon
0 siblings, 0 replies; 14+ messages in thread
From: Thomas Monjalon @ 2015-06-23 21:04 UTC (permalink / raw)
To: Gajdzica, MaciejX T; +Cc: dev
> > Added statistics for every type of table. By default all table statistics
> > are disabled, user must activate them in config file.
> >
> > Changes in v5:
> > - added missing CONFIG_ prefix to defines in config files
> > - added stub table stats
>
> Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Applied, thanks
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2015-06-23 21:05 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-19 10:28 [dpdk-dev] [PATCH v5 00/11] table: added table statistics Maciej Gajdzica
2015-06-19 10:28 ` [dpdk-dev] [PATCH v5 01/11] table: added structure for storing table stats and config option Maciej Gajdzica
2015-06-19 10:28 ` [dpdk-dev] [PATCH v5 02/11] table: added acl table stats Maciej Gajdzica
2015-06-19 10:28 ` [dpdk-dev] [PATCH v5 03/11] table: added array " Maciej Gajdzica
2015-06-19 10:28 ` [dpdk-dev] [PATCH v5 04/11] table: added hash_ext " Maciej Gajdzica
2015-06-19 10:28 ` [dpdk-dev] [PATCH v5 05/11] table: added hash_key16 " Maciej Gajdzica
2015-06-19 10:28 ` [dpdk-dev] [PATCH v5 06/11] table: added hash_key32 " Maciej Gajdzica
2015-06-19 10:28 ` [dpdk-dev] [PATCH v5 07/11] table: added hash_key8 " Maciej Gajdzica
2015-06-19 10:28 ` [dpdk-dev] [PATCH v5 08/11] table: added hash_lru " Maciej Gajdzica
2015-06-19 10:28 ` [dpdk-dev] [PATCH v5 09/11] table: added lpm_ipv6 " Maciej Gajdzica
2015-06-19 10:28 ` [dpdk-dev] [PATCH v5 10/11] table: added lpm " Maciej Gajdzica
2015-06-19 10:28 ` [dpdk-dev] [PATCH v5 11/11] table: added stub " Maciej Gajdzica
2015-06-23 10:27 ` [dpdk-dev] [PATCH v5 00/11] table: added table statistics Dumitrescu, Cristian
2015-06-23 21:04 ` Thomas Monjalon
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).