DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ajit Khaparde <ajit.khaparde@broadcom.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH 09/14] net/bnxt: maintain rx_mbuf_alloc_fail per RxQ
Date: Mon, 16 Apr 2018 18:11:21 -0700	[thread overview]
Message-ID: <20180417011126.12622-10-ajit.khaparde@broadcom.com> (raw)
In-Reply-To: <20180417011126.12622-1-ajit.khaparde@broadcom.com>

Currently we have a single counter for mbuf alloc failure.
Make it per RxQ instead.

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt.h        |  1 -
 drivers/net/bnxt/bnxt_ethdev.c |  1 -
 drivers/net/bnxt/bnxt_rxq.c    |  1 +
 drivers/net/bnxt/bnxt_rxq.h    |  1 +
 drivers/net/bnxt/bnxt_rxr.c    |  8 ++++----
 drivers/net/bnxt/bnxt_stats.c  | 10 ++++++++--
 6 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h
index d3eab8d36..bdca2622f 100644
--- a/drivers/net/bnxt/bnxt.h
+++ b/drivers/net/bnxt/bnxt.h
@@ -295,7 +295,6 @@ struct bnxt {
 	uint16_t		geneve_fw_dst_port_id;
 	uint32_t		fw_ver;
 	uint32_t		hwrm_spec_code;
-	rte_atomic64_t		rx_mbuf_alloc_fail;
 
 	struct bnxt_led_info	leds[BNXT_MAX_LED];
 	uint8_t			num_leds;
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index b7aab65ab..3cf845089 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -3129,7 +3129,6 @@ bnxt_dev_init(struct rte_eth_dev *eth_dev)
 
 	bp = eth_dev->data->dev_private;
 
-	rte_atomic64_init(&bp->rx_mbuf_alloc_fail);
 	bp->dev_stopped = 1;
 
 	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
diff --git a/drivers/net/bnxt/bnxt_rxq.c b/drivers/net/bnxt/bnxt_rxq.c
index ce3f0a1d9..d797a47e9 100644
--- a/drivers/net/bnxt/bnxt_rxq.c
+++ b/drivers/net/bnxt/bnxt_rxq.c
@@ -336,6 +336,7 @@ int bnxt_rx_queue_setup_op(struct rte_eth_dev *eth_dev,
 		rc = -ENOMEM;
 		goto out;
 	}
+	rte_atomic64_init(&rxq->rx_mbuf_alloc_fail);
 
 out:
 	return rc;
diff --git a/drivers/net/bnxt/bnxt_rxq.h b/drivers/net/bnxt/bnxt_rxq.h
index 616163e63..3350d7719 100644
--- a/drivers/net/bnxt/bnxt_rxq.h
+++ b/drivers/net/bnxt/bnxt_rxq.h
@@ -32,6 +32,7 @@ struct bnxt_rx_queue {
 	uint32_t			rx_buf_use_size;  /* useable size */
 	struct bnxt_rx_ring_info	*rx_ring;
 	struct bnxt_cp_ring_info	*cp_ring;
+	rte_atomic64_t		rx_mbuf_alloc_fail;
 };
 
 void bnxt_free_rxq_stats(struct bnxt_rx_queue *rxq);
diff --git a/drivers/net/bnxt/bnxt_rxr.c b/drivers/net/bnxt/bnxt_rxr.c
index d9b4d768d..4bc320430 100644
--- a/drivers/net/bnxt/bnxt_rxr.c
+++ b/drivers/net/bnxt/bnxt_rxr.c
@@ -41,7 +41,7 @@ static inline int bnxt_alloc_rx_data(struct bnxt_rx_queue *rxq,
 
 	mbuf = __bnxt_alloc_rx_data(rxq->mb_pool);
 	if (!mbuf) {
-		rte_atomic64_inc(&rxq->bp->rx_mbuf_alloc_fail);
+		rte_atomic64_inc(&rxq->rx_mbuf_alloc_fail);
 		return -ENOMEM;
 	}
 
@@ -62,7 +62,7 @@ static inline int bnxt_alloc_ag_data(struct bnxt_rx_queue *rxq,
 
 	mbuf = __bnxt_alloc_rx_data(rxq->mb_pool);
 	if (!mbuf) {
-		rte_atomic64_inc(&rxq->bp->rx_mbuf_alloc_fail);
+		rte_atomic64_inc(&rxq->rx_mbuf_alloc_fail);
 		return -ENOMEM;
 	}
 
@@ -299,7 +299,7 @@ static inline struct rte_mbuf *bnxt_tpa_end(
 	struct rte_mbuf *new_data = __bnxt_alloc_rx_data(rxq->mb_pool);
 	RTE_ASSERT(new_data != NULL);
 	if (!new_data) {
-		rte_atomic64_inc(&rxq->bp->rx_mbuf_alloc_fail);
+		rte_atomic64_inc(&rxq->rx_mbuf_alloc_fail);
 		return NULL;
 	}
 	tpa_info->mbuf = new_data;
@@ -767,7 +767,7 @@ int bnxt_init_one_rx_ring(struct bnxt_rx_queue *rxq)
 			rxr->tpa_info[i].mbuf =
 				__bnxt_alloc_rx_data(rxq->mb_pool);
 			if (!rxr->tpa_info[i].mbuf) {
-				rte_atomic64_inc(&rxq->bp->rx_mbuf_alloc_fail);
+				rte_atomic64_inc(&rxq->rx_mbuf_alloc_fail);
 				return -ENOMEM;
 			}
 		}
diff --git a/drivers/net/bnxt/bnxt_stats.c b/drivers/net/bnxt/bnxt_stats.c
index 5a1c07388..1b586f333 100644
--- a/drivers/net/bnxt/bnxt_stats.c
+++ b/drivers/net/bnxt/bnxt_stats.c
@@ -221,6 +221,8 @@ int bnxt_stats_get_op(struct rte_eth_dev *eth_dev,
 				     bnxt_stats, 1);
 		if (unlikely(rc))
 			return rc;
+		bnxt_stats->rx_nombuf +=
+				rte_atomic64_read(&rxq->rx_mbuf_alloc_fail);
 	}
 
 	for (i = 0; i < bp->tx_cp_nr_rings; i++) {
@@ -235,13 +237,13 @@ int bnxt_stats_get_op(struct rte_eth_dev *eth_dev,
 	rc = bnxt_hwrm_func_qstats(bp, 0xffff, bnxt_stats);
 	if (unlikely(rc))
 		return rc;
-	bnxt_stats->rx_nombuf = rte_atomic64_read(&bp->rx_mbuf_alloc_fail);
 	return rc;
 }
 
 void bnxt_stats_reset_op(struct rte_eth_dev *eth_dev)
 {
 	struct bnxt *bp = (struct bnxt *)eth_dev->data->dev_private;
+	unsigned int i;
 
 	if (!(bp->flags & BNXT_FLAG_INIT_DONE)) {
 		PMD_DRV_LOG(ERR, "Device Initialization not complete!\n");
@@ -249,7 +251,11 @@ void bnxt_stats_reset_op(struct rte_eth_dev *eth_dev)
 	}
 
 	bnxt_clear_all_hwrm_stat_ctxs(bp);
-	rte_atomic64_clear(&bp->rx_mbuf_alloc_fail);
+	for (i = 0; i < bp->rx_cp_nr_rings; i++) {
+		struct bnxt_rx_queue *rxq = bp->rx_queues[i];
+
+		rte_atomic64_clear(&rxq->rx_mbuf_alloc_fail);
+	}
 }
 
 int bnxt_dev_xstats_get_op(struct rte_eth_dev *eth_dev,
-- 
2.15.1 (Apple Git-101)

  parent reply	other threads:[~2018-04-17  1:11 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-17  1:11 [dpdk-dev] [PATCH 00/14] bnxt patchset Ajit Khaparde
2018-04-17  1:11 ` [dpdk-dev] [PATCH 01/14] net/bnxt: set default log level to informational Ajit Khaparde
2018-04-17  1:11 ` [dpdk-dev] [PATCH 02/14] net/bnxt: set padding flags in Rx descriptor Ajit Khaparde
2018-04-17  1:11 ` [dpdk-dev] [PATCH 03/14] net/bnxt: fix bnxt_hwrm_vnic_alloc Ajit Khaparde
2018-04-17  1:11 ` [dpdk-dev] [PATCH 04/14] net/bnxt: fix incorrect ntuple flag setting Ajit Khaparde
2018-04-17  1:11 ` [dpdk-dev] [PATCH 05/14] net/bnxt: fix Rx checksum flags for tunnel frames Ajit Khaparde
2018-04-17  1:11 ` [dpdk-dev] [PATCH 06/14] net/bnxt: fix L2 filter cleanup Ajit Khaparde
2018-04-17  1:11 ` [dpdk-dev] [PATCH 07/14] net/bnxt: fix bnxt_flow_destroy Ajit Khaparde
2018-04-17  1:11 ` [dpdk-dev] [PATCH 08/14] net/bnxt: add code to determine the Tx COS queue Ajit Khaparde
2018-04-17  1:11 ` Ajit Khaparde [this message]
2018-04-17  1:11 ` [dpdk-dev] [PATCH 10/14] net/bnxt: reset l2_filter_id once filter is freed Ajit Khaparde
2018-04-17  1:11 ` [dpdk-dev] [PATCH 11/14] net/bnxt: free memory allocated for VF filters Ajit Khaparde
2018-04-17  1:11 ` [dpdk-dev] [PATCH 12/14] net/bnxt: use UINT64_MAX to initialize filter ids Ajit Khaparde
2018-04-17  1:11 ` [dpdk-dev] [PATCH 13/14] net/bnxt: avoid freeing mem_zone multiple times Ajit Khaparde
2018-04-17  1:11 ` [dpdk-dev] [PATCH 14/14] bnxt: add device ID for Stratus VF Ajit Khaparde
2018-04-17 18:20   ` Ferruh Yigit
2018-04-17 18:25     ` Ajit Khaparde
2018-04-17 18:29       ` Ferruh Yigit
2018-04-17 18:19 ` [dpdk-dev] [PATCH 00/14] bnxt patchset Ferruh Yigit

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=20180417011126.12622-10-ajit.khaparde@broadcom.com \
    --to=ajit.khaparde@broadcom.com \
    --cc=dev@dpdk.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;
as well as URLs for NNTP newsgroup(s).