Skip to contentSkip to conversation

acm.c: Fix endian of transaction ID

PATCH In review Hal Rosenstock 2 participants 3 messages Aug 6, 2013 – Aug 7, 2013 2 messages not in the archive InfiniBand

lore
Share & tools
lore
#0 lore raw

PATCH 4/8 acm.c: Fix endian of transaction ID

It should be in network rather than host endian.

---
 src/acm.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
src/acm.c +3 -3
index 7de5873..d68746b 100644
@@ -839,7 +839,7 @@ static void acm_init_path_query(struct ib_sa_mad *mad)
 	mad->mgmt_class = IB_MGMT_CLASS_SA;
 	mad->class_version = 2;
 	mad->method = IB_METHOD_GET;
-	mad->tid = (uint64_t) atomic_inc(&tid);
+	mad->tid = htonll((uint64_t) atomic_inc(&tid));
 	mad->attr_id = IB_SA_ATTR_PATH_REC;
 }
 
@@ -1483,7 +1483,7 @@ static void acm_init_join(struct ib_sa_mad *mad, union ibv_gid *port_gid,
 	mad->mgmt_class = IB_MGMT_CLASS_SA;
 	mad->class_version = 2;
 	mad->method = IB_METHOD_SET;
-	mad->tid = (uint64_t) atomic_inc(&tid);
+	mad->tid = htonll((uint64_t) atomic_inc(&tid));
 	mad->attr_id = IB_SA_ATTR_MC_MEMBER_REC;
 	mad->comp_mask =
 		IB_COMP_MASK_MC_MGID | IB_COMP_MASK_MC_PORT_GID |
@@ -1953,7 +1953,7 @@ acm_send_resolve(struct acm_ep *ep, struct acm_dest *dest,
 	mad->class_version = 1;
 	mad->method = IB_METHOD_GET;
 	mad->control = ACM_CTRL_RESOLVE;
-	mad->tid = (uint64_t) atomic_inc(&tid);
+	mad->tid = htonll((uint64_t) atomic_inc(&tid));
 
 	rec = (struct acm_resolve_rec *) mad->data;
 	rec->src_type = (uint8_t) saddr->type;
Signature · 6 lines
1.7.8.2

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 5200E1D8.1090005-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org

#2 lore raw
Quoted 1 line

It should be in network rather than host endian.

The TID is basically an abstract 64-bit handle. I don't see that it matters what value is used, provided that the sender use it consistently. --
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 1828884A29C6694DAF28B7E6B8A8237388CA48A7-P5GAC/[email protected]

#4 lore raw
Quoted 4 lines · Sean
Quoted 1 line

It should be in network rather than host endian.

The TID is basically an abstract 64-bit handle. I don't see that it matters what value is used, provided that the sender use it consistently.

With little endian machines, the current code puts the TID in the high bits only to be overwritten by the agent ID so the TID is effectively 0. That being said, it works either way since currently there is only 1 outstanding query. It's a matter of better TID usage/correctness and debug when looking at OpenSM logs as to TIDs.

-- Hal

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html