Skip to content

Commit 34d8f39

Browse files
committed
prov/efa: Add env variable for testing with efa direct
Signed-off-by: Jessie Yang <[email protected]>
1 parent 9cffc5e commit 34d8f39

File tree

4 files changed

+18
-0
lines changed

4 files changed

+18
-0
lines changed

prov/efa/src/efa_env.c

+4
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ struct efa_env efa_env = {
4040
.huge_page_setting = EFA_ENV_HUGE_PAGE_UNSPEC,
4141
.use_unsolicited_write_recv = 1,
4242
.internal_rx_refill_threshold = 8,
43+
.use_efa_direct = 0,
4344
};
4445

4546
/**
@@ -155,6 +156,7 @@ void efa_env_param_get(void)
155156
&efa_env.efa_max_gdrcopy_msg_size);
156157
fi_param_get_bool(&efa_prov, "use_sm2", &efa_env.use_sm2);
157158
fi_param_get_bool(&efa_prov, "use_unsolicited_write_recv", &efa_env.use_unsolicited_write_recv);
159+
fi_param_get_bool(&efa_prov, "use_efa_direct", &efa_env.use_efa_direct);
158160

159161
int use_huge_page;
160162
if (fi_param_get_bool(&efa_prov, "use_huge_page", &use_huge_page) ==0) {
@@ -236,6 +238,8 @@ void efa_env_define()
236238
"Use device's unsolicited write recv functionality when it's available. (Default: true)");
237239
fi_param_define(&efa_prov, "internal_rx_refill_threshold", FI_PARAM_SIZE_T,
238240
"The threshold that EFA provider will refill the internal rx pkt pool. (Default: %zu)", efa_env.internal_rx_refill_threshold);
241+
fi_param_define(&efa_prov, "use_efa_direct", FI_PARAM_BOOL,
242+
"Use efa direct path. (Default: false)");
239243
}
240244

241245

prov/efa/src/efa_env.h

+1
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ struct efa_env {
8585
* the refill will be skipped.
8686
*/
8787
size_t internal_rx_refill_threshold;
88+
int use_efa_direct;
8889
};
8990

9091
extern struct efa_env efa_env;

prov/efa/src/rdm/efa_rdm_cq.c

+3
Original file line numberDiff line numberDiff line change
@@ -687,6 +687,9 @@ int efa_rdm_cq_open(struct fid_domain *domain, struct fi_cq_attr *attr,
687687
(*cq_fid)->fid.ops = &efa_rdm_cq_fi_ops;
688688
(*cq_fid)->ops = &efa_rdm_cq_ops;
689689

690+
if (efa_env.use_efa_direct)
691+
cq->util_cq.progress = efa_cq_progress;
692+
690693
/* open shm cq as peer cq */
691694
if (efa_domain->shm_domain) {
692695
memcpy(&shm_cq_attr, attr, sizeof(*attr));

prov/efa/src/rdm/efa_rdm_ep_fiops.c

+10
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
#include "efa_rdm_pke_req.h"
1515
#include "efa_cntr.h"
1616

17+
extern struct fi_ops_msg efa_msg_ops;
18+
extern struct fi_ops_rma efa_rma_ops;
19+
1720
static
1821
void efa_rdm_ep_construct_ibv_qp_init_attr_ex(struct efa_rdm_ep *ep,
1922
struct ibv_qp_init_attr_ex *attr_ex,
@@ -1288,6 +1291,7 @@ static int efa_rdm_ep_ctrl(struct fid *fid, int command, void *arg)
12881291
struct fi_peer_srx_context peer_srx_context = {0};
12891292
struct fi_rx_attr peer_srx_attr = {0};
12901293
struct util_srx_ctx *srx_ctx;
1294+
struct fid_ep *ep_fid;
12911295

12921296
switch (command) {
12931297
case FI_ENABLE:
@@ -1318,6 +1322,12 @@ static int efa_rdm_ep_ctrl(struct fid *fid, int command, void *arg)
13181322
ep->base_ep.inject_rma_size =
13191323
MIN(ep->base_ep.inject_rma_size,
13201324
efa_rdm_ep_domain(ep)->device->efa_attr.inline_buf_size);
1325+
1326+
if (efa_env.use_efa_direct) {
1327+
ep_fid = &ep->base_ep.util_ep.ep_fid;
1328+
ep_fid->msg = &efa_msg_ops;
1329+
ep_fid->rma = &efa_rma_ops;
1330+
}
13211331
}
13221332

13231333
ret = efa_rdm_ep_create_base_ep_ibv_qp(ep);

0 commit comments

Comments
 (0)