[ofw] [PATCH] Cleanup XXX_PTR64 macros from WSD

Fab Tillier ftillier at windows.microsoft.com
Thu Jun 26 23:52:46 PDT 2008


This patch removes XXX_PTR64 and TO_ULONG_PTR macro use from WSD.

Signed-off-by: Fab Tillier <ftillier at microsoft.com>

Index: ulp/wsd/user/extensions.c
===================================================================
--- ulp/wsd/user/extensions.c   (revision 1300)
+++ ulp/wsd/user/extensions.c   (working copy)
@@ -1,6 +1,7 @@
 /*
  * Copyright (c) 2005 SilverStorm Technologies.  All rights reserved.
  * Copyright (c) 2006 Mellanox Technologies.  All rights reserved.
+ * Portions Copyright (c) 2008 Microsoft Corporation.  All rights reserved.
  *
  * This software is available to you under the OpenIB.org BSD license
  * below:
@@ -402,7 +403,7 @@

        /* Format the send work request and post. */
        send_wr.p_next = NULL;
-       send_wr.wr_id = (uint64_t)(void* VOID_PTR64)wr;
+       send_wr.wr_id = (ULONG_PTR)wr;
        send_wr.wr_type = wr_type;
        send_wr.send_opt = 0;
        send_wr.num_ds = dwBufferCount;
@@ -414,7 +415,7 @@
        lpOverlapped->InternalHigh = 0;
        for( ds_idx = 0; ds_idx < dwBufferCount; ds_idx++ )
        {
-               local_ds[ds_idx].vaddr = (uint64_t)(void* VOID_PTR64)lpBuffers[ds_idx].buf;
+               local_ds[ds_idx].vaddr = (ULONG_PTR)lpBuffers[ds_idx].buf;
                local_ds[ds_idx].length = lpBuffers[ds_idx].len;
                local_ds[ds_idx].lkey =
                        ((struct memory_node*)lpBuffers[ds_idx].handle)->p_reg1->lkey;
Index: ulp/wsd/user/ibspstruct.h
===================================================================
--- ulp/wsd/user/ibspstruct.h   (revision 1300)
+++ ulp/wsd/user/ibspstruct.h   (working copy)
@@ -1,5 +1,6 @@
 /*
  * Copyright (c) 2005 SilverStorm Technologies.  All rights reserved.
+ * Portions Copyright (c) 2008 Microsoft Corporation.  All rights reserved.
  *
  * This software is available to you under the OpenIB.org BSD license
  * below:
@@ -173,7 +174,7 @@
        /* Memory registration parameters, returned by ib_reg_mem. */
        uint32_t                lkey;
        uint32_t                rkey;
-TO_LONG_PTR(   ib_mr_handle_t ,        mr_handle) ;
+       ib_mr_handle_t  mr_handle;
 };


@@ -203,7 +204,7 @@
        cl_list_item_t          list_item;

        cl_waitobj_handle_t cq_waitobj;
-TO_LONG_PTR(   ib_cq_handle_t , cq) ;
+       ib_cq_handle_t cq;

        /* Number of qp's using this cq */
        atomic32_t qp_count;
@@ -248,7 +249,7 @@
                /* Listening socket */
                unsigned int backlog;   /* Maximum number of pending connections */
                cl_qlist_t list;        /* list of pending connections */
-TO_LONG_PTR(           ib_listen_handle_t , handle) ;
+               ib_listen_handle_t handle;
                struct listen_req_param listen_req_param;
        } listen;

@@ -264,12 +265,12 @@
        struct ibsp_socket_options socket_options;      /* Socket Options */

        /* Infiniband ressources */
-TO_LONG_PTR(   ib_pd_handle_t , hca_pd) ;              /* Copy of the HCA PD, for faster access. */
+       ib_pd_handle_t hca_pd;          /* Copy of the HCA PD, for faster access. */

        /* Pointer to completion queue and thread assigned to this socket */
        struct cq_thread_info *cq_tinfo;

-TO_LONG_PTR(   ib_qp_handle_t ,                qp) ;
+       ib_qp_handle_t          qp;
        uint32_t                        max_inline;

        /* State on the QP. This is only valid when the socket state is IBSP_CONNECTED.
@@ -394,9 +395,9 @@

        ib_net64_t guid;
        uint16_t        dev_id; /* Device ID to selectively cap MTU to 1K for Tavor. */
-TO_LONG_PTR(   ib_ca_handle_t , hca_handle) ;
+       ib_ca_handle_t hca_handle;

