DPDK patches and discussions
 help / color / mirror / Atom feed
From: Lance Richardson <lance.richardson@broadcom.com>
To: dev@dpdk.org
Cc: ajit.khaparde@broadcom.com, ferruh.yigit@intel.com,
	Lance Richardson <lance.richardson@broadcom.com>
Subject: [dpdk-dev] [PATCH 07/11] net/bnxt: refactor doorbell handling
Date: Sun,  2 Jun 2019 13:42:42 -0400	[thread overview]
Message-ID: <20190602174247.32368-8-lance.richardson@broadcom.com> (raw)
In-Reply-To: <20190602174247.32368-1-lance.richardson@broadcom.com>

Reduce code duplication and prepare for newer controllers that
use different doorbell protocols by refactoring doorbell handling
code.

Signed-off-by: Lance Richardson <lance.richardson@broadcom.com>
Reviewed-by: Ajit Kumar Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt_cpr.h          |  27 ++++--
 drivers/net/bnxt/bnxt_irq.c          |   4 +-
 drivers/net/bnxt/bnxt_ring.c         | 132 +++++++++++++++------------
 drivers/net/bnxt/bnxt_ring.h         |  11 +++
 drivers/net/bnxt/bnxt_rxr.c          |  10 +-
 drivers/net/bnxt/bnxt_rxr.h          |   4 +-
 drivers/net/bnxt/bnxt_rxtx_vec_sse.c |   8 +-
 drivers/net/bnxt/bnxt_txr.c          |   4 +-
 drivers/net/bnxt/bnxt_txr.h          |   2 +-
 9 files changed, 118 insertions(+), 84 deletions(-)

diff --git a/drivers/net/bnxt/bnxt_cpr.h b/drivers/net/bnxt/bnxt_cpr.h
index ee5ca820e..77a22d241 100644
--- a/drivers/net/bnxt/bnxt_cpr.h
+++ b/drivers/net/bnxt/bnxt_cpr.h
@@ -9,6 +9,8 @@
 
 #include <rte_io.h>
 
+struct bnxt_db_info;
+
 #define CMP_VALID(cmp, raw_cons, ring)					\
 	(!!(rte_le_to_cpu_32(((struct cmpl_base *)(cmp))->info3_v) &	\
 	    CMPL_BASE_V) == !((raw_cons) & ((ring)->ring_size)))
@@ -40,37 +42,44 @@
 #define B_CP_DB_REARM(cpr, raw_cons)					\
 	rte_write32((DB_CP_REARM_FLAGS |				\
 		    RING_CMP(((cpr)->cp_ring_struct), raw_cons)),	\
-		    ((cpr)->cp_doorbell))
+		    ((cpr)->cp_db.doorbell))
+
+#define B_CP_DB_ARM(cpr)	rte_write32((DB_KEY_CP),		\
+					    ((cpr)->cp_db.doorbell))
 
-#define B_CP_DB_ARM(cpr)	rte_write32((DB_KEY_CP), ((cpr)->cp_doorbell))
-#define B_CP_DB_DISARM(cpr)	(*(uint32_t *)((cpr)->cp_doorbell) = \
+#define B_CP_DB_DISARM(cpr)	(*(uint32_t *)((cpr)->cp_db.doorbell) = \
 				 DB_KEY_CP | DB_IRQ_DIS)
 
 #define B_CP_DB_IDX_ARM(cpr, cons)					\
