diff options
| author | James Morris <james.morris@microsoft.com> | 2018-11-12 09:07:41 -0800 | 
|---|---|---|
| committer | James Morris <james.morris@microsoft.com> | 2018-11-12 09:07:41 -0800 | 
| commit | 26b76320a8a550472bbb8f42257df83fcb8d8df6 (patch) | |
| tree | 8a5b569f4f070bf4971e24e7fccfe3004b8fc4ba /net/dsa/dsa.c | |
| parent | f09c296ebf407f98f4ca70892e612b54484bf663 (diff) | |
| parent | ccda4af0f4b92f7b4c308d3acc262f4a7e3affad (diff) | |
Merge tag 'v4.20-rc2' into next-general
Sync to Linux 4.20-rc2 for downstream developers.
Diffstat (limited to 'net/dsa/dsa.c')
| -rw-r--r-- | net/dsa/dsa.c | 51 | 
1 files changed, 49 insertions, 2 deletions
| diff --git a/net/dsa/dsa.c b/net/dsa/dsa.c index e63c554e0623..a69c1790bbfc 100644 --- a/net/dsa/dsa.c +++ b/net/dsa/dsa.c @@ -19,12 +19,10 @@  #include <linux/of_mdio.h>  #include <linux/of_platform.h>  #include <linux/of_net.h> -#include <linux/of_gpio.h>  #include <linux/netdevice.h>  #include <linux/sysfs.h>  #include <linux/phy_fixed.h>  #include <linux/ptp_classify.h> -#include <linux/gpio/consumer.h>  #include <linux/etherdevice.h>  #include "dsa_priv.h" @@ -54,6 +52,9 @@ const struct dsa_device_ops *dsa_device_ops[DSA_TAG_LAST] = {  #ifdef CONFIG_NET_DSA_TAG_EDSA  	[DSA_TAG_PROTO_EDSA] = &edsa_netdev_ops,  #endif +#ifdef CONFIG_NET_DSA_TAG_GSWIP +	[DSA_TAG_PROTO_GSWIP] = &gswip_netdev_ops, +#endif  #ifdef CONFIG_NET_DSA_TAG_KSZ  	[DSA_TAG_PROTO_KSZ] = &ksz_netdev_ops,  #endif @@ -72,6 +73,52 @@ const struct dsa_device_ops *dsa_device_ops[DSA_TAG_LAST] = {  	[DSA_TAG_PROTO_NONE] = &none_ops,  }; +const char *dsa_tag_protocol_to_str(const struct dsa_device_ops *ops) +{ +	const char *protocol_name[DSA_TAG_LAST] = { +#ifdef CONFIG_NET_DSA_TAG_BRCM +		[DSA_TAG_PROTO_BRCM] = "brcm", +#endif +#ifdef CONFIG_NET_DSA_TAG_BRCM_PREPEND +		[DSA_TAG_PROTO_BRCM_PREPEND] = "brcm-prepend", +#endif +#ifdef CONFIG_NET_DSA_TAG_DSA +		[DSA_TAG_PROTO_DSA] = "dsa", +#endif +#ifdef CONFIG_NET_DSA_TAG_EDSA +		[DSA_TAG_PROTO_EDSA] = "edsa", +#endif +#ifdef CONFIG_NET_DSA_TAG_GSWIP +		[DSA_TAG_PROTO_GSWIP] = "gswip", +#endif +#ifdef CONFIG_NET_DSA_TAG_KSZ +		[DSA_TAG_PROTO_KSZ] = "ksz", +#endif +#ifdef CONFIG_NET_DSA_TAG_LAN9303 +		[DSA_TAG_PROTO_LAN9303] = "lan9303", +#endif +#ifdef CONFIG_NET_DSA_TAG_MTK +		[DSA_TAG_PROTO_MTK] = "mtk", +#endif +#ifdef CONFIG_NET_DSA_TAG_QCA +		[DSA_TAG_PROTO_QCA] = "qca", +#endif +#ifdef CONFIG_NET_DSA_TAG_TRAILER +		[DSA_TAG_PROTO_TRAILER] = "trailer", +#endif +		[DSA_TAG_PROTO_NONE] = "none", +	}; +	unsigned int i; + +	BUILD_BUG_ON(ARRAY_SIZE(protocol_name) != DSA_TAG_LAST); + +	for (i = 0; i < ARRAY_SIZE(dsa_device_ops); i++) +		if (ops == dsa_device_ops[i]) +			return protocol_name[i]; + +	return protocol_name[DSA_TAG_PROTO_NONE]; +}; +  const struct dsa_device_ops *dsa_resolve_tag_protocol(int tag_protocol)  {  	const struct dsa_device_ops *ops; | 
