From patchwork Fri Oct 23 11:31:10 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Uvarov X-Patchwork-Id: 55479 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lf0-f72.google.com (mail-lf0-f72.google.com [209.85.215.72]) by patches.linaro.org (Postfix) with ESMTPS id 24E1622A9D for ; Fri, 23 Oct 2015 11:31:37 +0000 (UTC) Received: by lffz202 with SMTP id z202sf47323494lff.3 for ; Fri, 23 Oct 2015 04:31:36 -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=qM6pKfGUBADMO2T7QRFV9AE8nAzmGLGcrtRMD4OPZsA=; b=UPHTJoI5dM/oHNWGfCeYvBT/94r08frUdm34Ox2vRFhkTLkk33KP1WAm/IdCaTBBY3 5N1uEHlhD6R7rkzXkGW4+Jh1Q80gJV7hL+8+JWCMAf0ImO0Mhvu8sr9Kn4CMLBicLypT ykiWbvzs6EmzrFZikt+HPjiWYpDYilaAaP9Um1WzCxPx5X/PPJupJvfTuhci9JV4gxuX GeIT1EoAK2KmAj3lnGv3Fbo8kbss5ARMxthjcsiYgsA3aqABlVq+tar6zlLpUo5hC4pl UYHfSimz/VOv68RltPKHz7luWFMhfzmDhcpYStDVb9v5aRy9lfjoHH3i2oqeIuU6x5Gu E1UQ== X-Gm-Message-State: ALoCoQnOHn4N5tG0Q8hVKqYYNiyDW1CmWB3FK6Jl2DhZbBR2ie0WErHqfpvrvj2rL4HJfEhjMmiP X-Received: by 10.180.109.129 with SMTP id hs1mr761158wib.1.1445599896015; Fri, 23 Oct 2015 04:31:36 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.25.18.90 with SMTP id h87ls440759lfi.9.gmail; Fri, 23 Oct 2015 04:31:35 -0700 (PDT) X-Received: by 10.25.166.140 with SMTP id p134mr2748023lfe.114.1445599895854; Fri, 23 Oct 2015 04:31:35 -0700 (PDT) Received: from mail-lf0-x229.google.com (mail-lf0-x229.google.com. [2a00:1450:4010:c07::229]) by mx.google.com with ESMTPS id 76si12399619lfy.91.2015.10.23.04.31.35 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 23 Oct 2015 04:31:35 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2a00:1450:4010:c07::229 as permitted sender) client-ip=2a00:1450:4010:c07::229; Received: by lfaz124 with SMTP id z124so80097654lfa.1 for ; Fri, 23 Oct 2015 04:31:35 -0700 (PDT) X-Received: by 10.112.64.72 with SMTP id m8mr10517502lbs.41.1445599895732; Fri, 23 Oct 2015 04:31:35 -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.59.35 with SMTP id w3csp1165707lbq; Fri, 23 Oct 2015 04:31:34 -0700 (PDT) X-Received: by 10.107.11.24 with SMTP id v24mr23696369ioi.184.1445599893639; Fri, 23 Oct 2015 04:31:33 -0700 (PDT) Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id j204si15232915ioe.84.2015.10.23.04.31.31; Fri, 23 Oct 2015 04:31:33 -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 23C0161B4C; Fri, 23 Oct 2015 11:31:30 +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.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, T_DKIM_INVALID, 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 36C3761B67; Fri, 23 Oct 2015 11:31:23 +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 5CFA261B54; Fri, 23 Oct 2015 11:31:21 +0000 (UTC) Received: from mail-lf0-f52.google.com (mail-lf0-f52.google.com [209.85.215.52]) by lists.linaro.org (Postfix) with ESMTPS id 17AFE61B3C for ; Fri, 23 Oct 2015 11:31:20 +0000 (UTC) Received: by lfaz124 with SMTP id z124so80090316lfa.1 for ; Fri, 23 Oct 2015 04:31:18 -0700 (PDT) X-Received: by 10.112.13.98 with SMTP id g2mr11034929lbc.18.1445599878754; Fri, 23 Oct 2015 04:31:18 -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 rf8sm3165988lbb.20.2015.10.23.04.31.17 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 23 Oct 2015 04:31:17 -0700 (PDT) From: Maxim Uvarov To: lng-odp@lists.linaro.org Date: Fri, 23 Oct 2015 14:31:10 +0300 Message-Id: <1445599870-19838-1-git-send-email-maxim.uvarov@linaro.org> X-Mailer: git-send-email 1.9.1 X-Topics: patch Subject: [lng-odp] [API-NEXT PATCHv6] 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-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 2a00:1450:4010:c07::229 as permitted sender) smtp.mailfrom=patch+caf_=patchwork-forward=linaro.org@linaro.org; dkim=neutral (body hash did not verify) header.i=@linaro_org.20150623.gappssmtp.com Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 Signed-off-by: Maxim Uvarov --- v6: fix Petris comments include/odp/api/packet_io.h | 2 + include/odp/api/packet_io_stats.h | 141 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 143 insertions(+) create mode 100644 include/odp/api/packet_io_stats.h diff --git a/include/odp/api/packet_io.h b/include/odp/api/packet_io.h index 3479af1..ca8777c 100644 --- a/include/odp/api/packet_io.h +++ b/include/odp/api/packet_io.h @@ -18,6 +18,8 @@ extern "C" { #endif +#include + /** @defgroup odp_packet_io ODP PACKET IO * Operations on a packet Input/Output interface. * diff --git a/include/odp/api/packet_io_stats.h b/include/odp/api/packet_io_stats.h new file mode 100644 index 0000000..148ad8d --- /dev/null +++ b/include/odp/api/packet_io_stats.h @@ -0,0 +1,141 @@ +/* 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 + +/** @addtogroup odp_packet_io + * @{ + */ + +/** + * Packet IO statistics + * + * Packet IO statictics counters follow RFCs for Management Information Base + * (MIB)for use with network management protocols in the Internet community: + * https://tools.ietf.org/html/rfc3635 + * https://tools.ietf.org/html/rfc2863 + * https://tools.ietf.org/html/rfc2819 + */ +typedef struct odp_pktio_stats_t { + /** + * The number of octets in valid MAC frames received on this interface, + * including the MAC header and FCS. See ifHCInOctets counter + * description in RFC 3635 for details. + */ + uint64_t in_octets; + + /** + * The number of packets, delivered by this sub-layer to a higher + * (sub-)layer, which were not addressed to a multicast or broadcast + * address at this sub-layer. See ifHCInUcastPkts in RFC 2863, RFC 3635. + */ + uint64_t in_ucast_pkts; + + /** + * The number of inbound packets which were chosen to be discarded + * even though no errors had been detected to preven their being + * deliverable to a higher-layer protocol. One possible reason for + * discarding such a packet could be to free up buffer space. + * See ifInDiscards in RFC 2863. + */ + uint64_t in_discards; + + /** + * The sum for this interface of AlignmentErrors, FCSErrors, FrameTooLongs, + * InternalMacReceiveErrors. See ifInErrors in RFC 3635. + */ + uint64_t in_errors; + + /** + * For packet-oriented interfaces, the number of packets received via + * the interface which were discarded because of an unknown or + * unsupported protocol. For character-oriented or fixed-length + * interfaces that support protocol multiplexing the number of + * transmission units received via the interface which were discarded + * because of an unknown or unsupported protocol. For any interface + * that does not support protocol multiplexing, this counter will always + * be 0. See ifInUnknownProtos in RFC 2863, RFC 3635. + */ + uint64_t in_unknown_protos; + + /** + * The number of octets transmitted in valid MAC frames on this + * interface, including the MAC header and FCS. This does include + * the number of octets in valid MAC Control frames transmitted on + * this interface. See ifHCOutOctets in RFC 3635. + */ + uint64_t out_octets; + + /** + * The total number of packets that higher-level protocols requested + * be transmitted, and which were not addressed to a multicast or + * broadcast address at this sub-layer, including those that were + * discarded or not sent. does not include MAC Control frames. + * See ifHCOutUcastPkts RFC 2863, 3635. + */ + uint64_t out_ucast_pkts; + + /** + * The number of outbound packets which were chosen to be discarded + * even though no errors had been detected to prevent their being + * transmitted. One possible reason for discarding such a packet could + * be to free up buffer space. See OutDiscards in RFC 2863. + */ + uint64_t out_discards; + + /** + * The sum for this interface of SQETestErrors, LateCollisions, + * ExcessiveCollisions, InternalMacTransmitErrors and + * CarrierSenseErrors. See ifOutErrors in RFC 3635. + */ + uint64_t out_errors; +} odp_pktio_stats_t; + +/** + * Get statistics for pktio handle + * + * @param pktio Packet IO handle + * @param[out] stats Output buffer for counters + * @retval 0 on success + * @retval <0 on failure + * + * @note: If counter is not supported by platform it has + * to be set to 0. + */ +int odp_pktio_stats(odp_pktio_t pktio, + odp_pktio_stats_t *stats); + +/** + * Reset statistics for pktio handle + * + * Reset all pktio counters to 0. + * @param pktio Packet IO handle + * @retval 0 on success + * @retval <0 on failure + * + */ +int odp_pktio_stats_reset(odp_pktio_t pktio); + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif