lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 15 Aug 2017 00:42:27 +0200
From:   Andrew Lunn <andrew@...n.ch>
To:     Vivien Didelot <vivien.didelot@...oirfairelinux.com>
Cc:     netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
        kernel@...oirfairelinux.com,
        "David S. Miller" <davem@...emloft.net>,
        Florian Fainelli <f.fainelli@...il.com>,
        Egil Hjelmeland <privat@...l-hjelmeland.no>,
        John Crispin <john@...ozen.org>,
        Woojung Huh <Woojung.Huh@...rochip.com>,
        Sean Wang <sean.wang@...iatek.com>,
        Volodymyr Bendiuga <volodymyr.bendiuga@...il.com>,
        Nikita Yushchenko <nikita.yoush@...entembedded.com>,
        Maxime Hadjinlian <maxime@...ialet.com>,
        Chris Healy <cphealy@...il.com>,
        Maxim Uvarov <muvarov@...il.com>,
        Stefan Eichenberger <eichest@...il.com>,
        Jason Cobham <jcobham@...stertangent.com>,
        Juergen Borleis <jbe@...gutronix.de>,
        Tobias Waldekranz <tobias@...dekranz.com>
Subject: Re: [PATCH net-next 04/11] net: dsa: debugfs: add tag_protocol

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@...oirfairelinux.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@...n.ch>

    Andrew

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