Skip to contentSkip to conversation

RDMA/efa: Add support for 128B admin v2 SQ entry

PATCH In review Yonatan Nachum 3 participants 7 messages Aug 12 – Sep 1

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

v3 cover RDMA/efa: Add support for 128B admin v2 SQ entry

Changelog:
v3:
* Ensure proper alignment of stack admin buffer to prevent unaligned memory accesses.
v2: https://lore.kernel.org/all/[email protected]/
* Rebase on for-next branch instead of wip/leon-for-next.
v1: https://lore.kernel.org/all/[email protected]/

-------------------------------------------------------------------------
Add support for the new 128-byte admin v2 SQ entry format. The v2 entry extends the v1 header with checksum and payload version fields, and carries a larger inline payload.

The series first decouples admin command payloads from admin headers, then generalizes the SQ ring to use a configurable entry size, and finally adds the v2 entry format selection based on device API version.

Yonatan Nachum (3):
RDMA/efa: Decouple admin command payload from admin header RDMA/efa: Generalize the admin SQ
RDMA/efa: Add support for 128B admin v2 SQ entry

 .../infiniband/hw/efa/efa_admin_cmds_defs.h   | 116 +++--------
 drivers/infiniband/hw/efa/efa_admin_defs.h    |  33 ++-
 drivers/infiniband/hw/efa/efa_com.c           | 194 +++++++++++-------
 drivers/infiniband/hw/efa/efa_com.h           |  16 +-
 drivers/infiniband/hw/efa/efa_com_cmd.c       | 170 +++++----------
 5 files changed, 240 insertions(+), 289 deletions(-)
Signature · 1 line
2.50.1
#1 lore raw

PATCH v3 1/3 RDMA/efa: Decouple admin command payload from admin header

Remove aq_common_desc from all EFA admin command descriptors so that command structs represent pure payloads. This allows attaching different headers to the same command by copying the payload into the generic header payload field. The admin header is now constructed in a single place which improves separability.

---
 .../infiniband/hw/efa/efa_admin_cmds_defs.h   | 116 +++---------
 drivers/infiniband/hw/efa/efa_admin_defs.h    |   8 +-
 drivers/infiniband/hw/efa/efa_com.c           |  53 +++---
 drivers/infiniband/hw/efa/efa_com.h           |   7 +-
 drivers/infiniband/hw/efa/efa_com_cmd.c       | 170 ++++++------------
 5 files changed, 112 insertions(+), 242 deletions(-)
