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 18C31A0471 for ; Tue, 16 Jul 2019 11:30:08 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 084551BDEB; Tue, 16 Jul 2019 11:29:09 +0200 (CEST) Received: from rnd-relay.smtp.broadcom.com (rnd-relay.smtp.broadcom.com [192.19.229.170]) by dpdk.org (Postfix) with ESMTP id C90BD1B94F for ; Tue, 16 Jul 2019 11:28:50 +0200 (CEST) Received: from nis-sj1-27.broadcom.com (nis-sj1-27.lvn.broadcom.net [10.75.144.136]) by rnd-relay.smtp.broadcom.com (Postfix) with ESMTP id 9896530C037; Tue, 16 Jul 2019 02:28:49 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.10.3 rnd-relay.smtp.broadcom.com 9896530C037 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=broadcom.com; s=dkimrelay; t=1563269329; bh=5ATZ2wUafOqbMn9qs7E3ffeQiiRY472jGYlEmFiN+vY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wI+DmvjgSTJ6EqOgQ68TFQi92VqlJidJ0lqNIPvq4tGY75MX5WX8SR9g07h9iHzoI /PfNeCCsKaTNGaZ/cwFQbGmsSd9TQqYf164iI+LB+qnHTRNhDPaUQqwRTQ6jtM6KO1 1wLgtDCo0biz/dmuL3m4rMS5HDh79ZzFtRgUmuWM= Received: from C02VPB22HTD6.wifi.broadcom.net (c02vpb22htd6.wifi.broadcom.net [10.122.43.105]) by nis-sj1-27.broadcom.com (Postfix) with ESMTP id 0F3DAAC0749; Tue, 16 Jul 2019 02:28:47 -0700 (PDT) From: Ajit Khaparde To: dev@dpdk.org Cc: ferruh.yigit@intel.com, Lance Richardson Date: Tue, 16 Jul 2019 14:58:20 +0530 Message-Id: <20190716092826.54276-10-ajit.khaparde@broadcom.com> X-Mailer: git-send-email 2.20.1 (Apple Git-117) In-Reply-To: <20190716092826.54276-1-ajit.khaparde@broadcom.com> References: <20190712060622.76975-1-ajit.khaparde@broadcom.com> <20190716092826.54276-1-ajit.khaparde@broadcom.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v2 09/15] net/bnxt: nq doorbell cleanups 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" From: Lance Richardson Simplify nq doorbell handling code by removing redundant db parameter and consolidating NQ doorbell macro into the inline function that uses it. Add "enable interrupt" variant of nq write. This will be used in a subsequent commit. When initializing nq doorbell, don't assume that only the "disable interrupt" form will be used. Fixes: f8168ca0e690 ("net/bnxt: support thor controller") Signed-off-by: Lance Richardson Reviewed-by: Ajit Khaparde Signed-off-by: Ajit Khaparde --- drivers/net/bnxt/bnxt.h | 1 + drivers/net/bnxt/bnxt_ring.c | 2 +- drivers/net/bnxt/bnxt_ring.h | 23 ++++++++++++++++++----- 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h index cd809b385..3ccf784e5 100644 --- a/drivers/net/bnxt/bnxt.h +++ b/drivers/net/bnxt/bnxt.h @@ -246,6 +246,7 @@ struct bnxt_coal { #define DBR_TYPE_SRQ (0x2ULL << 60) #define DBR_TYPE_CQ (0x4ULL << 60) #define DBR_TYPE_NQ (0xaULL << 60) +#define DBR_TYPE_NQ_ARM (0xbULL << 60) #define BNXT_RSS_TBL_SIZE_THOR 512 #define BNXT_RSS_ENTRIES_PER_CTX_THOR 64 diff --git a/drivers/net/bnxt/bnxt_ring.c b/drivers/net/bnxt/bnxt_ring.c index 9b19459b6..faf861cc1 100644 --- a/drivers/net/bnxt/bnxt_ring.c +++ b/drivers/net/bnxt/bnxt_ring.c @@ -341,7 +341,7 @@ static void bnxt_set_db(struct bnxt *bp, db->db_key64 = DBR_PATH_L2 | DBR_TYPE_CQ; break; case HWRM_RING_ALLOC_INPUT_RING_TYPE_NQ: - db->db_key64 = DBR_PATH_L2 | DBR_TYPE_NQ; + db->db_key64 = DBR_PATH_L2; break; } db->db_key64 |= (uint64_t)fid << DBR_XID_SFT; diff --git a/drivers/net/bnxt/bnxt_ring.h b/drivers/net/bnxt/bnxt_ring.h index af2c5762f..e5cef3a1d 100644 --- a/drivers/net/bnxt/bnxt_ring.h +++ b/drivers/net/bnxt/bnxt_ring.h @@ -84,15 +84,28 @@ static inline void bnxt_db_write(struct bnxt_db_info *db, uint32_t idx) rte_write32(db->db_key32 | idx, db->doorbell); } +/* Ring an NQ doorbell and disable interrupts for the ring. */ static inline void bnxt_db_nq(struct bnxt_cp_ring_info *cpr) { - struct bnxt_db_info *db = &cpr->cp_db; + if (unlikely(!cpr->cp_db.db_64)) + return; + + rte_smp_wmb(); + rte_write64(cpr->cp_db.db_key64 | DBR_TYPE_NQ | + RING_CMP(cpr->cp_ring_struct, cpr->cp_raw_cons), + cpr->cp_db.doorbell); +} + +/* Ring an NQ doorbell and enable interrupts for the ring. */ +static inline void bnxt_db_nq_arm(struct bnxt_cp_ring_info *cpr) +{ + if (unlikely(!cpr->cp_db.db_64)) + return; rte_smp_wmb(); - if (likely(db->db_64)) - rte_write64(db->db_key64 | DBR_TYPE_NQ | - RING_CMP(cpr->cp_ring_struct, cpr->cp_raw_cons), - db->doorbell); + rte_write64(cpr->cp_db.db_key64 | DBR_TYPE_NQ_ARM | + RING_CMP(cpr->cp_ring_struct, cpr->cp_raw_cons), + cpr->cp_db.doorbell); } static inline void bnxt_db_cq(struct bnxt_cp_ring_info *cpr) -- 2.20.1 (Apple Git-117)