All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH for-next 0/5] EFA cleanups 2021-01-26
@ 2021-01-26 12:06 Gal Pressman
  2021-01-26 12:06 ` [PATCH for-next 1/5] RDMA/efa: Remove redundant NULL pointer check of CQE Gal Pressman
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Gal Pressman @ 2021-01-26 12:06 UTC (permalink / raw)
  To: Jason Gunthorpe, Doug Ledford
  Cc: linux-rdma, Alexander Matushevsky, Gal Pressman

Hi,

This series contains misc cleanups to the EFA driver and device
definitions. Detailed descriptions can be found in the commit messages.

Thanks,
Gal

Gal Pressman (5):
  RDMA/efa: Remove redundant NULL pointer check of CQE
  RDMA/efa: Remove duplication of upper/lower_32_bits
  RDMA/efa: Remove unnecessary indentation in defs comments
  RDMA/efa: Remove unused 'select' field from get/set feature command
    descriptor
  RDMA/efa: Remove unused syndrome enum values

 .../infiniband/hw/efa/efa_admin_cmds_defs.h   | 25 ++++-----------
 drivers/infiniband/hw/efa/efa_admin_defs.h    |  4 +--
 drivers/infiniband/hw/efa/efa_com.c           | 31 +++++++------------
 3 files changed, 20 insertions(+), 40 deletions(-)


base-commit: f8e9a970159c7bd30429b86710397e9914fefbca
-- 
2.30.0


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH for-next 1/5] RDMA/efa: Remove redundant NULL pointer check of CQE
  2021-01-26 12:06 [PATCH for-next 0/5] EFA cleanups 2021-01-26 Gal Pressman
@ 2021-01-26 12:06 ` Gal Pressman
  2021-01-26 12:06 ` [PATCH for-next 2/5] RDMA/efa: Remove duplication of upper/lower_32_bits Gal Pressman
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Gal Pressman @ 2021-01-26 12:06 UTC (permalink / raw)
  To: Jason Gunthorpe, Doug Ledford
  Cc: linux-rdma, Alexander Matushevsky, Gal Pressman, Firas JahJah,
	Yossi Leybovich

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


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH for-next 2/5] RDMA/efa: Remove duplication of upper/lower_32_bits
  2021-01-26 12:06 [PATCH for-next 0/5] EFA cleanups 2021-01-26 Gal Pressman
  2021-01-26 12:06 ` [PATCH for-next 1/5] RDMA/efa: Remove redundant NULL pointer check of CQE Gal Pressman
@ 2021-01-26 12:06 ` Gal Pressman
  2021-01-26 12:06 ` [PATCH for-next 3/5] RDMA/efa: Remove unnecessary indentation in defs comments Gal Pressman
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Gal Pressman @ 2021-01-26 12:06 UTC (permalink / raw)
  To: Jason Gunthorpe, Doug Ledford
  Cc: linux-rdma, Alexander Matushevsky, Gal Pressman, Firas JahJah,
	Yossi Leybovich

The EFA_DMA_ADDR_TO_UINT32_HIGH/LOW macros are the same as the kernel's
upper/lower_32_bits, remove them and use kernel macros instead.

Reviewed-by: Firas JahJah <firasj@amazon.com>
Signed-off-by: Gal Pressman <galpress@amazon.com>
---
 drivers/infiniband/hw/efa/efa_com.c | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/drivers/infiniband/hw/efa/efa_com.c b/drivers/infiniband/hw/efa/efa_com.c
index 747efc794cc0..0d523ad736c7 100644
--- a/drivers/infiniband/hw/efa/efa_com.c
+++ b/drivers/infiniband/hw/efa/efa_com.c
@@ -20,9 +20,6 @@
 #define EFA_CTRL_MINOR          0
 #define EFA_CTRL_SUB_MINOR      1
 
