From patchwork Fri Aug 28 12:41:03 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Uvarov X-Patchwork-Id: 52791 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f197.google.com (mail-lb0-f197.google.com [209.85.217.197]) by patches.linaro.org (Postfix) with ESMTPS id C314221569 for ; Fri, 28 Aug 2015 12:52:38 +0000 (UTC) Received: by lbck9 with SMTP id k9sf16556148lbc.0 for ; Fri, 28 Aug 2015 05:52:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:delivered-to:from:to:date :message-id:subject:precedence:list-id:list-unsubscribe:list-archive :list-post:list-help:list-subscribe:mime-version:content-type :content-transfer-encoding:errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=2CFvLw09unEgiB5Uobqn13UjHGIHhxLEycgslnXfFXc=; b=gaFT8ieG/KRppq9lCWrVCPBaE8YjneHqZ6nev0XqbWHeKxna92L90+irhD/n3/klxj +fqE9lV+82VrvLu1Uwp8ySK9F8Wr2KgSa9FUiy3Va0Ra5PkKlim2jRUJsa6yELQk5Etw bhQmX5yxFy1LRJ0YQOzqUfCW+XYqhIT0bXcv7ICV2CKedYPkx1iS+wBrGRFfcOewObR1 LxAIlcvx+r/tSzra+vqbO6tFJDqWKNnbD38zjBwt0yTZyR9br1rCyc4A5ojBa8KtmU6W xNjJ686Rn13VNJzGWSRo0MRocLuhWEMkML038TL/qHme9LgHIvtxaHWZ4D+7z5WEq870 rZ0g== X-Gm-Message-State: ALoCoQm5C1VsiJFBv9edgAVcCfpNmqe8/ceDpGvqIyN1E7BHL1o1KMrJmQPmN5kFknXMrIgEopaq X-Received: by 10.180.79.66 with SMTP id h2mr1122147wix.3.1440766357731; Fri, 28 Aug 2015 05:52:37 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.219.34 with SMTP id pl2ls16845lac.5.gmail; Fri, 28 Aug 2015 05:52:37 -0700 (PDT) X-Received: by 10.112.142.105 with SMTP id rv9mr4696589lbb.11.1440766357454; Fri, 28 Aug 2015 05:52:37 -0700 (PDT) Received: from mail-la0-f46.google.com (mail-la0-f46.google.com. [209.85.215.46]) by mx.google.com with ESMTPS id a7si5650191lbv.164.2015.08.28.05.52.37 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 28 Aug 2015 05:52:37 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.46 as permitted sender) client-ip=209.85.215.46; Received: by laboe4 with SMTP id oe4so5873123lab.0 for ; Fri, 28 Aug 2015 05:52:37 -0700 (PDT) X-Received: by 10.152.203.134 with SMTP id kq6mr4823095lac.106.1440766357094; Fri, 28 Aug 2015 05:52:37 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.151.194 with SMTP id us2csp519267lbb; Fri, 28 Aug 2015 05:52:35 -0700 (PDT) X-Received: by 10.55.214.5 with SMTP id t5mr15098942qki.66.1440766355550; Fri, 28 Aug 2015 05:52:35 -0700 (PDT) Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id j86si6717284qkh.30.2015.08.28.05.52.34; Fri, 28 Aug 2015 05:52:35 -0700 (PDT) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Received: by lists.linaro.org (Postfix, from userid 109) id EBB17619C7; Fri, 28 Aug 2015 12:52:33 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 551C361A4B; Fri, 28 Aug 2015 12:51:59 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 34B7161A4B; Fri, 28 Aug 2015 12:51:11 +0000 (UTC) Received: from mail-lb0-f181.google.com (mail-lb0-f181.google.com [209.85.217.181]) by lists.linaro.org (Postfix) with ESMTPS id D986561B43 for ; Fri, 28 Aug 2015 12:41:10 +0000 (UTC) Received: by lbcbn3 with SMTP id bn3so29226550lbc.2 for ; Fri, 28 Aug 2015 05:41:09 -0700 (PDT) X-Received: by 10.112.170.129 with SMTP id am1mr4834387lbc.116.1440765669067; Fri, 28 Aug 2015 05:41:09 -0700 (PDT) Received: from localhost.localdomain (ppp91-76-161-180.pppoe.mtu-net.ru. [91.76.161.180]) by smtp.gmail.com with ESMTPSA id g1sm1379911lam.30.2015.08.28.05.41.07 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 28 Aug 2015 05:41:08 -0700 (PDT) From: Maxim Uvarov To: lng-odp@lists.linaro.org Date: Fri, 28 Aug 2015 15:41:03 +0300 Message-Id: <1440765663-17662-1-git-send-email-maxim.uvarov@linaro.org> X-Mailer: git-send-email 1.9.1 X-Topics: patch Subject: [lng-odp] [API-NEXT PATCHv2] api: define pktio statistics api X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: maxim.uvarov@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.46 as permitted sender) smtp.mailfrom=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 Signed-off-by: Maxim Uvarov Reviewed-by: Nicolas Morey-Chaisemartin --- v2: - add function to check supported cnts; - add optional functio to reset cnts; include/odp/api/packet_io_stats.h | 101 +++++++++++++++++++++++++ platform/linux-generic/include/odp/packet_io.h | 1 + 2 files changed, 102 insertions(+) create mode 100644 include/odp/api/packet_io_stats.h diff --git a/include/odp/api/packet_io_stats.h b/include/odp/api/packet_io_stats.h new file mode 100644 index 0000000..a72008b --- /dev/null +++ b/include/odp/api/packet_io_stats.h @@ -0,0 +1,101 @@ +/* Copyright (c) 2015, Linaro Limited + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +/** + * @file + * + * ODP Packet IO + */ + +#ifndef ODP_API_PACKET_IO_STATS_H_ +#define ODP_API_PACKET_IO_STATS_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/** @defgroup odp_packet_io ODP PACKET IO + * @{ + */ + +/** + * Packet IO statistics + * + */ +typedef struct odp_pktio_stats_t { + uint64_t collisions; /**< number of collisions */ + uint64_t multicast; /**< multicast packets received */ + + uint64_t rx_bytes; /**< total bytes received */ + uint64_t rx_crc_errors; /**< received packets with crc error */ + uint64_t rx_dropped; /**< no space in buffers */ + uint64_t rx_errors; /**< bad packets received */ + uint64_t rx_fifo_errors; /**< recv'r fifo overrun */ + uint64_t rx_frame_errors; /**< recv'd frame alignment error */ + uint64_t rx_length_errors; /**< bad packets length */ + uint64_t rx_missed_errors; /**< receiver missed packet */ + uint64_t rx_over_errors; /**< receiver ring buff overflow */ + uint64_t rx_packets; /**< total packets received */ + + uint64_t tx_aborted_errors; /**< packets aborted during + transmission by a network device (e.g: + because of a medium collision) */ + uint64_t tx_bytes; /**< total bytes transmitted */ + uint64_t tx_carrier_errors; /**< not transmitted packets because of + carrier errors (e.g: physical link down) */ + uint64_t tx_dropped; /**< no resources to transmit packet*/ + uint64_t tx_errors; /**< packets transmit problems */ + uint64_t tx_fifo_errors; /**< packets transmit FIFO errors */ + uint64_t tx_heartbeat_errors; /**< packets transmitted that have been + reported as heartbeat errors */ + uint64_t tx_packets; /**< total packets transmitted */ + uint64_t tx_window_errors; /**< number of packets not successfully + transmitted due to a window collision.*/ +} odp_pktio_stats_t; + +/** + * Get supported counters for pktio handle + * + * @param pktio Packet IO handle + * @param[out] *stats Output buffer + * For each stat field: + * 0 - counter not supported. + * !0 - counter is supported . + * @retval 0 on success + * @retval <0 on failure + */ +int odp_config_pktio_stats(odp_pktio_t pktio, odp_pktio_stats_t *stat); + +/** + * Get statistics for pktio handle + * + * @param pktio Packet IO handle + * @param[out] *stats Output buffer + * @retval 0 on success + * @retval <0 on failure + */ +int odp_pktio_stats(odp_pktio_t pktio, odp_pktio_stats_t *stats); + +/** + * Reset statistics for pktio handle + * + * @param pktio Packet IO handle + * @retval 0 on success + * @retval <0 on failure + * + * @note Optional. + */ +int odp_pktio_stats_reset(odp_pktio_t pktio); + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/platform/linux-generic/include/odp/packet_io.h b/platform/linux-generic/include/odp/packet_io.h index 1d690f5..18f8e78 100644 --- a/platform/linux-generic/include/odp/packet_io.h +++ b/platform/linux-generic/include/odp/packet_io.h @@ -33,6 +33,7 @@ extern "C" { */ #include +#include #ifdef __cplusplus }