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]
Message-Id: <20190418023120.17067-14-andrew@lunn.ch>
Date:   Thu, 18 Apr 2019 04:31:18 +0200
From:   Andrew Lunn <andrew@...n.ch>
To:     David Miller <davem@...emloft.net>
Cc:     netdev <netdev@...r.kernel.org>,
        Florian Fainelli <f.fainelli@...il.com>,
        Vivien Didelot <vivien.didelot@...il.com>,
        Andrew Lunn <andrew@...n.ch>
Subject: [PATCH net-next 13/15] dsa: Cleanup unneeded table and make tag structures static

Now that tag drivers dynamically register, we don't need the static
table. Remove it. This also means the tag driver structures can be
made static.

Signed-off-by: Andrew Lunn <andrew@...n.ch>
---
 include/net/dsa.h     |  1 -
 net/dsa/dsa.c         | 35 -----------------------------------
 net/dsa/dsa_priv.h    | 29 -----------------------------
 net/dsa/tag_brcm.c    |  4 ++--
 net/dsa/tag_dsa.c     |  2 +-
 net/dsa/tag_edsa.c    |  2 +-
 net/dsa/tag_gswip.c   |  2 +-
 net/dsa/tag_ksz.c     |  4 ++--
 net/dsa/tag_lan9303.c |  2 +-
 net/dsa/tag_mtk.c     |  2 +-
 net/dsa/tag_qca.c     |  2 +-
 net/dsa/tag_trailer.c |  2 +-
 12 files changed, 11 insertions(+), 76 deletions(-)

diff --git a/include/net/dsa.h b/include/net/dsa.h
index 46774e812f1b..547507db2d02 100644
--- a/include/net/dsa.h
+++ b/include/net/dsa.h
@@ -56,7 +56,6 @@ enum dsa_tag_protocol {
 	DSA_TAG_PROTO_MTK		= DSA_TAG_PROTO_MTK_VALUE,
 	DSA_TAG_PROTO_QCA		= DSA_TAG_PROTO_QCA_VALUE,
 	DSA_TAG_PROTO_TRAILER		= DSA_TAG_PROTO_TRAILER_VALUE,
-	DSA_TAG_LAST,			/* MUST BE LAST */
 };
 
 struct packet_type;
diff --git a/net/dsa/dsa.c b/net/dsa/dsa.c
index 17d26cc7a128..b3f0b32a4cd6 100644
--- a/net/dsa/dsa.c
+++ b/net/dsa/dsa.c
@@ -44,41 +44,6 @@ static struct dsa_device_ops none_ops = {
 	.rcv	= NULL,
 };
 
