From patchwork Thu Mar 23 09:12:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Selvin Xavier X-Patchwork-Id: 13185308 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 63FDFC7619A for ; Thu, 23 Mar 2023 09:13:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231367AbjCWJNU (ORCPT ); Thu, 23 Mar 2023 05:13:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34334 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231494AbjCWJNM (ORCPT ); Thu, 23 Mar 2023 05:13:12 -0400 Received: from mail-pf1-x434.google.com (mail-pf1-x434.google.com [IPv6:2607:f8b0:4864:20::434]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 57BCE1A95B for ; Thu, 23 Mar 2023 02:13:09 -0700 (PDT) Received: by mail-pf1-x434.google.com with SMTP id i15so8711239pfo.8 for ; Thu, 23 Mar 2023 02:13:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1679562789; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=CXE6NWV1wQ2VAW6XWzTt/QoRXeEA9TZDCJ3HKrwwYSU=; b=hA2cWZKaUMzSNqHe/mAl7gWD14za8xX1MhkAV9MrgH8d8V3uhbHOHvWXrlqBwDUavf 3aowknOtr9gTpFve8iSuNMxIyQIS6mk70T9cCdb7HVuSgOxsgBiXe83onoGPJJje0AOj 0BvmsAVh1mlcG0UFXlc6P4HQNPapABthfy5BI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679562789; 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=CXE6NWV1wQ2VAW6XWzTt/QoRXeEA9TZDCJ3HKrwwYSU=; b=eLJsxa97sZUMCeyHjG6piX3ph40MB0CvEJAFdMT2BOWc0n/BmStyXKh4G/BrHfuuBC iguAirS09bQupNm5iLEYuEmv8L476aoLU3sLKpeZtVXa7rP+nIm98MJc97goTRW/eFRJ Ou67Zn56aHBRnYvxLuyJJhm+nNqoySjJmO7Ow85aPYT5fWMdNt8aKmwY/XGqGqJsk5mW jxlGEp6yNhETefj6WFd6mvNb7FhKjU9fCpjQoZw+Z3CC8maw/hTC6kxvUrpaUus5fKw/ DsVIwRkQzEGn7jWBpk7NUcQR/WnxhtIfUz0twrQJt92PbsCj5Ysv64BypySt/SoxfkJe T6pA== X-Gm-Message-State: AO0yUKXXm0HYurd7MXlCTPqPRAgSHYtJ/4SS6fU7ZdR91yMLirj3+Kme 7R/SmDqMq60Dcq4DYV3CBoafttOIVushdcyDZlE= X-Google-Smtp-Source: AK7set+oPoxZcOFF0SF01HHDGzNv8a4QsPKpVDxOSfkg7CS/s5QaVVzx7vJ0eut6xLhEoV31KKLKbw== X-Received: by 2002:a62:62c3:0:b0:5e0:a86:a76f with SMTP id w186-20020a6262c3000000b005e00a86a76fmr6102616pfb.0.1679562788763; Thu, 23 Mar 2023 02:13:08 -0700 (PDT) Received: from dhcp-10-192-206-197.iig.avagotech.net.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id l20-20020a62be14000000b00627e9ab34b3sm9055114pff.91.2023.03.23.02.13.06 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 23 Mar 2023 02:13:07 -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 6/7] RDAM/bnxt_re: Use tlv apis while processing the slow path commands Date: Thu, 23 Mar 2023 02:12:18 -0700 Message-Id: <1679562739-24472-7-git-send-email-selvin.xavier@broadcom.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1679562739-24472-1-git-send-email-selvin.xavier@broadcom.com> References: <1679562739-24472-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",