From: Andrew Lunn <andrew@lunn.ch>
To: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
kernel@savoirfairelinux.com,
"David S. Miller" <davem@davemloft.net>,
Florian Fainelli <f.fainelli@gmail.com>,
Egil Hjelmeland <privat@egil-hjelmeland.no>,
John Crispin <john@phrozen.org>,
Woojung Huh <Woojung.Huh@microchip.com>,
Sean Wang <sean.wang@mediatek.com>,
Volodymyr Bendiuga <volodymyr.bendiuga@gmail.com>,
Nikita Yushchenko <nikita.yoush@cogentembedded.com>,
Maxime Hadjinlian <maxime@devialet.com>,
Chris Healy <cphealy@gmail.com>, Maxim Uvarov <muvarov@gmail.com>,
Stefan Eichenberger <eichest@gmail.com>,
Jason Cobham <jcobham@questertangent.com>,
Juergen Borleis <jbe@pengutronix.de>,
Tobias Waldekranz <tobias@waldekranz.com>
Subject: Re: [PATCH net-next 04/11] net: dsa: debugfs: add tag_protocol
Date: Tue, 15 Aug 2017 00:42:27 +0200 [thread overview]
Message-ID: <20170814224227.GA16885@lunn.ch> (raw)
In-Reply-To: <20170814222242.10643-5-vivien.didelot@savoirfairelinux.com>
On Mon, Aug 14, 2017 at 06:22:35PM -0400, Vivien Didelot wrote:
> Add a debug filesystem "tag_protocol" entry to query the switch tagging
> protocol through the .get_tag_protocol operation.
>
> # cat switch1/tag_protocol
> EDSA
>
> Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
> ---
> net/dsa/debugfs.c | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 54 insertions(+)
>
> diff --git a/net/dsa/debugfs.c b/net/dsa/debugfs.c
> index 5607efdb924d..30a732e86161 100644
> --- a/net/dsa/debugfs.c
> +++ b/net/dsa/debugfs.c
> @@ -109,6 +109,55 @@ static int dsa_debugfs_create_file(struct dsa_switch *ds, struct dentry *dir,
> return 0;
> }
>
> +static int dsa_debugfs_tag_protocol_read(struct dsa_switch *ds, int id,
> + struct seq_file *seq)
> +{
> + enum dsa_tag_protocol proto;
> +
> + if (!ds->ops->get_tag_protocol)
> + return -EOPNOTSUPP;
> +
> + proto = ds->ops->get_tag_protocol(ds);
> +
> + switch (proto) {
> + case DSA_TAG_PROTO_NONE:
> + seq_puts(seq, "NONE\n");
> + break;
> + case DSA_TAG_PROTO_BRCM:
> + seq_puts(seq, "BRCM\n");
> + break;
> + case DSA_TAG_PROTO_DSA:
> + seq_puts(seq, "DSA\n");
> + break;
> + case DSA_TAG_PROTO_EDSA:
> + seq_puts(seq, "EDSA\n");
> + break;
> + case DSA_TAG_PROTO_KSZ:
> + seq_puts(seq, "KSZ\n");
> + break;
> + case DSA_TAG_PROTO_LAN9303:
> + seq_puts(seq, "LAN9303\n");
> + break;
> + case DSA_TAG_PROTO_MTK:
> + seq_puts(seq, "MTK\n");
> + break;
> + case DSA_TAG_PROTO_QCA:
> + seq_puts(seq, "QCA\n");
> + break;
> + case DSA_TAG_PROTO_TRAILER:
> + seq_puts(seq, "TRAILER\n");
> + break;
> + default:
> + return -EINVAL;
> + }
Hi Vivien
Minor nitpick. Rather than -EINVAL, how about seq_puts(seq, "Unknown - Please fix %s\n", __func__);
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Andrew
next prev parent reply other threads:[~2017-08-14 22:42 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-14 22:22 [PATCH net-next 00/11] net: dsa: add generic debugfs interface Vivien Didelot
2017-08-14 22:22 ` [PATCH net-next 01/11] net: dsa: legacy: assign dst->applied Vivien Didelot
2017-08-14 22:58 ` Andrew Lunn
2017-08-14 22:22 ` [PATCH net-next 02/11] net: dsa: add debugfs interface Vivien Didelot
2017-08-15 17:29 ` Florian Fainelli
2017-08-14 22:22 ` [PATCH net-next 03/11] net: dsa: debugfs: add tree Vivien Didelot
2017-08-14 22:52 ` Andrew Lunn
2017-08-21 22:06 ` Florian Fainelli
2017-08-14 22:22 ` [PATCH net-next 04/11] net: dsa: debugfs: add tag_protocol Vivien Didelot
2017-08-14 22:42 ` Andrew Lunn [this message]
2017-08-15 17:31 ` Florian Fainelli
2017-08-14 22:22 ` [PATCH net-next 05/11] net: dsa: debugfs: add port stats Vivien Didelot
2017-08-14 22:45 ` Andrew Lunn
2017-08-15 17:34 ` Florian Fainelli
2017-08-14 22:22 ` [PATCH net-next 06/11] net: dsa: debugfs: add port registers Vivien Didelot
2017-08-14 22:46 ` Andrew Lunn
2017-08-15 16:28 ` Woojung.Huh
2017-08-15 17:34 ` Florian Fainelli
2017-08-14 22:22 ` [PATCH net-next 07/11] net: dsa: debugfs: add port fdb Vivien Didelot
2017-08-14 22:47 ` Andrew Lunn
2017-08-15 17:35 ` Florian Fainelli
2017-08-14 22:22 ` [PATCH net-next 08/11] net: dsa: restore mdb dump Vivien Didelot
2017-08-14 22:48 ` Andrew Lunn
2017-08-15 17:38 ` Florian Fainelli
2017-08-14 22:22 ` [PATCH net-next 09/11] net: dsa: debugfs: add port mdb Vivien Didelot
2017-08-14 22:50 ` Andrew Lunn
2017-08-15 17:38 ` Florian Fainelli
2017-08-14 22:22 ` [PATCH net-next 10/11] net: dsa: restore VLAN dump Vivien Didelot
2017-08-14 22:51 ` Andrew Lunn
2017-08-15 17:39 ` Florian Fainelli
2017-08-14 22:22 ` [PATCH net-next 11/11] net: dsa: debugfs: add port vlan Vivien Didelot
2017-08-14 22:52 ` Andrew Lunn
2017-08-15 17:41 ` Florian Fainelli
2017-08-18 21:54 ` [PATCH net-next 00/11] net: dsa: add generic debugfs interface Florian Fainelli
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170814224227.GA16885@lunn.ch \
--to=andrew@lunn.ch \
--cc=Woojung.Huh@microchip.com \
--cc=cphealy@gmail.com \
--cc=davem@davemloft.net \
--cc=eichest@gmail.com \
--cc=f.fainelli@gmail.com \
--cc=jbe@pengutronix.de \
--cc=jcobham@questertangent.com \
--cc=john@phrozen.org \
--cc=kernel@savoirfairelinux.com \
--cc=linux-kernel@vger.kernel.org \
--cc=maxime@devialet.com \
--cc=muvarov@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=nikita.yoush@cogentembedded.com \
--cc=privat@egil-hjelmeland.no \
--cc=sean.wang@mediatek.com \
--cc=tobias@waldekranz.com \
--cc=vivien.didelot@savoirfairelinux.com \
--cc=volodymyr.bendiuga@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox