Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/806738/?format=api
{ "id": 806738, "url": "http://patchwork.ozlabs.org/api/patches/806738/?format=api", "web_url": "http://patchwork.ozlabs.org/project/netdev/patch/20170828191748.19492-6-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-6-vivien.didelot@savoirfairelinux.com>", "list_archive_url": null, "date": "2017-08-28T19:17:43", "name": "[net-next,v2,05/10] net: dsa: debugfs: add port regs", "commit_ref": null, "pull_url": null, "state": "changes-requested", "archived": true, "hash": "9ecd17501610c1cf9e316ce6bf3d46d871bd001d", "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-6-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/806738/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/806738/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 3xh1zQ3FMWz9sN7\n\tfor <patchwork-incoming@ozlabs.org>;\n\tTue, 29 Aug 2017 05:29:06 +1000 (AEST)", "(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1751484AbdH1TVp (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tMon, 28 Aug 2017 15:21:45 -0400", "from mail.savoirfairelinux.com ([208.88.110.44]:36360 \"EHLO\n\tmail.savoirfairelinux.com\" rhost-flags-OK-OK-OK-OK) by\n\tvger.kernel.org with ESMTP id S1751215AbdH1TVk (ORCPT\n\t<rfc822;netdev@vger.kernel.org>); Mon, 28 Aug 2017 15:21:40 -0400", "from localhost (localhost [127.0.0.1])\n\tby mail.savoirfairelinux.com (Postfix) with ESMTP id 763739C1E85;\n\tMon, 28 Aug 2017 15:21:39 -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 m-g4Nzz53wCj; Mon, 28 Aug 2017 15:21:38 -0400 (EDT)", "from localhost (localhost [127.0.0.1])\n\tby mail.savoirfairelinux.com (Postfix) with ESMTP id 02B499C1B9D;\n\tMon, 28 Aug 2017 15:21:38 -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 1qmzmZJUfaZC; 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 9A0C99C21E4;\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 05/10] net: dsa: debugfs: add port regs", "Date": "Mon, 28 Aug 2017 15:17:43 -0400", "Message-Id": "<20170828191748.19492-6-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": "Add a debug filesystem \"regs\" entry to query a port's hardware registers\nthrough the .get_regs_len and .get_regs_len switch operations.\n\nThis is very convenient because it allows one to dump the registers of\nDSA links, which are not exposed to userspace.\n\nHere are the registers of a zii-rev-b CPU and DSA ports:\n\n # pr -mt switch0/port{5,6}/regs\n 0: 4e07\t\t\t 0: 4d04\n 1: 403e\t\t\t 1: 003d\n 2: 0000\t\t\t 2: 0000\n 3: 3521\t\t\t 3: 3521\n 4: 0533\t\t\t 4: 373f\n 5: 8000\t\t\t 5: 0000\n 6: 005f\t\t\t 6: 003f\n 7: 002a\t\t\t 7: 002a\n 8: 2080\t\t\t 8: 2080\n 9: 0001\t\t\t 9: 0001\n 10: 0000\t\t\t 10: 0000\n 11: 0020\t\t\t 11: 0000\n 12: 0000\t\t\t 12: 0000\n 13: 0000\t\t\t 13: 0000\n 14: 0000\t\t\t 14: 0000\n 15: 9100\t\t\t 15: dada\n 16: 0000\t\t\t 16: 0000\n 17: 0000\t\t\t 17: 0000\n 18: 0000\t\t\t 18: 0000\n 19: 0000\t\t\t 19: 00d8\n 20: 0000\t\t\t 20: 0000\n 21: 0000\t\t\t 21: 0000\n 22: 0022\t\t\t 22: 0000\n 23: 0000\t\t\t 23: 0000\n 24: 3210\t\t\t 24: 3210\n 25: 7654\t\t\t 25: 7654\n 26: 0000\t\t\t 26: 0000\n 27: 8000\t\t\t 27: 8000\n 28: 0000\t\t\t 28: 0000\n 29: 0000\t\t\t 29: 0000\n 30: 0000\t\t\t 30: 0000\n 31: 0000\t\t\t 31: 0000\n\nSigned-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>\nReviewed-by: Florian Fainelli <f.fainelli@gmail.com>\nReviewed-by: Andrew Lunn <andrew@lunn.ch>\n---\n net/dsa/debugfs.c | 39 +++++++++++++++++++++++++++++++++++++++\n 1 file changed, 39 insertions(+)", "diff": "diff --git a/net/dsa/debugfs.c b/net/dsa/debugfs.c\nindex 997bbc8eb502..7b299c9d9892 100644\n--- a/net/dsa/debugfs.c\n+++ b/net/dsa/debugfs.c\n@@ -109,6 +109,40 @@ static int dsa_debugfs_create_file(struct dsa_switch *ds, struct dentry *dir,\n \treturn 0;\n }\n \n+static void dsa_debugfs_regs_read_count(struct dsa_switch *ds, int id,\n+\t\t\t\t\tstruct seq_file *seq, int count)\n+{\n+\tu16 data[count * ETH_GSTRING_LEN];\n+\tstruct ethtool_regs regs;\n+\tint i;\n+\n+\tds->ops->get_regs(ds, id, ®s, data);\n+\n+\tfor (i = 0; i < count / 2; i++)\n+\t\tseq_printf(seq, \"%2d: %04x\\n\", i, data[i]);\n+}\n+\n+static int dsa_debugfs_regs_read(struct dsa_switch *ds, int id,\n+\t\t\t\t struct seq_file *seq)\n+{\n+\tint count;\n+\n+\tif (!ds->ops->get_regs_len || !ds->ops->get_regs)\n+\t\treturn -EOPNOTSUPP;\n+\n+\tcount = ds->ops->get_regs_len(ds, id);\n+\tif (count < 0)\n+\t\treturn count;\n+\n+\tdsa_debugfs_regs_read_count(ds, id, seq, count);\n+\n+\treturn 0;\n+}\n+\n+static const struct dsa_debugfs_ops dsa_debugfs_regs_ops = {\n+\t.read = dsa_debugfs_regs_read,\n+};\n+\n static void dsa_debugfs_stats_read_count(struct dsa_switch *ds, int id,\n \t\t\t\t\t struct seq_file *seq, int count)\n {\n@@ -188,6 +222,11 @@ static int dsa_debugfs_create_port(struct dsa_switch *ds, int port)\n \tif (IS_ERR_OR_NULL(dir))\n \t\treturn -EFAULT;\n \n+\terr = dsa_debugfs_create_file(ds, dir, \"regs\", port,\n+\t\t\t\t &dsa_debugfs_regs_ops);\n+\tif (err)\n+\t\treturn err;\n+\n \terr = dsa_debugfs_create_file(ds, dir, \"stats\", port,\n \t\t\t\t &dsa_debugfs_stats_ops);\n \tif (err)\n", "prefixes": [ "net-next", "v2", "05/10" ] }