-		(*(uint32_t *)((cpr)->cp_doorbell) = (DB_CP_REARM_FLAGS | \
+		(*(uint32_t *)((cpr)->cp_db.doorbell) = (DB_CP_REARM_FLAGS | \
 				(cons)))
 
 #define B_CP_DB_IDX_DISARM(cpr, cons)	do {				\
 		rte_smp_wmb();						\
-		(*(uint32_t *)((cpr)->cp_doorbell) = (DB_CP_FLAGS |	\
+		(*(uint32_t *)((cpr)->cp_db.doorbell) = (DB_CP_FLAGS |	\
 				(cons));				\
 } while (0)
 #define B_CP_DIS_DB(cpr, raw_cons)					\
 	rte_write32((DB_CP_FLAGS |					\
 		    RING_CMP(((cpr)->cp_ring_struct), raw_cons)),	\
-		    ((cpr)->cp_doorbell))
+		    ((cpr)->cp_db.doorbell))
+
 #define B_CP_DB(cpr, raw_cons, ring_mask)				\
 	rte_write32((DB_CP_FLAGS |					\
 		    RING_CMPL((ring_mask), raw_cons)),	\
-		    ((cpr)->cp_doorbell))
+		    ((cpr)->cp_db.doorbell))
+
+struct bnxt_db_info {
+	void		*doorbell;
+	uint32_t	db_key32;
+};
 
 struct bnxt_ring;
 struct bnxt_cp_ring_info {
 	uint32_t		cp_raw_cons;
-	void			*cp_doorbell;
 
 	struct cmpl_base	*cp_desc_ring;
-
+	struct bnxt_db_info     cp_db;
 	rte_iova_t		cp_desc_mapping;
 
 	struct ctx_hw_stats	*hw_stats;
diff --git a/drivers/net/bnxt/bnxt_irq.c b/drivers/net/bnxt/bnxt_irq.c
index 7ef7023eb..9f3c166a6 100644
--- a/drivers/net/bnxt/bnxt_irq.c
+++ b/drivers/net/bnxt/bnxt_irq.c
@@ -71,7 +71,7 @@ void bnxt_disable_int(struct bnxt *bp)
 	struct bnxt_cp_ring_info *cpr = bp->def_cp_ring;
 
 	/* Only the default completion ring */
-	if (cpr != NULL && cpr->cp_doorbell != NULL)
+	if (cpr != NULL && cpr->cp_db.doorbell != NULL)
 		B_CP_DB_DISARM(cpr);
 }
 
@@ -80,7 +80,7 @@ void bnxt_enable_int(struct bnxt *bp)
 	struct bnxt_cp_ring_info *cpr = bp->def_cp_ring;
 
 	/* Only the default completion ring */
-	if (cpr != NULL && cpr->cp_doorbell != NULL)
+	if (cpr != NULL && cpr->cp_db.doorbell != NULL)
 		B_CP_DB_ARM(cpr);
 }
 
diff --git a/drivers/net/bnxt/bnxt_ring.c b/drivers/net/bnxt/bnxt_ring.c
index 51fe35f3e..15d418977 100644
--- a/drivers/net/bnxt/bnxt_ring.c
+++ b/drivers/net/bnxt/bnxt_ring.c
@@ -276,31 +276,48 @@ static void bnxt_init_dflt_coal(struct bnxt_coal *coal)
 	coal->cmpl_aggr_dma_tmr_during_int = BNXT_CMPL_AGGR_DMA_TMR_DURING_INT;
 }
 
