From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 3BDBEA057B; Wed, 1 Apr 2020 16:25:07 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 5DB991C0D4; Wed, 1 Apr 2020 16:22:07 +0200 (CEST) Received: from mail-lf1-f68.google.com (mail-lf1-f68.google.com [209.85.167.68]) by dpdk.org (Postfix) with ESMTP id E63B61C0CB for ; Wed, 1 Apr 2020 16:22:03 +0200 (CEST) Received: by mail-lf1-f68.google.com with SMTP id x200so13457706lff.0 for ; Wed, 01 Apr 2020 07:22:03 -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 :mime-version:content-transfer-encoding; bh=dO1Nn0Ir82+T4hZw005gto/tMetTXzKV5ZtZiOGDbSk=; b=iyB37Oljm6vAHU8IT25sNm8UYyJIly+NbOR34x1/5rKgEjEB5tGg/cC85rRQMJHWoq /IbrzWZ93cJOcQIRLtq7uGJt1H0RQX2e2jsqvWKFZsl/2OCVUDIpk8CgpJrpaFSW92uA ZSGoGjsVxrCaOExENKJcycitkuE2hOjut/nYCmwAMVyaNbKjysp98S52oNGPyNf5ruBA 5e4Ryz6BW1RQ9M/1CT/QfLVJQduj2MmZ2Iuq1ng7ZOc3nqC8N/cJD/MbjBacuTuz1Kuf jd00vS4Z9PFNy0g3LgO8YfUQepOQcA0EfTG/IQZXz6Bz+9Vw2QK1uKYV2WNXAyC1NpuL IPHg== 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:mime-version:content-transfer-encoding; bh=dO1Nn0Ir82+T4hZw005gto/tMetTXzKV5ZtZiOGDbSk=; b=VqB07AKs1O3jsnEtX9JA6u6OSSt5vY5r8VWvuftuf6WPoJioSDH9nU6TP5o1By/zDN ShYdUq1l+0fqUjltvoANU4z+GwOPmWNyIjiYDtTWmcOwmpcntCLLWsp5y6+Pr4wycaqs WaixmAn1ccbDHRy5fR6uHNUit1ObKeNx3wCZqcNpLNmdQfCQ6G7zJNZN9gXsW8Esvxmn jqSe1nRj/xvRfvi/5hd6TXuOYgVkuL6r31kjij5QtkEPkpNUtBcWyC6D+DT6VX7ewjfF 2KDSR8OE5Fby0o7nQLcL3Q2TXsmx9mIBMGaBqftYMVOzYH2I5HfkmVHLQdeP+m4scd+Z 037w== X-Gm-Message-State: AGi0PuaU0uw3OKJcZCJ+jI39b/XdP3P2r0PXy42qEI+fsNXY0EkTg1mL Zun1inYdAgPVxlXc7+FjLL77oDpe02o= X-Google-Smtp-Source: APiQypKjRA2S6uMStl3kMWt/HdqToXCv+KjaXVNWdySaCr3NT316AKM+VyMZA2bgxYLZ+wK5LpqFRQ== X-Received: by 2002:a19:c304:: with SMTP id t4mr15427810lff.177.1585750923235; Wed, 01 Apr 2020 07:22:03 -0700 (PDT) Received: from mkPC.semihalf.local (193-106-246-138.noc.fibertech.net.pl. [193.106.246.138]) by smtp.gmail.com with ESMTPSA id r21sm1435961ljp.29.2020.04.01.07.22.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Apr 2020 07:22:02 -0700 (PDT) From: Michal Krawczyk To: dev@dpdk.org Cc: mw@semihalf.com, mba@semihalf.com, gtzalik@amazon.com, evgenys@amazon.com, igorch@amazon.com, Michal Krawczyk Date: Wed, 1 Apr 2020 16:21:17 +0200 Message-Id: <20200401142127.13715-20-mk@semihalf.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200401142127.13715-1-mk@semihalf.com> References: <20200401142127.13715-1-mk@semihalf.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v2 19/29] net/ena: add Tx drops statistic 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" ENA device can report in the AENQ handler amount of Tx packets that were dropped and not sent. This statistic is showing global value for the device and because rte_eth_stats is missing field that could indicate this value (it isn't the Tx error), it is being presented as a extended statistic. As the current design of extended statistics prevents tx_drops from being an atomic variable and both tx_drops and rx_drops are only updated from the AENQ handler, both were set as non-atomic for the alignment. Signed-off-by: Michal Krawczyk Reviewed-by: Igor Chauskin Reviewed-by: Guy Tzalik --- drivers/net/ena/ena_ethdev.c | 11 ++++++++--- drivers/net/ena/ena_ethdev.h | 8 +++++++- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c index eb97c80660..b7cdc5711c 100644 --- a/drivers/net/ena/ena_ethdev.c +++ b/drivers/net/ena/ena_ethdev.c @@ -96,6 +96,7 @@ static const struct ena_stats ena_stats_global_strings[] = { ENA_STAT_GLOBAL_ENTRY(wd_expired), ENA_STAT_GLOBAL_ENTRY(dev_start), ENA_STAT_GLOBAL_ENTRY(dev_stop), + ENA_STAT_GLOBAL_ENTRY(tx_drops), }; static const struct ena_stats ena_stats_tx_strings[] = { @@ -938,7 +939,7 @@ static void ena_stats_restart(struct rte_eth_dev *dev) rte_atomic64_init(&adapter->drv_stats->ierrors); rte_atomic64_init(&adapter->drv_stats->oerrors); rte_atomic64_init(&adapter->drv_stats->rx_nombuf); - rte_atomic64_init(&adapter->drv_stats->rx_drops); + adapter->drv_stats->rx_drops = 0; } static int ena_stats_get(struct rte_eth_dev *dev, @@ -972,7 +973,7 @@ static int ena_stats_get(struct rte_eth_dev *dev, ena_stats.tx_bytes_low); /* Driver related stats */ - stats->imissed = rte_atomic64_read(&adapter->drv_stats->rx_drops); + stats->imissed = adapter->drv_stats->rx_drops; stats->ierrors = rte_atomic64_read(&adapter->drv_stats->ierrors); stats->oerrors = rte_atomic64_read(&adapter->drv_stats->oerrors); stats->rx_nombuf = rte_atomic64_read(&adapter->drv_stats->rx_nombuf); @@ -2785,12 +2786,16 @@ static void ena_keep_alive(void *adapter_data, struct ena_adapter *adapter = adapter_data; struct ena_admin_aenq_keep_alive_desc *desc; uint64_t rx_drops; + uint64_t tx_drops; adapter->timestamp_wd = rte_get_timer_cycles(); desc = (struct ena_admin_aenq_keep_alive_desc *)aenq_e; rx_drops = ((uint64_t)desc->rx_drops_high << 32) | desc->rx_drops_low; - rte_atomic64_set(&adapter->drv_stats->rx_drops, rx_drops); + tx_drops = ((uint64_t)desc->tx_drops_high << 32) | desc->tx_drops_low; + + adapter->drv_stats->rx_drops = rx_drops; + adapter->dev_stats.tx_drops = tx_drops; } /** diff --git a/drivers/net/ena/ena_ethdev.h b/drivers/net/ena/ena_ethdev.h index 0e82c894f4..9558ee072f 100644 --- a/drivers/net/ena/ena_ethdev.h +++ b/drivers/net/ena/ena_ethdev.h @@ -134,13 +134,19 @@ struct ena_driver_stats { rte_atomic64_t ierrors; rte_atomic64_t oerrors; rte_atomic64_t rx_nombuf; - rte_atomic64_t rx_drops; + u64 rx_drops; }; struct ena_stats_dev { u64 wd_expired; u64 dev_start; u64 dev_stop; + /* + * Tx drops cannot be reported as the driver statistic, because DPDK + * rte_eth_stats structure isn't providing appropriate field for that. + * As a workaround it is being published as an extended statistic. + */ + u64 tx_drops; }; struct ena_offloads { -- 2.20.1