From patchwork Thu Dec 7 10:47:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Selvin Xavier X-Patchwork-Id: 13483156 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="UkyR6+9E" Received: from mail-pj1-x1036.google.com (mail-pj1-x1036.google.com [IPv6:2607:f8b0:4864:20::1036]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 28914D1 for ; Thu, 7 Dec 2023 03:04:35 -0800 (PST) Received: by mail-pj1-x1036.google.com with SMTP id 98e67ed59e1d1-289d988a947so369136a91.0 for ; Thu, 07 Dec 2023 03:04:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1701947074; x=1702551874; darn=vger.kernel.org; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=yzHd2QHTh8VD8MyJhl5d5YFVvrurch7g3IJHWkhJxsw=; b=UkyR6+9EnTeyd/jsk88sOKvKrswkDn+endhWxfzxIMr0flMgx6Eua/CuRO61Q41m46 /1vvMKH7YhxcRRSsimUXntlOKCFCI1an37jtfPg0Kmav68RoVYijwu9hJQlqrDXPde4c LJIhjiLjOvtGJli2b8hxX5UlY7YbUKPoiBDMk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701947074; x=1702551874; h=references:in-reply-to:message-id:date:subject:cc:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=yzHd2QHTh8VD8MyJhl5d5YFVvrurch7g3IJHWkhJxsw=; b=v48NusasC8kaJrP8qffkOkO/sUcVCsI/nBtEkICUUt52PZdqswHCkQLmYxfzKDsTWp 9c4Yz5OVygDNfGxh0+q02vIlvy925tguCekzcImN0W4s16PO3TYvAfdsJ0UO61meW+b9 g9GLOYqstN7PUuvMdEoPSJf9hp1fV+ebF0MDwfMO7OGgQgc6sBBisE4H6R1bfqlKQq8O dhQV4dzYEJqKvRgV1dj+Q6i4gu5fp2Us1ZI9BuXNrE5liLW1lKvZv6gyH6quOjO/YZgc yIs/R6uO8Cra9MYiXRchYG4zvj47SLjUmF7lwz57kpMvL8RU42DuiMV6ulwftmFZOnhk l+5Q== X-Gm-Message-State: AOJu0YycLhrtnU9MMiKrnzS6BD5bw5b9NnlfEAzj0c7JZOAgpyJcuIxQ h9Z54qrqJxhClrdzH7vTtiK0bg== X-Google-Smtp-Source: AGHT+IF/8kAH6WSaFoAlXgXvbtZIbh+14PzCgZkg2HRJkFA743tMpRHGsj+aojf1hvB5AseHFCv+0A== X-Received: by 2002:a17:90b:1d0b:b0:286:7ec2:df40 with SMTP id on11-20020a17090b1d0b00b002867ec2df40mr1865362pjb.2.1701947074542; Thu, 07 Dec 2023 03:04:34 -0800 (PST) Received: from dhcp-10-192-206-197.iig.avagotech.net.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id pm2-20020a17090b3c4200b00285db538b17sm1034254pjb.41.2023.12.07.03.04.32 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 07 Dec 2023 03:04:34 -0800 (PST) From: Selvin Xavier To: leon@kernel.org, jgg@ziepe.ca Cc: linux-rdma@vger.kernel.org, Selvin Xavier Subject: [PATCH for-next 4/6] RDMA/bnxt_re: Get the toggle bits from CQ completions Date: Thu, 7 Dec 2023 02:47:38 -0800 Message-Id: <1701946060-13931-5-git-send-email-selvin.xavier@broadcom.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1701946060-13931-1-git-send-email-selvin.xavier@broadcom.com> References: <1701946060-13931-1-git-send-email-selvin.xavier@broadcom.com> Precedence: bulk X-Mailing-List: linux-rdma@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Get the toggle bits from CQ completions. For older adapters these values are 0. Signed-off-by: Selvin Xavier --- drivers/infiniband/hw/bnxt_re/qplib_fp.c | 6 ++++++ drivers/infiniband/hw/bnxt_re/qplib_fp.h | 1 + drivers/infiniband/hw/bnxt_re/qplib_res.h | 1 + 3 files changed, 8 insertions(+) diff --git a/drivers/infiniband/hw/bnxt_re/qplib_fp.c b/drivers/infiniband/hw/bnxt_re/qplib_fp.c index 1b7e950..177c6c1 100644 --- a/drivers/infiniband/hw/bnxt_re/qplib_fp.c +++ b/drivers/infiniband/hw/bnxt_re/qplib_fp.c @@ -330,6 +330,9 @@ static void bnxt_qplib_service_nq(struct tasklet_struct *t) cq = (struct bnxt_qplib_cq *)(unsigned long)q_handle; if (!cq) break; + cq->toggle = (le16_to_cpu(nqe->info10_type) & + NQ_CN_TOGGLE_MASK) >> NQ_CN_TOGGLE_SFT; + cq->dbinfo.toggle = cq->toggle; bnxt_qplib_armen_db(&cq->dbinfo, DBC_DBC_TYPE_CQ_ARMENA); spin_lock_bh(&cq->compl_lock); @@ -2124,6 +2127,8 @@ int bnxt_qplib_create_cq(struct bnxt_qplib_res *res, struct bnxt_qplib_cq *cq) cq->dbinfo.xid = cq->id; cq->dbinfo.db = cq->dpi->dbr; cq->dbinfo.priv_db = res->dpi_tbl.priv_db; + cq->dbinfo.flags = 0; + cq->dbinfo.toggle = 0; bnxt_qplib_armen_db(&cq->dbinfo, DBC_DBC_TYPE_CQ_ARMENA); @@ -3018,6 +3023,7 @@ int bnxt_qplib_poll_cq(struct bnxt_qplib_cq *cq, struct bnxt_qplib_cqe *cqe, void bnxt_qplib_req_notify_cq(struct bnxt_qplib_cq *cq, u32 arm_type) { + cq->dbinfo.toggle = cq->toggle; if (arm_type) bnxt_qplib_ring_db(&cq->dbinfo, arm_type); /* Using cq->arm_state variable to track whether to issue cq handler */ diff --git a/drivers/infiniband/hw/bnxt_re/qplib_fp.h b/drivers/infiniband/hw/bnxt_re/qplib_fp.h index 23c27cb..8a6bea20 100644 --- a/drivers/infiniband/hw/bnxt_re/qplib_fp.h +++ b/drivers/infiniband/hw/bnxt_re/qplib_fp.h @@ -418,6 +418,7 @@ struct bnxt_qplib_cq { bool resize_in_progress; struct bnxt_qplib_sg_info sg_info; u64 cq_handle; + u8 toggle; #define CQ_RESIZE_WAIT_TIME_MS 500 unsigned long flags; diff --git a/drivers/infiniband/hw/bnxt_re/qplib_res.h b/drivers/infiniband/hw/bnxt_re/qplib_res.h index 397846b..7e6d907 100644 --- a/drivers/infiniband/hw/bnxt_re/qplib_res.h +++ b/drivers/infiniband/hw/bnxt_re/qplib_res.h @@ -190,6 +190,7 @@ struct bnxt_qplib_db_info { u32 xid; u32 max_slot; u32 flags; + u8 toggle; }; enum bnxt_qplib_db_info_flags_mask {