+static void bnxt_set_db(struct bnxt *bp,
+			struct bnxt_db_info *db,
+			uint32_t ring_type,
+			uint32_t map_idx)
+{
+	db->doorbell = (char *)bp->doorbell_base + map_idx * 0x80;
+	switch (ring_type) {
+	case HWRM_RING_ALLOC_INPUT_RING_TYPE_TX:
+		db->db_key32 = DB_KEY_TX;
+		break;
+	case HWRM_RING_ALLOC_INPUT_RING_TYPE_RX:
+		db->db_key32 = DB_KEY_RX;
+		break;
+	case HWRM_RING_ALLOC_INPUT_RING_TYPE_L2_CMPL:
+		db->db_key32 = DB_KEY_CP;
+		break;
+	}
+}
+
 int bnxt_alloc_hwrm_rx_ring(struct bnxt *bp, int queue_index)
 {
-	struct rte_pci_device *pci_dev = bp->pdev;
 	struct bnxt_rx_queue *rxq = bp->rx_queues[queue_index];
 	struct bnxt_cp_ring_info *cpr = rxq->cp_ring;
 	struct bnxt_ring *cp_ring = cpr->cp_ring_struct;
 	struct bnxt_rx_ring_info *rxr = rxq->rx_ring;
 	struct bnxt_ring *ring = rxr->rx_ring_struct;
 	unsigned int map_idx = queue_index + bp->rx_cp_nr_rings;
+	uint8_t ring_type;
 	int rc = 0;
 
 	bp->grp_info[queue_index].fw_stats_ctx = cpr->hw_stats_ctx_id;
 
 	/* Rx cmpl */
-	rc = bnxt_hwrm_ring_alloc(bp, cp_ring,
-				  HWRM_RING_ALLOC_INPUT_RING_TYPE_L2_CMPL,
-				  queue_index, HWRM_NA_SIGNATURE,
-				  HWRM_NA_SIGNATURE);
+	ring_type = HWRM_RING_ALLOC_INPUT_RING_TYPE_L2_CMPL;
+	rc = bnxt_hwrm_ring_alloc(bp, cp_ring,  ring_type, queue_index,
+				  HWRM_NA_SIGNATURE, HWRM_NA_SIGNATURE);
 	if (rc)
 		goto err_out;
 
-	cpr->cp_doorbell = (char *)pci_dev->mem_resource[2].addr +
-		queue_index * BNXT_DB_SIZE;
 	bp->grp_info[queue_index].cp_fw_ring_id = cp_ring->fw_ring_id;
-	B_CP_DIS_DB(cpr, cpr->cp_raw_cons);
+	bnxt_set_db(bp, &cpr->cp_db, ring_type, queue_index);
+	bnxt_db_cq(cpr);
 
 	if (!queue_index) {
 		/*
@@ -314,35 +331,33 @@ int bnxt_alloc_hwrm_rx_ring(struct bnxt *bp, int queue_index)
 			goto err_out;
 	}
 	/* Rx ring */
-	rc = bnxt_hwrm_ring_alloc(bp, ring, HWRM_RING_ALLOC_INPUT_RING_TYPE_RX,
-				  queue_index, cpr->hw_stats_ctx_id,
-				  cp_ring->fw_ring_id);
+	ring_type = HWRM_RING_ALLOC_INPUT_RING_TYPE_RX;
+	rc = bnxt_hwrm_ring_alloc(bp, ring, ring_type, queue_index,
+				  cpr->hw_stats_ctx_id, cp_ring->fw_ring_id);
 	if (rc)
 		goto err_out;
 
 	rxr->rx_prod = 0;
-	rxr->rx_doorbell = (char *)pci_dev->mem_resource[2].addr +
-		queue_index * BNXT_DB_SIZE;
 	bp->grp_info[queue_index].rx_fw_ring_id = ring->fw_ring_id;
-	B_RX_DB(rxr->rx_doorbell, rxr->rx_prod);
+	bnxt_set_db(bp, &rxr->rx_db, ring_type, queue_index);
+	bnxt_db_write(&rxr->rx_db, rxr->rx_prod);
 
-	ring = rxr->ag_ring_struct;
 	/* Agg ring */
+	ring = rxr->ag_ring_struct;
 	if (!ring)
 		PMD_DRV_LOG(ERR, "Alloc AGG Ring is NULL!\n");
 
-	rc = bnxt_hwrm_ring_alloc(bp, ring, HWRM_RING_ALLOC_INPUT_RING_TYPE_RX,
-				  map_idx, HWRM_NA_SIGNATURE,
-				  cp_ring->fw_ring_id);
+	ring_type = HWRM_RING_ALLOC_INPUT_RING_TYPE_RX;
+	rc = bnxt_hwrm_ring_alloc(bp, ring, ring_type, map_idx,
+				  HWRM_NA_SIGNATURE, cp_ring->fw_ring_id);
 	if (rc)
 		goto err_out;
 
 	PMD_DRV_LOG(DEBUG, "Alloc AGG Done!\n");
 	rxr->ag_prod = 0;
-	rxr->ag_doorbell = (char *)pci_dev->mem_resource[2].addr +
-		map_idx * BNXT_DB_SIZE;
 	bp->grp_info[queue_index].ag_fw_ring_id = ring->fw_ring_id;
-	B_RX_DB(rxr->ag_doorbell, rxr->ag_prod);
+	bnxt_set_db(bp, &rxr->ag_db, ring_type, map_idx);
+	bnxt_db_write(&rxr->ag_db, rxr->ag_prod);
 
 	rxq->rx_buf_use_size = BNXT_MAX_MTU + RTE_ETHER_HDR_LEN +
 		RTE_ETHER_CRC_LEN + (2 * VLAN_TAG_SIZE);
@@ -356,8 +371,8 @@ int bnxt_alloc_hwrm_rx_ring(struct bnxt *bp, int queue_index)
 			rc = -ENOMEM;
 			goto err_out;
 		}
-		B_RX_DB(rxr->rx_doorbell, rxr->rx_prod);
-		B_RX_DB(rxr->ag_doorbell, rxr->ag_prod);
+		bnxt_db_write(&rxr->rx_db, rxr->rx_prod);
+		bnxt_db_write(&rxr->ag_db, rxr->ag_prod);
 	}
 	rxq->index = queue_index;
 	PMD_DRV_LOG(INFO,
@@ -368,6 +383,7 @@ int bnxt_alloc_hwrm_rx_ring(struct bnxt *bp, int queue_index)
 err_out:
 	return rc;
 }
