verbs: optimize work request/completion structures
authorshefty <shefty@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Wed, 23 Jul 2008 21:03:49 +0000 (21:03 +0000)
committershefty <shefty@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Wed, 23 Jul 2008 21:03:49 +0000 (21:03 +0000)
Change work completion types to quickly allow a user to determine if a
completions is for a send or receive.  Align work request and work
completion type values to be the same for consistency.

Update work request structure to avoid unnecessary internal padding and
allocating extra unused space for pointers and structures that can be
part of a union.  Arrange structure layout to allow casting between
the UVP, IBAL, WinVerbs, and libibverbs work requests.

Update debug print functions to match changes.

Signed-off-by: Sean Hefty <sean.hefty@intel.com>
git-svn-id: svn://openib.tc.cornell.edu/gen1/trunk@1440 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86

core/al/ib_statustext.c
core/al/kernel/al_proxy_verbs.c
core/al/user/ual_qp.c
inc/iba/ib_types.h

index 378a8a2..d5f1334 100644 (file)
@@ -186,39 +186,46 @@ ib_get_wc_status_str(
 }\r
 \r
 \r
-static const char* const __ib_wc_type_str[] =\r
+static const char* const __ib_wc_send_type_str[] =\r
 {\r
        "IB_WC_SEND",\r
        "IB_WC_RDMA_WRITE",\r
-       "IB_WC_RECV",\r
        "IB_WC_RDMA_READ",\r
-       "IB_WC_MW_BIND",\r
-       "IB_WC_FETCH_ADD",\r
        "IB_WC_COMPARE_SWAP",\r
-       "IB_WC_RECV_RDMA_WRITE"\r
-       "IB_WC_UNKNOWN"\r
+       "IB_WC_FETCH_ADD",\r
+       "IB_WC_MW_BIND",\r
 };\r
 \r
+static const char* const __ib_wc_recv_type_str[] =\r
+{\r
+       "IB_WC_RECV",\r
+       "IB_WC_RECV_RDMA_WRITE"\r
+};\r
 \r
 const char*\r
 ib_get_wc_type_str(\r
        IN                              ib_wc_type_t                            wc_type )\r
 {\r
-       if( wc_type > IB_WC_UNKNOWN )\r
-               wc_type = IB_WC_UNKNOWN;\r
-       return( __ib_wc_type_str[wc_type] );\r
+       if ( wc_type & IB_WC_RECV )\r
+               if ( wc_type - IB_WC_RECV >= IB_WC_UNKNOWN2)\r
+                       return "IB_WC_UNKNOWN";\r
+               else\r
+                       return __ib_wc_recv_type_str[wc_type - IB_WC_RECV];\r
+       else\r
+               if ( wc_type >= IB_WC_UNKNOWN1 )\r
+                       return "IB_WC_UNKNOWN";\r
+               else\r
+                       return __ib_wc_send_type_str[wc_type];\r
 }\r
 \r
 \r
 static const char* const __ib_wr_type_str[] =\r
 {\r
-       "WR_DUMMY",             /*place holder*/\r
        "WR_SEND",\r
        "WR_RDMA_WRITE",\r
        "WR_RDMA_READ",\r
        "WR_COMPARE_SWAP",\r
-       "WR_FETCH_ADD",\r
-       "WR_UNKNOWN"\r
+       "WR_FETCH_ADD"\r
 };\r
 \r
 \r
@@ -226,8 +233,8 @@ const char*
 ib_get_wr_type_str(\r
        IN                              uint8_t                                         wr_type )\r
 {\r
-       if( wr_type > WR_UNKNOWN )\r
-               wr_type = WR_UNKNOWN;\r
+       if( wr_type >= WR_UNKNOWN )\r
+               return "WR_UNKNOWN";\r
        return( __ib_wr_type_str[wr_type] );\r
 }\r
 \r
