From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_PASS,UNPARSEABLE_RELAY, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A58B4C00319 for ; Thu, 21 Feb 2019 13:43:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7A25C207E0 for ; Thu, 21 Feb 2019 13:43:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728224AbfBUNnJ (ORCPT ); Thu, 21 Feb 2019 08:43:09 -0500 Received: from mail-il-dmz.mellanox.com ([193.47.165.129]:43892 "EHLO mellanox.co.il" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728161AbfBUNnF (ORCPT ); Thu, 21 Feb 2019 08:43:05 -0500 Received: from Internal Mail-Server by MTLPINE1 (envelope-from ayal@mellanox.com) with ESMTPS (AES256-SHA encrypted); 21 Feb 2019 15:43:00 +0200 Received: from dev-l-vrt-210.mtl.labs.mlnx (dev-l-vrt-210.mtl.labs.mlnx [10.134.210.1]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id x1LDh0bZ014063; Thu, 21 Feb 2019 15:43:00 +0200 Received: from dev-l-vrt-210.mtl.labs.mlnx (localhost [127.0.0.1]) by dev-l-vrt-210.mtl.labs.mlnx (8.15.2/8.15.2/Debian-8ubuntu1) with ESMTP id x1LDh034018304; Thu, 21 Feb 2019 15:43:00 +0200 Received: (from ayal@localhost) by dev-l-vrt-210.mtl.labs.mlnx (8.15.2/8.15.2/Submit) id x1LDh0Mt018303; Thu, 21 Feb 2019 15:43:00 +0200 From: Aya Levin To: David Ahern Cc: netdev@vger.kernel.org, Jiri Pirko , Moshe Shemesh , Eran Ben Elisha , Aya Levin Subject: [PATCH v2 iproute2-next 08/11] devlink: Add devlink health dump show command Date: Thu, 21 Feb 2019 15:42:44 +0200 Message-Id: <1550756567-18227-9-git-send-email-ayal@mellanox.com> X-Mailer: git-send-email 1.8.4.3 In-Reply-To: <1550756567-18227-1-git-send-email-ayal@mellanox.com> References: <1550756567-18227-1-git-send-email-ayal@mellanox.com> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Add devlink dump show command which displays the last saved dump. Devlink health saves a single dump. If a dump is not already stored by the devlink for this reporter, devlink generates a new dump. The dump can be generated automatically when a reporter reports on an error or manually by user's request. The dump's output is defined by the reporter. The command uses the infra structure for flexible format output introduced in previous patch. Example: $ devlink health dump show pci/0000:00:09.0 reporter tx Signed-off-by: Aya Levin Reviewed-by: Moshe Shemesh Acked-by: Jiri Pirko --- devlink/devlink.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/devlink/devlink.c b/devlink/devlink.c index ef6a72f0b04e..627f8e819aa5 100644 --- a/devlink/devlink.c +++ b/devlink/devlink.c @@ -5942,6 +5942,11 @@ static int cmd_health_object_common(struct dl *dl, uint8_t cmd) return err; } +static int cmd_health_dump_show(struct dl *dl) +{ + return cmd_health_object_common(dl, DEVLINK_CMD_HEALTH_REPORTER_DUMP_GET); +} + static int cmd_health_diagnose(struct dl *dl) { return cmd_health_object_common(dl, DEVLINK_CMD_HEALTH_REPORTER_DIAGNOSE); @@ -6106,6 +6111,7 @@ static void cmd_health_help(void) pr_err("Usage: devlink health show [ dev DEV reporter REPORTER_NAME ]\n"); pr_err(" devlink health recover DEV reporter REPORTER_NAME\n"); pr_err(" devlink health diagnose DEV reporter REPORTER_NAME\n"); + pr_err(" devlink health dump show DEV reporter REPORTER_NAME\n"); } static int cmd_health(struct dl *dl) @@ -6123,6 +6129,12 @@ static int cmd_health(struct dl *dl) } else if (dl_argv_match(dl, "diagnose")) { dl_arg_inc(dl); return cmd_health_diagnose(dl); + } else if (dl_argv_match(dl, "dump")) { + dl_arg_inc(dl); + if (dl_argv_match(dl, "show")) { + dl_arg_inc(dl); + return cmd_health_dump_show(dl); + } } pr_err("Command \"%s\" not found\n", dl_argv(dl)); -- 2.14.1