-TO_LONG_PTR(   ib_pd_handle_t , pd) ;
+       ib_pd_handle_t pd;

        /* Memory management */
        struct mr_list rdma_mem_list;   /* Regions registered through IBSPRegisterRdmaMemory */
@@ -430,9 +431,9 @@
        WSAPROTOCOL_INFOW protocol_info;

        /* Infiniband */
-TO_LONG_PTR(   ib_al_handle_t  , al_handle) ;
-TO_LONG_PTR(   ib_pnp_handle_t , pnp_handle_ca) ;
-TO_LONG_PTR(   ib_pnp_handle_t , pnp_handle_port) ;
+       ib_al_handle_t al_handle;
+       ib_pnp_handle_t pnp_handle_ca;
+       ib_pnp_handle_t pnp_handle_port;

        cl_qlist_t hca_list;
        cl_spinlock_t hca_mutex;
Index: ulp/wsd/user/ib_cm.c
===================================================================
--- ulp/wsd/user/ib_cm.c        (revision 1300)
+++ ulp/wsd/user/ib_cm.c        (working copy)
@@ -1,6 +1,7 @@
 /*
  * Copyright (c) 2005 SilverStorm Technologies.  All rights reserved.
  * Copyright (c) 2006 Mellanox Technologies.  All rights reserved.
+ * Portions Copyright (c) 2008 Microsoft Corporation.  All rights reserved.
  *
  * This software is available to you under the OpenIB.org BSD license
  * below:
@@ -113,7 +114,7 @@
        IN                              ib_cm_req_rec_t                         *p_cm_req_rec )
 {
        struct ibsp_socket_info *socket_info =
-               (struct ibsp_socket_info * VOID_PTR64)p_cm_req_rec->context;
+               (struct ibsp_socket_info *)p_cm_req_rec->context;
        struct listen_incoming *incoming;

        IBSP_ENTER( IBSP_DBG_CM );
@@ -208,7 +209,7 @@
        IN                              ib_cm_rep_rec_t                         *p_cm_rep_rec )
 {
        struct ibsp_socket_info *socket_info =
-               (struct ibsp_socket_info * VOID_PTR64)p_cm_rep_rec->qp_context;
+               (struct ibsp_socket_info *)p_cm_rep_rec->qp_context;
        ib_cm_rtu_t cm_rtu;
        ib_api_status_t status;

@@ -291,7 +292,7 @@
        IN                              ib_cm_rtu_rec_t                         *p_cm_rtu_rec )
 {
        struct ibsp_socket_info *socket_info =
-               (struct ibsp_socket_info * VOID_PTR64)p_cm_rtu_rec->qp_context;
+               (struct ibsp_socket_info *)p_cm_rtu_rec->qp_context;

        IBSP_ENTER( IBSP_DBG_CM );

@@ -336,7 +337,7 @@
                        wr = &socket_info->recv_wr[socket_info->recv_idx];

                        /* Update the work request ID. */
-                       wr->recv.wr_id = (uint64_t)(void* VOID_PTR64)wr;
+                       wr->recv.wr_id = (ULONG_PTR)wr;

                        /*
                         * Increment the count before posting so it doesn't go
@@ -421,7 +422,7 @@
        IN                              ib_cm_rej_rec_t                         *p_cm_rej_rec )
 {
        struct ibsp_socket_info *socket_info =
-               (struct ibsp_socket_info * VOID_PTR64)p_cm_rej_rec->qp_context;
+               (struct ibsp_socket_info *)p_cm_rej_rec->qp_context;

        IBSP_ENTER( IBSP_DBG_CM );

@@ -504,14 +505,14 @@
        ib_cm_drep_t cm_drep;
        struct disconnect_reason *reason;
        struct ibsp_socket_info *socket_info =
-               (struct ibsp_socket_info * VOID_PTR64)p_cm_dreq_rec->qp_context;
+               (struct ibsp_socket_info *)p_cm_dreq_rec->qp_context;

        IBSP_ENTER( IBSP_DBG_CM );
        IBSP_PRINT(TRACE_LEVEL_INFORMATION, IBSP_DBG_CM,
                ("socket=%p state=%s\n",
                socket_info, IBSP_SOCKET_STATE_STR( socket_info->socket_state )) );

-       reason = (struct disconnect_reason * VOID_PTR64)p_cm_dreq_rec->p_dreq_pdata;
+       reason = (struct disconnect_reason *)p_cm_dreq_rec->p_dreq_pdata;

        cl_spinlock_acquire( &socket_info->mutex1 );

Index: ulp/wsd/user/ibsp_pnp.c
===================================================================
--- ulp/wsd/user/ibsp_pnp.c     (revision 1300)
+++ ulp/wsd/user/ibsp_pnp.c     (working copy)
@@ -1,6 +1,7 @@
 /*
  * Copyright (c) 2005 SilverStorm Technologies.  All rights reserved.
  * Copyright (c) 2006 Mellanox Technologies.  All rights reserved.
+ * Portions Copyright (c) 2008 Microsoft Corporation.  All rights reserved.
  *
  * This software is available to you under the OpenIB.org BSD license
  * below:
@@ -319,7 +320,7 @@
                break;

        case IB_PNP_CA_REMOVE:
-               pnp_ca_remove( (struct ibsp_hca* VOID_PTR64)pnp_rec->context );
+               pnp_ca_remove( (struct ibsp_hca*)pnp_rec->context );
                break;

                /* Port events */
