Intel-Wired-Lan Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Emil Tantilov <emil.s.tantilov@intel.com>
To: intel-wired-lan@osuosl.org
Subject: [Intel-wired-lan] [PATCH 6/9] ixgbevf: add counters for Rx page allocations
Date: Mon, 11 Dec 2017 10:37:15 -0800	[thread overview]
Message-ID: <20171211183715.21524.56950.stgit@localhost6.localdomain6> (raw)
In-Reply-To: <20171211183537.21524.10133.stgit@localhost6.localdomain6>

We already had placehloders for failed page and buffer allocations.
Added alloc_rx_page and made sure the stats are properly updated and
exposed in ethtool.

Signed-off-by: Emil Tantilov <emil.s.tantilov@intel.com>
---
 drivers/net/ethernet/intel/ixgbevf/ethtool.c      |    3 +++
 drivers/net/ethernet/intel/ixgbevf/ixgbevf.h      |    6 ++++-
 drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c |   23 ++++++++++++++++-----
 3 files changed, 25 insertions(+), 7 deletions(-)

diff --git a/drivers/net/ethernet/intel/ixgbevf/ethtool.c b/drivers/net/ethernet/intel/ixgbevf/ethtool.c
index ff9d05f..4400e49 100644
--- a/drivers/net/ethernet/intel/ixgbevf/ethtool.c
+++ b/drivers/net/ethernet/intel/ixgbevf/ethtool.c
@@ -75,6 +75,9 @@ struct ixgbe_stats {
 	IXGBEVF_STAT("tx_timeout_count", tx_timeout_count),
 	IXGBEVF_NETDEV_STAT(multicast),
 	IXGBEVF_STAT("rx_csum_offload_errors", hw_csum_rx_error),
+	IXGBEVF_STAT("alloc_rx_page", alloc_rx_page),
+	IXGBEVF_STAT("alloc_rx_page_failed", alloc_rx_page_failed),
+	IXGBEVF_STAT("alloc_rx_buff_failed", alloc_rx_buff_failed),
 };
 
 #define IXGBEVF_QUEUE_STATS_LEN ( \
