From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 7F37BA0096 for ; Sun, 2 Jun 2019 19:44:15 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 9F3CD1B9A2; Sun, 2 Jun 2019 19:43:21 +0200 (CEST) Received: from mail-yb1-f194.google.com (mail-yb1-f194.google.com [209.85.219.194]) by dpdk.org (Postfix) with ESMTP id E5A941B94B for ; Sun, 2 Jun 2019 19:43:10 +0200 (CEST) Received: by mail-yb1-f194.google.com with SMTP id p8so5719393ybo.13 for ; Sun, 02 Jun 2019 10:43:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=wHk/+MRirWD3kvYnCvzJf/XXJQHvRcoPBEca6oS3qGs=; b=hpNfd3LPZSP1EUq2xkzlFhvFsRUbFCKoSzRqh/WBhNnpbGBE4NC5+sOW5b8x8MPciF jXwi2kaMOJc5r5cm2/nB4IuAGZib/chha0DwPAV2lMFJtrobo+mmA7UeMLxUZpGb64qX cRyMqO9+nezlb1mekTFOpSZz/r3XjNk1MOC0g= 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; bh=wHk/+MRirWD3kvYnCvzJf/XXJQHvRcoPBEca6oS3qGs=; b=LrUkvlwWopqYWfAX/rJzb9Be0owsTZg0x4eE/+i8xn87Ixtbm6Iuhf7LXNB7YPvJ9v e9mfZX9m5VVbiydmFY0KebqdwGgnvzs/FMJFiZ819WhrsFEZZ+G5hUVc4/D0cTv/UY+D LfDt1yEw+ZTI755JzBI8niWnz00cfZ6SusX1agr9AALQt2v3j9TQAhQUDLCDaluAwU3Y pPdafHGHX1Xv3Y2JCOLKPA0SaZ+x9tIovgZfuMBzrBGOTGj04hjY86PmyAAzpLKS0Zfr bZ7DeLYdnTRTmQYfEqXYCk2tA6By9AE3q9MGW4zGIL4upkclfXnEt/zm9OPHSYQuKi15 nfJA== X-Gm-Message-State: APjAAAWtkmDx4PGR+xs0/rl/XZ0duVEy2tc8VORtcY8843EX1jwr5r59 B/F3MmzrrdKAnyvPeA4KhSulpH6zp1lD+8mNvgcssQw9P6s0GQyt0gp1Zn0NlSXuiegSyJQxHtg AMRoXiANglKGEvFjeQ2exbuVlhDGiWuwCQ13uiDvdw2Y3wIz/25IDRujUz73qptmB X-Google-Smtp-Source: APXvYqxWyLEIP/isVR6XS0cCLQICYGBOSaM3I/5mUF9A51KP4KHWnf3mMMwxRbGISHzCgiOilP5m5w== X-Received: by 2002:a25:bfc1:: with SMTP id q1mr10800383ybm.371.1559497389830; Sun, 02 Jun 2019 10:43:09 -0700 (PDT) Received: from lrichardson-VirtualBox.attlocal.net (69-218-223-106.lightspeed.rlghnc.sbcglobal.net. [69.218.223.106]) by smtp.gmail.com with ESMTPSA id n78sm1000819ywd.2.2019.06.02.10.43.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 02 Jun 2019 10:43:09 -0700 (PDT) From: Lance Richardson To: dev@dpdk.org Cc: ajit.khaparde@broadcom.com, ferruh.yigit@intel.com, Lance Richardson Date: Sun, 2 Jun 2019 13:42:42 -0400 Message-Id: <20190602174247.32368-8-lance.richardson@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190602174247.32368-1-lance.richardson@broadcom.com> References: <20190602174247.32368-1-lance.richardson@broadcom.com> Subject: [dpdk-dev] [PATCH 07/11] net/bnxt: refactor doorbell handling 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" Reduce code duplication and prepare for newer controllers that use different doorbell protocols by refactoring doorbell handling code. Signed-off-by: Lance Richardson Reviewed-by: Ajit Kumar Khaparde --- 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 +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