Skip to contentSkip to conversation

EFA cleanups 2021-01-26

PATCH Applied Gal Pressman 2 participants 7 messages Jan 26, 2021 – Jan 28, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover EFA cleanups 2021-01-26

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

Signature · 1 line
2.30.0
#1 lore raw

PATCH 1/5 RDMA/efa: Remove redundant NULL pointer check of CQE

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.

---
 drivers/infiniband/hw/efa/efa_com.c | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)
drivers/infiniband/hw/efa/efa_com.c +6 -10
index f7242188a843..747efc794cc0 100644
@@ -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);
 	}
 
Signature · 1 line
2.30.0
#2 lore raw

PATCH 2/5 RDMA/efa: Remove duplication of upper/lower_32_bits

In reply to Gal Pressman

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.

---
 drivers/infiniband/hw/efa/efa_com.c | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)
drivers/infiniband/hw/efa/efa_com.c +6 -9
index 747efc794cc0..0d523ad736c7 100644
@@ -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);
Signature · 1 line
2.30.0
#3 lore raw

PATCH 3/5 RDMA/efa: Remove unnecessary indentation in defs comments

In reply to Gal Pressman

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

---
 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(-)
drivers/infiniband/hw/efa/efa_admin_cmds_defs.h +4 -4
index b199e4ac6cf9..d383850ee446 100644
@@ -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;
 
drivers/infiniband/hw/efa/efa_admin_defs.h +2 -2
index 29d53ed63b3e..78ff9389ae25 100644
@@ -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;
 };
Signature · 1 line
2.30.0
#4 lore raw

PATCH 4/5 RDMA/efa: Remove unused 'select' field from get/set feature command descriptor

In reply to Gal Pressman

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.

---
 drivers/infiniband/hw/efa/efa_admin_cmds_defs.h | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)
drivers/infiniband/hw/efa/efa_admin_cmds_defs.h +2 -9
index d383850ee446..9327d5e3ec62 100644
@@ -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)
Signature · 1 line
2.30.0
#5 lore raw

PATCH 5/5 RDMA/efa: Remove unused syndrome enum values

In reply to Gal Pressman

The notification syndrome enum values are unused, remove them.

---
 drivers/infiniband/hw/efa/efa_admin_cmds_defs.h | 6 ------
 1 file changed, 6 deletions(-)
drivers/infiniband/hw/efa/efa_admin_cmds_defs.h +0 -6
index 9327d5e3ec62..fa38b34eddb8 100644
@@ -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;
 
Signature · 1 line
2.30.0
maintainer Applied
#6 lore raw
In reply to Gal Pressman
Quoted 8 lines · 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

Quoted 7 lines

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