Commit b440de75 authored by Marek Behun's avatar Marek Behun
Browse files

patches/openwrt: fix omnia's multi CPU patches to work for Mox


Signed-off-by: Marek Behun's avatarMarek Behún <marek.behun@nic.cz>
parent 449fdfca
From eb7378684ab55a775b3e27935a1ef2aafbea5860 Mon Sep 17 00:00:00 2001
From a5a4301824ce979c5332515bf1abf8004d9e40ed Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marek=20Beh=C3=BAn?= <marek.behun@nic.cz>
Date: Tue, 27 Aug 2019 19:56:07 +0200
Date: Thu, 5 Sep 2019 18:43:13 +0200
Subject: [PATCH] mvebu: turris-omnia: multi cpu dsa
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
......@@ -16,13 +16,13 @@ Signed-off-by: Marek Behún <marek.behun@nic.cz>
diff --git a/target/linux/mvebu/patches-4.14/90500-net-dsa-multi-cpu.patch b/target/linux/mvebu/patches-4.14/90500-net-dsa-multi-cpu.patch
new file mode 100644
index 0000000..5bd18c1
index 0000000..1f0fd55
--- /dev/null
+++ b/target/linux/mvebu/patches-4.14/90500-net-dsa-multi-cpu.patch
@@ -0,0 +1,261 @@
+diff -Naurp a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c
+--- a/drivers/net/dsa/mv88e6xxx/chip.c 2019-08-22 10:27:11.763008277 +0200
++++ b/drivers/net/dsa/mv88e6xxx/chip.c 2019-08-28 00:17:26.065042132 +0200
+--- a/drivers/net/dsa/mv88e6xxx/chip.c 2019-09-05 16:56:10.344470471 +0200
++++ b/drivers/net/dsa/mv88e6xxx/chip.c 2019-09-05 18:37:15.627601841 +0200
+@@ -1087,6 +1087,7 @@ static u16 mv88e6xxx_port_vlan(struct mv
+ struct dsa_switch *ds = NULL;
+ struct net_device *br;
......@@ -31,13 +31,15 @@ index 0000000..5bd18c1
+ int i;
+
+ if (dev < DSA_MAX_SWITCHES)
+@@ -1097,8 +1098,26 @@ static u16 mv88e6xxx_port_vlan(struct mv
+@@ -1097,17 +1098,35 @@ static u16 mv88e6xxx_port_vlan(struct mv
+ return 0;
+
+ /* Frames from DSA links and CPU ports can egress any local port */
+- if (dsa_is_cpu_port(ds, port) || dsa_is_dsa_port(ds, port))
+- return mv88e6xxx_port_mask(chip);
++ if (dsa_is_cpu_port(ds, port) || dsa_is_dsa_port(ds, port)) {
++ if (dsa_is_dsa_port(ds, port))
+ return mv88e6xxx_port_mask(chip);
+
++ if (dsa_is_cpu_port(ds, port)) {
++ u16 pmask = mv88e6xxx_port_mask(chip);
++ pvlan = 0;
++
......@@ -47,20 +49,16 @@ index 0000000..5bd18c1
++ pvlan |= BIT(i);
++ continue;
++ }
++ if (dsa_is_dsa_port(ds, i)) {
++ pvlan |= BIT(i);
++ continue;
++ }
++ if ((pmask & BIT(i)) && dsa_port_upstream_port(chip->ds, i) == port)
++ pvlan |= BIT(i);
++ }
++
++ return pvlan;
++ }
+
++
+ br = ds->ports[port].bridge_dev;
+ pvlan = 0;
+@@ -1106,8 +1125,9 @@ static u16 mv88e6xxx_port_vlan(struct mv
+
+ /* Frames from user ports can egress any local DSA links and CPU ports,
+ * as well as any local member of their bridge group.
+ */
......@@ -71,7 +69,7 @@ index 0000000..5bd18c1
+ dsa_is_dsa_port(chip->ds, i) ||
+ (br && chip->ds->ports[i].bridge_dev == br))
+ pvlan |= BIT(i);
+@@ -1943,9 +1963,11 @@ static int mv88e6xxx_setup_message_port(
+@@ -1943,9 +1962,11 @@ static int mv88e6xxx_setup_message_port(
+
+ static int mv88e6xxx_setup_egress_floods(struct mv88e6xxx_chip *chip, int port)
+ {
......@@ -85,8 +83,8 @@ index 0000000..5bd18c1
+ return chip->info->ops->port_set_egress_floods(chip, port,
+ flood, flood);
+diff -Naurp a/include/net/dsa.h b/include/net/dsa.h
+--- a/include/net/dsa.h 2019-08-22 10:27:11.723008277 +0200
++++ b/include/net/dsa.h 2019-08-28 00:05:14.713351430 +0200
+--- a/include/net/dsa.h 2019-09-05 16:56:10.271137138 +0200
++++ b/include/net/dsa.h 2019-09-05 17:22:07.974758267 +0200
+@@ -188,6 +188,10 @@ struct dsa_port {
+ struct net_device *bridge_dev;
+ struct devlink_port devlink_port;
......@@ -130,8 +128,8 @@ index 0000000..5bd18c1
+ bool is_static, void *data);
+ struct dsa_switch_ops {
+diff -Naurp a/net/dsa/dsa2.c b/net/dsa/dsa2.c
+--- a/net/dsa/dsa2.c 2019-08-09 17:53:37.000000000 +0200
++++ b/net/dsa/dsa2.c 2019-08-28 00:13:37.643198813 +0200
+--- a/net/dsa/dsa2.c 2019-08-29 08:26:46.000000000 +0200
++++ b/net/dsa/dsa2.c 2019-09-05 17:25:55.361304595 +0200
+@@ -253,6 +253,8 @@ static int dsa_cpu_port_apply(struct dsa
+ memset(&port->devlink_port, 0, sizeof(port->devlink_port));
+ err = devlink_port_register(ds->devlink, &port->devlink_port,
......@@ -192,7 +190,7 @@ index 0000000..5bd18c1
++ return -EINVAL;
++ cpu_port_index = be32_to_cpup(cpu_port_reg);
++ } else {
++ cpu_port_index = dsa_upstream_port(ds);
++ cpu_port_index = DSA_RTABLE_NONE;
++ }
++
++ ds->ports[index].upstream = cpu_port_index;
......@@ -200,7 +198,7 @@ index 0000000..5bd18c1
+ return 0;
+ }
+
+@@ -533,10 +566,13 @@ static int dsa_ds_parse(struct dsa_switc
+@@ -533,8 +566,9 @@ static int dsa_ds_parse(struct dsa_switc
+ {
+ struct dsa_port *port;
+ u32 index;
......@@ -210,12 +208,8 @@ index 0000000..5bd18c1
++ /* first parse only CPU ports */
+ for (index = 0; index < ds->num_ports; index++) {
+ port = &ds->ports[index];
++ port->upstream = DSA_RTABLE_NONE;
++
+ if (!dsa_port_is_valid(port) ||
+ dsa_port_is_dsa(port))
+ continue;
+@@ -545,7 +581,20 @@ static int dsa_ds_parse(struct dsa_switc
+@@ -545,7 +579,20 @@ static int dsa_ds_parse(struct dsa_switc
+ err = dsa_cpu_parse(port, index, dst, ds);
+ if (err)
+ return err;
......@@ -238,8 +232,8 @@ index 0000000..5bd18c1
+ * to have access to a correct value, just like what
+ * net/dsa/dsa.c::dsa_switch_setup_one does.
+diff -Naurp a/net/dsa/dsa_priv.h b/net/dsa/dsa_priv.h
+--- a/net/dsa/dsa_priv.h 2019-08-22 10:27:11.723008277 +0200
++++ b/net/dsa/dsa_priv.h 2019-08-27 15:57:31.323513820 +0200
+--- a/net/dsa/dsa_priv.h 2019-09-05 16:56:10.271137138 +0200
++++ b/net/dsa/dsa_priv.h 2019-09-05 17:04:23.465370041 +0200
+@@ -81,6 +81,8 @@ struct dsa_slave_priv {
+
+ /* TC context */
......@@ -262,18 +256,24 @@ index 0000000..5bd18c1
+
+ static inline struct dsa_port *dsa_get_cpu_port(struct dsa_switch_tree *dst)
+diff -Naurp a/net/dsa/slave.c b/net/dsa/slave.c
+--- a/net/dsa/slave.c 2019-08-22 10:27:11.723008277 +0200
++++ b/net/dsa/slave.c 2019-08-27 15:58:17.039789880 +0200
+@@ -1242,7 +1242,7 @@ int dsa_slave_create(struct dsa_port *po
+--- a/net/dsa/slave.c 2019-09-05 16:56:10.271137138 +0200
++++ b/net/dsa/slave.c 2019-09-05 17:28:21.377969684 +0200
+@@ -1242,7 +1242,13 @@ int dsa_slave_create(struct dsa_port *po
+ int ret;
+
+ cpu_dp = ds->dst->cpu_dp;
+- master = cpu_dp->netdev;
++ master = ds->ports[port->upstream].ethernet;
++ if (port->upstream != DSA_RTABLE_NONE)
++ master = ds->ports[port->upstream].ethernet;
++ else
++ /* this should be actually the upstream's DSA port master, or
++ * even more complicated, but for now don't mix this
++ */
++ master = cpu_dp->netdev;
+
+ if (!ds->num_tx_queues)
+ ds->num_tx_queues = 1;
+@@ -1280,6 +1280,7 @@ int dsa_slave_create(struct dsa_port *po
+@@ -1280,6 +1286,7 @@ int dsa_slave_create(struct dsa_port *po
+ p->dp = port;
+ INIT_LIST_HEAD(&p->mall_tc_list);
+ p->xmit = dst->tag_ops->xmit;
......
  • is it permissible to share (link to here) this patch code on the kernel netdev mailing list[1] since it remedies an issue with vlan_filtering?


    [1] https://www.spinics.net/lists/netdev/msg624764.html

  • I have sent a RFC for multi-cpu support to netdev, but the whole thing is more complicated. See here. But of course you can send this patch explaining that it fixes another issue.

  • One more thing crossed my mind - seeing that that not every TO buyer is necessarily deploying TOS but OpenWrt instead would it not make sense to send the patch upstream to OpenWrt?

  • It would, but I fear it won't apply smoothly and needs some work. Sadly I have more pressing issues now to work on concerning Mox :(

Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment