Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp1189366pxu; Fri, 16 Oct 2020 06:13:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy2NSEOn+/0P6zWPEdFrHy7y3DDVedZvCNFcgdqAI6IoyltCGtELpCDFHVcYWmq5jDZON+i X-Received: by 2002:a50:85c6:: with SMTP id q6mr3928417edh.126.1602854027057; Fri, 16 Oct 2020 06:13:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602854027; cv=none; d=google.com; s=arc-20160816; b=MRRA7mUaT8UZL9JV1i9bO/pbHWE8jlvspSbz7fQpZIq3tgzVDEwEJoMmru253UJUSt bpMbyAhVw3Okl5A8+XVFKpUsIF9sgeeOHoDibcxehTS5LZcC72FpfiykxHyb5pagcM2L 9LkbCKr9JBL8tURTwvZc7N596y3EIluagZJRJmNwLVW/RcTNX6XEhR7ChY3u5bQhI21V 6uca3YW5+9jzsLdVPyveKRAI+GZUyOcdJJlBEHUZ3t7YTgXb5lW9KRxsy8b7e12EeAIQ lU2ks/B6kwaO09g5GZb8qzOIOKBx3krsfaUI7ULx8ZbCcNhNJKs37arRkk06meeFXiPQ lIzg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=9FUaERzJV2+J/MteS9K4tNtdGuklK9KHfOCKTL1tY0U=; b=fgIiR6DW9l1ZCAKcLFk56KOrJa8tQdkwEqD8O+wyRzV20jI3O+pdYDpeEFawiFEDE+ oLnEvV7dkLjcMXg8tl4EFG+JSN80B2fMv/2MU2UA/G/NNGnDTlt5cbZetj518Zq5ecWi C5wCxpIoIhyrdFzZaQPikujMK3H+NAU2mckcr+ViJcQz2X8sg7c2dYGGxDQiO35zCVz7 86fAcSLucr71PplnIv3esQ6/4zG4YyUSr68x9hk0UYNb27LSuxrH+HWEILM/aWoEDodw 9J5Wnj5avso+1iv5UjSej4x+Tg+x4cnUAUMlTNkgn1AuR/60iYF7SEJLG0C2MsWqcZMy zjKQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=nEUE7XDm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id qt2si1596739ejb.653.2020.10.16.06.13.19; Fri, 16 Oct 2020 06:13:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=nEUE7XDm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2407245AbgJPMOg (ORCPT + 99 others); Fri, 16 Oct 2020 08:14:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33280 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2407038AbgJPMO2 (ORCPT ); Fri, 16 Oct 2020 08:14:28 -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 6FE0CC061755; Fri, 16 Oct 2020 05:14:28 -0700 (PDT) Received: by mail-pf1-x443.google.com with SMTP id b26so1407923pff.3; Fri, 16 Oct 2020 05:14:28 -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=9FUaERzJV2+J/MteS9K4tNtdGuklK9KHfOCKTL1tY0U=; b=nEUE7XDmcZ6NfzoC2vt6YBIF061oYhllb8fBvqG1v/9H7WTIAEaw1I9HyUBZldkDLZ kuD6nkthVDN48dBeoEqii0L4D555/dAVxWzFUbMgtafllpbTwj38szWzHsiq7UeEhQic a1g9HRSd0hGOUB7L4fw6BgT5qrj3fVq12QIHPm9K4X6lfB6B3hehH+RFcJDpGP4aFGMc zNOiBzeI/16TFlNwL+C85g3qDE6dF1pcANwvxPWfr2TogwINWzHn4kSZSJGxqmQ9GeCX Oy/PBPQC7PAS1mAE8cvHPYhT3Lt6QyStEE41q0y+BmK+D86Yd/muGzvIfJpClRuxLEUn FiLA== 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=9FUaERzJV2+J/MteS9K4tNtdGuklK9KHfOCKTL1tY0U=; b=bWl0iSsD0xYN9zU9GI4IhEMbMLCHCD0zqegwXp2I60ueGKBhuNig0Dh96z0PW+E130 RSpX4yYU+/F6iKN2XxwQLrCP/gg/YU6GGZQaXzuTi9UamC0Az0OyVtWu1OzUaQzGBeEB EAGxYjNZ10hk99CLRPqhduI+PjBD1vKlMmewoW+3fyVqD4I46fL8kxN4IRcSo7hCd6zM +OwG8CCjn0XWvjkGyrVxTteet2+LsHBY3HrsN9x3oWVupL/8FNKu0UweIIy4qB+d8QrV dIe5TEq/Kz+r3RspH1lJT7/2h7urabUH/vOHSSg2chLJIKbltIayhVyketlMALL3uDXF xz9g== X-Gm-Message-State: AOAM531Nfur5GE9dNaI544px+gEsHBJWIwJIWHGdSF743dzt49MoMCoB oD947JhyFJqMM+iokapIKd4= X-Received: by 2002:a62:5382:0:b029:155:6333:ce4f with SMTP id h124-20020a6253820000b02901556333ce4fmr3327163pfb.28.1602850467826; Fri, 16 Oct 2020 05:14:27 -0700 (PDT) Received: from localhost ([160.16.113.140]) by smtp.gmail.com with ESMTPSA id 38sm2680994pgx.43.2020.10.16.05.14.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Oct 2020 05:14:27 -0700 (PDT) From: Coiby Xu To: devel@driverdev.osuosl.org Cc: Benjamin Poirier , Dan Carpenter , Shung-Hsi Yu , Willem de Bruijn , "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 v3 8/8] staging: qlge: add documentation for debugging qlge Date: Fri, 16 Oct 2020 19:54:07 +0800 Message-Id: <20201016115407.170821-9-coiby.xu@gmail.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201016115407.170821-1-coiby.xu@gmail.com> References: <20201016115407.170821-1-coiby.xu@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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 4538378de6f5..ed5691fef22e 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -14412,6 +14412,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 -- 2.28.0