1 /**
2 * Copyright (C) Mellanox Technologies Ltd. 2019.  ALL RIGHTS RESERVED.
3 *
4 * See file LICENSE for terms.
5 */
6 
7 #ifdef HAVE_CONFIG_H
8 #  include "config.h"
9 #endif
10 
11 #include <uct/ib/base/ib_iface.h>
12 
uct_ib_exp_qp_fill_attr(uct_ib_iface_t * iface,uct_ib_qp_attr_t * attr)13 void uct_ib_exp_qp_fill_attr(uct_ib_iface_t *iface, uct_ib_qp_attr_t *attr)
14 {
15 #if HAVE_DECL_IBV_EXP_CREATE_QP
16     if (!(attr->ibv.comp_mask & IBV_EXP_QP_INIT_ATTR_PD)) {
17         attr->ibv.comp_mask       = IBV_EXP_QP_INIT_ATTR_PD;
18         attr->ibv.pd              = uct_ib_iface_md(iface)->pd;
19     }
20 #endif
21 
22     if (attr->qp_type == IBV_QPT_UD) {
23         return;
24     }
25 
26 #if HAVE_IB_EXT_ATOMICS
27     attr->ibv.comp_mask          |= IBV_EXP_QP_INIT_ATTR_ATOMICS_ARG;
28     attr->ibv.max_atomic_arg      = UCT_IB_MAX_ATOMIC_SIZE;
29 #endif
30 
31 #if HAVE_DECL_IBV_EXP_ATOMIC_HCA_REPLY_BE
32     if (uct_ib_iface_device(iface)->dev_attr.exp_atomic_cap ==
33                                      IBV_EXP_ATOMIC_HCA_REPLY_BE) {
34         attr->ibv.comp_mask       |= IBV_EXP_QP_INIT_ATTR_CREATE_FLAGS;
35         attr->ibv.exp_create_flags = IBV_EXP_QP_CREATE_ATOMIC_BE_REPLY;
36     }
37 #endif
38 
39 #if HAVE_STRUCT_IBV_EXP_QP_INIT_ATTR_MAX_INL_RECV
40     attr->ibv.comp_mask           |= IBV_EXP_QP_INIT_ATTR_INL_RECV;
41     attr->ibv.max_inl_recv         = attr->max_inl_cqe[UCT_IB_DIR_RX];
42 #endif
43 }
44 
45