@@ -335,7 +336,7 @@
                break;

        case IB_PNP_PORT_REMOVE:
-               pnp_port_remove( (struct ibsp_port* VOID_PTR64)pnp_rec->context );
+               pnp_port_remove( (struct ibsp_port*)pnp_rec->context );
                break;

        case IB_PNP_PKEY_CHANGE:
Index: ulp/wsd/user/ibsp_perfmon.c
===================================================================
--- ulp/wsd/user/ibsp_perfmon.c (revision 1300)
+++ ulp/wsd/user/ibsp_perfmon.c (working copy)
@@ -1,6 +1,7 @@
 /*
  * Copyright (c) 2005 SilverStorm Technologies.  All rights reserved.
  * Copyright (c) 2006 Mellanox Technologies.  All rights reserved.
+ * Portions Copyright (c) 2008 Microsoft Corporation.  All rights reserved.
  *
  * This software is available to you under the OpenIB.org BSD license
  * below:
@@ -43,6 +44,7 @@

 struct _ibsp_pm_definition     g_ibsp_pm_def; /* IB WSD performance object */

+struct _pm_stat g_pm_stat;

 void
 IBSPPmInit( void )
@@ -420,7 +422,7 @@

        IBSP_ENTER( IBSP_DBG_PERFMON );

-       p_mem = (pm_shmem_t * VOID_PTR64 )g_pm_stat.p_shmem;
+       p_mem = (pm_shmem_t *)g_pm_stat.p_shmem;

        if( p_mem == NULL )
        {
Index: ulp/wsd/user/ibsp_ip.c
===================================================================
--- ulp/wsd/user/ibsp_ip.c      (revision 1300)
+++ ulp/wsd/user/ibsp_ip.c      (working copy)
@@ -1,6 +1,7 @@
 /*
  * Copyright (c) 2005 SilverStorm Technologies.  All rights reserved.
  * Copyright (c) 2006 Mellanox Technologies.  All rights reserved.
+ * Portions Copyright (c) 2008 Microsoft Corporation.  All rights reserved.
  *
  * This software is available to you under the OpenIB.org BSD license
  * below:
@@ -271,7 +272,7 @@
                                        ib_query_rec_t                          *p_query_rec )
 {
        struct query_guid_context *query_context =
-               (struct query_guid_context * VOID_PTR64)p_query_rec->query_context;
+               (struct query_guid_context *)p_query_rec->query_context;
        ib_service_record_t *service_record;

        IBSP_ENTER( IBSP_DBG_HW );
@@ -311,7 +312,7 @@
        ib_user_query_t user_query;
        struct query_guid_context query_context;
        ib_service_record_t service_record;
-       ib_query_handle_t VOID_PTR64 query_handle;
+       ib_query_handle_t query_handle;
        ib_query_req_t query_req;
        ib_api_status_t status;

@@ -392,7 +393,7 @@
                                        ib_query_rec_t                          *p_query_rec )
 {
        struct query_pr_context *query_context =
-               (struct query_pr_context * VOID_PTR64)p_query_rec->query_context;
+               (struct query_pr_context *)p_query_rec->query_context;
        ib_api_status_t status;

        IBSP_ENTER( IBSP_DBG_HW );
@@ -432,7 +433,7 @@
 {
        ib_gid_pair_t user_query;
        struct query_pr_context query_context;
-       ib_query_handle_t VOID_PTR64 query_handle;
+       ib_query_handle_t query_handle;
        ib_query_req_t query_req;
        ib_api_status_t status;
        uint8_t pkt_life;
Index: ulp/wsd/user/ibspproto.h
===================================================================
--- ulp/wsd/user/ibspproto.h    (revision 1300)
+++ ulp/wsd/user/ibspproto.h    (working copy)
@@ -1,5 +1,6 @@
 /*
  * Copyright (c) 2005 SilverStorm Technologies.  All rights reserved.
+ * Portions Copyright (c) 2008 Microsoft Corporation.  All rights reserved.
  *
  * This software is available to you under the OpenIB.org BSD license
  * below:
@@ -249,7 +250,7 @@
 struct memory_node *
 ibsp_reg_mem(
        IN                              struct ibsp_socket_info         *s,
-       IN                              ib_pd_handle_t FUNC_PTR64                               pd,
+       IN                              ib_pd_handle_t                          pd,
        IN                              void                                            *start,
        IN                              size_t                                          len,
        IN                              ib_access_t                                     access_ctrl,
Index: ulp/wsd/user/ibsp_perfmon.h
===================================================================
--- ulp/wsd/user/ibsp_perfmon.h (revision 1300)
+++ ulp/wsd/user/ibsp_perfmon.h (working copy)
@@ -1,5 +1,6 @@
 /*
  * Copyright (c) 2005 SilverStorm Technologies.  All rights reserved.
+ * Portions Copyright (c) 2008 Microsoft Corporation.  All rights reserved.
  *
  * This software is available to you under the OpenIB.org BSD license
  * below:
@@ -95,9 +96,11 @@
        DWORD                                   idx;                    /* slot index assigned for this process */
        LONG64                                  fall_back_data[IBSP_PM_NUM_COUNTERS];

-}      g_pm_stat;
+};

