aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Crispin <john@phrozen.org>2016-08-12 14:51:59 +0200
committerJohn Crispin <john@phrozen.org>2016-08-15 15:18:35 +0200
commit675407baa44a8700de20b6b2857009a552a807ba (patch)
tree22e664fb64f38dc3346217a20b2fa933d2e31df7
parent63f6fc5c16996cc47369bb0d6ef28ccd39845e7b (diff)
downloadupstream-675407baa44a8700de20b6b2857009a552a807ba.tar.gz
upstream-675407baa44a8700de20b6b2857009a552a807ba.tar.bz2
upstream-675407baa44a8700de20b6b2857009a552a807ba.zip
kernel/swconfig: remove obsolete portmapping feature from swconfig
Signed-off-by: John Crispin <john@phrozen.org>
-rw-r--r--target/linux/generic/files/drivers/net/phy/swconfig.c76
-rw-r--r--target/linux/generic/files/include/linux/switch.h7
-rw-r--r--target/linux/generic/files/include/uapi/linux/switch.h9
-rw-r--r--target/linux/ramips/dts/FONERA20N.dts30
-rw-r--r--target/linux/ramips/patches-4.4/0512-net-mediatek-add-swconfig-driver-for-esw_rt3050.patch3
5 files changed, 1 insertions, 124 deletions
diff --git a/target/linux/generic/files/drivers/net/phy/swconfig.c b/target/linux/generic/files/drivers/net/phy/swconfig.c
index c70ca74cad..8dfcb1aa3b 100644
--- a/target/linux/generic/files/drivers/net/phy/swconfig.c
+++ b/target/linux/generic/files/drivers/net/phy/swconfig.c
@@ -915,9 +915,7 @@ static int
swconfig_send_switch(struct sk_buff *msg, u32 pid, u32 seq, int flags,
const struct switch_dev *dev)
{
- struct nlattr *p = NULL, *m = NULL;
void *hdr;
- int i;
hdr = genlmsg_put(msg, pid, seq, &switch_fam, flags,
SWITCH_CMD_NEW_ATTR);
@@ -939,24 +937,6 @@ swconfig_send_switch(struct sk_buff *msg, u32 pid, u32 seq, int flags,
if (nla_put_u32(msg, SWITCH_ATTR_CPU_PORT, dev->cpu_port))
goto nla_put_failure;
- m = nla_nest_start(msg, SWITCH_ATTR_PORTMAP);
- if (!m)
- goto nla_put_failure;
- for (i = 0; i < dev->ports; i++) {
- p = nla_nest_start(msg, SWITCH_ATTR_PORTS);
- if (!p)
- continue;
- if (dev->portmap[i].s) {
- if (nla_put_string(msg, SWITCH_PORTMAP_SEGMENT,
- dev->portmap[i].s))
- goto nla_put_failure;
- if (nla_put_u32(msg, SWITCH_PORTMAP_VIRT,
- dev->portmap[i].virt))
- goto nla_put_failure;
- }
- nla_nest_end(msg, p);
- }
- nla_nest_end(msg, m);
genlmsg_end(msg, hdr);
return msg->len;
nla_put_failure:
@@ -1049,51 +1029,6 @@ static struct genl_ops swconfig_ops[] = {
}
};
-#ifdef CONFIG_OF
-void
-of_switch_load_portmap(struct switch_dev *dev)
-{
- struct device_node *port;
-
- if (!dev->of_node)
- return;
-
- for_each_child_of_node(dev->of_node, port) {
- const __be32 *prop;
- const char *segment;
- int size, phys;
-
- if (!of_device_is_compatible(port, "swconfig,port"))
- continue;
-
- if (of_property_read_string(port, "swconfig,segment", &segment))
- continue;
-
- prop = of_get_property(port, "swconfig,portmap", &size);
- if (!prop)
- continue;
-
- if (size != (2 * sizeof(*prop))) {
- pr_err("%s: failed to parse port mapping\n",
- port->name);
- continue;
- }
-
- phys = be32_to_cpup(prop++);
- if ((phys < 0) | (phys >= dev->ports)) {
- pr_err("%s: physical port index out of range\n",
- port->name);
- continue;
- }
-
- dev->portmap[phys].s = kstrdup(segment, GFP_KERNEL);
- dev->portmap[phys].virt = be32_to_cpup(prop);
- pr_debug("Found port: %s, physical: %d, virtual: %d\n",
- segment, phys, dev->portmap[phys].virt);
- }
-}
-#endif
-
int
register_switch(struct switch_dev *dev, struct net_device *netdev)
{
@@ -1116,12 +1051,6 @@ register_switch(struct switch_dev *dev, struct net_device *netdev)
dev->ports, GFP_KERNEL);
if (!dev->portbuf)
return -ENOMEM;
- dev->portmap = kzalloc(sizeof(struct switch_portmap) *
- dev->ports, GFP_KERNEL);
- if (!dev->portmap) {
- kfree(dev->portbuf);
- return -ENOMEM;
- }
}
swconfig_defaults_init(dev);
mutex_init(&dev->sw_mutex);
@@ -1143,11 +1072,6 @@ register_switch(struct switch_dev *dev, struct net_device *netdev)
return -ENFILE;
}
-#ifdef CONFIG_OF
- if (dev->ports)
- of_switch_load_portmap(dev);
-#endif
-
/* fill device name */
snprintf(dev->devname, IFNAMSIZ, SWCONFIG_DEVNAME, i);
diff --git a/target/linux/generic/files/include/linux/switch.h b/target/linux/generic/files/include/linux/switch.h
index dda4820a7a..a381fd006c 100644
--- a/target/linux/generic/files/include/linux/switch.h
+++ b/target/linux/generic/files/include/linux/switch.h
@@ -105,7 +105,6 @@ struct switch_dev_ops {
};
struct switch_dev {
- struct device_node *of_node;
const struct switch_dev_ops *ops;
/* will be automatically filled */
char devname[IFNAMSIZ];
@@ -126,7 +125,6 @@ struct switch_dev {
struct mutex sw_mutex;
struct switch_port *portbuf;
- struct switch_portmap *portmap;
struct switch_port_link linkbuf;
char buf[128];
@@ -141,11 +139,6 @@ struct switch_port {
u32 flags;
};
-struct switch_portmap {
- u32 virt;
- const char *s;
-};
-
struct switch_val {
const struct switch_attr *attr;
int port_vlan;
diff --git a/target/linux/generic/files/include/uapi/linux/switch.h b/target/linux/generic/files/include/uapi/linux/switch.h
index ea449653fa..2a67da2e9d 100644
--- a/target/linux/generic/files/include/uapi/linux/switch.h
+++ b/target/linux/generic/files/include/uapi/linux/switch.h
@@ -39,7 +39,6 @@ enum {
SWITCH_ATTR_NAME,
SWITCH_ATTR_VLANS,
SWITCH_ATTR_PORTS,
- SWITCH_ATTR_PORTMAP,
SWITCH_ATTR_CPU_PORT,
/* attributes */
SWITCH_ATTR_OP_ID,
@@ -57,14 +56,6 @@ enum {
SWITCH_ATTR_MAX
};
-enum {
- /* port map */
- SWITCH_PORTMAP_PORTS,
- SWITCH_PORTMAP_SEGMENT,
- SWITCH_PORTMAP_VIRT,
- SWITCH_PORTMAP_MAX
-};
-
/* commands */
enum {
SWITCH_CMD_UNSPEC,
diff --git a/target/linux/ramips/dts/FONERA20N.dts b/target/linux/ramips/dts/FONERA20N.dts
index b7eb91ea7b..004a2c0889 100644
--- a/target/linux/ramips/dts/FONERA20N.dts
+++ b/target/linux/ramips/dts/FONERA20N.dts
@@ -93,36 +93,6 @@
&esw {
mediatek,portmap = <0x2f>;
-
- port@0 {
- compatible = "swconfig,port";
- swconfig,segment = "lan";
- swconfig,portmap = <0 4>;
- };
-
- port@1 {
- compatible = "swconfig,port";
- swconfig,segment = "lan";
- swconfig,portmap = <1 3>;
- };
-
- port@2 {
- compatible = "swconfig,port";
- swconfig,segment = "lan";
- swconfig,portmap = <2 2>;
- };
-
- port@3 {
- compatible = "swconfig,port";
- swconfig,segment = "lan";
- swconfig,portmap = <3 1>;
- };
-
- port@4 {
- compatible = "swconfig,port";
- swconfig,segment = "wan";
- swconfig,portmap = <4 0>;
- };
};
&wmac {
diff --git a/target/linux/ramips/patches-4.4/0512-net-mediatek-add-swconfig-driver-for-esw_rt3050.patch b/target/linux/ramips/patches-4.4/0512-net-mediatek-add-swconfig-driver-for-esw_rt3050.patch
index 5d0072fe1e..b647d889f9 100644
--- a/target/linux/ramips/patches-4.4/0512-net-mediatek-add-swconfig-driver-for-esw_rt3050.patch
+++ b/target/linux/ramips/patches-4.4/0512-net-mediatek-add-swconfig-driver-for-esw_rt3050.patch
@@ -865,12 +865,11 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
struct rt305x_esw *esw;
struct resource *irq;
int ret;
-@@ -568,6 +1353,21 @@ static int esw_probe(struct platform_dev
+@@ -568,6 +1353,20 @@ static int esw_probe(struct platform_dev
if (reg_init)
esw->reg_led_polarity = be32_to_cpu(*reg_init);
+ swdev = &esw->swdev;
-+ swdev->of_node = pdev->dev.of_node;
+ swdev->name = "rt305x-esw";
+ swdev->alias = "rt305x";
+ swdev->cpu_port = RT305X_ESW_PORT6;