-#define EFA_DMA_ADDR_TO_UINT32_LOW(x)   ((u32)((u64)(x)))
-#define EFA_DMA_ADDR_TO_UINT32_HIGH(x)  ((u32)(((u64)(x)) >> 32))
-
 enum efa_cmd_status {
 	EFA_CMD_SUBMITTED,
 	EFA_CMD_COMPLETED,
@@ -138,8 +135,8 @@ static int efa_com_admin_init_sq(struct efa_com_dev *edev)
 
 	sq->db_addr = (u32 __iomem *)(edev->reg_bar + EFA_REGS_AQ_PROD_DB_OFF);
 
-	addr_high = EFA_DMA_ADDR_TO_UINT32_HIGH(sq->dma_addr);
-	addr_low = EFA_DMA_ADDR_TO_UINT32_LOW(sq->dma_addr);
+	addr_high = upper_32_bits(sq->dma_addr);
+	addr_low = lower_32_bits(sq->dma_addr);
 
 	writel(addr_low, edev->reg_bar + EFA_REGS_AQ_BASE_LO_OFF);
 	writel(addr_high, edev->reg_bar + EFA_REGS_AQ_BASE_HI_OFF);
@@ -172,8 +169,8 @@ static int efa_com_admin_init_cq(struct efa_com_dev *edev)
 	cq->cc = 0;
 	cq->phase = 1;
 
-	addr_high = EFA_DMA_ADDR_TO_UINT32_HIGH(cq->dma_addr);
-	addr_low = EFA_DMA_ADDR_TO_UINT32_LOW(cq->dma_addr);
+	addr_high = upper_32_bits(cq->dma_addr);
+	addr_low = lower_32_bits(cq->dma_addr);
 
 	writel(addr_low, edev->reg_bar + EFA_REGS_ACQ_BASE_LO_OFF);
 	writel(addr_high, edev->reg_bar + EFA_REGS_ACQ_BASE_HI_OFF);
@@ -213,8 +210,8 @@ static int efa_com_admin_init_aenq(struct efa_com_dev *edev,
 	aenq->cc = 0;
 	aenq->phase = 1;
 
-	addr_low = EFA_DMA_ADDR_TO_UINT32_LOW(aenq->dma_addr);
-	addr_high = EFA_DMA_ADDR_TO_UINT32_HIGH(aenq->dma_addr);
+	addr_low = lower_32_bits(aenq->dma_addr);
+	addr_high = upper_32_bits(aenq->dma_addr);
 
 	writel(addr_low, edev->reg_bar + EFA_REGS_AENQ_BASE_LO_OFF);
 	writel(addr_high, edev->reg_bar + EFA_REGS_AENQ_BASE_HI_OFF);
-- 
2.30.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH for-next 3/5] RDMA/efa: Remove unnecessary indentation in defs comments
  2021-01-26 12:06 [PATCH for-next 0/5] EFA cleanups 2021-01-26 Gal Pressman
  2021-01-26 12:06 ` [PATCH for-next 1/5] RDMA/efa: Remove redundant NULL pointer check of CQE Gal Pressman
  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 ` 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
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Gal Pressman @ 2021-01-26 12:06 UTC (permalink / raw)
  To: Jason Gunthorpe, Doug Ledford
  Cc: linux-rdma, Alexander Matushevsky, Gal Pressman, Firas JahJah,
	Yossi Leybovich

The indentation in the subsequent comment lines is unnecessary, remove
it.

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_admin_cmds_defs.h | 8 ++++----
 drivers/infiniband/hw/efa/efa_admin_defs.h      | 4 ++--
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/infiniband/hw/efa/efa_admin_cmds_defs.h b/drivers/infiniband/hw/efa/efa_admin_cmds_defs.h
index b199e4ac6cf9..d383850ee446 100644
--- a/drivers/infiniband/hw/efa/efa_admin_cmds_defs.h
+++ b/drivers/infiniband/hw/efa/efa_admin_cmds_defs.h
@@ -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.
  */
 
 #ifndef _EFA_ADMIN_CMDS_H_
@@ -161,8 +161,8 @@ struct efa_admin_create_qp_resp {
 	u32 qp_handle;
 
 	/*
-	 * QP number in the given EFA virtual device. Least-significant bits
-	 *    (as needed according to max_qp) carry unique QP ID
+	 * QP number in the given EFA virtual device. Least-significant bits (as
+	 * needed according to max_qp) carry unique QP ID
 	 */
 	u16 qp_num;
 
@@ -465,7 +465,7 @@ struct efa_admin_create_cq_cmd {
 
 	/*
 	 * number of sub cqs - must be equal to sub_cqs_per_cq of queue
-	 *    attributes.
+	 * attributes.
 	 */
 	u16 num_sub_cqs;
 
diff --git a/drivers/infiniband/hw/efa/efa_admin_defs.h b/drivers/infiniband/hw/efa/efa_admin_defs.h
index 29d53ed63b3e..78ff9389ae25 100644
--- a/drivers/infiniband/hw/efa/efa_admin_defs.h
+++ b/drivers/infiniband/hw/efa/efa_admin_defs.h
@@ -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.
  */
 
 #ifndef _EFA_ADMIN_H_
@@ -82,7 +82,7 @@ struct efa_admin_acq_common_desc {
 
 	/*
 	 * indicates to the driver which AQ entry has been consumed by the
-	 *    device and could be reused
+	 * device and could be reused
 	 */
 	u16 sq_head_indx;
 };
-- 
2.30.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH for-next 4/5] RDMA/efa: Remove unused 'select' field from get/set feature command descriptor
  2021-01-26 12:06 [PATCH for-next 0/5] EFA cleanups 2021-01-26 Gal Pressman
                   ` (2 preceding siblings ...)
  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 ` 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
  5 siblings, 0 replies; 7+ messages in thread
From: Gal Pressman @ 2021-01-26 12:07 UTC (permalink / raw)
  To: Jason Gunthorpe, Doug Ledford
  Cc: linux-rdma, Alexander Matushevsky, Gal Pressman, Firas JahJah,
	Yossi Leybovich

The 'select' field in the get/set feature admin command is
unimplemented, unused and misleading, remove it.
The command always refers to the current values.

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_admin_cmds_defs.h | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)

diff --git a/drivers/infiniband/hw/efa/efa_admin_cmds_defs.h b/drivers/infiniband/hw/efa/efa_admin_cmds_defs.h
index d383850ee446..9327d5e3ec62 100644
--- a/drivers/infiniband/hw/efa/efa_admin_cmds_defs.h
+++ b/drivers/infiniband/hw/efa/efa_admin_cmds_defs.h
@@ -563,12 +563,8 @@ struct efa_admin_acq_get_stats_resp {
 };
 
 struct efa_admin_get_set_feature_common_desc {
-	/*
-	 * 1:0 : select - 0x1 - current value; 0x3 - default
-	 *    value
-	 * 7:3 : reserved3 - MBZ
-	 */
-	u8 flags;
+	/* MBZ */
+	u8 reserved0;
 
 	/* as appears in efa_admin_aq_feature_id */
 	u8 feature_id;
@@ -909,9 +905,6 @@ struct efa_admin_host_info {
 #define EFA_ADMIN_CREATE_CQ_CMD_VIRT_MASK                   BIT(6)
 #define EFA_ADMIN_CREATE_CQ_CMD_CQ_ENTRY_SIZE_WORDS_MASK    GENMASK(4, 0)
 
-/* get_set_feature_common_desc */
-#define EFA_ADMIN_GET_SET_FEATURE_COMMON_DESC_SELECT_MASK   GENMASK(1, 0)
-
 /* feature_device_attr_desc */
 #define EFA_ADMIN_FEATURE_DEVICE_ATTR_DESC_RDMA_READ_MASK   BIT(0)
 #define EFA_ADMIN_FEATURE_DEVICE_ATTR_DESC_RNR_RETRY_MASK   BIT(1)
-- 
2.30.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH for-next 5/5] RDMA/efa: Remove unused syndrome enum values
  2021-01-26 12:06 [PATCH for-next 0/5] EFA cleanups 2021-01-26 Gal Pressman
                   ` (3 preceding siblings ...)
  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 ` Gal Pressman
  2021-01-28 19:58 ` [PATCH for-next 0/5] EFA cleanups 2021-01-26 Jason Gunthorpe
  5 siblings, 0 replies; 7+ messages in thread
From: Gal Pressman @ 2021-01-26 12:07 UTC (permalink / raw)
  To: Jason Gunthorpe, Doug Ledford
  Cc: linux-rdma, Alexander Matushevsky, Gal Pressman, Firas JahJah,
	Yossi Leybovich

The notification syndrome enum values are unused, remove them.

Reviewed-by: Firas JahJah <firasj@amazon.com>
Signed-off-by: Gal Pressman <galpress@amazon.com>
---
 drivers/infiniband/hw/efa/efa_admin_cmds_defs.h | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/drivers/infiniband/hw/efa/efa_admin_cmds_defs.h b/drivers/infiniband/hw/efa/efa_admin_cmds_defs.h
index 9327d5e3ec62..fa38b34eddb8 100644
--- a/drivers/infiniband/hw/efa/efa_admin_cmds_defs.h
+++ b/drivers/infiniband/hw/efa/efa_admin_cmds_defs.h
@@ -819,12 +819,6 @@ enum efa_admin_aenq_group {
 	EFA_ADMIN_AENQ_GROUPS_NUM                   = 5,
 };
 
-enum efa_admin_aenq_notification_syndrom {
-	EFA_ADMIN_SUSPEND                           = 0,
-	EFA_ADMIN_RESUME                            = 1,
-	EFA_ADMIN_UPDATE_HINTS                      = 2,
-};
-
 struct efa_admin_mmio_req_read_less_resp {
 	u16 req_id;
 
-- 
2.30.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH for-next 0/5] EFA cleanups 2021-01-26
  2021-01-26 12:06 [PATCH for-next 0/5] EFA cleanups 2021-01-26 Gal Pressman
                   ` (4 preceding siblings ...)
  2021-01-26 12:07 ` [PATCH for-next 5/5] RDMA/efa: Remove unused syndrome enum values Gal Pressman
@ 2021-01-28 19:58 ` Jason Gunthorpe
  5 siblings, 0 replies; 7+ messages in thread
From: Jason Gunthorpe @ 2021-01-28 19:58 UTC (permalink / raw)
  To: Gal Pressman; +Cc: Doug Ledford, linux-rdma, Alexander Matushevsky

On Tue, Jan 26, 2021 at 02:06:56PM +0200, Gal Pressman wrote:
> Hi,
> 
> This series contains misc cleanups to the EFA driver and device
> definitions. Detailed descriptions can be found in the commit messages.
> 
> Thanks,
> Gal
> 
> Gal Pressman (5):
>   RDMA/efa: Remove redundant NULL pointer check of CQE
>   RDMA/efa: Remove duplication of upper/lower_32_bits
>   RDMA/efa: Remove unnecessary indentation in defs comments
>   RDMA/efa: Remove unused 'select' field from get/set feature command
>     descriptor
>   RDMA/efa: Remove unused syndrome enum values

Applied to for-next, thanks

Jason

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-01-28 20:02 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-26 12:06 [PATCH for-next 0/5] EFA cleanups 2021-01-26 Gal Pressman
2021-01-26 12:06 ` [PATCH for-next 1/5] RDMA/efa: Remove redundant NULL pointer check of CQE Gal Pressman
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

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.