+
 /* ring_grp usage:
  * [0] = default completion ring
  * [1 -> +rx_cp_nr_rings] = rx_cp, rx rings
@@ -377,6 +393,7 @@ int bnxt_alloc_hwrm_rings(struct bnxt *bp)
 {
 	struct bnxt_coal coal;
 	unsigned int i;
+	uint8_t ring_type;
 	int rc = 0;
 
 	bnxt_init_dflt_coal(&coal);
@@ -392,18 +409,16 @@ int bnxt_alloc_hwrm_rings(struct bnxt *bp)
 		bp->grp_info[i].fw_stats_ctx = cpr->hw_stats_ctx_id;
 
 		/* Rx cmpl */
-		rc = bnxt_hwrm_ring_alloc
-			(bp,
-			 cp_ring,
-			 HWRM_RING_ALLOC_INPUT_RING_TYPE_L2_CMPL,
-			 i,
-			 HWRM_NA_SIGNATURE,
-			 HWRM_NA_SIGNATURE);
+		ring_type = HWRM_RING_ALLOC_INPUT_RING_TYPE_L2_CMPL;
+		rc = bnxt_hwrm_ring_alloc(bp, cp_ring, ring_type, i,
+					  HWRM_NA_SIGNATURE,
+					  HWRM_NA_SIGNATURE);
 		if (rc)
 			goto err_out;
-		cpr->cp_doorbell = (char *)bp->doorbell_base + i * 0x80;
 		bp->grp_info[i].cp_fw_ring_id = cp_ring->fw_ring_id;
-		B_CP_DIS_DB(cpr, cpr->cp_raw_cons);
+		bnxt_set_db(bp, &cpr->cp_db, ring_type, i);
+		bnxt_db_cq(cpr);
+
 		bnxt_hwrm_set_ring_coal(bp, &coal, cp_ring->fw_ring_id);
 
 		if (!i) {
@@ -420,37 +435,36 @@ int bnxt_alloc_hwrm_rings(struct bnxt *bp)
 		}
 
 		/* Rx ring */
