From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf1-f65.google.com (mail-lf1-f65.google.com [209.85.167.65]) by dpdk.org (Postfix) with ESMTP id 210B332A5 for ; Wed, 19 Sep 2018 17:01:46 +0200 (CEST) Received: by mail-lf1-f65.google.com with SMTP id z186-v6so5434605lfa.5 for ; Wed, 19 Sep 2018 08:01:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=8BG5lY0ZJR/mvPH9rbDHGSXAGyifldtfP6qCbRK1MxE=; b=xP46B37JkZ/5dJEU/5YuKyjJfFhWZC4DKkxmstdX4O4JSF9gpTdUfUtSDw3upuRRCn y7GPe3uNeKfAWpqZh/Vv/pP8Mc929Uku+h7yAvt8aHBe+lyYoigfepcVpWda0s+WTvxD Xk8Llj6K5SM8j8OE3bSPaUSk0lVKHTwRh7mRxqVHy+g9qiGG0tLIoDeotQTfuW8mjqYZ 0OP+WODUaB5CDpTrA5GGxhcDepXdlm19MJf1mhbhZVasw7wqASW0p3nyoSYN9mbYqB8H AZ+k4WMqDbwOpfhgbQPhHJE0fmsZZtv2pgXwfRYzZvN9Jef9yxgKlmY53WTClTx5bzyi pp7w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=8BG5lY0ZJR/mvPH9rbDHGSXAGyifldtfP6qCbRK1MxE=; b=H3K4N7a83jQ+81BCk1f0urkrjXDVf2rcmu+M7diNjjdKkMVFzURUBca0l8CTAldgaC smdhe5qXrOAtsNaQ6o1heVq1sqoV9cRF7pevGYds97ox5TjVKMoiZxdj17IZGZSOE1Zd iuevZccPF8THB/6D37kQMfGdhN9OZ52UUBnAErkEXWyJBXJbBv3UoIXVDvwHqcsOMZYn WelzO13TMwyKxl96U3W8kGyFOtT/VOc5yIuf2QdWmec20Y8NFcTplH+J4B5RUs0j8NNN ADwZfyPdIpX6C7u1IlCSfQsbnBnguO+Cz9+LAzVuxubm9fLwF8qEJZnSPeQ0WOgEWJrR +EuQ== X-Gm-Message-State: APzg51BbKnu3N5JkVOWpbTzWdKJDFSDBmJgL7eYIt9SqvH1ZheK7lw2e DWNTB+Gn+zTrf9gRCTzAvLFsHPkYVJE= X-Google-Smtp-Source: ANB0VdY0UTWMBQJpT4Uq0NPsBGVsX5lTEe1wcZ+8vSvLdeY8Z83txdUwA5/ATpCZ1Aw2AyDa86/CVA== X-Received: by 2002:a19:5f54:: with SMTP id a20-v6mr22612028lfj.42.1537369305505; Wed, 19 Sep 2018 08:01:45 -0700 (PDT) Received: from amok.semihalf.local (31-172-191-173.noc.fibertech.net.pl. [31.172.191.173]) by smtp.googlemail.com with ESMTPSA id z3-v6sm1107711lfj.89.2018.09.19.08.01.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 19 Sep 2018 08:01:44 -0700 (PDT) From: Andrzej Ostruszka To: dev@dpdk.org Cc: mw@semihalf.com, zr@semihalf.com, tdu@semihalf.com, nadavh@marvell.com Date: Wed, 19 Sep 2018 17:01:33 +0200 Message-Id: <1537369294-17099-8-git-send-email-amo@semihalf.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1537369294-17099-1-git-send-email-amo@semihalf.com> References: <1535720386-18775-1-git-send-email-amo@semihalf.com> <1537369294-17099-1-git-send-email-amo@semihalf.com> Subject: [dpdk-dev] [PATCH v4 7/8] net/mvneta: add support for basic stats X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Sep 2018 15:01:46 -0000 From: Zyta Szpak Add support for getting of basic statistics for the driver. Signed-off-by: Yelena Krivosheev Signed-off-by: Natalie Samsonov Signed-off-by: Zyta Szpak --- doc/guides/nics/features/mvneta.ini | 1 + doc/guides/nics/mvneta.rst | 1 + drivers/net/mvneta/mvneta_ethdev.c | 47 +++++++++++++++++++++++++++++++++++++ 3 files changed, 49 insertions(+) diff --git a/doc/guides/nics/features/mvneta.ini b/doc/guides/nics/features/mvneta.ini index 59c9c36..701eb03 100644 --- a/doc/guides/nics/features/mvneta.ini +++ b/doc/guides/nics/features/mvneta.ini @@ -14,5 +14,6 @@ CRC offload = Y L3 checksum offload = Y L4 checksum offload = Y Packet type parsing = Y +Basic stats = Y ARMv8 = Y Usage doc = Y diff --git a/doc/guides/nics/mvneta.rst b/doc/guides/nics/mvneta.rst index b21581b..5bcf3b6 100644 --- a/doc/guides/nics/mvneta.rst +++ b/doc/guides/nics/mvneta.rst @@ -38,6 +38,7 @@ Features of the MVNETA PMD are: - L3 checksum offload - L4 checksum offload - Packet type parsing +- Basic stats Limitations diff --git a/drivers/net/mvneta/mvneta_ethdev.c b/drivers/net/mvneta/mvneta_ethdev.c index fdd6eb0..3ea1dba 100644 --- a/drivers/net/mvneta/mvneta_ethdev.c +++ b/drivers/net/mvneta/mvneta_ethdev.c @@ -691,6 +691,52 @@ mvneta_mac_addr_set(struct rte_eth_dev *dev, struct ether_addr *mac_addr) return 0; } +/** + * DPDK callback to get device statistics. + * + * @param dev + * Pointer to Ethernet device structure. + * @param stats + * Stats structure output buffer. + * + * @return + * 0 on success, negative error value otherwise. + */ +static int +mvneta_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats) +{ + struct mvneta_priv *priv = dev->data->dev_private; + struct neta_ppio_statistics ppio_stats; + unsigned int ret; + + if (!priv->ppio) + return -EPERM; + + ret = neta_ppio_get_statistics(priv->ppio, &ppio_stats); + if (unlikely(ret)) { + MVNETA_LOG(ERR, "Failed to update port statistics"); + return ret; + } + + stats->ipackets += ppio_stats.rx_packets + + ppio_stats.rx_broadcast_packets + + ppio_stats.rx_multicast_packets; + stats->opackets += ppio_stats.tx_packets + + ppio_stats.tx_broadcast_packets + + ppio_stats.tx_multicast_packets; + stats->ibytes += ppio_stats.rx_bytes; + stats->obytes += ppio_stats.tx_bytes; + stats->imissed += ppio_stats.rx_discard + + ppio_stats.rx_overrun; + + stats->ierrors = ppio_stats.rx_packets_err + + ppio_stats.rx_errors + + ppio_stats.rx_crc_error; + stats->oerrors = ppio_stats.tx_errors; + + return 0; +} + static const struct eth_dev_ops mvneta_ops = { .dev_configure = mvneta_dev_configure, .dev_start = mvneta_dev_start, @@ -705,6 +751,7 @@ static const struct eth_dev_ops mvneta_ops = { .mac_addr_add = mvneta_mac_addr_add, .mac_addr_set = mvneta_mac_addr_set, .mtu_set = mvneta_mtu_set, + .stats_get = mvneta_stats_get, .dev_infos_get = mvneta_dev_infos_get, .dev_supported_ptypes_get = mvneta_dev_supported_ptypes_get, .rxq_info_get = mvneta_rxq_info_get, -- 2.7.4