return 0;\r
}\r
\r
+ if (!id_priv->id.qp && !param) {\r
+ return rdma_seterrno(EINVAL);\r
+ }\r
+\r
+ if (!param) {\r
+ return 0;\r
+ }\r
+\r
if ((param->responder_resources != RDMA_MAX_RESP_RES) &&\r
(param->responder_resources > id_priv->cma_dev->max_responder_resources)) {\r
return rdma_seterrno(EINVAL);\r
return 0;\r
}\r
\r
+static void ucma_set_connect_attr(struct cma_id_private *id_priv,\r
+ struct rdma_conn_param *param,\r
+ WV_CONNECT_PARAM *attr)\r
+{\r
+ RtlZeroMemory(attr, sizeof *attr);\r
+\r
+ attr->ResponderResources = id_priv->responder_resources;\r
+ attr->InitiatorDepth = id_priv->initiator_depth;\r
+\r
+ if (param) {\r
+ attr->RetryCount = param->retry_count;\r
+ attr->RnrRetryCount = param->rnr_retry_count;\r
+ if ((attr->DataLength = param->private_data_len)) {\r
+ RtlCopyMemory(attr->Data, param->private_data, attr->DataLength);\r
+ }\r
+ } else {\r
+ attr->RetryCount = 7;\r
+ attr->RnrRetryCount = 7;\r
+ }\r
+}\r
+\r
__declspec(dllexport)\r
int rdma_connect(struct rdma_cm_id *id, struct rdma_conn_param *conn_param)\r
{\r
return ret;\r
}\r
\r
- id_priv->responder_resources = min(conn_param->responder_resources,\r
- id_priv->cma_dev->max_responder_resources);\r
- id_priv->initiator_depth = min(conn_param->initiator_depth,\r
- id_priv->cma_dev->max_initiator_depth);\r
-\r
- RtlZeroMemory(&attr, sizeof attr);\r
- attr.ResponderResources = id_priv->responder_resources;\r
- attr.InitiatorDepth = id_priv->initiator_depth;\r
- attr.RetryCount = conn_param->retry_count;\r
- attr.RnrRetryCount = conn_param->rnr_retry_count;\r
- if ((attr.DataLength = conn_param->private_data_len)) {\r
- RtlCopyMemory(attr.Data, conn_param->private_data, attr.DataLength);\r
+ if (conn_param && conn_param->responder_resources != RDMA_MAX_RESP_RES) {\r
+ id_priv->responder_resources = conn_param->responder_resources;\r
+ } else {\r
+ id_priv->responder_resources = id_priv->cma_dev->max_responder_resources;\r
+ }\r
+ if (conn_param && conn_param->initiator_depth != RDMA_MAX_INIT_DEPTH) {\r
+ id_priv->initiator_depth = conn_param->initiator_depth;\r
+ } else {\r
+ id_priv->initiator_depth = id_priv->cma_dev->max_initiator_depth;\r
}\r
\r
+ ucma_set_connect_attr(id_priv, conn_param, &attr);\r
+\r
id_priv->state = cma_active_connect;\r
id_priv->refcnt++;\r
id->comp_entry.Busy = 1;\r
return ret;\r
}\r
\r
- if (conn_param->initiator_depth == RDMA_MAX_INIT_DEPTH) {\r
+ if (!conn_param || conn_param->initiator_depth == RDMA_MAX_INIT_DEPTH) {\r
id_priv->initiator_depth = min(id_priv->initiator_depth,\r
id_priv->cma_dev->max_initiator_depth);\r
} else {\r
id_priv->initiator_depth = conn_param->initiator_depth;\r
}\r
- if (conn_param->responder_resources == RDMA_MAX_RESP_RES) {\r
+ if (!conn_param || conn_param->responder_resources == RDMA_MAX_RESP_RES) {\r
id_priv->responder_resources = min(id_priv->responder_resources,\r
id_priv->cma_dev->max_responder_resources);\r
} else {\r
id_priv->responder_resources = conn_param->responder_resources;\r
}\r
\r
- RtlZeroMemory(&attr, sizeof attr);\r
- attr.ResponderResources = id_priv->responder_resources;\r
- attr.InitiatorDepth = id_priv->initiator_depth;\r
- attr.RetryCount = conn_param->retry_count;\r
- attr.RnrRetryCount = conn_param->rnr_retry_count;\r
- if ((attr.DataLength = conn_param->private_data_len)) {\r
- RtlCopyMemory(attr.Data, conn_param->private_data, attr.DataLength);\r
- }\r
+ ucma_set_connect_attr(id_priv, conn_param, &attr);\r
\r
id_priv->state = cma_accepting;\r
id_priv->refcnt++;\r