From patchwork Sat Mar 25 18:44:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Selvin Xavier X-Patchwork-Id: 13187859 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 8AEFFC6FD1C for ; Sat, 25 Mar 2023 18:46:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229977AbjCYSqt (ORCPT ); Sat, 25 Mar 2023 14:46:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35462 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230420AbjCYSot (ORCPT ); Sat, 25 Mar 2023 14:44:49 -0400 Received: from mail-pj1-x102a.google.com (mail-pj1-x102a.google.com [IPv6:2607:f8b0:4864:20::102a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1E234EC7A for ; Sat, 25 Mar 2023 11:44:47 -0700 (PDT) Received: by mail-pj1-x102a.google.com with SMTP id mp3-20020a17090b190300b0023fcc8ce113so8026032pjb.4 for ; Sat, 25 Mar 2023 11:44:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1679769886; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=sp0HcNuWdG6NR7mOGPVZqgq9sxP9ZOanCk/Fyd1G0rk=; b=hT0CZDtgU5r7ZxrGsrwlgr6IkOOf65qZ6j7ECTbIrAKalOWR9m2Yh2NJy4PAmb5SMc mxR0bzl82feta5d5niS6ED4Iqi+LrVH762rZSVGgOBla2A6yPvbMgzChADYg8bhm08+o yH/UenqdOhUhtfFSPMLlKXqAMoudEjqdPtoa8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679769886; 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=sp0HcNuWdG6NR7mOGPVZqgq9sxP9ZOanCk/Fyd1G0rk=; b=W0b6BilCYqsdYjC1CyJQUxi2LYNuSGq1aEnB7nTgOvDdeQe/c80VDKi746qeLbhHRe hz/AZBzxViZh3zw821VypBG4lptWeNMyS8FNrmHYNpDTZCwF+aMLpHZMsWfgnN7dSycu /c+SAWi11RUsio4gJORaxjukpK/meaJi5yzl5McEGHK5Hj8PIEws3BpOztDpnjgyzYvL e/p85BVtwzl8jTz3bnA6+Rbdk5axZ9NEWnRT+WYLVPLF7myD+1zy7IirrY8s/qoPtcyw cRLBTRYdY5fMXzKbDV5oxMeonVH9AXCAWCpo2ezUIC6jVBcVfK01HPrQ2xnvd8padoI9 6V2Q== X-Gm-Message-State: AAQBX9fxijOAOIdzRbfSD6BeDUo9TeQnHlE0dLXvnnhPu8G5lB9lovIs up02R3SjjnE0EzdEJV9ZObwEbMmRv3BpIRWaP9Q= X-Google-Smtp-Source: AKy350a8DaPjQv9EIG7K0hJ/llmv93Xd3X2wMcBxemU6ql+pOZLz5f82LZiB5airXWoWiDV5z6CMaA== X-Received: by 2002:a17:902:c949:b0:1a1:adb0:ed72 with SMTP id i9-20020a170902c94900b001a1adb0ed72mr8203648pla.4.1679769886606; Sat, 25 Mar 2023 11:44:46 -0700 (PDT) Received: from dhcp-10-192-206-197.iig.avagotech.net.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id q12-20020a170902b10c00b0019a70a42b0asm16283031plr.169.2023.03.25.11.44.44 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 25 Mar 2023 11:44:45 -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 v2 6/7] RDAM/bnxt_re: Use tlv apis while processing the slow path commands Date: Sat, 25 Mar 2023 11:44:13 -0700 Message-Id: <1679769854-30605-7-git-send-email-selvin.xavier@broadcom.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1679769854-30605-1-git-send-email-selvin.xavier@broadcom.com> References: <1679769854-30605-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",