+extern struct _pm_stat g_pm_stat;

+
 void
 IBSPPmInit( void );

Index: ulp/wsd/user/ibsp_iblow.c
===================================================================
--- ulp/wsd/user/ibsp_iblow.c   (revision 1300)
+++ ulp/wsd/user/ibsp_iblow.c   (working copy)
@@ -1,6 +1,7 @@
 /*
  * Copyright (c) 2005 SilverStorm Technologies.  All rights reserved.
  * Copyright (c) 2006 Mellanox Technologies.  All rights reserved.
+ * Portions Copyright (c) 2008 Microsoft Corporation.  All rights reserved.
  *
  * This software is available to you under the OpenIB.org BSD license
  * below:
@@ -66,8 +67,8 @@

        IBSP_ENTER( IBSP_DBG_IO );

-       wr = (struct _wr * VOID_PTR64)HDL_TO_PTR(wc->wr_id);
-       p_recv_wr = (struct _recv_wr * VOID_PTR64)HDL_TO_PTR(wc->wr_id);
+       wr = (struct _wr *)(ULONG_PTR)wc->wr_id;
+       p_recv_wr = (struct _recv_wr *)(ULONG_PTR)wc->wr_id;

        CL_ASSERT( wr );

@@ -110,7 +111,7 @@
 #ifdef IBSP_LOGGING
                        cl_spinlock_acquire( &socket_info->recv_lock );
                        DataLogger_WriteData(&socket_info->RecvDataLogger,
-                               p_recv_wr->idx, (void * VOID_PTR64)p_recv_wr->ds_array[0].vaddr,
+                               p_recv_wr->idx, (void *)p_recv_wr->ds_array[0].vaddr,
                                wc->length);
                        cl_spinlock_release( &socket_info->recv_lock );
 #endif
@@ -251,7 +252,7 @@
                //      if( idx >= QP_ATTRIB_RQ_DEPTH )
                //              idx += QP_ATTRIB_RQ_DEPTH;

-               //      CL_ASSERT( wc->wr_id == (uint64_t)(void* VOID_PTR64)&socket_info->recv_wr[idx] );
+               //      CL_ASSERT( wc->wr_id == (ULONG_PTR)&socket_info->recv_wr[idx] );
                //      cl_atomic_dec( &socket_info->recv_cnt );
                //      cl_spinlock_release( &socket_info->recv_lock );
                //}
@@ -259,7 +260,7 @@
                if( wc->status == IB_SUCCESS && p_recv_wr->ds_array[0].length >= 40 )
                {
                        debug_dump_buffer( IBSP_DBG_WQ, "RECV",
-                               (void * VOID_PTR64)p_recv_wr->ds_array[0].vaddr, 40 );
+                               (void *)(ULONG_PTR)p_recv_wr->ds_array[0].vaddr, 40 );
                }

                cl_atomic_dec( &g_ibsp.recv_count );
@@ -279,7 +280,7 @@
                //      idx = socket_info->send_idx - (uint8_t)socket_info->send_cnt;
                //      if( idx >= QP_ATTRIB_SQ_DEPTH )
                //              idx += QP_ATTRIB_SQ_DEPTH;
-               //      CL_ASSERT( wc->wr_id == (uint64_t)(void* VOID_PTR64)&socket_info->send_wr[idx] );
+               //      CL_ASSERT( wc->wr_id == (ULONG_PTR)&socket_info->send_wr[idx] );
                //      cl_atomic_dec( &socket_info->send_cnt );
                //      cl_spinlock_release( &socket_info->send_lock );
                //}
Index: ulp/wsd/user/ibspdll.c
===================================================================
--- ulp/wsd/user/ibspdll.c      (revision 1300)
+++ ulp/wsd/user/ibspdll.c      (working copy)
@@ -1,6 +1,7 @@
 /*
  * Copyright (c) 2005 SilverStorm Technologies.  All rights reserved.
  * Copyright (c) 2006 Mellanox Technologies.  All rights reserved.
+ * Portions Copyright (c) 2008 Microsoft Corporation.  All rights reserved.
  *
  * This software is available to you under the OpenIB.org BSD license
  * below:
@@ -1621,7 +1622,7 @@

        /* Looks good. Post the receive buffer. */
        wr->recv.p_next = NULL;
