summaryrefslogtreecommitdiffstats
path: root/src/net/infiniband
diff options
context:
space:
mode:
authorMichael Brown2016-03-04 13:24:22 +0100
committerMichael Brown2016-03-08 13:08:58 +0100
commitbd1687465c3c03b51179bd3732356a55b9766061 (patch)
tree6d2c82346e2f5b60401e731cd32f9242559949ec /src/net/infiniband
parent[infiniband] Use connection's local ID as debug message identifier (diff)
downloadipxe-bd1687465c3c03b51179bd3732356a55b9766061.tar.gz
ipxe-bd1687465c3c03b51179bd3732356a55b9766061.tar.xz
ipxe-bd1687465c3c03b51179bd3732356a55b9766061.zip
[infiniband] Use correct transaction identifier in CM responses
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/net/infiniband')
-rw-r--r--src/net/infiniband/ib_cm.c14
-rw-r--r--src/net/infiniband/ib_mi.c26
2 files changed, 24 insertions, 16 deletions
diff --git a/src/net/infiniband/ib_cm.c b/src/net/infiniband/ib_cm.c
index 94293957..247b8e7a 100644
--- a/src/net/infiniband/ib_cm.c
+++ b/src/net/infiniband/ib_cm.c
@@ -65,6 +65,7 @@ static struct ib_connection * ib_cm_find ( uint32_t local_id ) {
*
* @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
@@ -72,6 +73,7 @@ static struct ib_connection * ib_cm_find ( uint32_t local_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;
@@ -83,6 +85,7 @@ static int ib_cm_send_rtu ( struct ib_device *ibdev,
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 );
@@ -121,7 +124,8 @@ static void ib_cm_recv_rep ( struct ib_device *ibdev,
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 */
}
@@ -135,6 +139,7 @@ static void ib_cm_recv_rep ( struct ib_device *ibdev,
*
* @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
@@ -142,6 +147,7 @@ static void ib_cm_recv_rep ( struct ib_device *ibdev,
*/
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;
@@ -153,6 +159,7 @@ static int ib_cm_send_drep ( struct ib_device *ibdev,
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 );
@@ -197,7 +204,7 @@ static void ib_cm_recv_dreq ( struct ib_device *ibdev,
}
/* 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 */
}
@@ -294,7 +301,8 @@ static void ib_cm_req_complete ( struct ib_device *ibdev,
}
/* 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;
diff --git a/src/net/infiniband/ib_mi.c b/src/net/infiniband/ib_mi.c
index b4321297..f9c0862b 100644
--- a/src/net/infiniband/ib_mi.c
+++ b/src/net/infiniband/ib_mi.c
@@ -106,7 +106,7 @@ static int ib_mi_handle ( struct ib_device *ibdev,
/* 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;
}
@@ -152,7 +152,7 @@ static void ib_mi_complete_recv ( struct ib_device *ibdev,
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 ) );
@@ -192,12 +192,12 @@ int ib_mi_send ( struct ib_device *ibdev, struct ib_mad_interface *mi,
/* 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 ) );
@@ -217,8 +217,8 @@ int ib_mi_send ( struct ib_device *ibdev, struct ib_mad_interface *mi,
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;
}
}
@@ -228,7 +228,7 @@ int ib_mi_send ( struct ib_device *ibdev, struct ib_mad_interface *mi,
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 ) );
@@ -236,7 +236,7 @@ int ib_mi_send ( struct ib_device *ibdev, struct ib_mad_interface *mi,
/* 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;
@@ -261,7 +261,7 @@ static void ib_mi_timer_expired ( struct retry_timer *timer, int expired ) {
/* 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;
}
@@ -408,8 +408,8 @@ void ib_destroy_mi ( struct ib_device *ibdev, struct ib_mad_interface *mi ) {
/* 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 );
}