svn commit: r365001 - in head/sys/dev/mlx5: mlx5_core mlx5_en
Konstantin Belousov
kib at FreeBSD.org
Mon Aug 31 16:27:05 UTC 2020
Author: kib
Date: Mon Aug 31 16:27:03 2020
New Revision: 365001
URL: https://svnweb.freebsd.org/changeset/base/365001
Log:
mlx5en: Implement SIOCGIFDOWNREASON.
Sponsored by: Mellanox Technologies - Nvidia
MFC after: 1 week
Modified:
head/sys/dev/mlx5/mlx5_core/mlx5_core.h
head/sys/dev/mlx5/mlx5_core/mlx5_port.c
head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
Modified: head/sys/dev/mlx5/mlx5_core/mlx5_core.h
==============================================================================
--- head/sys/dev/mlx5/mlx5_core/mlx5_core.h Mon Aug 31 16:25:55 2020 (r365000)
+++ head/sys/dev/mlx5/mlx5_core/mlx5_core.h Mon Aug 31 16:27:03 2020 (r365001)
@@ -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: head/sys/dev/mlx5/mlx5_core/mlx5_port.c
==============================================================================
--- head/sys/dev/mlx5/mlx5_core/mlx5_port.c Mon Aug 31 16:25:55 2020 (r365000)
+++ head/sys/dev/mlx5/mlx5_core/mlx5_port.c Mon Aug 31 16:27:03 2020 (r365001)
@@ -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: head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
==============================================================================
--- head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Mon Aug 31 16:25:55 2020 (r365000)
+++ head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Mon Aug 31 16:27:03 2020 (r365001)
@@ -3233,6 +3233,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;
@@ -3500,6 +3501,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:
More information about the svn-src-head
mailing list