Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 3 Apr 2018 09:27:05 +0000 (UTC)
From:      Hans Petter Selasky <hselasky@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r331914 - stable/11/sys/dev/mlx5/mlx5_core
Message-ID:  <201804030927.w339R55D038917@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: hselasky
Date: Tue Apr  3 09:27:05 2018
New Revision: 331914
URL: https://svnweb.freebsd.org/changeset/base/331914

Log:
  MFC r331821:
  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.
  
  Submitted by:	slavash@
  Sponsored by:	Mellanox Technologies

Modified:
  stable/11/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c
  stable/11/sys/dev/mlx5/mlx5_core/mlx5_main.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c
==============================================================================
--- stable/11/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c	Tue Apr  3 09:25:52 2018	(r331913)
+++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c	Tue Apr  3 09:27:05 2018	(r331914)
@@ -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: stable/11/sys/dev/mlx5/mlx5_core/mlx5_main.c
==============================================================================
--- stable/11/sys/dev/mlx5/mlx5_core/mlx5_main.c	Tue Apr  3 09:25:52 2018	(r331913)
+++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_main.c	Tue Apr  3 09:27:05 2018	(r331914)
@@ -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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201804030927.w339R55D038917>