index 5b052e0..0169b08 100644 (file)
@@ -2356,7 +2356,7 @@ proxy_post_send(
                {\r
                        /* Validate the AV handle for UD */\r
                        h_av = (ib_av_handle_t)al_hdl_ref( p_context->h_al,\r
-                               p_wr[i].dgrm.ud.h_av_padding, AL_OBJ_TYPE_H_AV );\r
+                               (ULONG_PTR) p_wr[i].dgrm.ud.h_av, AL_OBJ_TYPE_H_AV );\r
                        if( !h_av )\r
                        {\r
                                status = IB_INVALID_AV_HANDLE;\r
index 0fc84ec..0b39de4 100644 (file)
@@ -119,8 +119,8 @@ ual_post_send(
                p_qp_ioctl->in.send_wr[num_wr] = *p_wr;\r
                if( h_qp->type == IB_QPT_UNRELIABLE_DGRM )\r
                {\r
-                       p_qp_ioctl->in.send_wr[num_wr].dgrm.ud.h_av_padding =\r
-                               p_wr->dgrm.ud.h_av->obj.hdl;\r
+                       p_qp_ioctl->in.send_wr[num_wr].dgrm.ud.h_av =\r
+                               (ib_av_handle_t) (ULONG_PTR) p_wr->dgrm.ud.h_av->obj.hdl;\r
                }\r
                num_wr++;\r
                cl_memcpy(\r
index c284e64..827cac3 100644 (file)
@@ -9992,7 +9992,7 @@ typedef struct _ib_qp_mod
 */\r
 typedef enum _ib_wr_type_t\r
 {\r
-       WR_SEND = 1,\r
+       WR_SEND,\r
        WR_RDMA_WRITE,\r
        WR_RDMA_READ,\r
        WR_COMPARE_SWAP,\r
@@ -10128,65 +10128,66 @@ typedef uint32_t                                      ib_send_opt_t;
 */\r
 typedef struct _ib_send_wr\r
 {\r
-       TO_LONG_PTR(struct _ib_send_wr*, p_next);\r
        uint64_t                                        wr_id;\r
+       struct _ib_send_wr*                     p_next;\r
+       ib_local_ds_t*                          ds_array;\r
+       uint32_t                                        num_ds;\r
        ib_wr_type_t                            wr_type;\r
        ib_send_opt_t                           send_opt;\r
-       uint32_t                                        num_ds;\r
-       TO_LONG_PTR(ib_local_ds_t*, ds_array);\r
        ib_net32_t                                      immediate_data;\r
 \r
-       union _send_dgrm\r
+       union\r
        {\r
-               struct _send_ud\r
-               {\r
-                       ib_net32_t              remote_qp;\r
-                       ib_net32_t              remote_qkey;\r
-                       TO_LONG_PTR(ib_av_handle_t, h_av);\r
-                       uint16_t                pkey_index;\r
-                       TO_LONG_PTR(void*, rsvd);\r
-\r
-               }       ud;\r
-\r
-               struct _send_rd\r
+               union _send_dgrm\r
                {\r
-                       ib_net32_t              remote_qp;\r
-                       ib_net32_t              remote_qkey;\r
-                       ib_net32_t              eecn;\r
+                       struct _send_ud\r
+                       {\r
+                               ib_av_handle_t  h_av; \r
+                               ib_net32_t              remote_qp;\r
+                               ib_net32_t              remote_qkey;\r
+                               void*                   rsvd;\r
+                               uint16_t                pkey_index;\r
 \r
-               }       rd;\r
+                       }       ud;\r
 \r
-               struct _send_raw_ether\r
-               {\r
-                       ib_net16_t              dest_lid;\r
-                       uint8_t                 path_bits;\r
-                       uint8_t                 sl;\r
-                       uint8_t                 max_static_rate;\r
-                       ib_net16_t              ether_type;\r
+                       struct _send_rd\r
+                       {\r
+                               ib_net32_t              remote_qp;\r
+                               ib_net32_t              remote_qkey;\r
+                               ib_net32_t              eecn;\r
 \r
-               }       raw_ether;\r
+                       }       rd;\r
 \r
-               struct _send_raw_ipv6\r
-               {\r
-                       ib_net16_t              dest_lid;\r
-                       uint8_t                 path_bits;\r
-                       uint8_t                 sl;\r
-                       uint8_t                 max_static_rate;\r
+                       struct _send_raw_ether\r
+                       {\r
+                               ib_net16_t              dest_lid;\r
+                               uint8_t                 path_bits;\r
+                               uint8_t                 sl;\r
+                               uint8_t                 max_static_rate;\r
+                               ib_net16_t              ether_type;\r
 \r
-               }       raw_ipv6;\r
+                       }       raw_ether;\r
 \r
-       }       dgrm;\r
+                       struct _send_raw_ipv6\r
+                       {\r
+                               ib_net16_t              dest_lid;\r
+                               uint8_t                 path_bits;\r
+                               uint8_t                 sl;\r
+                               uint8_t                 max_static_rate;\r
 \r
-       struct _send_remote_ops\r
-       {\r
-               uint64_t                        vaddr;\r
-               net32_t                         rkey;\r
+                       }       raw_ipv6;\r
 \r
-               ib_net64_t                      atomic1;\r
-               ib_net64_t                      atomic2;\r
+               }       dgrm;\r
 \r
-       }       remote_ops;\r
+               struct _send_remote_ops\r
+               {\r
+                       uint64_t                        vaddr;\r
+                       net32_t                         rkey;\r
+                       ib_net64_t                      atomic1;\r
+                       ib_net64_t                      atomic2;\r
 \r
+               }       remote_ops;\r
+       };\r
 }      ib_send_wr_t;\r
 /*\r
 * FIELDS\r
@@ -10539,13 +10540,14 @@ typedef enum _ib_wc_type_t
 {\r
        IB_WC_SEND,\r
        IB_WC_RDMA_WRITE,\r
-       IB_WC_RECV,\r
        IB_WC_RDMA_READ,\r
-       IB_WC_MW_BIND,\r
-       IB_WC_FETCH_ADD,\r
        IB_WC_COMPARE_SWAP,\r
+       IB_WC_FETCH_ADD,\r
+       IB_WC_MW_BIND,\r
+       IB_WC_UNKNOWN1,\r
+       IB_WC_RECV = (1 << 7),\r
        IB_WC_RECV_RDMA_WRITE,\r
-       IB_WC_UNKNOWN\r
+       IB_WC_UNKNOWN2\r
 \r
 }      ib_wc_type_t;\r
 /*****/\r
@@ -10626,13 +10628,13 @@ typedef struct _ib_wc
        ib_wc_type_t                    wc_type;\r
 \r
        uint32_t                                length;\r
-       ib_wc_status_t                  status;\r
        struct {\r
                uint8_t                         vendor_specific;\r
                uint8_t                         csum_ok;\r
                uint16_t                        vendor_specific2;\r
                uint32_t                        vendor_specific3;\r
        };\r
+       ib_wc_status_t                  status;\r
 \r
        union _wc_recv\r
        {\r