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 DB8A4A00E6 for ; Fri, 12 Jul 2019 08:08:09 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id F06C51BACA; Fri, 12 Jul 2019 08:07: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 8A4FB1B954 for ; Fri, 12 Jul 2019 08:07:04 +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 4BB8130C2D7; Thu, 11 Jul 2019 23:07:03 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.10.3 rnd-relay.smtp.broadcom.com 4BB8130C2D7 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=broadcom.com; s=dkimrelay; t=1562911623; bh=MfjDoxiaaTlI3BroV1EFWPfbGOc5vUGyJ5TEVcMbV4Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZQhV1UuXVPvMrXceq8buR2rYkQb2z9wQOSfkk7ppaCbWTjgyMtUzWzypK8CIUwQnZ 0gYSpWieTgEaoNpEbwTgJ435b/+a8V2BfBy7ShN/YLcW60IUp6uucIJRvS2gwcC2vM NpZXM6QHMtQ7T6XXwh0YEwbkZZffqUW1n3VnbCDk= Received: from localhost.localdomain (unknown [10.230.44.246]) by nis-sj1-27.broadcom.com (Postfix) with ESMTP id A8106AC074B; Thu, 11 Jul 2019 23:07:01 -0700 (PDT) From: Ajit Khaparde To: dev@dpdk.org Cc: ferruh.yigit@intel.com, Lance Richardson Date: Fri, 12 Jul 2019 11:36:16 +0530 Message-Id: <20190712060622.76975-10-ajit.khaparde@broadcom.com> X-Mailer: git-send-email 2.20.1 (Apple Git-117) In-Reply-To: <20190712060622.76975-1-ajit.khaparde@broadcom.com> References: <20190712060622.76975-1-ajit.khaparde@broadcom.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH 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 --- 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 f4f57862d..9e6074ae3 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)