From patchwork Mon Jun 8 15:00:06 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Jastrzebski X-Patchwork-Id: 5303 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 026F9C32C; Mon, 8 Jun 2015 17:03:00 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 98E2DC32C for ; Mon, 8 Jun 2015 17:02:58 +0200 (CEST) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga101.fm.intel.com with ESMTP; 08 Jun 2015 08:01:38 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.13,574,1427785200"; d="scan'208";a="743025326" Received: from unknown (HELO Sent) ([10.217.248.178]) by orsmga002.jf.intel.com with SMTP; 08 Jun 2015 08:01:25 -0700 Received: by Sent (sSMTP sendmail emulation); Mon, 08 Jun 2015 17:01:24 +0116 From: Michal Jastrzebski To: dev@dpdk.org Date: Mon, 8 Jun 2015 17:00:06 +0200 Message-Id: <1433775616-6896-16-git-send-email-michalx.k.jastrzebski@intel.com> X-Mailer: git-send-email 2.1.1 In-Reply-To: <1433775616-6896-1-git-send-email-michalx.k.jastrzebski@intel.com> References: <1433775616-6896-1-git-send-email-michalx.k.jastrzebski@intel.com> Subject: [dpdk-dev] [PATCH v4 01/10] 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" From: Maciej Gajdzica 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 1d26956..68d5110 100644 --- a/config/common_bsdapp +++ b/config/common_bsdapp @@ -389,6 +389,7 @@ RTE_PORT_STATS_COLLECT=n # Compile librte_table # CONFIG_RTE_LIBRTE_TABLE=y +RTE_TABLE_STATS_COLLECT=n # # Compile librte_pipeline diff --git a/config/common_linuxapp b/config/common_linuxapp index 5105b25..7e9b7fa 100644 --- a/config/common_linuxapp +++ b/config/common_linuxapp @@ -396,6 +396,7 @@ RTE_PORT_STATS_COLLECT=n # Compile librte_table # CONFIG_RTE_LIBRTE_TABLE=y +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..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