From patchwork Sun May 5 00:33:33 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saeed Mahameed X-Patchwork-Id: 1095335 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=mellanox.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=Mellanox.com header.i=@Mellanox.com header.b="gRhsuZJv"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 44xRhc0bLSz9s4V for ; Sun, 5 May 2019 10:34:40 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727232AbfEEAei (ORCPT ); Sat, 4 May 2019 20:34:38 -0400 Received: from mail-eopbgr70052.outbound.protection.outlook.com ([40.107.7.52]:1287 "EHLO EUR04-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727404AbfEEAef (ORCPT ); Sat, 4 May 2019 20:34:35 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=i/B/09CNMTKAJYF8rs7p6+Ynm4v6ODbE3XAgx+ewOAc=; b=gRhsuZJvlnBYgs5e2+PyKUlNAL9h19H1DQZSxfklnlrx0f5Nl56iT8Iaz7wB7AfGC8JPAThp+a3JM3GcFwo0MjEvlg31HREQ/sIuJcOljWHxoZc5Ycr2Rp1qzeGv7SiQNUzQQTVQyybqHHu7f2NvQQStP4celRpJhC+2DIsRv8M= Received: from DB8PR05MB5898.eurprd05.prod.outlook.com (20.179.9.32) by DB8PR05MB5881.eurprd05.prod.outlook.com (20.179.10.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1856.11; Sun, 5 May 2019 00:33:33 +0000 Received: from DB8PR05MB5898.eurprd05.prod.outlook.com ([fe80::ed24:8317:76e4:1a07]) by DB8PR05MB5898.eurprd05.prod.outlook.com ([fe80::ed24:8317:76e4:1a07%5]) with mapi id 15.20.1856.012; Sun, 5 May 2019 00:33:33 +0000 From: Saeed Mahameed To: "David S. Miller" CC: "netdev@vger.kernel.org" , Jiri Pirko , Moshe Shemesh , Saeed Mahameed Subject: [net-next 14/15] net/mlx5: Add support for FW fatal reporter dump Thread-Topic: [net-next 14/15] net/mlx5: Add support for FW fatal reporter dump Thread-Index: AQHVAtorycA5HCVlPkqR2luU2dyXFA== Date: Sun, 5 May 2019 00:33:33 +0000 Message-ID: <20190505003207.1353-15-saeedm@mellanox.com> References: <20190505003207.1353-1-saeedm@mellanox.com> In-Reply-To: <20190505003207.1353-1-saeedm@mellanox.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.20.1 x-originating-ip: [73.15.39.150] x-clientproxiedby: BY5PR13CA0008.namprd13.prod.outlook.com (2603:10b6:a03:180::21) To DB8PR05MB5898.eurprd05.prod.outlook.com (2603:10a6:10:a4::32) authentication-results: spf=none (sender IP is ) smtp.mailfrom=saeedm@mellanox.com; x-ms-exchange-messagesentrepresentingtype: 1 x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 195f859a-dbb3-4191-76a5-08d6d0f14dbb x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600141)(711020)(4605104)(4618075)(2017052603328)(7193020); SRVR:DB8PR05MB5881; x-ms-traffictypediagnostic: DB8PR05MB5881: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:7219; x-forefront-prvs: 00286C0CA6 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(346002)(376002)(366004)(39850400004)(136003)(396003)(199004)(189003)(305945005)(52116002)(76176011)(36756003)(316002)(25786009)(6486002)(478600001)(14454004)(446003)(50226002)(476003)(11346002)(2616005)(26005)(7736002)(4326008)(99286004)(86362001)(6916009)(53936002)(66476007)(186003)(68736007)(66446008)(64756008)(66556008)(6436002)(66946007)(73956011)(6512007)(1076003)(66066001)(71190400001)(71200400001)(54906003)(256004)(102836004)(81156014)(81166006)(8936002)(3846002)(6506007)(386003)(107886003)(2906002)(8676002)(5660300002)(6116002)(486006); DIR:OUT; SFP:1101; SCL:1; SRVR:DB8PR05MB5881; H:DB8PR05MB5898.eurprd05.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: wjxc/gEiIBR+w0D0kkiiaBo7jmCQD83TqMkxyzvSjXmQxN+8B5509PsKfMAOCzl5NZ+Jy+GotxAYr6rp1bzy/w87Q+gQp8VCHpfd0FZGN1hcAEc2zCWs4xv2b+ED16pLhVcKI/jBnS/8L11F3VNRkMxHW4gfmqt9l3XnSTcwYZ/rQ2HQtJOtpigBG+2vBzmOI/fOQOLWKq4Ls7KWapAAp0czJlXTzDRWGPmyL1cf3tVILgAQEZWK7Ylo5SSoG/26FU/d/qjyzZfANUunCc5GUrDll4Z1ASXGpAkasNnBdpdeRINaGrnMQLqocFso5ZOGDf9TTD4VaNuWq3JMjrc9gvs05+ztl+vD2ndlJNzhtf83OISndl1KCyNGDXPCMXO7LgRAlKE7Q+iCOi3RNp4A/u+SRPSOgy4iiROBOAKkYS8= MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 195f859a-dbb3-4191-76a5-08d6d0f14dbb X-MS-Exchange-CrossTenant-originalarrivaltime: 05 May 2019 00:33:33.2713 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR05MB5881 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Moshe Shemesh Add support of dump callback for mlx5 FW fatal reporter. The FW fatal dump use cr-dump functionality to gather cr-space data for debug. The cr-dump uses vsc interface which is valid even if the FW command interface is not functional, which is the case in most FW fatal errors. The cr-dump is stored as a memory region snapshot to ease read by address. Command example and output: $ devlink health dump show pci/0000:82:00.0 reporter fw_fatal devlink_region_name: cr-space snapshot_id: 1 $ devlink region read pci/0000:82:00.0/cr-space snapshot 1 address 983064 length 8 00000000000f0018 e1 03 00 00 fb ae a9 3f Signed-off-by: Moshe Shemesh Signed-off-by: Saeed Mahameed --- .../net/ethernet/mellanox/mlx5/core/health.c | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/health.c b/drivers/net/ethernet/mellanox/mlx5/core/health.c index e64f0e32cd67..5271c88ef64c 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/health.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/health.c @@ -547,9 +547,48 @@ mlx5_fw_fatal_reporter_recover(struct devlink_health_reporter *reporter, return mlx5_health_care(dev); } +static int +mlx5_fw_fatal_reporter_dump(struct devlink_health_reporter *reporter, + struct devlink_fmsg *fmsg, void *priv_ctx) +{ + struct mlx5_core_dev *dev = devlink_health_reporter_priv(reporter); + char crdump_region[20]; + u32 snapshot_id; + int err; + + if (!mlx5_core_is_pf(dev)) { + mlx5_core_err(dev, "Only PF is permitted run FW fatal dump\n"); + return -EPERM; + } + + err = mlx5_crdump_collect(dev, crdump_region, &snapshot_id); + if (err) + return err; + + if (priv_ctx) { + struct mlx5_fw_reporter_ctx *fw_reporter_ctx = priv_ctx; + + err = mlx5_fw_reporter_ctx_pairs_put(fmsg, fw_reporter_ctx); + if (err) + return err; + } + + err = devlink_fmsg_string_pair_put(fmsg, "devlink_region_name", + crdump_region); + if (err) + return err; + + err = devlink_fmsg_u32_pair_put(fmsg, "snapshot_id", snapshot_id); + if (err) + return err; + + return 0; +} + static const struct devlink_health_reporter_ops mlx5_fw_fatal_reporter_ops = { .name = "fw_fatal", .recover = mlx5_fw_fatal_reporter_recover, + .dump = mlx5_fw_fatal_reporter_dump, }; #define MLX5_REPORTER_FW_GRACEFUL_PERIOD 1200000