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 80A8AA0471 for ; Wed, 17 Jul 2019 12:43:18 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 363EB1BC20; Wed, 17 Jul 2019 12:42:15 +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 4ED221B9AF for ; Wed, 17 Jul 2019 12:42:05 +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 1FB5A30C0AB; Wed, 17 Jul 2019 03:42:04 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.10.3 rnd-relay.smtp.broadcom.com 1FB5A30C0AB DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=broadcom.com; s=dkimrelay; t=1563360124; bh=5ATZ2wUafOqbMn9qs7E3ffeQiiRY472jGYlEmFiN+vY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AiayFuUUB+/PCgFD+Bj8deR/5dehGD0sgJMpBcu24cK6TTEOc1/Zr+HXQKw7a5iwg d7leFAaJgzI93TjG2DT551ijWs0nbng7tIQQ4P5XLQYU8ixK3ZNH9Ul3eLtxB8ttAk BpViL6kqjmFCTTmInnVaCKuPkedZ0x+ZnL5Lq+5w= Received: from C02VPB22HTD6.wifi.broadcom.net (c02vpb22htd6.wifi.broadcom.net [10.122.43.105]) by nis-sj1-27.broadcom.com (Postfix) with ESMTP id A9990AC0749; Wed, 17 Jul 2019 03:42:02 -0700 (PDT) From: Ajit Khaparde To: dev@dpdk.org Cc: ferruh.yigit@intel.com, Lance Richardson Date: Wed, 17 Jul 2019 16:11:33 +0530 Message-Id: <20190717104139.21155-10-ajit.khaparde@broadcom.com> X-Mailer: git-send-email 2.20.1 (Apple Git-117) In-Reply-To: <20190717104139.21155-1-ajit.khaparde@broadcom.com> References: <0c1b327c-2c36-652f-c88d-cbca8f873c13@intel.com> <20190717104139.21155-1-ajit.khaparde@broadcom.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v3 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)