From nobody Thu Jul 6 23:45:25 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4QxtSP2zkkz4lXbH; Thu, 6 Jul 2023 23:45:25 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4QxtSP2Rcrz4WVt; Thu, 6 Jul 2023 23:45:25 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1688687125; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=cJWPbLpET0hTq5u9nJObr9Zdt7RPjNTzAtWPIPrJ4Qg=; b=V2o4OOAYkBRZmXhJetcfJhyijnOp+f9iUIShfI7Hi6QZFS8AfZsGixqoJ8YLVsjTRqu7UT nWVcCY2oSMwfJFfKfluJKgWfHN0Nf28/IS1S5Lsb5mVzthmIIWgNQ/T1mgixHJHWANTpg6 z+5gncdRUeucsZ6AgtwsNNHul5QhlO4WYSoSvqiWoaPjSd4XGHkOXqcKm0vOLfUx/+W0gc bJp1e62a32KNEMSxi9vEIlsLWUBi0t9xkbU+qRskJ8ui5AjrC+1z9c7eD4WWIiptrZXY+j Fp3V5TvMyiKXaU6sAGH4xm39l0t222tI7rpO0rGhav1cH0ltsqKwzsr19uMV0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1688687125; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=cJWPbLpET0hTq5u9nJObr9Zdt7RPjNTzAtWPIPrJ4Qg=; b=iRQgQtApx6eH1/g26WfX/LwWpsPIGamY489q5f8CnCYQIJpPawWQpJrCmnrohWHsTcZ8cN G7Y2mVRVeemmMq3Xi4C4f0Wrdk5Stu74+EZlj+R9K5IkFUn3xvzVo9KBjovAwE1mYjeUOe VUfN9jJ3gd7kRQN/Vaut+3OgQ+wPC47Dav6KQdytKrTNNq1j+Jx5/yAYAY2RkiXtmRFDif rh0iUjCfYBNmRfBv3hEcNCxwTqkyTAg0BT8YpgutTr+onsoz49J61wjFzfExK6NtWbqOy/ sZOSJiehS+QnW9/xJSo6fZMD4Emf6siyiKa4T+JUFf51eywXiJq3u1bkvN4y0w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1688687125; a=rsa-sha256; cv=none; b=INQ0N+SChiF7WF3242qcPBYLEyNZKGVZ8McoQZZtEfs2F7p9V6I3oFfteclFM7kFICz72I aj8m0Bt+iPm0VCYbszjSIqVwSMcL7EzHDu40o3VliE18brH/pXbOjLRunZ8eaNXADvj9X+ FrFye6HNhCLoaz1/T3AjShGYCCqcYKGlnMA+SzYV9omuhMjgNPvlOaNkUg4NPp3EmWa/cG grdSU0BSRZcWmogXP9fXqRSt0UHGiks5AB/NVAU0dyHTB25WBV4BdA3Kh0DGocGmeeujpq a6w2vdCwf6ea6rZqqYkG/UP7umFR+qdGqAuhgJ03QXetwh0n04fFP+DixKIxWw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4QxtSP1B8WzH60; Thu, 6 Jul 2023 23:45:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 366NjP0n011129; Thu, 6 Jul 2023 23:45:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 366NjPoC011128; Thu, 6 Jul 2023 23:45:25 GMT (envelope-from git) Date: Thu, 6 Jul 2023 23:45:25 GMT Message-Id: <202307062345.366NjPoC011128@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Piotr Kubaj Subject: git: a146207d66f3 - main - ixl: implement support for dumping NIC registers List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: pkubaj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a146207d66f320ed239c1059de9df854b66b55b7 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by pkubaj: URL: https://cgit.FreeBSD.org/src/commit/?id=a146207d66f320ed239c1059de9df854b66b55b7 commit a146207d66f320ed239c1059de9df854b66b55b7 Author: Piotr Kubaj AuthorDate: 2023-07-06 23:45:44 +0000 Commit: Piotr Kubaj CommitDate: 2023-07-06 23:45:44 +0000 ixl: implement support for dumping NIC registers To enable faster debug of customer issues Intel wants an end user to gather information about PHY configuration and status to debug link and connection issues in the field. For this reason the end user should have possibility of obtaining PHYs registers values at runtime during debugging. Differential Revision: https://reviews.freebsd.org/D40354 Approved by: erj --- sys/dev/ixl/i40e_register.h | 12 +++++++++ sys/dev/ixl/ixl_pf_main.c | 60 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 72 insertions(+) diff --git a/sys/dev/ixl/i40e_register.h b/sys/dev/ixl/i40e_register.h index ffc6a7e506a6..85bcb454b3e6 100644 --- a/sys/dev/ixl/i40e_register.h +++ b/sys/dev/ixl/i40e_register.h @@ -1443,6 +1443,18 @@ #define I40E_PRTMAC_PCS_XAUI_SWAP_B_SWAP_RX_LANE1_MASK I40E_MASK(0x3, I40E_PRTMAC_PCS_XAUI_SWAP_B_SWAP_RX_LANE1_SHIFT) #define I40E_PRTMAC_PCS_XAUI_SWAP_B_SWAP_RX_LANE0_SHIFT 14 #define I40E_PRTMAC_PCS_XAUI_SWAP_B_SWAP_RX_LANE0_MASK I40E_MASK(0x3, I40E_PRTMAC_PCS_XAUI_SWAP_B_SWAP_RX_LANE0_SHIFT) +/* _i=0...3 */ /* Reset: GLOBR */ +#define I40E_PRTMAC_PCS_LINK_STATUS1(_i) (0x0008C200 + ((_i) * 4)) +#define I40E_PRTMAC_PCS_LINK_STATUS1_LINK_SPEED_SHIFT 24 +#define I40E_PRTMAC_PCS_LINK_STATUS1_LINK_SPEED_MASK \ + I40E_MASK(0x7, I40E_PRTMAC_PCS_LINK_STATUS1_LINK_SPEED_SHIFT) +#define I40E_PRTMAC_PCS_LINK_STATUS2 0x0008C220 +#define I40E_PRTMAC_PCS_LINK_CTRL 0x0008C260 +#define I40E_PRTMAC_PCS_XGMII_FIFO_STATUS 0x0008C320 +#define I40E_PRTMAC_PCS_AN_LP_STATUS 0x0008C680 +#define I40E_PRTMAC_PCS_KR_STATUS 0x0008CA00 +#define I40E_PRTMAC_PCS_FEC_KR_STATUS1 0x0008CC20 +#define I40E_PRTMAC_PCS_FEC_KR_STATUS2 0x0008CC40 #define I40E_GL_FWRESETCNT 0x00083100 /* Reset: POR */ #define I40E_GL_FWRESETCNT_FWRESETCNT_SHIFT 0 #define I40E_GL_FWRESETCNT_FWRESETCNT_MASK I40E_MASK(0xFFFFFFFF, I40E_GL_FWRESETCNT_FWRESETCNT_SHIFT) diff --git a/sys/dev/ixl/ixl_pf_main.c b/sys/dev/ixl/ixl_pf_main.c index 4a28afc185f0..1ba59c0592a7 100644 --- a/sys/dev/ixl/ixl_pf_main.c +++ b/sys/dev/ixl/ixl_pf_main.c @@ -67,6 +67,7 @@ static int ixl_sysctl_set_link_active(SYSCTL_HANDLER_ARGS); /* Debug Sysctls */ static int ixl_sysctl_link_status(SYSCTL_HANDLER_ARGS); static int ixl_sysctl_phy_abilities(SYSCTL_HANDLER_ARGS); +static int ixl_sysctl_phy_statistics(SYSCTL_HANDLER_ARGS); static int ixl_sysctl_sw_filter_list(SYSCTL_HANDLER_ARGS); static int ixl_sysctl_hw_res_alloc(SYSCTL_HANDLER_ARGS); static int ixl_sysctl_switch_config(SYSCTL_HANDLER_ARGS); @@ -2671,6 +2672,10 @@ ixl_add_device_sysctls(struct ixl_pf *pf) CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_NEEDGIANT, pf, 0, ixl_sysctl_queue_interrupt_table, "A", "View MSI-X indices for TX/RX queues"); + SYSCTL_ADD_PROC(ctx, debug_list, + OID_AUTO, "phy_statistics", CTLTYPE_STRING | CTLFLAG_RD, + pf, 0, ixl_sysctl_phy_statistics, "A", "PHY Statistics"); + if (pf->has_i2c) { SYSCTL_ADD_PROC(ctx, debug_list, OID_AUTO, "read_i2c_byte", @@ -3511,6 +3516,61 @@ ixl_sysctl_phy_abilities(SYSCTL_HANDLER_ARGS) return (error); } +static int +ixl_sysctl_phy_statistics(SYSCTL_HANDLER_ARGS) +{ + struct ixl_pf *pf = (struct ixl_pf *)arg1; + struct i40e_hw *hw = &pf->hw; + device_t dev = pf->dev; + struct sbuf *buf; + int error = 0; + + buf = sbuf_new_for_sysctl(NULL, NULL, 128, req); + if (buf == NULL) { + device_printf(dev, "Could not allocate sbuf for sysctl output.\n"); + return (ENOMEM); + } + + if (hw->mac.type == I40E_MAC_X722) { + sbuf_printf(buf, "\n" + "PCS Link Control Register: unavailable\n" + "PCS Link Status 1: unavailable\n" + "PCS Link Status 2: unavailable\n" + "XGMII FIFO Status: unavailable\n" + "Auto-Negotiation (AN) Status: unavailable\n" + "KR PCS Status: unavailable\n" + "KR FEC Status 1 – FEC Correctable Blocks Counter: unavailable\n" + "KR FEC Status 2 – FEC Uncorrectable Blocks Counter: unavailable" + ); + } else { + sbuf_printf(buf, "\n" + "PCS Link Control Register: %#010X\n" + "PCS Link Status 1: %#010X\n" + "PCS Link Status 2: %#010X\n" + "XGMII FIFO Status: %#010X\n" + "Auto-Negotiation (AN) Status: %#010X\n" + "KR PCS Status: %#010X\n" + "KR FEC Status 1 – FEC Correctable Blocks Counter: %#010X\n" + "KR FEC Status 2 – FEC Uncorrectable Blocks Counter: %#010X", + rd32(hw, I40E_PRTMAC_PCS_LINK_CTRL), + rd32(hw, I40E_PRTMAC_PCS_LINK_STATUS1(0)), + rd32(hw, I40E_PRTMAC_PCS_LINK_STATUS2), + rd32(hw, I40E_PRTMAC_PCS_XGMII_FIFO_STATUS), + rd32(hw, I40E_PRTMAC_PCS_AN_LP_STATUS), + rd32(hw, I40E_PRTMAC_PCS_KR_STATUS), + rd32(hw, I40E_PRTMAC_PCS_FEC_KR_STATUS1), + rd32(hw, I40E_PRTMAC_PCS_FEC_KR_STATUS2) + ); + } + + error = sbuf_finish(buf); + if (error) + device_printf(dev, "Error finishing sbuf: %d\n", error); + + sbuf_delete(buf); + return (error); +} + static int ixl_sysctl_sw_filter_list(SYSCTL_HANDLER_ARGS) {