svn commit: r330660 - head/sys/dev/mlx5/mlx5_core

Hans Petter Selasky hselasky at FreeBSD.org
Thu Mar 8 16:19:02 UTC 2018


Author: hselasky
Date: Thu Mar  8 16:19:01 2018
New Revision: 330660
URL: https://svnweb.freebsd.org/changeset/base/330660

Log:
  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@
  MFC after:	1 week
  Sponsored by:	Mellanox Technologies

Modified:
  head/sys/dev/mlx5/mlx5_core/mlx5_core.h
  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_core.h
==============================================================================
--- head/sys/dev/mlx5/mlx5_core/mlx5_core.h	Thu Mar  8 15:58:30 2018	(r330659)
+++ head/sys/dev/mlx5/mlx5_core/mlx5_core.h	Thu Mar  8 16:19:01 2018	(r330660)
@@ -82,7 +82,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: head/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c
==============================================================================
--- head/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c	Thu Mar  8 15:58:30 2018	(r330659)
+++ head/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c	Thu Mar  8 16:19:01 2018	(r330660)
@@ -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: head/sys/dev/mlx5/mlx5_core/mlx5_main.c
==============================================================================
--- head/sys/dev/mlx5/mlx5_core/mlx5_main.c	Thu Mar  8 15:58:30 2018	(r330659)
+++ head/sys/dev/mlx5/mlx5_core/mlx5_main.c	Thu Mar  8 16:19:01 2018	(r330660)
@@ -1022,6 +1022,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);
 


More information about the svn-src-head mailing list