Skip to content

Commit 2b75cb4

Browse files
authored
Merge pull request #1708 from amzn/wide_wqe
efa: Add support for 128-byte WQE
2 parents 3084ead + f4176cd commit 2b75cb4

17 files changed

Lines changed: 755 additions & 185 deletions

debian/ibverbs-providers.symbols

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,7 @@ libefa.so.1 ibverbs-providers #MINVER#
186186
EFA_1.2@EFA_1.2 43
187187
EFA_1.3@EFA_1.3 50
188188
EFA_1.4@EFA_1.4 59
189+
EFA_1.5@EFA_1.5 63
189190
efadv_create_driver_qp@EFA_1.0 24
190191
efadv_create_qp_ex@EFA_1.1 26
191192
efadv_query_device@EFA_1.1 26
@@ -195,6 +196,8 @@ libefa.so.1 ibverbs-providers #MINVER#
195196
efadv_query_mr@EFA_1.3 50
196197
efadv_query_qp_wqs@EFA_1.4 59
197198
efadv_query_cq@EFA_1.4 59
199+
efadv_get_max_sq_depth@EFA_1.5 63
200+
efadv_get_max_rq_depth@EFA_1.5 63
198201
libhns.so.1 ibverbs-providers #MINVER#
199202
* Build-Depends-Package: libibverbs-dev
200203
HNS_1.0@HNS_1.0 51

providers/efa/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ if (ENABLE_LTTNG AND LTTNGUST_FOUND)
33
endif()
44

