get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/806744/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 806744,
    "url": "http://patchwork.ozlabs.org/api/patches/806744/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/netdev/patch/20170828191748.19492-2-vivien.didelot@savoirfairelinux.com/",
    "project": {
        "id": 7,
        "url": "http://patchwork.ozlabs.org/api/projects/7/?format=api",
        "name": "Linux network development",
        "link_name": "netdev",
        "list_id": "netdev.vger.kernel.org",
        "list_email": "netdev@vger.kernel.org",
        "web_url": null,
        "scm_url": null,
        "webscm_url": null,
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<20170828191748.19492-2-vivien.didelot@savoirfairelinux.com>",
    "list_archive_url": null,
    "date": "2017-08-28T19:17:39",
    "name": "[net-next,v2,01/10] net: dsa: add debugfs interface",
    "commit_ref": null,
    "pull_url": null,
    "state": "changes-requested",
    "archived": true,
    "hash": "40c36856ba2518a41ec7aa7456f18e8b3d80e561",
    "submitter": {
        "id": 15889,
        "url": "http://patchwork.ozlabs.org/api/people/15889/?format=api",
        "name": "Vivien Didelot",
        "email": "vivien.didelot@savoirfairelinux.com"
    },
    "delegate": {
        "id": 34,
        "url": "http://patchwork.ozlabs.org/api/users/34/?format=api",
        "username": "davem",
        "first_name": "David",
        "last_name": "Miller",
        "email": "davem@davemloft.net"
    },
    "mbox": "http://patchwork.ozlabs.org/project/netdev/patch/20170828191748.19492-2-vivien.didelot@savoirfairelinux.com/mbox/",
    "series": [
        {
            "id": 246,
            "url": "http://patchwork.ozlabs.org/api/series/246/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/netdev/list/?series=246",
            "date": "2017-08-28T19:17:41",
            "name": "net: dsa: add generic debugfs interface",
            "version": 2,
            "mbox": "http://patchwork.ozlabs.org/series/246/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/806744/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/806744/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<netdev-owner@vger.kernel.org>",
        "X-Original-To": "patchwork-incoming@ozlabs.org",
        "Delivered-To": "patchwork-incoming@ozlabs.org",
        "Authentication-Results": "ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=vger.kernel.org\n\t(client-ip=209.132.180.67; helo=vger.kernel.org;\n\tenvelope-from=netdev-owner@vger.kernel.org;\n\treceiver=<UNKNOWN>)",
        "Received": [
            "from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3xh24g1HFsz9sNc\n\tfor <patchwork-incoming@ozlabs.org>;\n\tTue, 29 Aug 2017 05:33:39 +1000 (AEST)",
            "(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1751435AbdH1TYi (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tMon, 28 Aug 2017 15:24:38 -0400",
            "from mail.savoirfairelinux.com ([208.88.110.44]:36416 \"EHLO\n\tmail.savoirfairelinux.com\" rhost-flags-OK-OK-OK-OK) by\n\tvger.kernel.org with ESMTP id S1751272AbdH1TVl (ORCPT\n\t<rfc822;netdev@vger.kernel.org>); Mon, 28 Aug 2017 15:21:41 -0400",
            "from localhost (localhost [127.0.0.1])\n\tby mail.savoirfairelinux.com (Postfix) with ESMTP id 958D49C1B9D;\n\tMon, 28 Aug 2017 15:21:40 -0400 (EDT)",
            "from mail.savoirfairelinux.com ([127.0.0.1])\n\tby localhost (mail.savoirfairelinux.com [127.0.0.1]) (amavisd-new,\n\tport 10032)\n\twith ESMTP id r9ivLwygpC5T; Mon, 28 Aug 2017 15:21:37 -0400 (EDT)",
            "from localhost (localhost [127.0.0.1])\n\tby mail.savoirfairelinux.com (Postfix) with ESMTP id 8FFD69C1D26;\n\tMon, 28 Aug 2017 15:21:37 -0400 (EDT)",
            "from mail.savoirfairelinux.com ([127.0.0.1])\n\tby localhost (mail.savoirfairelinux.com [127.0.0.1]) (amavisd-new,\n\tport 10026)\n\twith ESMTP id T1gcDfz9qxaS; Mon, 28 Aug 2017 15:21:37 -0400 (EDT)",
            "from weeman.mtl.sfl (unknown [192.168.50.91])\n\tby mail.savoirfairelinux.com (Postfix) with ESMTPSA id 5D9DD9C1B9D;\n\tMon, 28 Aug 2017 15:21:37 -0400 (EDT)"
        ],
        "X-Virus-Scanned": "amavisd-new at mail.savoirfairelinux.com",
        "From": "Vivien Didelot <vivien.didelot@savoirfairelinux.com>",
        "To": "netdev@vger.kernel.org",
        "Cc": "linux-kernel@vger.kernel.org, kernel@savoirfairelinux.com,\n\t\"David S. Miller\" <davem@davemloft.net>,\n\tFlorian Fainelli <f.fainelli@gmail.com>, Andrew Lunn <andrew@lunn.ch>,\n\tEgil Hjelmeland <privat@egil-hjelmeland.no>,\n\tJohn Crispin <john@phrozen.org>, Woojung Huh <Woojung.Huh@microchip.com>,\n\tSean Wang <sean.wang@mediatek.com>,\n\tNikita Yushchenko <nikita.yoush@cogentembedded.com>,\n\tChris Healy <cphealy@gmail.com>,\n\tVivien Didelot <vivien.didelot@savoirfairelinux.com>",
        "Subject": "[PATCH net-next v2 01/10] net: dsa: add debugfs interface",
        "Date": "Mon, 28 Aug 2017 15:17:39 -0400",
        "Message-Id": "<20170828191748.19492-2-vivien.didelot@savoirfairelinux.com>",
        "X-Mailer": "git-send-email 2.14.1",
        "In-Reply-To": "<20170828191748.19492-1-vivien.didelot@savoirfairelinux.com>",
        "References": "<20170828191748.19492-1-vivien.didelot@savoirfairelinux.com>",
        "Sender": "netdev-owner@vger.kernel.org",
        "Precedence": "bulk",
        "List-ID": "<netdev.vger.kernel.org>",
        "X-Mailing-List": "netdev@vger.kernel.org"
    },
    "content": "This commit adds a DEBUG_FS dependent DSA core file creating a generic\ndebug filesystem interface for the DSA switch devices.\n\nThe interface can be mounted with:\n\n    # mount -t debugfs none /sys/kernel/debug\n\nThe dsa directory contains one directory per switch chip:\n\n    # cd /sys/kernel/debug/dsa/\n    # ls\n    switch0  switch1 switch2\n\nEach chip directory contains one directory per port:\n\n    # ls -l switch0/\n    drwxr-xr-x 2 root root 0 Jan  1 00:00 port0\n    drwxr-xr-x 2 root root 0 Jan  1 00:00 port1\n    drwxr-xr-x 2 root root 0 Jan  1 00:00 port2\n    drwxr-xr-x 2 root root 0 Jan  1 00:00 port5\n    drwxr-xr-x 2 root root 0 Jan  1 00:00 port6\n\nFuture patches will add entry files to these directories.\n\nSigned-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>\n---\n include/net/dsa.h  |   7 ++++\n net/dsa/Kconfig    |  14 +++++++\n net/dsa/Makefile   |   1 +\n net/dsa/debugfs.c  | 118 +++++++++++++++++++++++++++++++++++++++++++++++++++++\n net/dsa/dsa.c      |   3 ++\n net/dsa/dsa2.c     |   4 ++\n net/dsa/dsa_priv.h |  13 ++++++\n net/dsa/legacy.c   |   4 ++\n 8 files changed, 164 insertions(+)\n create mode 100644 net/dsa/debugfs.c",
    "diff": "diff --git a/include/net/dsa.h b/include/net/dsa.h\nindex 398ca8d70ccd..7341178319f5 100644\n--- a/include/net/dsa.h\n+++ b/include/net/dsa.h\n@@ -210,6 +210,13 @@ struct dsa_switch {\n \t */\n \tvoid *priv;\n \n+#ifdef CONFIG_NET_DSA_DEBUGFS\n+\t/*\n+\t * Debugfs interface.\n+\t */\n+\tstruct dentry *debugfs_dir;\n+#endif\n+\n \t/*\n \t * Configuration data for this switch.\n \t */\ndiff --git a/net/dsa/Kconfig b/net/dsa/Kconfig\nindex cc5f8f971689..0f05a1e59dd2 100644\n--- a/net/dsa/Kconfig\n+++ b/net/dsa/Kconfig\n@@ -15,6 +15,20 @@ config NET_DSA\n \n if NET_DSA\n \n+config NET_DSA_DEBUGFS\n+\tbool \"Distributed Switch Architecture debugfs interface\"\n+\tdepends on DEBUG_FS\n+\t---help---\n+\t  Enable creation of debugfs files for the DSA core.\n+\n+\t  These debugfs files provide per-switch information, such as the tag\n+\t  protocol in use and ports connectivity. They also allow querying the\n+\t  hardware directly through the switch operations for debugging instead\n+\t  of going through the bridge, switchdev and DSA layers.\n+\n+\t  This is also a way to inspect the stats and FDB, MDB or VLAN entries\n+\t  of CPU and DSA links, since they are not exposed to userspace.\n+\n # tagging formats\n config NET_DSA_TAG_BRCM\n \tbool\ndiff --git a/net/dsa/Makefile b/net/dsa/Makefile\nindex fcce25da937c..7f60c6dfaffb 100644\n--- a/net/dsa/Makefile\n+++ b/net/dsa/Makefile\n@@ -1,6 +1,7 @@\n # the core\n obj-$(CONFIG_NET_DSA) += dsa_core.o\n dsa_core-y += dsa.o dsa2.o legacy.o port.o slave.o switch.o\n+dsa_core-$(CONFIG_NET_DSA_DEBUGFS) += debugfs.o\n \n # tagging formats\n dsa_core-$(CONFIG_NET_DSA_TAG_BRCM) += tag_brcm.o\ndiff --git a/net/dsa/debugfs.c b/net/dsa/debugfs.c\nnew file mode 100644\nindex 000000000000..b6b5e5c97389\n--- /dev/null\n+++ b/net/dsa/debugfs.c\n@@ -0,0 +1,118 @@\n+/*\n+ * net/dsa/debugfs.c - DSA debugfs interface\n+ * Copyright (c) 2017 Savoir-faire Linux, Inc.\n+ *\tVivien Didelot <vivien.didelot@savoirfairelinux.com>\n+ *\n+ * This program is free software; you can redistribute it and/or modify\n+ * it under the terms of the GNU General Public License as published by\n+ * the Free Software Foundation; either version 2 of the License, or\n+ * (at your option) any later version.\n+ */\n+\n+#include <linux/debugfs.h>\n+\n+#include \"dsa_priv.h\"\n+\n+#define DSA_SWITCH_FMT\t\"switch%d\"\n+#define DSA_PORT_FMT\t\"port%d\"\n+\n+/* DSA module debugfs directory */\n+static struct dentry *dsa_debugfs_dir;\n+\n+static int dsa_debugfs_create_port(struct dsa_switch *ds, int port)\n+{\n+\tstruct dentry *dir;\n+\tchar name[32];\n+\n+\tsnprintf(name, sizeof(name), DSA_PORT_FMT, port);\n+\n+\tdir = debugfs_create_dir(name, ds->debugfs_dir);\n+\tif (IS_ERR_OR_NULL(dir))\n+\t\treturn -EFAULT;\n+\n+\treturn 0;\n+}\n+\n+static int dsa_debugfs_create_switch(struct dsa_switch *ds)\n+{\n+\tchar name[32];\n+\tint i, err;\n+\n+\t/* skip if there is no debugfs support */\n+\tif (!dsa_debugfs_dir)\n+\t\treturn 0;\n+\n+\tsnprintf(name, sizeof(name), DSA_SWITCH_FMT, ds->index);\n+\n+\tds->debugfs_dir = debugfs_create_dir(name, dsa_debugfs_dir);\n+\tif (IS_ERR_OR_NULL(ds->debugfs_dir))\n+\t\treturn -EFAULT;\n+\n+\tfor (i = 0; i < ds->num_ports; i++) {\n+\t\tif (ds->enabled_port_mask & BIT(i)) {\n+\t\t\terr = dsa_debugfs_create_port(ds, i);\n+\t\t\tif (err)\n+\t\t\t\treturn err;\n+\t\t}\n+\t}\n+\n+\treturn 0;\n+}\n+\n+static void dsa_debugfs_destroy_switch(struct dsa_switch *ds)\n+{\n+\t/* handles NULL */\n+\tdebugfs_remove_recursive(ds->debugfs_dir);\n+}\n+\n+void dsa_debugfs_create_tree(struct dsa_switch_tree *dst)\n+{\n+\tstruct dsa_switch *ds;\n+\tint i, err;\n+\n+\tfor (i = 0; i < DSA_MAX_SWITCHES; i++) {\n+\t\tds = dst->ds[i];\n+\t\tif (!ds)\n+\t\t\tcontinue;\n+\n+\t\terr = dsa_debugfs_create_switch(ds);\n+\t\tif (err) {\n+\t\t\tpr_warn(\"DSA: failed to create debugfs interface for switch %d (%d)\\n\",\n+\t\t\t\tds->index, err);\n+\t\t\tdsa_debugfs_destroy_tree(dst);\n+\t\t\tbreak;\n+\t\t}\n+\t}\n+}\n+\n+void dsa_debugfs_destroy_tree(struct dsa_switch_tree *dst)\n+{\n+\tstruct dsa_switch *ds;\n+\tint i;\n+\n+\tfor (i = 0; i < DSA_MAX_SWITCHES; i++) {\n+\t\tds = dst->ds[i];\n+\t\tif (!ds)\n+\t\t\tcontinue;\n+\n+\t\tdsa_debugfs_destroy_switch(ds);\n+\t}\n+}\n+\n+void dsa_debugfs_create_module(void)\n+{\n+\tdsa_debugfs_dir = debugfs_create_dir(\"dsa\", NULL);\n+\tif (IS_ERR(dsa_debugfs_dir)) {\n+\t\tpr_warn(\"DSA: failed to create debugfs interface\\n\");\n+\t\tdsa_debugfs_dir = NULL;\n+\t}\n+\n+\tif (dsa_debugfs_dir)\n+\t\tpr_info(\"DSA: debugfs interface created\\n\");\n+}\n+\n+void dsa_debugfs_destroy_module(void)\n+{\n+\t/* handles NULL */\n+\tdebugfs_remove_recursive(dsa_debugfs_dir);\n+}\ndiff --git a/net/dsa/dsa.c b/net/dsa/dsa.c\nindex 03c58b0eb082..b23f1be50c71 100644\n--- a/net/dsa/dsa.c\n+++ b/net/dsa/dsa.c\n@@ -308,12 +308,15 @@ static int __init dsa_init_module(void)\n \n \tdev_add_pack(&dsa_pack_type);\n \n+\tdsa_debugfs_create_module();\n+\n \treturn 0;\n }\n module_init(dsa_init_module);\n \n static void __exit dsa_cleanup_module(void)\n {\n+\tdsa_debugfs_destroy_module();\n \tdsa_slave_unregister_notifier();\n \tdev_remove_pack(&dsa_pack_type);\n \tdsa_legacy_unregister();\ndiff --git a/net/dsa/dsa2.c b/net/dsa/dsa2.c\nindex cceaa4dd9f53..5912618ad63d 100644\n--- a/net/dsa/dsa2.c\n+++ b/net/dsa/dsa2.c\n@@ -447,6 +447,8 @@ static int dsa_dst_apply(struct dsa_switch_tree *dst)\n \tdst->cpu_dp->netdev->dsa_ptr = dst;\n \tdst->applied = true;\n \n+\tdsa_debugfs_create_tree(dst);\n+\n \treturn 0;\n }\n \n@@ -458,6 +460,8 @@ static void dsa_dst_unapply(struct dsa_switch_tree *dst)\n \tif (!dst->applied)\n \t\treturn;\n \n+\tdsa_debugfs_destroy_tree(dst);\n+\n \tdst->cpu_dp->netdev->dsa_ptr = NULL;\n \n \t/* If we used a tagging format that doesn't have an ethertype\ndiff --git a/net/dsa/dsa_priv.h b/net/dsa/dsa_priv.h\nindex 9c3eeb72462d..84ca3a50a58b 100644\n--- a/net/dsa/dsa_priv.h\n+++ b/net/dsa/dsa_priv.h\n@@ -93,6 +93,19 @@ struct dsa_slave_priv {\n \tstruct list_head\tmall_tc_list;\n };\n \n+/* debugfs.c */\n+#ifdef CONFIG_NET_DSA_DEBUGFS\n+void dsa_debugfs_create_module(void);\n+void dsa_debugfs_destroy_module(void);\n+void dsa_debugfs_create_tree(struct dsa_switch_tree *dst);\n+void dsa_debugfs_destroy_tree(struct dsa_switch_tree *dst);\n+#else\n+static inline void dsa_debugfs_create_module(void) { }\n+static inline void dsa_debugfs_destroy_module(void) { }\n+static inline void dsa_debugfs_create_tree(struct dsa_switch_tree *dst) { }\n+static inline void dsa_debugfs_destroy_tree(struct dsa_switch_tree *dst) { }\n+#endif\n+\n /* dsa.c */\n int dsa_cpu_dsa_setup(struct dsa_port *port);\n void dsa_cpu_dsa_destroy(struct dsa_port *dport);\ndiff --git a/net/dsa/legacy.c b/net/dsa/legacy.c\nindex 91e6f7981d39..8aa3de540552 100644\n--- a/net/dsa/legacy.c\n+++ b/net/dsa/legacy.c\n@@ -606,6 +606,8 @@ static int dsa_setup_dst(struct dsa_switch_tree *dst, struct net_device *dev,\n \twmb();\n \tdev->dsa_ptr = dst;\n \n+\tdsa_debugfs_create_tree(dst);\n+\n \treturn 0;\n }\n \n@@ -671,6 +673,8 @@ static void dsa_remove_dst(struct dsa_switch_tree *dst)\n {\n \tint i;\n \n+\tdsa_debugfs_destroy_tree(dst);\n+\n \tdst->cpu_dp->netdev->dsa_ptr = NULL;\n \n \t/* If we used a tagging format that doesn't have an ethertype\n",
    "prefixes": [
        "net-next",
        "v2",
        "01/10"
    ]
}