diff --git a/drivers/net/ethernet/intel/ixgbevf/ixgbevf.h b/drivers/net/ethernet/intel/ixgbevf/ixgbevf.h
index c70a789..f695242 100644
--- a/drivers/net/ethernet/intel/ixgbevf/ixgbevf.h
+++ b/drivers/net/ethernet/intel/ixgbevf/ixgbevf.h
@@ -84,6 +84,7 @@ struct ixgbevf_tx_queue_stats {
 struct ixgbevf_rx_queue_stats {
 	u64 alloc_rx_page_failed;
 	u64 alloc_rx_buff_failed;
+	u64 alloc_rx_page;
 	u64 csum_err;
 };
 
@@ -295,8 +296,9 @@ struct ixgbevf_adapter {
 	u64 hw_csum_rx_error;
 	u64 hw_rx_no_dma_resources;
 	int num_msix_vectors;
-	u32 alloc_rx_page_failed;
-	u32 alloc_rx_buff_failed;
+	u64 alloc_rx_page_failed;
+	u64 alloc_rx_buff_failed;
+	u64 alloc_rx_page;
 
 	struct msix_entry *msix_entries;
 
diff --git a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
index ae2402d..350afec 100644
--- a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
+++ b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
@@ -604,7 +604,7 @@ static bool ixgbevf_alloc_mapped_page(struct ixgbevf_ring *rx_ring,
 	if (dma_mapping_error(rx_ring->dev, dma)) {
 		__free_page(page);
 
-		rx_ring->rx_stats.alloc_rx_buff_failed++;
+		rx_ring->rx_stats.alloc_rx_page_failed++;
 		return false;
 	}
 
@@ -612,6 +612,7 @@ static bool ixgbevf_alloc_mapped_page(struct ixgbevf_ring *rx_ring,
 	bi->page = page;
 	bi->page_offset = 0;
 	bi->pagecnt_bias = 1;
+	rx_ring->rx_stats.alloc_rx_page++;
 
 	return true;
 }
@@ -963,8 +964,10 @@ static int ixgbevf_clean_rx_irq(struct ixgbevf_q_vector *q_vector,
 		skb = ixgbevf_fetch_rx_buffer(rx_ring, rx_desc, skb);
 
 		/* exit if we failed to retrieve a buffer */
-		if (!skb)
+		if (!skb) {
+			rx_ring->rx_stats.alloc_rx_buff_failed++;
 			break;
+		}
 
 		cleaned_count++;
 
@@ -2749,6 +2752,8 @@ static int ixgbevf_sw_init(struct ixgbevf_adapter *adapter)
 void ixgbevf_update_stats(struct ixgbevf_adapter *adapter)
 {
 	struct ixgbe_hw *hw = &adapter->hw;
+	u64 alloc_rx_page_failed = 0, alloc_rx_buff_failed = 0;
+	u64 alloc_rx_page = 0, hw_csum_rx_error = 0;
 	int i;
 
 	if (test_bit(__IXGBEVF_DOWN, &adapter->state) ||
@@ -2769,10 +2774,18 @@ void ixgbevf_update_stats(struct ixgbevf_adapter *adapter)
 				adapter->stats.vfmprc);
 
 	for (i = 0;  i  < adapter->num_rx_queues;  i++) {
-		adapter->hw_csum_rx_error +=
-			adapter->rx_ring[i]->hw_csum_rx_error;
-		adapter->rx_ring[i]->hw_csum_rx_error = 0;
+		struct ixgbevf_ring *rx_ring = adapter->rx_ring[i];
+
+		hw_csum_rx_error += rx_ring->rx_stats.csum_err;
+		alloc_rx_page_failed += rx_ring->rx_stats.alloc_rx_page_failed;
+		alloc_rx_buff_failed += rx_ring->rx_stats.alloc_rx_buff_failed;
+		alloc_rx_page += rx_ring->rx_stats.alloc_rx_page;
 	}
+
+	adapter->hw_csum_rx_error = hw_csum_rx_error;
+	adapter->alloc_rx_page_failed = alloc_rx_page_failed;
+	adapter->alloc_rx_buff_failed = alloc_rx_buff_failed;
+	adapter->alloc_rx_page = alloc_rx_page;
 }
 
 /**


  parent reply	other threads:[~2017-12-11 18:37 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-11 18:36 [Intel-wired-lan] [PATCH 0/9] ixgbevf: update Rx/Tx code path for build_skb Emil Tantilov
2017-12-11 18:36 ` [Intel-wired-lan] [PATCH 1/9] ixgbevf: add function for checking if we can reuse page Emil Tantilov
2018-01-04 15:41   ` Singh, Krishneil K
2017-12-11 18:36 ` [Intel-wired-lan] [PATCH 2/9] ixgbevf: only DMA sync frame length Emil Tantilov
2018-01-04 15:43   ` Singh, Krishneil K
2018-02-26 15:55   ` Singh, Krishneil K
2017-12-11 18:36 ` [Intel-wired-lan] [PATCH 3/9] ixgbevf: use length to determine if descriptor is done Emil Tantilov
2018-01-04 15:44   ` Singh, Krishneil K
2018-02-26 15:57   ` Singh, Krishneil K
2017-12-11 18:37 ` [Intel-wired-lan] [PATCH 4/9] ixgbevf: add support for DMA_ATTR_SKIP_CPU_SYNC/WEAK_ORDERING Emil Tantilov
2018-01-04 15:46   ` Singh, Krishneil K
2018-02-26 15:54   ` Singh, Krishneil K
2017-12-11 18:37 ` [Intel-wired-lan] [PATCH 5/9] ixgbevf: update code to better handle incrementing page count Emil Tantilov
2018-01-04 15:46   ` Singh, Krishneil K
2018-02-26 15:56   ` Singh, Krishneil K
2017-12-11 18:37 ` Emil Tantilov [this message]
2018-01-04 15:47   ` [Intel-wired-lan] [PATCH 6/9] ixgbevf: add counters for Rx page allocations Singh, Krishneil K
2018-02-26 15:54   ` Singh, Krishneil K
2017-12-11 18:37 ` [Intel-wired-lan] [PATCH 7/9] ixgbevf: clear rx_buffer_info in configure instead of clean Emil Tantilov
2018-01-04 15:48   ` Singh, Krishneil K
2018-02-26 15:55   ` Singh, Krishneil K
2017-12-11 18:37 ` [Intel-wired-lan] [PATCH 8/9] ixgbevf: improve performance and reduce size of ixgbevf_tx_map() Emil Tantilov
2018-01-04 15:49   ` Singh, Krishneil K
2018-02-26 15:54   ` Singh, Krishneil K
2017-12-11 18:37 ` [Intel-wired-lan] [PATCH 9/9] ixgbevf: don't bother clearing tx_buffer_info in ixgbevf_clean_tx_ring() Emil Tantilov
2018-01-04 15:50   ` Singh, Krishneil K
2018-02-26 15:57   ` Singh, Krishneil K

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171211183715.21524.56950.stgit@localhost6.localdomain6 \
    --to=emil.s.tantilov@intel.com \
    --cc=intel-wired-lan@osuosl.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox