Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 7 Sep 2020 10:50:47 +0000 (UTC)
From:      Konstantin Belousov <kib@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: r365412 - in stable/11/sys/dev/mlx5: mlx5_core mlx5_en
Message-ID:  <202009071050.087Aol68092914@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Mon Sep  7 10:50:47 2020
New Revision: 365412
URL: https://svnweb.freebsd.org/changeset/base/365412

Log:
  MFC r365001:
  mlx5en: Implement SIOCGIFDOWNREASON.

Modified:
  stable/11/sys/dev/mlx5/mlx5_core/mlx5_core.h
  stable/11/sys/dev/mlx5/mlx5_core/mlx5_port.c
  stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_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 Sep  7 10:50:17 2020	(r365411)
+++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_core.h	Mon Sep  7 10:50:47 2020	(r365412)
@@ -127,6 +127,9 @@ void mlx5_core_event(struct mlx5_core_dev *dev, enum m
 void mlx5_enter_error_state(struct mlx5_core_dev *dev, bool force);
 void mlx5_disable_device(struct mlx5_core_dev *dev);
 void mlx5_recover_device(struct mlx5_core_dev *dev);
+int mlx5_query_pddr_troubleshooting_info(struct mlx5_core_dev *mdev,
+					 u16 *monitor_opcode,
+					 u8 *status_message, size_t sm_len);
 
 int mlx5_register_device(struct mlx5_core_dev *dev);
 void mlx5_unregister_device(struct mlx5_core_dev *dev);

Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_port.c
==============================================================================
--- stable/11/sys/dev/mlx5/mlx5_core/mlx5_port.c	Mon Sep  7 10:50:17 2020	(r365411)
+++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_port.c	Mon Sep  7 10:50:47 2020	(r365412)
@@ -1221,6 +1221,31 @@ int mlx5_query_pddr_range_info(struct mlx5_core_dev *m
 }
 EXPORT_SYMBOL_GPL(mlx5_query_pddr_range_info);
 
+int mlx5_query_pddr_troubleshooting_info(struct mlx5_core_dev *mdev,
+    u16 *monitor_opcode, u8 *status_message, size_t sm_len)
+{
+	int outlen = MLX5_ST_SZ_BYTES(pddr_reg);
+	u32 out[MLX5_ST_SZ_DW(pddr_reg)] = {0};
+	int err;
+
+	err = mlx5_query_pddr(mdev, MLX5_PDDR_TROUBLESHOOTING_INFO_PAGE, 1,
+	    out, outlen);
+	if (err != 0)
+		return err;
+	if (monitor_opcode != NULL) {
+		*monitor_opcode = MLX5_GET(pddr_reg, out,
+		    page_data.troubleshooting_info_page.status_opcode.
+		    monitor_opcodes);
+	}
+	if (status_message != NULL) {
+		strlcpy(status_message,
+		    MLX5_ADDR_OF(pddr_reg, out,
+		    page_data.troubleshooting_info_page.status_message),
+		    sm_len);
+	}
+	return (0);
+}
+
 int
 mlx5_query_mfrl_reg(struct mlx5_core_dev *mdev, u8 *reset_level)
 {

Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
==============================================================================
--- stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c	Mon Sep  7 10:50:17 2020	(r365411)
+++ stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c	Mon Sep  7 10:50:47 2020	(r365412)
@@ -3077,6 +3077,7 @@ mlx5e_ioctl(struct ifnet *ifp, u_long command, caddr_t
 {
 	struct mlx5e_priv *priv;
 	struct ifreq *ifr;
+	struct ifdownreason *ifdr;
 	struct ifi2creq i2c;
 	int error = 0;
 	int mask = 0;
@@ -3328,6 +3329,16 @@ out:
 		error = copyout(&i2c, ifr_data_get_ptr(ifr), sizeof(i2c));
 err_i2c:
 		PRIV_UNLOCK(priv);
+		break;
+	case SIOCGIFDOWNREASON:
+		ifdr = (struct ifdownreason *)data;
+		bzero(ifdr->ifdr_msg, sizeof(ifdr->ifdr_msg));
+		PRIV_LOCK(priv);
+		error = -mlx5_query_pddr_troubleshooting_info(priv->mdev, NULL,
+		    ifdr->ifdr_msg, sizeof(ifdr->ifdr_msg));
+		PRIV_UNLOCK(priv);
+		if (error == 0)
+			ifdr->ifdr_reason = IFDR_REASON_MSG;
 		break;
 
 	default:



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