[openib-general] [PATCH][3/4] MAD, CM, SA/DM QP API
Roland Dreier
roland at topspin.com
Fri Aug 13 10:49:25 PDT 2004
Index: src/linux-kernel/infiniband/core/dm_client_svc_entries.c
===================================================================
--- src/linux-kernel/infiniband/core/dm_client_svc_entries.c (revision 576)
+++ src/linux-kernel/infiniband/core/dm_client_svc_entries.c (working copy)
@@ -181,7 +181,7 @@
attrib_mod =
TS_IB_DM_SE_SET_BEG_ENTRY_ID(attrib_mod, begin_svc_entry_id);
attrib_mod = TS_IB_DM_SE_SET_END_ENTRY_ID(attrib_mod, end_svc_entry_id);
- ib_dm_client_mad_init(&mad, device, port, dst_port_lid, IB_GSI_QP,
+ ib_dm_client_mad_init(&mad, device, port, dst_port_lid, 1,
TS_IB_DM_METHOD_GET, TS_IB_DM_ATTRIBUTE_SVC_ENTRIES,
attrib_mod);
Index: src/linux-kernel/infiniband/core/cm_common.c
===================================================================
--- src/linux-kernel/infiniband/core/cm_common.c (revision 576)
+++ src/linux-kernel/infiniband/core/cm_common.c (working copy)
@@ -166,7 +166,8 @@
void ib_cm_qp_to_error(struct ib_qp *qp)
{
- struct ib_qp_attribute *qp_attr;
+ struct ib_qp_attr *qp_attr;
+ int attr_mask;
qp_attr = kmalloc(sizeof *qp_attr, GFP_KERNEL);
if (!qp_attr) {
@@ -175,10 +176,10 @@
return;
}
- qp_attr->state = IB_QP_STATE_ERROR;
- qp_attr->valid_fields = IB_QP_ATTRIBUTE_STATE;
+ qp_attr->qp_state = IB_QPS_ERR;
+ attr_mask = IB_QP_STATE;
- if (ib_cm_qp_modify(qp, qp_attr))
+ if (ib_cm_qp_modify(qp, qp_attr, attr_mask))
TS_REPORT_WARN(MOD_IB_CM,
"ib_qp_modify to error failed");
@@ -352,7 +353,7 @@
connection->mad.device = connection->local_cm_device;
connection->mad.port = connection->local_cm_port;
connection->mad.pkey_index = connection->local_cm_pkey_index;
- connection->mad.sqpn = IB_GSI_QP;
+ connection->mad.sqpn = 1;
connection->mad.dlid = connection->remote_cm_lid;
connection->mad.dqpn = connection->remote_cm_qpn;
@@ -414,7 +415,7 @@
packet->device = local_cm_device;
packet->port = local_cm_port;
packet->pkey_index = pkey_index;
- packet->sqpn = IB_GSI_QP;
+ packet->sqpn = 1;
packet->dlid = remote_cm_lid;
packet->dqpn = remote_cm_qpn;
packet->has_grh = 0;
@@ -488,7 +489,7 @@
connection->mad.device = connection->local_cm_device;
connection->mad.port = connection->local_cm_port;
connection->mad.pkey_index = connection->local_cm_pkey_index;
- connection->mad.sqpn = IB_GSI_QP;
+ connection->mad.sqpn = 1;
connection->mad.dlid = connection->remote_cm_lid;
connection->mad.dqpn = connection->remote_cm_qpn;
@@ -711,7 +712,7 @@
drep->device = packet->device;
drep->port = packet->port;
drep->pkey_index = packet->pkey_index;
- drep->sqpn = IB_GSI_QP;
+ drep->sqpn = 1;
drep->dlid = packet->slid;
drep->dqpn = packet->sqpn;
drep->has_grh = 0;
Index: src/linux-kernel/infiniband/core/cm_path_migration.c
===================================================================
--- src/linux-kernel/infiniband/core/cm_path_migration.c (revision 576)
+++ src/linux-kernel/infiniband/core/cm_path_migration.c (working copy)
@@ -41,7 +41,8 @@
static int ib_cm_alt_path_load(struct ib_cm_connection *connection)
{
- struct ib_qp_attribute *qp_attr;
+ struct ib_qp_attr *qp_attr;
+ int attr_mask;
int result;
qp_attr = kmalloc(sizeof *qp_attr, GFP_KERNEL);
@@ -51,15 +52,16 @@
memset(qp_attr, 0, sizeof *qp_attr);
/* XXX need to include CA ACK delay */
- qp_attr->alt_local_ack_timeout = min(31, connection->alternate_path.packet_life + 1);
- qp_attr->alt_address.service_level = connection->alternate_path.sl;
- qp_attr->alt_address.dlid = connection->alternate_path.dlid;
- qp_attr->alt_address.source_path_bits = connection->alternate_path.slid & 0x7f;
- qp_attr->alt_address.static_rate = 0;
- qp_attr->alt_address.use_grh = 0;
- qp_attr->migration_state = IB_REARM;
+ qp_attr->alt_timeout = min(31, connection->alternate_path.packet_life + 1);
+ qp_attr->ah_attr.sl = connection->alternate_path.sl;
+ qp_attr->ah_attr.dlid = connection->alternate_path.dlid;
+ qp_attr->ah_attr.src_path_bits = connection->alternate_path.slid & 0x7f;
+ qp_attr->ah_attr.static_rate = 0;
+ qp_attr->ah_attr.grh_flag = 0;
+ qp_attr->path_mig_state = IB_MIG_REARM;
- if (ib_cached_gid_find(connection->alternate_path.sgid, NULL, &qp_attr->alt_port, NULL)) {
+ if (ib_cached_gid_find(connection->alternate_path.sgid, NULL,
+ &qp_attr->alt_port, NULL)) {
result = -EINVAL;
goto out;
}
@@ -75,18 +77,13 @@
TS_TRACE(MOD_IB_CM, T_VERY_VERBOSE, TRACE_IB_CM_GEN,
"Loading alternate path: port %d, timeout %d, 0x%04x -> 0x%04x",
qp_attr->alt_port,
- qp_attr->alt_local_ack_timeout,
+ qp_attr->alt_timeout,
connection->alternate_path.slid,
- qp_attr->alt_address.dlid);
+ qp_attr->ah_attr.dlid);
- qp_attr->valid_fields =
- IB_QP_ATTRIBUTE_ALT_PORT |
- IB_QP_ATTRIBUTE_ALT_ADDRESS |
- IB_QP_ATTRIBUTE_ALT_PKEY_INDEX |
- IB_QP_ATTRIBUTE_MIGRATION_STATE;
+ attr_mask = (IB_QP_ALT_PATH | IB_QP_PATH_MIG_STATE);
- result = ib_cm_qp_modify(connection->local_qp,
- qp_attr);
+ result = ib_cm_qp_modify(connection->local_qp, qp_attr, attr_mask);
if (result) {
TS_REPORT_WARN(MOD_IB_CM,
@@ -154,7 +151,7 @@
connection->mad.device = connection->local_cm_device;
connection->mad.port = connection->local_cm_port;
connection->mad.pkey_index = connection->local_cm_pkey_index;
- connection->mad.sqpn = IB_GSI_QP;
+ connection->mad.sqpn = 1;
connection->mad.dlid = connection->remote_cm_lid;
connection->mad.dqpn = connection->remote_cm_qpn;
@@ -291,7 +288,7 @@
connection->mad.device = connection->local_cm_device;
connection->mad.port = connection->local_cm_port;
connection->mad.pkey_index = connection->local_cm_pkey_index;
- connection->mad.sqpn = IB_GSI_QP;
+ connection->mad.sqpn = 1;
connection->mad.dlid = connection->remote_cm_lid;
connection->mad.dqpn = connection->remote_cm_qpn;
Index: src/linux-kernel/infiniband/core/cm_connection_table.c
===================================================================
--- src/linux-kernel/infiniband/core/cm_connection_table.c (revision 576)
+++ src/linux-kernel/infiniband/core/cm_connection_table.c (working copy)
@@ -231,7 +231,7 @@
tsKernelTimerInit(&connection->timer);
- connection->mad.sqpn = IB_GSI_QP;
+ connection->mad.sqpn = 1;
connection->mad.has_grh = 0;
connection->mad.completion_func = NULL;
connection->remote_qp_node.pprev = NULL;
Index: src/linux-kernel/infiniband/core/mad_thread.c
===================================================================
--- src/linux-kernel/infiniband/core/mad_thread.c (revision 576)
+++ src/linux-kernel/infiniband/core/mad_thread.c (working copy)
@@ -214,7 +214,7 @@
ib_mad_invoke_filters(mad, TS_IB_MAD_DIRECTION_OUT);
/* Handle directed route SMPs */
- if (mad->dqpn == IB_SMI_QP &&
+ if (mad->dqpn == 0 &&
mad->dlid == IB_LID_PERMISSIVE &&
mad->mgmt_class == IB_SM_DIRECTED_ROUTE)
if (ib_mad_smp_send(device, work, &reuse))
Index: src/linux-kernel/infiniband/core/dm_client_class_port_info.c
===================================================================
--- src/linux-kernel/infiniband/core/dm_client_class_port_info.c (revision 576)
+++ src/linux-kernel/infiniband/core/dm_client_class_port_info.c (working copy)
@@ -188,7 +188,7 @@
return -ENOMEM;
}
- ib_dm_client_mad_init(&mad, device, port, dst_port_lid, IB_GSI_QP,
+ ib_dm_client_mad_init(&mad, device, port, dst_port_lid, 1,
TS_IB_DM_METHOD_SET,
TS_IB_DM_ATTRIBUTE_CLASS_PORTINFO, 0);
Index: src/linux-kernel/infiniband/core/dm_client_ioc_profile.c
===================================================================
--- src/linux-kernel/infiniband/core/dm_client_ioc_profile.c (revision 576)
+++ src/linux-kernel/infiniband/core/dm_client_ioc_profile.c (working copy)
@@ -203,7 +203,7 @@
return -ENOMEM;
}
- ib_dm_client_mad_init(&mad, device, port, dst_port_lid, IB_GSI_QP,
+ ib_dm_client_mad_init(&mad, device, port, dst_port_lid, 1,
TS_IB_DM_METHOD_GET, TS_IB_DM_ATTRIBUTE_IOC_PROFILE,
TS_IB_DM_IOCPROFILE_GET_CONTROLLER_ID
(controller_id));
Index: src/linux-kernel/infiniband/core/mad_ib.c
===================================================================
--- src/linux-kernel/infiniband/core/mad_ib.c (revision 607)
+++ src/linux-kernel/infiniband/core/mad_ib.c (working copy)
@@ -49,24 +49,26 @@
{
struct ib_device *device = mad->device;
struct ib_mad_private *priv = device->mad;
- struct ib_gather_scatter gather_list;
- struct ib_send_param send_param;
+ struct ib_sge gather_list;
+ struct ib_send_wr send_param;
+ struct ib_send_wr *bad_wr;
struct ib_ah_attr av;
struct ib_ah *addr;
- gather_list.address = pci_map_single(priv->ib_dev->dma_device,
+ gather_list.addr = pci_map_single(priv->ib_dev->dma_device,
mad, IB_MAD_PACKET_SIZE,
PCI_DMA_TODEVICE);
gather_list.length = IB_MAD_PACKET_SIZE;
- gather_list.key = priv->lkey;
+ gather_list.lkey = priv->lkey;
- send_param.op = IB_OP_SEND;
- send_param.gather_list = &gather_list;
- send_param.num_gather_entries = 1;
- send_param.dest_qpn = mad->dqpn;
- send_param.pkey_index = mad->pkey_index;
- send_param.solicited_event = 1;
- send_param.signaled = 1;
+ send_param.next = NULL;
+ send_param.opcode = IB_WR_SEND;
+ send_param.sg_list = &gather_list;
+ send_param.num_sge = 1;
+ send_param.wr.ud.remote_qpn = mad->dqpn;
+ send_param.wr.ud.pkey_index = mad->pkey_index;
+ send_param.send_flags =
+ IB_SEND_SIGNALED | IB_SEND_SOLICITED;
av.dlid = mad->dlid;
av.port = mad->port;
@@ -95,16 +97,16 @@
wrid.field.qpn = mad->sqpn;
wrid.field.index = index;
- send_param.work_request_id = wrid.id;
+ send_param.wr_id = wrid.id;
}
- send_param.dest_address = addr;
- send_param.dest_qkey =
- mad->dqpn == IB_SMI_QP ? 0 : IB_GSI_WELL_KNOWN_QKEY;
+ send_param.wr.ud.ah = addr;
+ send_param.wr.ud.remote_qkey =
+ mad->dqpn ? IB_GSI_WELL_KNOWN_QKEY : 0;
pci_unmap_addr_set(&priv->send_buf[mad->port][mad->sqpn][index],
mapping, gather_list.address);
- if (ib_send(priv->qp[mad->port][mad->sqpn], &send_param, 1)) {
+ if (ib_post_send(priv->qp[mad->port][mad->sqpn], &send_param, &bad_wr)) {
TS_REPORT_WARN(MOD_KERNEL_IB,
"ib_send failed for port %d QPN %d of %s",
mad->port, mad->sqpn, device->name);
@@ -290,23 +292,24 @@
{
struct ib_mad_private *priv = device->mad;
void *buf;
- struct ib_receive_param receive_param;
- struct ib_gather_scatter scatter_list;
+ struct ib_recv_wr receive_param;
+ struct ib_recv_wr *bad_wr;
+ struct ib_sge scatter_list;
buf = kmalloc(sizeof (struct ib_mad) + IB_MAD_GRH_SIZE, GFP_KERNEL);
if (!buf)
return -ENOMEM;
- scatter_list.address = pci_map_single(priv->ib_dev->dma_device,
+ scatter_list.addr = pci_map_single(priv->ib_dev->dma_device,
buf, IB_MAD_BUFFER_SIZE,
PCI_DMA_FROMDEVICE);
scatter_list.length = IB_MAD_BUFFER_SIZE;
- scatter_list.key = priv->lkey;
+ scatter_list.lkey = priv->lkey;
- receive_param.scatter_list = &scatter_list;
- receive_param.num_scatter_entries = 1;
- receive_param.device_specific = NULL;
- receive_param.signaled = 1;
+ receive_param.next = NULL;
+ receive_param.sg_list = &scatter_list;
+ receive_param.num_sge = 1;
+ receive_param.recv_flags = IB_RECV_SIGNALED;
{
union ib_mad_wrid wrid;
@@ -316,14 +319,14 @@
wrid.field.qpn = qpn;
wrid.field.index = index;
- receive_param.work_request_id = wrid.id;
+ receive_param.wr_id = wrid.id;
}
priv->receive_buf[port][qpn][index].buf = buf;
pci_unmap_addr_set(&priv->receive_buf[port][qpn][index],
mapping, scatter_list.address);
- if (ib_receive(priv->qp[port][qpn], &receive_param, 1)) {
+ if (ib_post_recv(priv->qp[port][qpn], &receive_param, &bad_wr)) {
TS_REPORT_WARN(MOD_KERNEL_IB,
"ib_receive failed for port %d QPN %d of %s",
port, qpn, device->name);
Index: src/linux-kernel/infiniband/core/cm_api.c
===================================================================
--- src/linux-kernel/infiniband/core/cm_api.c (revision 576)
+++ src/linux-kernel/infiniband/core/cm_api.c (working copy)
@@ -99,20 +99,14 @@
*comm_id = connection->local_comm_id;
- connection->local_qp = param->qp;
- ret = ib_qp_query_qpn(param->qp, &connection->local_qpn);
- if (ret) {
- TS_REPORT_WARN(MOD_IB_CM,
- "ib_qp_query_qpn failed %d", ret);
- goto out;
- }
-
+ connection->local_qp = param->qp;
+ connection->local_qpn = param->qp->qp_num;
connection->transaction_id = ib_cm_tid_generate();
connection->local_cm_device = device;
connection->local_cm_port = port;
connection->primary_path = *primary_path;
connection->remote_cm_lid = primary_path->dlid;
- connection->remote_cm_qpn = IB_GSI_QP;
+ connection->remote_cm_qpn = 1;
connection->receive_psn = ib_cm_psn_generate();
connection->cm_function = function;
connection->cm_arg = arg;
@@ -133,7 +127,8 @@
}
{
- struct ib_qp_attribute *qp_attr;
+ struct ib_qp_attr *qp_attr;
+ int attr_mask;
qp_attr = kmalloc(sizeof *qp_attr, GFP_KERNEL);
if (!qp_attr) {
@@ -153,10 +148,10 @@
}
connection->local_cm_pkey_index = qp_attr->pkey_index;
- qp_attr->valid_fields =
- IB_QP_ATTRIBUTE_PORT |
- IB_QP_ATTRIBUTE_PKEY_INDEX;
- ret = ib_cm_qp_modify(connection->local_qp, qp_attr);
+ attr_mask =
+ IB_QP_PORT |
+ IB_QP_PKEY_INDEX;
+ ret = ib_cm_qp_modify(connection->local_qp, qp_attr, attr_mask);
kfree(qp_attr);
Index: src/linux-kernel/infiniband/core/cm_passive.c
===================================================================
--- src/linux-kernel/infiniband/core/cm_passive.c (revision 576)
+++ src/linux-kernel/infiniband/core/cm_passive.c (working copy)
@@ -92,7 +92,7 @@
connection->mad.device = connection->local_cm_device;
connection->mad.port = connection->local_cm_port;
connection->mad.pkey_index = connection->local_cm_pkey_index;
- connection->mad.sqpn = IB_GSI_QP;
+ connection->mad.sqpn = 1;
connection->mad.dlid = connection->remote_cm_lid;
connection->mad.dqpn = connection->remote_cm_qpn;
@@ -122,15 +122,16 @@
void *response_data,
int response_size)
{
- struct ib_qp_attribute *qp_attr;
+ struct ib_qp_attr *qp_attr;
+ int attr_mask;
int result;
- qp_attr = kmalloc(sizeof(struct ib_qp_attribute), GFP_KERNEL);
+ qp_attr = kmalloc(sizeof *qp_attr, GFP_KERNEL);
if (NULL == qp_attr) {
return -ENOMEM;
}
- memset(qp_attr, 0, sizeof(struct ib_qp_attribute));
+ memset(qp_attr, 0, sizeof *qp_attr);
qp_attr->port = connection->local_cm_port;
if (ib_cached_gid_find(connection->primary_path.sgid, NULL, &qp_attr->port, NULL)) {
@@ -145,11 +146,9 @@
}
connection->local_cm_pkey_index = qp_attr->pkey_index;
- qp_attr->valid_fields =
- IB_QP_ATTRIBUTE_PORT |
- IB_QP_ATTRIBUTE_PKEY_INDEX;
+ attr_mask = (IB_QP_PORT | IB_QP_PKEY_INDEX);
- if (ib_cm_qp_modify(connection->local_qp, qp_attr)) {
+ if (ib_cm_qp_modify(connection->local_qp, qp_attr, attr_mask)) {
TS_REPORT_WARN(MOD_IB_CM,
"ib_qp_modify INIT->INIT failed");
goto fail;
@@ -158,28 +157,28 @@
/* modify QP INIT->RTR */
connection->receive_psn = ib_cm_psn_generate();
- qp_attr->state = IB_QP_STATE_RTR;
- qp_attr->receive_psn = connection->receive_psn;
- qp_attr->destination_qpn = connection->remote_qpn;
- qp_attr->responder_resources = connection->responder_resources;
- qp_attr->rnr_timeout = IB_RNR_TIMER_122_88; /* XXX settable? */
+ qp_attr->qp_state = IB_QPS_RTR;
+ qp_attr->rq_psn = connection->receive_psn;
+ qp_attr->dest_qp_num = connection->remote_qpn;
+ qp_attr->max_dest_rd_atomic = connection->responder_resources;
+ qp_attr->min_rnr_timer = IB_RNR_TIMER_122_88; /* XXX settable? */
qp_attr->path_mtu = connection->primary_path.mtu;
- qp_attr->address.service_level = connection->primary_path.sl;
- qp_attr->address.dlid = connection->primary_path.dlid;
- qp_attr->address.source_path_bits = connection->primary_path.slid & 0x7f;
- qp_attr->address.static_rate = 0;
- qp_attr->address.use_grh = 0;
+ qp_attr->ah_attr.sl = connection->primary_path.sl;
+ qp_attr->ah_attr.dlid = connection->primary_path.dlid;
+ qp_attr->ah_attr.src_path_bits = connection->primary_path.slid & 0x7f;
+ qp_attr->ah_attr.static_rate = 0;
+ qp_attr->ah_attr.grh_flag = 0;
- qp_attr->valid_fields =
- IB_QP_ATTRIBUTE_STATE |
- IB_QP_ATTRIBUTE_RECEIVE_PSN |
- IB_QP_ATTRIBUTE_DESTINATION_QPN |
- IB_QP_ATTRIBUTE_RESPONDER_RESOURCES |
- IB_QP_ATTRIBUTE_RNR_TIMEOUT |
- IB_QP_ATTRIBUTE_PATH_MTU |
- IB_QP_ATTRIBUTE_ADDRESS;
+ attr_mask =
+ IB_QP_STATE |
+ IB_QP_RQ_PSN |
+ IB_QP_DEST_QPN |
+ IB_QP_MAX_DEST_RD_ATOMIC |
+ IB_QP_MIN_RNR_TIMER |
+ IB_QP_PATH_MTU |
+ IB_QP_AV;
- if (ib_cm_qp_modify(connection->local_qp, qp_attr)) {
+ if (ib_cm_qp_modify(connection->local_qp, qp_attr, attr_mask)) {
TS_REPORT_WARN(MOD_IB_CM,
"ib_qp_modify to RTR failed");
goto fail;
@@ -246,49 +245,46 @@
/* =============================================================== */
/*..ib_cm_passive_rts - Transition a passive connection to RTS */
-int ib_cm_passive_rts(
- struct ib_cm_connection *connection
- ) {
- struct ib_qp_attribute *qp_attr;
- int result;
+int ib_cm_passive_rts(struct ib_cm_connection *connection) {
+ struct ib_qp_attr *qp_attr;
+ int attr_mask;
+ int result;
- qp_attr = kmalloc(sizeof(struct ib_qp_attribute), GFP_KERNEL);
+ qp_attr = kmalloc(sizeof *qp_attr, GFP_KERNEL);
if (!qp_attr) {
return -ENOMEM;
}
- memset(qp_attr, 0, sizeof(struct ib_qp_attribute));
+ memset(qp_attr, 0, sizeof *qp_attr);
- qp_attr->state = IB_QP_STATE_RTS;
- qp_attr->send_psn = connection->send_psn;
- qp_attr->initiator_depth = connection->initiator_depth;
- qp_attr->retry_count = connection->retry_count;
- qp_attr->rnr_retry_count = connection->rnr_retry_count;
+ qp_attr->qp_state = IB_QPS_RTS;
+ qp_attr->sq_psn = connection->send_psn;
+ qp_attr->max_rd_atomic = connection->initiator_depth;
+ qp_attr->retry_cnt = connection->retry_count;
+ qp_attr->rnr_retry = connection->rnr_retry_count;
/* We abuse packet life and put local ACK timeout there */
- qp_attr->local_ack_timeout = connection->primary_path.packet_life;
+ qp_attr->timeout = connection->primary_path.packet_life;
- qp_attr->valid_fields =
- IB_QP_ATTRIBUTE_STATE |
- IB_QP_ATTRIBUTE_SEND_PSN |
- IB_QP_ATTRIBUTE_INITIATOR_DEPTH |
- IB_QP_ATTRIBUTE_RETRY_COUNT |
- IB_QP_ATTRIBUTE_RNR_RETRY_COUNT |
- IB_QP_ATTRIBUTE_LOCAL_ACK_TIMEOUT;
+ attr_mask =
+ IB_QP_STATE |
+ IB_QP_SQ_PSN |
+ IB_QP_MAX_QP_RD_ATOMIC |
+ IB_QP_RETRY_CNT |
+ IB_QP_RNR_RETRY |
+ IB_QP_TIMEOUT;
if (connection->alternate_path.dlid) {
- qp_attr->valid_fields |=
- IB_QP_ATTRIBUTE_ALT_PORT |
- IB_QP_ATTRIBUTE_ALT_ADDRESS |
- IB_QP_ATTRIBUTE_ALT_PKEY_INDEX |
- IB_QP_ATTRIBUTE_MIGRATION_STATE;
+ attr_mask |=
+ IB_QP_ALT_PATH |
+ IB_QP_PATH_MIG_STATE;
/* We abuse packet life and put local ACK timeout there */
- qp_attr->alt_local_ack_timeout = connection->alternate_path.packet_life;
- qp_attr->alt_address.service_level = connection->alternate_path.sl;
- qp_attr->alt_address.dlid = connection->alternate_path.dlid;
- qp_attr->alt_address.source_path_bits = connection->alternate_path.slid & 0x7f;
- qp_attr->alt_address.static_rate = 0;
- qp_attr->alt_address.use_grh = 0;
- qp_attr->migration_state = IB_REARM;
+ qp_attr->alt_timeout = connection->alternate_path.packet_life;
+ qp_attr->alt_ah_attr.sl = connection->alternate_path.sl;
+ qp_attr->alt_ah_attr.dlid = connection->alternate_path.dlid;
+ qp_attr->alt_ah_attr.src_path_bits = connection->alternate_path.slid & 0x7f;
+ qp_attr->alt_ah_attr.static_rate = 0;
+ qp_attr->alt_ah_attr.grh_flag = 0;
+ qp_attr->path_mig_state = IB_MIG_REARM;
ib_cached_gid_find(connection->alternate_path.sgid, NULL, &qp_attr->alt_port, NULL);
/* XXX check return value: */
@@ -298,7 +294,7 @@
&qp_attr->alt_pkey_index);
}
- result = ib_cm_qp_modify(connection->local_qp, qp_attr);
+ result = ib_cm_qp_modify(connection->local_qp, qp_attr, attr_mask);
kfree(qp_attr);
tsKernelTimerRemove(&connection->timer);
@@ -311,18 +307,10 @@
int ib_cm_passive_param_store(struct ib_cm_connection *connection,
struct ib_cm_passive_param *param)
{
- int result;
+ connection->local_qp = param->qp;
+ connection->local_qpn = param->qp->qp_num;
- connection->local_qp = param->qp;
-
- result = ib_qp_query_qpn(param->qp, &connection->local_qpn);
- if (result) {
- TS_REPORT_WARN(MOD_IB_CM,
- "ib_qp_query_qpn failed (return %d)",
- result);
- }
-
- return result;
+ return 0;
}
static void ib_cm_service_store(struct ib_cm_service *service,
Index: src/linux-kernel/infiniband/core/cm_priv.h
===================================================================
--- src/linux-kernel/infiniband/core/cm_priv.h (revision 576)
+++ src/linux-kernel/infiniband/core/cm_priv.h (working copy)
@@ -121,14 +121,14 @@
struct ib_path_record alternate_path;
tTS_IB_PSN receive_psn;
tTS_IB_PSN send_psn;
- u8 retry_count;
- u8 rnr_retry_count;
- u8 responder_resources;
- u8 initiator_depth;
+ u8 retry_count;
+ u8 rnr_retry_count;
+ u8 responder_resources;
+ u8 initiator_depth;
struct ib_device *local_cm_device;
tTS_IB_PORT local_cm_port;
- int local_cm_pkey_index;
+ u16 local_cm_pkey_index;
u16 remote_cm_lid;
u32 remote_cm_qpn;
u16 alternate_remote_cm_lid;
@@ -174,10 +174,13 @@
tTS_IB_CM_COMM_ID comm_id;
};
-static inline int ib_cm_qp_modify(struct ib_qp *qp,
- struct ib_qp_attribute *attr)
+static inline int ib_cm_qp_modify(struct ib_qp *qp,
+ struct ib_qp_attr *attr,
+ int attr_mask)
{
- return qp ? ib_qp_modify(qp, attr) : 0;
+ struct ib_qp_cap qp_cap;
+
+ return qp ? ib_modify_qp(qp, attr, attr_mask, &qp_cap) : 0;
}
int ib_cm_timeout_to_jiffies(int timeout);
Index: src/linux-kernel/infiniband/core/dm_client_iou_info.c
===================================================================
--- src/linux-kernel/infiniband/core/dm_client_iou_info.c (revision 576)
+++ src/linux-kernel/infiniband/core/dm_client_iou_info.c (working copy)
@@ -141,7 +141,7 @@
return -ENOMEM;
}
- ib_dm_client_mad_init(&mad, device, port, dst_port_lid, IB_GSI_QP,
+ ib_dm_client_mad_init(&mad, device, port, dst_port_lid, 1,
TS_IB_DM_METHOD_GET, TS_IB_DM_ATTRIBUTE_IOU_INFO,
0);
Index: src/linux-kernel/infiniband/core/mad_main.c
===================================================================
--- src/linux-kernel/infiniband/core/mad_main.c (revision 576)
+++ src/linux-kernel/infiniband/core/mad_main.c (working copy)
@@ -58,7 +58,7 @@
};
*mr = ib_reg_phys_mr(pd, &buffer_list, 1, /* list_len */
- IB_MR_LOCAL_WRITE, &iova);
+ IB_ACCESS_LOCAL_WRITE, &iova);
if (IS_ERR(*mr)) {
TS_REPORT_WARN(MOD_KERNEL_IB,
"ib_reg_phys_mr failed "
@@ -77,7 +77,9 @@
u32 qpn)
{
struct ib_mad_private *priv = device->mad;
- struct ib_qp_attribute qp_attr;
+ struct ib_qp_attr qp_attr;
+ struct ib_qp_cap qp_cap;
+ int attr_mask;
int ret;
TS_TRACE(MOD_KERNEL_IB, T_VERY_VERBOSE, TRACE_KERNEL_IB_GEN,
@@ -85,74 +87,69 @@
port, qpn, device->name);
{
- struct ib_qp_create_param param = { { 0 } };
+ struct ib_qp_init_attr init_attr = {
+ .send_cq = priv->cq,
+ .recv_cq = priv->cq,
+ .cap = {
+ .max_send_wr = IB_MAD_SENDS_PER_QP,
+ .max_recv_wr = IB_MAD_RECEIVES_PER_QP,
+ .max_send_sge = 1,
+ .max_recv_sge = 1
+ },
+ .sq_sig_type = IB_SIGNAL_ALL_WR,
+ .rq_sig_type = IB_SIGNAL_ALL_WR,
+ .qp_type = qpn == 0 ? IB_QPT_SMI : IB_QPT_GSI,
+ .port_num = port
+ };
+ struct ib_qp_cap qp_cap;
- param.limit.max_outstanding_send_request = IB_MAD_SENDS_PER_QP;
- param.limit.max_outstanding_receive_request = IB_MAD_RECEIVES_PER_QP;
- param.limit.max_send_gather_element = 1;
- param.limit.max_receive_scatter_element = 1;
-
- param.pd = priv->pd;
- param.send_queue = priv->cq;
- param.receive_queue = priv->cq;
- param.send_policy = IB_WQ_SIGNAL_ALL;
- param.receive_policy = IB_WQ_SIGNAL_ALL;
- param.transport = IB_TRANSPORT_UD;
-
- ret = ib_special_qp_create(¶m,
- port,
- qpn == 0 ? IB_SMI_QP : IB_GSI_QP,
- &priv->qp[port][qpn]);
- if (ret) {
+ priv->qp[port][qpn] = ib_create_qp(priv->pd, &init_attr, &qp_cap);
+ if (IS_ERR(priv->qp[port][qpn])) {
TS_REPORT_FATAL(MOD_KERNEL_IB,
"ib_special_qp_create failed for %s port %d QPN %d (%d)",
- device->name, port, qpn, ret);
- return ret;
+ device->name, port, qpn,
+ PTR_ERR(priv->qp[port][qpn]));
+ return PTR_ERR(priv->qp[port][qpn]);
}
}
- qp_attr.state = IB_QP_STATE_INIT;
- qp_attr.qkey = qpn == 0 ? 0 : IB_GSI_WELL_KNOWN_QKEY;
+ qp_attr.qp_state = IB_QPS_INIT;
+ qp_attr.qkey = qpn == 0 ? 0 : IB_GSI_WELL_KNOWN_QKEY;
/* P_Key index is really irrelevant for QP0/QP1, but we have to set
some value for RESET->INIT transition. */
qp_attr.pkey_index = 0;
- qp_attr.valid_fields =
- IB_QP_ATTRIBUTE_STATE |
- IB_QP_ATTRIBUTE_QKEY |
- IB_QP_ATTRIBUTE_PKEY_INDEX;
+ attr_mask =
+ IB_QP_STATE |
+ IB_QP_QKEY |
+ IB_QP_PKEY_INDEX;
- /* This is not required, according to the IB spec, but do it until
- the Tavor driver is fixed: */
- qp_attr.port = port;
- qp_attr.valid_fields |= IB_QP_ATTRIBUTE_PORT;
-
- ret = ib_qp_modify(priv->qp[port][qpn], &qp_attr);
+ ret = ib_modify_qp(priv->qp[port][qpn], &qp_attr, attr_mask, &qp_cap);
if (ret) {
TS_REPORT_FATAL(MOD_KERNEL_IB,
- "ib_qp_modify -> INIT failed for %s port %d QPN %d (%d)",
+ "ib_modify_qp -> INIT failed for %s port %d QPN %d (%d)",
device->name, port, qpn, ret);
return ret;
}
- qp_attr.state = IB_QP_STATE_RTR;
- qp_attr.valid_fields = IB_QP_ATTRIBUTE_STATE;
- ret = ib_qp_modify(priv->qp[port][qpn], &qp_attr);
+ qp_attr.qp_state = IB_QPS_RTR;
+ attr_mask = IB_QP_STATE;
+ ret = ib_modify_qp(priv->qp[port][qpn], &qp_attr, attr_mask, &qp_cap);
if (ret) {
TS_REPORT_FATAL(MOD_KERNEL_IB,
- "ib_qp_modify -> RTR failed for %s port %d QPN %d (%d)",
+ "ib_modify_qp -> RTR failed for %s port %d QPN %d (%d)",
device->name, port, qpn, ret);
return ret;
}
- qp_attr.state = IB_QP_STATE_RTS;
- qp_attr.send_psn = 0;
- qp_attr.valid_fields =
- IB_QP_ATTRIBUTE_STATE |
- IB_QP_ATTRIBUTE_SEND_PSN;
- ret = ib_qp_modify(priv->qp[port][qpn], &qp_attr);
+ qp_attr.qp_state = IB_QPS_RTS;
+ qp_attr.sq_psn = 0;
+ attr_mask =
+ IB_QP_STATE |
+ IB_QP_SQ_PSN;
+ ret = ib_modify_qp(priv->qp[port][qpn], &qp_attr, attr_mask, &qp_cap);
if (ret) {
TS_REPORT_FATAL(MOD_KERNEL_IB,
- "ib_qp_modify -> RTS failed for %s port %d QPN %d (%d)",
+ "ib_modify_qp -> RTS failed for %s port %d QPN %d (%d)",
device->name, port, qpn, ret);
return ret;
}
@@ -283,7 +280,7 @@
for (p = 0; p <= IB_MAD_MAX_PORTS_PER_DEVICE; ++p) {
for (q = 0; q <= 1; ++q) {
if (priv->qp[p][q]) {
- ib_qp_destroy(priv->qp[p][q]);
+ ib_destroy_qp(priv->qp[p][q]);
for (i = 0; i < IB_MAD_RECEIVES_PER_QP; ++i) {
if (priv->receive_buf[p][q][i].buf)
pci_unmap_single(priv->ib_dev->dma_device,
@@ -324,7 +321,7 @@
for (p = 0; p <= IB_MAD_MAX_PORTS_PER_DEVICE; ++p) {
for (q = 0; q <= 1; ++q) {
if (priv->qp[p][q]) {
- ib_qp_destroy(priv->qp[p][q]);
+ ib_destroy_qp(priv->qp[p][q]);
for (i = 0; i < IB_MAD_RECEIVES_PER_QP; ++i) {
if (priv->receive_buf[p][q][i].buf)
Index: src/linux-kernel/infiniband/core/dm_client_query.c
===================================================================
--- src/linux-kernel/infiniband/core/dm_client_query.c (revision 576)
+++ src/linux-kernel/infiniband/core/dm_client_query.c (working copy)
@@ -53,7 +53,7 @@
packet->slid = 0xffff;
packet->dlid = dst_lid;
packet->sl = 0;
- packet->sqpn = IB_GSI_QP;
+ packet->sqpn = 1;
packet->dqpn = dst_qpn;
packet->r_method = r_method;
packet->attribute_id = cpu_to_be16(attribute_id);
Index: src/linux-kernel/infiniband/core/sa_client_query.c
===================================================================
--- src/linux-kernel/infiniband/core/sa_client_query.c (revision 576)
+++ src/linux-kernel/infiniband/core/sa_client_query.c (working copy)
@@ -56,8 +56,8 @@
packet->slid = 0xffff;
packet->dlid = sm_path.sm_lid;
packet->sl = sm_path.sm_sl;
- packet->sqpn = IB_GSI_QP;
- packet->dqpn = IB_GSI_QP;
+ packet->sqpn = 1;
+ packet->dqpn = 1;
packet->has_grh = 0;
packet->completion_func = NULL;
Index: src/linux-kernel/infiniband/core/cm_active.c
===================================================================
--- src/linux-kernel/infiniband/core/cm_active.c (revision 576)
+++ src/linux-kernel/infiniband/core/cm_active.c (working copy)
@@ -150,7 +150,7 @@
connection->mad.device = connection->local_cm_device;
connection->mad.port = connection->local_cm_port;
connection->mad.pkey_index = connection->local_cm_pkey_index;
- connection->mad.sqpn = IB_GSI_QP;
+ connection->mad.sqpn = 1;
connection->mad.dlid = connection->remote_cm_lid;
connection->mad.dqpn = connection->remote_cm_qpn;
@@ -225,12 +225,13 @@
int ib_cm_rtu_send(struct ib_cm_connection *connection)
{
int result = 0;
- struct ib_qp_attribute *qp_attr;
+ struct ib_qp_attr *qp_attr;
+ int attr_mask;
if (!connection)
return -EINVAL;
- qp_attr = kmalloc(sizeof(struct ib_qp_attribute), GFP_KERNEL);
+ qp_attr = kmalloc(sizeof *qp_attr, GFP_KERNEL);
if (!qp_attr)
return -ENOMEM;
@@ -245,7 +246,7 @@
connection->mad.device = connection->local_cm_device;
connection->mad.port = connection->local_cm_port;
connection->mad.pkey_index = connection->local_cm_pkey_index;
- connection->mad.sqpn = IB_GSI_QP;
+ connection->mad.sqpn = 1;
connection->mad.dlid = connection->remote_cm_lid;
connection->mad.dqpn = connection->remote_cm_qpn;
@@ -261,36 +262,34 @@
"Sent RTU");
/* move connection to established. */
- qp_attr->state = IB_QP_STATE_RTS;
- qp_attr->send_psn = connection->send_psn;
- qp_attr->initiator_depth = connection->initiator_depth;
- qp_attr->retry_count = connection->retry_count;
- qp_attr->rnr_retry_count = connection->rnr_retry_count;
+ qp_attr->qp_state = IB_QPS_RTS;
+ qp_attr->sq_psn = connection->send_psn;
+ qp_attr->max_rd_atomic = connection->initiator_depth;
+ qp_attr->retry_cnt = connection->retry_count;
+ qp_attr->rnr_retry = connection->rnr_retry_count;
/* XXX need to include CA ACK delay */
- qp_attr->local_ack_timeout = min(31, connection->primary_path.packet_life + 1);
+ qp_attr->timeout = min(31, connection->primary_path.packet_life + 1);
- qp_attr->valid_fields =
- IB_QP_ATTRIBUTE_STATE |
- IB_QP_ATTRIBUTE_SEND_PSN |
- IB_QP_ATTRIBUTE_INITIATOR_DEPTH |
- IB_QP_ATTRIBUTE_RETRY_COUNT |
- IB_QP_ATTRIBUTE_RNR_RETRY_COUNT |
- IB_QP_ATTRIBUTE_LOCAL_ACK_TIMEOUT;
+ attr_mask =
+ IB_QP_STATE |
+ IB_QP_SQ_PSN |
+ IB_QP_MAX_QP_RD_ATOMIC |
+ IB_QP_RETRY_CNT |
+ IB_QP_RNR_RETRY |
+ IB_QP_TIMEOUT;
if (connection->alternate_path.dlid) {
- qp_attr->valid_fields |=
- IB_QP_ATTRIBUTE_ALT_PORT |
- IB_QP_ATTRIBUTE_ALT_ADDRESS |
- IB_QP_ATTRIBUTE_ALT_PKEY_INDEX |
- IB_QP_ATTRIBUTE_MIGRATION_STATE;
+ attr_mask |=
+ IB_QP_ALT_PATH |
+ IB_QP_PATH_MIG_STATE;
/* XXX need to include CA ACK delay */
- qp_attr->alt_local_ack_timeout = min(31, connection->alternate_path.packet_life + 1);
- qp_attr->alt_address.service_level = connection->alternate_path.sl;
- qp_attr->alt_address.dlid = connection->alternate_path.dlid;
- qp_attr->alt_address.source_path_bits = connection->alternate_path.slid & 0x7f;
- qp_attr->alt_address.static_rate = 0;
- qp_attr->alt_address.use_grh = 0;
- qp_attr->migration_state = IB_REARM;
+ qp_attr->alt_timeout = min(31, connection->alternate_path.packet_life + 1);
+ qp_attr->alt_ah_attr.sl = connection->alternate_path.sl;
+ qp_attr->alt_ah_attr.dlid = connection->alternate_path.dlid;
+ qp_attr->alt_ah_attr.src_path_bits = connection->alternate_path.slid & 0x7f;
+ qp_attr->alt_ah_attr.static_rate = 0;
+ qp_attr->alt_ah_attr.grh_flag = 0;
+ qp_attr->path_mig_state = IB_MIG_REARM;
ib_cached_gid_find(connection->alternate_path.sgid, NULL,
&qp_attr->alt_port, NULL);
@@ -299,7 +298,7 @@
connection->alternate_path.pkey,
&qp_attr->alt_pkey_index);
}
- result = ib_cm_qp_modify(connection->local_qp, qp_attr);
+ result = ib_cm_qp_modify(connection->local_qp, qp_attr, attr_mask);
if (result) {
TS_REPORT_WARN(MOD_IB_CM, "ib_qp_modify to RTS failed");
goto free;
@@ -344,7 +343,8 @@
void ib_cm_rep_handler(struct ib_mad *packet)
{
struct ib_cm_connection *connection;
- struct ib_qp_attribute *qp_attr;
+ struct ib_qp_attr *qp_attr;
+ int attr_mask;
tTS_IB_CM_REJ_REASON rej_reason;
int result;
@@ -392,7 +392,7 @@
goto out;
}
- qp_attr = kmalloc(sizeof(struct ib_qp_attribute), GFP_KERNEL);
+ qp_attr = kmalloc(sizeof *qp_attr, GFP_KERNEL);
if (!qp_attr) {
rej_reason = TS_IB_REJ_NO_RESOURCES;
goto reject;
@@ -406,30 +406,30 @@
connection->remote_comm_id = ib_cm_rep_local_comm_id_get(packet);
connection->send_psn = ib_cm_rep_starting_psn_get(packet);
- memset(qp_attr, 0, sizeof(struct ib_qp_attribute));
+ memset(qp_attr, 0, sizeof *qp_attr);
- qp_attr->state = IB_QP_STATE_RTR;
- qp_attr->receive_psn = connection->receive_psn;
- qp_attr->destination_qpn = connection->remote_qpn;
- qp_attr->responder_resources = connection->responder_resources;
- qp_attr->rnr_timeout = IB_RNR_TIMER_122_88; /* XXX settable? */
+ qp_attr->qp_state = IB_QPS_RTR;
+ qp_attr->rq_psn = connection->receive_psn;
+ qp_attr->dest_qp_num = connection->remote_qpn;
+ qp_attr->max_dest_rd_atomic = connection->responder_resources;
+ qp_attr->min_rnr_timer = IB_RNR_TIMER_122_88; /* XXX settable? */
qp_attr->path_mtu = connection->primary_path.mtu;
- qp_attr->address.service_level = connection->primary_path.sl;
- qp_attr->address.dlid = connection->primary_path.dlid;
- qp_attr->address.source_path_bits = connection->primary_path.slid & 0x7f;
- qp_attr->address.static_rate = 0;
- qp_attr->address.use_grh = 0;
+ qp_attr->ah_attr.sl = connection->primary_path.sl;
+ qp_attr->ah_attr.dlid = connection->primary_path.dlid;
+ qp_attr->ah_attr.src_path_bits = connection->primary_path.slid & 0x7f;
+ qp_attr->ah_attr.static_rate = 0;
+ qp_attr->ah_attr.grh_flag = 0;
- qp_attr->valid_fields =
- IB_QP_ATTRIBUTE_STATE |
- IB_QP_ATTRIBUTE_RECEIVE_PSN |
- IB_QP_ATTRIBUTE_DESTINATION_QPN |
- IB_QP_ATTRIBUTE_RESPONDER_RESOURCES |
- IB_QP_ATTRIBUTE_RNR_TIMEOUT |
- IB_QP_ATTRIBUTE_PATH_MTU |
- IB_QP_ATTRIBUTE_ADDRESS;
+ attr_mask =
+ IB_QP_STATE |
+ IB_QP_RQ_PSN |
+ IB_QP_DEST_QPN |
+ IB_QP_MAX_DEST_RD_ATOMIC |
+ IB_QP_MIN_RNR_TIMER |
+ IB_QP_PATH_MTU |
+ IB_QP_AV;
- result = ib_cm_qp_modify(connection->local_qp, qp_attr);
+ result = ib_cm_qp_modify(connection->local_qp, qp_attr, attr_mask);
if (result) {
TS_REPORT_WARN(MOD_IB_CM, "ib_qp_modify to RTR failed. <%d>", result);
kfree(qp_attr);
Index: src/linux-kernel/infiniband/include/ts_ib_cm_types.h
===================================================================
--- src/linux-kernel/infiniband/include/ts_ib_cm_types.h (revision 576)
+++ src/linux-kernel/infiniband/include/ts_ib_cm_types.h (working copy)
@@ -31,11 +31,6 @@
# include <stddef.h> /* for size_t */
#endif
-/* Visual C++ apparently can't handle empty structs. */
-#if !defined(EMPTY_STRUCT)
-# define EMPTY_STRUCT
-#endif
-
#include <ib_verbs.h>
typedef uint32_t tTS_IB_CM_COMM_ID;
@@ -45,6 +40,13 @@
#define TS_IB_CM_COMM_ID_INVALID 0
#define TS_IB_CM_SERVICE_EXACT_MASK 0xffffffffffffffffULL
+enum ib_transport {
+ IB_TRANSPORT_RC = 0,
+ IB_TRANSPORT_UC = 1,
+ IB_TRANSPORT_RD = 2,
+ IB_TRANSPORT_UD = 3,
+};
+
typedef enum {
TS_IB_CM_CALLBACK_PROCEED,
TS_IB_CM_CALLBACK_DEFER,
@@ -192,9 +194,7 @@
void *apr_info;
};
-struct ib_cm_established_param {
- EMPTY_STRUCT
-};
+struct ib_cm_established_param { };
struct ib_cm_disconnected_param {
tTS_IB_CM_DISCONNECTED_REASON reason;
More information about the general
mailing list