From: Selvin Xavier <selvin.xavier@broadcom.com>
To: jgg@ziepe.ca, leon@kernel.org
Cc: linux-rdma@vger.kernel.org, andrew.gospodarek@broadcom.com,
Kashyap Desai <kashyap.desai@broadcom.com>,
Selvin Xavier <selvin.xavier@broadcom.com>
Subject: [PATCH for-next 17/17] RDMA/bnxt_re: optimize the parameters passed to helper functions
Date: Thu, 8 Jun 2023 03:25:08 -0700 [thread overview]
Message-ID: <1686219908-11181-18-git-send-email-selvin.xavier@broadcom.com> (raw)
In-Reply-To: <1686219908-11181-1-git-send-email-selvin.xavier@broadcom.com>
[-- Attachment #1: Type: text/plain, Size: 7465 bytes --]
From: Kashyap Desai <kashyap.desai@broadcom.com>
Avoid passing arguments like Opcode which can be retrieved from
bnxt_qplib_crsqe structure.
Signed-off-by: Kashyap Desai <kashyap.desai@broadcom.com>
Signed-off-by: Selvin Xavier <selvin.xavier@broadcom.com>
---
drivers/infiniband/hw/bnxt_re/qplib_rcfw.c | 44 +++++++++++++-----------------
1 file changed, 19 insertions(+), 25 deletions(-)
diff --git a/drivers/infiniband/hw/bnxt_re/qplib_rcfw.c b/drivers/infiniband/hw/bnxt_re/qplib_rcfw.c
index 45bbf5f..3526518 100644
--- a/drivers/infiniband/hw/bnxt_re/qplib_rcfw.c
+++ b/drivers/infiniband/hw/bnxt_re/qplib_rcfw.c
@@ -93,9 +93,6 @@ static int bnxt_qplib_map_rc(u8 opcode)
* bnxt_re_is_fw_stalled - Check firmware health
* @rcfw - rcfw channel instance of rdev
* @cookie - cookie to track the command
- * @opcode - rcfw submitted for given opcode
- * @cbit - bitmap entry of cookie
- * @in_used - command is in used or freed
*
* If firmware has not responded any rcfw command within
* rcfw->max_timeout, consider firmware as stalled.
@@ -105,20 +102,22 @@ static int bnxt_qplib_map_rc(u8 opcode)
* -ENODEV if firmware is not responding
*/
static int bnxt_re_is_fw_stalled(struct bnxt_qplib_rcfw *rcfw,
- u16 cookie, u8 opcode, bool in_used)
+ u16 cookie)
{
struct bnxt_qplib_cmdq_ctx *cmdq;
+ struct bnxt_qplib_crsqe *crsqe;
+ crsqe = &rcfw->crsqe_tbl[cookie];
cmdq = &rcfw->cmdq;
if (time_after(jiffies, cmdq->last_seen +
(rcfw->max_timeout * HZ))) {
dev_warn_ratelimited(&rcfw->pdev->dev,
"%s: FW STALL Detected. cmdq[%#x]=%#x waited (%d > %d) msec active %d ",
- __func__, cookie, opcode,
+ __func__, cookie, crsqe->opcode,
jiffies_to_msecs(jiffies - cmdq->last_seen),
rcfw->max_timeout * 1000,
- in_used);
+ crsqe->is_in_used);
return -ENODEV;
}
@@ -129,7 +128,6 @@ static int bnxt_re_is_fw_stalled(struct bnxt_qplib_rcfw *rcfw,
* __wait_for_resp - Don't hold the cpu context and wait for response
* @rcfw - rcfw channel instance of rdev
* @cookie - cookie to track the command
- * @opcode - rcfw submitted for given opcode
*
* Wait for command completion in sleepable context.
*
@@ -137,7 +135,7 @@ static int bnxt_re_is_fw_stalled(struct bnxt_qplib_rcfw *rcfw,
* 0 if command is completed by firmware.
* Non zero error code for rest of the case.
*/
-static int __wait_for_resp(struct bnxt_qplib_rcfw *rcfw, u16 cookie, u8 opcode)
+static int __wait_for_resp(struct bnxt_qplib_rcfw *rcfw, u16 cookie)
{
struct bnxt_qplib_cmdq_ctx *cmdq;
struct bnxt_qplib_crsqe *crsqe;
@@ -148,7 +146,7 @@ static int __wait_for_resp(struct bnxt_qplib_rcfw *rcfw, u16 cookie, u8 opcode)
do {
if (test_bit(ERR_DEVICE_DETACHED, &cmdq->flags))
- return bnxt_qplib_map_rc(opcode);
+ return bnxt_qplib_map_rc(crsqe->opcode);
if (test_bit(FIRMWARE_STALL_DETECTED, &cmdq->flags))
return -ETIMEDOUT;
@@ -166,7 +164,7 @@ static int __wait_for_resp(struct bnxt_qplib_rcfw *rcfw, u16 cookie, u8 opcode)
if (!crsqe->is_in_used)
return 0;
- ret = bnxt_re_is_fw_stalled(rcfw, cookie, opcode, crsqe->is_in_used);
+ ret = bnxt_re_is_fw_stalled(rcfw, cookie);
if (ret)
return ret;
@@ -177,7 +175,6 @@ static int __wait_for_resp(struct bnxt_qplib_rcfw *rcfw, u16 cookie, u8 opcode)
* __block_for_resp - hold the cpu context and wait for response
* @rcfw - rcfw channel instance of rdev
* @cookie - cookie to track the command
- * @opcode - rcfw submitted for given opcode
*
* This function will hold the cpu (non-sleepable context) and
* wait for command completion. Maximum holding interval is 8 second.
@@ -186,7 +183,7 @@ static int __wait_for_resp(struct bnxt_qplib_rcfw *rcfw, u16 cookie, u8 opcode)
* -ETIMEOUT if command is not completed in specific time interval.
* 0 if command is completed by firmware.
*/
-static int __block_for_resp(struct bnxt_qplib_rcfw *rcfw, u16 cookie, u8 opcode)
+static int __block_for_resp(struct bnxt_qplib_rcfw *rcfw, u16 cookie)
{
struct bnxt_qplib_cmdq_ctx *cmdq = &rcfw->cmdq;
struct bnxt_qplib_crsqe *crsqe;
@@ -197,7 +194,7 @@ static int __block_for_resp(struct bnxt_qplib_rcfw *rcfw, u16 cookie, u8 opcode)
do {
if (test_bit(ERR_DEVICE_DETACHED, &cmdq->flags))
- return bnxt_qplib_map_rc(opcode);
+ return bnxt_qplib_map_rc(crsqe->opcode);
if (test_bit(FIRMWARE_STALL_DETECTED, &cmdq->flags))
return -ETIMEDOUT;
@@ -375,7 +372,6 @@ static int __send_message(struct bnxt_qplib_rcfw *rcfw,
* __poll_for_resp - self poll completion for rcfw command
* @rcfw - rcfw channel instance of rdev
* @cookie - cookie to track the command
- * @opcode - rcfw submitted for given opcode
*
* It works same as __wait_for_resp except this function will
* do self polling in sort interval since interrupt is disabled.
@@ -385,8 +381,7 @@ static int __send_message(struct bnxt_qplib_rcfw *rcfw,
* -ETIMEOUT if command is not completed in specific time interval.
* 0 if command is completed by firmware.
*/
-static int __poll_for_resp(struct bnxt_qplib_rcfw *rcfw, u16 cookie,
- u8 opcode)
+static int __poll_for_resp(struct bnxt_qplib_rcfw *rcfw, u16 cookie)
{
struct bnxt_qplib_cmdq_ctx *cmdq = &rcfw->cmdq;
struct bnxt_qplib_crsqe *crsqe;
@@ -398,7 +393,7 @@ static int __poll_for_resp(struct bnxt_qplib_rcfw *rcfw, u16 cookie,
do {
if (test_bit(ERR_DEVICE_DETACHED, &cmdq->flags))
- return bnxt_qplib_map_rc(opcode);
+ return bnxt_qplib_map_rc(crsqe->opcode);
if (test_bit(FIRMWARE_STALL_DETECTED, &cmdq->flags))
return -ETIMEDOUT;
@@ -409,7 +404,7 @@ static int __poll_for_resp(struct bnxt_qplib_rcfw *rcfw, u16 cookie,
return 0;
if (jiffies_to_msecs(jiffies - issue_time) >
(rcfw->max_timeout * 1000)) {
- ret = bnxt_re_is_fw_stalled(rcfw, cookie, opcode, crsqe->is_in_used);
+ ret = bnxt_re_is_fw_stalled(rcfw, cookie);
if (ret)
return ret;
}
@@ -417,13 +412,12 @@ static int __poll_for_resp(struct bnxt_qplib_rcfw *rcfw, u16 cookie,
};
static int __send_message_basic_sanity(struct bnxt_qplib_rcfw *rcfw,
- struct bnxt_qplib_cmdqmsg *msg)
+ struct bnxt_qplib_cmdqmsg *msg,
+ u8 opcode)
{
struct bnxt_qplib_cmdq_ctx *cmdq;
- u32 opcode;
cmdq = &rcfw->cmdq;
- opcode = __get_cmdq_base_opcode(msg->req, msg->req_sz);
/* Prevent posting if f/w is not in a state to process */
if (test_bit(ERR_DEVICE_DETACHED, &rcfw->cmdq.flags))
@@ -495,7 +489,7 @@ static int __bnxt_qplib_rcfw_send_message(struct bnxt_qplib_rcfw *rcfw,
opcode = __get_cmdq_base_opcode(msg->req, msg->req_sz);
- rc = __send_message_basic_sanity(rcfw, msg);
+ rc = __send_message_basic_sanity(rcfw, msg, opcode);
if (rc)
return rc == -ENXIO ? bnxt_qplib_map_rc(opcode) : rc;
@@ -507,11 +501,11 @@ static int __bnxt_qplib_rcfw_send_message(struct bnxt_qplib_rcfw *rcfw,
& RCFW_MAX_COOKIE_VALUE;
if (msg->block)
- rc = __block_for_resp(rcfw, cookie, opcode);
+ rc = __block_for_resp(rcfw, cookie);
else if (atomic_read(&rcfw->rcfw_intr_enabled))
- rc = __wait_for_resp(rcfw, cookie, opcode);
+ rc = __wait_for_resp(rcfw, cookie);
else
- rc = __poll_for_resp(rcfw, cookie, opcode);
+ rc = __poll_for_resp(rcfw, cookie);
if (rc) {
/* timed out */
dev_err(&rcfw->pdev->dev, "cmdq[%#x]=%#x timedout (%d)msec\n",
--
2.5.5
[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4224 bytes --]
prev parent reply other threads:[~2023-06-08 10:38 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-08 10:24 [PATCH for-next 00/17] RDMA/bnxt_re: Control path updates Selvin Xavier
2023-06-08 10:24 ` [PATCH for-next 01/17] RDMA/bnxt_re: wraparound mbox producer index Selvin Xavier
2023-06-08 10:24 ` [PATCH for-next 02/17] RDMA/bnxt_re: Avoid calling wake_up threads from spin_lock context Selvin Xavier
2023-06-08 10:24 ` [PATCH for-next 03/17] RDMA/bnxt_re: remove virt_func check while creating RoCE FW channel Selvin Xavier
2023-06-08 10:24 ` [PATCH for-next 04/17] RDMA/bnxt_re: set fixed command queue depth Selvin Xavier
2023-06-08 10:24 ` [PATCH for-next 05/17] RDMA/bnxt_re: Enhance the existing functions that wait for FW responses Selvin Xavier
2023-06-08 10:24 ` [PATCH for-next 06/17] RDMA/bnxt_re: Avoid the command wait if firmware is inactive Selvin Xavier
2023-06-08 10:24 ` [PATCH for-next 07/17] RDMA/bnxt_re: use shadow qd while posting non blocking rcfw command Selvin Xavier
2023-06-08 10:24 ` [PATCH for-next 08/17] RDMA/bnxt_re: Simplify the function that sends the FW commands Selvin Xavier
2023-06-08 10:25 ` [PATCH for-next 09/17] RDMA/bnxt_re: add helper function __poll_for_resp Selvin Xavier
2023-06-08 10:25 ` [PATCH for-next 10/17] RDMA/bnxt_re: handle command completions after driver detect a timedout Selvin Xavier
2023-06-08 12:53 ` kernel test robot
2023-06-08 10:25 ` [PATCH for-next 11/17] RDMA/bnxt_re: Add firmware stall check detection Selvin Xavier
2023-06-08 10:25 ` [PATCH for-next 12/17] RDMA/bnxt_re: post destroy_ah for delayed completion of AH creation Selvin Xavier
2023-06-08 10:25 ` [PATCH for-next 13/17] RDMA/bnxt_re: consider timeout of destroy ah as success Selvin Xavier
2023-06-08 10:25 ` [PATCH for-next 14/17] RDMA/bnxt_re: cancel all control path command waiters upon error Selvin Xavier
2023-06-08 10:25 ` [PATCH for-next 15/17] RDMA/bnxt_re: use firmware provided max request timeout Selvin Xavier
2023-06-08 10:25 ` [PATCH for-next 16/17] RDMA/bnxt_re: remove redundant cmdq_bitmap Selvin Xavier
2023-06-08 10:25 ` Selvin Xavier [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1686219908-11181-18-git-send-email-selvin.xavier@broadcom.com \
--to=selvin.xavier@broadcom.com \
--cc=andrew.gospodarek@broadcom.com \
--cc=jgg@ziepe.ca \
--cc=kashyap.desai@broadcom.com \
--cc=leon@kernel.org \
--cc=linux-rdma@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox