From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id 02131CAE4 for ; Thu, 30 Apr 2015 14:09:31 +0200 (CEST) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga103.jf.intel.com with ESMTP; 30 Apr 2015 05:09:13 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.11,676,1422950400"; d="scan'208";a="687981331" Received: from unknown (HELO Sent) ([10.217.248.194]) by orsmga001.jf.intel.com with SMTP; 30 Apr 2015 05:09:10 -0700 Received: by Sent (sSMTP sendmail emulation); Thu, 30 Apr 2015 14:08:27 +0116 From: Michal Jastrzebski To: dev@dpdk.org Date: Thu, 30 Apr 2015 14:07:20 +0200 Message-Id: <1430395652-6852-2-git-send-email-michalx.k.jastrzebski@intel.com> X-Mailer: git-send-email 2.1.1 In-Reply-To: <1430395652-6852-1-git-send-email-michalx.k.jastrzebski@intel.com> References: <1430395652-6852-1-git-send-email-michalx.k.jastrzebski@intel.com> Subject: [dpdk-dev] [PATCH v2 01/13] port: added structures for port stats 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: , X-List-Received-Date: Thu, 30 Apr 2015 12:09:32 -0000 From: Maciej Gajdzica Added common data structures for port statistics. Signed-off-by: Maciej Gajdzica --- lib/librte_port/rte_port.h | 60 ++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 55 insertions(+), 5 deletions(-) diff --git a/lib/librte_port/rte_port.h b/lib/librte_port/rte_port.h index d84e5a1..ab433e5 100644 --- a/lib/librte_port/rte_port.h +++ b/lib/librte_port/rte_port.h @@ -81,6 +81,12 @@ extern "C" { Cannot be changed. */ #define RTE_PORT_IN_BURST_SIZE_MAX 64 +/** Input port statistics */ +struct rte_port_in_stats { + uint64_t n_pkts_in; + uint64_t n_pkts_drop; +}; + /** * Input port create * @@ -120,17 +126,42 @@ typedef int (*rte_port_in_op_rx)( struct rte_mbuf **pkts, uint32_t n_pkts); +/** + * Input port stats get + * + * @param port + * Handle to output port instance + * @param stats + * Handle to port_in 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_port_in_op_stats_read)( + void *port, + struct rte_port_in_stats *stats, + int clear); + /** Input port interface defining the input port operation */ struct rte_port_in_ops { rte_port_in_op_create f_create; /**< Create */ rte_port_in_op_free f_free; /**< Free */ rte_port_in_op_rx f_rx; /**< Packet RX (packet burst) */ + rte_port_in_op_stats_read f_stats; /**< Stats */ }; /* * Port OUT * */ +/** Output port statistics */ +struct rte_port_out_stats { + uint64_t n_pkts_in; + uint64_t n_pkts_drop; +}; + /** * Output port create * @@ -197,13 +228,32 @@ typedef int (*rte_port_out_op_tx_bulk)( */ typedef int (*rte_port_out_op_flush)(void *port); +/** + * Output port stats read + * + * @param port + * Handle to output port instance + * @param stats + * Handle to port_out 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_port_out_op_stats_read)( + void *port, + struct rte_port_out_stats *stats, + int clear); + /** Output port interface defining the output port operation */ struct rte_port_out_ops { - rte_port_out_op_create f_create; /**< Create */ - rte_port_out_op_free f_free; /**< Free */ - rte_port_out_op_tx f_tx; /**< Packet TX (single packet) */ - rte_port_out_op_tx_bulk f_tx_bulk; /**< Packet TX (packet burst) */ - rte_port_out_op_flush f_flush; /**< Flush */ + rte_port_out_op_create f_create; /**< Create */ + rte_port_out_op_free f_free; /**< Free */ + rte_port_out_op_tx f_tx; /**< Packet TX (single packet) */ + rte_port_out_op_tx_bulk f_tx_bulk; /**< Packet TX (packet burst) */ + rte_port_out_op_flush f_flush; /**< Flush */ + rte_port_out_op_stats_read f_stats; /**< Stats */ }; #ifdef __cplusplus -- 1.7.9.5