Commit 04215330 authored by Michael Wang's avatar Michael Wang Committed by Doug Ledford

IB/Verbs: Use management helper rdma_cap_iw_cm()

Introduce helper rdma_cap_iw_cm() to help us check if the port of an
IB device support IWARP Communication Manager.
Signed-off-by: default avatarMichael Wang <yun.wang@profitbricks.com>
Reviewed-by: default avatarIra Weiny <ira.weiny@intel.com>
Tested-by: default avatarIra Weiny <ira.weiny@intel.com>
Reviewed-by: default avatarSean Hefty <sean.hefty@intel.com>
Reviewed-by: default avatarJason Gunthorpe <jgunthorpe@obsidianresearch.com>
Tested-by: default avatarDoug Ledford <dledford@redhat.com>
Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
parent 72219cea
...@@ -754,7 +754,7 @@ int rdma_init_qp_attr(struct rdma_cm_id *id, struct ib_qp_attr *qp_attr, ...@@ -754,7 +754,7 @@ int rdma_init_qp_attr(struct rdma_cm_id *id, struct ib_qp_attr *qp_attr,
if (qp_attr->qp_state == IB_QPS_RTR) if (qp_attr->qp_state == IB_QPS_RTR)
qp_attr->rq_psn = id_priv->seq_num; qp_attr->rq_psn = id_priv->seq_num;
} else if (rdma_protocol_iwarp(id->device, id->port_num)) { } else if (rdma_cap_iw_cm(id->device, id->port_num)) {
if (!id_priv->cm_id.iw) { if (!id_priv->cm_id.iw) {
qp_attr->qp_access_flags = 0; qp_attr->qp_access_flags = 0;
*qp_attr_mask = IB_QP_STATE | IB_QP_ACCESS_FLAGS; *qp_attr_mask = IB_QP_STATE | IB_QP_ACCESS_FLAGS;
...@@ -1043,7 +1043,7 @@ void rdma_destroy_id(struct rdma_cm_id *id) ...@@ -1043,7 +1043,7 @@ void rdma_destroy_id(struct rdma_cm_id *id)
if (rdma_cap_ib_cm(id_priv->id.device, 1)) { if (rdma_cap_ib_cm(id_priv->id.device, 1)) {
if (id_priv->cm_id.ib) if (id_priv->cm_id.ib)
ib_destroy_cm_id(id_priv->cm_id.ib); ib_destroy_cm_id(id_priv->cm_id.ib);
} else if (rdma_protocol_iwarp(id_priv->id.device, 1)) { } else if (rdma_cap_iw_cm(id_priv->id.device, 1)) {
if (id_priv->cm_id.iw) if (id_priv->cm_id.iw)
iw_destroy_cm_id(id_priv->cm_id.iw); iw_destroy_cm_id(id_priv->cm_id.iw);
} }
...@@ -2527,7 +2527,7 @@ int rdma_listen(struct rdma_cm_id *id, int backlog) ...@@ -2527,7 +2527,7 @@ int rdma_listen(struct rdma_cm_id *id, int backlog)
ret = cma_ib_listen(id_priv); ret = cma_ib_listen(id_priv);
if (ret) if (ret)
goto err; goto err;
} else if (rdma_protocol_iwarp(id->device, 1)) { } else if (rdma_cap_iw_cm(id->device, 1)) {
ret = cma_iw_listen(id_priv, backlog); ret = cma_iw_listen(id_priv, backlog);
if (ret) if (ret)
goto err; goto err;
...@@ -2872,7 +2872,7 @@ int rdma_connect(struct rdma_cm_id *id, struct rdma_conn_param *conn_param) ...@@ -2872,7 +2872,7 @@ int rdma_connect(struct rdma_cm_id *id, struct rdma_conn_param *conn_param)
ret = cma_resolve_ib_udp(id_priv, conn_param); ret = cma_resolve_ib_udp(id_priv, conn_param);
else else
ret = cma_connect_ib(id_priv, conn_param); ret = cma_connect_ib(id_priv, conn_param);
} else if (rdma_protocol_iwarp(id->device, id->port_num)) } else if (rdma_cap_iw_cm(id->device, id->port_num))
ret = cma_connect_iw(id_priv, conn_param); ret = cma_connect_iw(id_priv, conn_param);
else else
ret = -ENOSYS; ret = -ENOSYS;
...@@ -2994,7 +2994,7 @@ int rdma_accept(struct rdma_cm_id *id, struct rdma_conn_param *conn_param) ...@@ -2994,7 +2994,7 @@ int rdma_accept(struct rdma_cm_id *id, struct rdma_conn_param *conn_param)
else else
ret = cma_rep_recv(id_priv); ret = cma_rep_recv(id_priv);
} }
} else if (rdma_protocol_iwarp(id->device, id->port_num)) } else if (rdma_cap_iw_cm(id->device, id->port_num))
ret = cma_accept_iw(id_priv, conn_param); ret = cma_accept_iw(id_priv, conn_param);
else else
ret = -ENOSYS; ret = -ENOSYS;
...@@ -3049,7 +3049,7 @@ int rdma_reject(struct rdma_cm_id *id, const void *private_data, ...@@ -3049,7 +3049,7 @@ int rdma_reject(struct rdma_cm_id *id, const void *private_data,
ret = ib_send_cm_rej(id_priv->cm_id.ib, ret = ib_send_cm_rej(id_priv->cm_id.ib,
IB_CM_REJ_CONSUMER_DEFINED, NULL, IB_CM_REJ_CONSUMER_DEFINED, NULL,
0, private_data, private_data_len); 0, private_data, private_data_len);
} else if (rdma_protocol_iwarp(id->device, id->port_num)) { } else if (rdma_cap_iw_cm(id->device, id->port_num)) {
ret = iw_cm_reject(id_priv->cm_id.iw, ret = iw_cm_reject(id_priv->cm_id.iw,
private_data, private_data_len); private_data, private_data_len);
} else } else
...@@ -3075,7 +3075,7 @@ int rdma_disconnect(struct rdma_cm_id *id) ...@@ -3075,7 +3075,7 @@ int rdma_disconnect(struct rdma_cm_id *id)
/* Initiate or respond to a disconnect. */ /* Initiate or respond to a disconnect. */
if (ib_send_cm_dreq(id_priv->cm_id.ib, NULL, 0)) if (ib_send_cm_dreq(id_priv->cm_id.ib, NULL, 0))
ib_send_cm_drep(id_priv->cm_id.ib, NULL, 0); ib_send_cm_drep(id_priv->cm_id.ib, NULL, 0);
} else if (rdma_protocol_iwarp(id->device, id->port_num)) { } else if (rdma_cap_iw_cm(id->device, id->port_num)) {
ret = iw_cm_disconnect(id_priv->cm_id.iw, 0); ret = iw_cm_disconnect(id_priv->cm_id.iw, 0);
} else } else
ret = -EINVAL; ret = -EINVAL;
......
...@@ -1819,6 +1819,21 @@ static inline bool rdma_cap_ib_cm(struct ib_device *device, u8 port_num) ...@@ -1819,6 +1819,21 @@ static inline bool rdma_cap_ib_cm(struct ib_device *device, u8 port_num)
return rdma_ib_or_iboe(device, port_num); return rdma_ib_or_iboe(device, port_num);
} }
/**
* rdma_cap_iw_cm - Check if the port of device has the capability IWARP
* Communication Manager.
*
* @device: Device to be checked
* @port_num: Port number of the device
*
* Return false when port of the device don't support IWARP
* Communication Manager.
*/
static inline bool rdma_cap_iw_cm(struct ib_device *device, u8 port_num)
{
return rdma_protocol_iwarp(device, port_num);
}
int ib_query_gid(struct ib_device *device, int ib_query_gid(struct ib_device *device,
u8 port_num, int index, union ib_gid *gid); u8 port_num, int index, union ib_gid *gid);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment