From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lj1-f195.google.com (mail-lj1-f195.google.com [209.85.208.195]) by dpdk.org (Postfix) with ESMTP id D3FC544BE for ; Mon, 1 Oct 2018 11:26:20 +0200 (CEST) Received: by mail-lj1-f195.google.com with SMTP id f8-v6so11469097ljk.1 for ; Mon, 01 Oct 2018 02:26:20 -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=zNUvjdCqXzzxi4wCZxfJEc5kU/WdD0iM90Uj7HqOPcE=; b=kJTsFvhcjNykdBck2qojHQNM5OIuTZ8b7BtobKrmiARsOMX404BZzMzGvs3bTlBNlQ YHkGn9y+NdRPcGuQ1wMF1z1DIUlQPFPxRJ6kEevbJ4QdpxfBMOrgp4IN+XCKTsRRGoxK HU98s3+HWSDSXy+U0CL18qghh9k7ZBatE8QnbcCZqIZPQqs2S39W/9SPlCUZS0mlmkxX I8JYNwafdL9DZluCFPxepf6DnmDhplYAPtO60uqvmueyL2NethJMqD3L3pfT6lBFPDEG z8Ve+QYarQnPEy/hOxM/WebvvsYx+rVq/spgEkwNuzdNa+IVJqay53I2i5ul4robhkUw E9FQ== 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=zNUvjdCqXzzxi4wCZxfJEc5kU/WdD0iM90Uj7HqOPcE=; b=SX9WL6VMg/nmpyUQx9QqEYWyK2s4m7WUFPwrDrItsvX2LuyCthhqjdH+76ZKNwGy00 g6w3upl+rj2/MXzWiotwdAsK1mm3uUNuGRUkSHw6+7wogtknYqKnuAE0mu39VBZmvJNt jMDUh1E0iEKRK1gyB6xxs5dhZOW1AvM+kzQ14/zVZAU6YDNfWFS5EfJpGroyOeEU3mYB j9in07HA43NSPT44UUuybiSgJnNj4G2o8uuO2NPIZKG5aFWxC7ZFfsj75QEWONiM/HQP qkw1hgkIr0UrXIZs1jIJHawPHO6juc/g8fPsMFHq9sID+cnHQ1fx76dTm4LZ15wa/Gc2 i6tw== X-Gm-Message-State: ABuFfoiZzgxt2fIMBtgR7M8DaohgPztD6spoWZT+z2RmLeMtCKJze3fs tHeZdwSSuEql0Pd/702EqdQ6qw85pPY3+g== X-Google-Smtp-Source: ACcGV61E0I/7Hhpp/dm45sg3mHTRCTzB84bRT0HxKcRvgd0sbscEfAHZ4yuz0nzgfSBbQnZn3oY2gg== X-Received: by 2002:a2e:84c6:: with SMTP id q6-v6mr5603302ljh.65.1538385980326; Mon, 01 Oct 2018 02:26:20 -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 s11-v6sm2666955ljj.93.2018.10.01.02.26.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 01 Oct 2018 02:26:19 -0700 (PDT) From: Andrzej Ostruszka X-Google-Original-From: Andrzej Ostruszka To: dev@dpdk.org Cc: mw@semihalf.com, nadavh@marvell.com, zr@semihalf.com, tdu@semihalf.com Date: Mon, 1 Oct 2018 11:26:09 +0200 Message-Id: <1538385970-21260-8-git-send-email-andrzej.ostruszka@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1538385970-21260-1-git-send-email-andrzej.ostruszka@gmail.com> References: <1537434339-22570-1-git-send-email-amo@semihalf.com> <1538385970-21260-1-git-send-email-andrzej.ostruszka@gmail.com> Subject: [dpdk-dev] [PATCH v6 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: Mon, 01 Oct 2018 09:26:21 -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 ece549a..97b11f6 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 6e0dc3a..6a5de2f 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