static int is_sender;
static char *dst_addr;
static char *src_addr;
+static enum rdma_port_space port_space = RDMA_PS_UDP;
static int create_message(struct cmatest_node *node)
{
for (i = 0; i < connections; i++) {
test.nodes[i].id = i;
ret = rdma_create_id(test.channel, &test.nodes[i].cma_id,
- &test.nodes[i], RDMA_PS_UDP);
+ &test.nodes[i], port_space);
if (ret)
goto err;
}
{
int op, ret;
- while ((op = getopt(argc, argv, "m:sb:c:C:S:")) != -1) {
+ while ((op = getopt(argc, argv, "m:sb:c:C:S:p:")) != -1) {
switch (op) {
case 'm':
dst_addr = optarg;
case 'S':
message_size = atoi(optarg);
break;
+ case 'p':
+ port_space = strtol(optarg, NULL, 0);
+ break;
default:
printf("usage: %s\n", argv[0]);
printf("\t-m multicast_address\n");
printf("\t[-c connections]\n");
printf("\t[-C message_count]\n");
printf("\t[-S message_size]\n");
+ printf("\t[-p port_space - %#x for UDP (default), "
+ "%#x for IPOIB]\n", RDMA_PS_UDP, RDMA_PS_IPOIB);
exit(1);
}
}
node->ah = ibv_create_ah_from_wc(node->pd, wc, node->mem,
node->cma_id->port_num);
node->remote_qpn = ntohl(wc->imm_data);
- node->remote_qkey = RDMA_UD_QKEY;
+ node->remote_qkey = RDMA_UDP_QKEY;
}
static int poll_cqs(void)
};
enum rdma_port_space {
+ RDMA_PS_IPOIB= 0x0002,
RDMA_PS_TCP = 0x0106,
RDMA_PS_UDP = 0x0111,
};
/*
- * Global qkey value for all UD QPs and multicast groups created via the
+ * Global qkey value for UDP QPs and multicast groups created via the
* RDMA CM.
*/
-#define RDMA_UD_QKEY 0x01234567
+#define RDMA_UDP_QKEY 0x01234567
struct ib_addr {
union ibv_gid sgid;
qp_attr.port_num = id_priv->id.port_num;
qp_attr.qp_state = IBV_QPS_INIT;
- qp_attr.qkey = RDMA_UD_QKEY;
+ qp_attr.qkey = RDMA_UDP_QKEY; /* Will override PS_IPOIB on join */
ret = ibv_modify_qp(qp, &qp_attr, IBV_QP_STATE | IBV_QP_PKEY_INDEX |
IBV_QP_PORT | IBV_QP_QKEY);
if (ret)
if (!qp)
return -ENOMEM;
- if (id->ps == RDMA_PS_UDP)
+ if (id->ps == RDMA_PS_UDP || id->ps == RDMA_PS_IPOIB)
ret = ucma_init_ud_qp(id_priv, qp);
else
ret = ucma_init_ib_qp(id_priv, qp);
static int ucma_process_join(struct cma_event *evt)
{
+ int ret;
+
evt->mc->mgid = evt->event.param.ud.ah_attr.grh.dgid;
evt->mc->mlid = evt->event.param.ud.ah_attr.dlid;
- if (evt->id_priv->id.qp)
- return ibv_attach_mcast(evt->id_priv->id.qp,
- &evt->mc->mgid, evt->mc->mlid);
- else
+ if (!evt->id_priv->id.qp)
return 0;
+
+ if (evt->id_priv->id.ps == RDMA_PS_IPOIB) {
+ struct ibv_qp_attr qp_attr;
+
+ qp_attr.qkey = evt->event.param.ud.qkey;
+ ret = ibv_modify_qp(evt->id_priv->id.qp, &qp_attr, IBV_QP_QKEY);
+ if (ret)
+ return ret;
+ }
+
+ return ibv_attach_mcast(evt->id_priv->id.qp, &evt->mc->mgid,
+ evt->mc->mlid);
}
static void ucma_copy_conn_event(struct cma_event *event,