[openib-general] Re: [PATCH] [kdapl CM] Fix endian conversions of service ID

Hal Rosenstock halr at voltaire.com
Tue May 24 12:26:54 PDT 2005


On Tue, 2005-05-24 at 15:20, James Lentini wrote:
> 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 ...

I think the convention OpenIB has been using is to supply parameters in
CPU endian but it can work either way.

> 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?





More information about the general mailing list