From patchwork Fri Jun 19 10:28:34 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maciej Gajdzica X-Patchwork-Id: 5577 Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id 3EAD6C7CA; Fri, 19 Jun 2015 12:28:14 +0200 (CEST) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id 4471DC7C0 for ; Fri, 19 Jun 2015 12:28:12 +0200 (CEST) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga103.jf.intel.com with ESMTP; 19 Jun 2015 03:28:11 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.13,643,1427785200"; d="scan'208";a="749559564" Received: from unknown (HELO stargo) ([10.217.248.233]) by orsmga002.jf.intel.com with SMTP; 19 Jun 2015 03:28:10 -0700 Received: by stargo (sSMTP sendmail emulation); Fri, 19 Jun 2015 12:28:56 +0200 From: Maciej Gajdzica To: dev@dpdk.org Date: Fri, 19 Jun 2015 12:28:34 +0200 Message-Id: <1434709724-4574-2-git-send-email-maciejx.t.gajdzica@intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1434709724-4574-1-git-send-email-maciejx.t.gajdzica@intel.com> References: <1434709724-4574-1-git-send-email-maciejx.t.gajdzica@intel.com> Subject: [dpdk-dev] [PATCH v5 01/11] table: added structure for storing table stats and config option X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Added common structure for table statistics. Added config option to enable table stats collecting. Signed-off-by: Maciej Gajdzica --- 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