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, URIBL_BLOCKED,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 43CAAC43381 for ; Thu, 28 Feb 2019 12:13:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0D496214D8 for ; Thu, 28 Feb 2019 12:13:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731322AbfB1MNU (ORCPT ); Thu, 28 Feb 2019 07:13:20 -0500 Received: from mail-il-dmz.mellanox.com ([193.47.165.129]:45528 "EHLO mellanox.co.il" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1731257AbfB1MNT (ORCPT ); Thu, 28 Feb 2019 07:13:19 -0500 Received: from Internal Mail-Server by MTLPINE1 (envelope-from ayal@mellanox.com) with ESMTPS (AES256-SHA encrypted); 28 Feb 2019 14:13:16 +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 x1SCDGeg013894; Thu, 28 Feb 2019 14:13:16 +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 x1SCDGOc015823; Thu, 28 Feb 2019 14:13:16 +0200 Received: (from ayal@localhost) by dev-l-vrt-210.mtl.labs.mlnx (8.15.2/8.15.2/Submit) id x1SCDGEU015822; Thu, 28 Feb 2019 14:13:16 +0200 From: Aya Levin To: David Ahern Cc: netdev@vger.kernel.org, Jiri Pirko , Moshe Shemesh , Eran Ben Elisha , Aya Levin Subject: [PATCH v4 iproute2-next 08/11] devlink: Add devlink health dump show command Date: Thu, 28 Feb 2019 14:13:01 +0200 Message-Id: <1551355984-15752-9-git-send-email-ayal@mellanox.com> X-Mailer: git-send-email 1.8.4.3 In-Reply-To: <1551355984-15752-1-git-send-email-ayal@mellanox.com> References: <1551355984-15752-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 8490fffdd0a6..30076d25199b 100644 --- a/devlink/devlink.c +++ b/devlink/devlink.c @@ -5993,6 +5993,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); @@ -6156,6 +6161,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) @@ -6173,6 +6179,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)); return -ENOENT; -- 2.14.1