55
rdma_shared_provider(efa libefa.map
6-
1 1.4.${PACKAGE_VERSION}
6+
1 1.5.${PACKAGE_VERSION}
77
${TRACE_FILE}
88
efa.c
99
verbs.c

providers/efa/efa.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// SPDX-License-Identifier: GPL-2.0 OR BSD-2-Clause
22
/*
3-
* Copyright 2019-2025 Amazon.com, Inc. or its affiliates. All rights reserved.
3+
* Copyright 2019-2026 Amazon.com, Inc. or its affiliates. All rights reserved.
44
*/
55

66
#include <stdio.h>
@@ -83,6 +83,10 @@ static struct verbs_context *efa_alloc_context(struct ibv_device *vdev,
8383
ctx->cqe_size = sizeof(struct efa_io_rx_cdesc);
8484
ctx->ex_cqe_size = sizeof(struct efa_io_rx_cdesc_ex);
8585
ctx->inline_buf_size = resp.inline_buf_size;
86+
ctx->inline_buf_size_ex = resp.inline_buf_size_ex;
87+
if (ctx->inline_buf_size_ex == 0)
88+
ctx->inline_buf_size_ex = ctx->inline_buf_size;
89+
8690
ctx->max_llq_size = resp.max_llq_size;
8791
ctx->max_tx_batch = resp.max_tx_batch;
8892
ctx->min_sq_wr = resp.min_sq_wr;

providers/efa/efa.h

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* SPDX-License-Identifier: GPL-2.0 OR BSD-2-Clause */
22
/*
3-
* Copyright 2019-2025 Amazon.com, Inc. or its affiliates. All rights reserved.
3+
* Copyright 2019-2026 Amazon.com, Inc. or its affiliates. All rights reserved.
44
*/
55

66
#ifndef __EFA_H__
@@ -31,6 +31,7 @@ struct efa_context {
3131
uint32_t cmds_supp_udata_mask;
3232
uint16_t sub_cqs_per_cq;
3333
uint16_t inline_buf_size;
34+
uint16_t inline_buf_size_ex;
3435
uint32_t max_llq_size;
3536
uint32_t device_caps;
3637
uint32_t max_sq_wr;
@@ -133,6 +134,21 @@ struct efa_rq {
133134
size_t buf_size;
134135
};
135136

137+
struct efa_tx_wqe_ctx {
138+
/* wqe buffer */
139+
void *buff;
140+
/* wqe meta descriptor */
141+
struct efa_io_tx_meta_desc *md;
142+
/* wqe local memory / SGL */
143+
struct efa_io_tx_buf_desc *local_mem;
144+
/* wqe remote memory - RDMA only */
145+
struct efa_io_remote_mem_addr *remote_mem;
146+
/* wqe inline data buffer */
147+
uint8_t *inline_data;
148+
/* max sge allowed for this wqe */
149+
uint8_t max_sge;
150+
};
151+
136152
struct efa_sq {
137153
struct efa_wq wq;
138154
uint8_t *desc;
@@ -141,6 +157,8 @@ struct efa_sq {
141157
size_t max_inline_data;
142158
size_t max_wr_rdma_sge;
143159
uint16_t max_batch_wr;
160+
uint16_t wqe_size;
161+
bool inline_write_enabled;
144162

145163
/* Buffer for pending WR entries in the current session */
146164
uint8_t *local_queue;
@@ -149,7 +167,7 @@ struct efa_sq {
149167
/* Phase before current session */
150168
int phase_rb;
151169
/* Current wqe being built */
152-
struct efa_io_tx_wqe *curr_tx_wqe;
170+
struct efa_tx_wqe_ctx curr_tx_wqe;
153171
};
154172

155173
struct efa_qp {

providers/efa/efa_io_defs.h

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#define EFA_IO_TX_DESC_NUM_BUFS 2
1010
#define EFA_IO_TX_DESC_NUM_RDMA_BUFS 1
1111
#define EFA_IO_TX_DESC_INLINE_MAX_SIZE 32
12+
#define EFA_IO_TX_DESC_INLINE_MAX_SIZE_128 80
1213
#define EFA_IO_TX_DESC_IMM_DATA_SIZE 4
1314

1415
enum efa_io_queue_type {
@@ -164,9 +165,22 @@ struct efa_io_rdma_req {
164165
struct efa_io_tx_buf_desc local_mem[1];
165166
};
166167

168+
struct efa_io_rdma_req_128 {
169+
/* Remote memory address */
170+
struct efa_io_remote_mem_addr remote_mem;
171+
172+
union {
173+
/* Local memory address */
174+
struct efa_io_tx_buf_desc local_mem[1];
175+
176+
/* inline data for RDMA */
177+
uint8_t inline_data[80];
178+
};
179+
};
180+
167181
/*
168-
* Tx WQE, composed of tx meta descriptors followed by either tx buffer
169-
* descriptors or inline data
182+
* 64-byte Tx WQE, composed of tx meta descriptors followed by either tx
183+
* buffer descriptors or inline data
170184
*/
171185
struct efa_io_tx_wqe {
172186
/* TX meta */
@@ -183,6 +197,25 @@ struct efa_io_tx_wqe {
183197
} data;
184198
};
185199

200+
/*
201+
* 128-byte Tx WQE, composed of tx meta descriptors followed by either tx
202+
* buffer descriptors or inline data
203+
*/
204+
struct efa_io_tx_wqe_128 {
205+
/* TX meta */
206+
struct efa_io_tx_meta_desc meta;
207+
208+
union {
209+
/* Send buffer descriptors */
210+
struct efa_io_tx_buf_desc sgl[2];
211+
212+
uint8_t inline_data[80];
213+
214+
/* RDMA local and remote memory addresses */
215+
struct efa_io_rdma_req_128 rdma_req;
216+
} data;
217+
};
218+
186219
/*
187220
* Rx buffer descriptor; RX WQE is composed of one or more RX buffer
188221
* descriptors.

providers/efa/efadv.h

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* SPDX-License-Identifier: GPL-2.0 OR BSD-2-Clause */
22
/*
3-
* Copyright 2019-2025 Amazon.com, Inc. or its affiliates. All rights reserved.
3+
* Copyright 2019-2026 Amazon.com, Inc. or its affiliates. All rights reserved.
44
*/
55

66
#ifndef __EFADV_H__
@@ -32,7 +32,7 @@ struct efadv_device_attr {
3232
uint16_t max_sq_sge;
3333
uint16_t max_rq_sge;
3434
uint16_t inline_buf_size;
35-
uint8_t reserved[2];
35+
uint16_t inline_buf_size_ex;
3636
uint32_t device_caps;
3737
uint32_t max_rdma_size;
3838
};
@@ -47,6 +47,29 @@ struct efadv_ah_attr {
4747
uint8_t reserved[6];
4848
};
4949

50+
enum {
51+
EFADV_SQ_DEPTH_ATTR_INLINE_WRITE = 1 << 0,
52+
};
53+
54+
struct efadv_sq_depth_attr {
55+
uint64_t comp_mask;
56+
uint32_t flags;
57+
uint32_t max_send_sge;
58+
uint32_t max_rdma_sge;
59+
uint32_t max_inline_data;
60+
};
61+
62+
int efadv_get_max_sq_depth(struct ibv_context *ibvctx, struct efadv_sq_depth_attr *attr,
63+
uint32_t inlen);
64+
65+
struct efadv_rq_depth_attr {
66+
uint64_t comp_mask;
67+
uint32_t max_recv_sge;
68+
};
69+
70+
int efadv_get_max_rq_depth(struct ibv_context *ibvctx, struct efadv_rq_depth_attr *attr,
71+
uint32_t inlen);
72+
5073
int efadv_query_ah(struct ibv_ah *ibvah, struct efadv_ah_attr *attr,
5174
uint32_t inlen);
5275

@@ -61,6 +84,7 @@ struct ibv_qp *efadv_create_driver_qp(struct ibv_pd *ibvpd,
6184

6285
enum {
6386
EFADV_QP_FLAGS_UNSOLICITED_WRITE_RECV = 1 << 0,
87+
EFADV_QP_FLAGS_INLINE_WRITE = 1 << 1,
6488
};
6589

6690
struct efadv_qp_init_attr {

providers/efa/libefa.map

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,9 @@ EFA_1.4 {
2929
efadv_query_qp_wqs;
3030
efadv_query_cq;
3131
} EFA_1.3;
32+
33+
EFA_1.5 {
34+
global:
35+
efadv_get_max_sq_depth;
36+
efadv_get_max_rq_depth;
37+
} EFA_1.4;

providers/efa/man/efadv_create_qp_ex.3.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,9 @@ struct efadv_qp_init_attr {
6868
EFADV_QP_FLAGS_UNSOLICITED_WRITE_RECV:
6969
Receive WRs will not be consumed for RDMA write with imm.
7070

71+
EFADV_QP_FLAGS_INLINE_WRITE:
72+
QP supports RDMA write with inline operations.
73+
7174
*sl*
7275
: Service Level - 0 value implies default level.
7376

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
---
2+
layout: page
3+
title: EFADV_GET_MAX_RQ_DEPTH
4+
section: 3
5+
tagline: Verbs
6+
date: 2026-02-17
7+
header: "EFA Direct Verbs Manual"
8+
footer: efa
9+
---
10+
11+
# NAME
12+
13+
efadv_get_max_rq_depth - Get EFA receive queue max depth based on receive queue attributes
14+
15+
# SYNOPSIS
16+
17+
```c
18+
#include <infiniband/efadv.h>
19+
20+
int efadv_get_max_rq_depth(struct ibv_context *ibvctx, struct efadv_rq_depth_attr *attr,
21+
uint32_t inlen);
22+
```
23+
24+
# DESCRIPTION
25+
26+
**efadv_get_max_rq_depth()** get device-specific receive queue max depth based on RQ attributes.
27+
28+
Compatibility is handled using the comp_mask and inlen fields.
29+
30+
```c
31+
struct efadv_rq_depth_attr {
32+
uint64_t comp_mask;
33+
uint32_t max_recv_sge;
34+
};
35+
```
36+
37+
*inlen*
38+
: In: Size of struct efadv_rq_depth_attr.
39+
40+
*comp_mask*
41+
: Compatibility mask.
42+
43+
*max_recv_sge*
44+
: Requested max number of scatter/gather (s/g) elements in a WR in the receive queue.
45+
46+
# RETURN VALUE
47+
48+
**efadv_get_max_rq_depth()** returns max receive queue depth on success, or the negative value of errno on failure
49+
(which indicates the failure reason).
50+
51+
# SEE ALSO
52+
53+
**efadv**(7)
54+
55+
# AUTHORS
56+
57+
Yonatan Nachum <ynachum@amazon.com>
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
---
2+
layout: page
3+
title: EFADV_GET_MAX_SQ_DEPTH
4+
section: 3
5+
tagline: Verbs
6+
date: 2026-02-17
7+
header: "EFA Direct Verbs Manual"
8+
footer: efa
9+
---
10+
11+
# NAME
12+
13+
efadv_get_max_sq_depth - Get EFA send queue max depth based on send queue attributes
14+
15+
# SYNOPSIS
16+
17+
```c
18+
#include <infiniband/efadv.h>
19+
20+
int efadv_get_max_sq_depth(struct ibv_context *ibvctx, struct efadv_sq_depth_attr *attr,
21+
uint32_t inlen);
22+
```
23+
24+
# DESCRIPTION
25+
26+
**efadv_get_max_sq_depth()** get device-specific send queue max depth based on SQ attributes.
27+
28+
Compatibility is handled using the comp_mask and inlen fields.
29+
30+
```c
31+
struct efadv_sq_depth_attr {
32+
uint64_t comp_mask;
33+
uint32_t flags;
34+
uint32_t max_send_sge;
35+
uint32_t max_rdma_sge;
36+
uint32_t max_inline_data;
37+
};
38+
```
39+
40+
*inlen*
41+
: In: Size of struct efadv_sq_depth_attr.
42+
43+
*comp_mask*
44+
: Compatibility mask.
45+
46+
*flags*
47+
: A bitwise OR of the values described below.
48+
49+
EFADV_SQ_DEPTH_ATTR_INLINE_WRITE:
50+
Inline RDMA write operation support is required.
51+
52+
*max_send_sge*
53+
: Requested max number of scatter/gather (s/g) elements in a send WR in the send queue.
54+
55+
*max_rdma_sge*
56+
: Requested max number of scatter/gather (s/g) elements in a RDMA WR in the send queue.
57+
58+
*max_inline_data*
59+
: Requested max number of data (bytes) that can be posted inline to the send queue.
60+
61+
# RETURN VALUE
62+
63+
**efadv_get_max_sq_depth()** returns max send queue depth on success, or the negative value of errno on failure
64+
(which indicates the failure reason).
65+
66+
# SEE ALSO
67+
68+
**efadv**(7)
69+
70+
# AUTHORS
71+
72+
Yonatan Nachum <ynachum@amazon.com>

0 commit comments

Comments
 (0)