[IBAL] Use the CM protocol to exchange initiator depth and responder resources.
authorleonidk <leonidk@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Wed, 2 Jul 2008 12:39:02 +0000 (12:39 +0000)
committerleonidk <leonidk@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Wed, 2 Jul 2008 12:39:02 +0000 (12:39 +0000)
Signed-off-by: Fab Tillier <ftillier@microsoft.com>
git-svn-id: svn://openib.tc.cornell.edu/gen1/trunk@1324 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86

core/al/al_cm_cep.h
core/al/al_dev.h
core/al/kernel/al_cm_cep.c
core/al/kernel/al_ndi_cm.c
core/al/kernel/al_proxy_cep.c
inc/iba/ib_al_ioctl.h

index e500107..0f94b0a 100644 (file)
@@ -284,6 +284,8 @@ NTSTATUS
 al_cep_get_pdata(\r
        IN                              ib_al_handle_t                          h_al,\r
        IN                              net32_t                                         cid,\r
+        OUT         uint8_t                     *p_init_depth,\r
+        OUT         uint8_t                     *p_resp_res,\r
        IN      OUT                     uint8_t                                         *p_psize,\r
                OUT                     uint8_t*                                        pdata );\r
 \r
index 9c98e15..bb2211b 100644 (file)
@@ -55,7 +55,7 @@
 #define AL_DEVICE_NAME L"\\Device\\ibal"\r
 #define        ALDEV_KEY               (0x3B)  /* Matches FILE_DEVICE_INFINIBAND from wdm.h */\r
 \r
-#define AL_IOCTL_VERSION                       (6)\r
+#define AL_IOCTL_VERSION                       (7)\r
 \r
 /* max number of devices with non-default pkey */\r
 #define        MAX_NUM_PKEY    16\r
