From: Gal Pressman <galpress@amazon.com>
To: Jason Gunthorpe <jgg@nvidia.com>, Doug Ledford <dledford@redhat.com>
Cc: <linux-rdma@vger.kernel.org>,
Alexander Matushevsky <matua@amazon.com>,
Gal Pressman <galpress@amazon.com>,
Firas JahJah <firasj@amazon.com>,
Yossi Leybovich <sleybo@amazon.com>
Subject: [PATCH for-next 1/5] RDMA/efa: Remove redundant NULL pointer check of CQE
Date: Tue, 26 Jan 2021 14:06:57 +0200 [thread overview]
Message-ID: <20210126120702.9807-2-galpress@amazon.com> (raw)
In-Reply-To: <20210126120702.9807-1-galpress@amazon.com>
A pointer to store the command completion must be provided as it is
always used in efa_com_put_comp_ctx() to return the completion context
back to the pool. Remove the NULL pointer check and the redundant
'status' field stored on the context as it could be retrieved from the
completion itself.
Reviewed-by: Firas JahJah <firasj@amazon.com>
Reviewed-by: Yossi Leybovich <sleybo@amazon.com>
Signed-off-by: Gal Pressman <galpress@amazon.com>
---
drivers/infiniband/hw/efa/efa_com.c | 16 ++++++----------
1 file changed, 6 insertions(+), 10 deletions(-)
diff --git a/drivers/infiniband/hw/efa/efa_com.c b/drivers/infiniband/hw/efa/efa_com.c
index f7242188a843..747efc794cc0 100644
--- a/drivers/infiniband/hw/efa/efa_com.c
+++ b/drivers/infiniband/hw/efa/efa_com.c
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0 OR BSD-2-Clause
/*
- * Copyright 2018-2020 Amazon.com, Inc. or its affiliates. All rights reserved.
+ * Copyright 2018-2021 Amazon.com, Inc. or its affiliates. All rights reserved.
*/
#include "efa_com.h"
@@ -33,8 +33,6 @@ struct efa_comp_ctx {
struct efa_admin_acq_entry *user_cqe;
u32 comp_size;
enum efa_cmd_status status;
- /* status from the device */
- u8 comp_status;
u8 cmd_opcode;
u8 occupied;
};
@@ -421,9 +419,7 @@ static void efa_com_handle_single_admin_completion(struct efa_com_admin_queue *a
}
comp_ctx->status = EFA_CMD_COMPLETED;
- comp_ctx->comp_status = cqe->acq_common_descriptor.status;
- if (comp_ctx->user_cqe)
- memcpy(comp_ctx->user_cqe, cqe, comp_ctx->comp_size);
+ memcpy(comp_ctx->user_cqe, cqe, comp_ctx->comp_size);
if (!test_bit(EFA_AQ_STATE_POLLING_BIT, &aq->state))
complete(&comp_ctx->wait_event);
@@ -521,7 +517,7 @@ static int efa_com_wait_and_process_admin_cq_polling(struct efa_comp_ctx *comp_c
msleep(aq->poll_interval);
}
- err = efa_com_comp_status_to_errno(comp_ctx->comp_status);
+ err = efa_com_comp_status_to_errno(comp_ctx->user_cqe->acq_common_descriptor.status);
out:
efa_com_put_comp_ctx(aq, comp_ctx);
return err;
@@ -569,7 +565,7 @@ static int efa_com_wait_and_process_admin_cq_interrupts(struct efa_comp_ctx *com
goto out;
}
- err = efa_com_comp_status_to_errno(comp_ctx->comp_status);
+ err = efa_com_comp_status_to_errno(comp_ctx->user_cqe->acq_common_descriptor.status);
out:
efa_com_put_comp_ctx(aq, comp_ctx);
return err;
@@ -641,8 +637,8 @@ int efa_com_cmd_exec(struct efa_com_admin_queue *aq,
aq->efa_dev,
"Failed to process command %s (opcode %u) comp_status %d err %d\n",
efa_com_cmd_str(cmd->aq_common_descriptor.opcode),
- cmd->aq_common_descriptor.opcode, comp_ctx->comp_status,
- err);
+ cmd->aq_common_descriptor.opcode,
+ comp_ctx->user_cqe->acq_common_descriptor.status, err);
atomic64_inc(&aq->stats.cmd_err);
}
--
2.30.0
next prev parent reply other threads:[~2021-01-26 12:09 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-26 12:06 [PATCH for-next 0/5] EFA cleanups 2021-01-26 Gal Pressman
2021-01-26 12:06 ` Gal Pressman [this message]
2021-01-26 12:06 ` [PATCH for-next 2/5] RDMA/efa: Remove duplication of upper/lower_32_bits Gal Pressman
2021-01-26 12:06 ` [PATCH for-next 3/5] RDMA/efa: Remove unnecessary indentation in defs comments Gal Pressman
2021-01-26 12:07 ` [PATCH for-next 4/5] RDMA/efa: Remove unused 'select' field from get/set feature command descriptor Gal Pressman
2021-01-26 12:07 ` [PATCH for-next 5/5] RDMA/efa: Remove unused syndrome enum values Gal Pressman
2021-01-28 19:58 ` [PATCH for-next 0/5] EFA cleanups 2021-01-26 Jason Gunthorpe
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=20210126120702.9807-2-galpress@amazon.com \
--to=galpress@amazon.com \
--cc=dledford@redhat.com \
--cc=firasj@amazon.com \
--cc=jgg@nvidia.com \
--cc=linux-rdma@vger.kernel.org \
--cc=matua@amazon.com \
--cc=sleybo@amazon.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.