-const struct dsa_device_ops *dsa_device_ops[DSA_TAG_LAST] = {
-#ifdef CONFIG_NET_DSA_TAG_BRCM
-	[DSA_TAG_PROTO_BRCM] = &brcm_netdev_ops,
-#endif
-#ifdef CONFIG_NET_DSA_TAG_BRCM_PREPEND
-	[DSA_TAG_PROTO_BRCM_PREPEND] = &brcm_prepend_netdev_ops,
-#endif
-#ifdef CONFIG_NET_DSA_TAG_DSA
-	[DSA_TAG_PROTO_DSA] = &dsa_netdev_ops,
-#endif
-#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_KSZ9477
-	[DSA_TAG_PROTO_KSZ9477] = &ksz9477_netdev_ops,
-	[DSA_TAG_PROTO_KSZ9893] = &ksz9893_netdev_ops,
-#endif
-#ifdef CONFIG_NET_DSA_TAG_LAN9303
-	[DSA_TAG_PROTO_LAN9303] = &lan9303_netdev_ops,
-#endif
-#ifdef CONFIG_NET_DSA_TAG_MTK
-	[DSA_TAG_PROTO_MTK] = &mtk_netdev_ops,
-#endif
-#ifdef CONFIG_NET_DSA_TAG_QCA
-	[DSA_TAG_PROTO_QCA] = &qca_netdev_ops,
-#endif
-#ifdef CONFIG_NET_DSA_TAG_TRAILER
-	[DSA_TAG_PROTO_TRAILER] = &trailer_netdev_ops,
-#endif
-	[DSA_TAG_PROTO_NONE] = &none_ops,
-};
-
 static int dsa_tag_driver_register(struct dsa_device_ops *ops,
 				   struct module *owner)
 {
diff --git a/net/dsa/dsa_priv.h b/net/dsa/dsa_priv.h
index ec002a7c8a58..7467d062f0c7 100644
--- a/net/dsa/dsa_priv.h
+++ b/net/dsa/dsa_priv.h
@@ -203,33 +203,4 @@ dsa_slave_to_master(const struct net_device *dev)
 int dsa_switch_register_notifier(struct dsa_switch *ds);
 void dsa_switch_unregister_notifier(struct dsa_switch *ds);
 
-/* tag_brcm.c */
-extern struct dsa_device_ops brcm_netdev_ops;
-extern struct dsa_device_ops brcm_prepend_netdev_ops;
-
-/* tag_dsa.c */
-extern struct dsa_device_ops dsa_netdev_ops;
-
-/* tag_edsa.c */
-extern struct dsa_device_ops edsa_netdev_ops;
-
-/* tag_gswip.c */
-extern struct dsa_device_ops gswip_netdev_ops;
-
-/* tag_ksz.c */
-extern struct dsa_device_ops ksz9477_netdev_ops;
-extern struct dsa_device_ops ksz9893_netdev_ops;
-
-/* tag_lan9303.c */
-extern struct dsa_device_ops lan9303_netdev_ops;
-
-/* tag_mtk.c */
-extern struct dsa_device_ops mtk_netdev_ops;
-
-/* tag_qca.c */
-extern struct dsa_device_ops qca_netdev_ops;
-
-/* tag_trailer.c */
-extern struct dsa_device_ops trailer_netdev_ops;
-
 #endif
diff --git a/net/dsa/tag_brcm.c b/net/dsa/tag_brcm.c
index bff9b03a7752..684730d52b4c 100644
--- a/net/dsa/tag_brcm.c
+++ b/net/dsa/tag_brcm.c
@@ -167,7 +167,7 @@ static struct sk_buff *brcm_tag_rcv(struct sk_buff *skb, struct net_device *dev,
 	return nskb;
 }
 
-struct dsa_device_ops brcm_netdev_ops = {
+static struct dsa_device_ops brcm_netdev_ops = {
 	.name	= "brcm",
 	.proto	= DSA_TAG_PROTO_BRCM,
 	.xmit	= brcm_tag_xmit,
@@ -194,7 +194,7 @@ static struct sk_buff *brcm_tag_rcv_prepend(struct sk_buff *skb,
 	return brcm_tag_rcv_ll(skb, dev, pt, ETH_HLEN);
 }
 
-struct dsa_device_ops brcm_prepend_netdev_ops = {
+static struct dsa_device_ops brcm_prepend_netdev_ops = {
 	.name	= "brcm-prepend",
 	.proto	= DSA_TAG_PROTO_BRCM_PREPEND,
 	.xmit	= brcm_tag_xmit_prepend,
diff --git a/net/dsa/tag_dsa.c b/net/dsa/tag_dsa.c
index 44e023e3da84..1dcc4bb7d295 100644
--- a/net/dsa/tag_dsa.c
+++ b/net/dsa/tag_dsa.c
@@ -150,7 +150,7 @@ static int dsa_tag_flow_dissect(const struct sk_buff *skb, __be16 *proto,
 	return 0;
 }
 
-struct dsa_device_ops dsa_netdev_ops = {
+static struct dsa_device_ops dsa_netdev_ops = {
 	.name	= "dsa",
 	.proto	= DSA_TAG_PROTO_DSA,
 	.xmit	= dsa_xmit,
diff --git a/net/dsa/tag_edsa.c b/net/dsa/tag_edsa.c
index e51e5db45d43..59f0a7a57743 100644
--- a/net/dsa/tag_edsa.c
+++ b/net/dsa/tag_edsa.c
@@ -169,7 +169,7 @@ static int edsa_tag_flow_dissect(const struct sk_buff *skb, __be16 *proto,
 	return 0;
 }
 
-struct dsa_device_ops edsa_netdev_ops = {
+static struct dsa_device_ops edsa_netdev_ops = {
 	.name	= "edsa",
 	.proto	= DSA_TAG_PROTO_EDSA,
 	.xmit	= edsa_xmit,
diff --git a/net/dsa/tag_gswip.c b/net/dsa/tag_gswip.c
index 38d7617d8a03..a681d0878c0e 100644
--- a/net/dsa/tag_gswip.c
+++ b/net/dsa/tag_gswip.c
@@ -103,7 +103,7 @@ static struct sk_buff *gswip_tag_rcv(struct sk_buff *skb,
 	return skb;
 }
 
-struct dsa_device_ops gswip_netdev_ops = {
+static struct dsa_device_ops gswip_netdev_ops = {
 	.name = "gwsip",
 	.proto	= DSA_TAG_PROTO_GSWIP,
 	.xmit = gswip_tag_xmit,
diff --git a/net/dsa/tag_ksz.c b/net/dsa/tag_ksz.c
index 3e4ea4ac10d6..059a015bcaae 100644
--- a/net/dsa/tag_ksz.c
+++ b/net/dsa/tag_ksz.c
@@ -133,7 +133,7 @@ static struct sk_buff *ksz9477_rcv(struct sk_buff *skb, struct net_device *dev,
 	return ksz_common_rcv(skb, dev, port, len);
 }
 
-struct dsa_device_ops ksz9477_netdev_ops = {
+static struct dsa_device_ops ksz9477_netdev_ops = {
 	.name	= "ksz9477",
 	.proto	= DSA_TAG_PROTO_KSZ9477,
 	.xmit	= ksz9477_xmit,
@@ -170,7 +170,7 @@ static struct sk_buff *ksz9893_xmit(struct sk_buff *skb,
 	return nskb;
 }
 
-struct dsa_device_ops ksz9893_netdev_ops = {
+static struct dsa_device_ops ksz9893_netdev_ops = {
 	.name	= "ksz9893",
 	.proto	= DSA_TAG_PROTO_KSZ9893,
 	.xmit	= ksz9893_xmit,
diff --git a/net/dsa/tag_lan9303.c b/net/dsa/tag_lan9303.c
index 4135080559cf..ee39e73fe9f9 100644
--- a/net/dsa/tag_lan9303.c
+++ b/net/dsa/tag_lan9303.c
@@ -128,7 +128,7 @@ static struct sk_buff *lan9303_rcv(struct sk_buff *skb, struct net_device *dev,
 	return skb;
 }
 
-struct dsa_device_ops lan9303_netdev_ops = {
+static struct dsa_device_ops lan9303_netdev_ops = {
 	.name = "lan9303",
 	.proto	= DSA_TAG_PROTO_LAN9303,
 	.xmit = lan9303_xmit,
diff --git a/net/dsa/tag_mtk.c b/net/dsa/tag_mtk.c
index bcca5e1a3732..4dfbb79435cc 100644
--- a/net/dsa/tag_mtk.c
+++ b/net/dsa/tag_mtk.c
@@ -98,7 +98,7 @@ static int mtk_tag_flow_dissect(const struct sk_buff *skb, __be16 *proto,
 	return 0;
 }
 
-struct dsa_device_ops mtk_netdev_ops = {
+static struct dsa_device_ops mtk_netdev_ops = {
 	.name		= "mtk",
 	.proto		= DSA_TAG_PROTO_MTK,
 	.xmit		= mtk_tag_xmit,
diff --git a/net/dsa/tag_qca.c b/net/dsa/tag_qca.c
index fce437c51fcd..f8ab977a42a8 100644
--- a/net/dsa/tag_qca.c
+++ b/net/dsa/tag_qca.c
@@ -99,7 +99,7 @@ static int qca_tag_flow_dissect(const struct sk_buff *skb, __be16 *proto,
 	return 0;
 }
 
-struct dsa_device_ops qca_netdev_ops = {
+static struct dsa_device_ops qca_netdev_ops = {
 	.name	= "qca",
 	.proto	= DSA_TAG_PROTO_QCA,
 	.xmit	= qca_tag_xmit,
diff --git a/net/dsa/tag_trailer.c b/net/dsa/tag_trailer.c
index d8955ec1a38f..8d6446d4ee41 100644
--- a/net/dsa/tag_trailer.c
+++ b/net/dsa/tag_trailer.c
@@ -77,7 +77,7 @@ static struct sk_buff *trailer_rcv(struct sk_buff *skb, struct net_device *dev,
 	return skb;
 }
 
-struct dsa_device_ops trailer_netdev_ops = {
+static struct dsa_device_ops trailer_netdev_ops = {
 	.name	= "trailer",
 	.proto	= DSA_TAG_PROTO_TRAILER,
 	.xmit	= trailer_xmit,
-- 
2.20.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