drivers/infiniband/hw/efa/efa_admin_cmds_defs.h +24 -92
index 95d1493153cd..ab830764e3b4 100644
@@ -102,9 +102,6 @@ struct efa_admin_qp_alloc_size {
 };
 
 struct efa_admin_create_qp_cmd {
-	/* Common Admin Queue descriptor */
-	struct efa_admin_aq_common_desc aq_common_desc;
-
 	/* Protection Domain associated with this QP */
 	u16 pd;
 
@@ -167,7 +164,7 @@ struct efa_admin_create_qp_cmd {
 
 	/* MBZ */
 	u32 reserved2;
-};
+} __packed;
 
 struct efa_admin_create_qp_resp {
 	/* Common Admin Queue completion descriptor */
@@ -208,9 +205,6 @@ struct efa_admin_create_qp_resp {
 };
 
 struct efa_admin_modify_qp_cmd {
-	/* Common Admin Queue descriptor */
-	struct efa_admin_aq_common_desc aq_common_desc;
-
 	/*
 	 * Mask indicating which fields should be updated
 	 * 0 : qp_state
@@ -246,7 +240,7 @@ struct efa_admin_modify_qp_cmd {
 
 	/* MBZ */
 	u16 reserved2;
-};
+} __packed;
 
 struct efa_admin_modify_qp_resp {
 	/* Common Admin Queue completion descriptor */
@@ -254,12 +248,9 @@ struct efa_admin_modify_qp_resp {
 };
 
 struct efa_admin_query_qp_cmd {
-	/* Common Admin Queue descriptor */
-	struct efa_admin_aq_common_desc aq_common_desc;
-
 	/* QP handle returned by create_qp command */
 	u32 qp_handle;
-};
+} __packed;
 
 struct efa_admin_query_qp_resp {
 	/* Common Admin Queue completion descriptor */
@@ -285,12 +276,9 @@ struct efa_admin_query_qp_resp {
 };
 
 struct efa_admin_destroy_qp_cmd {
-	/* Common Admin Queue descriptor */
-	struct efa_admin_aq_common_desc aq_common_desc;
-
 	/* QP handle returned by create_qp command */
 	u32 qp_handle;
-};
+} __packed;
 
 struct efa_admin_destroy_qp_resp {
 	/* Common Admin Queue completion descriptor */
@@ -302,9 +290,6 @@ struct efa_admin_destroy_qp_resp {
  * once for the same destination
  */
 struct efa_admin_create_ah_cmd {
-	/* Common Admin Queue descriptor */
-	struct efa_admin_aq_common_desc aq_common_desc;
-
 	/* Destination address in network byte order */
 	u8 dest_addr[16];
 
@@ -313,7 +298,7 @@ struct efa_admin_create_ah_cmd {
 
 	/* MBZ */
 	u16 reserved;
-};
+} __packed;
 
 struct efa_admin_create_ah_resp {
 	/* Common Admin Queue completion descriptor */
@@ -327,15 +312,12 @@ struct efa_admin_create_ah_resp {
 };
 
 struct efa_admin_destroy_ah_cmd {
-	/* Common Admin Queue descriptor */
-	struct efa_admin_aq_common_desc aq_common_desc;
-
 	/* Target interface address handle (opaque) */
 	u16 ah;
 
 	/* PD number */
 	u16 pd;
-};
+} __packed;
 
 struct efa_admin_destroy_ah_resp {
 	/* Common Admin Queue completion descriptor */
@@ -349,9 +331,6 @@ struct efa_admin_destroy_ah_resp {
  * on users working with very large datasets (i.e. full GPU memory mapping).
  */
 struct efa_admin_reg_mr_cmd {
-	/* Common Admin Queue descriptor */
-	struct efa_admin_aq_common_desc aq_common_desc;
-
 	/* Protection Domain */
 	u16 pd;
 
@@ -413,7 +392,7 @@ struct efa_admin_reg_mr_cmd {
 	 * the region.
 	 */
 	u64 iova;
-};
+} __packed;
 
 struct efa_admin_reg_mr_resp {
 	/* Common Admin Queue completion descriptor */
@@ -459,12 +438,9 @@ struct efa_admin_reg_mr_resp {
 };
 
 struct efa_admin_dereg_mr_cmd {
-	/* Common Admin Queue descriptor */
-	struct efa_admin_aq_common_desc aq_common_desc;
-
 	/* L_Key, memory region's l_key */
 	u32 l_key;
-};
+} __packed;
 
 struct efa_admin_dereg_mr_resp {
 	/* Common Admin Queue completion descriptor */
@@ -476,9 +452,6 @@ struct efa_admin_dereg_mr_resp {
  * Addresses in kernel verbs semantics, ready for fast registration use.
  */
 struct efa_admin_alloc_mr_cmd {
-	/* Common Admin Queue descriptor */
-	struct efa_admin_aq_common_desc aq_common_desc;
-
 	/* Protection Domain */
 	u16 pd;
 
@@ -487,7 +460,7 @@ struct efa_admin_alloc_mr_cmd {
 
 	/* Maximum number of pages this MR supports. */
 	u32 max_pages;
-};
+} __packed;
 
 struct efa_admin_alloc_mr_resp {
 	/* Common Admin Queue completion descriptor */
@@ -507,8 +480,6 @@ struct efa_admin_alloc_mr_resp {
 };
 
 struct efa_admin_create_cq_cmd {
-	struct efa_admin_aq_common_desc aq_common_desc;
-
 	/*
 	 * 4:0 : reserved5 - MBZ
 	 * 5 : interrupt_mode_enabled - if set, cq operates
@@ -561,7 +532,7 @@ struct efa_admin_create_cq_cmd {
 
 	/* UAR number */
 	u16 uar;
-};
+} __packed;
 
 struct efa_admin_create_cq_resp {
 	struct efa_admin_acq_common_desc acq_common_desc;
@@ -582,13 +553,11 @@ struct efa_admin_create_cq_resp {
 };
 
 struct efa_admin_destroy_cq_cmd {
-	struct efa_admin_aq_common_desc aq_common_desc;
-
 	u16 cq_idx;
 
 	/* MBZ */
 	u16 reserved1;
-};
+} __packed;
 
 struct efa_admin_destroy_cq_resp {
 	struct efa_admin_acq_common_desc acq_common_desc;
@@ -599,14 +568,7 @@ struct efa_admin_destroy_cq_resp {
  * buffer pointed by AQ entry
  */
 struct efa_admin_aq_get_stats_cmd {
-	struct efa_admin_aq_common_desc aq_common_descriptor;
-
-	union {
-		/* command specific inline data */
-		u32 inline_data_w1[3];
-
-		struct efa_admin_ctrl_buff_info control_buffer;
-	} u;
+	struct efa_admin_ctrl_buff_info control_buffer;
 
 	/* stats type as defined in enum efa_admin_get_stats_type */
 	u8 type;
@@ -615,7 +577,7 @@ struct efa_admin_aq_get_stats_cmd {
 	u8 scope;
 
 	u16 scope_modifier;
-};
+} __packed;
 
 struct efa_admin_basic_stats {
 	u64 tx_bytes;
@@ -903,14 +865,12 @@ struct efa_admin_hw_hints {
 };
 
 struct efa_admin_get_feature_cmd {
-	struct efa_admin_aq_common_desc aq_common_descriptor;
-
 	struct efa_admin_ctrl_buff_info control_buffer;
 
 	struct efa_admin_get_set_feature_common_desc feature_common;
 
 	u32 raw[11];
-};
+} __packed;
 
 struct efa_admin_get_feature_resp {
 	struct efa_admin_acq_common_desc acq_common_desc;
@@ -935,8 +895,6 @@ struct efa_admin_get_feature_resp {
 };
 
 struct efa_admin_set_feature_cmd {
-	struct efa_admin_aq_common_desc aq_common_descriptor;
-
 	struct efa_admin_ctrl_buff_info control_buffer;
 
 	struct efa_admin_get_set_feature_common_desc feature_common;
@@ -947,7 +905,7 @@ struct efa_admin_set_feature_cmd {
 		/* AENQ configuration */
 		struct efa_admin_feature_aenq_desc aenq;
 	} u;
-};
+} __packed;
 
 struct efa_admin_set_feature_resp {
 	struct efa_admin_acq_common_desc acq_common_desc;
@@ -957,10 +915,6 @@ struct efa_admin_set_feature_resp {
 	} u;
 };
 
-struct efa_admin_alloc_pd_cmd {
-	struct efa_admin_aq_common_desc aq_common_descriptor;
-};
-
 struct efa_admin_alloc_pd_resp {
 	struct efa_admin_acq_common_desc acq_common_desc;
 
@@ -972,23 +926,17 @@ struct efa_admin_alloc_pd_resp {
 };
 
 struct efa_admin_dealloc_pd_cmd {
-	struct efa_admin_aq_common_desc aq_common_descriptor;
-
 	/* PD number */
 	u16 pd;
 
 	/* MBZ */
 	u16 reserved;
-};
+} __packed;
 
 struct efa_admin_dealloc_pd_resp {
 	struct efa_admin_acq_common_desc acq_common_desc;
 };
 
-struct efa_admin_alloc_uar_cmd {
-	struct efa_admin_aq_common_desc aq_common_descriptor;
-};
-
 struct efa_admin_alloc_uar_resp {
 	struct efa_admin_acq_common_desc acq_common_desc;
 
@@ -1000,22 +948,18 @@ struct efa_admin_alloc_uar_resp {
 };
 
 struct efa_admin_dealloc_uar_cmd {
-	struct efa_admin_aq_common_desc aq_common_descriptor;
-
 	/* UAR number */
 	u16 uar;
 
 	/* MBZ */
 	u16 reserved;
-};
+} __packed;
 
 struct efa_admin_dealloc_uar_resp {
 	struct efa_admin_acq_common_desc acq_common_desc;
 };
 
 struct efa_admin_create_eq_cmd {
-	struct efa_admin_aq_common_desc aq_common_descriptor;
-
 	/* Size of the EQ in entries, must be power of 2 */
 	u16 depth;
 
@@ -1041,7 +985,7 @@ struct efa_admin_create_eq_cmd {
 
 	/* MBZ */
 	u32 reserved;
-};
+} __packed;
 
 struct efa_admin_create_eq_resp {
 	struct efa_admin_acq_common_desc acq_common_desc;
@@ -1054,14 +998,12 @@ struct efa_admin_create_eq_resp {
 };
 
 struct efa_admin_destroy_eq_cmd {
-	struct efa_admin_aq_common_desc aq_common_descriptor;
-
 	/* EQ number */
 	u16 eqn;
 
 	/* MBZ */
 	u16 reserved;
-};
+} __packed;
 
 struct efa_admin_destroy_eq_resp {
 	struct efa_admin_acq_common_desc acq_common_desc;
@@ -1134,10 +1076,8 @@ struct efa_admin_host_info {
 };
 
 struct efa_admin_service_cmd {
-	struct efa_admin_aq_common_desc aq_common_descriptor;
-
 	u8 buffer[60];
-};
+} __packed;
 
 struct efa_admin_service_resp {
 	struct efa_admin_acq_common_desc acq_common_desc;
@@ -1147,8 +1087,6 @@ struct efa_admin_service_resp {
 
 /* Create Counter command */
 struct efa_admin_create_event_counter_cmd {
-	struct efa_admin_aq_common_desc aq_common_descriptor;
-
 	/* UAR number */
 	u16 uar;
 
@@ -1157,7 +1095,7 @@ struct efa_admin_create_event_counter_cmd {
 
 	/* Counter physical address */
 	u64 paddr;
-};
+} __packed;
 
 struct efa_admin_create_event_counter_resp {
 	struct efa_admin_acq_common_desc acq_common_desc;
@@ -1170,11 +1108,9 @@ struct efa_admin_create_event_counter_resp {
 };
 
 struct efa_admin_destroy_event_counter_cmd {
-	struct efa_admin_aq_common_desc aq_common_descriptor;
-
 	/* Counter handle */
 	u32 cntr_handle;
-};
+} __packed;
 
 struct efa_admin_destroy_event_counter_resp {
 	struct efa_admin_acq_common_desc acq_common_desc;
@@ -1206,8 +1142,6 @@ struct efa_admin_event_counter_attach_qp_events {
 };
 
 struct efa_admin_attach_detach_event_counter_cmd {
-	struct efa_admin_aq_common_desc aq_common_descriptor;
-
 	/* Counter handle */
 	u32 cntr_handle;
 
@@ -1220,7 +1154,7 @@ struct efa_admin_attach_detach_event_counter_cmd {
 	union {
 		struct efa_admin_event_counter_attach_qp_events qp_events;
 	} u;
-};
+} __packed;
 
 struct efa_admin_attach_detach_event_counter_resp {
 	struct efa_admin_acq_common_desc acq_common_desc;
@@ -1235,8 +1169,6 @@ enum efa_admin_event_counter_modify_ops {
 };
 
 struct efa_admin_modify_event_counter_cmd {
-	struct efa_admin_aq_common_desc aq_common_descriptor;
-
 	/* Counter handle */
 	u32 cntr_handle;
 
@@ -1248,7 +1180,7 @@ struct efa_admin_modify_event_counter_cmd {
 
 	/* Value for SET or ADD */
 	u64 value;
-};
+} __packed;
 
 struct efa_admin_modify_event_counter_resp {
 	struct efa_admin_acq_common_desc acq_common_desc;
drivers/infiniband/hw/efa/efa_admin_defs.h +1 -7
index 02f86edabed8..0a14b3abe6f9 100644
@@ -55,13 +55,7 @@ struct efa_admin_ctrl_buff_info {
 struct efa_admin_aq_entry {
 	struct efa_admin_aq_common_desc aq_common_descriptor;
 
-	union {
-		u32 inline_data_w1[3];
-
-		struct efa_admin_ctrl_buff_info control_buffer;
-	} u;
-
-	u32 inline_data_w4[12];
+	u32 request_payload[15];
 };
 
 struct efa_admin_acq_common_desc {
drivers/infiniband/hw/efa/efa_com.c +27 -26

110 lines not on this page · raw message

drivers/infiniband/hw/efa/efa_com.h +3 -4
index 599db9d583bf..f979e36ec158 100644
@@ -174,10 +174,9 @@ int efa_com_validate_version(struct efa_com_dev *edev);
 int efa_com_get_dma_width(struct efa_com_dev *edev);
 
 int efa_com_cmd_exec(struct efa_com_admin_queue *aq,
-		     struct efa_admin_aq_entry *cmd,
-		     size_t cmd_size,
-		     struct efa_admin_acq_entry *comp,
-		     size_t comp_size);
+		     u8 opcode, u8 flags,
+		     void *payload, size_t payload_size,
+		     struct efa_admin_acq_entry *comp, size_t comp_size);
 void efa_com_aenq_intr_handler(struct efa_com_dev *edev, void *data);
 void efa_com_eq_comp_intr_handler(struct efa_com_dev *edev,
 				  struct efa_com_eq *eeq);
drivers/infiniband/hw/efa/efa_com_cmd.c +57 -113

392 lines not on this page · raw message

Signature · 1 line
2.50.1
#2 lore raw

PATCH v3 2/3 RDMA/efa: Generalize the admin SQ

In reply to Yonatan Nachum

As preparation for admin v2 entry size which is 128B, generalize the SQ ring to use a generic buffer and use the right offset into it using the configured entry size. This will allow us to choose different entry size on SQ init with minimal changes.

---
 drivers/infiniband/hw/efa/efa_com.c | 48 +++++++++++++----------------
 drivers/infiniband/hw/efa/efa_com.h |  3 +-
 2 files changed, 24 insertions(+), 27 deletions(-)
drivers/infiniband/hw/efa/efa_com.c +22 -26
index 8d8be22b76c8..72b87f8cd086 100644
@@ -138,14 +138,13 @@ static int efa_com_admin_init_sq(struct efa_com_dev *edev)
 {
 	struct efa_com_admin_queue *aq = &edev->aq;
 	struct efa_com_admin_sq *sq = &aq->sq;
-	u16 size = aq->depth * sizeof(*sq->entries);
+	u32 addr_high, addr_low;
 	u32 aq_caps = 0;
-	u32 addr_high;
-	u32 addr_low;
 
-	sq->entries =
-		dma_alloc_coherent(aq->dmadev, size, &sq->dma_addr, GFP_KERNEL);
-	if (!sq->entries)
+	sq->entry_size = sizeof(struct efa_admin_aq_entry);
+	sq->buffer = dma_alloc_coherent(aq->dmadev, aq->depth * sq->entry_size,
+					&sq->dma_addr, GFP_KERNEL);
+	if (!sq->buffer)
 		return -ENOMEM;
 
 	spin_lock_init(&sq->lock);
@@ -163,8 +162,7 @@ static int efa_com_admin_init_sq(struct efa_com_dev *edev)
 	writel(addr_high, edev->reg_bar + EFA_REGS_AQ_BASE_HI_OFF);
 
 	EFA_SET(&aq_caps, EFA_REGS_AQ_CAPS_AQ_DEPTH, aq->depth);
-	EFA_SET(&aq_caps, EFA_REGS_AQ_CAPS_AQ_ENTRY_SIZE,
-		sizeof(struct efa_admin_aq_entry));
+	EFA_SET(&aq_caps, EFA_REGS_AQ_CAPS_AQ_ENTRY_SIZE, sq->entry_size);
 
 	writel(aq_caps, edev->reg_bar + EFA_REGS_AQ_CAPS_OFF);
 
@@ -330,24 +328,22 @@ static void __efa_com_submit_admin_cmd(struct efa_com_admin_queue *aq,
 				       struct efa_admin_acq_entry *comp,
 				       size_t comp_size_in_bytes)
 {
-	struct efa_admin_aq_entry *aqe;
-	u16 queue_size_mask;
-	u16 cmd_id;
-	u16 ctx_id;
-	u16 pi;
+	u16 queue_size_mask, cmd_id, ctx_id, pi;
+	struct efa_com_admin_sq *sq = &aq->sq;
+	u8 *aqe;
 
 	queue_size_mask = aq->depth - 1;
-	pi = aq->sq.pc & queue_size_mask;
+	pi = sq->pc & queue_size_mask;
 	ctx_id = efa_com_get_comp_ctx_id(aq, comp_ctx);
 
 	/* cmd_id LSBs are the ctx_id and MSBs are entropy bits from pc */
 	cmd_id = ctx_id & queue_size_mask;
-	cmd_id |= aq->sq.pc << ilog2(aq->depth);
+	cmd_id |= sq->pc << ilog2(aq->depth);
 	cmd_id &= EFA_ADMIN_AQ_COMMON_DESC_COMMAND_ID_MASK;
 
 	cmd->aq_common_descriptor.command_id = cmd_id;
 	EFA_SET(&cmd->aq_common_descriptor.flags,
-		EFA_ADMIN_AQ_COMMON_DESC_PHASE, aq->sq.phase);
+		EFA_ADMIN_AQ_COMMON_DESC_PHASE, sq->phase);
 
 	comp_ctx->status = EFA_CMD_SUBMITTED;
 	comp_ctx->comp_size = comp_size_in_bytes;
@@ -357,18 +353,18 @@ static void __efa_com_submit_admin_cmd(struct efa_com_admin_queue *aq,
 
 	reinit_completion(&comp_ctx->wait_event);
 
-	aqe = &aq->sq.entries[pi];
-	memset(aqe, 0, sizeof(*aqe));
+	aqe = sq->buffer + sq->entry_size * pi;
+	memset(aqe, 0, sq->entry_size);
 	memcpy(aqe, cmd, cmd_size_in_bytes);
 
-	aq->sq.pc++;
+	sq->pc++;
 	atomic64_inc(&aq->stats.submitted_cmd);
 
-	if ((aq->sq.pc & queue_size_mask) == 0)
-		aq->sq.phase = !aq->sq.phase;
+	if ((sq->pc & queue_size_mask) == 0)
+		sq->phase = !sq->phase;
 
 	/* barrier not needed in case of writel */
-	writel(aq->sq.pc, aq->sq.db_addr);
+	writel(sq->pc, sq->db_addr);
 }
 
 static inline int efa_com_init_comp_ctxt(struct efa_com_admin_queue *aq)
@@ -723,8 +719,8 @@ void efa_com_admin_destroy(struct efa_com_dev *edev)
 	devm_kfree(edev->dmadev, aq->comp_ctx_pool);
 	devm_kfree(edev->dmadev, aq->comp_ctx);
 
-	size = aq->depth * sizeof(*sq->entries);
-	dma_free_coherent(edev->dmadev, size, sq->entries, sq->dma_addr);
+	size = aq->depth * sq->entry_size;
+	dma_free_coherent(edev->dmadev, size, sq->buffer, sq->dma_addr);
 
 	size = aq->depth * sizeof(*cq->entries);
 	dma_free_coherent(edev->dmadev, size, cq->entries, cq->dma_addr);
@@ -843,8 +839,8 @@ int efa_com_admin_init(struct efa_com_dev *edev,
 	dma_free_coherent(edev->dmadev, aq->depth * sizeof(*aq->cq.entries),
 			  aq->cq.entries, aq->cq.dma_addr);
 err_destroy_sq:
-	dma_free_coherent(edev->dmadev, aq->depth * sizeof(*aq->sq.entries),
-			  aq->sq.entries, aq->sq.dma_addr);
+	dma_free_coherent(edev->dmadev, aq->depth * aq->sq.entry_size,
+			  aq->sq.buffer, aq->sq.dma_addr);
 err_destroy_comp_ctxt:
 	devm_kfree(edev->dmadev, aq->comp_ctx);
 err_destroy_ah_cache:
drivers/infiniband/hw/efa/efa_com.h +2 -1
index f979e36ec158..069c9dd98328 100644
@@ -33,7 +33,8 @@ struct efa_com_admin_cq {
 };
 
 struct efa_com_admin_sq {
-	struct efa_admin_aq_entry *entries;
+	u8 *buffer;
+	u16 entry_size;
 	dma_addr_t dma_addr;
 	spinlock_t lock; /* Protects ASQ */
 
Signature · 1 line
2.50.1
#3 lore raw

PATCH v3 3/3 RDMA/efa: Add support for 128B admin v2 SQ entry

In reply to Yonatan Nachum

Add the new admin v2 format which is 128B in size and its header extends the v1 header with checksum and payload version.
On admin SQ init check if the API version reported by the device supports the admin v2 SQ entry and if so use it. Store the payload offset and max size in the SQ for quick access in admin command execution flow.

Using the admin SQ v2 entry implicitly enable the checksum in its header so set it for device to validate against.

---
 drivers/infiniband/hw/efa/efa_admin_defs.h |  29 +++++-
 drivers/infiniband/hw/efa/efa_com.c        | 113 +++++++++++++++------
 drivers/infiniband/hw/efa/efa_com.h        |   6 ++
 3 files changed, 116 insertions(+), 32 deletions(-)
drivers/infiniband/hw/efa/efa_admin_defs.h +27 -2
index 0a14b3abe6f9..bf1721e31a70 100644
@@ -7,7 +7,7 @@
 #define _EFA_ADMIN_H_
 
 #define EFA_ADMIN_API_VERSION_MAJOR          0
-#define EFA_ADMIN_API_VERSION_MINOR          2
+#define EFA_ADMIN_API_VERSION_MINOR          3
 
 enum efa_admin_aq_completion_status {
 	EFA_ADMIN_SUCCESS                           = 0,
@@ -41,6 +41,21 @@ struct efa_admin_aq_common_desc {
 	u8 flags;
 };
 
+struct efa_admin_aq_common_desc_v2 {
+	struct efa_admin_aq_common_desc common;
+
+	/*
+	 * Poly 0x8005 CRC16 with initial value 0xFFFF and final XOR of
+	 * 0xFFFF. The checksum covers the entire admin command entry
+	 * including the zeroed checksum field.
+	 */
+	u16 checksum;
+
+	u8 payload_ver;
+
+	u8 reserved[5];
+};
+
 /*
  * used in efa_admin_aq_entry. Can point directly to control data, or to a
  * page list chunk. Used also at the end of indirect mode page list chunks,
@@ -58,6 +73,12 @@ struct efa_admin_aq_entry {
 	u32 request_payload[15];
 };
 
+struct efa_admin_aq_entry_v2 {
+	struct efa_admin_aq_common_desc_v2 aq_common_descriptor;
+
+	u32 request_payload[29];
+};
+
 struct efa_admin_acq_common_desc {
 	/*
 	 * command identifier to associate it with the aq descriptor
@@ -74,7 +95,11 @@ struct efa_admin_acq_common_desc {
 	 */
 	u8 flags;
 
-	/* Poly 0x8005 CRC16 with initial value 0xFFFF and final XOR of 0xFFFF */
+	/*
+	 * Poly 0x8005 CRC16 with initial value 0xFFFF and final XOR of 0xFFFF.
+	 * The checksum covers the entire admin completion entry including the
+	 * zeroed checksum field.
+	 */
 	u16 checksum;
 
 	u16 reserved;
drivers/infiniband/hw/efa/efa_com.c +83 -30

206 lines not on this page · raw message

drivers/infiniband/hw/efa/efa_com.h +6 -0
index 069c9dd98328..0341704d0921 100644
@@ -22,6 +22,9 @@
 
 #define EFA_MAX_HANDLERS 256
 
+#define EFA_ADMIN_V1_PROTO_VER 0
+#define EFA_ADMIN_V2_PROTO_VER 1
+
 struct efa_com_admin_cq {
 	struct efa_admin_acq_entry *entries;
 	dma_addr_t dma_addr;
@@ -35,8 +38,11 @@ struct efa_com_admin_cq {
 struct efa_com_admin_sq {
 	u8 *buffer;
 	u16 entry_size;
+	u16 payload_offset;
+	u16 max_payload_size;
 	dma_addr_t dma_addr;
 	spinlock_t lock; /* Protects ASQ */
+	u8 proto_ver;
 
 	u32 __iomem *db_addr;
 
Signature · 1 line
2.50.1
maintainer Reviewed-by on the v3 series
#4 lore raw
In reply to Yonatan Nachum
Quoted 13 lines · Yonatan Nachum

Changelog:
v3:
* Ensure proper alignment of stack admin buffer to prevent unaligned memory accesses.
v2: https://lore.kernel.org/all/[email protected]/
* Rebase on for-next branch instead of wip/leon-for-next.
v1: https://lore.kernel.org/all/[email protected]/

-------------------------------------------------------------------------
Add support for the new 128-byte admin v2 SQ entry format. The v2 entry extends the v1 header with checksum and payload version fields, and carries a larger inline payload.

Quoted 8 lines

The series first decouples admin command payloads from admin headers, then generalizes the SQ ring to use a configurable entry size, and finally adds the v2 entry format selection based on device API version.

Yonatan Nachum (3):
RDMA/efa: Decouple admin command payload from admin header RDMA/efa: Generalize the admin SQ
RDMA/efa: Add support for 128B admin v2 SQ entry

Jason

#5 lore raw
In reply to Yonatan Nachum
Quoted 22 lines · Yonatan Nachum

Changelog:
v3:
* Ensure proper alignment of stack admin buffer to prevent unaligned memory accesses.
v2: https://lore.kernel.org/all/[email protected]/
* Rebase on for-next branch instead of wip/leon-for-next.
v1: https://lore.kernel.org/all/[email protected]/

-------------------------------------------------------------------------
Add support for the new 128-byte admin v2 SQ entry format. The v2 entry extends the v1 header with checksum and payload version fields, and carries a larger inline payload.

The series first decouples admin command payloads from admin headers, then generalizes the SQ ring to use a configurable entry size, and finally adds the v2 entry format selection based on device API version.

Yonatan Nachum (3):
RDMA/efa: Decouple admin command payload from admin header RDMA/efa: Generalize the admin SQ
RDMA/efa: Add support for 128B admin v2 SQ entry

Quoted 6 lines
 .../infiniband/hw/efa/efa_admin_cmds_defs.h   | 116 +++--------
 drivers/infiniband/hw/efa/efa_admin_defs.h    |  33 ++-
 drivers/infiniband/hw/efa/efa_com.c           | 194 +++++++++++-------
 drivers/infiniband/hw/efa/efa_com.h           |  16 +-
 drivers/infiniband/hw/efa/efa_com_cmd.c       | 170 +++++----------
 5 files changed, 240 insertions(+), 289 deletions(-)

I tried to apply the series, but it resulted in a large number of merge conflicts. Please rebase and resend it.

Thanks

Quoted 4 lines
Signature · 2 lines
-- 
2.50.1
#6 lore raw
Quoted 30 lines · Leon Romanovsky
Quoted 22 lines · Yonatan Nachum

Changelog:
v3:
* Ensure proper alignment of stack admin buffer to prevent unaligned memory accesses.
v2: https://lore.kernel.org/all/[email protected]/
* Rebase on for-next branch instead of wip/leon-for-next.
v1: https://lore.kernel.org/all/[email protected]/

-------------------------------------------------------------------------
Add support for the new 128-byte admin v2 SQ entry format. The v2 entry extends the v1 header with checksum and payload version fields, and carries a larger inline payload.

The series first decouples admin command payloads from admin headers, then generalizes the SQ ring to use a configurable entry size, and finally adds the v2 entry format selection based on device API version.

Yonatan Nachum (3):
RDMA/efa: Decouple admin command payload from admin header RDMA/efa: Generalize the admin SQ
RDMA/efa: Add support for 128B admin v2 SQ entry

Quoted 6 lines
 .../infiniband/hw/efa/efa_admin_cmds_defs.h   | 116 +++--------
 drivers/infiniband/hw/efa/efa_admin_defs.h    |  33 ++-
 drivers/infiniband/hw/efa/efa_com.c           | 194 +++++++++++-------
 drivers/infiniband/hw/efa/efa_com.h           |  16 +-
 drivers/infiniband/hw/efa/efa_com_cmd.c       | 170 +++++----------
 5 files changed, 240 insertions(+), 289 deletions(-)
Quoted 2 lines

I tried to apply the series, but it resulted in a large number of merge conflicts. Please rebase and resend it.

Disregard this email, the series were applied by Jason.

Quoted 8 lines

Thanks

Quoted 4 lines
Signature · 2 lines
-- 
2.50.1