From patchwork Thu Oct 8 11:58:03 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Coiby Xu X-Patchwork-Id: 11822783 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=-12.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable 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 6ADE1C4363A for ; Thu, 8 Oct 2020 11:58:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0128B20B1F for ; Thu, 8 Oct 2020 11:58:29 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="g8jm4x6w" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727407AbgJHL61 (ORCPT ); Thu, 8 Oct 2020 07:58:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33262 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725802AbgJHL60 (ORCPT ); Thu, 8 Oct 2020 07:58:26 -0400 Received: from mail-pf1-x443.google.com (mail-pf1-x443.google.com [IPv6:2607:f8b0:4864:20::443]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 61176C061755; Thu, 8 Oct 2020 04:58:26 -0700 (PDT) Received: by mail-pf1-x443.google.com with SMTP id 144so3800991pfb.4; Thu, 08 Oct 2020 04:58:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=frpVJGSrADc0qf4QOcahuyZ6/84Fj8bNZxACxFn3RQ4=; b=g8jm4x6wbGy35dyRV6AKdPZZSFPnwVHTeM7mcMdx5R40sYzE/l5FKVH9PtYAM5hkaG 2aeIKXjZScyO5YcXTYO5FJXptCEA0HAY5BbCeYaZekMQbHdT/YuIEomnpR92nTO75H/C slXKMXaEj5y5fg8mMXKl1soovIzdu0/AnJnhKk2C0vd3nllhzQjUnnclwQLTKq+S8dMN Fujdc6fyCg4uOS4cI5h4UlyDJWMGGk178J/p110UDckdWDosN/QcGHN8U0AkDvLnA//n RIAmCSVsilfPOdnuh800KtXKpBa8Ntiwh9xtCIs8WIn0HZo2chYCE+f4I/I1MmHPvStH VTOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=frpVJGSrADc0qf4QOcahuyZ6/84Fj8bNZxACxFn3RQ4=; b=T1FqARbtj11AW86oBlEIuZdb0263OzxH4XdP3rF88uljKPTJ2RpI1I5FoKGg/1UY81 GWfbq7P4PSwWW0dIPsajfCub8Vexf6LMfTnVzRrLXycN8kWmr8WiBEmXLLxNyQKlPeb5 E3bV1NtWbW0jSlmNBlgFfgp8OuRzxxYEiOVlNzYUCf0sr3feXNoMq3Ac5rUUiRkM0DKR 2fR+R5NAH1YBhCGwmfnvJQiooEvt5fbMkP0jnuu0J2eDZIQ/t0Yb52Pxnkg90F1xZs4P EsjaUhkpHajKhV6DJ4mbG0p7OCa+0nnRCDvM9KIw1qWmfyG6dwhZv/x5BT1+Nlt5Iq7Z rdjg== X-Gm-Message-State: AOAM533XG4klj8VzxOHL0+v5Dw59vZttuHxWDNexaOzhxBLSOtSl2gTU wQOvmmpd5rwaQR7d7yOl94YP4Di2/IyDPw== X-Google-Smtp-Source: ABdhPJykc9dPin9J4WvzqMrHsbMFOV+UMGcrbcTfHEcjT7KC4+bado0v1kTE2x832NSVMvP2FwOYIw== X-Received: by 2002:a17:90a:e453:: with SMTP id jp19mr8152320pjb.34.1602158305838; Thu, 08 Oct 2020 04:58:25 -0700 (PDT) Received: from localhost ([2001:e42:102:1532:160:16:113:140]) by smtp.gmail.com with ESMTPSA id k9sm6380537pfc.96.2020.10.08.04.58.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Oct 2020 04:58:25 -0700 (PDT) From: Coiby Xu To: devel@driverdev.osuosl.org Cc: Benjamin Poirier , Shung-Hsi Yu , Manish Chopra , GR-Linux-NIC-Dev@marvell.com (supporter:QLOGIC QLGE 10Gb ETHERNET DRIVER), Greg Kroah-Hartman , linux-kernel@vger.kernel.org (open list), netdev@vger.kernel.org (open list:QLOGIC QLGE 10Gb ETHERNET DRIVER) Subject: [PATCH v1 1/6] staging: qlge: Initialize devlink health dump framework for the dlge driver Date: Thu, 8 Oct 2020 19:58:03 +0800 Message-Id: <20201008115808.91850-2-coiby.xu@gmail.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201008115808.91850-1-coiby.xu@gmail.com> References: <20201008115808.91850-1-coiby.xu@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Initialize devlink health dump framework for the dlge driver so the coredump could be done via devlink. Signed-off-by: Coiby Xu Reported-by: kernel test robot --- drivers/staging/qlge/Kconfig | 1 + drivers/staging/qlge/Makefile | 2 +- drivers/staging/qlge/qlge.h | 9 +++++++ drivers/staging/qlge/qlge_devlink.c | 38 +++++++++++++++++++++++++++++ drivers/staging/qlge/qlge_devlink.h | 8 ++++++ drivers/staging/qlge/qlge_main.c | 28 +++++++++++++++++++++ 6 files changed, 85 insertions(+), 1 deletion(-) create mode 100644 drivers/staging/qlge/qlge_devlink.c create mode 100644 drivers/staging/qlge/qlge_devlink.h diff --git a/drivers/staging/qlge/Kconfig b/drivers/staging/qlge/Kconfig index a3cb25a3ab80..6d831ed67965 100644 --- a/drivers/staging/qlge/Kconfig +++ b/drivers/staging/qlge/Kconfig @@ -3,6 +3,7 @@ config QLGE tristate "QLogic QLGE 10Gb Ethernet Driver Support" depends on ETHERNET && PCI + select NET_DEVLINK help This driver supports QLogic ISP8XXX 10Gb Ethernet cards. diff --git a/drivers/staging/qlge/Makefile b/drivers/staging/qlge/Makefile index 1dc2568e820c..07c1898a512e 100644 --- a/drivers/staging/qlge/Makefile +++ b/drivers/staging/qlge/Makefile @@ -5,4 +5,4 @@ obj-$(CONFIG_QLGE) += qlge.o -qlge-objs := qlge_main.o qlge_dbg.o qlge_mpi.o qlge_ethtool.o +qlge-objs := qlge_main.o qlge_dbg.o qlge_mpi.o qlge_ethtool.o qlge_devlink.o diff --git a/drivers/staging/qlge/qlge.h b/drivers/staging/qlge/qlge.h index b295990e361b..290e754450c5 100644 --- a/drivers/staging/qlge/qlge.h +++ b/drivers/staging/qlge/qlge.h @@ -2060,6 +2060,14 @@ struct nic_operations { int (*port_initialize)(struct ql_adapter *qdev); }; + + +struct qlge_devlink { + struct ql_adapter *qdev; + struct net_device *ndev; + struct devlink_health_reporter *reporter; +}; + /* * The main Adapter structure definition. * This structure has all fields relevant to the hardware. @@ -2077,6 +2085,7 @@ struct ql_adapter { struct pci_dev *pdev; struct net_device *ndev; /* Parent NET device */ + struct qlge_devlink *ql_devlink; /* Hardware information */ u32 chip_rev_id; u32 fw_rev_id; diff --git a/drivers/staging/qlge/qlge_devlink.c b/drivers/staging/qlge/qlge_devlink.c new file mode 100644 index 000000000000..aa45e7e368c0 --- /dev/null +++ b/drivers/staging/qlge/qlge_devlink.c @@ -0,0 +1,38 @@ +#include "qlge.h" +#include "qlge_devlink.h" + +static int +qlge_reporter_coredump(struct devlink_health_reporter *reporter, + struct devlink_fmsg *fmsg, void *priv_ctx, + struct netlink_ext_ack *extack) +{ + return 0; +} + +static const struct devlink_health_reporter_ops qlge_reporter_ops = { + .name = "dummy", + .dump = qlge_reporter_coredump, +}; + +int qlge_health_create_reporters(struct qlge_devlink *priv) +{ + int err; + + struct devlink_health_reporter *reporter; + struct devlink *devlink; + + devlink = priv_to_devlink(priv); + reporter = + devlink_health_reporter_create(devlink, &qlge_reporter_ops, + 0, + priv); + if (IS_ERR(reporter)) { + netdev_warn(priv->ndev, + "Failed to create reporter, err = %ld\n", + PTR_ERR(reporter)); + return PTR_ERR(reporter); + } + priv->reporter = reporter; + + return err; +} diff --git a/drivers/staging/qlge/qlge_devlink.h b/drivers/staging/qlge/qlge_devlink.h new file mode 100644 index 000000000000..c91f7a29e805 --- /dev/null +++ b/drivers/staging/qlge/qlge_devlink.h @@ -0,0 +1,8 @@ +#ifndef QLGE_DEVLINK_H +#define QLGE_DEVLINK_H + +#include + +int qlge_health_create_reporters(struct qlge_devlink *priv); + +#endif /* QLGE_DEVLINK_H */ diff --git a/drivers/staging/qlge/qlge_main.c b/drivers/staging/qlge/qlge_main.c index 27da386f9d87..135225530e51 100644 --- a/drivers/staging/qlge/qlge_main.c +++ b/drivers/staging/qlge/qlge_main.c @@ -42,6 +42,7 @@ #include #include "qlge.h" +#include "qlge_devlink.h" char qlge_driver_name[] = DRV_NAME; const char qlge_driver_version[] = DRV_VERSION; @@ -4549,6 +4550,8 @@ static void ql_timer(struct timer_list *t) mod_timer(&qdev->timer, jiffies + (5 * HZ)); } +static const struct devlink_ops qlge_devlink_ops; + static int qlge_probe(struct pci_dev *pdev, const struct pci_device_id *pci_entry) { @@ -4556,6 +4559,13 @@ static int qlge_probe(struct pci_dev *pdev, struct ql_adapter *qdev = NULL; static int cards_found; int err = 0; + struct devlink *devlink; + struct qlge_devlink *ql_devlink; + + devlink = devlink_alloc(&qlge_devlink_ops, sizeof(struct qlge_devlink)); + if (!devlink) + return -ENOMEM; + ql_devlink = devlink_priv(devlink); ndev = alloc_etherdev_mq(sizeof(struct ql_adapter), min(MAX_CPUS, @@ -4614,6 +4624,16 @@ static int qlge_probe(struct pci_dev *pdev, free_netdev(ndev); return err; } + + err = devlink_register(devlink, &pdev->dev); + if (err) { + goto devlink_free; + } + + qlge_health_create_reporters(ql_devlink); + ql_devlink->qdev = qdev; + ql_devlink->ndev = ndev; + qdev->ql_devlink = ql_devlink; /* Start up the timer to trigger EEH if * the bus goes dead */ @@ -4624,6 +4644,10 @@ static int qlge_probe(struct pci_dev *pdev, atomic_set(&qdev->lb_count, 0); cards_found++; return 0; + +devlink_free: + devlink_free(devlink); + return err; } netdev_tx_t ql_lb_send(struct sk_buff *skb, struct net_device *ndev) @@ -4640,12 +4664,16 @@ static void qlge_remove(struct pci_dev *pdev) { struct net_device *ndev = pci_get_drvdata(pdev); struct ql_adapter *qdev = netdev_priv(ndev); + struct devlink *devlink = priv_to_devlink(qdev->ql_devlink); del_timer_sync(&qdev->timer); ql_cancel_all_work_sync(qdev); unregister_netdev(ndev); ql_release_all(pdev); pci_disable_device(pdev); + devlink_health_reporter_destroy(qdev->ql_devlink->reporter); + devlink_unregister(devlink); + devlink_free(devlink); free_netdev(ndev); } From patchwork Thu Oct 8 11:58:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Coiby Xu X-Patchwork-Id: 11822785 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=-12.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable 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 F3676C4363A for ; Thu, 8 Oct 2020 11:58:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A6F4420B1F for ; Thu, 8 Oct 2020 11:58:40 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="eOcnhk8I" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729185AbgJHL6f (ORCPT ); Thu, 8 Oct 2020 07:58:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33274 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725802AbgJHL6a (ORCPT ); Thu, 8 Oct 2020 07:58:30 -0400 Received: from mail-pl1-x641.google.com (mail-pl1-x641.google.com [IPv6:2607:f8b0:4864:20::641]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 293F3C061755; Thu, 8 Oct 2020 04:58:30 -0700 (PDT) Received: by mail-pl1-x641.google.com with SMTP id h2so2643122pll.11; Thu, 08 Oct 2020 04:58:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=3OFquukHoMu9n94tKujWLnRYqiNvHzmkGIP28BJkBw8=; b=eOcnhk8Iw5OIf0hY3osasiDAnFP1KOXOqCwk7YMNIokUezphtq45JruiQqhsU+JXAB 5Lx7cxi3WbDFGs/qJJaT7JW8JJIHzzom8Ft07hcvHdF8cjnIYYu44vVTmQtBNDp4ECRw L+po8/Xx0YQjCHwgFY9uGGhfz8dsCPWQpR1YgF+8yGnwtrBM20Ke+xvyV1SdyIHsMV62 18bEDBf+cjxxjpv3hXcD4uhfnmpUD5r7s9uXkmrrNo0qgtoasBipTBdp9ldj1UvOVV1i tw3ocgV9rGApuwFzU7VBhTRwgQOeWfnMODkBAjhoQiA2HHcmZlxDIi4qpXCDJ+y74UyO MBhQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=3OFquukHoMu9n94tKujWLnRYqiNvHzmkGIP28BJkBw8=; b=ZLWy7IDUTXt78DhuXmk5beXTlGYDheE556OWXgUBK0zMIIOTrF8ht2QtyGTO55R7P5 xABifJSgi0vuQM2xpOIwve/ifkzhAnVZrcz8mdrOsGvBPuiD39Y7trOg+ryLpSOTovHl nDwfu09inA96qTxXpetsw+WYTawvEN60Q/sZxiz4zEMyUJy+sLpqcOrxO9zyOCvjkDxM WTeKyFZtkCqA+RvOREtdvnrO5VnT2lFf1odwKPrk68bfTeDr6lUV685lkA+wQSeTK/20 DLXzJNLKUHa8er1MCifOxouUDfephYVbf1gor1dJRvBaixBramhHXOunD+klXxdqosOL jPOA== X-Gm-Message-State: AOAM532j08vTnmLZzQ5xF1lDZYCID4zlL44NL2HyK7ZNthUKbuaYp722 WXM2JQWcX3LIThCmUM9LCVU= X-Google-Smtp-Source: ABdhPJywIrj6kS3v/8UP7Gy3NYZB4iDCMUVBSvyhyeFrdW8F5KwFy8rKnRSc/BKDdMtdjMrWw/7yUg== X-Received: by 2002:a17:902:6545:b029:d3:d370:2882 with SMTP id d5-20020a1709026545b02900d3d3702882mr7421335pln.44.1602158309625; Thu, 08 Oct 2020 04:58:29 -0700 (PDT) Received: from localhost ([2001:e42:102:1532:160:16:113:140]) by smtp.gmail.com with ESMTPSA id nm11sm6081911pjb.24.2020.10.08.04.58.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Oct 2020 04:58:29 -0700 (PDT) From: Coiby Xu To: devel@driverdev.osuosl.org Cc: Benjamin Poirier , Shung-Hsi Yu , Manish Chopra , GR-Linux-NIC-Dev@marvell.com (supporter:QLOGIC QLGE 10Gb ETHERNET DRIVER), Greg Kroah-Hartman , netdev@vger.kernel.org (open list:QLOGIC QLGE 10Gb ETHERNET DRIVER), linux-kernel@vger.kernel.org (open list) Subject: [PATCH v1 2/6] staging: qlge: coredump via devlink health reporter Date: Thu, 8 Oct 2020 19:58:04 +0800 Message-Id: <20201008115808.91850-3-coiby.xu@gmail.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201008115808.91850-1-coiby.xu@gmail.com> References: <20201008115808.91850-1-coiby.xu@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org $ devlink health dump show DEVICE reporter coredump -p -j { "Core Registers": { "segment": 1, "values": [ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ] }, "Test Logic Regs": { "segment": 2, "values": [ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ] }, "RMII Registers": { "segment": 3, "values": [ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ] }, ... "Sem Registers": { "segment": 50, "values": [ 0,0,0,0 ] } } Signed-off-by: Coiby Xu --- drivers/staging/qlge/qlge_devlink.c | 131 ++++++++++++++++++++++++++-- 1 file changed, 125 insertions(+), 6 deletions(-) diff --git a/drivers/staging/qlge/qlge_devlink.c b/drivers/staging/qlge/qlge_devlink.c index aa45e7e368c0..91b6600b94a9 100644 --- a/drivers/staging/qlge/qlge_devlink.c +++ b/drivers/staging/qlge/qlge_devlink.c @@ -1,16 +1,135 @@ #include "qlge.h" #include "qlge_devlink.h" -static int -qlge_reporter_coredump(struct devlink_health_reporter *reporter, - struct devlink_fmsg *fmsg, void *priv_ctx, - struct netlink_ext_ack *extack) +static int fill_seg_(struct devlink_fmsg *fmsg, + struct mpi_coredump_segment_header *seg_header, + u32 *reg_data) { - return 0; + int i; + int header_size = sizeof(struct mpi_coredump_segment_header); + int regs_num = (seg_header->seg_size - header_size) / sizeof(u32); + int err; + + err = devlink_fmsg_pair_nest_start(fmsg, seg_header->description); + if (err) + return err; + err = devlink_fmsg_obj_nest_start(fmsg); + if (err) + return err; + err = devlink_fmsg_u32_pair_put(fmsg, "segment", seg_header->seg_num); + if (err) + return err; + err = devlink_fmsg_arr_pair_nest_start(fmsg, "values"); + if (err) + return err; + for (i = 0; i < regs_num; i++) { + err = devlink_fmsg_u32_put(fmsg, *reg_data); + if (err) + return err; + reg_data++; + } + err = devlink_fmsg_obj_nest_end(fmsg); + if (err) + return err; + err = devlink_fmsg_arr_pair_nest_end(fmsg); + if (err) + return err; + err = devlink_fmsg_pair_nest_end(fmsg); + return err; +} + +#define fill_seg(seg_hdr, seg_regs) \ + do { \ + err = fill_seg_(fmsg, &dump->seg_hdr, dump->seg_regs); \ + if (err) { \ + kvfree(dump); \ + return err; \ + } \ + } while (0) + +static int qlge_reporter_coredump(struct devlink_health_reporter *reporter, + struct devlink_fmsg *fmsg, void *priv_ctx, + struct netlink_ext_ack *extack) +{ + int err = 0; + + struct qlge_devlink *dev = devlink_health_reporter_priv(reporter); + struct ql_adapter *qdev = dev->qdev; + struct ql_mpi_coredump *dump; + + if (!netif_running(qdev->ndev)) + return 0; + + dump = kvmalloc(sizeof(*dump), GFP_KERNEL); + if (!dump) + return -ENOMEM; + + err = ql_core_dump(qdev, dump); + if (err) { + kvfree(dump); + return err; + } + + fill_seg(core_regs_seg_hdr, mpi_core_regs); + fill_seg(test_logic_regs_seg_hdr, test_logic_regs); + fill_seg(rmii_regs_seg_hdr, rmii_regs); + fill_seg(fcmac1_regs_seg_hdr, fcmac1_regs); + fill_seg(fcmac2_regs_seg_hdr, fcmac2_regs); + fill_seg(fc1_mbx_regs_seg_hdr, fc1_mbx_regs); + fill_seg(ide_regs_seg_hdr, ide_regs); + fill_seg(nic1_mbx_regs_seg_hdr, nic1_mbx_regs); + fill_seg(smbus_regs_seg_hdr, smbus_regs); + fill_seg(fc2_mbx_regs_seg_hdr, fc2_mbx_regs); + fill_seg(nic2_mbx_regs_seg_hdr, nic2_mbx_regs); + fill_seg(i2c_regs_seg_hdr, i2c_regs); + fill_seg(memc_regs_seg_hdr, memc_regs); + fill_seg(pbus_regs_seg_hdr, pbus_regs); + fill_seg(mde_regs_seg_hdr, mde_regs); + fill_seg(nic_regs_seg_hdr, nic_regs); + fill_seg(nic2_regs_seg_hdr, nic2_regs); + fill_seg(xgmac1_seg_hdr, xgmac1); + fill_seg(xgmac2_seg_hdr, xgmac2); + fill_seg(code_ram_seg_hdr, code_ram); + fill_seg(memc_ram_seg_hdr, memc_ram); + fill_seg(xaui_an_hdr, serdes_xaui_an); + fill_seg(xaui_hss_pcs_hdr, serdes_xaui_hss_pcs); + fill_seg(xfi_an_hdr, serdes_xfi_an); + fill_seg(xfi_train_hdr, serdes_xfi_train); + fill_seg(xfi_hss_pcs_hdr, serdes_xfi_hss_pcs); + fill_seg(xfi_hss_tx_hdr, serdes_xfi_hss_tx); + fill_seg(xfi_hss_rx_hdr, serdes_xfi_hss_rx); + fill_seg(xfi_hss_pll_hdr, serdes_xfi_hss_pll); + + err = fill_seg_(fmsg, &dump->misc_nic_seg_hdr, + (u32 *)&dump->misc_nic_info); + if (err) { + kvfree(dump); + return err; + } + + fill_seg(intr_states_seg_hdr, intr_states); + fill_seg(cam_entries_seg_hdr, cam_entries); + fill_seg(nic_routing_words_seg_hdr, nic_routing_words); + fill_seg(ets_seg_hdr, ets); + fill_seg(probe_dump_seg_hdr, probe_dump); + fill_seg(routing_reg_seg_hdr, routing_regs); + fill_seg(mac_prot_reg_seg_hdr, mac_prot_regs); + fill_seg(xaui2_an_hdr, serdes2_xaui_an); + fill_seg(xaui2_hss_pcs_hdr, serdes2_xaui_hss_pcs); + fill_seg(xfi2_an_hdr, serdes2_xfi_an); + fill_seg(xfi2_train_hdr, serdes2_xfi_train); + fill_seg(xfi2_hss_pcs_hdr, serdes2_xfi_hss_pcs); + fill_seg(xfi2_hss_tx_hdr, serdes2_xfi_hss_tx); + fill_seg(xfi2_hss_rx_hdr, serdes2_xfi_hss_rx); + fill_seg(xfi2_hss_pll_hdr, serdes2_xfi_hss_pll); + fill_seg(sem_regs_seg_hdr, sem_regs); + + kvfree(dump); + return err; } static const struct devlink_health_reporter_ops qlge_reporter_ops = { - .name = "dummy", + .name = "coredump", .dump = qlge_reporter_coredump, }; From patchwork Thu Oct 8 11:58:05 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Coiby Xu X-Patchwork-Id: 11822787 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=-12.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable 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 20622C4363A for ; Thu, 8 Oct 2020 11:58:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CEEFA21527 for ; Thu, 8 Oct 2020 11:58:42 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ceqBsCnf" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728954AbgJHL6e (ORCPT ); Thu, 8 Oct 2020 07:58:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33284 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728446AbgJHL6d (ORCPT ); Thu, 8 Oct 2020 07:58:33 -0400 Received: from mail-pg1-x542.google.com (mail-pg1-x542.google.com [IPv6:2607:f8b0:4864:20::542]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 55538C0613D2; Thu, 8 Oct 2020 04:58:33 -0700 (PDT) Received: by mail-pg1-x542.google.com with SMTP id n9so4080474pgf.9; Thu, 08 Oct 2020 04:58:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=KQzCKemZS/RK2g3GQ9qxoMzKSIZg3RP0p33btHevshs=; b=ceqBsCnf9PxKBZZRJV18dvuuUVKgkIHBsg+3ZK5fULT6K0gDyopsAgvBDPcusREsHA KJMT5k2DLduQ9uWfxdP+VWcGvZcsSjK3vy//E9bmx0Uuno0DA6CIyJgJz5VD+rYolf12 KV5cwWFPYhDZ/6/TgrrXlqQWKZDImd//ox8+TAA3RsdIXpkGQKNo/jtTDb1XxvYu9qGh mmZjwxhGfNu+bLR7G5j0wleTkpneESiabQdBbYthFQ1kQOGPuWxU/2/5PPmPr/i4X3cz OOiuSHT4f7yyejbl+mQ5fqDl+NIeH19c6sQNBfU7+28/O6Zktr8Z2Ls0Y46/JUQj1+Gf QLZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=KQzCKemZS/RK2g3GQ9qxoMzKSIZg3RP0p33btHevshs=; b=s+6bj+VPq4OdEjRPsM4koiF7fxnEugOss0U6rhUkfLua7xNsEJAsL4O6MyFqq69CCa WowzsS/H9XjgZOoygGJkl6v3r92Uz2+ojG2fqmn5WbBABeYEqHDb43eNo8MFfuaRBGRK zPu6BJkCkgnLZsYUWIQea46Lscban7GMQ03/Z1ltVdCeL/u4MCNp1h+z6UvEmHBgbOL/ q14/Bb+Dgn/fsL5hz9gP8MF0ETpI8DjkY3hDPH5JSpOj+eQ4hqNv7+yDPX886fg/GZH4 Ck8Dfv8c9YFUlnrpwCjsLstNg6Amy5JrgmGnftQlaNYponzrLEmkvqp2nlxIvl9j3Lhv 79ug== X-Gm-Message-State: AOAM5315YOKxAnSwuuP6NRugGAVS3LFvaE+keo2pFvE5KO4hvByRV3BO oGRrHdbfh5+q/V8Ni03xIGs= X-Google-Smtp-Source: ABdhPJxAkUUxk6Bx5wTttze7DKUa4yHhg0poALtcyr+CH1TpoqzNICh0YqiD39MBSldIMWMhyOedXA== X-Received: by 2002:a62:7a53:0:b029:152:5482:8935 with SMTP id v80-20020a627a530000b029015254828935mr7409775pfc.31.1602158312899; Thu, 08 Oct 2020 04:58:32 -0700 (PDT) Received: from localhost ([2001:e42:102:1532:160:16:113:140]) by smtp.gmail.com with ESMTPSA id a1sm6676712pjh.2.2020.10.08.04.58.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Oct 2020 04:58:32 -0700 (PDT) From: Coiby Xu To: devel@driverdev.osuosl.org Cc: Benjamin Poirier , Shung-Hsi Yu , Manish Chopra , GR-Linux-NIC-Dev@marvell.com (supporter:QLOGIC QLGE 10Gb ETHERNET DRIVER), Greg Kroah-Hartman , netdev@vger.kernel.org (open list:QLOGIC QLGE 10Gb ETHERNET DRIVER), linux-kernel@vger.kernel.org (open list) Subject: [PATCH v1 3/6] staging: qlge: support force_coredump option for devlink health dump Date: Thu, 8 Oct 2020 19:58:05 +0800 Message-Id: <20201008115808.91850-4-coiby.xu@gmail.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201008115808.91850-1-coiby.xu@gmail.com> References: <20201008115808.91850-1-coiby.xu@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org With force_coredump module paramter set, devlink health dump will reset the MPI RISC first which takes 5 secs to be finished. Signed-off-by: Coiby Xu --- drivers/staging/qlge/qlge_devlink.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/staging/qlge/qlge_devlink.c b/drivers/staging/qlge/qlge_devlink.c index 91b6600b94a9..54257468bc7f 100644 --- a/drivers/staging/qlge/qlge_devlink.c +++ b/drivers/staging/qlge/qlge_devlink.c @@ -56,10 +56,17 @@ static int qlge_reporter_coredump(struct devlink_health_reporter *reporter, struct qlge_devlink *dev = devlink_health_reporter_priv(reporter); struct ql_adapter *qdev = dev->qdev; struct ql_mpi_coredump *dump; + wait_queue_head_t wait; if (!netif_running(qdev->ndev)) return 0; + if (test_bit(QL_FRC_COREDUMP, &qdev->flags)) { + ql_queue_fw_error(qdev); + init_waitqueue_head(&wait); + wait_event_timeout(wait, 0, 5 * HZ); + } + dump = kvmalloc(sizeof(*dump), GFP_KERNEL); if (!dump) return -ENOMEM; From patchwork Thu Oct 8 11:58:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Coiby Xu X-Patchwork-Id: 11822791 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=-12.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable 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 800B2C4363A for ; Thu, 8 Oct 2020 11:58:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2E39021527 for ; Thu, 8 Oct 2020 11:58:55 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="BVL0iDFt" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729569AbgJHL6q (ORCPT ); Thu, 8 Oct 2020 07:58:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33296 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729371AbgJHL6h (ORCPT ); Thu, 8 Oct 2020 07:58:37 -0400 Received: from mail-pg1-x541.google.com (mail-pg1-x541.google.com [IPv6:2607:f8b0:4864:20::541]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 450A0C061755; Thu, 8 Oct 2020 04:58:37 -0700 (PDT) Received: by mail-pg1-x541.google.com with SMTP id 7so4071302pgm.11; Thu, 08 Oct 2020 04:58:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=bEAelpRiHustXW5V3YshgfU8vMjoeMB0xcSYBIrSiOg=; b=BVL0iDFtsgfWa+kE5fCunUorX2j2hf1QwPHlaCuiw2u86+MkANg93O5MEEKOpngNMx eThiEwVHhIIv6FnGZJGX7Lvvb0k+WdkejwQEyJ49xauJ8FxF+wj8/yZm+i/HxB+bemxd /T7+iqgkEPZK86JmJPMLLxN8xIrz6+5V34jv8DLgzXy8v183ZCWOOftuiwiyFjK4h6LQ +W59U2gWBQkrHVhltLCpPojAhfyuZAOuM1XZPQ5OW3O272oVCr7JnmZTaxFmtdmvRoxO Ks9o4tqD50uwvSF2B23J3No9l8IlgN2vmDPX+UoDUEykH/HPjhf9FVV6EmaT+IL+K3LN aIqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=bEAelpRiHustXW5V3YshgfU8vMjoeMB0xcSYBIrSiOg=; b=LOTWZqhRGdKZk7i87O4QVyJl6tmBqiNAy2R2sdatceJqkjkvvSyskNPqjHovaDAlqZ c5PlZuln0pIBROD8QsbpySfLtOyxAUOfl2SSvXbk4h9/pCMD+oWyHriuBCHdxtfPbMTk 9NMVZgzgyDbiSGh5nLuVUkOTP9j8EVRuaWg6wUeVZ9YPqot99I+oVt0d2K+e9mQFI92C fWj1kSPy8olbikTVskZe/turyxjrQqwQfrZrPka+KXF/OTUHjjr+T1DP626bOYacIamY gh/c7Hmjwk6AaNTW69C1SG4j61VbKRBDc4hscuyCkilb2jXmwJme8wDdyxdX0bUmfTRo Aeuw== X-Gm-Message-State: AOAM533+BROmoJj1H1qdHrff2oHX6GjWXxwRVDjr1pQNt8WDCwwpul53 HqLNMZnLdmftrujU//ke0xfxZO72mVrLQg== X-Google-Smtp-Source: ABdhPJy4Od0Fv6yQ29AYh31ZIu42PWrymIyFirG6WqS8uxAyU1pjzv/mgVkI4lZehCq2L3HjZPOYQA== X-Received: by 2002:a17:90a:8007:: with SMTP id b7mr7815533pjn.84.1602158316881; Thu, 08 Oct 2020 04:58:36 -0700 (PDT) Received: from localhost ([2001:e42:102:1532:160:16:113:140]) by smtp.gmail.com with ESMTPSA id a9sm7151206pjm.40.2020.10.08.04.58.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Oct 2020 04:58:36 -0700 (PDT) From: Coiby Xu To: devel@driverdev.osuosl.org Cc: Benjamin Poirier , Shung-Hsi Yu , Manish Chopra , GR-Linux-NIC-Dev@marvell.com (supporter:QLOGIC QLGE 10Gb ETHERNET DRIVER), Greg Kroah-Hartman , netdev@vger.kernel.org (open list:QLOGIC QLGE 10Gb ETHERNET DRIVER), linux-kernel@vger.kernel.org (open list) Subject: [PATCH v1 4/6] staging: qlge: remove mpi_core_to_log which sends coredump to the kernel ring buffer Date: Thu, 8 Oct 2020 19:58:06 +0800 Message-Id: <20201008115808.91850-5-coiby.xu@gmail.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201008115808.91850-1-coiby.xu@gmail.com> References: <20201008115808.91850-1-coiby.xu@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org devlink health could be used to get coredump. No need to send so much data to the kernel ring buffer. Signed-off-by: Coiby Xu --- drivers/staging/qlge/qlge.h | 3 --- drivers/staging/qlge/qlge_dbg.c | 11 ----------- drivers/staging/qlge/qlge_ethtool.c | 1 - drivers/staging/qlge/qlge_main.c | 2 -- drivers/staging/qlge/qlge_mpi.c | 6 ------ 5 files changed, 23 deletions(-) diff --git a/drivers/staging/qlge/qlge.h b/drivers/staging/qlge/qlge.h index 290e754450c5..0a39801be15a 100644 --- a/drivers/staging/qlge/qlge.h +++ b/drivers/staging/qlge/qlge.h @@ -2149,7 +2149,6 @@ struct ql_adapter { u32 port_init; u32 link_status; struct ql_mpi_coredump *mpi_coredump; - u32 core_is_dumped; u32 link_config; u32 led_config; u32 max_frame_size; @@ -2162,7 +2161,6 @@ struct ql_adapter { struct delayed_work mpi_work; struct delayed_work mpi_port_cfg_work; struct delayed_work mpi_idc_work; - struct delayed_work mpi_core_to_log; struct completion ide_completion; const struct nic_operations *nic_ops; u16 device_id; @@ -2253,7 +2251,6 @@ int ql_write_cfg(struct ql_adapter *qdev, void *ptr, int size, u32 bit, void ql_queue_fw_error(struct ql_adapter *qdev); void ql_mpi_work(struct work_struct *work); void ql_mpi_reset_work(struct work_struct *work); -void ql_mpi_core_to_log(struct work_struct *work); int ql_wait_reg_rdy(struct ql_adapter *qdev, u32 reg, u32 bit, u32 ebit); void ql_queue_asic_error(struct ql_adapter *qdev); void ql_set_ethtool_ops(struct net_device *ndev); diff --git a/drivers/staging/qlge/qlge_dbg.c b/drivers/staging/qlge/qlge_dbg.c index 42fd13990f3a..989575743718 100644 --- a/drivers/staging/qlge/qlge_dbg.c +++ b/drivers/staging/qlge/qlge_dbg.c @@ -1314,17 +1314,6 @@ void ql_get_dump(struct ql_adapter *qdev, void *buff) } } -/* Coredump to messages log file using separate worker thread */ -void ql_mpi_core_to_log(struct work_struct *work) -{ - struct ql_adapter *qdev = - container_of(work, struct ql_adapter, mpi_core_to_log.work); - - print_hex_dump(KERN_DEBUG, "Core is dumping to log file!\n", - DUMP_PREFIX_OFFSET, 32, 4, qdev->mpi_coredump, - sizeof(*qdev->mpi_coredump), false); -} - #ifdef QL_REG_DUMP static void ql_dump_intr_states(struct ql_adapter *qdev) { diff --git a/drivers/staging/qlge/qlge_ethtool.c b/drivers/staging/qlge/qlge_ethtool.c index d44b2dae9213..eed116d8895e 100644 --- a/drivers/staging/qlge/qlge_ethtool.c +++ b/drivers/staging/qlge/qlge_ethtool.c @@ -616,7 +616,6 @@ static void ql_get_regs(struct net_device *ndev, struct ql_adapter *qdev = netdev_priv(ndev); ql_get_dump(qdev, p); - qdev->core_is_dumped = 0; if (!test_bit(QL_FRC_COREDUMP, &qdev->flags)) regs->len = sizeof(struct ql_mpi_coredump); else diff --git a/drivers/staging/qlge/qlge_main.c b/drivers/staging/qlge/qlge_main.c index 135225530e51..aaca740d46c4 100644 --- a/drivers/staging/qlge/qlge_main.c +++ b/drivers/staging/qlge/qlge_main.c @@ -3808,7 +3808,6 @@ static void ql_cancel_all_work_sync(struct ql_adapter *qdev) cancel_delayed_work_sync(&qdev->mpi_reset_work); cancel_delayed_work_sync(&qdev->mpi_work); cancel_delayed_work_sync(&qdev->mpi_idc_work); - cancel_delayed_work_sync(&qdev->mpi_core_to_log); cancel_delayed_work_sync(&qdev->mpi_port_cfg_work); } @@ -4504,7 +4503,6 @@ static int ql_init_device(struct pci_dev *pdev, struct net_device *ndev, INIT_DELAYED_WORK(&qdev->mpi_work, ql_mpi_work); INIT_DELAYED_WORK(&qdev->mpi_port_cfg_work, ql_mpi_port_cfg_work); INIT_DELAYED_WORK(&qdev->mpi_idc_work, ql_mpi_idc_work); - INIT_DELAYED_WORK(&qdev->mpi_core_to_log, ql_mpi_core_to_log); init_completion(&qdev->ide_completion); mutex_init(&qdev->mpi_mutex); diff --git a/drivers/staging/qlge/qlge_mpi.c b/drivers/staging/qlge/qlge_mpi.c index 143a886080c5..1cea24201b17 100644 --- a/drivers/staging/qlge/qlge_mpi.c +++ b/drivers/staging/qlge/qlge_mpi.c @@ -1269,11 +1269,5 @@ void ql_mpi_reset_work(struct work_struct *work) return; } - if (qdev->mpi_coredump && !ql_core_dump(qdev, qdev->mpi_coredump)) { - netif_err(qdev, drv, qdev->ndev, "Core is dumped!\n"); - qdev->core_is_dumped = 1; - queue_delayed_work(qdev->workqueue, - &qdev->mpi_core_to_log, 5 * HZ); - } ql_soft_reset_mpi_risc(qdev); } From patchwork Thu Oct 8 11:58:07 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Coiby Xu X-Patchwork-Id: 11822789 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=-12.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable 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 7E395C43467 for ; Thu, 8 Oct 2020 11:58:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id F316021527 for ; Thu, 8 Oct 2020 11:58:51 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="jgfOU0Io" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729629AbgJHL6s (ORCPT ); Thu, 8 Oct 2020 07:58:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33310 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729476AbgJHL6m (ORCPT ); Thu, 8 Oct 2020 07:58:42 -0400 Received: from mail-pg1-x543.google.com (mail-pg1-x543.google.com [IPv6:2607:f8b0:4864:20::543]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 97E1CC0613D2; Thu, 8 Oct 2020 04:58:42 -0700 (PDT) Received: by mail-pg1-x543.google.com with SMTP id 34so4064687pgo.13; Thu, 08 Oct 2020 04:58:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Hvr8t6qyC1luUdpoiTEnPYkbWgtgEqsCozYGgg3gk10=; b=jgfOU0Io4xQqhhzkbtyqMVI04k2dE53z6Qt1lWaiRCiCpyXUxaj8r89FdT9ngvyyvi 2l7bo9hU4WTTvsDQN22lIzRtsaPjxy3cT0PfpF+RCKbmjtHSquXUUe/Ji3wybuq/nkAB PdZC4kzlpk2RspnIwDm4zwoLkmIMcBVSp5Hwx0kqu+3afTQYBu1cgPLAKK0cn7mVB6Z/ hPtpl2Uy+FYIaG6kRyTy0dFHv9vczBxuhVbtK8vY7m6TmSGJ/kE4U+tOCYzjai/HS7zI P1q2K6tuEvsbHB1wwOD+Ih6JsC9REVuy9e/sfMDLKPx/kWOarS94/t2H15j2EHaig6al XIPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Hvr8t6qyC1luUdpoiTEnPYkbWgtgEqsCozYGgg3gk10=; b=QjdYpW2enqJjc4I/O5pmyGG3Ky3YNfiynCUth5SvgnjkdUitcj60ocYRmPAgrJhTgM RoouI3glfkg7iRTUyjkirtGN/svm4+br79pi7xZiw1QYx007pymnWb3fu10DDY6q4U71 XVMZIrD7pByz0Jyu9iPZTzapcnPCk/CQ8wNPZcfCR3RXVLYhRvp6rokc7bR1kHchJwBA BlMbhBDG2JFwR6DBUSyoIzMpLEXqG1mxDghF9Aq/nLkQdvZM9sbMlvYG/6SpO+qmPvTR kAYzW3lIEeOu+TswkejljgqP7Iwbmjk1i/Sd+WV/cThz4/izN3Yb4t7r0NzpgAc24cLg BDLQ== X-Gm-Message-State: AOAM53394GTwfFlKNRuchSdjqRBHo1WOyBi1jLPfK93tnY6pRNsj5FmC W9MBCgBr4SZ+oKEJD6xrGyo= X-Google-Smtp-Source: ABdhPJy2SCOcshUnDHFHpzaf6XNjFIcGaBMqV5O3zS4oFM2J/xoH8bf/4sN+rzVb4y2/+A6/Kmw7dg== X-Received: by 2002:a05:6a00:44:b029:155:18ee:a71e with SMTP id i4-20020a056a000044b029015518eea71emr7188617pfk.1.1602158321794; Thu, 08 Oct 2020 04:58:41 -0700 (PDT) Received: from localhost ([2001:e42:102:1532:160:16:113:140]) by smtp.gmail.com with ESMTPSA id w23sm6558518pfn.142.2020.10.08.04.58.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Oct 2020 04:58:41 -0700 (PDT) From: Coiby Xu To: devel@driverdev.osuosl.org Cc: Benjamin Poirier , Shung-Hsi Yu , Manish Chopra , GR-Linux-NIC-Dev@marvell.com (supporter:QLOGIC QLGE 10Gb ETHERNET DRIVER), Greg Kroah-Hartman , netdev@vger.kernel.org (open list:QLOGIC QLGE 10Gb ETHERNET DRIVER), linux-kernel@vger.kernel.org (open list) Subject: [PATCH v1 5/6] staging: qlge: clean up debugging code in the QL_ALL_DUMP ifdef land Date: Thu, 8 Oct 2020 19:58:07 +0800 Message-Id: <20201008115808.91850-6-coiby.xu@gmail.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201008115808.91850-1-coiby.xu@gmail.com> References: <20201008115808.91850-1-coiby.xu@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org The debugging code in the following ifdef land - QL_ALL_DUMP - QL_REG_DUMP - QL_DEV_DUMP - QL_CB_DUMP - QL_IB_DUMP - QL_OB_DUMP becomes unnecessary because, - Device status and general registers can be obtained by ethtool. - Coredump can be done via devlink health reporter. - Structure related to the hardware (struct ql_adapter) can be obtained by crash or drgn. Suggested-by: Benjamin Poirier Signed-off-by: Coiby Xu --- drivers/staging/qlge/qlge.h | 82 ---- drivers/staging/qlge/qlge_dbg.c | 688 ---------------------------- drivers/staging/qlge/qlge_ethtool.c | 2 - drivers/staging/qlge/qlge_main.c | 7 +- 4 files changed, 1 insertion(+), 778 deletions(-) diff --git a/drivers/staging/qlge/qlge.h b/drivers/staging/qlge/qlge.h index 0a39801be15a..8aff3ba77730 100644 --- a/drivers/staging/qlge/qlge.h +++ b/drivers/staging/qlge/qlge.h @@ -2285,86 +2285,4 @@ void ql_check_lb_frame(struct ql_adapter *qdev, struct sk_buff *skb); int ql_own_firmware(struct ql_adapter *qdev); int ql_clean_lb_rx_ring(struct rx_ring *rx_ring, int budget); -/* #define QL_ALL_DUMP */ -/* #define QL_REG_DUMP */ -/* #define QL_DEV_DUMP */ -/* #define QL_CB_DUMP */ -/* #define QL_IB_DUMP */ -/* #define QL_OB_DUMP */ - -#ifdef QL_REG_DUMP -void ql_dump_xgmac_control_regs(struct ql_adapter *qdev); -void ql_dump_routing_entries(struct ql_adapter *qdev); -void ql_dump_regs(struct ql_adapter *qdev); -#define QL_DUMP_REGS(qdev) ql_dump_regs(qdev) -#define QL_DUMP_ROUTE(qdev) ql_dump_routing_entries(qdev) -#define QL_DUMP_XGMAC_CONTROL_REGS(qdev) ql_dump_xgmac_control_regs(qdev) -#else -#define QL_DUMP_REGS(qdev) -#define QL_DUMP_ROUTE(qdev) -#define QL_DUMP_XGMAC_CONTROL_REGS(qdev) -#endif - -#ifdef QL_STAT_DUMP -void ql_dump_stat(struct ql_adapter *qdev); -#define QL_DUMP_STAT(qdev) ql_dump_stat(qdev) -#else -#define QL_DUMP_STAT(qdev) -#endif - -#ifdef QL_DEV_DUMP -void ql_dump_qdev(struct ql_adapter *qdev); -#define QL_DUMP_QDEV(qdev) ql_dump_qdev(qdev) -#else -#define QL_DUMP_QDEV(qdev) -#endif - -#ifdef QL_CB_DUMP -void ql_dump_wqicb(struct wqicb *wqicb); -void ql_dump_tx_ring(struct tx_ring *tx_ring); -void ql_dump_ricb(struct ricb *ricb); -void ql_dump_cqicb(struct cqicb *cqicb); -void ql_dump_rx_ring(struct rx_ring *rx_ring); -void ql_dump_hw_cb(struct ql_adapter *qdev, int size, u32 bit, u16 q_id); -#define QL_DUMP_RICB(ricb) ql_dump_ricb(ricb) -#define QL_DUMP_WQICB(wqicb) ql_dump_wqicb(wqicb) -#define QL_DUMP_TX_RING(tx_ring) ql_dump_tx_ring(tx_ring) -#define QL_DUMP_CQICB(cqicb) ql_dump_cqicb(cqicb) -#define QL_DUMP_RX_RING(rx_ring) ql_dump_rx_ring(rx_ring) -#define QL_DUMP_HW_CB(qdev, size, bit, q_id) \ - ql_dump_hw_cb(qdev, size, bit, q_id) -#else -#define QL_DUMP_RICB(ricb) -#define QL_DUMP_WQICB(wqicb) -#define QL_DUMP_TX_RING(tx_ring) -#define QL_DUMP_CQICB(cqicb) -#define QL_DUMP_RX_RING(rx_ring) -#define QL_DUMP_HW_CB(qdev, size, bit, q_id) -#endif - -#ifdef QL_OB_DUMP -void ql_dump_tx_desc(struct ql_adapter *qdev, struct tx_buf_desc *tbd); -void ql_dump_ob_mac_iocb(struct ql_adapter *qdev, struct ob_mac_iocb_req *ob_mac_iocb); -void ql_dump_ob_mac_rsp(struct ql_adapter *qdev, struct ob_mac_iocb_rsp *ob_mac_rsp); -#define QL_DUMP_OB_MAC_IOCB(qdev, ob_mac_iocb) ql_dump_ob_mac_iocb(qdev, ob_mac_iocb) -#define QL_DUMP_OB_MAC_RSP(qdev, ob_mac_rsp) ql_dump_ob_mac_rsp(qdev, ob_mac_rsp) -#else -#define QL_DUMP_OB_MAC_IOCB(qdev, ob_mac_iocb) -#define QL_DUMP_OB_MAC_RSP(qdev, ob_mac_rsp) -#endif - -#ifdef QL_IB_DUMP -void ql_dump_ib_mac_rsp(struct ql_adapter *qdev, struct ib_mac_iocb_rsp *ib_mac_rsp); -#define QL_DUMP_IB_MAC_RSP(qdev, ib_mac_rsp) ql_dump_ib_mac_rsp(qdev, ib_mac_rsp) -#else -#define QL_DUMP_IB_MAC_RSP(qdev, ib_mac_rsp) -#endif - -#ifdef QL_ALL_DUMP -void ql_dump_all(struct ql_adapter *qdev); -#define QL_DUMP_ALL(qdev) ql_dump_all(qdev) -#else -#define QL_DUMP_ALL(qdev) -#endif - #endif /* _QLGE_H_ */ diff --git a/drivers/staging/qlge/qlge_dbg.c b/drivers/staging/qlge/qlge_dbg.c index 989575743718..a02ecf8fb291 100644 --- a/drivers/staging/qlge/qlge_dbg.c +++ b/drivers/staging/qlge/qlge_dbg.c @@ -1313,691 +1313,3 @@ void ql_get_dump(struct ql_adapter *qdev, void *buff) ql_get_core_dump(qdev); } } - -#ifdef QL_REG_DUMP -static void ql_dump_intr_states(struct ql_adapter *qdev) -{ - int i; - u32 value; - - for (i = 0; i < qdev->intr_count; i++) { - ql_write32(qdev, INTR_EN, qdev->intr_context[i].intr_read_mask); - value = ql_read32(qdev, INTR_EN); - netdev_err(qdev->ndev, "Interrupt %d is %s\n", i, - (value & INTR_EN_EN ? "enabled" : "disabled")); - } -} - -#define DUMP_XGMAC(qdev, reg) \ -do { \ - u32 data; \ - ql_read_xgmac_reg(qdev, reg, &data); \ - netdev_err(qdev->ndev, "%s = 0x%.08x\n", #reg, data); \ -} while (0) - -void ql_dump_xgmac_control_regs(struct ql_adapter *qdev) -{ - if (ql_sem_spinlock(qdev, qdev->xg_sem_mask)) { - netdev_err(qdev->ndev, "%s: Couldn't get xgmac sem\n", - __func__); - return; - } - DUMP_XGMAC(qdev, PAUSE_SRC_LO); - DUMP_XGMAC(qdev, PAUSE_SRC_HI); - DUMP_XGMAC(qdev, GLOBAL_CFG); - DUMP_XGMAC(qdev, TX_CFG); - DUMP_XGMAC(qdev, RX_CFG); - DUMP_XGMAC(qdev, FLOW_CTL); - DUMP_XGMAC(qdev, PAUSE_OPCODE); - DUMP_XGMAC(qdev, PAUSE_TIMER); - DUMP_XGMAC(qdev, PAUSE_FRM_DEST_LO); - DUMP_XGMAC(qdev, PAUSE_FRM_DEST_HI); - DUMP_XGMAC(qdev, MAC_TX_PARAMS); - DUMP_XGMAC(qdev, MAC_RX_PARAMS); - DUMP_XGMAC(qdev, MAC_SYS_INT); - DUMP_XGMAC(qdev, MAC_SYS_INT_MASK); - DUMP_XGMAC(qdev, MAC_MGMT_INT); - DUMP_XGMAC(qdev, MAC_MGMT_IN_MASK); - DUMP_XGMAC(qdev, EXT_ARB_MODE); - ql_sem_unlock(qdev, qdev->xg_sem_mask); -} - -static void ql_dump_ets_regs(struct ql_adapter *qdev) -{ -} - -static void ql_dump_cam_entries(struct ql_adapter *qdev) -{ - int i; - u32 value[3]; - - i = ql_sem_spinlock(qdev, SEM_MAC_ADDR_MASK); - if (i) - return; - for (i = 0; i < 4; i++) { - if (ql_get_mac_addr_reg(qdev, MAC_ADDR_TYPE_CAM_MAC, i, value)) { - netdev_err(qdev->ndev, - "%s: Failed read of mac index register\n", - __func__); - break; - } - if (value[0]) - netdev_err(qdev->ndev, - "CAM index %d CAM Lookup Lower = 0x%.08x:%.08x, Output = 0x%.08x\n", - i, value[1], value[0], value[2]); - } - for (i = 0; i < 32; i++) { - if (ql_get_mac_addr_reg - (qdev, MAC_ADDR_TYPE_MULTI_MAC, i, value)) { - netdev_err(qdev->ndev, - "%s: Failed read of mac index register\n", - __func__); - break; - } - if (value[0]) - netdev_err(qdev->ndev, - "MCAST index %d CAM Lookup Lower = 0x%.08x:%.08x\n", - i, value[1], value[0]); - } - ql_sem_unlock(qdev, SEM_MAC_ADDR_MASK); -} - -void ql_dump_routing_entries(struct ql_adapter *qdev) -{ - int i; - u32 value; - - i = ql_sem_spinlock(qdev, SEM_RT_IDX_MASK); - if (i) - return; - for (i = 0; i < 16; i++) { - value = 0; - if (ql_get_routing_reg(qdev, i, &value)) { - netdev_err(qdev->ndev, - "%s: Failed read of routing index register\n", - __func__); - break; - } - if (value) - netdev_err(qdev->ndev, - "Routing Mask %d = 0x%.08x\n", - i, value); - } - ql_sem_unlock(qdev, SEM_RT_IDX_MASK); -} - -#define DUMP_REG(qdev, reg) \ - netdev_err(qdev->ndev, "%-32s= 0x%x\n", #reg, ql_read32(qdev, reg)) - -void ql_dump_regs(struct ql_adapter *qdev) -{ - netdev_err(qdev->ndev, "reg dump for function #%d\n", qdev->func); - DUMP_REG(qdev, SYS); - DUMP_REG(qdev, RST_FO); - DUMP_REG(qdev, FSC); - DUMP_REG(qdev, CSR); - DUMP_REG(qdev, ICB_RID); - DUMP_REG(qdev, ICB_L); - DUMP_REG(qdev, ICB_H); - DUMP_REG(qdev, CFG); - DUMP_REG(qdev, BIOS_ADDR); - DUMP_REG(qdev, STS); - DUMP_REG(qdev, INTR_EN); - DUMP_REG(qdev, INTR_MASK); - DUMP_REG(qdev, ISR1); - DUMP_REG(qdev, ISR2); - DUMP_REG(qdev, ISR3); - DUMP_REG(qdev, ISR4); - DUMP_REG(qdev, REV_ID); - DUMP_REG(qdev, FRC_ECC_ERR); - DUMP_REG(qdev, ERR_STS); - DUMP_REG(qdev, RAM_DBG_ADDR); - DUMP_REG(qdev, RAM_DBG_DATA); - DUMP_REG(qdev, ECC_ERR_CNT); - DUMP_REG(qdev, SEM); - DUMP_REG(qdev, GPIO_1); - DUMP_REG(qdev, GPIO_2); - DUMP_REG(qdev, GPIO_3); - DUMP_REG(qdev, XGMAC_ADDR); - DUMP_REG(qdev, XGMAC_DATA); - DUMP_REG(qdev, NIC_ETS); - DUMP_REG(qdev, CNA_ETS); - DUMP_REG(qdev, FLASH_ADDR); - DUMP_REG(qdev, FLASH_DATA); - DUMP_REG(qdev, CQ_STOP); - DUMP_REG(qdev, PAGE_TBL_RID); - DUMP_REG(qdev, WQ_PAGE_TBL_LO); - DUMP_REG(qdev, WQ_PAGE_TBL_HI); - DUMP_REG(qdev, CQ_PAGE_TBL_LO); - DUMP_REG(qdev, CQ_PAGE_TBL_HI); - DUMP_REG(qdev, COS_DFLT_CQ1); - DUMP_REG(qdev, COS_DFLT_CQ2); - DUMP_REG(qdev, SPLT_HDR); - DUMP_REG(qdev, FC_PAUSE_THRES); - DUMP_REG(qdev, NIC_PAUSE_THRES); - DUMP_REG(qdev, FC_ETHERTYPE); - DUMP_REG(qdev, FC_RCV_CFG); - DUMP_REG(qdev, NIC_RCV_CFG); - DUMP_REG(qdev, FC_COS_TAGS); - DUMP_REG(qdev, NIC_COS_TAGS); - DUMP_REG(qdev, MGMT_RCV_CFG); - DUMP_REG(qdev, XG_SERDES_ADDR); - DUMP_REG(qdev, XG_SERDES_DATA); - DUMP_REG(qdev, PRB_MX_ADDR); - DUMP_REG(qdev, PRB_MX_DATA); - ql_dump_intr_states(qdev); - ql_dump_xgmac_control_regs(qdev); - ql_dump_ets_regs(qdev); - ql_dump_cam_entries(qdev); - ql_dump_routing_entries(qdev); -} -#endif - -#ifdef QL_STAT_DUMP - -#define DUMP_STAT(qdev, stat) \ - netdev_err(qdev->ndev, "%s = %ld\n", #stat, \ - (unsigned long)(qdev)->nic_stats.stat) - -void ql_dump_stat(struct ql_adapter *qdev) -{ - netdev_err(qdev->ndev, "%s: Enter\n", __func__); - DUMP_STAT(qdev, tx_pkts); - DUMP_STAT(qdev, tx_bytes); - DUMP_STAT(qdev, tx_mcast_pkts); - DUMP_STAT(qdev, tx_bcast_pkts); - DUMP_STAT(qdev, tx_ucast_pkts); - DUMP_STAT(qdev, tx_ctl_pkts); - DUMP_STAT(qdev, tx_pause_pkts); - DUMP_STAT(qdev, tx_64_pkt); - DUMP_STAT(qdev, tx_65_to_127_pkt); - DUMP_STAT(qdev, tx_128_to_255_pkt); - DUMP_STAT(qdev, tx_256_511_pkt); - DUMP_STAT(qdev, tx_512_to_1023_pkt); - DUMP_STAT(qdev, tx_1024_to_1518_pkt); - DUMP_STAT(qdev, tx_1519_to_max_pkt); - DUMP_STAT(qdev, tx_undersize_pkt); - DUMP_STAT(qdev, tx_oversize_pkt); - DUMP_STAT(qdev, rx_bytes); - DUMP_STAT(qdev, rx_bytes_ok); - DUMP_STAT(qdev, rx_pkts); - DUMP_STAT(qdev, rx_pkts_ok); - DUMP_STAT(qdev, rx_bcast_pkts); - DUMP_STAT(qdev, rx_mcast_pkts); - DUMP_STAT(qdev, rx_ucast_pkts); - DUMP_STAT(qdev, rx_undersize_pkts); - DUMP_STAT(qdev, rx_oversize_pkts); - DUMP_STAT(qdev, rx_jabber_pkts); - DUMP_STAT(qdev, rx_undersize_fcerr_pkts); - DUMP_STAT(qdev, rx_drop_events); - DUMP_STAT(qdev, rx_fcerr_pkts); - DUMP_STAT(qdev, rx_align_err); - DUMP_STAT(qdev, rx_symbol_err); - DUMP_STAT(qdev, rx_mac_err); - DUMP_STAT(qdev, rx_ctl_pkts); - DUMP_STAT(qdev, rx_pause_pkts); - DUMP_STAT(qdev, rx_64_pkts); - DUMP_STAT(qdev, rx_65_to_127_pkts); - DUMP_STAT(qdev, rx_128_255_pkts); - DUMP_STAT(qdev, rx_256_511_pkts); - DUMP_STAT(qdev, rx_512_to_1023_pkts); - DUMP_STAT(qdev, rx_1024_to_1518_pkts); - DUMP_STAT(qdev, rx_1519_to_max_pkts); - DUMP_STAT(qdev, rx_len_err_pkts); -}; -#endif - -#ifdef QL_DEV_DUMP - -#define DUMP_QDEV_FIELD(qdev, type, field) \ - netdev_err(qdev->ndev, "qdev->%-24s = " type "\n", #field, (qdev)->field) -#define DUMP_QDEV_DMA_FIELD(qdev, field) \ - netdev_err(qdev->ndev, "qdev->%-24s = %llx\n", #field, \ - (unsigned long long)qdev->field) -#define DUMP_QDEV_ARRAY(qdev, type, array, index, field) \ - netdev_err(qdev->ndev, "%s[%d].%s = " type "\n", \ - #array, index, #field, (qdev)->array[index].field) -void ql_dump_qdev(struct ql_adapter *qdev) -{ - int i; - - DUMP_QDEV_FIELD(qdev, "%lx", flags); - DUMP_QDEV_FIELD(qdev, "%p", pdev); - DUMP_QDEV_FIELD(qdev, "%p", ndev); - DUMP_QDEV_FIELD(qdev, "%d", chip_rev_id); - DUMP_QDEV_FIELD(qdev, "%p", reg_base); - DUMP_QDEV_FIELD(qdev, "%p", doorbell_area); - DUMP_QDEV_FIELD(qdev, "%d", doorbell_area_size); - DUMP_QDEV_FIELD(qdev, "%x", msg_enable); - DUMP_QDEV_FIELD(qdev, "%p", rx_ring_shadow_reg_area); - DUMP_QDEV_DMA_FIELD(qdev, rx_ring_shadow_reg_dma); - DUMP_QDEV_FIELD(qdev, "%p", tx_ring_shadow_reg_area); - DUMP_QDEV_DMA_FIELD(qdev, tx_ring_shadow_reg_dma); - DUMP_QDEV_FIELD(qdev, "%d", intr_count); - if (qdev->msi_x_entry) - for (i = 0; i < qdev->intr_count; i++) { - DUMP_QDEV_ARRAY(qdev, "%d", msi_x_entry, i, vector); - DUMP_QDEV_ARRAY(qdev, "%d", msi_x_entry, i, entry); - } - for (i = 0; i < qdev->intr_count; i++) { - DUMP_QDEV_ARRAY(qdev, "%p", intr_context, i, qdev); - DUMP_QDEV_ARRAY(qdev, "%d", intr_context, i, intr); - DUMP_QDEV_ARRAY(qdev, "%d", intr_context, i, hooked); - DUMP_QDEV_ARRAY(qdev, "0x%08x", intr_context, i, intr_en_mask); - DUMP_QDEV_ARRAY(qdev, "0x%08x", intr_context, i, intr_dis_mask); - DUMP_QDEV_ARRAY(qdev, "0x%08x", intr_context, i, intr_read_mask); - } - DUMP_QDEV_FIELD(qdev, "%d", tx_ring_count); - DUMP_QDEV_FIELD(qdev, "%d", rx_ring_count); - DUMP_QDEV_FIELD(qdev, "%d", ring_mem_size); - DUMP_QDEV_FIELD(qdev, "%p", ring_mem); - DUMP_QDEV_FIELD(qdev, "%d", intr_count); - DUMP_QDEV_FIELD(qdev, "%p", tx_ring); - DUMP_QDEV_FIELD(qdev, "%d", rss_ring_count); - DUMP_QDEV_FIELD(qdev, "%p", rx_ring); - DUMP_QDEV_FIELD(qdev, "%d", default_rx_queue); - DUMP_QDEV_FIELD(qdev, "0x%08x", xg_sem_mask); - DUMP_QDEV_FIELD(qdev, "0x%08x", port_link_up); - DUMP_QDEV_FIELD(qdev, "0x%08x", port_init); - DUMP_QDEV_FIELD(qdev, "%u", lbq_buf_size); -} -#endif - -#ifdef QL_CB_DUMP -void ql_dump_wqicb(struct wqicb *wqicb) -{ - struct tx_ring *tx_ring = container_of(wqicb, struct tx_ring, wqicb); - struct ql_adapter *qdev = tx_ring->qdev; - - netdev_err(qdev->ndev, "Dumping wqicb stuff...\n"); - netdev_err(qdev->ndev, "wqicb->len = 0x%x\n", le16_to_cpu(wqicb->len)); - netdev_err(qdev->ndev, "wqicb->flags = %x\n", - le16_to_cpu(wqicb->flags)); - netdev_err(qdev->ndev, "wqicb->cq_id_rss = %d\n", - le16_to_cpu(wqicb->cq_id_rss)); - netdev_err(qdev->ndev, "wqicb->rid = 0x%x\n", le16_to_cpu(wqicb->rid)); - netdev_err(qdev->ndev, "wqicb->wq_addr = 0x%llx\n", - (unsigned long long)le64_to_cpu(wqicb->addr)); - netdev_err(qdev->ndev, "wqicb->wq_cnsmr_idx_addr = 0x%llx\n", - (unsigned long long)le64_to_cpu(wqicb->cnsmr_idx_addr)); -} - -void ql_dump_tx_ring(struct tx_ring *tx_ring) -{ - struct ql_adapter *qdev = tx_ring->qdev; - - netdev_err(qdev->ndev, "===================== Dumping tx_ring %d ===============\n", - tx_ring->wq_id); - netdev_err(qdev->ndev, "tx_ring->base = %p\n", tx_ring->wq_base); - netdev_err(qdev->ndev, "tx_ring->base_dma = 0x%llx\n", - (unsigned long long)tx_ring->wq_base_dma); - netdev_err(qdev->ndev, "tx_ring->cnsmr_idx_sh_reg, addr = 0x%p, value = %d\n", - tx_ring->cnsmr_idx_sh_reg, - tx_ring->cnsmr_idx_sh_reg - ? ql_read_sh_reg(tx_ring->cnsmr_idx_sh_reg) : 0); - netdev_err(qdev->ndev, "tx_ring->size = %d\n", tx_ring->wq_size); - netdev_err(qdev->ndev, "tx_ring->len = %d\n", tx_ring->wq_len); - netdev_err(qdev->ndev, "tx_ring->prod_idx_db_reg = %p\n", tx_ring->prod_idx_db_reg); - netdev_err(qdev->ndev, "tx_ring->valid_db_reg = %p\n", tx_ring->valid_db_reg); - netdev_err(qdev->ndev, "tx_ring->prod_idx = %d\n", tx_ring->prod_idx); - netdev_err(qdev->ndev, "tx_ring->cq_id = %d\n", tx_ring->cq_id); - netdev_err(qdev->ndev, "tx_ring->wq_id = %d\n", tx_ring->wq_id); - netdev_err(qdev->ndev, "tx_ring->q = %p\n", tx_ring->q); - netdev_err(qdev->ndev, "tx_ring->tx_count = %d\n", atomic_read(&tx_ring->tx_count)); -} - -void ql_dump_ricb(struct ricb *ricb) -{ - int i; - struct ql_adapter *qdev = - container_of(ricb, struct ql_adapter, ricb); - - netdev_err(qdev->ndev, "===================== Dumping ricb ===============\n"); - netdev_err(qdev->ndev, "Dumping ricb stuff...\n"); - - netdev_err(qdev->ndev, "ricb->base_cq = %d\n", ricb->base_cq & 0x1f); - netdev_err(qdev->ndev, "ricb->flags = %s%s%s%s%s%s%s%s%s\n", - ricb->base_cq & RSS_L4K ? "RSS_L4K " : "", - ricb->flags & RSS_L6K ? "RSS_L6K " : "", - ricb->flags & RSS_LI ? "RSS_LI " : "", - ricb->flags & RSS_LB ? "RSS_LB " : "", - ricb->flags & RSS_LM ? "RSS_LM " : "", - ricb->flags & RSS_RI4 ? "RSS_RI4 " : "", - ricb->flags & RSS_RT4 ? "RSS_RT4 " : "", - ricb->flags & RSS_RI6 ? "RSS_RI6 " : "", - ricb->flags & RSS_RT6 ? "RSS_RT6 " : ""); - netdev_err(qdev->ndev, "ricb->mask = 0x%.04x\n", le16_to_cpu(ricb->mask)); - for (i = 0; i < 16; i++) - netdev_err(qdev->ndev, "ricb->hash_cq_id[%d] = 0x%.08x\n", i, - le32_to_cpu(ricb->hash_cq_id[i])); - for (i = 0; i < 10; i++) - netdev_err(qdev->ndev, "ricb->ipv6_hash_key[%d] = 0x%.08x\n", i, - le32_to_cpu(ricb->ipv6_hash_key[i])); - for (i = 0; i < 4; i++) - netdev_err(qdev->ndev, "ricb->ipv4_hash_key[%d] = 0x%.08x\n", i, - le32_to_cpu(ricb->ipv4_hash_key[i])); -} - -void ql_dump_cqicb(struct cqicb *cqicb) -{ - struct rx_ring *rx_ring = container_of(cqicb, struct rx_ring, cqicb); - struct ql_adapter *qdev = rx_ring->qdev; - - netdev_err(qdev->ndev, "Dumping cqicb stuff...\n"); - - netdev_err(qdev->ndev, "cqicb->msix_vect = %d\n", cqicb->msix_vect); - netdev_err(qdev->ndev, "cqicb->flags = %x\n", cqicb->flags); - netdev_err(qdev->ndev, "cqicb->len = %d\n", le16_to_cpu(cqicb->len)); - netdev_err(qdev->ndev, "cqicb->addr = 0x%llx\n", - (unsigned long long)le64_to_cpu(cqicb->addr)); - netdev_err(qdev->ndev, "cqicb->prod_idx_addr = 0x%llx\n", - (unsigned long long)le64_to_cpu(cqicb->prod_idx_addr)); - netdev_err(qdev->ndev, "cqicb->pkt_delay = 0x%.04x\n", - le16_to_cpu(cqicb->pkt_delay)); - netdev_err(qdev->ndev, "cqicb->irq_delay = 0x%.04x\n", - le16_to_cpu(cqicb->irq_delay)); - netdev_err(qdev->ndev, "cqicb->lbq_addr = 0x%llx\n", - (unsigned long long)le64_to_cpu(cqicb->lbq_addr)); - netdev_err(qdev->ndev, "cqicb->lbq_buf_size = 0x%.04x\n", - le16_to_cpu(cqicb->lbq_buf_size)); - netdev_err(qdev->ndev, "cqicb->lbq_len = 0x%.04x\n", - le16_to_cpu(cqicb->lbq_len)); - netdev_err(qdev->ndev, "cqicb->sbq_addr = 0x%llx\n", - (unsigned long long)le64_to_cpu(cqicb->sbq_addr)); - netdev_err(qdev->ndev, "cqicb->sbq_buf_size = 0x%.04x\n", - le16_to_cpu(cqicb->sbq_buf_size)); - netdev_err(qdev->ndev, "cqicb->sbq_len = 0x%.04x\n", - le16_to_cpu(cqicb->sbq_len)); -} - -static const char *qlge_rx_ring_type_name(struct rx_ring *rx_ring) -{ - struct ql_adapter *qdev = rx_ring->qdev; - - if (rx_ring->cq_id < qdev->rss_ring_count) - return "RX COMPLETION"; - else - return "TX COMPLETION"; -}; - -void ql_dump_rx_ring(struct rx_ring *rx_ring) -{ - struct ql_adapter *qdev = rx_ring->qdev; - - netdev_err(qdev->ndev, - "===================== Dumping rx_ring %d ===============\n", - rx_ring->cq_id); - netdev_err(qdev->ndev, - "Dumping rx_ring %d, type = %s\n", rx_ring->cq_id, - qlge_rx_ring_type_name(rx_ring)); - netdev_err(qdev->ndev, "rx_ring->cqicb = %p\n", &rx_ring->cqicb); - netdev_err(qdev->ndev, "rx_ring->cq_base = %p\n", rx_ring->cq_base); - netdev_err(qdev->ndev, "rx_ring->cq_base_dma = %llx\n", - (unsigned long long)rx_ring->cq_base_dma); - netdev_err(qdev->ndev, "rx_ring->cq_size = %d\n", rx_ring->cq_size); - netdev_err(qdev->ndev, "rx_ring->cq_len = %d\n", rx_ring->cq_len); - netdev_err(qdev->ndev, - "rx_ring->prod_idx_sh_reg, addr = 0x%p, value = %d\n", - rx_ring->prod_idx_sh_reg, - rx_ring->prod_idx_sh_reg ? ql_read_sh_reg(rx_ring->prod_idx_sh_reg) : 0); - netdev_err(qdev->ndev, "rx_ring->prod_idx_sh_reg_dma = %llx\n", - (unsigned long long)rx_ring->prod_idx_sh_reg_dma); - netdev_err(qdev->ndev, "rx_ring->cnsmr_idx_db_reg = %p\n", - rx_ring->cnsmr_idx_db_reg); - netdev_err(qdev->ndev, "rx_ring->cnsmr_idx = %d\n", rx_ring->cnsmr_idx); - netdev_err(qdev->ndev, "rx_ring->curr_entry = %p\n", rx_ring->curr_entry); - netdev_err(qdev->ndev, "rx_ring->valid_db_reg = %p\n", rx_ring->valid_db_reg); - - netdev_err(qdev->ndev, "rx_ring->lbq.base = %p\n", rx_ring->lbq.base); - netdev_err(qdev->ndev, "rx_ring->lbq.base_dma = %llx\n", - (unsigned long long)rx_ring->lbq.base_dma); - netdev_err(qdev->ndev, "rx_ring->lbq.base_indirect = %p\n", - rx_ring->lbq.base_indirect); - netdev_err(qdev->ndev, "rx_ring->lbq.base_indirect_dma = %llx\n", - (unsigned long long)rx_ring->lbq.base_indirect_dma); - netdev_err(qdev->ndev, "rx_ring->lbq = %p\n", rx_ring->lbq.queue); - netdev_err(qdev->ndev, "rx_ring->lbq.prod_idx_db_reg = %p\n", - rx_ring->lbq.prod_idx_db_reg); - netdev_err(qdev->ndev, "rx_ring->lbq.next_to_use = %d\n", rx_ring->lbq.next_to_use); - netdev_err(qdev->ndev, "rx_ring->lbq.next_to_clean = %d\n", rx_ring->lbq.next_to_clean); - - netdev_err(qdev->ndev, "rx_ring->sbq.base = %p\n", rx_ring->sbq.base); - netdev_err(qdev->ndev, "rx_ring->sbq.base_dma = %llx\n", - (unsigned long long)rx_ring->sbq.base_dma); - netdev_err(qdev->ndev, "rx_ring->sbq.base_indirect = %p\n", - rx_ring->sbq.base_indirect); - netdev_err(qdev->ndev, "rx_ring->sbq.base_indirect_dma = %llx\n", - (unsigned long long)rx_ring->sbq.base_indirect_dma); - netdev_err(qdev->ndev, "rx_ring->sbq = %p\n", rx_ring->sbq.queue); - netdev_err(qdev->ndev, "rx_ring->sbq.prod_idx_db_reg addr = %p\n", - rx_ring->sbq.prod_idx_db_reg); - netdev_err(qdev->ndev, "rx_ring->sbq.next_to_use = %d\n", rx_ring->sbq.next_to_use); - netdev_err(qdev->ndev, "rx_ring->sbq.next_to_clean = %d\n", rx_ring->sbq.next_to_clean); - netdev_err(qdev->ndev, "rx_ring->cq_id = %d\n", rx_ring->cq_id); - netdev_err(qdev->ndev, "rx_ring->irq = %d\n", rx_ring->irq); - netdev_err(qdev->ndev, "rx_ring->cpu = %d\n", rx_ring->cpu); - netdev_err(qdev->ndev, "rx_ring->qdev = %p\n", rx_ring->qdev); -} - -void ql_dump_hw_cb(struct ql_adapter *qdev, int size, u32 bit, u16 q_id) -{ - void *ptr; - - netdev_err(qdev->ndev, "%s: Enter\n", __func__); - - ptr = kmalloc(size, GFP_ATOMIC); - if (!ptr) - return; - - if (ql_write_cfg(qdev, ptr, size, bit, q_id)) { - netdev_err(qdev->ndev, "%s: Failed to upload control block!\n", __func__); - goto fail_it; - } - switch (bit) { - case CFG_DRQ: - ql_dump_wqicb((struct wqicb *)ptr); - break; - case CFG_DCQ: - ql_dump_cqicb((struct cqicb *)ptr); - break; - case CFG_DR: - ql_dump_ricb((struct ricb *)ptr); - break; - default: - netdev_err(qdev->ndev, "%s: Invalid bit value = %x\n", __func__, bit); - break; - } -fail_it: - kfree(ptr); -} -#endif - -#ifdef QL_OB_DUMP -void ql_dump_tx_desc(struct ql_adapter *qdev, struct tx_buf_desc *tbd) -{ - netdev_err(qdev->ndev, "tbd->addr = 0x%llx\n", - le64_to_cpu((u64)tbd->addr)); - netdev_err(qdev->ndev, "tbd->len = %d\n", - le32_to_cpu(tbd->len & TX_DESC_LEN_MASK)); - netdev_err(qdev->ndev, "tbd->flags = %s %s\n", - tbd->len & TX_DESC_C ? "C" : ".", - tbd->len & TX_DESC_E ? "E" : "."); - tbd++; - netdev_err(qdev->ndev, "tbd->addr = 0x%llx\n", - le64_to_cpu((u64)tbd->addr)); - netdev_err(qdev->ndev, "tbd->len = %d\n", - le32_to_cpu(tbd->len & TX_DESC_LEN_MASK)); - netdev_err(qdev->ndev, "tbd->flags = %s %s\n", - tbd->len & TX_DESC_C ? "C" : ".", - tbd->len & TX_DESC_E ? "E" : "."); - tbd++; - netdev_err(qdev->ndev, "tbd->addr = 0x%llx\n", - le64_to_cpu((u64)tbd->addr)); - netdev_err(qdev->ndev, "tbd->len = %d\n", - le32_to_cpu(tbd->len & TX_DESC_LEN_MASK)); - netdev_err(qdev->ndev, "tbd->flags = %s %s\n", - tbd->len & TX_DESC_C ? "C" : ".", - tbd->len & TX_DESC_E ? "E" : "."); -} - -void ql_dump_ob_mac_iocb(struct ql_adapter *qdev, struct ob_mac_iocb_req *ob_mac_iocb) -{ - struct ob_mac_tso_iocb_req *ob_mac_tso_iocb = - (struct ob_mac_tso_iocb_req *)ob_mac_iocb; - struct tx_buf_desc *tbd; - u16 frame_len; - - netdev_err(qdev->ndev, "%s\n", __func__); - netdev_err(qdev->ndev, "opcode = %s\n", - (ob_mac_iocb->opcode == OPCODE_OB_MAC_IOCB) ? "MAC" : "TSO"); - netdev_err(qdev->ndev, "flags1 = %s %s %s %s %s\n", - ob_mac_tso_iocb->flags1 & OB_MAC_TSO_IOCB_OI ? "OI" : "", - ob_mac_tso_iocb->flags1 & OB_MAC_TSO_IOCB_I ? "I" : "", - ob_mac_tso_iocb->flags1 & OB_MAC_TSO_IOCB_D ? "D" : "", - ob_mac_tso_iocb->flags1 & OB_MAC_TSO_IOCB_IP4 ? "IP4" : "", - ob_mac_tso_iocb->flags1 & OB_MAC_TSO_IOCB_IP6 ? "IP6" : ""); - netdev_err(qdev->ndev, "flags2 = %s %s %s\n", - ob_mac_tso_iocb->flags2 & OB_MAC_TSO_IOCB_LSO ? "LSO" : "", - ob_mac_tso_iocb->flags2 & OB_MAC_TSO_IOCB_UC ? "UC" : "", - ob_mac_tso_iocb->flags2 & OB_MAC_TSO_IOCB_TC ? "TC" : ""); - netdev_err(qdev->ndev, "flags3 = %s %s %s\n", - ob_mac_tso_iocb->flags3 & OB_MAC_TSO_IOCB_IC ? "IC" : "", - ob_mac_tso_iocb->flags3 & OB_MAC_TSO_IOCB_DFP ? "DFP" : "", - ob_mac_tso_iocb->flags3 & OB_MAC_TSO_IOCB_V ? "V" : ""); - netdev_err(qdev->ndev, "tid = %x\n", ob_mac_iocb->tid); - netdev_err(qdev->ndev, "txq_idx = %d\n", ob_mac_iocb->txq_idx); - netdev_err(qdev->ndev, "vlan_tci = %x\n", ob_mac_tso_iocb->vlan_tci); - if (ob_mac_iocb->opcode == OPCODE_OB_MAC_TSO_IOCB) { - netdev_err(qdev->ndev, "frame_len = %d\n", - le32_to_cpu(ob_mac_tso_iocb->frame_len)); - netdev_err(qdev->ndev, "mss = %d\n", - le16_to_cpu(ob_mac_tso_iocb->mss)); - netdev_err(qdev->ndev, "prot_hdr_len = %d\n", - le16_to_cpu(ob_mac_tso_iocb->total_hdrs_len)); - netdev_err(qdev->ndev, "hdr_offset = 0x%.04x\n", - le16_to_cpu(ob_mac_tso_iocb->net_trans_offset)); - frame_len = le32_to_cpu(ob_mac_tso_iocb->frame_len); - } else { - netdev_err(qdev->ndev, "frame_len = %d\n", - le16_to_cpu(ob_mac_iocb->frame_len)); - frame_len = le16_to_cpu(ob_mac_iocb->frame_len); - } - tbd = &ob_mac_iocb->tbd[0]; - ql_dump_tx_desc(qdev, tbd); -} - -void ql_dump_ob_mac_rsp(struct ql_adapter *qdev, struct ob_mac_iocb_rsp *ob_mac_rsp) -{ - netdev_err(qdev->ndev, "%s\n", __func__); - netdev_err(qdev->ndev, "opcode = %d\n", ob_mac_rsp->opcode); - netdev_err(qdev->ndev, "flags = %s %s %s %s %s %s %s\n", - ob_mac_rsp->flags1 & OB_MAC_IOCB_RSP_OI ? - "OI" : ".", ob_mac_rsp->flags1 & OB_MAC_IOCB_RSP_I ? "I" : ".", - ob_mac_rsp->flags1 & OB_MAC_IOCB_RSP_E ? "E" : ".", - ob_mac_rsp->flags1 & OB_MAC_IOCB_RSP_S ? "S" : ".", - ob_mac_rsp->flags1 & OB_MAC_IOCB_RSP_L ? "L" : ".", - ob_mac_rsp->flags1 & OB_MAC_IOCB_RSP_P ? "P" : ".", - ob_mac_rsp->flags2 & OB_MAC_IOCB_RSP_B ? "B" : "."); - netdev_err(qdev->ndev, "tid = %x\n", ob_mac_rsp->tid); -} -#endif - -#ifdef QL_IB_DUMP -void ql_dump_ib_mac_rsp(struct ql_adapter *qdev, struct ib_mac_iocb_rsp *ib_mac_rsp) -{ - netdev_err(qdev->ndev, "%s\n", __func__); - netdev_err(qdev->ndev, "opcode = 0x%x\n", ib_mac_rsp->opcode); - netdev_err(qdev->ndev, "flags1 = %s%s%s%s%s%s\n", - ib_mac_rsp->flags1 & IB_MAC_IOCB_RSP_OI ? "OI " : "", - ib_mac_rsp->flags1 & IB_MAC_IOCB_RSP_I ? "I " : "", - ib_mac_rsp->flags1 & IB_MAC_IOCB_RSP_TE ? "TE " : "", - ib_mac_rsp->flags1 & IB_MAC_IOCB_RSP_NU ? "NU " : "", - ib_mac_rsp->flags1 & IB_MAC_IOCB_RSP_IE ? "IE " : "", - ib_mac_rsp->flags1 & IB_MAC_IOCB_RSP_B ? "B " : ""); - - if (ib_mac_rsp->flags1 & IB_MAC_IOCB_RSP_M_MASK) - netdev_err(qdev->ndev, "%s%s%s Multicast\n", - (ib_mac_rsp->flags1 & IB_MAC_IOCB_RSP_M_MASK) == - IB_MAC_IOCB_RSP_M_HASH ? "Hash" : "", - (ib_mac_rsp->flags1 & IB_MAC_IOCB_RSP_M_MASK) == - IB_MAC_IOCB_RSP_M_REG ? "Registered" : "", - (ib_mac_rsp->flags1 & IB_MAC_IOCB_RSP_M_MASK) == - IB_MAC_IOCB_RSP_M_PROM ? "Promiscuous" : ""); - - netdev_err(qdev->ndev, "flags2 = %s%s%s%s%s\n", - (ib_mac_rsp->flags2 & IB_MAC_IOCB_RSP_P) ? "P " : "", - (ib_mac_rsp->flags2 & IB_MAC_IOCB_RSP_V) ? "V " : "", - (ib_mac_rsp->flags2 & IB_MAC_IOCB_RSP_U) ? "U " : "", - (ib_mac_rsp->flags2 & IB_MAC_IOCB_RSP_T) ? "T " : "", - (ib_mac_rsp->flags2 & IB_MAC_IOCB_RSP_FO) ? "FO " : ""); - - if (ib_mac_rsp->flags2 & IB_MAC_IOCB_RSP_ERR_MASK) - netdev_err(qdev->ndev, "%s%s%s%s%s error\n", - (ib_mac_rsp->flags2 & IB_MAC_IOCB_RSP_ERR_MASK) == - IB_MAC_IOCB_RSP_ERR_OVERSIZE ? "oversize" : "", - (ib_mac_rsp->flags2 & IB_MAC_IOCB_RSP_ERR_MASK) == - IB_MAC_IOCB_RSP_ERR_UNDERSIZE ? "undersize" : "", - (ib_mac_rsp->flags2 & IB_MAC_IOCB_RSP_ERR_MASK) == - IB_MAC_IOCB_RSP_ERR_PREAMBLE ? "preamble" : "", - (ib_mac_rsp->flags2 & IB_MAC_IOCB_RSP_ERR_MASK) == - IB_MAC_IOCB_RSP_ERR_FRAME_LEN ? "frame length" : "", - (ib_mac_rsp->flags2 & IB_MAC_IOCB_RSP_ERR_MASK) == - IB_MAC_IOCB_RSP_ERR_CRC ? "CRC" : ""); - - netdev_err(qdev->ndev, "flags3 = %s%s\n", - ib_mac_rsp->flags3 & IB_MAC_IOCB_RSP_DS ? "DS " : "", - ib_mac_rsp->flags3 & IB_MAC_IOCB_RSP_DL ? "DL " : ""); - - if (ib_mac_rsp->flags3 & IB_MAC_IOCB_RSP_RSS_MASK) - netdev_err(qdev->ndev, "RSS flags = %s%s%s%s\n", - ((ib_mac_rsp->flags3 & IB_MAC_IOCB_RSP_RSS_MASK) == - IB_MAC_IOCB_RSP_M_IPV4) ? "IPv4 RSS" : "", - ((ib_mac_rsp->flags3 & IB_MAC_IOCB_RSP_RSS_MASK) == - IB_MAC_IOCB_RSP_M_IPV6) ? "IPv6 RSS " : "", - ((ib_mac_rsp->flags3 & IB_MAC_IOCB_RSP_RSS_MASK) == - IB_MAC_IOCB_RSP_M_TCP_V4) ? "TCP/IPv4 RSS" : "", - ((ib_mac_rsp->flags3 & IB_MAC_IOCB_RSP_RSS_MASK) == - IB_MAC_IOCB_RSP_M_TCP_V6) ? "TCP/IPv6 RSS" : ""); - - netdev_err(qdev->ndev, "data_len = %d\n", - le32_to_cpu(ib_mac_rsp->data_len)); - netdev_err(qdev->ndev, "data_addr = 0x%llx\n", - (unsigned long long)le64_to_cpu(ib_mac_rsp->data_addr)); - if (ib_mac_rsp->flags3 & IB_MAC_IOCB_RSP_RSS_MASK) - netdev_err(qdev->ndev, "rss = %x\n", - le32_to_cpu(ib_mac_rsp->rss)); - if (ib_mac_rsp->flags2 & IB_MAC_IOCB_RSP_V) - netdev_err(qdev->ndev, "vlan_id = %x\n", - le16_to_cpu(ib_mac_rsp->vlan_id)); - - netdev_err(qdev->ndev, "flags4 = %s%s%s\n", - ib_mac_rsp->flags4 & IB_MAC_IOCB_RSP_HV ? "HV " : "", - ib_mac_rsp->flags4 & IB_MAC_IOCB_RSP_HS ? "HS " : "", - ib_mac_rsp->flags4 & IB_MAC_IOCB_RSP_HL ? "HL " : ""); - - if (ib_mac_rsp->flags4 & IB_MAC_IOCB_RSP_HV) { - netdev_err(qdev->ndev, "hdr length = %d\n", - le32_to_cpu(ib_mac_rsp->hdr_len)); - netdev_err(qdev->ndev, "hdr addr = 0x%llx\n", - (unsigned long long)le64_to_cpu(ib_mac_rsp->hdr_addr)); - } -} -#endif - -#ifdef QL_ALL_DUMP -void ql_dump_all(struct ql_adapter *qdev) -{ - int i; - - QL_DUMP_REGS(qdev); - QL_DUMP_QDEV(qdev); - for (i = 0; i < qdev->tx_ring_count; i++) { - QL_DUMP_TX_RING(&qdev->tx_ring[i]); - QL_DUMP_WQICB((struct wqicb *)&qdev->tx_ring[i]); - } - for (i = 0; i < qdev->rx_ring_count; i++) { - QL_DUMP_RX_RING(&qdev->rx_ring[i]); - QL_DUMP_CQICB((struct cqicb *)&qdev->rx_ring[i]); - } -} -#endif diff --git a/drivers/staging/qlge/qlge_ethtool.c b/drivers/staging/qlge/qlge_ethtool.c index eed116d8895e..d6b7f60a84da 100644 --- a/drivers/staging/qlge/qlge_ethtool.c +++ b/drivers/staging/qlge/qlge_ethtool.c @@ -327,8 +327,6 @@ static void ql_update_stats(struct ql_adapter *qdev) ql_sem_unlock(qdev, qdev->xg_sem_mask); quit: spin_unlock(&qdev->stats_lock); - - QL_DUMP_STAT(qdev); } static void ql_get_strings(struct net_device *dev, u32 stringset, u8 *buf) diff --git a/drivers/staging/qlge/qlge_main.c b/drivers/staging/qlge/qlge_main.c index aaca740d46c4..898c50f553c6 100644 --- a/drivers/staging/qlge/qlge_main.c +++ b/drivers/staging/qlge/qlge_main.c @@ -1857,8 +1857,6 @@ static void ql_process_mac_split_rx_intr(struct ql_adapter *qdev, struct net_device *ndev = qdev->ndev; struct sk_buff *skb = NULL; - QL_DUMP_IB_MAC_RSP(qdev, ib_mac_rsp); - skb = ql_build_rx_skb(qdev, rx_ring, ib_mac_rsp); if (unlikely(!skb)) { netif_printk(qdev, rx_status, KERN_DEBUG, qdev->ndev, @@ -1955,8 +1953,6 @@ static unsigned long ql_process_mac_rx_intr(struct ql_adapter *qdev, ((le16_to_cpu(ib_mac_rsp->vlan_id) & IB_MAC_IOCB_RSP_VLAN_MASK)) : 0xffff; - QL_DUMP_IB_MAC_RSP(qdev, ib_mac_rsp); - if (ib_mac_rsp->flags4 & IB_MAC_IOCB_RSP_HV) { /* The data and headers are split into * separate buffers. @@ -2002,7 +1998,6 @@ static void ql_process_mac_tx_intr(struct ql_adapter *qdev, struct tx_ring *tx_ring; struct tx_ring_desc *tx_ring_desc; - QL_DUMP_OB_MAC_RSP(qdev, mac_rsp); tx_ring = &qdev->tx_ring[mac_rsp->txq_idx]; tx_ring_desc = &tx_ring->q[mac_rsp->tid]; ql_unmap_send(qdev, tx_ring_desc, tx_ring_desc->map_cnt); @@ -2593,7 +2588,7 @@ static netdev_tx_t qlge_send(struct sk_buff *skb, struct net_device *ndev) tx_ring->tx_errors++; return NETDEV_TX_BUSY; } - QL_DUMP_OB_MAC_IOCB(qdev, mac_iocb_ptr); + tx_ring->prod_idx++; if (tx_ring->prod_idx == tx_ring->wq_len) tx_ring->prod_idx = 0; From patchwork Thu Oct 8 11:58:08 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Coiby Xu X-Patchwork-Id: 11822793 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=-12.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable 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 C765BC4363A for ; Thu, 8 Oct 2020 11:59:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6D66321527 for ; Thu, 8 Oct 2020 11:59:05 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="M6GmYwfb" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729707AbgJHL7E (ORCPT ); Thu, 8 Oct 2020 07:59:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33324 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729650AbgJHL6s (ORCPT ); Thu, 8 Oct 2020 07:58:48 -0400 Received: from mail-pl1-x643.google.com (mail-pl1-x643.google.com [IPv6:2607:f8b0:4864:20::643]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ACA5CC061755; Thu, 8 Oct 2020 04:58:47 -0700 (PDT) Received: by mail-pl1-x643.google.com with SMTP id d6so2635208plo.13; Thu, 08 Oct 2020 04:58:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=C16XrUr3EIZoC6wKnJOdQjSS5HIA0XhjmNmgGMQUzM4=; b=M6GmYwfbt/kjjUW6kp5B076qsmpCA6NAxj2aoMFmCLiqC6VWEhmwIkeTxTLjaR/BCj 3iR9bU/ra3dayF4z0WUFKWnNJ5peBgsjjppx5Uk9CZaKeMVGwGVpJGo9b8hx0tklIqdu prMZsWNqmRo/buzmThYSm4iKEsbYTH/EZtJ7WczGcl/Rbqdn7UPUo/dpNf4L6mLygsoI rGIeSL0ftAreMCxlS4OTBU8g9V1P958rcn5Bg8W3DD2z4CqsAZ43pbSi/vsdJU024AUt yxjl+fh02KHA9q0MpzJx5O73kisLHCxKK5bf2Mj5mnAJW70PhVt7Yi1612Y5722HdrAp hw6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=C16XrUr3EIZoC6wKnJOdQjSS5HIA0XhjmNmgGMQUzM4=; b=gQtwiM+D4eQKpOKLSzFoPbflC37Txr444Zt+imcdenPUUDzcdblqEJpJtsmx8H8q0u r5uv5QgNDjiTsznvZC11XvxOQIF/G/A/MU3pvV7jB/zRNIdx/4PgVvALkFjJKQraAv3N 0jwRq09IcOD6TMUU+Tf4PWuxkj/QN2lDCyj3HT7FuimafaurMaaBwMs32DIeaggIAB4T y6TFpVcNPmdglO2JOIIh5OommUK8geIGns8LfBPSSafz9XA7OHlurmPrfUcPtqM2XRqn dClJHlk22pGecKf3TD7gNMiRs/fE+JKyq9XCsp5sMgkh1NXW/OtLPKFk9HXzcLbG8N7A 49Iw== X-Gm-Message-State: AOAM530E9X+LPHNqncrUrYl4hAbW/Fq4TYkYFm+habqAXHvqskcQU/+O 71HJuV9cvyyyYMcQf+GPCrw= X-Google-Smtp-Source: ABdhPJxBYQscTqQs3Usj08yzGOuKS+2JWwobVnEXIACwojWNpwWI5RwwKY4148y1cdC1Hg6PHssNQg== X-Received: by 2002:a17:902:aa04:b029:d3:8b4e:e5ef with SMTP id be4-20020a170902aa04b02900d38b4ee5efmr7380941plb.65.1602158327213; Thu, 08 Oct 2020 04:58:47 -0700 (PDT) Received: from localhost ([2001:e42:102:1532:160:16:113:140]) by smtp.gmail.com with ESMTPSA id 31sm7027555pgs.59.2020.10.08.04.58.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Oct 2020 04:58:46 -0700 (PDT) From: Coiby Xu To: devel@driverdev.osuosl.org Cc: Benjamin Poirier , Shung-Hsi Yu , "David S. Miller" , Jakub Kicinski , Jonathan Corbet , netdev@vger.kernel.org (open list:NETWORKING [GENERAL]), linux-doc@vger.kernel.org (open list:DOCUMENTATION), linux-kernel@vger.kernel.org (open list) Subject: [PATCH v1 6/6] staging: qlge: add documentation for debugging qlge Date: Thu, 8 Oct 2020 19:58:08 +0800 Message-Id: <20201008115808.91850-7-coiby.xu@gmail.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201008115808.91850-1-coiby.xu@gmail.com> References: <20201008115808.91850-1-coiby.xu@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Instructions and examples on kernel data structures dumping and coredump. Signed-off-by: Coiby Xu --- .../networking/device_drivers/index.rst | 1 + .../device_drivers/qlogic/index.rst | 18 +++ .../networking/device_drivers/qlogic/qlge.rst | 118 ++++++++++++++++++ MAINTAINERS | 6 + 4 files changed, 143 insertions(+) create mode 100644 Documentation/networking/device_drivers/qlogic/index.rst create mode 100644 Documentation/networking/device_drivers/qlogic/qlge.rst diff --git a/Documentation/networking/device_drivers/index.rst b/Documentation/networking/device_drivers/index.rst index a3113ffd7a16..d8279de7bf25 100644 --- a/Documentation/networking/device_drivers/index.rst +++ b/Documentation/networking/device_drivers/index.rst @@ -15,6 +15,7 @@ Contents: ethernet/index fddi/index hamradio/index + qlogic/index wan/index wifi/index diff --git a/Documentation/networking/device_drivers/qlogic/index.rst b/Documentation/networking/device_drivers/qlogic/index.rst new file mode 100644 index 000000000000..ad05b04286e4 --- /dev/null +++ b/Documentation/networking/device_drivers/qlogic/index.rst @@ -0,0 +1,18 @@ +.. SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) + +QLogic QLGE Device Drivers +=============================================== + +Contents: + +.. toctree:: + :maxdepth: 2 + + qlge + +.. only:: subproject and html + + Indices + ======= + + * :ref:`genindex` diff --git a/Documentation/networking/device_drivers/qlogic/qlge.rst b/Documentation/networking/device_drivers/qlogic/qlge.rst new file mode 100644 index 000000000000..0b888253d152 --- /dev/null +++ b/Documentation/networking/device_drivers/qlogic/qlge.rst @@ -0,0 +1,118 @@ +.. SPDX-License-Identifier: GPL-2.0 + +======================================= +QLogic QLGE 10Gb Ethernet device driver +======================================= + +This driver use drgn and devlink for debugging. + +Dump kernel data structures in drgn +----------------------------------- + +To dump kernel data structures, the following Python script can be used +in drgn: + +.. code-block:: python + + def align(x, a): + """the alignment a should be a power of 2 + """ + mask = a - 1 + return (x+ mask) & ~mask + + def struct_size(struct_type): + struct_str = "struct {}".format(struct_type) + return sizeof(Object(prog, struct_str, address=0x0)) + + def netdev_priv(netdevice): + NETDEV_ALIGN = 32 + return netdevice.value_() + align(struct_size("net_device"), NETDEV_ALIGN) + + name = 'xxx' + qlge_device = None + netdevices = prog['init_net'].dev_base_head.address_of_() + for netdevice in list_for_each_entry("struct net_device", netdevices, "dev_list"): + if netdevice.name.string_().decode('ascii') == name: + print(netdevice.name) + + ql_adapter = Object(prog, "struct ql_adapter", address=netdev_priv(qlge_device)) + +The struct ql_adapter will be printed in drgn as follows, + + >>> ql_adapter + (struct ql_adapter){ + .ricb = (struct ricb){ + .base_cq = (u8)0, + .flags = (u8)120, + .mask = (__le16)26637, + .hash_cq_id = (u8 [1024]){ 172, 142, 255, 255 }, + .ipv6_hash_key = (__le32 [10]){}, + .ipv4_hash_key = (__le32 [4]){}, + }, + .flags = (unsigned long)0, + .wol = (u32)0, + .nic_stats = (struct nic_stats){ + .tx_pkts = (u64)0, + .tx_bytes = (u64)0, + .tx_mcast_pkts = (u64)0, + .tx_bcast_pkts = (u64)0, + .tx_ucast_pkts = (u64)0, + .tx_ctl_pkts = (u64)0, + .tx_pause_pkts = (u64)0, + ... + }, + .active_vlans = (unsigned long [64]){ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 52780853100545, 18446744073709551615, + 18446619461681283072, 0, 42949673024, 2147483647, + }, + .rx_ring = (struct rx_ring [17]){ + { + .cqicb = (struct cqicb){ + .msix_vect = (u8)0, + .reserved1 = (u8)0, + .reserved2 = (u8)0, + .flags = (u8)0, + .len = (__le16)0, + .rid = (__le16)0, + ... + }, + .cq_base = (void *)0x0, + .cq_base_dma = (dma_addr_t)0, + } + ... + } + } + +coredump via devlink +-------------------- + + +And the coredump obtained via devlink in json format looks like, + +.. code:: shell + + $ devlink health dump show DEVICE reporter coredump -p -j + { + "Core Registers": { + "segment": 1, + "values": [ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ] + }, + "Test Logic Regs": { + "segment": 2, + "values": [ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ] + }, + "RMII Registers": { + "segment": 3, + "values": [ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ] + }, + ... + "Sem Registers": { + "segment": 50, + "values": [ 0,0,0,0 ] + } + } + +When the module parameter qlge_force_coredump is set to be true, the MPI +RISC reset before coredumping. So coredumping will much longer since +devlink tool has to wait for 5 secs for the resetting to be +finished. diff --git a/MAINTAINERS b/MAINTAINERS index 9ecb727f0a8f..d482078e3e88 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -14411,6 +14411,12 @@ L: netdev@vger.kernel.org S: Supported F: drivers/staging/qlge/ +QLOGIC QLGE 10Gb ETHERNET DRIVER +M: Coiby Xu +L: netdev@vger.kernel.org +S: Maintained +F: Documentation/networking/device_drivers/qlogic/qlge.rst + QM1D1B0004 MEDIA DRIVER M: Akihiro Tsukada L: linux-media@vger.kernel.org