From owner-svn-src-stable@freebsd.org Mon Mar 26 21:06:24 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 9B78EF6BD17; Mon, 26 Mar 2018 21:06:24 +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 502317453E; Mon, 26 Mar 2018 21:06:24 +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 4AAF7123C3; Mon, 26 Mar 2018 21:06:24 +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 w2QL6OHk037239; Mon, 26 Mar 2018 21:06:24 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2QL6Ngg037236; Mon, 26 Mar 2018 21:06:23 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201803262106.w2QL6Ngg037236@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 26 Mar 2018 21:06:23 +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: r331591 - 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: 331591 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: Mon, 26 Mar 2018 21:06:24 -0000 Author: hselasky Date: Mon Mar 26 21:06:23 2018 New Revision: 331591 URL: https://svnweb.freebsd.org/changeset/base/331591 Log: MFC r330660: Add call to setup firmware data dump structure during device load in mlx5core. Do not consider the inability to create a firmware dump fatal, but inform about the situation and allow the driver to attach. The device might not implement the needed VSC, or we might not know the layout of the registers map. In either case, only firmware dump functionality is limited, the network operations should be fine. Submitted by: kib@ Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_core.h 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_core.h ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_core/mlx5_core.h Mon Mar 26 21:04:47 2018 (r331590) +++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_core.h Mon Mar 26 21:06:23 2018 (r331591) @@ -97,7 +97,7 @@ int mlx5_rename_eq(struct mlx5_core_dev *dev, int eq_i int mlx5_fwdump_init(void); void mlx5_fwdump_fini(void); -int mlx5_fwdump_prep(struct mlx5_core_dev *mdev); +void mlx5_fwdump_prep(struct mlx5_core_dev *mdev); void mlx5_fwdump(struct mlx5_core_dev *mdev); void mlx5_fwdump_clean(struct mlx5_core_dev *mdev); Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c Mon Mar 26 21:04:47 2018 (r331590) +++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c Mon Mar 26 21:06:23 2018 (r331591) @@ -69,15 +69,19 @@ mlx5_fwdump_destroy_dd(struct mlx5_dump_data *dd) free(dd, M_MLX5_DUMP); } -int +void mlx5_fwdump_prep(struct mlx5_core_dev *mdev) { struct mlx5_dump_data *dd; int error; error = mlx5_vsc_find_cap(mdev); - if (error != 0) - return (error); + if (error != 0) { + /* Inability to create a firmware dump is not fatal. */ + device_printf((&mdev->pdev->dev)->bsddev, "WARN: " + "mlx5_fwdump_prep failed %d\n", error); + return; + } dd = malloc(sizeof(struct mlx5_dump_data), M_MLX5_DUMP, M_WAITOK); switch (pci_get_device(mdev->pdev->dev.bsddev)) { case 0x1013: @@ -92,7 +96,7 @@ mlx5_fwdump_prep(struct mlx5_core_dev *mdev) break; default: free(dd, M_MLX5_DUMP); - return (0); /* silently fail to not prevent driver attach */ + return; /* silently fail, do not prevent driver attach */ } dd->dump_size = mlx5_fwdump_getsize(dd->rege); dd->dump = malloc(dd->dump_size * sizeof(uint32_t), M_MLX5_DUMP, @@ -102,7 +106,6 @@ mlx5_fwdump_prep(struct mlx5_core_dev *mdev) if (atomic_cmpset_rel_ptr((uintptr_t *)&mdev->dump_data, 0, (uintptr_t)dd) == 0) mlx5_fwdump_destroy_dd(dd); - return (0); } void Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_main.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_core/mlx5_main.c Mon Mar 26 21:04:47 2018 (r331590) +++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_main.c Mon Mar 26 21:06:23 2018 (r331591) @@ -1043,6 +1043,8 @@ static int mlx5_load_one(struct mlx5_core_dev *dev, st goto err_reg_dev; } + mlx5_fwdump_prep(dev); + clear_bit(MLX5_INTERFACE_STATE_DOWN, &dev->intf_state); set_bit(MLX5_INTERFACE_STATE_UP, &dev->intf_state);