*
* @v ibdev Infiniband device
* @v mi Management interface
+ * @v tid Transaction identifier
* @v av Address vector
* @v local_id Local communication ID
* @v remote_id Remote communication ID
*/
static int ib_cm_send_rtu ( struct ib_device *ibdev,
struct ib_mad_interface *mi,
+ struct ib_mad_tid *tid,
struct ib_address_vector *av,
uint32_t local_id, uint32_t remote_id ) {
union ib_mad mad;
mad.hdr.mgmt_class = IB_MGMT_CLASS_CM;
mad.hdr.class_version = IB_CM_CLASS_VERSION;
mad.hdr.method = IB_MGMT_METHOD_SEND;
+ memcpy ( &mad.hdr.tid, tid, sizeof ( mad.hdr.tid ) );
mad.hdr.attr_id = htons ( IB_CM_ATTR_READY_TO_USE );
rtu->local_id = htonl ( local_id );
rtu->remote_id = htonl ( remote_id );
conn = ib_cm_find ( local_id );
if ( conn ) {
/* Try to send "ready to use" reply */
- if ( ( rc = ib_cm_send_rtu ( ibdev, mi, av, conn->local_id,
+ if ( ( rc = ib_cm_send_rtu ( ibdev, mi, &mad->hdr.tid, av,
+ conn->local_id,
conn->remote_id ) ) != 0 ) {
/* Ignore errors; the remote end will retry */
}
*
* @v ibdev Infiniband device
* @v mi Management interface
+ * @v tid Transaction identifier
* @v av Address vector
* @v local_id Local communication ID
* @v remote_id Remote communication ID
*/
static int ib_cm_send_drep ( struct ib_device *ibdev,
struct ib_mad_interface *mi,
+ struct ib_mad_tid *tid,
struct ib_address_vector *av,
uint32_t local_id, uint32_t remote_id ) {
union ib_mad mad;
mad.hdr.mgmt_class = IB_MGMT_CLASS_CM;
mad.hdr.class_version = IB_CM_CLASS_VERSION;
mad.hdr.method = IB_MGMT_METHOD_SEND;
+ memcpy ( &mad.hdr.tid, tid, sizeof ( mad.hdr.tid ) );
mad.hdr.attr_id = htons ( IB_CM_ATTR_DISCONNECT_REPLY );
drep->local_id = htonl ( local_id );
drep->remote_id = htonl ( remote_id );
}
/* Send reply */
- if ( ( rc = ib_cm_send_drep ( ibdev, mi, av, local_id,
+ if ( ( rc = ib_cm_send_drep ( ibdev, mi, &mad->hdr.tid, av, local_id,
remote_id ) ) != 0 ) {
/* Ignore errors; the remote end will retry */
}
}
/* Send "ready to use" reply */
- if ( ( rc = ib_cm_send_rtu ( ibdev, mi, av, conn->local_id,
+ if ( ( rc = ib_cm_send_rtu ( ibdev, mi, &mad->hdr.tid, av,
+ conn->local_id,
conn->remote_id ) ) != 0 ) {
/* Treat as non-fatal */
rc = 0;
/* Otherwise, ignore it */
DBGC ( mi, "MI %p RX TID %08x%08x ignored\n",
- mi, ntohl ( hdr->tid[0] ), ntohl ( hdr->tid[1] ) );
+ mi, ntohl ( hdr->tid.high ), ntohl ( hdr->tid.low ) );
return -ENOTSUP;
}
goto out;
}
DBGC ( mi, "MI %p RX TID %08x%08x (%02x,%02x,%02x,%04x) status "
- "%04x\n", mi, ntohl ( hdr->tid[0] ), ntohl ( hdr->tid[1] ),
+ "%04x\n", mi, ntohl ( hdr->tid.high ), ntohl ( hdr->tid.low ),
hdr->mgmt_class, hdr->class_version, hdr->method,
ntohs ( hdr->attr_id ), ntohs ( hdr->status ) );
DBGC2_HDA ( mi, 0, mad, sizeof ( *mad ) );
/* Set common fields */
hdr->base_version = IB_MGMT_BASE_VERSION;
- if ( ( hdr->tid[0] == 0 ) && ( hdr->tid[1] == 0 ) ) {
- hdr->tid[0] = htonl ( IB_MI_TID_MAGIC );
- hdr->tid[1] = htonl ( ++next_tid );
+ if ( ( hdr->tid.high == 0 ) && ( hdr->tid.low == 0 ) ) {
+ hdr->tid.high = htonl ( IB_MI_TID_MAGIC );
+ hdr->tid.low = htonl ( ++next_tid );
}
DBGC ( mi, "MI %p TX TID %08x%08x (%02x,%02x,%02x,%04x) status "
- "%04x\n", mi, ntohl ( hdr->tid[0] ), ntohl ( hdr->tid[1] ),
+ "%04x\n", mi, ntohl ( hdr->tid.high ), ntohl ( hdr->tid.low ),
hdr->mgmt_class, hdr->class_version, hdr->method,
ntohs ( hdr->attr_id ), ntohs ( hdr->status ) );
DBGC2_HDA ( mi, 0, mad, sizeof ( *mad ) );
smp->return_path.hops[hop_pointer] = ibdev->port;
} else {
DBGC ( mi, "MI %p TX TID %08x%08x invalid hop pointer "
- "%d\n", mi, ntohl ( hdr->tid[0] ),
- ntohl ( hdr->tid[1] ), hop_pointer );
+ "%d\n", mi, ntohl ( hdr->tid.high ),
+ ntohl ( hdr->tid.low ), hop_pointer );
return -EINVAL;
}
}
if ( ! iobuf ) {
DBGC ( mi, "MI %p could not allocate buffer for TID "
"%08x%08x\n",
- mi, ntohl ( hdr->tid[0] ), ntohl ( hdr->tid[1] ) );
+ mi, ntohl ( hdr->tid.high ), ntohl ( hdr->tid.low ) );
return -ENOMEM;
}
memcpy ( iob_put ( iobuf, sizeof ( *mad ) ), mad, sizeof ( *mad ) );
/* Send I/O buffer */
if ( ( rc = ib_post_send ( ibdev, mi->qp, av, iobuf ) ) != 0 ) {
DBGC ( mi, "MI %p TX TID %08x%08x failed: %s\n",
- mi, ntohl ( hdr->tid[0] ), ntohl ( hdr->tid[1] ),
+ mi, ntohl ( hdr->tid.high ), ntohl ( hdr->tid.low ),
strerror ( rc ) );
free_iob ( iobuf );
return rc;
/* Abandon transaction if we have tried too many times */
if ( expired ) {
DBGC ( mi, "MI %p abandoning TID %08x%08x\n",
- mi, ntohl ( hdr->tid[0] ), ntohl ( hdr->tid[1] ) );
+ mi, ntohl ( hdr->tid.high ), ntohl ( hdr->tid.low ) );
madx->op->complete ( ibdev, mi, madx, -ETIMEDOUT, NULL, NULL );
return;
}
/* Flush any outstanding requests */
list_for_each_entry_safe ( madx, tmp, &mi->madx, list ) {
DBGC ( mi, "MI %p destroyed while TID %08x%08x in progress\n",
- mi, ntohl ( madx->mad.hdr.tid[0] ),
- ntohl ( madx->mad.hdr.tid[1] ) );
+ mi, ntohl ( madx->mad.hdr.tid.high ),
+ ntohl ( madx->mad.hdr.tid.low ) );
madx->op->complete ( ibdev, mi, madx, -ECANCELED, NULL, NULL );
}