[IBAL] This patch removes ATS queries from the ND proxy, with the anticipation that...
authorleonidk <leonidk@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Wed, 9 Jul 2008 12:15:02 +0000 (12:15 +0000)
committerleonidk <leonidk@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Wed, 9 Jul 2008 12:15:02 +0000 (12:15 +0000)
Signed-off-by: Fab Tillier <ftillier@microsoft.com>
git-svn-id: svn://openib.tc.cornell.edu/gen1/trunk@1357 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86

core/al/kernel/al_ndi_cm.c
core/al/kernel/al_ndi_cm.h
core/al/kernel/al_proxy_ndi.c

index 1bf25a5..028c6c9 100644 (file)
@@ -103,7 +103,6 @@ static char * State2String(ndi_cm_state_t state)
        switch (state) \r
        {\r
                case NDI_CM_IDLE                                        : return "NDI_CM_IDLE";\r
-               case NDI_CM_CONNECTING_ATS_SENT         : return "NDI_CM_CONNECTING_ATS_SENT";\r
                case NDI_CM_CONNECTING_QPR_SENT         : return "NDI_CM_CONNECTING_QPR_SENT";\r
                case NDI_CM_CONNECTING_REQ_SENT         : return "NDI_CM_CONNECTING_REQ_SENT";\r
                case NDI_CM_CONNECTING_REP_SENT         : return "NDI_CM_CONNECTING_REP_SENT";\r
@@ -280,10 +279,6 @@ static NTSTATUS __ndi_insert_irp_ex(
        AL_ENTER( AL_DBG_NDI );\r
        switch( (ULONG_PTR)Context )\r
        {\r
-       case NDI_CM_CONNECTING_ATS_SENT:\r
-               status = __ndi_ats_query( pIrp );\r
-               break;\r
-\r
        case NDI_CM_CONNECTING_QPR_SENT:\r
                status = __ndi_pr_query( pIrp );\r
                break;\r
@@ -424,10 +419,10 @@ static VOID __ndi_complete_cancelled_irp(
        {\r
        case UAL_NDI_REQ_CM:\r
                __ndi_acquire_lock( Csq, &irql );\r
-                               /*\r
+               /*\r
                 * Note that al_cancel_sa_req is synchronized with any potential\r
                 * SA callback by the CSQ lock.\r
-                                */\r
+                */\r
 #pragma warning( disable:4305 )\r
                h_query = InterlockedExchangePointer( &h_qp->p_irp_queue->h_query, NULL );\r
 #pragma warning( default:4305 )\r
@@ -536,7 +531,7 @@ ndi_qp_destroy(
                        __ndi_complete_cancelled_irp( &h_qp->p_irp_queue->csq, Irp );\r
                }\r
                while( Irp = IoCsqRemoveNextIrp(\r
-            &h_qp->p_irp_queue->csq, (VOID*)(ULONG_PTR)UAL_NDI_NOTIFY_DREQ ) )\r
+                       &h_qp->p_irp_queue->csq, (VOID*)(ULONG_PTR)UAL_NDI_NOTIFY_DREQ ) )\r
                {\r
                        AL_PRINT( TRACE_LEVEL_INFORMATION, AL_DBG_NDI, \r
                                ("h_qp %#I64x, uhdl %#I64x, ref_cnt %d\n", \r
@@ -901,13 +896,13 @@ __ndi_cm_handler(
                                        cid, h_al, h_qp, new_cid ) );\r
                                __ndi_proc_drep( h_qp );\r
                                break;\r
-               \r
+\r
                        case CM_RTU_ATTR_ID:\r
                                AL_PRINT( TRACE_LEVEL_INFORMATION, AL_DBG_NDI,\r
                                        ("RTU received for CEP with cid %d, h_al %p, context %p, new_cid %d.\n",\r
                                        cid, h_al, h_qp, new_cid ) );\r
                                break;\r
-               \r
+\r
                        default:\r
                                AL_PRINT( TRACE_LEVEL_ERROR, AL_DBG_ERROR,\r
                                        ("Unhandled MAD attr ID %d for CEP with cid %d, h_al %p, context %p, new_cid %d .\n", \r
@@ -985,7 +980,7 @@ __ndi_send_req(
 \r
        AL_ENTER( AL_DBG_NDI );\r
 \r
-    p_irp->Tail.Overlay.DriverContext[1] = NULL;\r
+       p_irp->Tail.Overlay.DriverContext[1] = NULL;\r
 \r
        if( h_qp->p_irp_queue->state != NDI_CM_CONNECTING_QPR_SENT )\r
        {\r
@@ -1107,9 +1102,9 @@ __ndi_pr_query_cb(
                        case IB_MAD_STATUS_BUSY:\r
                        case IB_SA_MAD_STATUS_NO_RESOURCES:\r
                                status = STATUS_TIMEOUT;\r
-                       break;\r
+                               break;\r
 \r
-               default:\r
+                       default:\r
                                status = STATUS_INVALID_PARAMETER_1 +\r
                                        (p_query_rec->p_result_mad->p_mad_buf->status & 0xFF);\r
                                break;\r
@@ -1185,12 +1180,12 @@ __ndi_pr_query(
 \r
        AL_ENTER( AL_DBG_NDI );\r
 \r
-       if ( h_qp->p_irp_queue->state != NDI_CM_CONNECTING_ATS_SENT )\r
+       if ( h_qp->p_irp_queue->state != NDI_CM_IDLE )\r
        {\r
                AL_PRINT_EXIT( TRACE_LEVEL_ERROR, AL_DBG_ERROR, \r
                        ("STATUS_CONNECTION_ACTIVE: h_qp %#I64x, uhdl %#I64x, ref_cnt %d\n",\r
                        (uint64_t)h_qp, h_qp->obj.hdl, h_qp->obj.ref_cnt ) );\r
-               return STATUS_CONNECTION_ABORTED;\r
+               return STATUS_CONNECTION_ACTIVE;\r
        }\r
 \r
        query_req.query_type = IB_QUERY_PATH_REC_BY_GIDS;\r
@@ -1221,199 +1216,29 @@ __ndi_pr_query(
 }\r
 \r
 \r
-static void AL_API\r
-__ndi_ats_query_cb(\r
-       IN                              ib_query_rec_t                          *p_query_rec )\r
-{\r
-       cl_ioctl_handle_t p_irp;\r
-       ib_service_record_t *service_record;\r
-       ib_qp_handle_t h_qp = (ib_qp_handle_t)p_query_rec->query_context;\r
-       ual_ndi_req_cm_ioctl_in_t *p_req;\r
-       KIRQL irql;\r
-       NTSTATUS status;\r
-\r
-       AL_ENTER( AL_DBG_NDI );\r
-\r
-       AL_PRINT( TRACE_LEVEL_ERROR, AL_DBG_ERROR,\r
-               ("status is %d, count is %d, context %p\n", p_query_rec->status,\r
-               p_query_rec->result_cnt, p_query_rec->query_context) );\r
-\r
-       p_irp = IoCsqRemoveNextIrp( &h_qp->p_irp_queue->csq, (VOID*)(ULONG_PTR)UAL_NDI_REQ_CM );\r
-       if( p_irp == NULL )\r
-       {\r
-               goto exit;\r
-       }\r
-\r
-#pragma warning( disable:4305 )\r
-       InterlockedExchangePointer( &h_qp->p_irp_queue->h_query, NULL );\r
-#pragma warning( default:4305 )\r
-\r
-       if( p_query_rec->status != IB_SUCCESS || !p_query_rec->result_cnt )\r
-       {\r
-               __ndi_acquire_lock( &h_qp->p_irp_queue->csq, &irql );\r
-               if( h_qp->p_irp_queue->state != NDI_CM_INVALID )\r
-                       h_qp->p_irp_queue->state = NDI_CM_IDLE;\r
-               __ndi_release_lock( &h_qp->p_irp_queue->csq, irql );\r
-\r
-               if( p_query_rec->status == IB_TIMEOUT )\r
-               {\r
-                       __ndi_complete_irp( h_qp, p_irp, STATUS_TIMEOUT );\r
-               }\r
-               else\r
-               {\r
-                       __ndi_complete_irp( h_qp, p_irp, STATUS_HOST_UNREACHABLE );\r
-               }\r
-\r
-               goto exit;              /* ATS request failed */\r
-       }\r
-\r
-       /* send Path Request */\r
-       service_record = ib_get_query_svc_rec( p_query_rec->p_result_mad, 0 );\r
-       p_req = (ual_ndi_req_cm_ioctl_in_t*)cl_ioctl_in_buf( p_irp );\r
-       p_req->gids.src_gid.unicast.prefix = service_record->service_gid.unicast.prefix;\r
-       p_req->gids.src_gid.unicast.interface_id = p_req->guid;\r
-       p_req->gids.dest_gid = service_record->service_gid;\r
-       status = IoCsqInsertIrpEx(\r
-               &h_qp->p_irp_queue->csq,\r
-               p_irp,\r
-               NULL,\r
-               (VOID*)(ULONG_PTR)NDI_CM_CONNECTING_QPR_SENT\r
-               );\r
-       if( status != STATUS_SUCCESS )\r
-       {\r
-               __ndi_complete_irp( h_qp, p_irp, status );\r
-       }\r
-       else\r
-       {\r
-               /*\r
-                * Release the previous reference because IoCsqInsertIrpEx\r
-                * took a new one.\r
-                */\r
-               deref_al_obj( &h_qp->obj ); /* Release IRP reference. */\r
-       }\r
-\r
-exit:  \r
-       if( p_query_rec->p_result_mad )\r
-               ib_put_mad( p_query_rec->p_result_mad );\r
-\r
-       deref_al_obj( &h_qp->obj );     /* release ATS query reference */\r
-       AL_EXIT( AL_DBG_NDI );\r
-}\r
-\r
-/*\r
- * Send asynchronous query to the SA for an ATS record.\r
- *\r
- * Called from the __ndi_insert_irp_ex function, so the CSQ lock is held.\r
- */\r
-NTSTATUS\r
-__ndi_ats_query(\r
-       IN              IRP*                                                            p_irp\r
-       )\r
-{\r
-       ib_user_query_t user_query;\r
-       ib_service_record_t service_record;\r
-       ib_query_req_t query_req;\r
-       ib_api_status_t status;\r
-       ual_ndi_req_cm_ioctl_in_t *p_req = \r
-               (ual_ndi_req_cm_ioctl_in_t*)cl_ioctl_in_buf( p_irp );\r
-       ib_qp_handle_t h_qp = (ib_qp_handle_t)p_irp->Tail.Overlay.DriverContext[0];\r
-\r
-       AL_ENTER( AL_DBG_NDI );\r
-\r
-       if ( h_qp->p_irp_queue->state != NDI_CM_IDLE )\r
-       {\r
-               AL_PRINT_EXIT( TRACE_LEVEL_ERROR, AL_DBG_ERROR, \r
-                       ("STATUS_CONNECTION_ACTIVE: h_qp %#I64x, uhdl %#I64x, ref_cnt %d\n",\r
-                       (uint64_t)h_qp, h_qp->obj.hdl, h_qp->obj.ref_cnt ) );\r
-               return STATUS_CONNECTION_ACTIVE;\r
-       }\r
-\r
-       query_req.query_type = IB_QUERY_USER_DEFINED;\r
-       query_req.p_query_input = &user_query;\r
-       query_req.port_guid = p_req->guid;\r
-       query_req.timeout_ms = g_sa_timeout;\r
-       query_req.retry_cnt = g_sa_retries;\r
-       query_req.flags = 0;    /* IB_FLAGS_SYNC */\r
-       query_req.query_context = h_qp;\r
-       query_req.pfn_query_cb = __ndi_ats_query_cb;\r
-\r
-       /* TODO: which method one is correct? */\r
-       user_query.method = IB_MAD_METHOD_GETTABLE;\r
-       //user_query.method = IB_MAD_METHOD_GET;\r
-       user_query.attr_id = IB_MAD_ATTR_SERVICE_RECORD;\r
-       user_query.attr_size = sizeof(ib_service_record_t);\r
-       user_query.comp_mask =\r
-               IB_SR_COMPMASK_SPKEY |\r
-               IB_SR_COMPMASK_SLEASE |\r
-               IB_SR_COMPMASK_SNAME |\r
-               IB_SR_COMPMASK_SDATA8_12 |\r
-               IB_SR_COMPMASK_SDATA8_13 | IB_SR_COMPMASK_SDATA8_14 | IB_SR_COMPMASK_SDATA8_15;\r
-\r
-       user_query.p_attr = &service_record;\r
-\r
-       memset( &service_record, 0, sizeof(service_record) );\r
-       service_record.service_pkey = cl_hton16( IB_DEFAULT_PKEY );\r
-       service_record.service_data8[12] = (uint8_t) (p_req->pdata.dst_ip_addr[3] >> 0);\r
-       service_record.service_data8[13] = (uint8_t) (p_req->pdata.dst_ip_addr[3] >> 8);\r
-       service_record.service_data8[14] = (uint8_t) (p_req->pdata.dst_ip_addr[3] >> 16);\r
-       service_record.service_data8[15] = (uint8_t) (p_req->pdata.dst_ip_addr[3] >> 24);\r
-       service_record.service_lease = 0xFFFFFFFF;\r
-       strcpy( (void*)service_record.service_name, ATS_NAME );\r
-       \r
-       AL_PRINT( TRACE_LEVEL_INFORMATION, AL_DBG_NDI,\r
-               ("ATS:: MAD: method %#x, attr_id %#hx, Service: comp_mask %#I64x, IP %d.%d.%d.%d \n", \r
-               user_query.method,\r
-               CL_NTOH16(user_query.attr_id),\r
-               user_query.comp_mask,\r
-               service_record.service_data8[12],\r
-               service_record.service_data8[13],\r
-               service_record.service_data8[14],\r
-               service_record.service_data8[15]\r
-               ) );\r
-\r
-       AL_PRINT( TRACE_LEVEL_INFORMATION, AL_DBG_NDI, \r
-               ("h_qp %#I64x, uhdl %#I64x, ref_cnt %d\n", \r
-               (uint64_t)h_qp, h_qp->obj.hdl, h_qp->obj.ref_cnt ) );\r
-\r
-       ref_al_obj( &h_qp->obj );               /* take ATS query reference */\r
-\r
-       /* query SA */\r
-       status = ib_query( qp_get_al( h_qp ), &query_req, &h_qp->p_irp_queue->h_query );\r
-       if( status != IB_SUCCESS )\r
-       {\r
-               AL_PRINT_EXIT( TRACE_LEVEL_ERROR, AL_DBG_ERROR, ("ib_query failed (%d)\n", status) );\r
-               deref_al_obj( &h_qp->obj );     /* release ATS query reference */\r
-               return STATUS_UNSUCCESSFUL;\r
-       }\r
-\r
-       AL_EXIT( AL_DBG_NDI );\r
-       return STATUS_SUCCESS;\r
-}\r
-\r
-\r
 NTSTATUS\r
 ndi_req_cm(\r
        IN              ib_qp_handle_t  const                           h_qp,\r
-       IN              IRP                                                     *p_irp\r
+       IN              IRP                                                                     *p_irp\r
        )\r
 {\r
-       NTSTATUS nt_status;\r
+       NTSTATUS status;\r
 \r
        AL_ENTER( AL_DBG_NDI );\r
 \r
        p_irp->Tail.Overlay.DriverContext[0] = (ib_qp_t*)h_qp;\r
 \r
-       nt_status = IoCsqInsertIrpEx(\r
+       status = IoCsqInsertIrpEx(\r
                &h_qp->p_irp_queue->csq,\r
                p_irp,\r
                NULL,\r
-               (VOID*)(ULONG_PTR)NDI_CM_CONNECTING_ATS_SENT\r
+               (VOID*)(ULONG_PTR)NDI_CM_CONNECTING_QPR_SENT\r
                );\r
-       if( nt_status == STATUS_SUCCESS )\r
-               nt_status = STATUS_PENDING;\r
+       if( status == STATUS_SUCCESS )\r
+               status = STATUS_PENDING;\r
 \r
        AL_EXIT( AL_DBG_NDI );\r
-       return nt_status;\r
+       return status;\r
 }\r
 \r
 \r
index ad3a3bf..029f769 100644 (file)
@@ -64,7 +64,6 @@
 typedef enum _ndi_cm_state \r
 {\r
        NDI_CM_IDLE,\r
-       NDI_CM_CONNECTING_ATS_SENT, // ATS = Address Translation Service\r
        NDI_CM_CONNECTING_QPR_SENT, // QPR = Query path record\r
        NDI_CM_CONNECTING_REQ_SENT,\r
        NDI_CM_CONNECTING_REP_SENT,\r
index 7a93f77..ef1ab9a 100644 (file)
@@ -349,7 +349,7 @@ __ndi_req_cm(
                cl_status = CL_INVALID_PARAMETER;\r
                goto err;\r
        }\r
-       \r
+\r
        /* perform the ioctl */\r
        cl_status = ndi_req_cm( h_qp, h_ioctl );\r
 \r