[openib-general] Re: [PATCH] [kdapl CM] Fix endian conversions of service ID
James Lentini
jlentini at netapp.com
Tue May 24 12:20:49 PDT 2005
halr> [kdapl CM] Fix endian conversions of service ID
halr> Problem pointed out by James Lentini
halr>
halr> Signed-off-by: Hal Rosenstock <halr at voltaire.com>
halr>
halr> Index: dapl_openib_cm.c
halr> ===================================================================
halr> -- dapl_openib_cm.c (revision 2468)
halr> +++ dapl_openib_cm.c (working copy)
halr> @@ -309,7 +309,7 @@
halr> if (conn->dapl_path.mtu > IB_MTU_1024)
halr> conn->dapl_path.mtu = IB_MTU_1024;
halr>
halr> - conn->param.service_id = be64_to_cpu(conn->service_id);
halr> + conn->param.service_id = conn->service_id;
With the change to dapl_ib_connect below, the conn->service_id is in
CPU byte order at this point. The conn->param is a ib_cm_req_param
structure. The comment describing this structure's service_id field
says that it should be in network (big endian) byte order.
So...
halr> conn->param.primary_path = &conn->dapl_path;
halr> conn->param.alternate_path = NULL;
halr>
halr> @@ -445,8 +445,7 @@
halr> conn->param.local_cm_response_timeout =
halr> DAPL_OPENIB_CM_RESPONSE_TIMEOUT;
halr> conn->param.max_cm_retries = DAPL_OPENIB_MAX_CM_RETRIES;
halr>
halr> - memcpy(&conn->service_id, &remote_conn_qual, sizeof
halr> conn->service_id);
halr> -
halr> + conn->service_id = be64_to_cpu(remote_conn_qual);
...that makes me think we should change the line above to
conn->service_id = remote_conn_qual;
and require that consumer's specify their connection qualifier values
in network byte order here and ...
halr> conn->remote_ia_address = remote_ia_address;
halr> conn->dapl_comp.fn = &dapl_rt_comp_handler;
halr> conn->dapl_comp.context = conn;
halr> @@ -627,7 +626,7 @@
halr> }
halr>
halr> status = ib_cm_listen(sp_ptr->cm_srvc_handle,
halr> - be64_to_cpu(sp_ptr->conn_qual), 0);
halr> + cpu_to_be64(sp_ptr->conn_qual), 0);
... do the same here. What do you think?
halr> if (status) {
halr> ib_destroy_cm_id(sp_ptr->cm_srvc_handle);
halr> sp_ptr->cm_srvc_handle = NULL;
halr>
halr>
halr>
More information about the general
mailing list