Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 26 Mar 2018 21:06:23 +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: r331591 - stable/11/sys/dev/mlx5/mlx5_core
Message-ID:  <201803262106.w2QL6Ngg037236@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);
 



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