-		rc = bnxt_hwrm_ring_alloc(bp,
-					  ring,
-					  HWRM_RING_ALLOC_INPUT_RING_TYPE_RX,
-					  i,
+		ring_type = HWRM_RING_ALLOC_INPUT_RING_TYPE_RX;
+		rc = bnxt_hwrm_ring_alloc(bp, ring, ring_type, i,
 					  cpr->hw_stats_ctx_id,
 					  cp_ring->fw_ring_id);
 		if (rc)
 			goto err_out;
 		rxr->rx_prod = 0;
-		rxr->rx_doorbell = (char *)bp->doorbell_base + i * 0x80;
 		bp->grp_info[i].rx_fw_ring_id = ring->fw_ring_id;
-		B_RX_DB(rxr->rx_doorbell, rxr->rx_prod);
+		bnxt_set_db(bp, &rxr->rx_db, ring_type, i);
+		bnxt_db_write(&rxr->rx_db, rxr->rx_prod);
 
-		ring = rxr->ag_ring_struct;
 		/* Agg ring */
+		ring = rxr->ag_ring_struct;
+
 		if (ring == NULL) {
 			PMD_DRV_LOG(ERR, "Alloc AGG Ring is NULL!\n");
 			goto err_out;
 		}
 
-		rc = bnxt_hwrm_ring_alloc(bp, ring,
-				HWRM_RING_ALLOC_INPUT_RING_TYPE_RX,
-				map_idx, HWRM_NA_SIGNATURE,
-				cp_ring->fw_ring_id);
+		ring_type = HWRM_RING_ALLOC_INPUT_RING_TYPE_RX;
+		rc = bnxt_hwrm_ring_alloc(bp, ring, ring_type, map_idx,
+					  HWRM_NA_SIGNATURE,
+					  cp_ring->fw_ring_id);
 		if (rc)
 			goto err_out;
-		PMD_DRV_LOG(DEBUG, "Alloc AGG Done!\n");
+
 		rxr->ag_prod = 0;
-		rxr->ag_doorbell = (char *)bp->doorbell_base + map_idx * 0x80;
 		bp->grp_info[i].ag_fw_ring_id = ring->fw_ring_id;
-		B_RX_DB(rxr->ag_doorbell, rxr->ag_prod);
+		bnxt_set_db(bp, &rxr->ag_db, ring_type, map_idx);
+		bnxt_db_write(&rxr->ag_db, rxr->ag_prod);
 
 		rxq->rx_buf_use_size = BNXT_MAX_MTU + RTE_ETHER_HDR_LEN +
 					RTE_ETHER_CRC_LEN + (2 * VLAN_TAG_SIZE);
@@ -459,8 +473,8 @@ int bnxt_alloc_hwrm_rings(struct bnxt *bp)
 			bnxt_rx_queue_release_op(rxq);
 			return -ENOMEM;
 		}
-		B_RX_DB(rxr->rx_doorbell, rxr->rx_prod);
-		B_RX_DB(rxr->ag_doorbell, rxr->ag_prod);
+		bnxt_db_write(&rxr->rx_db, rxr->rx_prod);
+		bnxt_db_write(&rxr->ag_db, rxr->ag_prod);
 		rxq->index = i;
 	}
 
@@ -473,25 +487,25 @@ int bnxt_alloc_hwrm_rings(struct bnxt *bp)
 		unsigned int idx = i + bp->rx_cp_nr_rings;
 
 		/* Tx cmpl */
-		rc = bnxt_hwrm_ring_alloc(bp, cp_ring,
-					HWRM_RING_ALLOC_INPUT_RING_TYPE_L2_CMPL,
-					idx, HWRM_NA_SIGNATURE,
-					HWRM_NA_SIGNATURE);
+		ring_type = HWRM_RING_ALLOC_INPUT_RING_TYPE_L2_CMPL;
+		rc = bnxt_hwrm_ring_alloc(bp, cp_ring, ring_type, idx,
+					  HWRM_NA_SIGNATURE,
+					  HWRM_NA_SIGNATURE);
 		if (rc)
 			goto err_out;
 
-		cpr->cp_doorbell = (char *)bp->doorbell_base + idx * 0x80;
-		B_CP_DIS_DB(cpr, cpr->cp_raw_cons);
+		bnxt_set_db(bp, &cpr->cp_db, ring_type, idx);
+		bnxt_db_cq(cpr);
 
 		/* Tx ring */
