From patchwork Thu Mar 30 09:45:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Selvin Xavier X-Patchwork-Id: 13193734 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7F5BAC761AF for ; Thu, 30 Mar 2023 09:47:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230359AbjC3Jrg (ORCPT ); Thu, 30 Mar 2023 05:47:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43024 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230361AbjC3JrG (ORCPT ); Thu, 30 Mar 2023 05:47:06 -0400 Received: from mail-pf1-x431.google.com (mail-pf1-x431.google.com [IPv6:2607:f8b0:4864:20::431]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 39C3986A2 for ; Thu, 30 Mar 2023 02:46:31 -0700 (PDT) Received: by mail-pf1-x431.google.com with SMTP id l14so12080914pfc.11 for ; Thu, 30 Mar 2023 02:46:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1680169585; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=GqLITbZ60zVDq+mCpxcEVaT/3F6rhsIXh9f67DkSI5M=; b=duOr4MuMUlKH980TogqxmMsidlVZ2hMB0fzt8l0sM6SDBrtFomW7f3QlVzpJAcNzE3 eO9aPIkPd9jd4hAoreVBqZghtrnDZdom5HlqFbNE4bfAM9h3wthzPIMOUhQPsI4GDkol XNFpwsHliqLDPRDRR19kQ3iRut/zuTI5iYM8c= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680169585; 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=GqLITbZ60zVDq+mCpxcEVaT/3F6rhsIXh9f67DkSI5M=; b=zJ/Hz+x0hB2caLd2BOBSctxm7Pq3BhpNZYTz/37UrxQF3+R7j4BiM4Jidma1QN3ibO jTIWwN6oh4aOdda3n/FhK5DtrM/ZJkMgIiLW+d/lHl96nrUXofeUSTHOjpuoqrQ7dzGy +e5+RVMeXvKbHO9mT3gS4Bj8q/IZNmYeyTLtoJ4jqv5LPIbTMtdD5TM235FfRmUSL/Mx AadzwhxD1zwFPhhlNgLohumGZFkNzZCCWlKAqVSRqPb2u+3xa5QdAJhuZ0beQGGE1qB2 +7NkXk+/IHIrFbnnC8cT0/IlxEhO0BrAo0w92vJaiYEXnf/y/EwwUG9UWEHmsp3+gZDt 80DQ== X-Gm-Message-State: AAQBX9flf3gHAQ9feRuWCUB2N7S0rYEmMgxXmVZ3qW8+PnNVTiss6ZKQ i4bg0oa4db6GJPZWPsNras89RQ== X-Google-Smtp-Source: AKy350bfFW6fzYa8RcwJoABOFKR8wNfQArU8O2wHpv655GFlWYC+JMCTx6DNSEjt7xL+o4YZAIGupQ== X-Received: by 2002:aa7:971c:0:b0:625:7acb:bf0e with SMTP id a28-20020aa7971c000000b006257acbbf0emr20998702pfg.19.1680169585583; Thu, 30 Mar 2023 02:46:25 -0700 (PDT) Received: from dhcp-10-192-206-197.iig.avagotech.net.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id c26-20020aa78e1a000000b00625616f59a1sm24468857pfr.73.2023.03.30.02.46.23 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 30 Mar 2023 02:46:24 -0700 (PDT) From: Selvin Xavier To: jgg@ziepe.ca, leon@kernel.org Cc: linux-rdma@vger.kernel.org, andrew.gospodarek@broadcom.com, Selvin Xavier Subject: [PATCH for-next v3 6/7] RDAM/bnxt_re: Use tlv apis while processing the slow path commands Date: Thu, 30 Mar 2023 02:45:39 -0700 Message-Id: <1680169540-10029-7-git-send-email-selvin.xavier@broadcom.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1680169540-10029-1-git-send-email-selvin.xavier@broadcom.com> References: <1680169540-10029-1-git-send-email-selvin.xavier@broadcom.com> Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org Use the new TLV APIs for existing slow path commands. The TLV APIs will be used to populate extended headers for some of the Firmware commands, which will be introduced in the patches that follow. Signed-off-by: Selvin Xavier --- drivers/infiniband/hw/bnxt_re/qplib_rcfw.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/drivers/infiniband/hw/bnxt_re/qplib_rcfw.c b/drivers/infiniband/hw/bnxt_re/qplib_rcfw.c index 7403a4e..06979f7 100644 --- a/drivers/infiniband/hw/bnxt_re/qplib_rcfw.c +++ b/drivers/infiniband/hw/bnxt_re/qplib_rcfw.c @@ -49,6 +49,7 @@ #include "qplib_rcfw.h" #include "qplib_sp.h" #include "qplib_fp.h" +#include "qplib_tlv.h" static void bnxt_qplib_service_creq(struct tasklet_struct *t); @@ -101,7 +102,7 @@ static int __send_message(struct bnxt_qplib_rcfw *rcfw, pdev = rcfw->pdev; - opcode = msg->req->opcode; + opcode = __get_cmdq_base_opcode(msg->req, msg->req_sz); if (!test_bit(FIRMWARE_INITIALIZED_FLAG, &cmdq->flags) && (opcode != CMDQ_BASE_OPCODE_QUERY_FUNC && opcode != CMDQ_BASE_OPCODE_INITIALIZE_FW && @@ -137,7 +138,7 @@ static int __send_message(struct bnxt_qplib_rcfw *rcfw, cookie |= RCFW_CMD_IS_BLOCKING; set_bit(cbit, cmdq->cmdq_bitmap); - msg->req->cookie = cpu_to_le16(cookie); + __set_cmdq_base_cookie(msg->req, msg->req_sz, cpu_to_le16(cookie)); crsqe = &rcfw->crsqe_tbl[cbit]; if (crsqe->resp) { spin_unlock_irqrestore(&hwq->lock, flags); @@ -153,13 +154,12 @@ static int __send_message(struct bnxt_qplib_rcfw *rcfw, memset(msg->resp, 0, sizeof(*msg->resp)); crsqe->resp = (struct creq_qp_event *)msg->resp; crsqe->resp->cookie = msg->req->cookie; - crsqe->req_size = msg->req->cmd_size; - if (msg->req->resp_size && msg->sb) { + crsqe->req_size = __get_cmdq_base_cmd_size(msg->req, msg->req_sz); + if (__get_cmdq_base_resp_size(msg->req, msg->req_sz) && msg->sb) { struct bnxt_qplib_rcfw_sbuf *sbuf = msg->sb; - - msg->req->resp_addr = cpu_to_le64(sbuf->dma_addr); - msg->req->resp_size = (sbuf->size + BNXT_QPLIB_CMDQE_UNITS - 1) / - BNXT_QPLIB_CMDQE_UNITS; + __set_cmdq_base_resp_addr(msg->req, msg->req_sz, cpu_to_le64(sbuf->dma_addr)); + __set_cmdq_base_resp_size(msg->req, msg->req_sz, + ALIGN(sbuf->size, BNXT_QPLIB_CMDQE_UNITS)); } preq = (u8 *)msg->req; @@ -214,12 +214,12 @@ int bnxt_qplib_rcfw_send_message(struct bnxt_qplib_rcfw *rcfw, return 0; do { - opcode = msg->req->opcode; + opcode = __get_cmdq_base_opcode(msg->req, msg->req_sz); rc = __send_message(rcfw, msg); - cookie = le16_to_cpu(msg->req->cookie) & RCFW_MAX_COOKIE_VALUE; + cookie = le16_to_cpu(__get_cmdq_base_cookie(msg->req, msg->req_sz)) & + RCFW_MAX_COOKIE_VALUE; if (!rc) break; - if (!retry_cnt || (rc != -EAGAIN && rc != -EBUSY)) { /* send failed */ dev_err(&rcfw->pdev->dev, "cmdq[%#x]=%#x send failed\n",