Author: hselasky
Date: Fri Mar 30 19:43:15 2018
New Revision: 331821
URL: https://svnweb.freebsd.org/changeset/base/331821

Log:
  Prepare for FW dump in error state in mlx5core.
  
  - Move firmware dump prep and cleanup to init_one() and remove_one() so that
  the init and cleanup will happen only upon driver reload.
  - Add some prints to indicate firmware dump.
  
  MFC after:    3 days
  Submitted by: slavash@
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c
  head/sys/dev/mlx5/mlx5_core/mlx5_main.c

Modified: head/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c
==============================================================================
--- head/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c   Fri Mar 30 19:39:27 2018        
(r331820)
+++ head/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c   Fri Mar 30 19:43:15 2018        
(r331821)
@@ -116,14 +116,18 @@ mlx5_fwdump(struct mlx5_core_dev *mdev)
        uint32_t i, ri;
        int error;
 
+       dev_info(&mdev->pdev->dev, "Issuing FW dump\n");
        dd = (struct mlx5_dump_data *)atomic_load_acq_ptr((uintptr_t *)
            &mdev->dump_data);
        if (dd == NULL)
                return;
        mtx_lock(&dd->dump_lock);
-       if (dd->dump_valid)
+       if (dd->dump_valid) {
                /* only one dump */
+               dev_warn(&mdev->pdev->dev,
+                   "Only one FW dump can be captured aborting FW dump\n");
                goto failed;
+       }
 
        /* mlx5_vsc already warns, be silent. */
        error = mlx5_vsc_lock(mdev);

Modified: head/sys/dev/mlx5/mlx5_core/mlx5_main.c
==============================================================================
--- head/sys/dev/mlx5/mlx5_core/mlx5_main.c     Fri Mar 30 19:39:27 2018        
(r331820)
+++ head/sys/dev/mlx5/mlx5_core/mlx5_main.c     Fri Mar 30 19:43:15 2018        
(r331821)
@@ -1056,8 +1056,6 @@ static int mlx5_load_one(struct mlx5_core_dev *dev, st
                goto err_fs;
        }
 
-       mlx5_fwdump_prep(dev);
-
        clear_bit(MLX5_INTERFACE_STATE_DOWN, &dev->intf_state);
        set_bit(MLX5_INTERFACE_STATE_UP, &dev->intf_state);
 
@@ -1127,7 +1125,6 @@ static int mlx5_unload_one(struct mlx5_core_dev *dev, 
                goto out;
        }
 
-       mlx5_fwdump_clean(dev);
        mlx5_unregister_device(dev);
 
        mlx5_cleanup_fs(dev);
@@ -1179,7 +1176,6 @@ struct mlx5_core_event_handler {
                      void *data);
 };
 
-
 static int init_one(struct pci_dev *pdev,
                    const struct pci_device_id *id)
 {
@@ -1224,6 +1220,8 @@ static int init_one(struct pci_dev *pdev,
                goto clean_health;
        }
 
+       mlx5_fwdump_prep(dev);
+
        pci_save_state(pdev->dev.bsddev);
        return 0;
 
@@ -1248,6 +1246,7 @@ static void remove_one(struct pci_dev *pdev)
                return;
        }
 
+       mlx5_fwdump_clean(dev);
        mlx5_pagealloc_cleanup(dev);
        mlx5_health_cleanup(dev);
        mlx5_pci_close(dev, priv);
@@ -1264,6 +1263,7 @@ static pci_ers_result_t mlx5_pci_err_detected(struct p
        dev_info(&pdev->dev, "%s was called\n", __func__);
        mlx5_enter_error_state(dev, false);
        mlx5_unload_one(dev, priv, false);
+
        if (state) {
                mlx5_drain_health_wq(dev);
                mlx5_pci_disable_device(dev);
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to