-		rc = bnxt_hwrm_ring_alloc(bp, ring,
-					HWRM_RING_ALLOC_INPUT_RING_TYPE_TX,
-					idx, cpr->hw_stats_ctx_id,
-					cp_ring->fw_ring_id);
+		ring_type = HWRM_RING_ALLOC_INPUT_RING_TYPE_TX;
+		rc = bnxt_hwrm_ring_alloc(bp, ring, ring_type, idx,
+					  cpr->hw_stats_ctx_id,
+					  cp_ring->fw_ring_id);
 		if (rc)
 			goto err_out;
 
-		txr->tx_doorbell = (char *)bp->doorbell_base + idx * 0x80;
+		bnxt_set_db(bp, &txr->tx_db, ring_type, idx);
 		txq->index = idx;
 		bnxt_hwrm_set_ring_coal(bp, &coal, cp_ring->fw_ring_id);
 	}
diff --git a/drivers/net/bnxt/bnxt_ring.h b/drivers/net/bnxt/bnxt_ring.h
index fd3d0bd73..8cb0e8eb0 100644
--- a/drivers/net/bnxt/bnxt_ring.h
+++ b/drivers/net/bnxt/bnxt_ring.h
@@ -74,4 +74,15 @@ int bnxt_alloc_rings(struct bnxt *bp, uint16_t qidx,
 int bnxt_alloc_hwrm_rx_ring(struct bnxt *bp, int queue_index);
 int bnxt_alloc_hwrm_rings(struct bnxt *bp);
 
+static inline void bnxt_db_write(struct bnxt_db_info *db, uint32_t idx)
+{
+	rte_write32(db->db_key32 | idx, db->doorbell);
+}
+
+static inline void bnxt_db_cq(struct bnxt_cp_ring_info *cpr)
+{
+	rte_smp_wmb();
+	B_CP_DIS_DB(cpr, cpr->cp_raw_cons);
+}
+
 #endif
diff --git a/drivers/net/bnxt/bnxt_rxr.c b/drivers/net/bnxt/bnxt_rxr.c
index 303549b5d..75d2c76a5 100644
--- a/drivers/net/bnxt/bnxt_rxr.c
+++ b/drivers/net/bnxt/bnxt_rxr.c
@@ -552,7 +552,7 @@ uint16_t bnxt_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 			break;
 		/* Post some Rx buf early in case of larger burst processing */
 		if (nb_rx_pkts == BNXT_RX_POST_THRESH)
-			B_RX_DB(rxr->rx_doorbell, rxr->rx_prod);
+			bnxt_db_write(&rxr->rx_db, rxr->rx_prod);
 	}
 
 	cpr->cp_raw_cons = raw_cons;
@@ -565,13 +565,13 @@ uint16_t bnxt_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 	}
 
 	if (prod != rxr->rx_prod)
-		B_RX_DB(rxr->rx_doorbell, rxr->rx_prod);
+		bnxt_db_write(&rxr->rx_db, rxr->rx_prod);
 
 	/* Ring the AGG ring DB */
 	if (ag_prod != rxr->ag_prod)
-		B_RX_DB(rxr->ag_doorbell, rxr->ag_prod);
+		bnxt_db_write(&rxr->ag_db, rxr->ag_prod);
 