index 33455d7..1db46ce 100644 (file)
@@ -6363,6 +6363,8 @@ NTSTATUS
 al_cep_get_pdata(\r
        IN                              ib_al_handle_t                          h_al,\r
        IN                              net32_t                                         cid,\r
+        OUT         uint8_t                     *p_init_depth,\r
+        OUT         uint8_t                     *p_resp_res,\r
        IN      OUT                     uint8_t                                         *p_psize,\r
                OUT                     uint8_t*                                        pdata )\r
 {\r
@@ -6384,6 +6386,9 @@ al_cep_get_pdata(
                return STATUS_CONNECTION_INVALID;\r
        }\r
 \r
+    *p_init_depth = p_cep->init_depth;\r
+    *p_resp_res = p_cep->resp_res;\r
+\r
     copy_len = min( *p_psize, p_cep->psize );\r
 \r
     if( copy_len )\r
index 438f9f3..da6a35f 100644 (file)
@@ -184,29 +184,26 @@ __cep_timewait_qp(
 static ib_api_status_t\r
 __ndi_qp2rts(\r
        IN              ib_qp_handle_t  const                           h_qp,\r
-       IN              uint8_t                                                         init_depth,\r
-       IN              uint8_t                                                         resp_res,\r
-       IN              PIRP                                                            p_irp,\r
-       IN      OUT     ib_qp_mod_t                                                     *p_qp_mod\r
+       IN              PIRP                                                            p_irp\r
        )\r
 {\r
        ib_api_status_t status;\r
+       ib_qp_mod_t qp_mod;\r
 \r
        AL_ENTER( AL_DBG_NDI );\r
 \r
        /* fill required qp attributes */\r
        status = al_cep_get_rtr_attr( qp_get_al( h_qp ), \r
-               ((al_conn_qp_t*)h_qp)->cid, p_qp_mod );\r
+               ((al_conn_qp_t*)h_qp)->cid, &qp_mod );\r
        if ( status != IB_SUCCESS )\r
        {\r
                AL_PRINT( TRACE_LEVEL_ERROR, AL_DBG_ERROR,\r
                        ("al_cep_get_rtr_attr returned %s\n", ib_get_err_str( status )) );\r
                goto exit;\r
        }\r
-       p_qp_mod->state.rtr.resp_res = resp_res;\r
 \r
        /* perform the request: INIT->RTR */\r
-       status = ndi_modify_qp( h_qp, p_qp_mod, \r
+       status = ndi_modify_qp( h_qp, &qp_mod, \r
                cl_ioctl_out_size( p_irp ), cl_ioctl_out_buf( p_irp ) );\r
        if ( status != IB_SUCCESS )\r
        {\r
@@ -217,17 +214,16 @@ __ndi_qp2rts(
 \r
        /* fill required qp attributes */\r
        status = al_cep_get_rts_attr( qp_get_al( h_qp ), \r
-               ((al_conn_qp_t*)h_qp)->cid, p_qp_mod );\r
+               ((al_conn_qp_t*)h_qp)->cid, &qp_mod );\r
        if ( status != IB_SUCCESS )\r
        {\r
                AL_PRINT( TRACE_LEVEL_ERROR, AL_DBG_ERROR,\r
                        ("al_cep_get_rts_attr returned %s\n", ib_get_err_str( status )) );\r
                goto exit;\r
        }\r
-       p_qp_mod->state.rts.init_depth = init_depth;\r
 \r
        /* perform the request: RTR->RTS */\r
-       status = ndi_modify_qp( h_qp, p_qp_mod, \r
+       status = ndi_modify_qp( h_qp, &qp_mod, \r
                cl_ioctl_out_size( p_irp ), cl_ioctl_out_buf( p_irp ) );\r
        if ( status != IB_SUCCESS )\r
        {\r
@@ -848,8 +844,8 @@ __ndi_fill_cm_req(
 \r
        p_cm_req->qp_type = IB_QPT_RELIABLE_CONN;\r
        p_cm_req->h_qp = h_qp;\r
-       p_cm_req->resp_res = 0;\r
-       p_cm_req->init_depth = 0;\r
+       p_cm_req->resp_res = p_req->resp_res;\r
+       p_cm_req->init_depth = p_req->init_depth;\r
 \r
        p_cm_req->remote_resp_timeout =\r
                ib_path_rec_pkt_life( p_path_rec ) + CM_REMOTE_TIMEOUT;\r
@@ -1218,13 +1214,8 @@ __ndi_rtu_cm(
        IN                              PIRP                                            p_irp )\r
 {\r
        NTSTATUS nt_status;\r
-       ib_qp_mod_t qp_mod;\r
        ib_api_status_t status;\r
-       ib_qp_handle_t VOID_PTR64 h_qp = p_irp->Tail.Overlay.DriverContext[0];\r
-       ual_ndi_rtu_cm_ioctl_in_t *p_rtu = \r
-               (ual_ndi_rtu_cm_ioctl_in_t*)cl_ioctl_in_buf( p_irp );\r
-       uint8_t pdata[IB_REJ_PDATA_SIZE];\r
-       uint8_t psize = sizeof(pdata);\r
+       ib_qp_handle_t h_qp = p_irp->Tail.Overlay.DriverContext[0];\r
 \r
        UNUSED_PARAM(p_dev_obj);\r
 \r
@@ -1235,17 +1226,15 @@ __ndi_rtu_cm(
                IoFreeWorkItem( p_irp->Tail.Overlay.DriverContext[1] );\r
 \r
        /* change the QP state to RTS */\r
-       status = __ndi_qp2rts( h_qp, p_rtu->init_depth, \r
-               p_rtu->resp_res, p_irp, &qp_mod );\r
+       status = __ndi_qp2rts( h_qp, p_irp );\r
        if ( status != IB_SUCCESS )\r
        {\r
                goto err;\r
        }\r
        \r
        /* send RTU */\r
-       al_cep_get_pdata( qp_get_al( h_qp ), ((al_conn_qp_t*)h_qp)->cid, &psize, pdata );\r
-       status = al_cep_rtu( qp_get_al( h_qp ), ((al_conn_qp_t*)h_qp)->cid, pdata, psize );\r
-       if( status != IB_SUCCESS && status != IB_INVALID_STATE )\r
+       status = al_cep_rtu( qp_get_al( h_qp ), ((al_conn_qp_t*)h_qp)->cid, NULL, 0 );\r
+       if( status != IB_SUCCESS )\r
        {\r
                net32_t                         cid;\r
 err:\r
@@ -1333,7 +1322,6 @@ __ndi_rep_cm(
        IN                              PIRP                                            p_irp )\r
 {\r
        NTSTATUS nt_status;\r
-       ib_qp_mod_t qp_mod;\r
        ib_api_status_t status;\r
        ib_qp_handle_t VOID_PTR64 h_qp = p_irp->Tail.Overlay.DriverContext[0];\r
        ual_ndi_rep_cm_ioctl_in_t *p_rep = \r
@@ -1348,8 +1336,7 @@ __ndi_rep_cm(
                IoFreeWorkItem( p_irp->Tail.Overlay.DriverContext[1] );\r
 \r
        /* change the QP state to RTS */\r
-       status = __ndi_qp2rts( h_qp, p_rep->init_depth, \r
-               p_rep->resp_res, p_irp, &qp_mod );\r
+       status = __ndi_qp2rts( h_qp, p_irp );\r
        if ( status != IB_SUCCESS )\r
        {\r
                nt_status = STATUS_CONNECTION_ABORTED;\r
@@ -1417,7 +1404,7 @@ __ndi_fill_cm_rep(
        p_cm_rep->h_qp = h_qp;\r
 \r
        p_cm_rep->access_ctrl = IB_AC_RDMA_READ | IB_AC_RDMA_WRITE | IB_AC_LOCAL_WRITE;\r
-       p_cm_rep->init_depth = 0;\r
+       p_cm_rep->init_depth = p_rep->init_depth;\r
        p_cm_rep->target_ack_delay = 10;\r
        p_cm_rep->failover_accepted = IB_FAILOVER_ACCEPT_UNSUPPORTED;\r
        p_cm_rep->flow_ctrl = TRUE;     /* HCAs must support end-to-end flow control. */\r
index 5ff8f77..17422ef 100644 (file)
@@ -935,7 +935,8 @@ proxy_cep_get_pdata(
        }\r
 \r
        p_ioctl->out.pdata_len = sizeof(p_ioctl->out.pdata);\r
-       status = al_cep_get_pdata( p_context->h_al, p_ioctl->in.cid, \r
+       status = al_cep_get_pdata( p_context->h_al, p_ioctl->in.cid,\r
+        &p_ioctl->out.init_depth, &p_ioctl->out.resp_res,\r
                (uint8_t*)&p_ioctl->out.pdata_len, p_ioctl->out.pdata );\r
 \r
        if( NT_SUCCESS( status ) )\r
index 8830c51..066d370 100644 (file)
@@ -3130,6 +3130,8 @@ typedef union _ual_cep_get_pdata_ioctl
        {\r
                uint32_t                                pdata_len;\r
                uint8_t                                 pdata[IB_REJ_PDATA_SIZE];\r
+        uint8_t                 resp_res;\r
+        uint8_t                 init_depth;\r
 \r
        }       out;\r
 \r
@@ -3513,6 +3515,8 @@ typedef struct _ual_ndi_req_cm_ioctl_in
        uint64_t                                        h_qp;\r
        net64_t                                         guid;\r
        uint16_t                                        dst_port;\r
+    uint8_t                     resp_res;\r
+    uint8_t                     init_depth;\r
        uint8_t                                         prot;\r
        uint8_t                                         pdata_size;\r
        ib_cm_rdma_req_t                        pdata;\r
@@ -3532,6 +3536,12 @@ typedef struct _ual_ndi_req_cm_ioctl_in
 *      dst_port\r
 *              Destination port number.\r
 *\r
+*   resp_res\r
+*       Responder resources for the QP.\r
+*\r
+*   init_depth\r
+*       Initiator depth for the QP.\r
+*\r
 *      prot\r
 *              Protocol.\r
 *\r
@@ -3635,8 +3645,6 @@ typedef struct _ual_ndi_rej_cm_ioctl_in
 typedef struct _ual_ndi_rtu_cm_ioctl_in\r
 {\r
        uint64_t                                        h_qp;\r
-       uint8_t                                         init_depth;\r
-       uint8_t                                         resp_res;\r
 \r
 }      ual_ndi_rtu_cm_ioctl_in_t;\r
 /*\r