git: f2e512d09bbe - stable/13 - mlx5: add a knob to administratively disable mlx5 fw dump setup

Konstantin Belousov kib at FreeBSD.org
Mon Jul 26 15:19:49 UTC 2021


The branch stable/13 has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=f2e512d09bbe6f28b48a5df246b495c3f62eb0c6

commit f2e512d09bbe6f28b48a5df246b495c3f62eb0c6
Author:     Konstantin Belousov <konstantinb at nvidia.com>
AuthorDate: 2021-07-05 07:55:19 +0000
Commit:     Konstantin Belousov <kib at FreeBSD.org>
CommitDate: 2021-07-26 13:51:12 +0000

    mlx5: add a knob to administratively disable mlx5 fw dump setup
    
    (cherry picked from commit 8391db038df87e0fa5519617e3bb35a2cf78b41e)
---
 sys/dev/mlx5/mlx5_core/mlx5_fwdump.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c b/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c
index 09e8f9f7660a..7bb563846144 100644
--- a/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c
+++ b/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c
@@ -59,6 +59,11 @@ mlx5_fwdump_destroy_dd(struct mlx5_core_dev *mdev)
 	mdev->dump_data = NULL;
 }
 
+static int mlx5_fw_dump_enable = 1;
+SYSCTL_INT(_hw_mlx5, OID_AUTO, fw_dump_enable, CTLFLAG_RDTUN | CTLFLAG_NOFETCH,
+    &mlx5_fw_dump_enable, 0,
+    "Enable fw dump setup and op");
+
 void
 mlx5_fwdump_prep(struct mlx5_core_dev *mdev)
 {
@@ -68,6 +73,14 @@ mlx5_fwdump_prep(struct mlx5_core_dev *mdev)
 	u32 addr, in, out, next_addr;
 
 	mdev->dump_data = NULL;
+
+	TUNABLE_INT_FETCH("hw.mlx5.fw_dump_enable", &mlx5_fw_dump_enable);
+	if (!mlx5_fw_dump_enable) {
+		mlx5_core_warn(mdev,
+		    "Firmware dump administratively prohibited\n");
+		return;
+	}
+
 	error = mlx5_vsc_find_cap(mdev);
 	if (error != 0) {
 		/* Inability to create a firmware dump is not fatal. */


More information about the dev-commits-src-all mailing list