* [dpdk-dev] [PATCH v3 00/10] table: added table statistics
@ 2015-05-26 12:39 Maciej Gajdzica
2015-05-26 12:39 ` [dpdk-dev] [PATCH v3 01/10] table: added structure for storing table stats Maciej Gajdzica
` (10 more replies)
0 siblings, 11 replies; 18+ messages in thread
From: Maciej Gajdzica @ 2015-05-26 12:39 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
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
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 ++++++++++++++++++++
10 files changed, 383 insertions(+), 1 deletion(-)
--
1.7.9.5
^ permalink raw reply [flat|nested] 18+ messages in thread
* [dpdk-dev] [PATCH v3 01/10] table: added structure for storing table stats
2015-05-26 12:39 [dpdk-dev] [PATCH v3 00/10] table: added table statistics Maciej Gajdzica
@ 2015-05-26 12:39 ` Maciej Gajdzica
2015-05-26 14:57 ` Stephen Hemminger
2015-05-26 22:03 ` Chris Wright
2015-05-26 12:39 ` [dpdk-dev] [PATCH v3 02/10] table: added acl " Maciej Gajdzica
` (9 subsequent siblings)
10 siblings, 2 replies; 18+ messages in thread
From: Maciej Gajdzica @ 2015-05-26 12:39 UTC (permalink / raw)
To: dev
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 6e51fe6..1732fbf 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 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 */
@@ -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] 18+ messages in thread
* [dpdk-dev] [PATCH v3 02/10] table: added acl table stats
2015-05-26 12:39 [dpdk-dev] [PATCH v3 00/10] table: added table statistics Maciej Gajdzica
2015-05-26 12:39 ` [dpdk-dev] [PATCH v3 01/10] table: added structure for storing table stats Maciej Gajdzica
@ 2015-05-26 12:39 ` Maciej Gajdzica
2015-05-26 12:39 ` [dpdk-dev] [PATCH v3 03/10] table: added array " Maciej Gajdzica
` (8 subsequent siblings)
10 siblings, 0 replies; 18+ messages in thread
From: Maciej Gajdzica @ 2015-05-26 12:39 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..c67622a 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>
+#if RTE_LOG_LEVEL == RTE_LOG_DEBUG
+
+#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] 18+ messages in thread
* [dpdk-dev] [PATCH v3 03/10] table: added array table stats
2015-05-26 12:39 [dpdk-dev] [PATCH v3 00/10] table: added table statistics Maciej Gajdzica
2015-05-26 12:39 ` [dpdk-dev] [PATCH v3 01/10] table: added structure for storing table stats Maciej Gajdzica
2015-05-26 12:39 ` [dpdk-dev] [PATCH v3 02/10] table: added acl " Maciej Gajdzica
@ 2015-05-26 12:39 ` Maciej Gajdzica
2015-05-26 12:39 ` [dpdk-dev] [PATCH v3 04/10] table: added hash_ext " Maciej Gajdzica
` (7 subsequent siblings)
10 siblings, 0 replies; 18+ messages in thread
From: Maciej Gajdzica @ 2015-05-26 12:39 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..a44e544 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"
+#if RTE_LOG_LEVEL == RTE_LOG_DEBUG
+
+#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] 18+ messages in thread
* [dpdk-dev] [PATCH v3 04/10] table: added hash_ext table stats
2015-05-26 12:39 [dpdk-dev] [PATCH v3 00/10] table: added table statistics Maciej Gajdzica
` (2 preceding siblings ...)
2015-05-26 12:39 ` [dpdk-dev] [PATCH v3 03/10] table: added array " Maciej Gajdzica
@ 2015-05-26 12:39 ` Maciej Gajdzica
2015-05-26 12:39 ` [dpdk-dev] [PATCH v3 05/10] table: added hash_key16 " Maciej Gajdzica
` (6 subsequent siblings)
10 siblings, 0 replies; 18+ messages in thread
From: Maciej Gajdzica @ 2015-05-26 12:39 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..7217155 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)
+#if RTE_LOG_LEVEL == RTE_LOG_DEBUG
+
+#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] 18+ messages in thread
* [dpdk-dev] [PATCH v3 05/10] table: added hash_key16 table stats
2015-05-26 12:39 [dpdk-dev] [PATCH v3 00/10] table: added table statistics Maciej Gajdzica
` (3 preceding siblings ...)
2015-05-26 12:39 ` [dpdk-dev] [PATCH v3 04/10] table: added hash_ext " Maciej Gajdzica
@ 2015-05-26 12:39 ` Maciej Gajdzica
2015-05-26 12:39 ` [dpdk-dev] [PATCH v3 06/10] table: added hash_key32 " Maciej Gajdzica
` (5 subsequent siblings)
10 siblings, 0 replies; 18+ messages in thread
From: Maciej Gajdzica @ 2015-05-26 12:39 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..24334e8 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
+#if RTE_LOG_LEVEL == RTE_LOG_DEBUG
+
+#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] 18+ messages in thread
* [dpdk-dev] [PATCH v3 06/10] table: added hash_key32 table stats
2015-05-26 12:39 [dpdk-dev] [PATCH v3 00/10] table: added table statistics Maciej Gajdzica
` (4 preceding siblings ...)
2015-05-26 12:39 ` [dpdk-dev] [PATCH v3 05/10] table: added hash_key16 " Maciej Gajdzica
@ 2015-05-26 12:39 ` Maciej Gajdzica
2015-05-26 12:39 ` [dpdk-dev] [PATCH v3 07/10] table: added hash_key8 " Maciej Gajdzica
` (4 subsequent siblings)
10 siblings, 0 replies; 18+ messages in thread
From: Maciej Gajdzica @ 2015-05-26 12:39 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..da08edc 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
+#if RTE_LOG_LEVEL == RTE_LOG_DEBUG
+
+#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] 18+ messages in thread
* [dpdk-dev] [PATCH v3 07/10] table: added hash_key8 table stats
2015-05-26 12:39 [dpdk-dev] [PATCH v3 00/10] table: added table statistics Maciej Gajdzica
` (5 preceding siblings ...)
2015-05-26 12:39 ` [dpdk-dev] [PATCH v3 06/10] table: added hash_key32 " Maciej Gajdzica
@ 2015-05-26 12:39 ` Maciej Gajdzica
2015-05-26 12:39 ` [dpdk-dev] [PATCH v3 08/10] table: added hash_lru " Maciej Gajdzica
` (3 subsequent siblings)
10 siblings, 0 replies; 18+ messages in thread
From: Maciej Gajdzica @ 2015-05-26 12:39 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..9e480c9 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
+#if RTE_LOG_LEVEL == RTE_LOG_DEBUG
+
+#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] 18+ messages in thread
* [dpdk-dev] [PATCH v3 08/10] table: added hash_lru table stats
2015-05-26 12:39 [dpdk-dev] [PATCH v3 00/10] table: added table statistics Maciej Gajdzica
` (6 preceding siblings ...)
2015-05-26 12:39 ` [dpdk-dev] [PATCH v3 07/10] table: added hash_key8 " Maciej Gajdzica
@ 2015-05-26 12:39 ` Maciej Gajdzica
2015-05-26 12:39 ` [dpdk-dev] [PATCH v3 09/10] table: added lpm_ipv6 " Maciej Gajdzica
` (2 subsequent siblings)
10 siblings, 0 replies; 18+ messages in thread
From: Maciej Gajdzica @ 2015-05-26 12:39 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..30ed19f 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
+#if RTE_LOG_LEVEL == RTE_LOG_DEBUG
+
+#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] 18+ messages in thread
* [dpdk-dev] [PATCH v3 09/10] table: added lpm_ipv6 table stats
2015-05-26 12:39 [dpdk-dev] [PATCH v3 00/10] table: added table statistics Maciej Gajdzica
` (7 preceding siblings ...)
2015-05-26 12:39 ` [dpdk-dev] [PATCH v3 08/10] table: added hash_lru " Maciej Gajdzica
@ 2015-05-26 12:39 ` Maciej Gajdzica
2015-05-26 12:39 ` [dpdk-dev] [PATCH v3 10/10] table: added lpm " Maciej Gajdzica
2015-05-26 13:39 ` [dpdk-dev] [PATCH v3 00/10] table: added table statistics Dumitrescu, Cristian
10 siblings, 0 replies; 18+ messages in thread
From: Maciej Gajdzica @ 2015-05-26 12:39 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..62a4c56 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
+#if RTE_LOG_LEVEL == RTE_LOG_DEBUG
+
+#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] 18+ messages in thread
* [dpdk-dev] [PATCH v3 10/10] table: added lpm table stats
2015-05-26 12:39 [dpdk-dev] [PATCH v3 00/10] table: added table statistics Maciej Gajdzica
` (8 preceding siblings ...)
2015-05-26 12:39 ` [dpdk-dev] [PATCH v3 09/10] table: added lpm_ipv6 " Maciej Gajdzica
@ 2015-05-26 12:39 ` Maciej Gajdzica
2015-05-26 13:39 ` [dpdk-dev] [PATCH v3 00/10] table: added table statistics Dumitrescu, Cristian
10 siblings, 0 replies; 18+ messages in thread
From: Maciej Gajdzica @ 2015-05-26 12:39 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..ab304ea 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
+#if RTE_LOG_LEVEL == RTE_LOG_DEBUG
+
+#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] 18+ messages in thread
* Re: [dpdk-dev] [PATCH v3 00/10] table: added table statistics
2015-05-26 12:39 [dpdk-dev] [PATCH v3 00/10] table: added table statistics Maciej Gajdzica
` (9 preceding siblings ...)
2015-05-26 12:39 ` [dpdk-dev] [PATCH v3 10/10] table: added lpm " Maciej Gajdzica
@ 2015-05-26 13:39 ` Dumitrescu, Cristian
10 siblings, 0 replies; 18+ messages in thread
From: Dumitrescu, Cristian @ 2015-05-26 13:39 UTC (permalink / raw)
To: Gajdzica, MaciejX T, dev
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Maciej Gajdzica
> Sent: Tuesday, May 26, 2015 1:40 PM
> To: dev@dpdk.org
> Subject: [dpdk-dev] [PATCH v3 00/10] 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 v2:
> - added missing signoffs
>
> Changes in v3:
> - removed new config options to enable/disable stats
> - using RTE_LOG_LEVEL instead
>
> 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
>
> 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 ++++++++++++++++++++
> 10 files changed, 383 insertions(+), 1 deletion(-)
>
> --
> 1.7.9.5
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [dpdk-dev] [PATCH v3 01/10] table: added structure for storing table stats
2015-05-26 12:39 ` [dpdk-dev] [PATCH v3 01/10] table: added structure for storing table stats Maciej Gajdzica
@ 2015-05-26 14:57 ` Stephen Hemminger
2015-05-26 21:40 ` Dumitrescu, Cristian
2015-05-26 22:03 ` Chris Wright
1 sibling, 1 reply; 18+ messages in thread
From: Stephen Hemminger @ 2015-05-26 14:57 UTC (permalink / raw)
To: Maciej Gajdzica; +Cc: dev
On Tue, 26 May 2015 14:39:38 +0200
Maciej Gajdzica <maciejx.t.gajdzica@intel.com> wrote:
> +
> /** 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 */
> };
Another good idea, which is an ABI change.
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [dpdk-dev] [PATCH v3 01/10] table: added structure for storing table stats
2015-05-26 14:57 ` Stephen Hemminger
@ 2015-05-26 21:40 ` Dumitrescu, Cristian
2015-05-26 21:57 ` Stephen Hemminger
0 siblings, 1 reply; 18+ messages in thread
From: Dumitrescu, Cristian @ 2015-05-26 21:40 UTC (permalink / raw)
To: Stephen Hemminger, Gajdzica, MaciejX T; +Cc: dev
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Stephen
> Hemminger
> Sent: Tuesday, May 26, 2015 3:58 PM
> To: Gajdzica, MaciejX T
> Cc: dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH v3 01/10] table: added structure for storing
> table stats
>
> On Tue, 26 May 2015 14:39:38 +0200
> Maciej Gajdzica <maciejx.t.gajdzica@intel.com> wrote:
>
> > +
> > /** 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 */
> > };
>
> Another good idea, which is an ABI change.
This is simply adding a new API function, this is not changing any function prototype. There is no change required in the map file of this library. Is there anything we should have done and we did not do?
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [dpdk-dev] [PATCH v3 01/10] table: added structure for storing table stats
2015-05-26 21:40 ` Dumitrescu, Cristian
@ 2015-05-26 21:57 ` Stephen Hemminger
2015-05-28 19:32 ` Dumitrescu, Cristian
0 siblings, 1 reply; 18+ messages in thread
From: Stephen Hemminger @ 2015-05-26 21:57 UTC (permalink / raw)
To: Dumitrescu, Cristian; +Cc: dev
On Tue, 26 May 2015 21:40:42 +0000
"Dumitrescu, Cristian" <cristian.dumitrescu@intel.com> wrote:
>
>
> > -----Original Message-----
> > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Stephen
> > Hemminger
> > Sent: Tuesday, May 26, 2015 3:58 PM
> > To: Gajdzica, MaciejX T
> > Cc: dev@dpdk.org
> > Subject: Re: [dpdk-dev] [PATCH v3 01/10] table: added structure for storing
> > table stats
> >
> > On Tue, 26 May 2015 14:39:38 +0200
> > Maciej Gajdzica <maciejx.t.gajdzica@intel.com> wrote:
> >
> > > +
> > > /** 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 */
> > > };
> >
> > Another good idea, which is an ABI change.
>
> This is simply adding a new API function, this is not changing any function prototype. There is no change required in the map file of this library. Is there anything we should have done and we did not do?
>
But if I built an external set of code which had rte_table_ops (don't worry I haven't)
and that binary ran with the new definition, the core code it table would reference
outside the (old version) of rte_table_ops structure and find garbage.
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [dpdk-dev] [PATCH v3 01/10] table: added structure for storing table stats
2015-05-26 12:39 ` [dpdk-dev] [PATCH v3 01/10] table: added structure for storing table stats Maciej Gajdzica
2015-05-26 14:57 ` Stephen Hemminger
@ 2015-05-26 22:03 ` Chris Wright
1 sibling, 0 replies; 18+ messages in thread
From: Chris Wright @ 2015-05-26 22:03 UTC (permalink / raw)
To: Maciej Gajdzica; +Cc: dev
* Maciej Gajdzica (maciejx.t.gajdzica@intel.com) wrote:
> @@ -187,6 +193,24 @@ typedef int (*rte_table_op_lookup)(
> uint64_t *lookup_hit_mask,
> void **entries);
>
> +/**
> + * Lookup table stats read
> + *
> + * @param port
Parameter is actually called 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);
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [dpdk-dev] [PATCH v3 01/10] table: added structure for storing table stats
2015-05-26 21:57 ` Stephen Hemminger
@ 2015-05-28 19:32 ` Dumitrescu, Cristian
2015-05-28 21:41 ` Stephen Hemminger
0 siblings, 1 reply; 18+ messages in thread
From: Dumitrescu, Cristian @ 2015-05-28 19:32 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: dev
> -----Original Message-----
> From: Stephen Hemminger [mailto:stephen@networkplumber.org]
> Sent: Tuesday, May 26, 2015 10:58 PM
> To: Dumitrescu, Cristian
> Cc: Gajdzica, MaciejX T; dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH v3 01/10] table: added structure for storing
> table stats
>
> On Tue, 26 May 2015 21:40:42 +0000
> "Dumitrescu, Cristian" <cristian.dumitrescu@intel.com> wrote:
>
> >
> >
> > > -----Original Message-----
> > > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Stephen
> > > Hemminger
> > > Sent: Tuesday, May 26, 2015 3:58 PM
> > > To: Gajdzica, MaciejX T
> > > Cc: dev@dpdk.org
> > > Subject: Re: [dpdk-dev] [PATCH v3 01/10] table: added structure for
> storing
> > > table stats
> > >
> > > On Tue, 26 May 2015 14:39:38 +0200
> > > Maciej Gajdzica <maciejx.t.gajdzica@intel.com> wrote:
> > >
> > > > +
> > > > /** 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 */
> > > > };
> > >
> > > Another good idea, which is an ABI change.
> >
> > This is simply adding a new API function, this is not changing any function
> prototype. There is no change required in the map file of this library. Is there
> anything we should have done and we did not do?
> >
>
> But if I built an external set of code which had rte_table_ops (don't worry I
> haven't)
> and that binary ran with the new definition, the core code it table would
> reference
> outside the (old version) of rte_table_ops structure and find garbage.
This is just adding a new field at the end of an API data structure. Based on input from multiple people and after reviewing the rules listed on http://dpdk.org/doc/guides/rel_notes/abi.html , I think this is an acceptable change. There are other patches in flight on this mailing list that are in the same situation. Any typical/well behaved application will not break due to this change.
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [dpdk-dev] [PATCH v3 01/10] table: added structure for storing table stats
2015-05-28 19:32 ` Dumitrescu, Cristian
@ 2015-05-28 21:41 ` Stephen Hemminger
0 siblings, 0 replies; 18+ messages in thread
From: Stephen Hemminger @ 2015-05-28 21:41 UTC (permalink / raw)
To: Dumitrescu, Cristian; +Cc: dev
On Thu, 28 May 2015 19:32:32 +0000
"Dumitrescu, Cristian" <cristian.dumitrescu@intel.com> wrote:
> This is just adding a new field at the end of an API data structure. Based on input from multiple people and after reviewing the rules listed on http://dpdk.org/doc/guides/rel_notes/abi.html , I think this is an acceptable change. There are other patches in flight on this mailing list that are in the same situation. Any typical/well behaved application will not break due to this change.
Expanding a structure can be okay but:
1. The allocation will have to always take within the library.
If you let application put structure on stack or allocate on it's own, the ABI would break.
2. The structure must not be used as a return by reference.
For example, this would break if sizeof(struct my_stats) changed.
void foo() {
struct my_stats stats;
int i_will_get_clobbered;
...
rte_dpdk_get_stats(obj, &stats)
}
^ permalink raw reply [flat|nested] 18+ messages in thread
end of thread, other threads:[~2015-05-28 21:41 UTC | newest]
Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-26 12:39 [dpdk-dev] [PATCH v3 00/10] table: added table statistics Maciej Gajdzica
2015-05-26 12:39 ` [dpdk-dev] [PATCH v3 01/10] table: added structure for storing table stats Maciej Gajdzica
2015-05-26 14:57 ` Stephen Hemminger
2015-05-26 21:40 ` Dumitrescu, Cristian
2015-05-26 21:57 ` Stephen Hemminger
2015-05-28 19:32 ` Dumitrescu, Cristian
2015-05-28 21:41 ` Stephen Hemminger
2015-05-26 22:03 ` Chris Wright
2015-05-26 12:39 ` [dpdk-dev] [PATCH v3 02/10] table: added acl " Maciej Gajdzica
2015-05-26 12:39 ` [dpdk-dev] [PATCH v3 03/10] table: added array " Maciej Gajdzica
2015-05-26 12:39 ` [dpdk-dev] [PATCH v3 04/10] table: added hash_ext " Maciej Gajdzica
2015-05-26 12:39 ` [dpdk-dev] [PATCH v3 05/10] table: added hash_key16 " Maciej Gajdzica
2015-05-26 12:39 ` [dpdk-dev] [PATCH v3 06/10] table: added hash_key32 " Maciej Gajdzica
2015-05-26 12:39 ` [dpdk-dev] [PATCH v3 07/10] table: added hash_key8 " Maciej Gajdzica
2015-05-26 12:39 ` [dpdk-dev] [PATCH v3 08/10] table: added hash_lru " Maciej Gajdzica
2015-05-26 12:39 ` [dpdk-dev] [PATCH v3 09/10] table: added lpm_ipv6 " Maciej Gajdzica
2015-05-26 12:39 ` [dpdk-dev] [PATCH v3 10/10] table: added lpm " Maciej Gajdzica
2015-05-26 13:39 ` [dpdk-dev] [PATCH v3 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).