-	B_CP_DIS_DB(cpr, cpr->cp_raw_cons);
+	bnxt_db_cq(cpr);
 
 	/* Attempt to alloc Rx buf in case of a previous allocation failure. */
 	if (rc == -ENOMEM) {
@@ -588,7 +588,7 @@ uint16_t bnxt_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 			/* This slot is empty. Alloc buffer for Rx */
 			if (!bnxt_alloc_rx_data(rxq, rxr, i)) {
 				rxr->rx_prod = i;
-				B_RX_DB(rxr->rx_doorbell, rxr->rx_prod);
+				bnxt_db_write(&rxr->rx_db, rxr->rx_prod);
 			} else {
 				PMD_DRV_LOG(ERR, "Alloc  mbuf failed\n");
 				break;
diff --git a/drivers/net/bnxt/bnxt_rxr.h b/drivers/net/bnxt/bnxt_rxr.h
index d10cefb93..6523b94c6 100644
--- a/drivers/net/bnxt/bnxt_rxr.h
+++ b/drivers/net/bnxt/bnxt_rxr.h
@@ -81,8 +81,8 @@ struct bnxt_sw_rx_bd {
 struct bnxt_rx_ring_info {
 	uint16_t		rx_prod;
 	uint16_t		ag_prod;
-	void			*rx_doorbell;
-	void			*ag_doorbell;
+	struct bnxt_db_info     rx_db;
+	struct bnxt_db_info     ag_db;
 
 	struct rx_prod_pkt_bd	*rx_desc_ring;
 	struct rx_prod_pkt_bd	*ag_desc_ring;
diff --git a/drivers/net/bnxt/bnxt_rxtx_vec_sse.c b/drivers/net/bnxt/bnxt_rxtx_vec_sse.c
index 1c32c986c..c358506f8 100644
--- a/drivers/net/bnxt/bnxt_rxtx_vec_sse.c
+++ b/drivers/net/bnxt/bnxt_rxtx_vec_sse.c
@@ -92,7 +92,7 @@ bnxt_rxq_rearm(struct bnxt_rx_queue *rxq, struct bnxt_rx_ring_info *rxr)
 	}
 
 	rxq->rxrearm_start += RTE_BNXT_RXQ_REARM_THRESH;
-	B_RX_DB(rxr->rx_doorbell, rxq->rxrearm_start - 1);
+	bnxt_db_write(&rxr->rx_db, rxq->rxrearm_start - 1);
 	if (rxq->rxrearm_start >= rxq->nb_rx_desc)
 		rxq->rxrearm_start = 0;
 
@@ -272,7 +272,7 @@ bnxt_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,
 	rxq->rxrearm_nb += nb_rx_pkts;
 	cpr->cp_raw_cons = raw_cons;
 	if (nb_rx_pkts || evt)
-		B_CP_DIS_DB(cpr, cpr->cp_raw_cons);
+		bnxt_db_cq(cpr);
 
 	return nb_rx_pkts;
 }
@@ -349,7 +349,7 @@ bnxt_handle_tx_cp_vec(struct bnxt_tx_queue *txq)
 	if (nb_tx_pkts) {
 		bnxt_tx_cmp_vec(txq, nb_tx_pkts);
 		cpr->cp_raw_cons = raw_cons;
-		B_CP_DB(cpr, raw_cons, ring_mask);
+		bnxt_db_cq(cpr);
 	}
 }
 
@@ -420,7 +420,7 @@ bnxt_xmit_fixed_burst_vec(void *tx_queue, struct rte_mbuf **tx_pkts,
 	}
 
 	rte_compiler_barrier();
-	B_TX_DB(txr->tx_doorbell, prod);
+	bnxt_db_write(&txr->tx_db, prod);
 
 	txr->tx_prod = prod;
 
diff --git a/drivers/net/bnxt/bnxt_txr.c b/drivers/net/bnxt/bnxt_txr.c
index 16598ba63..26dd384a6 100644
--- a/drivers/net/bnxt/bnxt_txr.c
+++ b/drivers/net/bnxt/bnxt_txr.c
@@ -415,7 +415,7 @@ static int bnxt_handle_tx_cp(struct bnxt_tx_queue *txq)
 	if (nb_tx_pkts) {
 		bnxt_tx_cmp(txq, nb_tx_pkts);
 		cpr->cp_raw_cons = raw_cons;
-		B_CP_DB(cpr, cpr->cp_raw_cons, ring_mask);
+		bnxt_db_cq(cpr);
 	}
 
 	return nb_tx_pkts;
@@ -452,7 +452,7 @@ uint16_t bnxt_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 	if (likely(nb_tx_pkts)) {
 		/* Request a completion on the last packet */
 		last_txbd->flags_type &= ~TX_BD_LONG_FLAGS_NO_CMPL;
-		B_TX_DB(txq->tx_ring->tx_doorbell, txq->tx_ring->tx_prod);
+		bnxt_db_write(&txq->tx_ring->tx_db, txq->tx_ring->tx_prod);
 	}
 
 	return nb_tx_pkts;
diff --git a/drivers/net/bnxt/bnxt_txr.h b/drivers/net/bnxt/bnxt_txr.h
index 58678a1c8..08fd2e014 100644
--- a/drivers/net/bnxt/bnxt_txr.h
+++ b/drivers/net/bnxt/bnxt_txr.h
@@ -18,7 +18,7 @@
 struct bnxt_tx_ring_info {
 	uint16_t		tx_prod;
 	uint16_t		tx_cons;
-	void			*tx_doorbell;
+	struct bnxt_db_info     tx_db;
 
 	struct tx_bd_long	*tx_desc_ring;
 	struct bnxt_sw_tx_bd	*tx_buf_ring;
-- 
2.17.1


  parent reply	other threads:[~2019-06-02 17:44 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-02 17:42 [dpdk-dev] [PATCH 00/11] add support for BCM57508 controller Lance Richardson
2019-06-02 17:42 ` [dpdk-dev] [PATCH 01/11] net/bnxt: endianness conversions in cp ring macros Lance Richardson
2019-06-02 17:42 ` [dpdk-dev] [PATCH 02/11] net/bnxt: fix ring type macro name usage Lance Richardson
2019-06-02 17:42 ` [dpdk-dev] [PATCH 03/11] net/bnxt: fix width in stats ctx endian conversion Lance Richardson
2019-06-02 17:42 ` [dpdk-dev] [PATCH 04/11] net/bnxt: use consistent values for vnic RSS rule Lance Richardson
2019-06-02 17:42 ` [dpdk-dev] [PATCH 05/11] net/bnxt: reset function earlier in initialization Lance Richardson
2019-06-02 17:42 ` [dpdk-dev] [PATCH 06/11] net/bnxt: support extended hwrm request sizes Lance Richardson
2019-06-02 17:42 ` Lance Richardson [this message]
2019-06-02 17:42 ` [dpdk-dev] [PATCH 08/11] net/bnxt: refactor ring allocation code Lance Richardson
2019-06-02 17:42 ` [dpdk-dev] [PATCH 09/11] net/bnxt: add support for thor controller Lance Richardson
2019-06-14  2:17   ` [dpdk-dev] compilation failing - " Thomas Monjalon
2019-06-14  3:34     ` Ajit Khaparde
2019-06-14  3:42       ` Lance Richardson
2019-06-14  4:20     ` [dpdk-dev] [PATCH] net/bnxt: fix compilation error with some compilers Ajit Khaparde
2019-06-14  6:56       ` Thomas Monjalon
2019-06-02 17:42 ` [dpdk-dev] [PATCH 10/11] net/bnxt: enable completion coalescing for thor Lance Richardson
2019-06-02 17:42 ` [dpdk-dev] [PATCH 11/11] net/bnxt: enable RSS for thor-based adapters Lance Richardson
2019-06-02 17:42 ` [dpdk-dev] [PATCH 11/11] net/bnxt: enable RSS for thor-based controllers Lance Richardson
2019-06-07 10:48 ` [dpdk-dev] [PATCH 00/11] add support for BCM57508 controller Ferruh Yigit
2019-06-07 10:52   ` Ferruh Yigit
2019-06-07 13:45     ` Lance Richardson
2019-06-07 14:13       ` 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=20190602174247.32368-8-lance.richardson@broadcom.com \
    --to=lance.richardson@broadcom.com \
    --cc=ajit.khaparde@broadcom.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    /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).