From owner-svn-src-stable@freebsd.org Mon Sep 7 10:36:08 2020 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C95FA3EE2C8; Mon, 7 Sep 2020 10:36:08 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BlPp04vF2z3gmy; Mon, 7 Sep 2020 10:36:08 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8B4161E198; Mon, 7 Sep 2020 10:36:08 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 087Aa8tf086590; Mon, 7 Sep 2020 10:36:08 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 087Aa7rl086587; Mon, 7 Sep 2020 10:36:07 GMT (envelope-from kib@FreeBSD.org) Message-Id: <202009071036.087Aa7rl086587@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 7 Sep 2020 10:36:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r365407 - in stable/12/sys/dev/mlx5: mlx5_core mlx5_en X-SVN-Group: stable-12 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in stable/12/sys/dev/mlx5: mlx5_core mlx5_en X-SVN-Commit-Revision: 365407 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Sep 2020 10:36:08 -0000 Author: kib Date: Mon Sep 7 10:36:07 2020 New Revision: 365407 URL: https://svnweb.freebsd.org/changeset/base/365407 Log: MFC r365001: mlx5en: Implement SIOCGIFDOWNREASON. Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_core.h stable/12/sys/dev/mlx5/mlx5_core/mlx5_port.c stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_core.h ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_core/mlx5_core.h Mon Sep 7 10:35:22 2020 (r365406) +++ stable/12/sys/dev/mlx5/mlx5_core/mlx5_core.h Mon Sep 7 10:36:07 2020 (r365407) @@ -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/12/sys/dev/mlx5/mlx5_core/mlx5_port.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_core/mlx5_port.c Mon Sep 7 10:35:22 2020 (r365406) +++ stable/12/sys/dev/mlx5/mlx5_core/mlx5_port.c Mon Sep 7 10:36:07 2020 (r365407) @@ -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/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Mon Sep 7 10:35:22 2020 (r365406) +++ stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Mon Sep 7 10:36:07 2020 (r365407) @@ -3195,6 +3195,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; @@ -3456,6 +3457,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: