[VNIC] memory leak in data_disconnect. added reset+pnp_dereg.Changed debug flags...
authoraestrin <aestrin@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Sun, 15 Oct 2006 00:13:46 +0000 (00:13 +0000)
committeraestrin <aestrin@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Sun, 15 Oct 2006 00:13:46 +0000 (00:13 +0000)
 Replaced cl_qlist* send_pending_list on Ndis* provided API.Some other cleanup efforts.

git-svn-id: svn://openib.tc.cornell.edu/gen1/trunk@522 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86

13 files changed:
ulp/inic/kernel/vnic_adapter.c
ulp/inic/kernel/vnic_adapter.h
ulp/inic/kernel/vnic_config.h
ulp/inic/kernel/vnic_control.c
ulp/inic/kernel/vnic_data.c
ulp/inic/kernel/vnic_data.h
ulp/inic/kernel/vnic_debug.h
ulp/inic/kernel/vnic_driver.c
ulp/inic/kernel/vnic_ib.c
ulp/inic/kernel/vnic_netpath.c
ulp/inic/kernel/vnic_trailer.h
ulp/inic/kernel/vnic_viport.c
ulp/inic/kernel/vnic_viport.h

index 624a6b1..8e6508a 100644 (file)
@@ -594,7 +594,8 @@ vnic_viport_allocate(
 \r
        KeInitializeSpinLock( &p_viport->lock );\r
        InitializeListHead( &p_viport->listPtrs );\r
-       cl_qlist_init( &p_viport->send_pending_list );\r
+       InitializeListHead( &p_viport->send_pending_list );\r
+       NdisAllocateSpinLock(&p_viport->pending_list_lock );\r
 \r
        KeInitializeEvent( &p_viport->conn_event, SynchronizationEvent, FALSE );\r
 \r
@@ -608,6 +609,8 @@ vnic_viport_allocate(
        control_construct( &p_viport->control, p_viport );\r
        data_construct( &p_viport->data, p_viport );\r
 \r
+       p_viport->ioc_num = _get_ioc_num_from_iocguid( &p_adapter->ifc_data.guid );\r
+       \r
        *pp_viport = p_viport;\r
 \r
        NdisReleaseSpinLock( &p_adapter->lock );\r
@@ -642,6 +645,8 @@ vnic_set_mcast(
 \r
        VNIC_ENTER( VNIC_DBG_MCAST );\r
 \r
+       VNIC_TRACE( VNIC_DBG_INFO,\r
+               ("MCAST COUNT to set = %d\n", mc_count));\r
        /* Copy the MC address list into the adapter. */\r
        if( mc_count )\r
        {\r
@@ -653,11 +658,11 @@ vnic_set_mcast(
        if( !p_adapter->p_currentPath->pViport )\r
                return NDIS_STATUS_SUCCESS;\r
 \r
-       p_adapter->pending_set = TRUE;\r
+       ++p_adapter->pending_set;\r
        status = viport_setMulticast( p_adapter->p_currentPath->pViport );\r
        if( status != NDIS_STATUS_PENDING )\r
        {\r
-               p_adapter->pending_set = FALSE;\r
+               --p_adapter->pending_set;\r
        }\r
 \r
        VNIC_EXIT( VNIC_DBG_MCAST );\r
@@ -896,8 +901,7 @@ __vnic_pnp_cb(
                        if( ib_status != IB_SUCCESS )\r
                        {\r
                                VNIC_TRACE( VNIC_DBG_ERROR,\r
-                                               ("Control path connect failed status s%\n",\r
-                                                                               p_adapter->ifc.get_err_str( ib_status )) );\r
+                                               ("Control connect return s%\n", p_adapter->ifc.get_err_str( ib_status )) );\r
                                vnic_viport_cleanup( p_adapter );\r
                                break;\r
                        }\r
@@ -949,15 +953,13 @@ vnic_get_adapter_interface(
        IN      NDIS_HANDLE                     h_handle,\r
        IN      vnic_adapter_t          *p_adapter)\r
 {\r
-\r
        NTSTATUS                        status;\r
        ib_al_ifc_data_t        data;\r
        IO_STACK_LOCATION       io_stack;\r
-       DEVICE_OBJECT           *p_pdo;\r
 \r
        VNIC_ENTER( VNIC_DBG_ADAPTER );\r
 \r
-       NdisMGetDeviceProperty( h_handle, &p_pdo, NULL, NULL, NULL, NULL );\r
+       NdisMGetDeviceProperty( h_handle, &p_adapter->p_pdo, NULL, NULL, NULL, NULL );\r
 \r
        data.size = sizeof(ioc_ifc_data_t);\r
        data.type = &GUID_IOC_INTERFACE_DATA;\r
@@ -971,7 +973,7 @@ vnic_get_adapter_interface(
        io_stack.Parameters.QueryInterface.InterfaceSpecificData = &data;\r
        io_stack.Parameters.QueryInterface.InterfaceType = &GUID_IB_AL_INTERFACE;\r
 \r
-       status = cl_fwd_query_ifc( p_pdo, &io_stack );\r
+       status = cl_fwd_query_ifc( p_adapter->p_pdo, &io_stack );\r
 \r
        if( !NT_SUCCESS( status ) )\r
        {\r
@@ -1005,3 +1007,104 @@ vnic_viport_cleanup(
 \r
        VNIC_EXIT( VNIC_DBG_ADAPTER );\r
 }\r
+\r
+void\r
+__vnic_pnp_dereg(\r
+       IN                      void*                   context )\r
+{\r
+       vnic_adapter_t*         p_adapter;\r
+       ib_api_status_t         ib_status;\r
+       ib_pnp_event_t          state;\r
+       ib_pnp_req_t            pnp_req;\r
+       viport_t                        *p_viport;\r
+\r
+       VNIC_ENTER( VNIC_DBG_INIT );\r
+\r
+       p_adapter = (vnic_adapter_t*)context;\r
+\r
+       CL_ASSERT( !p_adapter->h_pnp );\r
+\r
+       if( p_adapter->pnp_state != IB_PNP_IOC_REMOVE )\r
+               p_adapter->pnp_state = IB_PNP_IOC_ADD;\r
+\r
+       state = p_adapter->pnp_state;\r
+\r
+       /* Destroy the current port instance if it still exists. */\r
+       p_viport = InterlockedExchangePointer( (void *)&p_adapter->p_viport, NULL );\r
+\r
+       if( p_viport )\r
+       {\r
+               viport_cleanup( p_viport );\r
+       }\r
+\r
+       if( state != IB_PNP_IOC_REMOVE )\r
+       {\r
+               /* Register for IOC events */\r
+               pnp_req.pfn_pnp_cb = __vnic_pnp_cb;\r
+               pnp_req.pnp_class = IB_PNP_IOC | IB_PNP_FLAG_REG_SYNC;\r
+               pnp_req.pnp_context = p_adapter;\r
+\r
+               ib_status = p_adapter->ifc.reg_pnp( p_adapter->h_al, &pnp_req, &p_adapter->h_pnp );\r
+               if( ib_status != IB_SUCCESS )\r
+               {\r
+                       p_adapter->reset = FALSE;\r
+                       VNIC_TRACE( VNIC_DBG_ERROR,\r
+                                               ("pnp_reg returned %s\n",\r
+                                                               p_adapter->ifc.get_err_str( ib_status )) );\r
+                       NdisMResetComplete( \r
+                               p_adapter->h_handle, NDIS_STATUS_HARD_ERRORS, TRUE );\r
+               }\r
+       }\r
+       else\r
+       {\r
+               p_adapter->reset = FALSE;\r
+               NdisMResetComplete(\r
+                                       p_adapter->h_handle, NDIS_STATUS_SUCCESS, TRUE );\r
+               ib_status = IB_SUCCESS;\r
+       }\r
+\r
+       VNIC_EXIT( VNIC_DBG_INIT );\r
+}\r
+\r
+\r
+ib_api_status_t\r
+vnic_reset_adapter(\r
+          IN   vnic_adapter_t* const   p_adapter )\r
+{\r
+\r
+       ib_api_status_t         status;\r
+       ib_pnp_handle_t         h_pnp;\r
+       ib_pnp_req_t            pnp_req;\r
+\r
+       VNIC_ENTER( VNIC_DBG_INIT );\r
+\r
+       if( p_adapter->reset )\r
+               return IB_INVALID_STATE;\r
+\r
+       p_adapter->hung = 0;\r
+       p_adapter->reset = TRUE;\r
+\r
+       if( p_adapter->h_pnp )\r
+       {\r
+               h_pnp = p_adapter->h_pnp;\r
+               p_adapter->h_pnp  = NULL;\r
+               status = p_adapter->ifc.dereg_pnp( h_pnp, __vnic_pnp_dereg );\r
+               if( status == IB_SUCCESS )\r
+                       status = IB_NOT_DONE;\r
+       }\r
+       else\r
+       {\r
+               /* Register for IOC events */\r
+               pnp_req.pfn_pnp_cb = __vnic_pnp_cb;\r
+               pnp_req.pnp_class = IB_PNP_IOC | IB_PNP_FLAG_REG_SYNC;\r
+               pnp_req.pnp_context = p_adapter;\r
+\r
+               status = p_adapter->ifc.reg_pnp( p_adapter->h_al, &pnp_req, &p_adapter->h_pnp );\r
+               if( status == IB_SUCCESS )\r
+               {\r
+                       p_adapter->hung = FALSE;\r
+               }\r
+       }\r
+       VNIC_EXIT( VNIC_DBG_INIT );\r
+       return status;\r
+}\r
index dcb0b25..ca271ee 100644 (file)
@@ -108,7 +108,7 @@ typedef struct _vnic_params {
 typedef struct _vnic_adapter {\r
        LIST_ENTRY                              list_entry;\r
        NDIS_HANDLE                             h_handle;\r
-       PDRIVER_OBJECT                  p_drv_obj;\r
+       DEVICE_OBJECT                   *p_pdo;\r
 //     cl_obj_t                                obj;\r
        NDIS_SPIN_LOCK                  lock;\r
        ib_al_ifc_t                             ifc;\r
@@ -133,8 +133,10 @@ typedef struct _vnic_adapter {
        LONG                                    xmitStarted;\r
        LONG                                    carrier;\r
        uint32_t                                packet_filter;\r
-       BOOLEAN                                 hung;\r
-       BOOLEAN                                 pending_set;\r
+       int                                             hung;\r
+       BOOLEAN                                 reset;\r
+       //BOOLEAN                                       pending_set;\r
+       int                                             pending_set;\r
        BOOLEAN                                 pending_query;\r
        pending_oid_t                   query_oid;\r
        pending_oid_t                   set_oid;\r
@@ -213,4 +215,12 @@ ibregion_physInit(
        IN                      uint64_t                                        *p_vaddr,\r
        IN                      uint64_t                                        len );\r
 \r
+void\r
+__vnic_pnp_dereg(\r
+       IN              void*                   context );\r
+\r
+ib_api_status_t\r
+vnic_reset_adapter(\r
+       IN              vnic_adapter_t* const           p_adapter );\r
+\r
 #endif /* !defined _VNIC_ADAPTER_H_ */\r
index 9a054ca..4a91679 100644 (file)
 #define MAX_MTU                         9500 /*  max Jumbo frame payload size */\r
 #define ETH_VLAN_HLEN                   18   /* ethernet header with VLAN tag */\r
 \r
-#define HOST_RECV_POOL_ENTRIES          512  /* TBD: Abritrary */\r
+#define HOST_RECV_POOL_ENTRIES          128  /* TBD: Abritrary */\r
 #define MIN_HOST_POOL_SZ                64   /* TBD: Abritrary */\r
 #define MIN_EIOC_POOL_SZ                64   /* TBD: Abritrary */\r
-#define MAX_EIOC_POOL_SZ                256  /* TBD: Abritrary */\r
+#define MAX_EIOC_POOL_SZ                128  /* TBD: Abritrary */\r
 \r
-#define MIN_HOST_KICK_TIMEOUT           10   /* TBD: Arbitrary */\r
-#define MAX_HOST_KICK_TIMEOUT           100  /* In uSec */\r
+#define MIN_HOST_KICK_TIMEOUT           100   /* TBD: Arbitrary */\r
+#define MAX_HOST_KICK_TIMEOUT           200  /* In uSec */\r
 \r
 #define MIN_HOST_KICK_ENTRIES           1    /* TBD: Arbitrary */\r
-#define MAX_HOST_KICK_ENTRIES           128  /* TBD: Arbitrary */\r
+#define MAX_HOST_KICK_ENTRIES           64  /* TBD: Arbitrary */\r
 \r
 #define MIN_HOST_KICK_BYTES             0\r
 #define MAX_HOST_KICK_BYTES             5000\r
index 9ca242f..e6ed64f 100644 (file)
@@ -80,15 +80,6 @@ static void
 __control_logControlPacket(\r
                                        Inic_ControlPacket_t *pPkt );\r
 \r
-static inline char*\r
-control_ifcfg_name( Control_t *pControl )\r
-{\r
-       if (! pControl)\r
-               return "NCtl";\r
-       return (pControl->p_viport->p_adapter->name );\r
-}\r
-\r
-\r
 void\r
 control_construct(\r
        IN              Control_t                       *pControl,\r
@@ -145,7 +136,7 @@ control_init(
                &pControl->qp, guid, &pConfig->ibConfig );\r
        if( ib_status != IB_SUCCESS )\r
        {\r
-               VNIC_TRACE_EXIT( VNIC_DBG_ERROR, ("%s: ibqp_init returned %s\n",\r
+               VNIC_TRACE_EXIT( VNIC_DBG_ERROR, ("ibqp_init returned %s\n",\r
                        pViport->p_adapter->ifc.get_err_str( ib_status )) );\r
                goto failure;\r
        }\r
@@ -158,8 +149,7 @@ control_init(
        if ( pControl->pLocalStorage == NULL )\r
        {\r
                VNIC_TRACE_EXIT( VNIC_DBG_ERROR,\r
-                       ("%s: Failed allocating space for local storage\n",\r
-                                       control_ifcfg_name(pControl)) );\r
+                       ("Failed allocating space for local storage\n" ));\r
 \r
                ibqp_cleanup(&pControl->qp);\r
                ib_status = IB_INSUFFICIENT_MEMORY;\r
@@ -181,9 +171,9 @@ control_init(
                 * as the receive buffers. I'm doing this to combine them\r
                 * into a single region, and conserve a region.\r
                 */\r
-               VNIC_TRACE_EXIT( VNIC_DBG_ERROR|VNIC_DBG_CTRL,\r
-                                       ("%s: Failed setting up control space region\n",\r
-                                                                       control_ifcfg_name(pControl)) );\r
+               VNIC_TRACE_EXIT( VNIC_DBG_ERROR ,\r
+                                       (" Failed setting up control space region\n" ));\r
+\r
                ibqp_cleanup( &pControl->qp );\r
                cl_free( pControl->pLocalStorage );\r
                goto failure;\r
@@ -267,9 +257,9 @@ control_processAsync(
 \r
        if ( pRecvIo != NULL )\r
        {\r
-               VNIC_TRACE( VNIC_DBG_CTRL | VNIC_DBG_INFO,\r
-                               ("%s: processing info packet\n",\r
-                                               control_ifcfg_name(pControl)) );\r
+               VNIC_TRACE( VNIC_DBG_CTRL,\r
+                               ("IOC %d:  processing info packet\n",\r
+                                               pControl->p_viport->ioc_num ) );\r
        \r
                pPkt = control_packet( pRecvIo );\r
 \r
@@ -278,25 +268,23 @@ control_processAsync(
                        switch( ntoh32(pPkt->cmd.reportStatus.statusNumber) )\r
                        {\r
                        case INIC_STATUS_LINK_UP:\r
-                               VNIC_TRACE( VNIC_DBG_CTRL | VNIC_DBG_INFO,\r
-                                                       ("%s: Link Up\n",\r
-                                                                       control_ifcfg_name(pControl)) );\r
+                               VNIC_TRACE( VNIC_DBG_CTRL,\r
+                                       ("IOC %d: Link Up\n", pControl->p_viport->ioc_num ) );\r
 \r
                                viport_linkUp( pControl->p_viport );\r
                                break;\r
 \r
                        case INIC_STATUS_LINK_DOWN:\r
-                               VNIC_TRACE( VNIC_DBG_CTRL | VNIC_DBG_INFO,\r
-                                                       ("%s: Link Down\n",\r
-                                                                       control_ifcfg_name(pControl)) );\r
+                               VNIC_TRACE( VNIC_DBG_CTRL,\r
+                                       ("IOC %d: Link Down\n", pControl->p_viport->ioc_num ) );\r
 \r
                                viport_linkDown( pControl->p_viport );\r
                                break;\r
 \r
                        default:\r
                                VNIC_TRACE( VNIC_DBG_CTRL | VNIC_DBG_ERROR,\r
-                                               ("%s: Asynchronous status received from EIOC\n",\r
-                                                                       control_ifcfg_name(pControl)) );\r
+                                               ("IOC %d: Asynchronous status received from EIOC\n",\r
+                                                                        pControl->p_viport->ioc_num ) );\r
                                __control_logControlPacket( pPkt );\r
                                break;\r
                        }\r
@@ -314,17 +302,17 @@ control_processAsync(
        while ( !IsListEmpty( &pControl->failureList ) )\r
        {\r
 \r
-               VNIC_TRACE( VNIC_DBG_CTRL | VNIC_DBG_INFO,\r
-                                       ("%s: processing error packet\n",\r
-                                                               control_ifcfg_name(pControl)) );\r
+               VNIC_TRACE( VNIC_DBG_CTRL,\r
+                                       ("IOC %d: processing error packet\n",\r
+                                                                pControl->p_viport->ioc_num ) );\r
 \r
                p_list_entry = ExInterlockedRemoveHeadList( &pControl->failureList, &pControl->ioLock );\r
                pRecvIo = (RecvIo_t *)p_list_entry;\r
                pPkt = control_packet( pRecvIo );\r
 \r
-               VNIC_TRACE( VNIC_DBG_CTRL | VNIC_DBG_INFO,\r
-                                       ("%s: Asynchronous error received from EIOC\n",\r
-                                                               control_ifcfg_name(pControl)) );\r
+               VNIC_TRACE( VNIC_DBG_CTRL,\r
+                                       ("IOC %d: Asynchronous error received from EIOC\n",\r
+                                                               pControl->p_viport->ioc_num ) );\r
        \r
                __control_logControlPacket( pPkt );\r
 \r
@@ -352,7 +340,11 @@ control_initInicReq(
        ib_api_status_t                 ib_status;\r
 \r
        VNIC_ENTER( VNIC_DBG_CTRL );\r
-\r
+       \r
+       if( pControl->p_viport->errored )\r
+       {\r
+               return IB_ERROR;\r
+       }\r
        control_initHdr( pControl, CMD_INIT_INIC );\r
 \r
        pPkt                           = control_packet( &pControl->sendIo );\r
@@ -396,14 +388,14 @@ control_initInicRsp(
        {\r
        \r
                VNIC_TRACE( VNIC_DBG_CTRL | VNIC_DBG_ERROR,\r
-                                       ("%s: Sent control request:\n",\r
-                                               control_ifcfg_name(pControl)) );\r
+                       ("IOC %d: Sent control request:\n",\r
+                                               pControl->p_viport->ioc_num ) );\r
 \r
                __control_logControlPacket( control_lastReq( pControl ) );\r
 \r
                VNIC_TRACE_EXIT( VNIC_DBG_CTRL | VNIC_DBG_ERROR,\r
-                                       ("%s: Received control response:\n",\r
-                                                       control_ifcfg_name(pControl)) );\r
+                                       ("IOC %d: Received control response:\n",\r
+                                                       pControl->p_viport->ioc_num ) );\r
        \r
                __control_logControlPacket( pPkt );\r
                goto failure;\r
@@ -421,45 +413,45 @@ control_initInicRsp(
              ( pControl->minVer > INIC_MINORVERSION )) )\r
        {\r
                VNIC_TRACE_EXIT( VNIC_DBG_CTRL | VNIC_DBG_ERROR,\r
-                               ("%s: Unsupported version\n",\r
-                                               control_ifcfg_name(pControl)) );\r
+                               ("IOC %d: Unsupported version\n",\r
+                                               pControl->p_viport->ioc_num ) );\r
                goto failure;\r
        }\r
 \r
        if ( numDataPaths != 1 )\r
        {\r
                VNIC_TRACE_EXIT( VNIC_DBG_CTRL | VNIC_DBG_ERROR,\r
-                                       ("%s: EIOC returned too many datapaths\n",\r
-                                                       control_ifcfg_name(pControl)) );\r
+                                       ("IOC %d: EIOC returned too many datapaths\n",\r
+                                                       pControl->p_viport->ioc_num ) );\r
                goto failure;\r
        }\r
 \r
        if ( *pNumAddrs > p_conf->maxAddressEntries )\r
        {\r
                VNIC_TRACE_EXIT( VNIC_DBG_CTRL | VNIC_DBG_ERROR,\r
-                               ("%s: EIOC returned more Address entries than requested\n",\r
-                                               control_ifcfg_name(pControl)) );\r
+                               ("IOC %d: EIOC returned more Address entries than requested\n",\r
+                                               pControl->p_viport->ioc_num) );\r
                goto failure;\r
        }\r
        if ( *pNumAddrs < p_conf->minAddressEntries )\r
        {\r
                VNIC_TRACE_EXIT( VNIC_DBG_CTRL | VNIC_DBG_ERROR,\r
-                                       ("%s: Not enough address entries\n",\r
-                                                       control_ifcfg_name(pControl)) );\r
+                                       ("IOC %d: Not enough address entries\n",\r
+                                                       pControl->p_viport->ioc_num ) );\r
                goto failure;\r
        }\r
        if ( numLanSwitches < 1 )\r
        {\r
                VNIC_TRACE_EXIT( VNIC_DBG_CTRL | VNIC_DBG_ERROR,\r
-                                       ("%s: EIOC returned no lan switches\n",\r
-                                                       control_ifcfg_name(pControl)) );\r
+                                       ("IOC %d: EIOC returned no lan switches\n",\r
+                                                       pControl->p_viport->ioc_num ) );\r
                goto failure;\r
        }\r
        if ( numLanSwitches > 1 )\r
        {\r
                VNIC_TRACE_EXIT( VNIC_DBG_CTRL | VNIC_DBG_ERROR,\r
-                                       ("%s: EIOC returned multiple lan switches\n",\r
-                                                       control_ifcfg_name(pControl)) );\r
+                                       ("IOC %d: EIOC returned multiple lan switches\n",\r
+                                                       pControl->p_viport->ioc_num ) );\r
                goto failure;\r
        }\r
 \r
@@ -497,7 +489,11 @@ control_configDataPathReq(
        ib_api_status_t                         ib_status;\r
 \r
        VNIC_ENTER( VNIC_DBG_CTRL );\r
-\r
+       \r
+       if( pControl->p_viport->errored )\r
+       {\r
+               return IB_ERROR;\r
+       }\r
        control_initHdr( pControl, CMD_CONFIG_DATA_PATH );\r
 \r
        pPkt                            = control_packet( &pControl->sendIo );\r
@@ -539,14 +535,14 @@ control_configDataPathRsp(
        if ( pPkt->hdr.pktCmd != CMD_CONFIG_DATA_PATH )\r
        {\r
                VNIC_TRACE( VNIC_DBG_ERROR,\r
-                       ("%s: Sent control request:\n",\r
-                                       control_ifcfg_name(pControl)) );\r
+                       ("IOC %d: Sent control request:\n",\r
+                                       pControl->p_viport->ioc_num ) );\r
 \r
                __control_logControlPacket( control_lastReq( pControl ) );\r
 \r
                VNIC_TRACE( VNIC_DBG_ERROR,\r
-                       ("%s: Received control response:\n",\r
-                                               control_ifcfg_name( pControl )) );\r
+                       ("IOC %d: Received control response:\n",\r
+                                               pControl->p_viport->ioc_num ) );\r
        \r
                __control_logControlPacket( pPkt );\r
                goto failure;\r
@@ -557,8 +553,8 @@ control_configDataPathRsp(
        if ( pConfigDataPath->dataPath  != 0 )\r
        {\r
                VNIC_TRACE( VNIC_DBG_ERROR,\r
-                       ("%s: Received CMD_CONFIG_DATA_PATH response for wrong data path: %u\n",\r
-                                       control_ifcfg_name( pControl ), pConfigDataPath->dataPath) );\r
+                       ("IOC %d: Received CMD_CONFIG_DATA_PATH response for wrong data path: %u\n",\r
+                                       pControl->p_viport->ioc_num , pConfigDataPath->dataPath) );\r
                goto failure;\r
        }\r
 \r
@@ -593,6 +589,10 @@ control_exchangePoolsReq(
 \r
        VNIC_ENTER( VNIC_DBG_CTRL );\r
 \r
+       if( pControl->p_viport->errored )\r
+       {\r
+               return IB_ERROR;\r
+       }\r
        control_initHdr(pControl, CMD_EXCHANGE_POOLS );\r
 \r
        pPkt                     = control_packet( &pControl->sendIo );\r
@@ -629,14 +629,14 @@ control_exchangePoolsRsp(
        if ( pPkt->hdr.pktCmd != CMD_EXCHANGE_POOLS )\r
        {\r
                VNIC_TRACE( VNIC_DBG_ERROR,\r
-                       ("%s: Sent control request:\n",\r
-                                       control_ifcfg_name(pControl)) );\r
+                       ("IOC %d: Sent control request:\n",\r
+                                       pControl->p_viport->ioc_num ) );\r
 \r
                __control_logControlPacket( control_lastReq(pControl ) );\r
 \r
                VNIC_TRACE( VNIC_DBG_ERROR,\r
-                       ("%s: Received control response:\n",\r
-                                       control_ifcfg_name(pControl)) );\r
+                       ("IOC %d: Received control response:\n",\r
+                                       pControl->p_viport->ioc_num ) );\r
        \r
                __control_logControlPacket( pPkt );\r
                goto failure;\r
@@ -649,8 +649,8 @@ control_exchangePoolsRsp(
        if ( hton32( pExchangePools->dataPath ) != 0 )\r
        {\r
                VNIC_TRACE_EXIT( VNIC_DBG_ERROR,\r
-                       ("%s: Received CMD_EXCHANGE_POOLS response for wrong data path: %u\n",\r
-                                       control_ifcfg_name(pControl), pExchangePools->dataPath ) );\r
+                       ("IOC %d: Received CMD_EXCHANGE_POOLS response for wrong data path: %u\n",\r
+                                       pControl->p_viport->ioc_num , pExchangePools->dataPath ) );\r
                goto failure;\r
        }\r
 \r
@@ -676,7 +676,11 @@ control_configLinkReq(
        ib_api_status_t                 ib_status;\r
 \r
        VNIC_ENTER( VNIC_DBG_CTRL );\r
-\r
+       \r
+       if( pControl->p_viport->errored )\r
+       {\r
+               return IB_ERROR;\r
+       }\r
        control_initHdr( pControl, CMD_CONFIG_LINK );\r
 \r
        pPkt                         = control_packet( &pControl->sendIo );\r
@@ -745,14 +749,14 @@ control_configLinkRsp(
        if ( pPkt->hdr.pktCmd != CMD_CONFIG_LINK )\r
        {\r
                VNIC_TRACE( VNIC_DBG_ERROR,\r
-                       ("%s: Sent control request:\n",\r
-                               control_ifcfg_name( pControl )) );\r
+                       ("IOC %d: Sent control request:\n",\r
+                               pControl->p_viport->ioc_num ) );\r
 \r
                __control_logControlPacket( control_lastReq( pControl ) );\r
 \r
                VNIC_TRACE( VNIC_DBG_ERROR,\r
-                       ("%s: Received control response:\n",\r
-                                       control_ifcfg_name( pControl ))  );\r
+                       ("IOC %d: Received control response:\n",\r
+                                       pControl->p_viport->ioc_num )  );\r
        \r
                __control_logControlPacket( pPkt );\r
                goto failure;\r
@@ -796,6 +800,10 @@ control_configAddrsReq(
 \r
        VNIC_ENTER( VNIC_DBG_CTRL );\r
 \r
+       if( pControl->p_viport->errored )\r
+       {\r
+               return IB_ERROR;\r
+       }\r
        control_initHdr( pControl, CMD_CONFIG_ADDRESSES );\r
 \r
        pPkt                          = control_packet( &pControl->sendIo );\r
@@ -851,14 +859,14 @@ control_configAddrsRsp(
        if ( pPkt->hdr.pktCmd != CMD_CONFIG_ADDRESSES )\r
        {\r
                VNIC_TRACE( VNIC_DBG_ERROR,\r
-                       ("%s: Sent control request:\n",\r
-                               control_ifcfg_name( pControl )) );\r
+                       ("IOC %d: Sent control request:\n",\r
+                               pControl->p_viport->ioc_num ) );\r
 \r
                __control_logControlPacket( control_lastReq( pControl ) );\r
 \r
                VNIC_TRACE_EXIT(VNIC_DBG_ERROR,\r
-                       ("%s: Received control response:\n",\r
-                               control_ifcfg_name( pControl )) );\r
+                       ("IOC %d: Received control response:\n",\r
+                               pControl->p_viport->ioc_num ) );\r
 \r
                __control_logControlPacket( pPkt );\r
        \r
@@ -918,14 +926,14 @@ control_reportStatisticsRsp(
        if ( pPkt->hdr.pktCmd != CMD_REPORT_STATISTICS )\r
        {\r
                VNIC_TRACE(VNIC_DBG_ERROR,\r
-                       ("%s: Sent control request:\n",\r
-                                       control_ifcfg_name( pControl )) );\r
+                       ("IOC %d: Sent control request:\n",\r
+                                       pControl->p_viport->ioc_num ) );\r
 \r
                __control_logControlPacket( control_lastReq( pControl ) );\r
 \r
                VNIC_TRACE_EXIT(VNIC_DBG_ERROR,\r
-                       ("%s: Received control response:\n",\r
-                               control_ifcfg_name( pControl ) ) );\r
+                       ("IOC %d: Received control response:\n",\r
+                               pControl->p_viport->ioc_num  ) );\r
 \r
                __control_logControlPacket( pPkt );\r
        \r
@@ -998,14 +1006,14 @@ control_resetRsp(
        if ( pPkt->hdr.pktCmd != CMD_RESET )\r
        {\r
                VNIC_TRACE( VNIC_DBG_ERROR,\r
-                       ("%s: Sent control request:\n",\r
-                               control_ifcfg_name( pControl )) );\r
+                       ("IOC %d: Sent control request:\n",\r
+                               pControl->p_viport->ioc_num ) );\r
 \r
                __control_logControlPacket( control_lastReq( pControl ) );\r
        \r
                VNIC_TRACE( VNIC_DBG_ERROR,\r
-                       ("%s: Received control response:\n",\r
-                               control_ifcfg_name( pControl )) );\r
+                       ("IOC %d: Received control response:\n",\r
+                               pControl->p_viport->ioc_num ) );\r
 \r
                __control_logControlPacket( pPkt );\r
 \r
@@ -1032,7 +1040,10 @@ control_heartbeatReq(
        ib_api_status_t                 ib_status;\r
 \r
        VNIC_ENTER( VNIC_DBG_CTRL );\r
-\r
+       if( pControl->p_viport->errored )\r
+       {\r
+               return IB_ERROR;\r
+       }\r
        control_initHdr(pControl, CMD_HEARTBEAT);\r
 \r
        pPkt                      = control_packet(&pControl->sendIo);\r
@@ -1042,7 +1053,6 @@ control_heartbeatReq(
        pHeartbeatReq->hbInterval = hton32( hbInterval*1000 );\r
 \r
        ib_status = control_send( pControl );\r
-       ASSERT( ib_status == IB_SUCCESS );\r
        VNIC_EXIT( VNIC_DBG_CTRL );\r
        return ib_status;\r
 }\r
@@ -1067,14 +1077,14 @@ control_heartbeatRsp(
        if ( pPkt->hdr.pktCmd != CMD_HEARTBEAT )\r
        {\r
                VNIC_TRACE( VNIC_DBG_ERROR,\r
-                               ("%s: Sent control request:\n",\r
-                                       control_ifcfg_name(pControl)) );\r
+                               ("IOC %d: Sent control request:\n",\r
+                                       pControl->p_viport->ioc_num ) );\r
        \r
                __control_logControlPacket( control_lastReq(pControl) );\r
        \r
                VNIC_TRACE( VNIC_DBG_ERROR,\r
-                       ("%s: Received control response:\n",\r
-                                       control_ifcfg_name(pControl)) );\r
+                       ("IOC %d: Received control response:\n",\r
+                                       pControl->p_viport->ioc_num ) );\r
        \r
                __control_logControlPacket( pPkt );\r
                goto failure;\r
@@ -1118,6 +1128,10 @@ control_recvComplete(
        Inic_ControlPacket_t *pPkt = control_packet(pRecvIo);\r
        Inic_ControlHeader_t *pCHdr = &pPkt->hdr;\r
 \r
+       if( p_viport->errored )\r
+       {\r
+               return;\r
+       }\r
        switch ( pCHdr->pktType )\r
        {\r
                case TYPE_INFO:\r
@@ -1169,7 +1183,7 @@ control_recvComplete(
                break;\r
 \r
        case CMD_CONFIG_DATA_PATH:\r
-               status = control_configDataPathRsp( &p_viport->control,\r
+               status = control_configDataPathRsp( pControl,\r
                        data_hostPool( &p_viport->data ),\r
                        data_eiocPool( &p_viport->data ),\r
                        data_hostPoolMax( &p_viport->data ),\r
@@ -1212,10 +1226,16 @@ control_recvComplete(
                        if( p_viport->flags & INIC_FLAG_ENABLE_NIC )\r
                        {\r
                                InterlockedExchange( &p_viport->p_netpath->carrier, TRUE );\r
+                               /* don't indicate media state yet if in sync query */\r
+                               if( !( p_viport->updates & SYNC_QUERY ) )\r
+                               {       \r
+                                       viport_linkUp( p_viport );\r
+                               }\r
                        }\r
                        else\r
                        {\r
                                InterlockedExchange( &p_viport->p_netpath->carrier, FALSE );\r
+                               viport_linkDown( p_viport );\r
                        }\r
                        InterlockedAnd( &p_viport->updates, ~NEED_LINK_CONFIG );\r
                }\r
@@ -1236,15 +1256,19 @@ control_recvComplete(
        case CMD_CONFIG_ADDRESSES:\r
                status = control_configAddrsRsp( pControl );\r
                if( status == TRUE )\r
-               {\r
-                       if(     pControl->p_viport->addrs_query_done == 0 )\r
+               {       // need more entries to send?\r
+                       if(     p_viport->addrs_query_done == 0 )\r
                        {\r
-                               // need more entries to send\r
-                               // TODO: Handle a send failure.\r
-                               control_configAddrsReq( pControl,\r
-                                       pControl->p_viport->macAddresses,\r
-                                       pControl->p_viport->numMacAddresses,\r
-                                       &pControl->p_viport->addrs_query_done );\r
+                               if( !p_viport->errored )\r
+                               {\r
+                                       if( control_configAddrsReq( pControl,\r
+                                                       p_viport->macAddresses,\r
+                                                       p_viport->numMacAddresses,\r
+                                                       &p_viport->addrs_query_done ) != IB_SUCCESS )\r
+                                       {\r
+                                               viport_failure( p_viport );\r
+                                       }\r
+                               }\r
                                // Don't signal any waiting thread or start processing other updates.\r
                                return;\r
                        }\r
@@ -1259,7 +1283,8 @@ control_recvComplete(
                status = control_reportStatisticsRsp( pControl, &p_viport->stats );\r
                if ( status )\r
                {\r
-                       if( p_viport->stats.ethernetStatus > 0 )\r
+                       if( p_viport->stats.ethernetStatus > 0 &&\r
+                               !p_viport->errored )\r
                        {\r
                                viport_linkUp( p_viport );\r
                        }\r
@@ -1339,7 +1364,7 @@ control_send(
                InterlockedExchange((volatile LONG*)&pControl->reqOutstanding, FALSE );\r
 \r
                VNIC_TRACE( VNIC_DBG_ERROR,\r
-                       ("%s: Failed to post send\n", control_ifcfg_name(pControl)) );\r
+                       ("IOC %d: Failed to post send\n", pControl->p_viport->ioc_num ) );\r
                viport_failure( pControl->p_viport );\r
        }\r
 \r
@@ -1461,8 +1486,8 @@ control_getRsp(
                Inic_ControlHeader_t *pHdr = &pPkt->hdr;\r
 \r
                VNIC_TRACE( VNIC_DBG_CTRL| VNIC_DBG_ERROR,\r
-                               ("%s: No response received from EIOC\n",\r
-                                               control_ifcfg_name(pControl)) );\r
+                               ("IOC %d: No response received from EIOC\n",\r
+                                               pControl->p_viport->ioc_num ) );\r
 #ifdef VNIC_STATISTIC\r
                pControl->statistics.timeoutNum++;\r
 #endif /* VNIC_STATISTIC */\r
@@ -1472,8 +1497,8 @@ control_getRsp(
                if ( pControl->reqRetryCounter >= pControl->p_conf->reqRetryCount )\r
                {\r
                        VNIC_TRACE( VNIC_DBG_CTRL| VNIC_DBG_ERROR,\r
-                               ("%s: Control packet retry exceeded\n",\r
-                                               control_ifcfg_name(pControl)) );\r
+                               ("IOC %d: Control packet retry exceeded\n",\r
+                                               pControl->p_viport->ioc_num ) );\r
                        viport_failure(pControl->p_viport );\r
                }\r
                else\r
@@ -1618,43 +1643,43 @@ __control_logControlPacket(
        switch( pPkt->hdr.pktCmd  )\r
        {\r
        case CMD_INIT_INIC:\r
-               VNIC_PRINT( VNIC_DBG_CTRL_PKT | VNIC_DBG_INFO,\r
+               VNIC_PRINT( VNIC_DBG_CTRL_PKT,\r
                        ("ControlPacket: pktType = %s, pktCmd = CMD_INIT_INIC\n", type ) );\r
-               VNIC_PRINT( VNIC_DBG_CTRL| VNIC_DBG_INFO,\r
+               VNIC_PRINT( VNIC_DBG_CTRL,\r
                        ("               pktSeqNum = %u, pktRetryCount = %u\n",\r
                                                                pPkt->hdr.pktSeqNum,\r
                                                                pPkt->hdr.pktRetryCount) );\r
-               VNIC_PRINT( VNIC_DBG_CTRL_PKT | VNIC_DBG_INFO,\r
+               VNIC_PRINT( VNIC_DBG_CTRL_PKT,\r
                        ("               inicMajorVersion = %u, inicMinorVersion = %u\n",\r
                                                                ntoh16(pPkt->cmd.initInicReq.inicMajorVersion),\r
                                                                ntoh16(pPkt->cmd.initInicReq.inicMinorVersion)) );\r
                if (pPkt->hdr.pktType == TYPE_REQ)\r
                {\r
-                       VNIC_PRINT( VNIC_DBG_CTRL_PKT | VNIC_DBG_INFO,\r
+                       VNIC_PRINT( VNIC_DBG_CTRL_PKT,\r
                                ("               inicInstance = %u, numDataPaths = %u\n",\r
                               pPkt->cmd.initInicReq.inicInstance,\r
                               pPkt->cmd.initInicReq.numDataPaths) );\r
-                       VNIC_PRINT( VNIC_DBG_CTRL_PKT| VNIC_DBG_INFO,\r
+                       VNIC_PRINT( VNIC_DBG_CTRL_PKT,\r
                                ("               numAddressEntries = %u\n",\r
                                                                ntoh16(pPkt->cmd.initInicReq.numAddressEntries)) );\r
                }\r
                else\r
                {\r
-                       VNIC_PRINT( VNIC_DBG_CTRL_PKT | VNIC_DBG_INFO,\r
+                       VNIC_PRINT( VNIC_DBG_CTRL_PKT,\r
                                ("               numLanSwitches = %u, numDataPaths = %u\n",\r
                                                                pPkt->cmd.initInicRsp.numLanSwitches,\r
                                                                pPkt->cmd.initInicRsp.numDataPaths) );\r
-                       VNIC_PRINT( VNIC_DBG_CTRL_PKT | VNIC_DBG_INFO,\r
+                       VNIC_PRINT( VNIC_DBG_CTRL_PKT,\r
                                ("               numAddressEntries = %u, featuresSupported = %08x\n",\r
                                                                ntoh16(pPkt->cmd.initInicRsp.numAddressEntries),\r
                                                                ntoh32(pPkt->cmd.initInicRsp.featuresSupported)) );\r
                        if (pPkt->cmd.initInicRsp.numLanSwitches != 0)\r
                        {\r
-                               VNIC_PRINT( VNIC_DBG_CTRL_PKT | VNIC_DBG_INFO,\r
+                               VNIC_PRINT( VNIC_DBG_CTRL_PKT,\r
                                ("lanSwitch[0]  lanSwitchNum = %u, numEnetPorts = %08x\n",\r
                                       pPkt->cmd.initInicRsp.lanSwitch[0].lanSwitchNum,\r
                                       pPkt->cmd.initInicRsp.lanSwitch[0].numEnetPorts) );\r
-                               VNIC_PRINT( VNIC_DBG_CTRL_PKT | VNIC_DBG_INFO,\r
+                               VNIC_PRINT( VNIC_DBG_CTRL_PKT,\r
                                        ("               defaultVlan = %u, hwMacAddress = %02x:%02x:%02x:%02x:%02x:%02x\n",\r
                                                                ntoh16(pPkt->cmd.initInicRsp.lanSwitch[0].defaultVlan),\r
                                                                pPkt->cmd.initInicRsp.lanSwitch[0].hwMacAddress[0],\r
@@ -1667,99 +1692,99 @@ __control_logControlPacket(
                }\r
                break;\r
        case CMD_CONFIG_DATA_PATH:\r
-               VNIC_PRINT( VNIC_DBG_CTRL_PKT | VNIC_DBG_INFO,\r
+               VNIC_PRINT( VNIC_DBG_CTRL_PKT,\r
                        ( "ControlPacket: pktType = %s, pktCmd = CMD_CONFIG_DATA_PATH\n", type) );\r
-               VNIC_PRINT( VNIC_DBG_CTRL_PKT | VNIC_DBG_INFO,\r
+               VNIC_PRINT( VNIC_DBG_CTRL_PKT,\r
                        ("               pktSeqNum = %u, pktRetryCount = %u\n",\r
                                                                pPkt->hdr.pktSeqNum,\r
                                                                pPkt->hdr.pktRetryCount) );\r
-               VNIC_PRINT( VNIC_DBG_CTRL_PKT | VNIC_DBG_INFO,\r
+               VNIC_PRINT( VNIC_DBG_CTRL_PKT,\r
                        ("               pathIdentifier = %"PRIx64", dataPath = %u\n",\r
                                                        pPkt->cmd.configDataPathReq.pathIdentifier,\r
                                                        pPkt->cmd.configDataPathReq.dataPath) );\r
        \r
-               VNIC_PRINT( VNIC_DBG_CTRL_PKT | VNIC_DBG_INFO,\r
+               VNIC_PRINT( VNIC_DBG_CTRL_PKT,\r
                        ("Host Config    sizeRecvPoolEntry = %u, numRecvPoolEntries = %u\n",\r
                                        ntoh32(pPkt->cmd.configDataPathReq.hostRecvPoolConfig.sizeRecvPoolEntry),\r
                                        ntoh32(pPkt->cmd.configDataPathReq.hostRecvPoolConfig.numRecvPoolEntries)) );\r
        \r
-               VNIC_PRINT( VNIC_DBG_CTRL_PKT | VNIC_DBG_INFO,\r
+               VNIC_PRINT( VNIC_DBG_CTRL_PKT,\r
                        ("               timeoutBeforeKick = %u, numRecvPoolEntriesBeforeKick = %u\n",\r
                                        ntoh32(pPkt->cmd.configDataPathReq.hostRecvPoolConfig.timeoutBeforeKick),\r
                                        ntoh32(pPkt->cmd.configDataPathReq.hostRecvPoolConfig.numRecvPoolEntriesBeforeKick)) );\r
        \r
-               VNIC_PRINT( VNIC_DBG_CTRL_PKT | VNIC_DBG_INFO,\r
+               VNIC_PRINT( VNIC_DBG_CTRL_PKT,\r
                        ("               numRecvPoolBytesBeforeKick = %u, freeRecvPoolEntriesPerUpdate = %u\n",\r
                       ntoh32(pPkt->cmd.configDataPathReq.hostRecvPoolConfig.numRecvPoolBytesBeforeKick),\r
                       ntoh32(pPkt->cmd.configDataPathReq.hostRecvPoolConfig.freeRecvPoolEntriesPerUpdate)) );\r
 \r
-               VNIC_PRINT( VNIC_DBG_CTRL_PKT | VNIC_DBG_INFO,\r
+               VNIC_PRINT( VNIC_DBG_CTRL_PKT,\r
                        ("Eioc Config    sizeRecvPoolEntry = %u, numRecvPoolEntries = %u\n",\r
                       ntoh32(pPkt->cmd.configDataPathReq.eiocRecvPoolConfig.sizeRecvPoolEntry),\r
                       ntoh32(pPkt->cmd.configDataPathReq.eiocRecvPoolConfig.numRecvPoolEntries)) );\r
 \r
-               VNIC_PRINT( VNIC_DBG_CTRL_PKT | VNIC_DBG_INFO,\r
+               VNIC_PRINT( VNIC_DBG_CTRL_PKT,\r
                        ("               timeoutBeforeKick = %u, numRecvPoolEntriesBeforeKick = %u\n",\r
                       ntoh32(pPkt->cmd.configDataPathReq.eiocRecvPoolConfig.timeoutBeforeKick),\r
                       ntoh32(pPkt->cmd.configDataPathReq.eiocRecvPoolConfig.numRecvPoolEntriesBeforeKick)) );\r
 \r
-               VNIC_PRINT( VNIC_DBG_CTRL_PKT | VNIC_DBG_INFO,\r
+               VNIC_PRINT( VNIC_DBG_CTRL_PKT,\r
                        ("               numRecvPoolBytesBeforeKick = %u, freeRecvPoolEntriesPerUpdate = %u\n",\r
                       ntoh32(pPkt->cmd.configDataPathReq.eiocRecvPoolConfig.numRecvPoolBytesBeforeKick),\r
                       ntoh32(pPkt->cmd.configDataPathReq.eiocRecvPoolConfig.freeRecvPoolEntriesPerUpdate)) );\r
                break;\r
        case CMD_EXCHANGE_POOLS:\r
-               VNIC_PRINT( VNIC_DBG_CTRL_PKT | VNIC_DBG_INFO,\r
+               VNIC_PRINT( VNIC_DBG_CTRL_PKT,\r
                        ("ControlPacket: pktType = %s, pktCmd = CMD_EXCHANGE_POOLS\n", type ) );\r
-               VNIC_PRINT( VNIC_DBG_CTRL_PKT | VNIC_DBG_INFO,\r
+               VNIC_PRINT( VNIC_DBG_CTRL_PKT,\r
                        ("               pktSeqNum = %u, pktRetryCount = %u\n",\r
                                                        pPkt->hdr.pktSeqNum,\r
                                                        pPkt->hdr.pktRetryCount) );\r
-               VNIC_PRINT( VNIC_DBG_CTRL_PKT | VNIC_DBG_INFO,\r
+               VNIC_PRINT( VNIC_DBG_CTRL_PKT,\r
                        ("               datapath = %u\n",\r
                                                pPkt->cmd.exchangePoolsReq.dataPath) );\r
-               VNIC_PRINT( VNIC_DBG_CTRL_PKT | VNIC_DBG_INFO,\r
+               VNIC_PRINT( VNIC_DBG_CTRL_PKT,\r
                        ("               poolRKey = %08x poolAddr = %"PRIx64"\n",\r
                                                ntoh32(pPkt->cmd.exchangePoolsReq.poolRKey),\r
                                                ntoh64(pPkt->cmd.exchangePoolsReq.poolAddr)) );\r
                break;\r
        case CMD_CONFIG_ADDRESSES:\r
-               VNIC_PRINT( VNIC_DBG_CTRL_PKT | VNIC_DBG_INFO,\r
+               VNIC_PRINT( VNIC_DBG_CTRL_PKT,\r
                        ( "ControlPacket: pktType = %s, pktCmd = CMD_CONFIG_ADDRESSES\n", type ) );\r
-               VNIC_PRINT( VNIC_DBG_CTRL_PKT | VNIC_DBG_INFO,\r
+               VNIC_PRINT( VNIC_DBG_CTRL_PKT,\r
                        ("               pktSeqNum = %u, pktRetryCount = %u\n",\r
                                                        pPkt->hdr.pktSeqNum,\r
                                                        pPkt->hdr.pktRetryCount) );\r
-               VNIC_PRINT( VNIC_DBG_CTRL_PKT | VNIC_DBG_INFO,\r
+               VNIC_PRINT( VNIC_DBG_CTRL_PKT,\r
                        ("               numAddressOps = %x, lanSwitchNum = %d\n",\r
                                                        pPkt->cmd.configAddressesReq.numAddressOps,\r
                                                        pPkt->cmd.configAddressesReq.lanSwitchNum) );\r
                for (i = 0; ( i < pPkt->cmd.configAddressesReq.numAddressOps) && (i < 16); i++)\r
                {\r
-                       VNIC_PRINT( VNIC_DBG_CTRL_PKT | VNIC_DBG_INFO,\r
+                       VNIC_PRINT( VNIC_DBG_CTRL_PKT,\r
                                ("               listAddressOps[%u].index = %u\n",\r
                                        i, ntoh16(pPkt->cmd.configAddressesReq.listAddressOps[i].index)) );\r
                       \r
                        switch(pPkt->cmd.configAddressesReq.listAddressOps[i].operation)\r
                        {\r
                        case INIC_OP_GET_ENTRY:\r
-                               VNIC_PRINT( VNIC_DBG_CTRL_PKT | VNIC_DBG_INFO,\r
+                               VNIC_PRINT( VNIC_DBG_CTRL_PKT,\r
                                        ("               listAddressOps[%u].operation = INIC_OP_GET_ENTRY\n", i) );\r
                                break;\r
                        case INIC_OP_SET_ENTRY:\r
-                               VNIC_PRINT( VNIC_DBG_CTRL_PKT | VNIC_DBG_INFO,\r
+                               VNIC_PRINT( VNIC_DBG_CTRL_PKT,\r
                                        ("               listAddressOps[%u].operation = INIC_OP_SET_ENTRY\n", i) );\r
                                break;\r
                        default:\r
-                               VNIC_PRINT( VNIC_DBG_CTRL_PKT | VNIC_DBG_INFO,\r
+                               VNIC_PRINT( VNIC_DBG_CTRL_PKT,\r
                                        ("               listAddressOps[%u].operation = UNKNOWN(%d)\n",\r
                                       i, pPkt->cmd.configAddressesReq.listAddressOps[i].operation) );\r
                                break;\r
                        }\r
-                       VNIC_PRINT( VNIC_DBG_CTRL_PKT | VNIC_DBG_INFO,\r
+                       VNIC_PRINT( VNIC_DBG_CTRL_PKT,\r
                                ("               listAddressOps[%u].valid = %u\n",\r
                               i, pPkt->cmd.configAddressesReq.listAddressOps[i].valid) );\r
-                       VNIC_PRINT( VNIC_DBG_CTRL_PKT | VNIC_DBG_INFO,\r
+                       VNIC_PRINT( VNIC_DBG_CTRL_PKT,\r
                                ("               listAddressOps[%u].address = %02x:%02x:%02x:%02x:%02x:%02x\n", i,\r
                                        pPkt->cmd.configAddressesReq.listAddressOps[i].address[0],\r
                                        pPkt->cmd.configAddressesReq.listAddressOps[i].address[1],\r
@@ -1768,56 +1793,56 @@ __control_logControlPacket(
                                        pPkt->cmd.configAddressesReq.listAddressOps[i].address[4],\r
                                        pPkt->cmd.configAddressesReq.listAddressOps[i].address[5]) );\r
 \r
-                       VNIC_PRINT( VNIC_DBG_CTRL_PKT | VNIC_DBG_INFO,\r
+                       VNIC_PRINT( VNIC_DBG_CTRL_PKT,\r
                                ("               listAddressOps[%u].vlan = %u\n",\r
                               i, ntoh16(pPkt->cmd.configAddressesReq.listAddressOps[i].vlan)) );\r
                }\r
                break;\r
        case CMD_CONFIG_LINK:\r
-               VNIC_PRINT( VNIC_DBG_CTRL_PKT | VNIC_DBG_INFO,\r
+               VNIC_PRINT( VNIC_DBG_CTRL_PKT,\r
                        ("ControlPacket: pktType = %s, pktCmd = CMD_CONFIG_LINK\n", type) );\r
-               VNIC_PRINT( VNIC_DBG_CTRL_PKT | VNIC_DBG_INFO,\r
+               VNIC_PRINT( VNIC_DBG_CTRL_PKT,\r
                        ("               pktSeqNum = %u, pktRetryCount = %u\n",\r
                       pPkt->hdr.pktSeqNum,\r
                       pPkt->hdr.pktRetryCount) );\r
-               VNIC_PRINT( VNIC_DBG_CTRL_PKT | VNIC_DBG_INFO,\r
+               VNIC_PRINT( VNIC_DBG_CTRL_PKT,\r
                        ("               cmdFlags = %x\n",\r
                       pPkt->cmd.configLinkReq.cmdFlags) );\r
 \r
                if ( pPkt->cmd.configLinkReq.cmdFlags & INIC_FLAG_ENABLE_NIC )\r
-                       VNIC_PRINT( VNIC_DBG_CTRL_PKT | VNIC_DBG_INFO,\r
+                       VNIC_PRINT( VNIC_DBG_CTRL_PKT,\r
                                ("                       INIC_FLAG_ENABLE_NIC\n") );\r
 \r
                if ( pPkt->cmd.configLinkReq.cmdFlags & INIC_FLAG_DISABLE_NIC )\r
        \r
-                       VNIC_PRINT( VNIC_DBG_CTRL_PKT | VNIC_DBG_INFO,\r
+                       VNIC_PRINT( VNIC_DBG_CTRL_PKT,\r
                                ("                       INIC_FLAG_DISABLE_NIC\n") );\r
 \r
                if ( pPkt->cmd.configLinkReq.cmdFlags & INIC_FLAG_ENABLE_MCAST_ALL )\r
-                       VNIC_PRINT( VNIC_DBG_CTRL_PKT | VNIC_DBG_INFO,\r
+                       VNIC_PRINT( VNIC_DBG_CTRL_PKT,\r
                                ("                       INIC_FLAG_ENABLE_MCAST_ALL\n") );\r
 \r
                if ( pPkt->cmd.configLinkReq.cmdFlags & INIC_FLAG_DISABLE_MCAST_ALL )\r
-                       VNIC_PRINT( VNIC_DBG_CTRL_PKT | VNIC_DBG_INFO,\r
+                       VNIC_PRINT( VNIC_DBG_CTRL_PKT,\r
                                ("                       INIC_FLAG_DISABLE_MCAST_ALL\n") );\r
 \r
                if ( pPkt->cmd.configLinkReq.cmdFlags & INIC_FLAG_ENABLE_PROMISC )\r
-                       VNIC_PRINT( VNIC_DBG_CTRL_PKT | VNIC_DBG_INFO,\r
+                       VNIC_PRINT( VNIC_DBG_CTRL_PKT,\r
                                ("                       INIC_FLAG_ENABLE_PROMISC\n") );\r
        \r
                if ( pPkt->cmd.configLinkReq.cmdFlags & INIC_FLAG_DISABLE_PROMISC )\r
-                       VNIC_PRINT( VNIC_DBG_CTRL_PKT | VNIC_DBG_INFO,\r
+                       VNIC_PRINT( VNIC_DBG_CTRL_PKT,\r
                                ("                       INIC_FLAG_DISABLE_PROMISC\n") );\r
                if ( pPkt->cmd.configLinkReq.cmdFlags & INIC_FLAG_SET_MTU )\r
-                       VNIC_PRINT( VNIC_DBG_CTRL_PKT | VNIC_DBG_INFO,\r
+                       VNIC_PRINT( VNIC_DBG_CTRL_PKT,\r
                                ("                       INIC_FLAG_SET_MTU\n") );\r
-               VNIC_PRINT( VNIC_DBG_CTRL_PKT | VNIC_DBG_INFO,\r
+               VNIC_PRINT( VNIC_DBG_CTRL_PKT,\r
                                ("               lanSwitchNum = %x, mtuSize = %d\n",\r
                                                pPkt->cmd.configLinkReq.lanSwitchNum,\r
                                                ntoh16(pPkt->cmd.configLinkReq.mtuSize)) );\r
                if ( pPkt->hdr.pktType == TYPE_RSP )\r
                {\r
-                       VNIC_PRINT( VNIC_DBG_CTRL_PKT | VNIC_DBG_INFO,\r
+                       VNIC_PRINT( VNIC_DBG_CTRL_PKT,\r
                                ("               defaultVlan = %u, hwMacAddress = %02x:%02x:%02x:%02x:%02x:%02x\n",\r
                                ntoh16(pPkt->cmd.configLinkReq.defaultVlan),\r
                                pPkt->cmd.configLinkReq.hwMacAddress[0],\r
@@ -1829,148 +1854,148 @@ __control_logControlPacket(
                }\r
                break;\r
        case CMD_REPORT_STATISTICS:\r
-               VNIC_PRINT( VNIC_DBG_CTRL_PKT | VNIC_DBG_INFO,\r
+               VNIC_PRINT( VNIC_DBG_CTRL_PKT,\r
                        ("ControlPacket: pktType = %s, pktCmd = CMD_REPORT_STATISTICS\n", type ) );\r
-               VNIC_PRINT( VNIC_DBG_CTRL_PKT | VNIC_DBG_INFO,\r
+               VNIC_PRINT( VNIC_DBG_CTRL_PKT,\r
                        ("               pktSeqNum = %u, pktRetryCount = %u\n",\r
                        pPkt->hdr.pktSeqNum,\r
                        pPkt->hdr.pktRetryCount) );\r
-               VNIC_PRINT( VNIC_DBG_CTRL_PKT | VNIC_DBG_INFO,\r
+               VNIC_PRINT( VNIC_DBG_CTRL_PKT,\r
                        ("               lanSwitchNum = %u\n",\r
                        pPkt->cmd.reportStatisticsReq.lanSwitchNum) );\r
 \r
                if (pPkt->hdr.pktType == TYPE_REQ)\r
                        break;\r
-               VNIC_PRINT( VNIC_DBG_CTRL_PKT | VNIC_DBG_INFO,\r
+               VNIC_PRINT( VNIC_DBG_CTRL_PKT,\r
                        ("               ifInBroadcastPkts = %"PRIu64,\r
                        ntoh64(pPkt->cmd.reportStatisticsRsp.ifInBroadcastPkts)) );\r
-               VNIC_PRINT( VNIC_DBG_CTRL_PKT | VNIC_DBG_INFO,\r
+               VNIC_PRINT( VNIC_DBG_CTRL_PKT,\r
                        (" ifInMulticastPkts = %"PRIu64"\n",\r
                        ntoh64(pPkt->cmd.reportStatisticsRsp.ifInMulticastPkts)) );\r
-               VNIC_PRINT( VNIC_DBG_CTRL_PKT | VNIC_DBG_INFO,\r
+               VNIC_PRINT( VNIC_DBG_CTRL_PKT,\r
                        ("               ifInOctets = %"PRIu64,\r
                        ntoh64(pPkt->cmd.reportStatisticsRsp.ifInOctets)) );\r
-               VNIC_PRINT( VNIC_DBG_CTRL_PKT | VNIC_DBG_INFO,\r
+               VNIC_PRINT( VNIC_DBG_CTRL_PKT,\r
                        (" ifInUcastPkts = %"PRIu64"\n",\r
                        ntoh64(pPkt->cmd.reportStatisticsRsp.ifInUcastPkts)) );\r
-               VNIC_PRINT( VNIC_DBG_CTRL_PKT | VNIC_DBG_INFO,\r
+               VNIC_PRINT( VNIC_DBG_CTRL_PKT,\r
                        ("               ifInNUcastPkts = %"PRIu64,\r
                        ntoh64(pPkt->cmd.reportStatisticsRsp.ifInNUcastPkts)) );\r
-               VNIC_PRINT( VNIC_DBG_CTRL_PKT | VNIC_DBG_INFO,\r
+               VNIC_PRINT( VNIC_DBG_CTRL_PKT,\r
                        (" ifInUnderrun = %"PRIu64"\n",\r
                        ntoh64(pPkt->cmd.reportStatisticsRsp.ifInUnderrun)) );\r
-               VNIC_PRINT( VNIC_DBG_CTRL_PKT | VNIC_DBG_INFO,\r
+               VNIC_PRINT( VNIC_DBG_CTRL_PKT,\r
                        ("               ifInErrors = %"PRIu64,\r
                        ntoh64(pPkt->cmd.reportStatisticsRsp.ifInErrors)) );\r
-               VNIC_PRINT( VNIC_DBG_CTRL_PKT | VNIC_DBG_INFO,\r
+               VNIC_PRINT( VNIC_DBG_CTRL_PKT,\r
                        (" ifOutErrors = %"PRIu64"\n",\r
                        ntoh64(pPkt->cmd.reportStatisticsRsp.ifOutErrors)) );\r
-               VNIC_PRINT( VNIC_DBG_CTRL_PKT | VNIC_DBG_INFO,\r
+               VNIC_PRINT( VNIC_DBG_CTRL_PKT,\r
                        ("               ifOutOctets = %"PRIu64,\r
                        ntoh64(pPkt->cmd.reportStatisticsRsp.ifOutOctets)) );\r
-               VNIC_PRINT( VNIC_DBG_CTRL_PKT | VNIC_DBG_INFO,\r
+               VNIC_PRINT( VNIC_DBG_CTRL_PKT,\r
                        (" ifOutUcastPkts = %"PRIu64"\n",\r
                        ntoh64(pPkt->cmd.reportStatisticsRsp.ifOutUcastPkts)) );\r
-               VNIC_PRINT( VNIC_DBG_CTRL_PKT | VNIC_DBG_INFO,\r
+               VNIC_PRINT( VNIC_DBG_CTRL_PKT,\r
                        ("               ifOutMulticastPkts = %"PRIu64,\r
                        ntoh64(pPkt->cmd.reportStatisticsRsp.ifOutMulticastPkts)) );\r
-               VNIC_PRINT( VNIC_DBG_CTRL_PKT | VNIC_DBG_INFO,\r
+               VNIC_PRINT( VNIC_DBG_CTRL_PKT,\r
                        (" ifOutBroadcastPkts = %"PRIu64"\n",\r
                        ntoh64(pPkt->cmd.reportStatisticsRsp.ifOutBroadcastPkts)) );\r
-               VNIC_PRINT( VNIC_DBG_CTRL_PKT | VNIC_DBG_INFO,\r
+               VNIC_PRINT( VNIC_DBG_CTRL_PKT,\r
                        ("               ifOutNUcastPkts = %"PRIu64,\r
                        ntoh64(pPkt->cmd.reportStatisticsRsp.ifOutNUcastPkts)) );\r
-               VNIC_PRINT( VNIC_DBG_CTRL_PKT | VNIC_DBG_INFO,\r
+               VNIC_PRINT( VNIC_DBG_CTRL_PKT,\r
                        (" ifOutOk = %"PRIu64"\n",\r
                        ntoh64(pPkt->cmd.reportStatisticsRsp.ifOutOk)) );\r
-               VNIC_PRINT( VNIC_DBG_CTRL_PKT | VNIC_DBG_INFO,\r
+               VNIC_PRINT( VNIC_DBG_CTRL_PKT,\r
                        ("               ifInOk = %"PRIu64,\r
                        ntoh64(pPkt->cmd.reportStatisticsRsp.ifInOk)) );\r
-               VNIC_PRINT( VNIC_DBG_CTRL_PKT | VNIC_DBG_INFO,\r
+               VNIC_PRINT( VNIC_DBG_CTRL_PKT,\r
                        (" ifOutUcastBytes = %"PRIu64"\n",\r
                        ntoh64(pPkt->cmd.reportStatisticsRsp.ifOutUcastBytes)) );\r
-               VNIC_PRINT( VNIC_DBG_CTRL_PKT | VNIC_DBG_INFO,\r
+               VNIC_PRINT( VNIC_DBG_CTRL_PKT,\r
                        ("               ifOutMulticastBytes = %"PRIu64,\r
                        ntoh64(pPkt->cmd.reportStatisticsRsp.ifOutMulticastBytes)) );\r
-               VNIC_PRINT( VNIC_DBG_CTRL_PKT | VNIC_DBG_INFO,\r
+               VNIC_PRINT( VNIC_DBG_CTRL_PKT,\r
                        (" ifOutBroadcastBytes = %"PRIu64"\n",\r
                        ntoh64(pPkt->cmd.reportStatisticsRsp.ifOutBroadcastBytes)) );\r
-               VNIC_PRINT( VNIC_DBG_CTRL_PKT | VNIC_DBG_INFO,\r
+               VNIC_PRINT( VNIC_DBG_CTRL_PKT,\r
                        ("               ifInUcastBytes = %"PRIu64,\r
                        ntoh64(pPkt->cmd.reportStatisticsRsp.ifInUcastBytes)) );\r
-               VNIC_PRINT( VNIC_DBG_CTRL_PKT | VNIC_DBG_INFO,\r
+               VNIC_PRINT( VNIC_DBG_CTRL_PKT,\r
                        (" ifInMulticastBytes = %"PRIu64"\n",\r
                        ntoh64(pPkt->cmd.reportStatisticsRsp.ifInMulticastBytes)) );\r
-               VNIC_PRINT( VNIC_DBG_CTRL_PKT | VNIC_DBG_INFO,\r
+               VNIC_PRINT( VNIC_DBG_CTRL_PKT,\r
                        ("               ifInBroadcastBytes = %"PRIu64,\r
                        ntoh64(pPkt->cmd.reportStatisticsRsp.ifInBroadcastBytes)) );\r
-               VNIC_PRINT( VNIC_DBG_CTRL_PKT | VNIC_DBG_INFO,\r
+               VNIC_PRINT( VNIC_DBG_CTRL_PKT,\r
                        (" ethernetStatus = %"PRIu64"\n",\r
                        ntoh64(pPkt->cmd.reportStatisticsRsp.ethernetStatus)) );\r
                break;\r
        case CMD_CLEAR_STATISTICS:\r
-               VNIC_PRINT( VNIC_DBG_CTRL_PKT | VNIC_DBG_INFO,\r
+               VNIC_PRINT( VNIC_DBG_CTRL_PKT,\r
                        ("ControlPacket: pktType = %s, pktCmd = CMD_CLEAR_STATISTICS\n", type ) );\r
-               VNIC_PRINT( VNIC_DBG_CTRL_PKT | VNIC_DBG_INFO,\r
+               VNIC_PRINT( VNIC_DBG_CTRL_PKT,\r
                        ("               pktSeqNum = %u, pktRetryCount = %u\n",\r
                        pPkt->hdr.pktSeqNum,\r
                        pPkt->hdr.pktRetryCount) );\r
                break;\r
        case CMD_REPORT_STATUS:\r
-               VNIC_PRINT( VNIC_DBG_CTRL_PKT | VNIC_DBG_INFO,\r
+               VNIC_PRINT( VNIC_DBG_CTRL_PKT,\r
                        ("ControlPacket: pktType = %s, pktCmd = CMD_REPORT_STATUS\n",\r
                        type) );\r
-               VNIC_PRINT( VNIC_DBG_CTRL_PKT | VNIC_DBG_INFO,\r
+               VNIC_PRINT( VNIC_DBG_CTRL_PKT,\r
                        ("               pktSeqNum = %u, pktRetryCount = %u\n",\r
                        pPkt->hdr.pktSeqNum,\r
                        pPkt->hdr.pktRetryCount) );\r
-               VNIC_PRINT( VNIC_DBG_CTRL_PKT | VNIC_DBG_INFO,\r
+               VNIC_PRINT( VNIC_DBG_CTRL_PKT,\r
                        ("               lanSwitchNum = %u, isFatal = %u\n",\r
                        pPkt->cmd.reportStatus.lanSwitchNum,\r
                        pPkt->cmd.reportStatus.isFatal) );\r
-               VNIC_PRINT( VNIC_DBG_CTRL_PKT | VNIC_DBG_INFO,\r
+               VNIC_PRINT( VNIC_DBG_CTRL_PKT,\r
                        ("               statusNumber = %u, statusInfo = %u\n",\r
                        ntoh32(pPkt->cmd.reportStatus.statusNumber),\r
                        ntoh32(pPkt->cmd.reportStatus.statusInfo)) );\r
                pPkt->cmd.reportStatus.fileName[31] = '\0';\r
                pPkt->cmd.reportStatus.routine[31] = '\0';\r
-               VNIC_PRINT( VNIC_DBG_CTRL_PKT | VNIC_DBG_INFO,\r
+               VNIC_PRINT( VNIC_DBG_CTRL_PKT,\r
                        ("               filename = %s, routine = %s\n",\r
                        pPkt->cmd.reportStatus.fileName,\r
                        pPkt->cmd.reportStatus.routine) );\r
-               VNIC_PRINT( VNIC_DBG_CTRL_PKT | VNIC_DBG_INFO,\r
+               VNIC_PRINT( VNIC_DBG_CTRL_PKT,\r
                        ("               lineNum = %u, errorParameter = %u\n",\r
                        ntoh32(pPkt->cmd.reportStatus.lineNum),\r
                        ntoh32(pPkt->cmd.reportStatus.errorParameter)) );\r
                pPkt->cmd.reportStatus.descText[127] = '\0';\r
-               VNIC_PRINT( VNIC_DBG_CTRL_PKT | VNIC_DBG_INFO,\r
+               VNIC_PRINT( VNIC_DBG_CTRL_PKT,\r
                        ("               descText = %s\n",\r
                        pPkt->cmd.reportStatus.descText) );\r
                break;\r
        case CMD_RESET:\r
-               VNIC_PRINT( VNIC_DBG_CTRL_PKT | VNIC_DBG_INFO,\r
+               VNIC_PRINT( VNIC_DBG_CTRL_PKT,\r
                        ("ControlPacket: pktType = %s, pktCmd = CMD_RESET\n", type ) );\r
-               VNIC_PRINT( VNIC_DBG_CTRL_PKT | VNIC_DBG_INFO,\r
+               VNIC_PRINT( VNIC_DBG_CTRL_PKT,\r
                        ("               pktSeqNum = %u, pktRetryCount = %u\n",\r
                        pPkt->hdr.pktSeqNum,\r
                        pPkt->hdr.pktRetryCount) );\r
                break;\r
        case CMD_HEARTBEAT:\r
-               VNIC_PRINT( VNIC_DBG_CTRL_PKT | VNIC_DBG_INFO,\r
+               VNIC_PRINT( VNIC_DBG_CTRL_PKT,\r
                        ("ControlPacket: pktType = %s, pktCmd = CMD_HEARTBEAT\n", type ) );\r
-               VNIC_PRINT( VNIC_DBG_CTRL_PKT | VNIC_DBG_INFO,\r
+               VNIC_PRINT( VNIC_DBG_CTRL_PKT,\r
                        ("               pktSeqNum = %u, pktRetryCount = %u\n",\r
                        pPkt->hdr.pktSeqNum,\r
                        pPkt->hdr.pktRetryCount) );\r
-               VNIC_PRINT( VNIC_DBG_CTRL_PKT | VNIC_DBG_INFO,\r
+               VNIC_PRINT( VNIC_DBG_CTRL_PKT,\r
                        ("               hbInterval = %d\n",\r
                        ntoh32(pPkt->cmd.heartbeatReq.hbInterval)) );\r
                break;\r
        default:\r
-               VNIC_PRINT( VNIC_DBG_CTRL_PKT | VNIC_DBG_INFO,\r
+               VNIC_PRINT( VNIC_DBG_CTRL_PKT,\r
                        ("ControlPacket: pktType = %s, pktCmd = UNKNOWN (%u)\n",\r
                        type,pPkt->hdr.pktCmd) );\r
-               VNIC_PRINT( VNIC_DBG_CTRL_PKT | VNIC_DBG_INFO,\r
+               VNIC_PRINT( VNIC_DBG_CTRL_PKT,\r
                        ("               pktSeqNum = %u, pktRetryCount = %u\n",\r
                        pPkt->hdr.pktSeqNum,\r
                        pPkt->hdr.pktRetryCount) );\r
index 66f6037..a3706bc 100644 (file)
@@ -101,7 +101,7 @@ data_construct(
        IN              Data_t                  *pData,\r
        IN              viport_t                *pViport )\r
 {\r
-       VNIC_ENTER( VNIC_DBG_DATA | VNIC_DBG_INFO );\r
+       VNIC_ENTER( VNIC_DBG_DATA );\r
 \r
        RtlZeroMemory( pData, sizeof(*pData) );\r
 \r
@@ -114,7 +114,7 @@ data_construct(
 \r
        ibqp_construct( &pData->qp, pViport );\r
 \r
-       VNIC_EXIT( VNIC_DBG_DATA | VNIC_DBG_INFO );\r
+       VNIC_EXIT( VNIC_DBG_DATA );\r
 }\r
 \r
 \r
@@ -126,7 +126,7 @@ data_init(
 {\r
        ib_api_status_t ib_status;\r
 \r
-       VNIC_ENTER( VNIC_DBG_DATA | VNIC_DBG_INFO );\r
+       VNIC_ENTER( VNIC_DBG_DATA );\r
 \r
        ASSERT( pData->p_viport != NULL );\r
        pData->p_conf = p_conf;\r
@@ -137,7 +137,7 @@ data_init(
        if( ib_status != IB_SUCCESS )\r
                VNIC_TRACE( VNIC_DBG_ERROR, ("data ibqp_init failed\n") );\r
 \r
-       VNIC_EXIT( VNIC_DBG_DATA | VNIC_DBG_INFO );\r
+       VNIC_EXIT( VNIC_DBG_DATA );\r
        return ib_status;\r
 }\r
 \r
@@ -158,7 +158,7 @@ data_connect(
        int               sz, regionSz;\r
        unsigned int      i, j;\r
 \r
-       VNIC_ENTER( VNIC_DBG_DATA | VNIC_DBG_INFO );\r
+       VNIC_ENTER( VNIC_DBG_DATA );\r
 \r
        pRecvPool->poolSz           = pData->p_conf->hostRecvPoolEntries;\r
        pRecvPool->eiocPoolSz       = pData->hostPoolParms.numRecvPoolEntries;\r
@@ -299,6 +299,8 @@ data_connect(
                                                                                sz, 'fubr');\r
        if( status != NDIS_STATUS_SUCCESS )\r
        {\r
+               VNIC_TRACE_EXIT( VNIC_DBG_ERROR,\r
+                               ("Allocate recv buffers failed\n"));\r
                ib_status = IB_INSUFFICIENT_MEMORY;\r
                goto err3;\r
        }\r
@@ -351,13 +353,6 @@ data_connect(
 \r
        for ( i = 0; i < pRecvPool->poolSz; i++ )\r
        {\r
-               /* Allocate a region for each possible receive\r
-                * buffer. Make sure each is large enough for\r
-                * the maximum packet size, but initially point\r
-                * each to a random piece of memory. As buffers\r
-                * are allocated, the region will be modified to\r
-                * reflect the memory space of the actual buffers.\r
-                */\r
                pRdmaDest = &pRecvPool->pRecvBufs[i];\r
                pRdmaDest->data = pData->p_recv_bufs + (i * pRecvPool->bufferSz );\r
                pRdmaDest->region = pData->rbuf_region;\r
@@ -394,8 +389,10 @@ data_connect(
                        pData->p_viport->p_adapter->ifc.get_err_str( ib_status )) );\r
 err7:\r
                NdisFreeBufferPool( pData->h_recv_buf_pool );\r
+               pData->h_recv_buf_pool = NULL;\r
 err6:\r
                NdisFreePacketPool( pData->h_recv_pkt_pool );\r
+               pData->h_recv_pkt_pool = NULL;\r
 err5:\r
                ibregion_cleanup( pData->p_viport, &pData->rbuf_region );\r
 err4:\r
@@ -410,7 +407,7 @@ err1:
                pRecvPool->poolSz = 0;\r
        }\r
 \r
-       VNIC_EXIT( VNIC_DBG_DATA | VNIC_DBG_INFO );\r
+       VNIC_EXIT( VNIC_DBG_DATA );\r
        return ib_status;\r
 }\r
 \r
@@ -419,7 +416,7 @@ void
 data_connected(\r
                IN              Data_t          *pData )\r
 {\r
-       VNIC_ENTER( VNIC_DBG_DATA | VNIC_DBG_INFO );\r
+       VNIC_ENTER( VNIC_DBG_DATA );\r
 \r
        pData->freeBufsIo.io.wrq.remote_ops.rkey =\r
                                                        pData->recvPool.eiocRdmaRkey;\r
@@ -428,7 +425,7 @@ data_connected(
        _data_sendFreeRecvBuffers(pData);\r
        pData->connected = TRUE;\r
 \r
-       VNIC_EXIT( VNIC_DBG_DATA | VNIC_DBG_INFO );\r
+       VNIC_EXIT( VNIC_DBG_DATA );\r
        return;\r
 }\r
 \r
@@ -439,43 +436,45 @@ data_disconnect(
        RecvPool_t *pRecvPool = &pData->recvPool;\r
        viport_t        *p_viport = pData->p_viport;\r
        NDIS_PACKET             *p_packet;\r
-       cl_list_item_t  *p_list_item;\r
+       LIST_ENTRY              *p_list_item;\r
        unsigned int        i;\r
 \r
-       VNIC_ENTER( VNIC_DBG_DATA | VNIC_DBG_INFO );\r
+       VNIC_ENTER( VNIC_DBG_DATA );\r
 \r
-       pData->connected = FALSE;\r
        _data_kickTimer_stop ( pData );\r
 \r
+       pData->connected = FALSE;\r
+\r
        ibqp_detach( &pData->qp );\r
 \r
-       ibregion_cleanup( pData->p_viport, &pData->rbuf_region );\r
-       ibregion_cleanup( pData->p_viport, &pData->region );\r
+       ibregion_cleanup( p_viport, &pData->rbuf_region );\r
+       ibregion_cleanup( p_viport, &pData->region );\r
 \r
        for ( i = 0; i < pRecvPool->poolSz; i++ )\r
        {\r
                p_packet = pRecvPool->pRecvBufs[i].p_packet;\r
-               pRecvPool->pRecvBufs[i].p_packet = NULL;\r
-\r
                if ( p_packet != NULL )\r
                {\r
+                       pRecvPool->pRecvBufs[i].p_packet = NULL;\r
                        _data_return_recv( p_packet );\r
                }\r
        }\r
        /* clear pending queue if any */\r
-       if( cl_qlist_count( &p_viport->send_pending_list ) )\r
+       while( ( p_list_item = NdisInterlockedRemoveHeadList(\r
+               &p_viport->send_pending_list,\r
+               &p_viport->pending_list_lock )) != NULL )\r
        {\r
-               for( p_list_item = cl_qlist_remove_head( &p_viport->send_pending_list );\r
-                       p_list_item != cl_qlist_end( &p_viport->send_pending_list );\r
-                       p_list_item = cl_qlist_remove_head( &p_viport->send_pending_list ) )\r
+               p_packet = VNIC_PACKET_FROM_LIST_ITEM( p_list_item );\r
+               if ( p_packet )\r
                {\r
-                       p_packet = VNIC_PACKET_FROM_LIST_ITEM( p_list_item );\r
-                       NdisMSendComplete( pData->p_viport->p_adapter->h_handle,\r
-                                                               p_packet, NDIS_STATUS_RESET_IN_PROGRESS );\r
+                       NDIS_SET_PACKET_STATUS( p_packet, NDIS_STATUS_FAILURE );\r
+                       NdisMSendComplete( p_viport->p_adapter->h_handle,\r
+                               p_packet, NDIS_STATUS_FAILURE );\r
+                       p_viport->stats.ifOutErrors++;\r
                }\r
        }\r
 \r
-       VNIC_EXIT( VNIC_DBG_DATA | VNIC_DBG_INFO );\r
+       VNIC_EXIT( VNIC_DBG_DATA );\r
        return;\r
 }\r
 \r
@@ -497,7 +496,7 @@ data_xmitPacket(
        uint32_t                i;\r
        PHYSICAL_ADDRESS phy_addr;\r
 \r
-       VNIC_ENTER( VNIC_DBG_DATA | VNIC_DBG_INFO );\r
+       VNIC_ENTER( VNIC_DBG_DATA );\r
 \r
        if( !data_allocXmitBuffer( pData, &pBpe, &pRdmaIo, &last ) )\r
        {\r
@@ -516,7 +515,6 @@ data_xmitPacket(
                                                                        &buf_len,\r
                                                                        &pRdmaIo->packet_sz,\r
                                                                        NormalPagePriority );\r
-\r
        if( pRdmaIo->packet_sz > p_xmitPool->bufferSz )\r
        {\r
                VNIC_TRACE_EXIT( VNIC_DBG_ERROR,\r
@@ -526,7 +524,7 @@ data_xmitPacket(
 \r
        if ( p_sgl->NumberOfElements > (ULONG)MAX_NUM_SGE - 1 )\r
        {\r
-               VNIC_TRACE( VNIC_DBG_DATA | VNIC_DBG_INFO,\r
+               VNIC_TRACE( VNIC_DBG_DATA,\r
                        (" Xmit packet exceeded SGE limit - %d\n",\r
                                                                                p_sgl->NumberOfElements ) );\r
                return FALSE;\r
@@ -656,7 +654,7 @@ _tx_chksum_flags(
                }\r
        }\r
        \r
-       VNIC_TRACE( VNIC_DBG_DATA | VNIC_DBG_INFO ,\r
+       VNIC_TRACE( VNIC_DBG_DATA ,\r
                                ("txChksumFlags = %d: V4 %c, V6 %c, IP %c, TCP %c, UDP %c\n",\r
                                txChksumFlags,\r
                                ((txChksumFlags & TX_CHKSUM_FLAGS_CHECKSUM_V4 )? '+': '-'),\r
@@ -676,7 +674,7 @@ _get_first_buffer(
                OUT             ULONG                   *p_packet_sz )\r
 {\r
        UINT            buf_len;\r
-       VNIC_ENTER( VNIC_DBG_DATA | VNIC_DBG_INFO );\r
+       VNIC_ENTER( VNIC_DBG_DATA );\r
 \r
        NdisGetFirstBufferFromPacketSafe( p_packet,\r
                                                                        pp_buf_desc,\r
@@ -684,7 +682,7 @@ _get_first_buffer(
                                                                        &buf_len,\r
                                                                        p_packet_sz,\r
                                                                        NormalPagePriority );\r
-       VNIC_EXIT( VNIC_DBG_DATA | VNIC_DBG_INFO );\r
+       VNIC_EXIT( VNIC_DBG_DATA );\r
 }\r
 \r
 static void\r
@@ -695,7 +693,7 @@ data_postRecvs(
        LIST_ENTRY              *p_list_entry;\r
        ib_api_status_t ib_status;\r
 \r
-       VNIC_ENTER ( VNIC_DBG_DATA | VNIC_DBG_INFO );\r
+       VNIC_ENTER ( VNIC_DBG_DATA );\r
 \r
        while( ( p_list_entry = ExInterlockedRemoveHeadList( &pData->recvIos,\r
                                                                                                                 &pData->recvIosLock ))\r
@@ -713,7 +711,7 @@ data_postRecvs(
                }\r
        }\r
 \r
-       VNIC_EXIT( VNIC_DBG_DATA | VNIC_DBG_INFO );\r
+       VNIC_EXIT( VNIC_DBG_DATA );\r
        return;\r
 }\r
 \r
@@ -724,7 +722,7 @@ _data_receivedKick(
        Data_t        *pData = &pIo->pViport->data;\r
        uint32_t                num_pkts = 0;\r
 \r
-       VNIC_ENTER( VNIC_DBG_DATA | VNIC_DBG_INFO );\r
+       VNIC_ENTER( VNIC_DBG_DATA );\r
 \r
 #ifdef VNIC_STATISTIC\r
        recvRef = cl_get_tick_count();\r
@@ -747,10 +745,10 @@ _data_receivedKick(
                NdisMIndicateReceivePacket( pData->p_viport->p_adapter->h_handle,\r
                                                                        pData->recvPool.recv_pkt_array,\r
                                                                        num_pkts );\r
-               pData->p_viport->stats.ifInOk++;\r
+               pData->p_viport->stats.ifInOk += num_pkts;\r
        }\r
 \r
-       VNIC_EXIT( VNIC_DBG_DATA | VNIC_DBG_INFO );\r
+       VNIC_EXIT( VNIC_DBG_DATA );\r
        return;\r
 }\r
 \r
@@ -761,12 +759,11 @@ _data_xmitComplete(
        RdmaIo_t       *pRdmaIo = (RdmaIo_t *)pIo;\r
        Data_t         *pData = &pIo->pViport->data;\r
        XmitPool_t     *p_xmitPool = &pData->xmitPool;\r
-       vnic_adapter_t  *p_adapter = pIo->pViport->p_adapter;\r
        NDIS_PACKET             *p_packet;\r
        NDIS_STATUS             ndis_status;\r
-       cl_list_item_t  *p_list_item;\r
+       LIST_ENTRY              *p_list_item;\r
 \r
-       VNIC_ENTER( VNIC_DBG_DATA | VNIC_DBG_INFO );\r
+       VNIC_ENTER( VNIC_DBG_DATA );\r
 \r
        while ( p_xmitPool->lastCompBuf != pRdmaIo->index )\r
        {\r
@@ -780,36 +777,37 @@ _data_xmitComplete(
                        if( pIo->wc_status != IB_WCS_SUCCESS )\r
                        {\r
                                ndis_status = NDIS_STATUS_FAILURE;\r
-                               p_adapter->p_viport->stats.ifOutErrors++;\r
+                               pIo->pViport->stats.ifOutErrors++;\r
+                               pIo->wc_status = IB_WCS_SUCCESS;\r
                        }\r
                        else\r
                        {\r
                                ndis_status = NDIS_STATUS_SUCCESS;\r
-                               p_adapter->p_viport->stats.ifOutOk++;\r
+                               pIo->pViport->stats.ifOutOk++;\r
                        }\r
                        NDIS_SET_PACKET_STATUS( p_packet, ndis_status );\r
                        NdisMSendComplete( pIo->pViport->p_adapter->h_handle,\r
                                                                p_packet, ndis_status );\r
                }\r
        }\r
-       pIo->wc_status = IB_WCS_SUCCESS;\r
-       if( !p_adapter->packet_filter )\r
+\r
+       if( !pIo->pViport->p_netpath->carrier )\r
        {\r
-               if( cl_qlist_count( &pIo->pViport->send_pending_list ) )\r
+               while( ( p_list_item = NdisInterlockedRemoveHeadList(\r
+                       &pIo->pViport->send_pending_list,\r
+                       &pIo->pViport->pending_list_lock ) ) != NULL )\r
                {\r
-                       for( p_list_item = cl_qlist_remove_head( &pIo->pViport->send_pending_list );\r
-                               p_list_item != cl_qlist_end( &pIo->pViport->send_pending_list );\r
-                               p_list_item = cl_qlist_remove_head( &pIo->pViport->send_pending_list ) )\r
-                       {\r
-                               p_packet = VNIC_PACKET_FROM_LIST_ITEM( p_list_item );\r
-                               NdisMSendComplete( p_adapter->h_handle, p_packet,\r
-                                                                       NDIS_STATUS_RESET_IN_PROGRESS );\r
-                       }\r
+                       p_packet = VNIC_PACKET_FROM_LIST_ITEM( p_list_item );\r
+                       NDIS_SET_PACKET_STATUS( p_packet, NDIS_STATUS_FAILURE );\r
+                       NdisMSendComplete( &pIo->pViport->p_adapter->h_handle,\r
+                                                               p_packet, NDIS_STATUS_FAILURE );\r
+                       pIo->pViport->stats.ifOutErrors++;\r
                }\r
        }\r
-       data_checkXmitBuffers(pData);\r
 \r
-       VNIC_EXIT( VNIC_DBG_DATA | VNIC_DBG_INFO );\r
+       data_checkXmitBuffers( pData );\r
+\r
+       VNIC_EXIT( VNIC_DBG_DATA );\r
        return;\r
 }\r
 \r
@@ -819,7 +817,7 @@ data_sendKickMessage(
 {\r
        XmitPool_t *pPool = &pData->xmitPool;\r
 \r
-       VNIC_ENTER( VNIC_DBG_DATA | VNIC_DBG_INFO );\r
+       VNIC_ENTER( VNIC_DBG_DATA );\r
 \r
        /* stop timer for BundleTimeout */\r
        _data_kickTimer_stop( pData );\r
@@ -837,7 +835,7 @@ data_sendKickMessage(
                viport_failure( pData->p_viport );\r
        }\r
 \r
-       VNIC_EXIT( VNIC_DBG_DATA | VNIC_DBG_INFO );\r
+       VNIC_EXIT( VNIC_DBG_DATA );\r
 }\r
 \r
 static void\r
@@ -845,12 +843,12 @@ _data_kickTimeoutHandler( void * context )
 {\r
        Data_t* pData = (Data_t *)context;\r
 \r
-       VNIC_ENTER( VNIC_DBG_DATA | VNIC_DBG_INFO );\r
-\r
-       pData->kickTimerOn = FALSE;\r
+       VNIC_ENTER( VNIC_DBG_DATA );\r
+       \r
+       InterlockedExchange( &pData->kickTimerOn, FALSE );\r
        data_sendKickMessage( pData );\r
 \r
-       VNIC_EXIT( VNIC_DBG_DATA | VNIC_DBG_INFO );\r
+       VNIC_EXIT( VNIC_DBG_DATA );\r
 \r
        return;\r
 }\r
@@ -865,7 +863,7 @@ data_allocXmitBuffer(
        XmitPool_t    *p_xmitPool = &pData->xmitPool;\r
        KIRQL flags;\r
 \r
-       VNIC_ENTER( VNIC_DBG_DATA | VNIC_DBG_INFO );\r
+       VNIC_ENTER( VNIC_DBG_DATA );\r
 \r
        KeAcquireSpinLock( &pData->xmitBufLock, &flags );\r
 \r
@@ -880,7 +878,7 @@ data_allocXmitBuffer(
 \r
                if ( !p_xmitPool->bufPool[p_xmitPool->nextXmitPool].valid )\r
                {\r
-                       VNIC_TRACE( VNIC_DBG_DATA | VNIC_DBG_INFO,\r
+                       VNIC_TRACE( VNIC_DBG_DATA,\r
                                ("Just used the last EIOU receive buffer\n") );\r
 \r
                        *pLast = TRUE;\r
@@ -892,7 +890,7 @@ data_allocXmitBuffer(
                }\r
                else if ( p_xmitPool->nextXmitBuf == p_xmitPool->lastCompBuf )\r
                {\r
-                       VNIC_TRACE( VNIC_DBG_DATA | VNIC_DBG_INFO,\r
+                       VNIC_TRACE( VNIC_DBG_DATA,\r
                                                ("Just used our last xmit buffer\n") );\r
                \r
                        p_xmitPool->needBuffers = TRUE;\r
@@ -927,7 +925,7 @@ data_checkXmitBuffers(
        XmitPool_t      *p_xmitPool = &pData->xmitPool;\r
        KIRQL           flags;\r
 \r
-       VNIC_ENTER( VNIC_DBG_DATA | VNIC_DBG_INFO );\r
+       VNIC_ENTER( VNIC_DBG_DATA );\r
 \r
        KeAcquireSpinLock( &pData->xmitBufLock, &flags );\r
 \r
@@ -938,13 +936,13 @@ data_checkXmitBuffers(
                pData->xmitPool.needBuffers = FALSE;\r
                viport_restartXmit( pData->p_viport );\r
 \r
-               VNIC_TRACE( VNIC_DBG_DATA | VNIC_DBG_INFO,\r
+               VNIC_TRACE( VNIC_DBG_DATA,\r
                                                ("There are free xmit buffers\n") );\r
        }\r
 \r
        KeReleaseSpinLock( &pData->xmitBufLock, flags );\r
 \r
-       VNIC_EXIT( VNIC_DBG_DATA | VNIC_DBG_INFO );\r
+       VNIC_EXIT( VNIC_DBG_DATA );\r
        return;\r
 }\r
 \r
@@ -957,7 +955,7 @@ data_rdmaPacket(
        ib_send_wr_t    *pWrq;\r
        uint64_t                remote_addr;\r
 \r
-       VNIC_ENTER( VNIC_DBG_DATA | VNIC_DBG_INFO );\r
+       VNIC_ENTER( VNIC_DBG_DATA );\r
 \r
        pWrq = &pRdmaIo->io.wrq;\r
 \r
@@ -992,7 +990,7 @@ data_rdmaPacket(
        pData->statistics.xmitNum++;\r
 #endif /* VNIC_STATISTIC */\r
 \r
-       VNIC_EXIT( VNIC_DBG_DATA | VNIC_DBG_INFO );\r
+       VNIC_EXIT( VNIC_DBG_DATA );\r
 }\r
 \r
 static NDIS_PACKET *\r
@@ -1008,7 +1006,7 @@ _data_recv_to_ndis_pkt(
        uint8_t rxChksumFlags;\r
        NDIS_TCP_IP_CHECKSUM_PACKET_INFO  packet_info;\r
 \r
-       VNIC_ENTER( VNIC_DBG_DATA | VNIC_DBG_INFO );\r
+       VNIC_ENTER( VNIC_DBG_DATA );\r
 \r
        pTrailer = pRdmaDest->pTrailer;\r
        start = (int)data_offset(pData, pTrailer);\r
@@ -1054,7 +1052,7 @@ _data_recv_to_ndis_pkt(
 \r
        rxChksumFlags = pTrailer->rxChksumFlags;\r
 \r
-       VNIC_TRACE( VNIC_DBG_DATA | VNIC_DBG_INFO,\r
+       VNIC_TRACE( VNIC_DBG_DATA,\r
                ("rxChksumFlags = %d, LOOP = %c, IP = %c, TCP = %c, UDP = %c\n",\r
                rxChksumFlags,\r
                (rxChksumFlags & RX_CHKSUM_FLAGS_LOOPBACK)? 'Y': 'N',\r
@@ -1088,7 +1086,7 @@ _data_recv_to_ndis_pkt(
        VNIC_RECV_FROM_PACKET( p_packet ) = pRdmaDest;\r
        NDIS_SET_PACKET_STATUS( p_packet, NDIS_STATUS_SUCCESS );\r
 \r
-       VNIC_EXIT( VNIC_DBG_DATA | VNIC_DBG_INFO );\r
+       VNIC_EXIT( VNIC_DBG_DATA );\r
        return p_packet;\r
 }\r
 \r
@@ -1103,7 +1101,7 @@ _data_allocBuffers(
        LIST_ENTRY              *p_list_entry;\r
        int            index;\r
 \r
-       VNIC_ENTER( VNIC_DBG_DATA | VNIC_DBG_INFO );\r
+       VNIC_ENTER( VNIC_DBG_DATA );\r
 \r
        index = ADD(p_recvPool->nextFreeBuf, p_recvPool->numFreeBufs, p_recvPool->eiocPoolSz);\r
 \r
@@ -1126,7 +1124,7 @@ _data_allocBuffers(
                index = NEXT(index,p_recvPool->eiocPoolSz);\r
        }\r
 \r
-       VNIC_EXIT( VNIC_DBG_DATA | VNIC_DBG_INFO );\r
+       VNIC_EXIT( VNIC_DBG_DATA );\r
        return;\r
 }\r
 \r
@@ -1162,7 +1160,7 @@ _data_incomingRecv(
        uint32_t                idx = 0;\r
        BOOLEAN status = FALSE;\r
 \r
-       VNIC_ENTER( VNIC_DBG_DATA | VNIC_DBG_INFO );\r
+       VNIC_ENTER( VNIC_DBG_DATA );\r
 \r
        while( !status )\r
        {\r
@@ -1227,7 +1225,8 @@ vnic_return_packet(
        InsertTailList( &p_viport->data.recvPool.availRecvBufs,\r
                                        &p_rdma_dest->listPtrs );\r
 \r
-       if( p_viport->data.connected == TRUE )\r
+       if( p_viport->data.connected == TRUE &&\r
+               !p_viport->errored )\r
        {\r
                _data_allocBuffers( &p_viport->data, FALSE );\r
                _data_sendFreeRecvBuffers( &p_viport->data );\r
@@ -1259,7 +1258,7 @@ _data_sendFreeRecvBuffers(
        unsigned int numToSend,\r
                    nextIncrement;\r
 \r
-       VNIC_ENTER( VNIC_DBG_DATA | VNIC_DBG_INFO );\r
+       VNIC_ENTER( VNIC_DBG_DATA );\r
 \r
        for (   numToSend = p_recvPool->szFreeBundle;\r
                        numToSend <= p_recvPool->numFreeBufs;\r
@@ -1277,7 +1276,6 @@ _data_sendFreeRecvBuffers(
                sz       = numToSend * sizeof(BufferPoolEntry_t);\r
                rdmaAddr = p_recvPool->eiocRdmaAddr + offset;\r
        \r
-               //pWrq->MessageLen      = sz;\r
                pWrq->ds_array->length  = sz;\r
                pWrq->ds_array->vaddr = PTR64((uint8_t *)p_recvPool->bufPool + offset);\r
                pWrq->remote_ops.vaddr = rdmaAddr;\r
@@ -1307,12 +1305,12 @@ _data_sendFreeRecvBuffers(
        if( p_recvPool->numPostedBufs == 0 )\r
        {\r
                VNIC_TRACE( VNIC_DBG_ERROR,\r
-                               ("%s: Unable to allocate receive buffers\n",\r
-                                                       pData->p_viport->p_adapter->name ) );\r
+                               ("IOC %d: Unable to allocate receive buffers\n",\r
+                                       pData->p_viport->ioc_num ) );\r
        \r
                viport_failure( pData->p_viport );\r
        }\r
-       VNIC_EXIT( VNIC_DBG_DATA | VNIC_DBG_INFO );\r
+       VNIC_EXIT( VNIC_DBG_DATA );\r
 }\r
 \r
 \r
@@ -1320,7 +1318,7 @@ void
 data_cleanup(\r
        IN                      Data_t  *pData )\r
 {\r
-       VNIC_ENTER( VNIC_DBG_DATA | VNIC_DBG_INFO );\r
+       VNIC_ENTER( VNIC_DBG_DATA );\r
 \r
        if( pData->recvPool.recv_pkt_array )\r
        {\r
@@ -1334,22 +1332,36 @@ data_cleanup(
                NdisFreeMemory( pData->pLocalStorage, pData->localStorageSz, 0 );\r
                pData->pLocalStorage = NULL;\r
        }\r
+\r
+       if( NdisPacketPoolUsage(pData->h_recv_pkt_pool) != 0)\r
+       {\r
+                       VNIC_TRACE( VNIC_DBG_WARN,\r
+                               ("Recv packet pool is not empty!!!\n") );\r
+                       NdisMSleep(100);\r
+       }\r
+\r
        if(  pData->h_recv_buf_pool )\r
        {\r
                NdisFreeBufferPool( pData->h_recv_buf_pool );\r
                pData->h_recv_buf_pool = NULL;\r
        }\r
+\r
        if ( pData->h_recv_pkt_pool )\r
        {\r
                NdisFreePacketPool( pData->h_recv_pkt_pool );\r
                pData->h_recv_pkt_pool = NULL;\r
        }\r
+       if( pData->p_recv_bufs )\r
+       {\r
+               NdisFreeMemory( pData->p_recv_bufs, pData->recv_bufs_sz, 0 );\r
+               pData->p_recv_bufs = NULL;\r
+       }\r
        // clear Qp struct for reuse\r
        cl_memclr( &pData->qp, sizeof( IbQp_t) );\r
 \r
        cl_timer_destroy( &pData->kickTimer );\r
 \r
-       VNIC_EXIT( VNIC_DBG_CTRL );\r
+       VNIC_EXIT( VNIC_DBG_DATA );\r
 }\r
 \r
 \r
@@ -1358,13 +1370,13 @@ _data_kickTimer_start(
                  IN    Data_t          *pData,\r
                  IN    uint32_t        microseconds )\r
 {\r
-       VNIC_ENTER( VNIC_DBG_DATA | VNIC_DBG_INFO );\r
+       VNIC_ENTER( VNIC_DBG_DATA );\r
 \r
        InterlockedExchange( (LONG *)&pData->kickTimerOn, TRUE );\r
 \r
        usec_timer_start(&pData->kickTimer, microseconds );\r
 \r
-       VNIC_EXIT( VNIC_DBG_DATA | VNIC_DBG_INFO );\r
+       VNIC_EXIT( VNIC_DBG_DATA );\r
        return;\r
 }\r
 \r
@@ -1372,12 +1384,12 @@ static void
 _data_kickTimer_stop(\r
                  IN    Data_t          *pData )\r
 {\r
-       VNIC_ENTER( VNIC_DBG_DATA | VNIC_DBG_INFO );\r
+       VNIC_ENTER( VNIC_DBG_DATA );\r
 \r
        if( InterlockedExchange( &pData->kickTimerOn, FALSE ) == TRUE )\r
        {\r
                cl_timer_stop( &pData->kickTimer );\r
        }\r
 \r
-       VNIC_EXIT( VNIC_DBG_DATA | VNIC_DBG_INFO );\r
+       VNIC_EXIT( VNIC_DBG_DATA );\r
 }\r
index 1aec7ef..4f156e3 100644 (file)
@@ -196,7 +196,7 @@ data_cleanup(
        (((RdmaDest_t **)P->MiniportReservedEx)[1])\r
 \r
 #define VNIC_LIST_ITEM_FROM_PACKET( P ) \\r
-               ((cl_list_item_t*)P->MiniportReservedEx)\r
+               ((LIST_ENTRY *)P->MiniportReservedEx)\r
 \r
 #define VNIC_PACKET_FROM_LIST_ITEM( I ) \\r
                (PARENT_STRUCT( I, NDIS_PACKET, MiniportReservedEx ))\r
index ea1dad7..bb8b6b9 100644 (file)
 extern uint32_t                g_vnic_dbg_lvl;\r
 \r
 \r
-#define VNIC_DBG_INIT          (0x00000001)\r
-#define VNIC_DBG_PNP           (0x00000002)\r
-#define VNIC_DBG_SEND          (0x00000004)\r
-#define VNIC_DBG_RECV          (0x00000008)\r
-#define VNIC_DBG_STATUS                (0x00000010)\r
-#define VNIC_DBG_IB                    (0x00000020)\r
-#define VNIC_DBG_BUF           (0x00000040)\r
-#define VNIC_DBG_MCAST         (0x00000080)\r
-#define VNIC_DBG_ALLOC         (0x00000100)\r
-#define VNIC_DBG_OID           (0x00000200)\r
-#define VNIC_DBG_DATA          (0x00000400)\r
-#define VNIC_DBG_CTRL          (0x00000800)\r
-#define VNIC_DBG_CTRL_PKT      (0x00001000\r
-#define VNIC_DBG_CONF          (0x00002000)\r
-#define VNIC_DBG_VIPORT                (0x00004000)\r
-#define VNIC_DBG_ADAPTER       (0x00008000)\r
-#define VNIC_DBG_NETPATH       (0x00010000)\r
+#define VNIC_DBG_INIT          ( ( VNIC_DBG_INFO ) | 0x00000001 )\r
+#define VNIC_DBG_PNP           ( ( VNIC_DBG_INFO ) | 0x00000002 )\r
+#define VNIC_DBG_SEND          ( ( VNIC_DBG_INFO ) | 0x00000004 )\r
+#define VNIC_DBG_RECV          ( ( VNIC_DBG_INFO ) | 0x00000008 )\r
+#define VNIC_DBG_STATUS                ( ( VNIC_DBG_INFO ) | 0x00000010 )\r
+#define VNIC_DBG_IB                    ( ( VNIC_DBG_INFO ) | 0x00000020 )\r
+#define VNIC_DBG_BUF           ( ( VNIC_DBG_INFO ) | 0x00000040 )\r
+#define VNIC_DBG_MCAST         ( ( VNIC_DBG_INFO ) | 0x00000080 )\r
+#define VNIC_DBG_ALLOC         ( ( VNIC_DBG_INFO ) | 0x00000100 )\r
+#define VNIC_DBG_OID           ( ( VNIC_DBG_INFO ) | 0x00000200 )\r
+#define VNIC_DBG_DATA          ( ( VNIC_DBG_INFO ) | 0x00000400 )\r
+#define VNIC_DBG_CTRL          ( ( VNIC_DBG_INFO ) | 0x00000800 )\r
+#define VNIC_DBG_CTRL_PKT      ( ( VNIC_DBG_INFO ) | 0x00001000 \r
+#define VNIC_DBG_CONF          ( ( VNIC_DBG_INFO ) | 0x00002000 )\r
+#define VNIC_DBG_VIPORT                ( ( VNIC_DBG_INFO ) | 0x00004000 )\r
+#define VNIC_DBG_ADAPTER       ( ( VNIC_DBG_INFO ) | 0x00008000 )\r
+#define VNIC_DBG_NETPATH       ( ( VNIC_DBG_INFO ) | 0x00010000 )\r
 \r
 #define VNIC_DBG_FUNC          (0x10000000)    /* For function entry/exit */\r
 #define VNIC_DBG_INFO          (0x20000000)    /* For verbose information */\r
@@ -66,7 +66,6 @@ extern uint32_t               g_vnic_dbg_lvl;
 #define VNIC_DBG_ERROR         CL_DBG_ERROR\r
 #define VNIC_DBG_ALL           CL_DBG_ALL\r
 \r
-//#define VNIC_DEBUG_FLAGS ( VNIC_DBG_ERROR | VNIC_DBG_WARN |  VNIC_DBG_INFO | VNIC_DBG_FUNC | VNIC_DBG_OID | VNIC_DBG_VIPORT | VNIC_DBG_CTRL | VNIC_DBG_DATA | VNIC_DBG_IB)\r
 #define VNIC_DEBUG_FLAGS ( VNIC_DBG_ERROR | VNIC_DBG_WARN |    VNIC_DBG_INFO )\r
 /* Enter and exit macros automatically add VNIC_DBG_FUNC bit */\r
 #define VNIC_ENTER( lvl )      \\r
index 7dd3335..e9b0678 100644 (file)
@@ -39,7 +39,6 @@ vnic_globals_t        g_vnic;
 \r
 #define DEFAULT_HOST_NAME "VNIC Host"\r
 \r
-//uint32_t g_vnic_dbg_lvl = VNIC_DBG_ERROR | VNIC_DBG_INIT | VNIC_DBG_IB | VNIC_DBG_INFO;\r
 uint32_t g_vnic_dbg_lvl = VNIC_DEBUG_FLAGS;\r
 \r
 static void\r
@@ -246,16 +245,15 @@ vnic_initialize(
 \r
        /* set NDIS features we support */\r
        NdisMSetAttributesEx( h_handle,\r
-                                               p_adapter,\r
-                                               5,                                              /*check for hung t-out */\r
+                                               (NDIS_HANDLE)p_adapter,\r
+                                               2,                                              /*check for hung t-out */\r
                                                NDIS_ATTRIBUTE_BUS_MASTER |\r
                                                NDIS_ATTRIBUTE_DESERIALIZE |\r
                                                NDIS_ATTRIBUTE_SURPRISE_REMOVE_OK |\r
                                                NDIS_ATTRIBUTE_USES_SAFE_BUFFER_APIS,\r
                                                NdisInterfacePNPBus );\r
 \r
-       buffer_size = sizeof(ViportTrailer_t) +\r
-               ROUNDUPP2(p_adapter->params.MaxMtu + sizeof(eth_hdr_t),VIPORT_TRAILER_ALIGNMENT );\r
+       buffer_size = ROUNDUPP2(p_adapter->params.MinMtu + sizeof(eth_hdr_t), 8 );\r
 \r
        status = NdisMInitializeScatterGatherDma( h_handle, TRUE, buffer_size );\r
        if ( status != NDIS_STATUS_SUCCESS )\r
@@ -268,7 +266,7 @@ vnic_initialize(
        /* Register for IOC events */\r
        pnp_req.pfn_pnp_cb = __vnic_pnp_cb;\r
        pnp_req.pnp_class = IB_PNP_IOC | IB_PNP_FLAG_REG_SYNC;\r
-       pnp_req.pnp_context = p_adapter;\r
+       pnp_req.pnp_context = (const void *)p_adapter;\r
 \r
        ib_status = p_adapter->ifc.reg_pnp( p_adapter->h_al, &pnp_req, &p_adapter->h_pnp );\r
 \r
@@ -322,6 +320,7 @@ vnic_halt(
 @param adapter_context The adapter context allocated at start\r
 @return TRUE if the driver determines that its NIC is not operating\r
 */\r
+#define VNIC_MAX_HUNG_CHK      3\r
 BOOLEAN\r
 vnic_check_for_hang(\r
        IN                              NDIS_HANDLE                                     adapter_context )\r
@@ -333,13 +332,13 @@ vnic_check_for_hang(
 \r
        if( p_adapter->p_viport )\r
        {\r
-               p_adapter->hung =\r
-                       (BOOLEAN)( p_adapter->p_viport->errored != 0 );\r
+               if( p_adapter->p_viport->errored != 0 )\r
+                       p_adapter->hung++;\r
        }\r
-       if( p_adapter->hung )\r
+       if( p_adapter->hung > VNIC_MAX_HUNG_CHK )\r
        {\r
                VNIC_TRACE( VNIC_DBG_WARN, ("Adapter Hung\n"));\r
-               p_adapter->hung = FALSE;\r
+               p_adapter->hung = 0;\r
                return TRUE;\r
        }\r
        return FALSE;\r
@@ -399,25 +398,25 @@ vnic_oid_query_info(
        {\r
        /* Required General */\r
        case OID_GEN_SUPPORTED_LIST:\r
-               VNIC_TRACE( VNIC_DBG_OID | VNIC_DBG_INFO,\r
+               VNIC_TRACE( VNIC_DBG_OID,\r
                        ("received query for OID_GEN_SUPPORTED_LIST\n") );\r
                src_buf = (PVOID)SUPPORTED_OIDS;\r
                buf_len = sizeof(SUPPORTED_OIDS);\r
                break;\r
 \r
        case OID_GEN_HARDWARE_STATUS:\r
-               VNIC_TRACE( VNIC_DBG_OID | VNIC_DBG_INFO,\r
+               VNIC_TRACE( VNIC_DBG_OID,\r
                        ("received query for OID_GEN_HARDWARE_STATUS\n") );\r
 \r
                if( p_adapter->p_currentPath->carrier )\r
                {\r
-                       VNIC_TRACE( VNIC_DBG_OID | VNIC_DBG_INFO,\r
+                       VNIC_TRACE( VNIC_DBG_OID,\r
                                ("returning NdisHardwareStatusReady\n") );\r
                        info32 = NdisHardwareStatusReady;\r
                }\r
                else\r
                {\r
-                       VNIC_TRACE( VNIC_DBG_OID | VNIC_DBG_INFO,\r
+                       VNIC_TRACE( VNIC_DBG_OID,\r
                                ("returning NdisHardwareStatusInitializing\n") );\r
                        info32 = NdisHardwareStatusNotReady;\r
                }\r
@@ -425,14 +424,14 @@ vnic_oid_query_info(
 \r
        case OID_GEN_MEDIA_SUPPORTED:\r
        case OID_GEN_MEDIA_IN_USE:\r
-               VNIC_TRACE( VNIC_DBG_OID | VNIC_DBG_INFO,\r
+               VNIC_TRACE( VNIC_DBG_OID,\r
                        ("received query for OID_GEN_MEDIA_SUPPORTED "\r
                        "or OID_GEN_MEDIA_IN_USE\n") );\r
                info32 = NdisMedium802_3;\r
                break;\r
 \r
        case OID_GEN_MAXIMUM_FRAME_SIZE:\r
-               VNIC_TRACE( VNIC_DBG_OID | VNIC_DBG_INFO,\r
+               VNIC_TRACE( VNIC_DBG_OID,\r
                        ("received query for OID_GEN_MAXIMUM_FRAME_SIZE\n") );\r
                if( !p_adapter->p_currentPath->carrier )\r
                {\r
@@ -446,7 +445,7 @@ vnic_oid_query_info(
                break;\r
 \r
        case OID_GEN_LINK_SPEED:\r
-               VNIC_TRACE( VNIC_DBG_OID | VNIC_DBG_INFO,\r
+               VNIC_TRACE( VNIC_DBG_OID,\r
                                ("received query for OID_GEN_LINK_SPEED\n") );\r
 \r
                if( p_adapter->p_currentPath->carrier )\r
@@ -460,14 +459,14 @@ vnic_oid_query_info(
                break;\r
 \r
        case OID_GEN_TRANSMIT_BUFFER_SPACE:\r
-               VNIC_TRACE( VNIC_DBG_OID | VNIC_DBG_INFO,\r
+               VNIC_TRACE( VNIC_DBG_OID,\r
                        ("received query for OID_GEN_TRANSMIT_BUFFER_SPACE\n") );\r
                if ( !p_adapter->p_currentPath->carrier )\r
                {\r
                        p_adapter->pending_query = TRUE;\r
                        p_adapter->query_oid = oid_info;\r
 \r
-                       VNIC_TRACE( VNIC_DBG_OID | VNIC_DBG_INFO,\r
+                       VNIC_TRACE( VNIC_DBG_OID,\r
                                ("returning NDIS_STATUS_PENDING\n") );\r
                        status = NDIS_STATUS_PENDING;\r
                }\r
@@ -479,7 +478,7 @@ vnic_oid_query_info(
                break;\r
 \r
        case OID_GEN_RECEIVE_BUFFER_SPACE:\r
-               VNIC_TRACE( VNIC_DBG_OID | VNIC_DBG_INFO,\r
+               VNIC_TRACE( VNIC_DBG_OID,\r
                        ("received query for OID_GEN_RECEIVE_BUFFER_SPACE "\r
                        "or OID_GEN_RECEIVE_BUFFER_SPACE\n") );\r
                if ( !p_adapter->p_currentPath->carrier )\r
@@ -487,7 +486,7 @@ vnic_oid_query_info(
                        p_adapter->pending_query = TRUE;\r
                        p_adapter->query_oid = oid_info;\r
 \r
-                       VNIC_TRACE( VNIC_DBG_OID | VNIC_DBG_INFO,\r
+                       VNIC_TRACE( VNIC_DBG_OID,\r
                                ("returning NDIS_STATUS_PENDING\n") );\r
                        status = NDIS_STATUS_PENDING;\r
                }\r
@@ -502,7 +501,7 @@ vnic_oid_query_info(
        case OID_GEN_TRANSMIT_BLOCK_SIZE:\r
        case OID_GEN_RECEIVE_BLOCK_SIZE:\r
        case OID_GEN_MAXIMUM_TOTAL_SIZE:\r
-               VNIC_TRACE( VNIC_DBG_OID | VNIC_DBG_INFO,\r
+               VNIC_TRACE( VNIC_DBG_OID,\r
                        ("received query for OID_GEN_MAXIMUM_LOOKAHEAD "\r
                        "or OID_GEN_CURRENT_LOOKAHEAD or "\r
                        "OID_GEN_TRANSMIT_BLOCK_SIZE or "\r
@@ -521,7 +520,7 @@ vnic_oid_query_info(
                break;\r
 \r
        case OID_GEN_VENDOR_ID:\r
-               VNIC_TRACE( VNIC_DBG_OID | VNIC_DBG_INFO,\r
+               VNIC_TRACE( VNIC_DBG_OID,\r
                        ("received query for OID_GEN_VENDOR_ID\n") );\r
 \r
                src_buf = (void*)VENDOR_ID;\r
@@ -529,14 +528,14 @@ vnic_oid_query_info(
                break;\r
 \r
        case OID_GEN_VENDOR_DESCRIPTION:\r
-               VNIC_TRACE( VNIC_DBG_OID | VNIC_DBG_INFO,\r
+               VNIC_TRACE( VNIC_DBG_OID,\r
                        ("received query for OID_GEN_VENDOR_DESCRIPTION\n") );\r
                src_buf = VENDOR_DESCRIPTION;\r
                buf_len = sizeof(VENDOR_DESCRIPTION);\r
                break;\r
 \r
        case OID_GEN_VENDOR_DRIVER_VERSION:\r
-               VNIC_TRACE( VNIC_DBG_OID | VNIC_DBG_INFO,\r
+               VNIC_TRACE( VNIC_DBG_OID,\r
                        ("  received query for OID_GEN_VENDOR_DRIVER_VERSION\n" ) );\r
                src_buf = &version;\r
                buf_len = sizeof(version);\r
@@ -545,19 +544,19 @@ vnic_oid_query_info(
                break;\r
 \r
        case OID_GEN_PHYSICAL_MEDIUM:\r
-               VNIC_TRACE( VNIC_DBG_OID | VNIC_DBG_INFO,\r
+               VNIC_TRACE( VNIC_DBG_OID,\r
                        ("  received query for OID_GEN_PHYSICAL_MEDIUM\n" ) );\r
                info32 = NdisPhysicalMediumUnspecified;\r
                break;\r
 \r
        case OID_GEN_CURRENT_PACKET_FILTER:\r
-               VNIC_TRACE( VNIC_DBG_OID | VNIC_DBG_INFO,\r
+               VNIC_TRACE( VNIC_DBG_OID,\r
                        ("  received query for OID_GEN_CURRENT_PACKET_FILTER\n" ) );\r
                info32 = p_adapter->packet_filter;\r
                break;\r
 \r
        case OID_GEN_DRIVER_VERSION:\r
-               VNIC_TRACE( VNIC_DBG_OID | VNIC_DBG_INFO,\r
+               VNIC_TRACE( VNIC_DBG_OID,\r
                        ("  received query for OID_GEN_DRIVER_VERSION\n" ) );\r
                src_buf = &version;\r
                buf_len = sizeof(version);\r
@@ -565,7 +564,7 @@ vnic_oid_query_info(
                break;\r
 \r
        case OID_GEN_MAC_OPTIONS:\r
-               VNIC_TRACE( VNIC_DBG_OID | VNIC_DBG_INFO,\r
+               VNIC_TRACE( VNIC_DBG_OID,\r
                        ("  received query for OID_GEN_MAC_OPTIONS\n" ) );\r
                info32 = NDIS_MAC_OPTION_COPY_LOOKAHEAD_DATA |\r
                                NDIS_MAC_OPTION_TRANSFERS_NOT_PEND |\r
@@ -579,7 +578,7 @@ vnic_oid_query_info(
                break;\r
 \r
        case OID_GEN_MEDIA_CONNECT_STATUS:\r
-               VNIC_TRACE( VNIC_DBG_OID | VNIC_DBG_INFO,\r
+               VNIC_TRACE( VNIC_DBG_OID,\r
                        ("  received query for OID_GEN_MEDIA_CONNECT_STATUS\n" ) );\r
 \r
                info32 =  ( p_adapter->carrier )?\r
@@ -588,14 +587,14 @@ vnic_oid_query_info(
                break;\r
 \r
        case OID_GEN_MAXIMUM_SEND_PACKETS:\r
-               VNIC_TRACE( VNIC_DBG_OID | VNIC_DBG_INFO,\r
+               VNIC_TRACE( VNIC_DBG_OID,\r
                        ("  received query for OID_GEN_MAXIMUM_SEND_PACKETS\n" ) );\r
                info32 = MAXLONG; // NDIS ignored it anyway\r
                break;\r
 \r
        /* Required General Statistics */\r
        case OID_GEN_XMIT_OK:\r
-               VNIC_TRACE( VNIC_DBG_OID | VNIC_DBG_INFO,\r
+               VNIC_TRACE( VNIC_DBG_OID,\r
                        ("  received query for OID_GEN_XMIT_OK\n" ) );\r
                if ( !p_adapter->p_currentPath->carrier )\r
                {\r
@@ -610,7 +609,7 @@ vnic_oid_query_info(
                break;\r
 \r
        case OID_GEN_RCV_OK:\r
-               VNIC_TRACE( VNIC_DBG_OID | VNIC_DBG_INFO,\r
+               VNIC_TRACE( VNIC_DBG_OID,\r
                        ("  received query for OID_GEN_RCV_OK\n" ) );\r
                if ( !p_adapter->p_currentPath->carrier)\r
                {\r
@@ -630,7 +629,7 @@ vnic_oid_query_info(
                break;\r
 \r
        case OID_GEN_XMIT_ERROR:\r
-               VNIC_TRACE( VNIC_DBG_OID | VNIC_DBG_INFO,\r
+               VNIC_TRACE( VNIC_DBG_OID,\r
                        ("  received query for OID_GEN_XMIT_ERROR\n" ) );\r
                if ( !p_adapter->p_currentPath->carrier )\r
                {\r
@@ -645,7 +644,7 @@ vnic_oid_query_info(
                break;\r
 \r
        case OID_GEN_RCV_ERROR:\r
-               VNIC_TRACE( VNIC_DBG_OID | VNIC_DBG_INFO,\r
+               VNIC_TRACE( VNIC_DBG_OID,\r
                        ("  received query for OID_GEN_RCV_ERROR\n" ) );\r
                if ( !p_adapter->p_currentPath->carrier )\r
                {\r
@@ -660,14 +659,14 @@ vnic_oid_query_info(
                break;\r
 \r
        case OID_GEN_RCV_NO_BUFFER:\r
-               VNIC_TRACE( VNIC_DBG_OID | VNIC_DBG_INFO,\r
+               VNIC_TRACE( VNIC_DBG_OID,\r
                        ("  received query for OID_GEN_RCV_NO_BUFFER\n" ) );\r
                info32 = 0;\r
                status = NDIS_STATUS_SUCCESS;\r
                break;\r
 \r
        case OID_GEN_DIRECTED_BYTES_XMIT:\r
-               VNIC_TRACE( VNIC_DBG_OID | VNIC_DBG_INFO,\r
+               VNIC_TRACE( VNIC_DBG_OID,\r
                        ("  received query for OID_GEN_DIRECTED_BYTES_XMIT\n" ) );\r
                if ( !p_adapter->p_currentPath->carrier )\r
                {\r
@@ -682,7 +681,7 @@ vnic_oid_query_info(
                break;\r
 \r
        case OID_GEN_DIRECTED_FRAMES_XMIT:\r
-               VNIC_TRACE( VNIC_DBG_OID | VNIC_DBG_INFO,\r
+               VNIC_TRACE( VNIC_DBG_OID,\r
                        ("  received query for OID_GEN_DIRECTED_FRAMES_XMIT\n" ) );\r
                if ( !p_adapter->p_currentPath->carrier )\r
                {\r
@@ -697,7 +696,7 @@ vnic_oid_query_info(
                break;\r
 \r
        case OID_GEN_MULTICAST_BYTES_XMIT:\r
-               VNIC_TRACE( VNIC_DBG_OID | VNIC_DBG_INFO,\r
+               VNIC_TRACE( VNIC_DBG_OID,\r
                        ("  received query for OID_GEN_MULTICAST_BYTES_XMIT\n" ) );\r
                if ( !p_adapter->p_currentPath->carrier )\r
                {\r
@@ -712,7 +711,7 @@ vnic_oid_query_info(
                break;\r
 \r
        case OID_GEN_MULTICAST_FRAMES_XMIT:\r
-               VNIC_TRACE( VNIC_DBG_OID | VNIC_DBG_INFO,\r
+               VNIC_TRACE( VNIC_DBG_OID,\r
                        ("  received query for OID_GEN_MULTICAST_FRAMES_XMIT\n" ) );\r
                if ( !p_adapter->p_currentPath->carrier )\r
                {\r
@@ -727,7 +726,7 @@ vnic_oid_query_info(
                break;\r
 \r
        case OID_GEN_BROADCAST_BYTES_XMIT:\r
-               VNIC_TRACE( VNIC_DBG_OID | VNIC_DBG_INFO,\r
+               VNIC_TRACE( VNIC_DBG_OID,\r
                        ("  received query for OID_GEN_BROADCAST_BYTES_XMIT\n" ) );\r
                if ( !p_adapter->p_currentPath->carrier )\r
                {\r
@@ -742,7 +741,7 @@ vnic_oid_query_info(
                break;\r
 \r
        case OID_GEN_BROADCAST_FRAMES_XMIT:\r
-               VNIC_TRACE( VNIC_DBG_OID | VNIC_DBG_INFO,\r
+               VNIC_TRACE( VNIC_DBG_OID,\r
                        ("  received query for OID_GEN_BROADCAST_FRAMES_XMIT\n" ) );\r
                if ( !p_adapter->p_currentPath->carrier )\r
                {\r
@@ -756,7 +755,7 @@ vnic_oid_query_info(
                }\r
                break;\r
        case OID_GEN_DIRECTED_BYTES_RCV:\r
-               VNIC_TRACE( VNIC_DBG_OID | VNIC_DBG_INFO,\r
+               VNIC_TRACE( VNIC_DBG_OID,\r
                        ("  received query for OID_GEN_DIRECTED_BYTES_RCV\n" ) );\r
                if ( !p_adapter->p_currentPath->carrier )\r
                {\r
@@ -771,7 +770,7 @@ vnic_oid_query_info(
                break;\r
 \r
        case OID_GEN_DIRECTED_FRAMES_RCV:\r
-               VNIC_TRACE( VNIC_DBG_OID | VNIC_DBG_INFO,\r
+               VNIC_TRACE( VNIC_DBG_OID,\r
                        ("  received query for OID_GEN_DIRECTED_FRAMES_RCV\n" ) );\r
                if ( !p_adapter->p_currentPath->carrier )\r
                {\r
@@ -786,7 +785,7 @@ vnic_oid_query_info(
                break;\r
 \r
        case OID_GEN_MULTICAST_BYTES_RCV:\r
-               VNIC_TRACE( VNIC_DBG_OID | VNIC_DBG_INFO,\r
+               VNIC_TRACE( VNIC_DBG_OID,\r
                        ("  received query for OID_GEN_MULTICAST_BYTES_RCV\n" ) );\r
                if ( !p_adapter->p_currentPath->carrier )\r
                {\r
@@ -801,7 +800,7 @@ vnic_oid_query_info(
                break;\r
 \r
        case OID_GEN_MULTICAST_FRAMES_RCV:\r
-               VNIC_TRACE( VNIC_DBG_OID | VNIC_DBG_INFO,\r
+               VNIC_TRACE( VNIC_DBG_OID,\r
                        ("  received query for OID_GEN_MULTICAST_FRAMES_RCV\n" ) );\r
                if ( !p_adapter->p_currentPath->carrier )\r
                {\r
@@ -817,7 +816,7 @@ vnic_oid_query_info(
                break;\r
 \r
        case OID_GEN_BROADCAST_BYTES_RCV:\r
-               VNIC_TRACE( VNIC_DBG_OID | VNIC_DBG_INFO,\r
+               VNIC_TRACE( VNIC_DBG_OID,\r
                        ("  received query for OID_GEN_BROADCAST_BYTES_RCV\n" ) );\r
                if ( !p_adapter->p_currentPath->carrier )\r
                {\r
@@ -832,7 +831,7 @@ vnic_oid_query_info(
                break;\r
 \r
        case OID_GEN_BROADCAST_FRAMES_RCV:\r
-               VNIC_TRACE( VNIC_DBG_OID | VNIC_DBG_INFO,\r
+               VNIC_TRACE( VNIC_DBG_OID,\r
                        ("  received query for OID_GEN_BROADCAST_FRAMES_RCV\n" ) );\r
                if ( !p_adapter->p_currentPath->carrier )\r
                {\r
@@ -852,12 +851,12 @@ vnic_oid_query_info(
 #if defined( _DEBUG_ )\r
                if( oid == OID_802_3_PERMANENT_ADDRESS )\r
                {\r
-                       VNIC_TRACE( VNIC_DBG_OID | VNIC_DBG_INFO,\r
+                       VNIC_TRACE( VNIC_DBG_OID,\r
                                ("  received query for OID_802_3_PERMANENT_ADDRESS\n" ) );\r
                }\r
                else\r
                {\r
-                       VNIC_TRACE( VNIC_DBG_OID | VNIC_DBG_INFO,\r
+                       VNIC_TRACE( VNIC_DBG_OID,\r
                                ("  received query for OID_802_3_CURRENT_ADDRESS\n" ) );\r
                }\r
 #endif /* defined( _DEBUG_ )*/\r
@@ -866,7 +865,7 @@ vnic_oid_query_info(
                        p_adapter->pending_query = TRUE;\r
                        p_adapter->query_oid = oid_info;\r
 \r
-                       VNIC_TRACE( VNIC_DBG_OID | VNIC_DBG_INFO,\r
+                       VNIC_TRACE( VNIC_DBG_OID,\r
                                ("returning NDIS_STATUS_PENDING\n") );\r
                        status = NDIS_STATUS_PENDING;\r
                }\r
@@ -881,7 +880,7 @@ vnic_oid_query_info(
                VNIC_TRACE( VNIC_DBG_INFO,\r
                        ("  received query for OID_802_3_MULTICAST_LIST\n" ) );\r
        \r
-               if (!p_adapter->p_currentPath->carrier &&\r
+               if (!p_adapter->p_currentPath->carrier ||\r
                        !(p_adapter->p_viport->flags & INIC_FLAG_ENABLE_NIC) )\r
                {\r
                        p_adapter->pending_query = TRUE;\r
@@ -915,7 +914,7 @@ vnic_oid_query_info(
                }\r
                break;\r
        case OID_802_3_MAC_OPTIONS:\r
-               VNIC_TRACE( VNIC_DBG_OID | VNIC_DBG_INFO,\r
+               VNIC_TRACE( VNIC_DBG_OID,\r
                        ("  received query for OID_802_3_MAC_OPTIONS\n" ) );\r
                info32 = 0;\r
                break;\r
@@ -924,7 +923,7 @@ vnic_oid_query_info(
        case OID_802_3_RCV_ERROR_ALIGNMENT:\r
        case OID_802_3_XMIT_ONE_COLLISION:\r
        case OID_802_3_XMIT_MORE_COLLISIONS:\r
-               VNIC_TRACE( VNIC_DBG_OID | VNIC_DBG_INFO,\r
+               VNIC_TRACE( VNIC_DBG_OID,\r
                        ("  received query for OID_802_3_RCV_ERROR_ALIGNMENT or "\r
                        "OID_802_3_XMIT_ONE_COLLISION or "\r
                        "OID_802_3_XMIT_MORE_COLLISIONS\n" ) );\r
@@ -932,7 +931,7 @@ vnic_oid_query_info(
                break;\r
 \r
        case OID_TCP_TASK_OFFLOAD:\r
-                       VNIC_TRACE( VNIC_DBG_OID | VNIC_DBG_INFO,\r
+                       VNIC_TRACE( VNIC_DBG_OID,\r
                        ("  received query for OID_TCP_TASK_OFFLOAD\n" ) );\r
 \r
                src_buf = NULL;\r
@@ -959,7 +958,7 @@ vnic_oid_query_info(
        case OID_802_3_XMIT_LATE_COLLISIONS:\r
        case OID_PNP_CAPABILITIES:\r
                status = NDIS_STATUS_NOT_SUPPORTED;\r
-               VNIC_TRACE( VNIC_DBG_OID | VNIC_DBG_INFO,\r
+               VNIC_TRACE( VNIC_DBG_OID,\r
                        ("  received an unsupported oid of 0x%.8X!\n" , oid) );\r
                break;\r
 \r
@@ -971,7 +970,7 @@ vnic_oid_query_info(
 #endif\r
        default:\r
                status = NDIS_STATUS_INVALID_OID;\r
-               VNIC_TRACE( VNIC_DBG_OID | VNIC_DBG_INFO,\r
+               VNIC_TRACE( VNIC_DBG_OID,\r
                        ("  received an invalid oid of 0x%.8X!\n" , oid) );\r
                break;\r
        }\r
@@ -1011,7 +1010,7 @@ _vnic_complete_query(
        {\r
                if( p_oid_info->buf_len < buf_len )\r
                {\r
-                       VNIC_TRACE( VNIC_DBG_OID | VNIC_DBG_INFO,\r
+                       VNIC_TRACE( VNIC_DBG_OID,\r
                                ("Insufficient buffer space.  "\r
                                "Returning NDIS_STATUS_INVALID_LENGTH.\n") );\r
                        oid_status = NDIS_STATUS_INVALID_LENGTH;\r
@@ -1029,7 +1028,7 @@ _vnic_complete_query(
                }\r
                else\r
                {\r
-                       VNIC_TRACE( VNIC_DBG_OID | VNIC_DBG_INFO,\r
+                       VNIC_TRACE( VNIC_DBG_OID,\r
                                ("Returning NDIS_NOT_ACCEPTED") );\r
                        oid_status = NDIS_STATUS_NOT_ACCEPTED;\r
                }\r
@@ -1219,23 +1218,37 @@ NDIS_STATUS_RESET_IN_PROGRESS, NDIS_STATUS_SOFT_ERRORS, NDIS_STATUS_HARD_ERRORS
 */\r
 NDIS_STATUS\r
 vnic_reset(\r
-               OUT                     PBOOLEAN                                        p_addr_reset,\r
-       IN                              NDIS_HANDLE                                     adapter_context)\r
+       OUT                     PBOOLEAN                        p_addr_reset,\r
+       IN                      NDIS_HANDLE                     adapter_context)\r
 {\r
-//     vnic_adapter_t* p_adapter;\r
+       vnic_adapter_t* p_adapter;\r
+       ib_api_status_t         status;\r
 \r
        VNIC_ENTER( VNIC_DBG_INIT );\r
+\r
        CL_ASSERT( p_addr_reset );\r
        CL_ASSERT( adapter_context );\r
-       //p_adapter = (vnic_adapter_t*)adapter_context;\r
-       *p_addr_reset = TRUE;\r
 \r
-       UNREFERENCED_PARAMETER( adapter_context );\r
+       p_adapter = (vnic_adapter_t*)adapter_context;\r
 \r
+       status = vnic_reset_adapter( p_adapter );\r
        VNIC_EXIT( VNIC_DBG_INIT );\r
-       return NDIS_STATUS_SUCCESS;\r
-}\r
+       switch( status )\r
+       {\r
+               case IB_SUCCESS:\r
+                       *p_addr_reset = TRUE;\r
+                       return NDIS_STATUS_SUCCESS;\r
+               \r
+               case IB_NOT_DONE:\r
+                       return NDIS_STATUS_PENDING;\r
 \r
+               case IB_INVALID_STATE:\r
+                       return NDIS_STATUS_RESET_IN_PROGRESS;\r
+\r
+               default:\r
+                       return NDIS_STATUS_HARD_ERRORS;\r
+       }\r
+}\r
 \r
 //! Request changes in the state information that the miniport driver maintains\r
 /*  For example, this is used to set multicast addresses and the packet filter.\r
@@ -1272,7 +1285,7 @@ vnic_oid_set_info(
 \r
        CL_ASSERT( p_bytes_read );\r
        CL_ASSERT( p_bytes_needed );\r
-       CL_ASSERT( !p_adapter->pending_set );\r
+       CL_ASSERT( p_adapter->pending_set == 0 );\r
 \r
        status = NDIS_STATUS_SUCCESS;\r
        *p_bytes_needed = 0;\r
@@ -1296,7 +1309,9 @@ vnic_oid_set_info(
        /* Required General */\r
        case OID_GEN_CURRENT_PACKET_FILTER:\r
                VNIC_TRACE( VNIC_DBG_INFO,\r
-                       ("  received set for OID_GEN_CURRENT_PACKET_FILTER, %#x\n", *(uint32_t*)info_buf  ));\r
+                       ("  IOC %d received set for OID_GEN_CURRENT_PACKET_FILTER, %#x\n",\r
+                                               p_adapter->p_currentPath->pViport->ioc_num,\r
+                                               *(uint32_t*)info_buf  ));\r
                if ( !p_adapter->p_currentPath->carrier )\r
                {\r
                        status = NDIS_STATUS_NOT_ACCEPTED;\r
@@ -1318,14 +1333,14 @@ vnic_oid_set_info(
                break;\r
 \r
        case OID_GEN_CURRENT_LOOKAHEAD:\r
-               VNIC_TRACE( VNIC_DBG_OID | VNIC_DBG_INFO,\r
+               VNIC_TRACE( VNIC_DBG_OID,\r
                        ("  received set for OID_GEN_CURRENT_LOOKAHEAD\n" ));\r
                if( info_buf_len < buf_len )\r
                        status = NDIS_STATUS_INVALID_LENGTH;\r
                break;\r
 \r
        case OID_GEN_PROTOCOL_OPTIONS:\r
-               VNIC_TRACE( VNIC_DBG_OID | VNIC_DBG_INFO,\r
+               VNIC_TRACE( VNIC_DBG_OID,\r
                        ("  received set for OID_GEN_PROTOCOL_OPTIONS\n" ));\r
                if( info_buf_len < buf_len )\r
                        status = NDIS_STATUS_INVALID_LENGTH;\r
@@ -1333,7 +1348,7 @@ vnic_oid_set_info(
 \r
 #ifdef NDIS51_MINIPORT\r
        case OID_GEN_MACHINE_NAME:\r
-               VNIC_TRACE( VNIC_DBG_OID | VNIC_DBG_INFO,\r
+               VNIC_TRACE( VNIC_DBG_OID,\r
                        ("  received set for OID_GEN_MACHINE_NAME\n" ) );\r
                if( info_buf_len < buf_len )\r
                        status = NDIS_STATUS_INVALID_LENGTH;\r
@@ -1351,7 +1366,8 @@ vnic_oid_set_info(
                        break;\r
                }\r
                VNIC_TRACE( VNIC_DBG_INFO,\r
-                       ("  received set for OID_802_3_MULTICAST_LIST\n" ) );\r
+                       ("  IOC %d received set for OID_802_3_MULTICAST_LIST\n",\r
+                               p_adapter->p_currentPath->pViport->ioc_num ) );\r
                if( info_buf_len > MAX_MCAST * sizeof(mac_addr_t) )\r
                {\r
                        VNIC_TRACE( VNIC_DBG_INFO,\r
@@ -1367,7 +1383,7 @@ vnic_oid_set_info(
                }\r
                else if( info_buf == NULL && info_buf_len != 0 )\r
                {\r
-                       VNIC_TRACE( VNIC_DBG_OID | VNIC_DBG_INFO,\r
+                       VNIC_TRACE( VNIC_DBG_OID,\r
                                ("  OID_802_3_MULTICAST_LIST - Invalid input buffer.\n" ) );\r
                        status = NDIS_STATUS_INVALID_DATA;\r
                }\r
@@ -1380,7 +1396,7 @@ vnic_oid_set_info(
                break;\r
 \r
        case OID_TCP_TASK_OFFLOAD:\r
-               VNIC_TRACE( VNIC_DBG_OID | VNIC_DBG_INFO,\r
+               VNIC_TRACE( VNIC_DBG_OID,\r
                        ("  received set for OID_TCP_TASK_OFFLOAD\n" ) );\r
                buf_len = info_buf_len;\r
                status = __vnic_set_tcp_task_offload( p_adapter, info_buf, &buf_len );\r
@@ -1388,7 +1404,7 @@ vnic_oid_set_info(
 \r
        /* Optional General */\r
        case OID_GEN_TRANSPORT_HEADER_OFFSET:\r
-                       VNIC_TRACE( VNIC_DBG_OID | VNIC_DBG_INFO,\r
+                       VNIC_TRACE( VNIC_DBG_OID,\r
                                ("Set for OID_GEN_TRANSPORT_HEADER_OFFSET\n") );\r
                break;\r
 #ifdef NDIS51_MINIPORT\r
@@ -1396,7 +1412,7 @@ vnic_oid_set_info(
        case OID_GEN_VLAN_ID:\r
 #endif\r
                status = NDIS_STATUS_NOT_SUPPORTED;\r
-               VNIC_TRACE( VNIC_DBG_OID | VNIC_DBG_INFO,\r
+               VNIC_TRACE( VNIC_DBG_OID,\r
                        ("  received an unsupported oid of 0x%.8X!\n" , oid));\r
                break;\r
 \r
@@ -1423,7 +1439,7 @@ vnic_oid_set_info(
        case OID_GEN_PHYSICAL_MEDIUM:\r
        default:\r
                status = NDIS_STATUS_INVALID_OID;\r
-               VNIC_TRACE( VNIC_DBG_OID | VNIC_DBG_INFO,\r
+               VNIC_TRACE( VNIC_DBG_OID,\r
                        ("  received an invalid oid of 0x%.8X!\n" , oid));\r
                break;\r
        }\r
@@ -1465,37 +1481,21 @@ vnic_send_packets(
        IN                              PPNDIS_PACKET                           packet_array,\r
        IN                              UINT                                            num_packets )\r
 {\r
-       vnic_adapter_t          *p_adapter;\r
-       viport_t                        *p_viport;\r
+       vnic_adapter_t*  const  p_adapter =(vnic_adapter_t* const )adapter_context;\r
+       viport_t                        *p_viport = p_adapter->p_viport;\r
        UINT                            packet_num;\r
 \r
        VNIC_ENTER( VNIC_DBG_SEND );\r
 \r
        CL_ASSERT( adapter_context );\r
-\r
-       p_adapter = (vnic_adapter_t*)adapter_context;\r
-       p_viport = p_adapter->p_viport;\r
-\r
-       NdisAcquireSpinLock( &p_adapter->lock );\r
-\r
-       if( !p_adapter->carrier )\r
-       {\r
-               NdisReleaseSpinLock( &p_adapter->lock );\r
-               for( packet_num = 0; packet_num < num_packets; ++packet_num )\r
-               {\r
-                       NdisMSendComplete( p_adapter->h_handle,\r
-                               packet_array[packet_num], NDIS_STATUS_ADAPTER_NOT_READY );\r
-               }\r
-               VNIC_EXIT( VNIC_DBG_SEND );\r
-               return;\r
-       }\r
-       NdisReleaseSpinLock( &p_adapter->lock );\r
+       CL_ASSERT( p_viport );\r
 \r
        for( packet_num = 0; packet_num < num_packets; ++packet_num )\r
        {\r
                netpath_xmitPacket( p_adapter->p_currentPath,\r
                                                                                        packet_array[packet_num] );\r
        }\r
+       \r
        VNIC_EXIT( VNIC_DBG_SEND );\r
 }\r
 \r
@@ -1543,7 +1543,7 @@ vnic_resume_set_oids(
        IN                              vnic_adapter_t* const           p_adapter )\r
 {\r
        NDIS_STATUS             status = NDIS_STATUS_SUCCESS;\r
-       BOOLEAN                 pending_set;\r
+       int                                     pending_set;\r
        pending_oid_t   set_oid = {0};\r
 \r
        VNIC_ENTER( VNIC_DBG_OID );\r
@@ -1568,7 +1568,7 @@ vnic_resume_set_oids(
        if( pending_set )\r
        {\r
                set_oid = p_adapter->set_oid;\r
-               p_adapter->pending_set = FALSE;\r
+               --p_adapter->pending_set;\r
        }\r
        NdisReleaseSpinLock( &p_adapter->lock );\r
 \r
@@ -1579,6 +1579,9 @@ vnic_resume_set_oids(
                switch( set_oid.oid )\r
                {\r
                case OID_GEN_CURRENT_PACKET_FILTER:\r
+                               VNIC_TRACE( VNIC_DBG_INFO,\r
+                                       ("  IOC %d resume PACKET_FILTER set \n",\r
+                                               p_adapter->p_currentPath->pViport->ioc_num ) );\r
                        /* Validation already performed in the SetInformation path. */\r
                        p_adapter->packet_filter = *(PULONG)set_oid.p_buf;\r
                        NdisMSetInformationComplete( p_adapter->h_handle, status );\r
@@ -1590,6 +1593,10 @@ vnic_resume_set_oids(
                        break;\r
 \r
                case OID_802_3_MULTICAST_LIST:\r
+                                       VNIC_TRACE( VNIC_DBG_INFO,\r
+                                               ("  IOC %d resume MULTICAST_LIST\n",\r
+                                               p_adapter->p_currentPath->pViport->ioc_num ) );\r
+\r
                        NdisMSetInformationComplete( p_adapter->h_handle, status );\r
                        break;\r
 \r
@@ -1845,32 +1852,50 @@ _vnic_process_packet_filter(
 \r
        ASSERT( (p_adapter->p_viport->updates & ~MCAST_OVERFLOW) == 0 );\r
 \r
-       if( pkt_filter & NDIS_PACKET_TYPE_ALL_MULTICAST )\r
+       if( pkt_filter == 0 )\r
+       {       /* gateway will disable forwarding for associated viport */\r
+               p_adapter->p_viport->newFlags &= ~INIC_FLAG_ENABLE_NIC;\r
+               InterlockedOr( &p_adapter->p_viport->updates, NEED_LINK_CONFIG );\r
+       }\r
+       else\r
        {\r
-               if( !p_adapter->p_viport->flags & INIC_FLAG_ENABLE_MCAST_ALL )\r
+               if( !( p_adapter->p_viport->flags & INIC_FLAG_ENABLE_NIC ) )\r
+               {\r
+                       p_adapter->p_viport->newFlags &= ~INIC_FLAG_DISABLE_NIC;\r
+                       p_adapter->p_viport->newFlags |= INIC_FLAG_ENABLE_NIC;\r
+                       InterlockedOr( &p_adapter->p_viport->updates, NEED_LINK_CONFIG );\r
+               }\r
+\r
+               if( pkt_filter & NDIS_PACKET_TYPE_ALL_MULTICAST )\r
                {\r
-                       p_adapter->p_viport->newFlags |= INIC_FLAG_ENABLE_MCAST_ALL;\r
-                       // TODO: Shouldn't MCAST_OVERFLOW be a flag bit, not an update bit?\r
-                       InterlockedOr( &p_adapter->p_viport->updates,\r
+                       if( !( p_adapter->p_viport->flags & INIC_FLAG_ENABLE_MCAST_ALL ) )\r
+                       {\r
+                               p_adapter->p_viport->newFlags |= INIC_FLAG_ENABLE_MCAST_ALL;\r
+                               // TODO: Shouldn't MCAST_OVERFLOW be a flag bit, not an update bit?\r
+                               InterlockedOr( &p_adapter->p_viport->updates,\r
                                NEED_LINK_CONFIG | MCAST_OVERFLOW );\r
+                       }\r
                }\r
-       }\r
-       if ( pkt_filter & NDIS_PACKET_TYPE_PROMISCUOUS )\r
-       {\r
-               if( !p_adapter->p_viport->flags & INIC_FLAG_ENABLE_PROMISC )\r
+\r
+               if ( pkt_filter & NDIS_PACKET_TYPE_PROMISCUOUS )\r
                {\r
-                       p_adapter->p_viport->newFlags |= INIC_FLAG_ENABLE_PROMISC;\r
-                       InterlockedOr( &p_adapter->p_viport->updates, NEED_LINK_CONFIG );\r
+                       if( !( p_adapter->p_viport->flags & INIC_FLAG_ENABLE_PROMISC ) )\r
+                       {\r
+                               p_adapter->p_viport->newFlags |= INIC_FLAG_ENABLE_PROMISC;\r
+                               InterlockedOr( &p_adapter->p_viport->updates, NEED_LINK_CONFIG );\r
+                       }\r
                }\r
        }\r
-       /* BROADCAST and MULTICAST flags VEx enable by default */\r
-       p_adapter->pending_set = TRUE;\r
+       /* ENABLE NIC, BROADCAST and MULTICAST flags set on start */\r
+\r
+       ++p_adapter->pending_set;\r
        status = _viport_process_query( p_adapter->p_viport, FALSE );\r
        VNIC_TRACE( VNIC_DBG_INFO,\r
                                        ("LINK CONFIG status %x\n", status ));\r
        if( status != NDIS_STATUS_PENDING )\r
-               p_adapter->pending_set = FALSE;\r
-\r
+       {\r
+               --p_adapter->pending_set;\r
+       }\r
        VNIC_EXIT( VNIC_DBG_FUNC );\r
        return status;\r
 }\r
index 888c098..940d465 100644 (file)
@@ -418,6 +418,7 @@ _ibqp_detach_cb(
        CL_ASSERT( p_drep_rec );\r
 \r
        InterlockedExchange( &pQp->qpState, IB_DETACHED );\r
+       viport_failure( pQp->pViport );\r
 \r
        VNIC_EXIT( VNIC_DBG_IB );\r
 }\r
@@ -650,7 +651,7 @@ ibqp_postRecv(IbQp_t *pQp, Io_t *pIo)
                        pQp->pViport->p_adapter->ifc.get_err_str(ib_status), ib_status ));\r
 \r
                NdisReleaseSpinLock( &pQp->qpLock );\r
-               return FALSE;\r
+               return ib_status;\r
        }\r
        else\r
        {\r
index a20862e..65926a7 100644 (file)
@@ -29,7 +29,6 @@ netpath_init(
        return;\r
 }\r
 \r
-\r
 BOOLEAN\r
 netpath_addPath (\r
                                 Netpath_t              *pNetpath,\r
@@ -66,28 +65,6 @@ netpath_removePath(
 }\r
 \r
 \r
-BOOLEAN netpath_setUnicast(Netpath_t *pNetpath, uint8_t *pAddress)\r
-{\r
-       BOOLEAN ret = FALSE;\r
-\r
-       // TODO: Not called anywhere!!!\r
-       VNIC_TRACE( VNIC_DBG_NETPATH | VNIC_DBG_INFO,\r
-               ("Set %s MAC to %02X:%02X:%02X:%02X:%02X:%02X\n",\r
-               netpath_to_string(pNetpath->p_adapter, pNetpath),\r
-               pAddress[0],\r
-               pAddress[1],\r
-               pAddress[2],\r
-               pAddress[3],\r
-               pAddress[4],\r
-               pAddress[5]) );\r
-\r
-       if (pNetpath->pViport)\r
-       {\r
-               ret = viport_setUnicast( pNetpath->pViport, pAddress );\r
-       }\r
-       return ret;\r
-}\r
-\r
 \r
 int netpath_maxMtu(Netpath_t *pNetpath)\r
 {\r
index d128780..05b1df1 100644 (file)
@@ -74,6 +74,9 @@
 #define ROUNDUPP2(val, align)   \\r
         (((uintn_t)(val) + (uintn_t)(align) - 1) & (~((uintn_t)(align)-1)))\r
 #endif\r
+/* roundup address to align */\r
+#define ADDR_ROUNDUPP2(_addr, _align) \\r
+               ((VOID *)(((ULONG_PTR)(_addr) + (_align - 1)) & ( ~(_align - 1) )))\r
 \r
 #define VIPORT_TRAILER_ALIGNMENT       32\r
 #define BUFFER_SIZE(len)                       (sizeof(ViportTrailer_t) + ROUNDUPP2((len), VIPORT_TRAILER_ALIGNMENT))\r
index 02be3cf..d6e823d 100644 (file)
@@ -48,6 +48,8 @@ uint32_t
 viport_get_adapter_name(\r
                        IN              viport_t                *p_viport )\r
 {\r
+       /* TODO: consider unique addressable and friendly name \r
+               should I use ioc profile string ? seem too long */\r
        cl_memcpy(p_viport->p_adapter->name, DEFAULT_VNIC_NAME, sizeof(DEFAULT_VNIC_NAME) );\r
                return ( sizeof(DEFAULT_VNIC_NAME) );\r
 }\r
@@ -80,16 +82,7 @@ viport_config_defaults(
                                min( sizeof( p_adapter->ioc_info.profile.id_string ),\r
                                         sizeof( pConfig->ioc_string )) );\r
 \r
-       pControlConfig->ibConfig.sid =\r
-               0x10ULL << 56 |\r
-               0x00ULL << 48 |\r
-               0x06ULL << 40 |\r
-               0x6aULL << 32 |\r
-               0x00ULL << 24 |\r
-               0x00ULL << 16 |\r
-               0x00ULL << 8 |\r
-               ( (uint8_t)( p_adapter->ioc_info.profile.ioc_guid >> 24 ) & 0xFF );\r
-\r
+       pControlConfig->ibConfig.sid = 0; /* will set it later, from svc entries */\r
        pControlConfig->ibConfig.connData.pathId                = 0;\r
        pControlConfig->ibConfig.connData.inicInstance  = 0;\r
        pControlConfig->ibConfig.connData.pathNum               = 0;\r
@@ -119,16 +112,7 @@ viport_config_defaults(
        pControlConfig->reqRetryCount           = (uint8_t)p_adapter->params.ControlReqRetryCount;\r
        pControlConfig->rspTimeout                      = p_adapter->params.ControlRspTimeout;\r
 \r
-       pDataConfig->ibConfig.sid =\r
-               0x10LL << 56 |\r
-               0x00LL << 48 |\r
-               0x06LL << 40 |\r
-               0x6aLL << 32 |\r
-               0x00LL << 24 |\r
-               0x00LL << 16 |\r
-               0x01LL << 8 |\r
-               ( (uint8_t)( p_adapter->ioc_info.profile.ioc_guid >> 24 ) & 0xFF );\r
-\r
+       pDataConfig->ibConfig.sid = 0;  /* will set it later, from svc entries */\r
        pDataConfig->ibConfig.connData.pathId           = get_time_stamp_ms();\r
        pDataConfig->ibConfig.connData.inicInstance     = pControlConfig->inicInstance;\r
        pDataConfig->ibConfig.connData.pathNum          = 0;\r
@@ -420,7 +404,7 @@ viport_setUnicast(
 /* Returns flags for state machine operations. */\r
 NDIS_STATUS\r
 viport_setMulticast(\r
-               IN              viport_t                                *p_viport )\r
+               IN              viport_t*       const   p_viport )\r
 {\r
        vnic_adapter_t  *p_adapter = p_viport->p_adapter;\r
        uint32_t                updates = 0;\r
@@ -446,12 +430,6 @@ viport_setMulticast(
        }\r
        else if( p_adapter->mc_count == 0 )\r
        {\r
-               /* NDIS can send us a NULL array to clear all entries */\r
-               if( InterlockedAnd(\r
-                       &p_viport->updates, ~MCAST_OVERFLOW ) & MCAST_OVERFLOW )\r
-               {\r
-                       updates |= NEED_LINK_CONFIG;\r
-               }\r
                /* invalidate all entries for the remote */\r
                for (i = MCAST_ADDR_START;\r
                         i < min( MAX_ADDR_ARRAY, p_viport->numMacAddresses ); i++ )\r
@@ -459,7 +437,6 @@ viport_setMulticast(
                        p_viport->macAddresses[i].valid = 0;\r
                        p_viport->macAddresses[i].operation = INIC_OP_SET_ENTRY;\r
                }\r
-               updates |= NEED_ADDRESS_CONFIG;\r
        }\r
        else\r
        {\r
@@ -515,7 +492,6 @@ viport_setMulticast(
        return status;\r
 }\r
 \r
-\r
 NDIS_STATUS\r
 viport_getStats(\r
                IN              viport_t                *p_viport )\r
@@ -532,8 +508,8 @@ viport_getStats(
                p_viport->lastStatsTime = (uint32_t)stats_update_ms;\r
 \r
                InterlockedOr( &p_viport->updates, NEED_STATS );\r
-               // TODO: Should the following call be synchronous?\r
-               status = _viport_process_query( p_viport, TRUE );\r
+               \r
+               status = _viport_process_query( p_viport, FALSE );\r
                if ( status != NDIS_STATUS_SUCCESS )\r
                {\r
                        VNIC_TRACE( VNIC_DBG_ERROR,\r
@@ -553,30 +529,34 @@ viport_xmitPacket(
 {\r
        BOOLEAN status = FALSE;\r
     KIRQL              flags;\r
-       cl_list_item_t  *p_list_item;\r
+       LIST_ENTRY      *p_list_item;\r
 \r
        VNIC_ENTER( VNIC_DBG_VIPORT );\r
 \r
-       KeAcquireSpinLock( &p_viport->lock, &flags );\r
-\r
-       if( p_viport->p_adapter->xmitStarted )\r
+       if( !p_viport->p_adapter->xmitStarted )\r
+       {\r
+                       NdisInterlockedInsertTailList( \r
+                                       &p_viport->send_pending_list,\r
+                                       VNIC_LIST_ITEM_FROM_PACKET( p_packet ),\r
+                                       &p_viport->pending_list_lock );\r
+       }\r
+       else \r
        {\r
-               for( p_list_item = cl_qlist_remove_head( &p_viport->send_pending_list );\r
-                        p_list_item != cl_qlist_end( &p_viport->send_pending_list );\r
-                        p_list_item = cl_qlist_remove_head( &p_viport->send_pending_list ) )\r
+               while( ( p_list_item = NdisInterlockedRemoveHeadList(\r
+                       &p_viport->send_pending_list,\r
+                       &p_viport->pending_list_lock ) ) != NULL )\r
                {\r
+                       KeAcquireSpinLock( &p_viport->lock, &flags );\r
                        status = data_xmitPacket( &p_viport->data,\r
-                                                       VNIC_PACKET_FROM_LIST_ITEM( p_list_item ));\r
+                               VNIC_PACKET_FROM_LIST_ITEM( p_list_item ));\r
+                       KeReleaseSpinLock( &p_viport->lock, flags );\r
                }\r
+\r
+               /* just send a packet */\r
+               KeAcquireSpinLock( &p_viport->lock, &flags );\r
                status = data_xmitPacket( &p_viport->data, p_packet );\r
+               KeReleaseSpinLock( &p_viport->lock, flags );\r
        }\r
-       else\r
-       {\r
-               cl_qlist_insert_tail( &p_viport->send_pending_list,\r
-                       VNIC_LIST_ITEM_FROM_PACKET( p_packet ) );\r
-       }\r
-\r
-       KeReleaseSpinLock( &p_viport->lock, flags );\r
 \r
        VNIC_EXIT( VNIC_DBG_VIPORT );\r
        return status;\r
@@ -585,10 +565,14 @@ viport_xmitPacket(
 void viport_linkUp(viport_t *p_viport)\r
 {\r
        VNIC_ENTER( VNIC_DBG_VIPORT );\r
-       InterlockedExchange( &p_viport->p_adapter->carrier, TRUE );\r
-       NdisMIndicateStatus( p_viport->p_adapter->h_handle,\r
-                                               NDIS_STATUS_MEDIA_CONNECT, NULL, 0 );\r
-       NdisMIndicateStatusComplete( p_viport->p_adapter->h_handle );\r
+\r
+       if( p_viport->p_netpath->carrier == TRUE && \r
+               InterlockedExchange( &p_viport->p_adapter->carrier, TRUE ) == FALSE )\r
+       {\r
+               NdisMIndicateStatus( p_viport->p_adapter->h_handle,\r
+                                                       NDIS_STATUS_MEDIA_CONNECT, NULL, 0 );\r
+               NdisMIndicateStatusComplete( p_viport->p_adapter->h_handle );\r
+       }\r
        VNIC_EXIT( VNIC_DBG_VIPORT );\r
        return;\r
 }\r
@@ -596,10 +580,12 @@ void viport_linkUp(viport_t *p_viport)
 void viport_linkDown(viport_t *p_viport)\r
 {\r
        VNIC_ENTER( VNIC_DBG_VIPORT );\r
-       InterlockedExchange( &p_viport->p_adapter->carrier, FALSE );\r
-       NdisMIndicateStatus( p_viport->p_adapter->h_handle,\r
+       if ( InterlockedExchange( &p_viport->p_adapter->carrier, FALSE ) == TRUE )\r
+       {\r
+               NdisMIndicateStatus( p_viport->p_adapter->h_handle,\r
                                                NDIS_STATUS_MEDIA_DISCONNECT, NULL, 0 );\r
-       NdisMIndicateStatusComplete( p_viport->p_adapter->h_handle );\r
+               NdisMIndicateStatusComplete( p_viport->p_adapter->h_handle );\r
+       }\r
        VNIC_EXIT( VNIC_DBG_VIPORT );\r
        return;\r
 }\r
@@ -638,7 +624,14 @@ viport_failure(
 {\r
        VNIC_ENTER( VNIC_DBG_VIPORT );\r
 \r
-       InterlockedExchange( (volatile LONG*)&p_viport->errored,  1 );\r
+       CL_ASSERT( p_viport );\r
+\r
+       InterlockedExchange( &p_viport->p_netpath->carrier, FALSE );\r
+       \r
+       if( InterlockedExchange( (volatile LONG*)&p_viport->errored,  TRUE ) == FALSE )\r
+       {\r
+               viport_linkDown( p_viport );\r
+       }\r
 \r
        VNIC_EXIT( VNIC_DBG_VIPORT );\r
 }\r
@@ -649,15 +642,18 @@ viport_timeout(
                IN              void    *context )\r
 {\r
        viport_t        *p_viport = (viport_t *)context;\r
+       CL_ASSERT( p_viport );\r
 \r
        InterlockedExchange( &p_viport->timerActive, FALSE );\r
-       if( p_viport && p_viport->data.connected )\r
+       if( p_viport &&\r
+               p_viport->data.connected &&\r
+               !p_viport->errored )\r
        {\r
                // TODO: What about send failure?\r
                if( !p_viport->control.reqOutstanding )\r
                {\r
-                       control_heartbeatReq( &p_viport->control,\r
-                                                       p_viport->port_config.hbTimeout );\r
+                        control_heartbeatReq( &p_viport->control,\r
+                                               p_viport->port_config.hbTimeout );\r
                }\r
                else\r
                {       /* send WQE is taken, send heartbeat later */\r
@@ -672,7 +668,7 @@ viport_timer(
                IN               viport_t       *p_viport,\r
                IN              int                     timeout )\r
 {\r
-       VNIC_ENTER( VNIC_DBG_VIPORT );;\r
+       VNIC_ENTER( VNIC_DBG_VIPORT );\r
 \r
        InterlockedExchange( &p_viport->timerActive, TRUE );\r
        cl_timer_start( &p_viport->timer, (uint32_t)timeout );\r
@@ -1024,7 +1020,7 @@ _viport_process_query(
 \r
        if( sync )\r
        {\r
-               cl_event_wait_on( &p_viport->conn_event, EVENT_NO_TIMEOUT, FALSE );\r
+               cl_event_wait_on( &p_viport->conn_event, EVENT_NO_TIMEOUT, TRUE );\r
 \r
                if( p_viport->linkState != expected_state )\r
                {\r
index 529d124..6023e3f 100644 (file)
@@ -153,7 +153,8 @@ typedef struct _viport {
        LIST_ENTRY                                              listPtrs;\r
        KSPIN_LOCK                                              lock;\r
        cl_obj_t                                                obj;\r
-       cl_qlist_t                                              send_pending_list;\r
+       LIST_ENTRY                                              send_pending_list;\r
+       NDIS_SPIN_LOCK                                  pending_list_lock;\r
        struct _vnic_adapter                    *p_adapter;\r
        struct Netpath                                  *p_netpath;\r
        struct ViportConfig                             port_config;\r
@@ -161,7 +162,7 @@ typedef struct _viport {
        struct Data                                             data;\r
        uint64_t                                                iocGuid;\r
        uint64_t                                                portGuid;\r
-\r
+       uint32_t                                                ioc_num;\r
        // connected/disconnected state of control and data QPs.\r
        viport_state_t                                  state;\r
 \r
@@ -227,7 +228,7 @@ void     viport_restartXmit(viport_t *pViport);
 void     viport_recvPacket(viport_t *pViport, NDIS_PACKET *pkt );\r
 void     viport_failure(viport_t *pViport);\r
 BOOLEAN  viport_setUnicast(viport_t *pViport, uint8_t *pAddress);\r
-NDIS_STATUS viport_setMulticast( viport_t *pViport );\r
+NDIS_STATUS viport_setMulticast( viport_t* const pViport );\r
 #define  viport_portGuid(pViport) ((pViport)->portGuid)\r
 #define  viport_maxMtu(pViport) data_maxMtu(&(pViport)->data)\r
 \r
@@ -244,7 +245,6 @@ void    netpath_init( struct Netpath *pNetpath, struct _vnic_adapter *p_adapter
 BOOLEAN netpath_addPath(struct Netpath *pNetpath, viport_t *pViport);\r
 BOOLEAN netpath_removePath(struct Netpath *pNetpath, viport_t *pViport);\r
 BOOLEAN netpath_getStats(struct Netpath *pNetpath );\r
-BOOLEAN netpath_setUnicast(struct Netpath *pNetpath, uint8_t *pAddress);\r
 BOOLEAN netpath_setMulticast(struct Netpath *pNetpath, mc_list_t *mc_list,\r
        int mc_count);\r
 int     netpath_maxMtu(struct Netpath *pNetpath);\r