From patchwork Mon Sep 7 12:43:36 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Uvarov X-Patchwork-Id: 53233 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f72.google.com (mail-la0-f72.google.com [209.85.215.72]) by patches.linaro.org (Postfix) with ESMTPS id 4E75722B06 for ; Mon, 7 Sep 2015 12:46:54 +0000 (UTC) Received: by laeb10 with SMTP id b10sf27877709lae.1 for ; Mon, 07 Sep 2015 05:46:53 -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=1ji/RfmINEo2b3ZQvUn0aBWUDymLBv7X5Jee2pD4LzQ=; b=kYMdSasPi4W4b0lkcpwE8jBEH31+YX42/lwvaxjheLDsyWoDgRz8HVEFw7wGJEXykT YZWTq1w/ZS3y6MCmLFsynDTayeY6QhWTsjs50Uld0NwB8noI50YXoxYEyM8dbtCjv69E FEDG2YwQ48xY8uVTZTBFvjxANd+exEgdaCHf8b+1piHEJQDELyfng9KcSltU8KDyUptd iwtOM4BD4Z0KHP1OQelbk7PjOUOH5qphAP3GzDpWUKEXrmiZXZY/REvLJLVC6yH9L1Fa +2zUrC0Iu0m2C0XcV4DRfsfxfLdhziOge7Z8KyQgBWjPmbpZpUqp7v4kLyPjGh2BWjor /U3Q== X-Gm-Message-State: ALoCoQkNExfGAR+bS3vVJDR0Vdmqh65hlhyminWTl401YbHSI+WXa/NgnWOHMGiL7+U+Tq7LDXM/ X-Received: by 10.112.189.105 with SMTP id gh9mr4970565lbc.16.1441630013333; Mon, 07 Sep 2015 05:46:53 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.27.8 with SMTP id p8ls286552lag.29.gmail; Mon, 07 Sep 2015 05:46:53 -0700 (PDT) X-Received: by 10.152.204.108 with SMTP id kx12mr9662366lac.20.1441630013183; Mon, 07 Sep 2015 05:46:53 -0700 (PDT) Received: from mail-la0-f47.google.com (mail-la0-f47.google.com. [209.85.215.47]) by mx.google.com with ESMTPS id z4si10296073lal.167.2015.09.07.05.46.53 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 07 Sep 2015 05:46:53 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.47 as permitted sender) client-ip=209.85.215.47; Received: by lanb10 with SMTP id b10so50975185lan.3 for ; Mon, 07 Sep 2015 05:46:53 -0700 (PDT) X-Received: by 10.152.5.228 with SMTP id v4mr16826330lav.36.1441630013045; Mon, 07 Sep 2015 05:46:53 -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 w3csp357747lbq; Mon, 7 Sep 2015 05:46:52 -0700 (PDT) X-Received: by 10.140.238.208 with SMTP id j199mr27986208qhc.65.1441630012035; Mon, 07 Sep 2015 05:46:52 -0700 (PDT) Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id j88si13619339qga.26.2015.09.07.05.46.51; Mon, 07 Sep 2015 05:46:52 -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 EC09161987; Mon, 7 Sep 2015 12:46:50 +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 2ABF761847; Mon, 7 Sep 2015 12:45:32 +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 1C5486184A; Mon, 7 Sep 2015 12:45:28 +0000 (UTC) Received: from mail-la0-f41.google.com (mail-la0-f41.google.com [209.85.215.41]) by lists.linaro.org (Postfix) with ESMTPS id 4FF03606D0 for ; Mon, 7 Sep 2015 12:43:42 +0000 (UTC) Received: by laeb10 with SMTP id b10so51841543lae.1 for ; Mon, 07 Sep 2015 05:43:41 -0700 (PDT) X-Received: by 10.112.55.105 with SMTP id r9mr16892714lbp.89.1441629821120; Mon, 07 Sep 2015 05:43:41 -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 h7sm3051061lbl.8.2015.09.07.05.43.40 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 07 Sep 2015 05:43:40 -0700 (PDT) From: Maxim Uvarov To: lng-odp@lists.linaro.org Date: Mon, 7 Sep 2015 15:43:36 +0300 Message-Id: <1441629816-12209-1-git-send-email-maxim.uvarov@linaro.org> X-Mailer: git-send-email 1.9.1 X-Topics: patch Subject: [lng-odp] [NEXT PATCHv3] 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.47 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 --- v3: - reduce number of counters; v2: - add function to check supported cnts; - add optional functio to reset cnts; include/odp/api/packet_io_stats.h | 94 ++++++++++++++++++++++++++ platform/linux-generic/include/odp/packet_io.h | 1 + 2 files changed, 95 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..0faf15b --- /dev/null +++ b/include/odp/api/packet_io_stats.h @@ -0,0 +1,94 @@ +/* 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_length_errors; /**< bad packets length */ + uint64_t rx_over_errors; /**< receiver 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_packets; /**< total packets transmitted */ +} 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 }