Skip to content

Commit 017b972

Browse files
committed
prov/efa: Use tclass to prioritize the messages from an ep
To prioritize the messages from a given endpoint, user can specify ` fi_info->tx_attr->tclass = FI_TC_LOW_LATENCY` in the fi_endpoint() call to set the service level in rdma-core. All other tclass values will be ignored. Signed-off-by: Jessie Yang <[email protected]>
1 parent 16a4445 commit 017b972

File tree

5 files changed

+22
-5
lines changed

5 files changed

+22
-5
lines changed

man/fi_efa.7.md

+2
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,8 @@ struct fi_efa_mr_attr {
205205
**query_mr()** returns 0 on success, or the value of errno on failure
206206
(which indicates the failure reason).
207207

208+
# Traffic Class (tclass) in EFA
209+
To prioritize the messages from a given endpoint, user can specify `fi_info->tx_attr->tclass = FI_TC_LOW_LATENCY` in the fi_endpoint() call to set the service level in rdma-core. All other tclass values will be ignored.
208210

209211
# RUNTIME PARAMETERS
210212

prov/efa/configure.m4

+9
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ AC_DEFUN([FI_EFA_CONFIGURE],[
7777
efadv_support_extended_cq=0
7878
have_efa_dmabuf_mr=0
7979
have_efadv_query_mr=0
80+
have_efadv_sl=0
8081
8182
dnl $have_neuron is defined at top-level configure.ac
8283
AM_CONDITIONAL([HAVE_NEURON], [ test x"$have_neuron" = x1 ])
@@ -159,6 +160,11 @@ AC_DEFUN([FI_EFA_CONFIGURE],[
159160
[],
160161
[have_efadv_query_mr=0],
161162
[[#include <infiniband/efadv.h>]])
163+
164+
AC_CHECK_MEMBER(struct efadv_qp_init_attr.sl,
165+
[have_efadv_sl=1],
166+
[have_efadv_sl=0],
167+
[[#include <infiniband/efadv.h>]])
162168
])
163169
164170
AC_DEFINE_UNQUOTED([HAVE_RDMA_SIZE],
@@ -188,6 +194,9 @@ AC_DEFUN([FI_EFA_CONFIGURE],[
188194
AC_DEFINE_UNQUOTED([HAVE_EFADV_QUERY_MR],
189195
[$have_efadv_query_mr],
190196
[Indicates if efadv_query_mr verbs is available])
197+
AC_DEFINE_UNQUOTED([HAVE_EFADV_SL],
198+
[$have_efadv_sl],
199+
[Indicates if efadv_qp_init_attr has sl])
191200
192201
193202
CPPFLAGS=$save_CPPFLAGS

prov/efa/src/efa_base_ep.c

+6-2
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ static int efa_base_ep_modify_qp_rst2rts(struct efa_base_ep *base_ep,
167167
* @param init_attr_ex ibv_qp_init_attr_ex
168168
* @return int 0 on success, negative integer on failure
169169
*/
170-
int efa_qp_create(struct efa_qp **qp, struct ibv_qp_init_attr_ex *init_attr_ex)
170+
int efa_qp_create(struct efa_qp **qp, struct ibv_qp_init_attr_ex *init_attr_ex, uint32_t tclass)
171171
{
172172
struct efadv_qp_init_attr efa_attr = { 0 };
173173

@@ -185,6 +185,10 @@ int efa_qp_create(struct efa_qp **qp, struct ibv_qp_init_attr_ex *init_attr_ex)
185185
efa_attr.flags |= EFADV_QP_FLAGS_UNSOLICITED_WRITE_RECV;
186186
#endif
187187
efa_attr.driver_qp_type = EFADV_QP_DRIVER_TYPE_SRD;
188+
#if HAVE_EFADV_SL
189+
if (tclass == FI_TC_LOW_LATENCY)
190+
efa_attr.sl = EFA_QP_DEFAULT_SERVICE_LEVEL;
191+
#endif
188192
(*qp)->ibv_qp = efadv_create_qp_ex(
189193
init_attr_ex->pd->context, init_attr_ex, &efa_attr,
190194
sizeof(struct efadv_qp_init_attr));
@@ -206,7 +210,7 @@ int efa_base_ep_create_qp(struct efa_base_ep *base_ep,
206210
{
207211
int ret;
208212

209-
ret = efa_qp_create(&base_ep->qp, init_attr_ex);
213+
ret = efa_qp_create(&base_ep->qp, init_attr_ex, base_ep->info->tx_attr->tclass);
210214
if (ret)
211215
return ret;
212216

prov/efa/src/efa_base_ep.h

+3-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
#include "ofi_util.h"
1313
#include "rdm/efa_rdm_protocol.h"
1414

15+
#define EFA_QP_DEFAULT_SERVICE_LEVEL 8
16+
1517
struct efa_qp {
1618
struct ibv_qp *ibv_qp;
1719
struct ibv_qp_ex *ibv_qp_ex;
@@ -72,7 +74,7 @@ int efa_base_ep_construct(struct efa_base_ep *base_ep,
7274

7375
int efa_base_ep_getname(fid_t fid, void *addr, size_t *addrlen);
7476

75-
int efa_qp_create(struct efa_qp **qp, struct ibv_qp_init_attr_ex *init_attr_ex);
77+
int efa_qp_create(struct efa_qp **qp, struct ibv_qp_init_attr_ex *init_attr_ex, uint32_t tclass);
7678

7779
void efa_qp_destruct(struct efa_qp *qp);
7880

prov/efa/src/rdm/efa_rdm_ep_fiops.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ int efa_rdm_ep_create_base_ep_ibv_qp(struct efa_rdm_ep *ep)
105105
* without any headers.
106106
*/
107107
if (ep->use_zcpy_rx) {
108-
ret = efa_qp_create(&ep->base_ep.user_recv_qp, &attr_ex);
108+
ret = efa_qp_create(&ep->base_ep.user_recv_qp, &attr_ex, ep->base_ep.info->tx_attr->tclass);
109109
if (ret) {
110110
efa_base_ep_destruct_qp(&ep->base_ep);
111111
return ret;
@@ -1646,7 +1646,7 @@ int efa_rdm_ep_check_qp_in_order_aligned_128_bytes(struct efa_rdm_ep *ep,
16461646
/* Create a dummy qp for query only */
16471647
efa_rdm_ep_construct_ibv_qp_init_attr_ex(ep, &attr_ex, ibv_cq_ex, ibv_cq_ex);
16481648

1649-
ret = efa_qp_create(&qp, &attr_ex);
1649+
ret = efa_qp_create(&qp, &attr_ex, FI_TC_UNSPEC);
16501650
if (ret)
16511651
goto out;
16521652

0 commit comments

Comments
 (0)