From owner-svn-src-stable@freebsd.org Tue Apr 3 09:27:06 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 335D6F6FB08; Tue, 3 Apr 2018 09:27:06 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D583970518; Tue, 3 Apr 2018 09:27:05 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D086E22871; Tue, 3 Apr 2018 09:27:05 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w339R5bV038922; Tue, 3 Apr 2018 09:27:05 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w339R55D038917; Tue, 3 Apr 2018 09:27:05 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201804030927.w339R55D038917@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Tue, 3 Apr 2018 09:27:05 +0000 (UTC) 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 X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/dev/mlx5/mlx5_core X-SVN-Commit-Revision: 331914 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Apr 2018 09:27:06 -0000 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);