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 32A9CA0589; Fri, 27 Mar 2020 11:32:22 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id EAAA11C1A4; Fri, 27 Mar 2020 11:29:45 +0100 (CET) Received: from mail-lj1-f193.google.com (mail-lj1-f193.google.com [209.85.208.193]) by dpdk.org (Postfix) with ESMTP id E15B51C0CB for ; Fri, 27 Mar 2020 11:29:35 +0100 (CET) Received: by mail-lj1-f193.google.com with SMTP id i20so9633476ljn.6 for ; Fri, 27 Mar 2020 03:29:35 -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=CUokLl9P44Co5oTDPqz/JzoBAxLSE1S9K05SI5KDHm4=; b=MDn1Bgidg7ctRPEcYXoIcGnt/1RW+I/PBSqDFa3HBQWuyhEouQqWaDjArGKXDzpTUo jI/c5/+tln/5JxdSlTjU9VNFWFKCcfbEU4Fw9s4v3LkhPgbJ5ifEjrzE3e5Z/fKgaDfF s7JHZaNSbTfat9o5noqcSPPXh6w5y1aaHHoiYaTtf/GLGAoMNiaatv0ZoAiqYGXZl7qV myF3yh/WZcKB1bUkWAsdPHzVN3091TzenOuS6/SUiqyl0MU2WTc55pSQLzbPv9FtOatI k9f+kRrI6qrgdeIUWA9CxPgu/gF3H9pzMY1zwFmLBmlzJcg5BOZh/M5jPcuOEnSaVaLF juIw== 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=CUokLl9P44Co5oTDPqz/JzoBAxLSE1S9K05SI5KDHm4=; b=LPVTiYptL6q4W9t+sZyWxd3kfr2trpmlOe7mBBvg5lQG/33fOdHPUjY7Y8Mgq3iGX+ OySvDyVXunJ8w9hKLgjCaU40axtKtKPzrW8m1axOtvpFngFuyZd9KVRtv7sHwwQArhN/ TTvLeaBbMT/UoXEJ7uKb7kBB56fUJ4f8upatoHekaoDnVwPpQocqX1kdNcEPPb0cUoNC h1tQDg0G+24agC8ir0+xxwgSE7nRl19DZKLvaTg83rr+i5972DxRx7jEHG2Hy8Q87PsR aeCR2DMy6qP3W9WSN89atbfkG6+gl404cFEktqioRTFvckLNdWk68VUUxxynz04MMkDC MdFA== X-Gm-Message-State: AGi0PuZ9HkT2+cRvWoIwJqQK2D/G6uPZmLdLkQBaDHGpMMBIf8+O4R4j 7Zak/plBRHjOk2cDBeiDiofk3eGjq9r3+g== X-Google-Smtp-Source: APiQypI/LF3ABc2ZSnAobQFi2R2Yrrn8QEFZ1r7KufXoYKmffliMP0hzcJixrj9awz+DNDwu2OwMQA== X-Received: by 2002:a2e:9710:: with SMTP id r16mr4792315lji.109.1585304975232; Fri, 27 Mar 2020 03:29:35 -0700 (PDT) Received: from localhost.localdomain (193-106-246-138.noc.fibertech.net.pl. [193.106.246.138]) by smtp.gmail.com with ESMTPSA id i11sm2789587lfo.84.2020.03.27.03.29.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Mar 2020 03:29:34 -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: Fri, 27 Mar 2020 11:18:13 +0100 Message-Id: <20200327101823.12646-20-mk@semihalf.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200327101823.12646-1-mk@semihalf.com> References: <20200327101823.12646-1-mk@semihalf.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH 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 19a43400d5..52eac0f1b9 100644 --- a/drivers/net/ena/ena_ethdev.c +++ b/drivers/net/ena/ena_ethdev.c @@ -92,6 +92,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[] = { @@ -925,7 +926,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, @@ -959,7 +960,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); @@ -2715,12 +2716,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 99d1fba64d..a7f87eddc3 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