-       wr->recv.wr_id = (uint64_t)(void* VOID_PTR64)wr;
+       wr->recv.wr_id = (ULONG_PTR)wr;
        wr->recv.num_ds = dwBufferCount;
        wr->recv.ds_array = wr->ds_array;

@@ -1643,7 +1644,7 @@
                }

                wr->ds_array[ds_idx].vaddr =
-                       (uint64_t)(void* VOID_PTR64)lpBuffers[ds_idx].buf;
+                       (ULONG_PTR)lpBuffers[ds_idx].buf;
                wr->ds_array[ds_idx].length = lpBuffers[ds_idx].len;
                wr->ds_array[ds_idx].lkey = node->p_reg1->lkey;
        }
@@ -1847,7 +1848,7 @@
        lpOverlapped->InternalHigh = 0;
        for( ds_idx = 0; ds_idx < dwBufferCount; ds_idx++ )
        {
-               local_ds[ds_idx].vaddr = (uint64_t)(void* VOID_PTR64)lpBuffers[ds_idx].buf;
+               local_ds[ds_idx].vaddr = (ULONG_PTR)lpBuffers[ds_idx].buf;
                local_ds[ds_idx].length = lpBuffers[ds_idx].len;

                lpOverlapped->InternalHigh += lpBuffers[ds_idx].len;
Index: ulp/wsd/user/ibsp_mem.c
===================================================================
--- ulp/wsd/user/ibsp_mem.c     (revision 1300)
+++ ulp/wsd/user/ibsp_mem.c     (working copy)
@@ -1,6 +1,7 @@
 /*
  * Copyright (c) 2005 SilverStorm Technologies.  All rights reserved.
  * Copyright (c) 2006 Mellanox Technologies.  All rights reserved.
+ * Portions Copyright (c) 2008 Microsoft Corporation.  All rights reserved.
  *
  * This software is available to you under the OpenIB.org BSD license
  * below:
@@ -51,8 +52,8 @@
 {
        return( (p_reg->type.access_ctrl & acl_mask) == acl_mask &&
                start >= p_reg->type.vaddr &&
-               ((uintn_t)start) + len <=
-               ((uintn_t)(uint64_t)p_reg->type.vaddr) + p_reg->type.length );
+               ((ULONG_PTR)start) + len <=
+               ((ULONG_PTR)p_reg->type.vaddr) + p_reg->type.length );
 }


@@ -100,7 +101,7 @@
 struct memory_node *
 ibsp_reg_mem(
        IN                              struct ibsp_socket_info         *s,
-       IN                              ib_pd_handle_t FUNC_PTR64                               pd,
+       IN                              ib_pd_handle_t                          pd,
        IN                              void                                            *start,
        IN                              size_t                                          len,
        IN                              ib_access_t                                     access_ctrl,
@@ -361,8 +362,8 @@
                p_item = cl_qlist_next( p_item );

                if( lpvAddress > p_reg->type.vaddr ||
-                       ((uintn_t)lpvAddress) + Size <
-                       ((uintn_t)(uint64_t)p_reg->type.vaddr) + p_reg->type.length )
+                       ((ULONG_PTR)lpvAddress) + Size <
+                       ((ULONG_PTR)p_reg->type.vaddr) + p_reg->type.length )
                {
                        continue;
                }
-------------- next part --------------
A non-text attachment was scrubbed...
Name: wsd.patch
Type: application/octet-stream
Size: 16431 bytes
Desc: wsd.patch
URL: <http://lists.openfabrics.org/pipermail/ofw/attachments/20080626/ed48ef8f/attachment.obj>


More information about the ofw mailing list