[MLX4] Soft Reset: (bugfix in error flow) handling a case when MLX4_BUS fails during...
authorleonidk <leonidk@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Sun, 18 Jan 2009 16:11:56 +0000 (16:11 +0000)
committerleonidk <leonidk@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Sun, 18 Jan 2009 16:11:56 +0000 (16:11 +0000)
Soft Reset mechanism is used only in Ethernet mode of ConnectX HCA.

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

hw/mlx4/kernel/bus/drv/pdo.c
hw/mlx4/kernel/bus/inc/ib_verbs.h
hw/mlx4/kernel/bus/net/catas.c
hw/mlx4/kernel/bus/net/main.c
inc/iba/ib_types.h

index 826f834..a14f042 100644 (file)
@@ -30,11 +30,19 @@ EvtDeviceProcessQueryInterfaceRequest(
        UNUSED_PARAM(InterfaceType);\r
        UNUSED_PARAM(ExposedInterfaceSpecificData);\r
 \r
-       p_ib_ifc->p_ibdev = p_fdo->bus_ib_ifc.p_ibdev;\r
-       p_ib_ifc->pmlx4_dev = p_fdo->bus_ib_ifc.pmlx4_dev;\r
-       p_ib_ifc->is_livefish = p_fdo->bus_ib_ifc.is_livefish;\r
+       if (p_fdo->pci_dev.dev) {\r
+               p_ib_ifc->p_ibdev = p_fdo->bus_ib_ifc.p_ibdev;\r
+               p_ib_ifc->pmlx4_dev = p_fdo->bus_ib_ifc.pmlx4_dev;\r
+               p_ib_ifc->is_livefish = p_fdo->bus_ib_ifc.is_livefish;\r
+               return STATUS_SUCCESS;\r
+       }\r
+       else {\r
+               p_ib_ifc->p_ibdev = NULL;\r
+               p_ib_ifc->pmlx4_dev = NULL;\r
+               p_ib_ifc->is_livefish = FALSE;\r
+               return STATUS_UNSUCCESSFUL;\r
+       }\r
 \r
-       return STATUS_SUCCESS;\r
 }\r
 \r
 NTSTATUS\r
@@ -182,7 +190,7 @@ Return Value:
        p_pdo->PdoDevice = hChild;\r
 \r
        //\r
-       // Set some properties for the child device.\r
+       // Set PnP properties for the child device.\r
        //\r
        WDF_DEVICE_PNP_CAPABILITIES_INIT(&pnpCaps);\r
        pnpCaps.Removable         = WdfTrue;\r
@@ -194,6 +202,9 @@ Return Value:
 \r
        WdfDeviceSetPnpCapabilities(hChild, &pnpCaps);\r
 \r
+       //\r
+       // Set Power properties for the child device\r
+       //\r
        WDF_DEVICE_POWER_CAPABILITIES_INIT(&powerCaps);\r
 \r
        powerCaps.DeviceD1 = WdfTrue;\r
@@ -209,6 +220,9 @@ Return Value:
 \r
        WdfDeviceSetPowerCapabilities(hChild, &powerCaps);\r
 \r
+       //\r
+       // Set bus IB interface\r
+       //\r
        p_fdo->bus_ib_ifc.port_id = (u8) SerialNo;\r
        p_fdo->bus_ib_ifc.pVipBusIfc = &p_fdo->mtnic_Ifc;\r
        p_fdo->bus_ib_ifc.mlx4_interface.mlx4_pd_alloc = mlx4_pd_alloc;\r
index da886ff..94be539 100644 (file)
@@ -272,7 +272,8 @@ enum ib_event_type {
        IB_EVENT_QP_LAST_WQE_REACHED            = IB_AE_SRQ_QP_LAST_WQE_REACHED,\r
        IB_EVENT_RESET_DRIVER                           = IB_AE_RESET_DRIVER,   // device will be reset upon fatal error\r
        IB_EVENT_RESET_CLIENT                           = IB_AE_RESET_CLIENT,   // device will be reset upon client request\r
-       IB_EVENT_RESET_END                                      = IB_AE_RESET_END,              // device has been reset \r
+       IB_EVENT_RESET_END                                      = IB_AE_RESET_END,              // device has been reset \r
+       IB_EVENT_RESET_FAILED                           = IB_AE_RESET_FAILED,           // device has been reset \r
        IB_EVENT_LID_CHANGE                                     = IB_AE_UNKNOWN + 1,\r
        IB_EVENT_PKEY_CHANGE,\r
        IB_EVENT_SM_CHANGE,\r
index 29132a2..e48ecf8 100644 (file)
@@ -285,12 +285,16 @@ int mlx4_reset_execute( struct ib_event_handler *event_handler )
 
        // restart the device
        err = mlx4_restart_one(pdev);
-
-       // recreate interfaces
-       fix_bus_ifc(pdev);
+       if (err) {
+               event.event = IB_EVENT_RESET_FAILED;
+       }
+       else {
+               // recreate interfaces
+               fix_bus_ifc(pdev);
+               event.event = IB_EVENT_RESET_END;
+       }
 
        // notify the clients
-       event.event = IB_EVENT_RESET_END;
        list_for_each_entry_safe(handler, thandler, &tlist, 
                list, struct ib_event_handler, struct ib_event_handler)
        {
index 6d7d848..8ea460e 100644 (file)
@@ -911,6 +911,9 @@ int mlx4_init_one(struct pci_dev *pdev)
                        goto err;
 #endif
 
+       /* we are going to recreate device anyway */
+       pdev->dev = NULL;
+       
        /* find the type of device */
        id = mlx4_find_pci_dev(pdev->ven_id, pdev->dev_id);
        if (id == NULL) {
@@ -959,9 +962,12 @@ run_as_livefish:
                dev->flags |= MLX4_FLAG_LIVEFISH;
        if (mlx4_is_livefish(dev)) {
                err = mlx4_register_device(dev);
-               if (err)
+               if (err) {
                        MLX4_PRINT(TRACE_LEVEL_INFORMATION ,MLX4_DBG_LOW ,
                                ("mlx4_register_device for livefish failed, trying to proceed.\n"));
+                       pdev->dev = NULL;
+                       kfree(priv);
+               }
                goto end;
        }
 
@@ -1030,6 +1036,7 @@ err_cmd:
        mlx4_cmd_cleanup(dev);
 
 err_free_dev:
+       pdev->dev = NULL;
        kfree(priv);
 
 err:
index 9ad64a3..c62da28 100644 (file)
@@ -8796,6 +8796,7 @@ typedef enum _ib_async_event_t
        IB_AE_RESET_DRIVER,\r
        IB_AE_RESET_CLIENT,\r
        IB_AE_RESET_END,\r
+       IB_AE_RESET_FAILED,\r
        IB_AE_UNKNOWN           /* ALWAYS LAST ENUM VALUE */\r
 \r
 }      ib_async_event_t;\r
@@ -8909,6 +8910,9 @@ typedef enum _ib_async_event_t
 *      IB_AE_RESET_END\r
 *              Device has been reset.\r
 *\r
+*      IB_AE_RESET_FAILED\r
+*              Device reset failed. The Low Level Driver is inoperational.\r
+*\r
 *      IB_AE_UNKNOWN\r
 *              An unknown error occurred which cannot be attributed to any\r
 *              resource; behavior is indeterminate.\r