Re: [OpenWrt-Devel] [RFC] Fix VLAN on Atheros AR8327N
On 2014-09-17 20:25, Valentin Spreckels wrote: I'm interested in this feature. I tried to understand what the revoked patch changes and rewrote it. I submitted my changes two months ago: http://patchwork.openwrt.org/patch/5957/ http://patchwork.openwrt.org/patch/5958/ My patches attempt to minimize changes in non-ar8327-specific code. Neither the revert commit nor ticket #12181 describe the issues. So I'm not sure, if my patches have them too. Does anyone know details about the issues? Hi Valentin, I finally got around to properly reviewing your changes, and they look correct to me. I committed them in r42652, r42653 - let's see if any new issues show up. Thanks, - Felix ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
Re: [OpenWrt-Devel] [RFC] Fix VLAN on Atheros AR8327N
Tue, Sep 23, 2014 at 12:22:02PM CEST, n...@openwrt.org wrote: On 2014-09-17 20:25, Valentin Spreckels wrote: I'm interested in this feature. I tried to understand what the revoked patch changes and rewrote it. I submitted my changes two months ago: http://patchwork.openwrt.org/patch/5957/ http://patchwork.openwrt.org/patch/5958/ My patches attempt to minimize changes in non-ar8327-specific code. Neither the revert commit nor ticket #12181 describe the issues. So I'm not sure, if my patches have them too. Does anyone know details about the issues? Hi Valentin, I finally got around to properly reviewing your changes, and they look correct to me. I committed them in r42652, r42653 - let's see if any new issues show up. Just curious, are these 2 patches going to be backported to BB? How that can happen? Thanks. Thanks, - Felix ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
Re: [OpenWrt-Devel] [RFC] Fix VLAN on Atheros AR8327N
On 2014-09-23 19:19, Jiri Pirko wrote: Tue, Sep 23, 2014 at 12:22:02PM CEST, n...@openwrt.org wrote: On 2014-09-17 20:25, Valentin Spreckels wrote: I'm interested in this feature. I tried to understand what the revoked patch changes and rewrote it. I submitted my changes two months ago: http://patchwork.openwrt.org/patch/5957/ http://patchwork.openwrt.org/patch/5958/ My patches attempt to minimize changes in non-ar8327-specific code. Neither the revert commit nor ticket #12181 describe the issues. So I'm not sure, if my patches have them too. Does anyone know details about the issues? Hi Valentin, I finally got around to properly reviewing your changes, and they look correct to me. I committed them in r42652, r42653 - let's see if any new issues show up. Just curious, are these 2 patches going to be backported to BB? How that can happen? First I'd like to have it tested in trunk for a while. - Felix ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
Re: [OpenWrt-Devel] [RFC] Fix VLAN on Atheros AR8327N
On Tue, Sep 23, 2014 at 6:22 AM, Felix Fietkau n...@openwrt.org wrote: Hi Valentin, I finally got around to properly reviewing your changes, and they look correct to me. I committed them in r42652, r42653 - let's see if any new issues show up. It works as expected on my TPLink TL-WR1043ND (using the r42653 image). Is there any chance of this making 14.07, or will it need to wait for 14.07.1? Thanks Aaron Z A human being should be able to change a diaper, plan an invasion, butcher a hog, conn a ship, design a building, write a sonnet, balance accounts, build a wall, set a bone, comfort the dying, take orders, give orders, cooperate, act alone, solve equations, analyze a new problem, pitch manure, program a computer, cook a tasty meal, fight efficiently, die gallantly. Specialization is for insects. — Robert Heinlein, Time Enough for Love ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
Re: [OpenWrt-Devel] [RFC] Fix VLAN on Atheros AR8327N
Wed, Sep 17, 2014 at 08:25:22PM CEST, valentin.spreck...@informatik.uni-oldenburg.de wrote: Hi, Am 17.09.2014 19:50, schrieb John Crispin: On 17/09/2014 19:47, Florian Fainelli wrote: On 08/31/2014 10:42 AM, Jiri Pirko wrote: Sat, Jul 19, 2014 at 09:49:38PM CEST, nolt...@gmail.com wrote: Commit 40842 reverted the fix for tagged+untagged VLANs on AR8327: https://dev.openwrt.org/changeset/40777 https://dev.openwrt.org/changeset/40842 According to jow, some people experienced some issues on older devices. Can anyone tell me what were those issues? Anyway, that patch modified some parts of the ar8216/ar8236, so I suppose any device with those switches were affected. However, I've modified the patch keeping the ar8216/ar8236 as much untouched as possible. Could anyone test it on those devices? BTW, this works for me on a TP-Link WDR4300 (ar8327). I tested the patch on TL-WR1043ND v2 with Atheros AR8327 rev. 4. Vlans are working as expected. Please include this into BB (might need repost) Thanks! Tested-by: Jiri Pirko j...@resnulli.us Unless there are further objections, we should probably just go ahead and apply this patch since it affects a bunch of users. and then the other bunch complains, as we had before. we keep applying and reversing this i think. maybe we should just see what the real bug is ? John I'm interested in this feature. I tried to understand what the revoked patch changes and rewrote it. I submitted my changes two months ago: http://patchwork.openwrt.org/patch/5957/ http://patchwork.openwrt.org/patch/5958/ I like this patches. Look very clean. Will test them on wr1043v2. Thanks. My patches attempt to minimize changes in non-ar8327-specific code. Neither the revert commit nor ticket #12181 describe the issues. So I'm not sure, if my patches have them too. Does anyone know details about the issues? - Valentin Spreckels Signed-off-by: Saverio Proto ziopr...@gmail.com Signed-off-by: Álvaro Fernández nolt...@gmail.com --- diff --git a/target/linux/generic/files/drivers/net/phy/ar8216.c b/target/linux/generic/files/drivers/net/phy/ar8216.c index 3846159..9eae624 100644 --- a/target/linux/generic/files/drivers/net/phy/ar8216.c +++ b/target/linux/generic/files/drivers/net/phy/ar8216.c @@ -78,7 +78,7 @@ struct ar8xxx_chip { u32 (*read_port_status)(struct ar8xxx_priv *priv, int port); int (*atu_flush)(struct ar8xxx_priv *priv); void (*vtu_flush)(struct ar8xxx_priv *priv); - void (*vtu_load_vlan)(struct ar8xxx_priv *priv, u32 vid, u32 port_mask); +void (*vtu_load_vlan)(struct ar8xxx_priv *priv, u32 vlan); const struct ar8xxx_mib_desc *mib_decs; unsigned num_mibs; @@ -112,7 +112,12 @@ struct ar8327_led { enum ar8327_led_pattern pattern; }; +struct ar8216_data { + u8 vlan_tagged; +}; + struct ar8327_data { + u8 vlan_tagged[AR8X16_MAX_VLANS]; u32 port0_status; u32 port6_status; @@ -138,6 +143,7 @@ struct ar8xxx_priv { u8 chip_rev; const struct ar8xxx_chip *chip; union { + struct ar8216_data ar8216; struct ar8327_data ar8327; } chip_data; bool initialized; @@ -159,7 +165,6 @@ struct ar8xxx_priv { bool vlan; u16 vlan_id[AR8X16_MAX_VLANS]; u8 vlan_table[AR8X16_MAX_VLANS]; - u8 vlan_tagged; u16 pvid[AR8X16_MAX_PORTS]; /* mirroring */ @@ -641,7 +646,7 @@ ar8216_mangle_rx(struct net_device *dev, struct sk_buff *skb) port = buf[0] 0xf; /* no need to fix up packets coming from a tagged source */ - if (priv-vlan_tagged (1 port)) +if (priv-chip_data.ar8216.vlan_tagged BIT(port)) return; /* lookup port vid from local table, the switch passes an invalid vlan id */ @@ -695,10 +700,13 @@ ar8216_vtu_flush(struct ar8xxx_priv *priv) } static void -ar8216_vtu_load_vlan(struct ar8xxx_priv *priv, u32 vid, u32 port_mask) +ar8216_vtu_load_vlan(struct ar8xxx_priv *priv, u32 vlan) { u32 op; + u32 vid = priv-vlan_id[vlan]; +u32 port_mask = priv-vlan_table[vlan]; + op = AR8216_VTU_OP_LOAD | (vid AR8216_VTU_VID_S); ar8216_vtu_op(priv, op, port_mask); } @@ -1705,12 +1713,16 @@ ar8327_vtu_flush(struct ar8xxx_priv *priv) } static void -ar8327_vtu_load_vlan(struct ar8xxx_priv *priv, u32 vid, u32 port_mask) +ar8327_vtu_load_vlan(struct ar8xxx_priv *priv, u32 vlan) { u32 op; u32 val; int i; + u32 vid = priv-vlan_id[vlan]; +u32 port_mask = priv-vlan_table[vlan]; + u32 tagged = priv-chip_data.ar8327.vlan_tagged[vlan]; + op = AR8327_VTU_FUNC1_OP_LOAD | (vid AR8327_VTU_FUNC1_VID_S); val = AR8327_VTU_FUNC0_VALID | AR8327_VTU_FUNC0_IVL; for (i = 0; i AR8327_NUM_PORTS; i++) { @@ -1720,7 +1732,7 @@ ar8327_vtu_load_vlan(struct ar8xxx_priv *priv, u32 vid, u32 port_mask) mode = AR8327_VTU_FUNC0_EG_MODE_NOT; else if (priv-vlan == 0) mode = AR8327_VTU_FUNC0_EG_MODE_KEEP; - else if (priv-vlan_tagged BIT(i)) + else if (tagged BIT(i)) mode = AR8327_VTU_FUNC0_EG_MODE_TAG; else mode = AR8327_VTU_FUNC0_EG_MODE_UNTAG; @@ -1734,26 +1746,22 @@ static void
Re: [OpenWrt-Devel] [RFC] Fix VLAN on Atheros AR8327N
As someone who has spent much of the past week trying to figure out why my TL-WR1043ND V2 wont work with both taggged and untagged packets on the same port, I am all for it being applied. If its not, a note on the 1043 page in the wiki explaining that you cant have tagged and untagged packets on the same port in versions X, Y and Z and linking to the patch would be very useful... Aaron Z A human being should be able to change a diaper, plan an invasion, butcher a hog, conn a ship, design a building, write a sonnet, balance accounts, build a wall, set a bone, comfort the dying, take orders, give orders, cooperate, act alone, solve equations, analyze a new problem, pitch manure, program a computer, cook a tasty meal, fight efficiently, die gallantly. Specialization is for insects. — Robert Heinlein, Time Enough for Love ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
Re: [OpenWrt-Devel] [RFC] Fix VLAN on Atheros AR8327N
On 08/31/2014 10:42 AM, Jiri Pirko wrote: Sat, Jul 19, 2014 at 09:49:38PM CEST, nolt...@gmail.com wrote: Commit 40842 reverted the fix for tagged+untagged VLANs on AR8327: https://dev.openwrt.org/changeset/40777 https://dev.openwrt.org/changeset/40842 According to jow, some people experienced some issues on older devices. Can anyone tell me what were those issues? Anyway, that patch modified some parts of the ar8216/ar8236, so I suppose any device with those switches were affected. However, I've modified the patch keeping the ar8216/ar8236 as much untouched as possible. Could anyone test it on those devices? BTW, this works for me on a TP-Link WDR4300 (ar8327). I tested the patch on TL-WR1043ND v2 with Atheros AR8327 rev. 4. Vlans are working as expected. Please include this into BB (might need repost) Thanks! Tested-by: Jiri Pirko j...@resnulli.us Unless there are further objections, we should probably just go ahead and apply this patch since it affects a bunch of users. Signed-off-by: Saverio Proto ziopr...@gmail.com Signed-off-by: Álvaro Fernández nolt...@gmail.com --- diff --git a/target/linux/generic/files/drivers/net/phy/ar8216.c b/target/linux/generic/files/drivers/net/phy/ar8216.c index 3846159..9eae624 100644 --- a/target/linux/generic/files/drivers/net/phy/ar8216.c +++ b/target/linux/generic/files/drivers/net/phy/ar8216.c @@ -78,7 +78,7 @@ struct ar8xxx_chip { u32 (*read_port_status)(struct ar8xxx_priv *priv, int port); int (*atu_flush)(struct ar8xxx_priv *priv); void (*vtu_flush)(struct ar8xxx_priv *priv); -void (*vtu_load_vlan)(struct ar8xxx_priv *priv, u32 vid, u32 port_mask); +void (*vtu_load_vlan)(struct ar8xxx_priv *priv, u32 vlan); const struct ar8xxx_mib_desc *mib_decs; unsigned num_mibs; @@ -112,7 +112,12 @@ struct ar8327_led { enum ar8327_led_pattern pattern; }; +struct ar8216_data { +u8 vlan_tagged; +}; + struct ar8327_data { +u8 vlan_tagged[AR8X16_MAX_VLANS]; u32 port0_status; u32 port6_status; @@ -138,6 +143,7 @@ struct ar8xxx_priv { u8 chip_rev; const struct ar8xxx_chip *chip; union { +struct ar8216_data ar8216; struct ar8327_data ar8327; } chip_data; bool initialized; @@ -159,7 +165,6 @@ struct ar8xxx_priv { bool vlan; u16 vlan_id[AR8X16_MAX_VLANS]; u8 vlan_table[AR8X16_MAX_VLANS]; -u8 vlan_tagged; u16 pvid[AR8X16_MAX_PORTS]; /* mirroring */ @@ -641,7 +646,7 @@ ar8216_mangle_rx(struct net_device *dev, struct sk_buff *skb) port = buf[0] 0xf; /* no need to fix up packets coming from a tagged source */ -if (priv-vlan_tagged (1 port)) +if (priv-chip_data.ar8216.vlan_tagged BIT(port)) return; /* lookup port vid from local table, the switch passes an invalid vlan id */ @@ -695,10 +700,13 @@ ar8216_vtu_flush(struct ar8xxx_priv *priv) } static void -ar8216_vtu_load_vlan(struct ar8xxx_priv *priv, u32 vid, u32 port_mask) +ar8216_vtu_load_vlan(struct ar8xxx_priv *priv, u32 vlan) { u32 op; +u32 vid = priv-vlan_id[vlan]; +u32 port_mask = priv-vlan_table[vlan]; + op = AR8216_VTU_OP_LOAD | (vid AR8216_VTU_VID_S); ar8216_vtu_op(priv, op, port_mask); } @@ -1705,12 +1713,16 @@ ar8327_vtu_flush(struct ar8xxx_priv *priv) } static void -ar8327_vtu_load_vlan(struct ar8xxx_priv *priv, u32 vid, u32 port_mask) +ar8327_vtu_load_vlan(struct ar8xxx_priv *priv, u32 vlan) { u32 op; u32 val; int i; +u32 vid = priv-vlan_id[vlan]; +u32 port_mask = priv-vlan_table[vlan]; +u32 tagged = priv-chip_data.ar8327.vlan_tagged[vlan]; + op = AR8327_VTU_FUNC1_OP_LOAD | (vid AR8327_VTU_FUNC1_VID_S); val = AR8327_VTU_FUNC0_VALID | AR8327_VTU_FUNC0_IVL; for (i = 0; i AR8327_NUM_PORTS; i++) { @@ -1720,7 +1732,7 @@ ar8327_vtu_load_vlan(struct ar8xxx_priv *priv, u32 vid, u32 port_mask) mode = AR8327_VTU_FUNC0_EG_MODE_NOT; else if (priv-vlan == 0) mode = AR8327_VTU_FUNC0_EG_MODE_KEEP; -else if (priv-vlan_tagged BIT(i)) +else if (tagged BIT(i)) mode = AR8327_VTU_FUNC0_EG_MODE_TAG; else mode = AR8327_VTU_FUNC0_EG_MODE_UNTAG; @@ -1734,26 +1746,22 @@ static void ar8327_setup_port(struct ar8xxx_priv *priv, int port, u32 egress, u32 ingress, u32 members, u32 pvid) { -u32 t; -u32 mode; +u32 mode, t; + +if (priv-vlan) { +pvid = priv-vlan_id[priv-pvid[port]]; +mode = AR8327_PORT_VLAN1_OUT_MODE_UNMOD; +ingress = AR8216_IN_SECURE; +} else { +pvid = port; +mode = AR8327_PORT_VLAN1_OUT_MODE_UNTOUCH; +ingress = AR8216_IN_PORT_ONLY; +} t = pvid AR8327_PORT_VLAN0_DEF_SVID_S; t |= pvid
Re: [OpenWrt-Devel] [RFC] Fix VLAN on Atheros AR8327N
On 17/09/2014 19:47, Florian Fainelli wrote: On 08/31/2014 10:42 AM, Jiri Pirko wrote: Sat, Jul 19, 2014 at 09:49:38PM CEST, nolt...@gmail.com wrote: Commit 40842 reverted the fix for tagged+untagged VLANs on AR8327: https://dev.openwrt.org/changeset/40777 https://dev.openwrt.org/changeset/40842 According to jow, some people experienced some issues on older devices. Can anyone tell me what were those issues? Anyway, that patch modified some parts of the ar8216/ar8236, so I suppose any device with those switches were affected. However, I've modified the patch keeping the ar8216/ar8236 as much untouched as possible. Could anyone test it on those devices? BTW, this works for me on a TP-Link WDR4300 (ar8327). I tested the patch on TL-WR1043ND v2 with Atheros AR8327 rev. 4. Vlans are working as expected. Please include this into BB (might need repost) Thanks! Tested-by: Jiri Pirko j...@resnulli.us Unless there are further objections, we should probably just go ahead and apply this patch since it affects a bunch of users. and then the other bunch complains, as we had before. we keep applying and reversing this i think. maybe we should just see what the real bug is ? John Signed-off-by: Saverio Proto ziopr...@gmail.com Signed-off-by: Álvaro Fernández nolt...@gmail.com --- diff --git a/target/linux/generic/files/drivers/net/phy/ar8216.c b/target/linux/generic/files/drivers/net/phy/ar8216.c index 3846159..9eae624 100644 --- a/target/linux/generic/files/drivers/net/phy/ar8216.c +++ b/target/linux/generic/files/drivers/net/phy/ar8216.c @@ -78,7 +78,7 @@ struct ar8xxx_chip { u32 (*read_port_status)(struct ar8xxx_priv *priv, int port); int (*atu_flush)(struct ar8xxx_priv *priv); void (*vtu_flush)(struct ar8xxx_priv *priv); - void (*vtu_load_vlan)(struct ar8xxx_priv *priv, u32 vid, u32 port_mask); + void (*vtu_load_vlan)(struct ar8xxx_priv *priv, u32 vlan); const struct ar8xxx_mib_desc *mib_decs; unsigned num_mibs; @@ -112,7 +112,12 @@ struct ar8327_led { enum ar8327_led_pattern pattern; }; +struct ar8216_data { + u8 vlan_tagged; +}; + struct ar8327_data { + u8 vlan_tagged[AR8X16_MAX_VLANS]; u32 port0_status; u32 port6_status; @@ -138,6 +143,7 @@ struct ar8xxx_priv { u8 chip_rev; const struct ar8xxx_chip *chip; union { + struct ar8216_data ar8216; struct ar8327_data ar8327; } chip_data; bool initialized; @@ -159,7 +165,6 @@ struct ar8xxx_priv { bool vlan; u16 vlan_id[AR8X16_MAX_VLANS]; u8 vlan_table[AR8X16_MAX_VLANS]; - u8 vlan_tagged; u16 pvid[AR8X16_MAX_PORTS]; /* mirroring */ @@ -641,7 +646,7 @@ ar8216_mangle_rx(struct net_device *dev, struct sk_buff *skb) port = buf[0] 0xf; /* no need to fix up packets coming from a tagged source */ - if (priv-vlan_tagged (1 port)) + if (priv-chip_data.ar8216.vlan_tagged BIT(port)) return; /* lookup port vid from local table, the switch passes an invalid vlan id */ @@ -695,10 +700,13 @@ ar8216_vtu_flush(struct ar8xxx_priv *priv) } static void -ar8216_vtu_load_vlan(struct ar8xxx_priv *priv, u32 vid, u32 port_mask) +ar8216_vtu_load_vlan(struct ar8xxx_priv *priv, u32 vlan) { u32 op; + u32 vid = priv-vlan_id[vlan]; +u32 port_mask = priv-vlan_table[vlan]; + op = AR8216_VTU_OP_LOAD | (vid AR8216_VTU_VID_S); ar8216_vtu_op(priv, op, port_mask); } @@ -1705,12 +1713,16 @@ ar8327_vtu_flush(struct ar8xxx_priv *priv) } static void -ar8327_vtu_load_vlan(struct ar8xxx_priv *priv, u32 vid, u32 port_mask) +ar8327_vtu_load_vlan(struct ar8xxx_priv *priv, u32 vlan) { u32 op; u32 val; int i; + u32 vid = priv-vlan_id[vlan]; +u32 port_mask = priv-vlan_table[vlan]; + u32 tagged = priv-chip_data.ar8327.vlan_tagged[vlan]; + op = AR8327_VTU_FUNC1_OP_LOAD | (vid AR8327_VTU_FUNC1_VID_S); val = AR8327_VTU_FUNC0_VALID | AR8327_VTU_FUNC0_IVL; for (i = 0; i AR8327_NUM_PORTS; i++) { @@ -1720,7 +1732,7 @@ ar8327_vtu_load_vlan(struct ar8xxx_priv *priv, u32 vid, u32 port_mask) mode = AR8327_VTU_FUNC0_EG_MODE_NOT; else if (priv-vlan == 0) mode = AR8327_VTU_FUNC0_EG_MODE_KEEP; - else if (priv-vlan_tagged BIT(i)) + else if (tagged BIT(i)) mode = AR8327_VTU_FUNC0_EG_MODE_TAG; else mode = AR8327_VTU_FUNC0_EG_MODE_UNTAG; @@ -1734,26 +1746,22 @@ static void ar8327_setup_port(struct ar8xxx_priv *priv, int port, u32 egress, u32 ingress, u32 members, u32 pvid) { - u32 t; -u32 mode; + u32 mode, t; + +if (priv-vlan) { + pvid = priv-vlan_id[priv-pvid[port]]; + mode = AR8327_PORT_VLAN1_OUT_MODE_UNMOD; + ingress = AR8216_IN_SECURE; + } else { + pvid = port; + mode = AR8327_PORT_VLAN1_OUT_MODE_UNTOUCH; + ingress = AR8216_IN_PORT_ONLY; + } t = pvid AR8327_PORT_VLAN0_DEF_SVID_S; t |= pvid AR8327_PORT_VLAN0_DEF_CVID_S; priv-write(priv, AR8327_REG_PORT_VLAN0(port), t); - mode =
Re: [OpenWrt-Devel] [RFC] Fix VLAN on Atheros AR8327N
Hi, Am 17.09.2014 19:50, schrieb John Crispin: On 17/09/2014 19:47, Florian Fainelli wrote: On 08/31/2014 10:42 AM, Jiri Pirko wrote: Sat, Jul 19, 2014 at 09:49:38PM CEST, nolt...@gmail.com wrote: Commit 40842 reverted the fix for tagged+untagged VLANs on AR8327: https://dev.openwrt.org/changeset/40777 https://dev.openwrt.org/changeset/40842 According to jow, some people experienced some issues on older devices. Can anyone tell me what were those issues? Anyway, that patch modified some parts of the ar8216/ar8236, so I suppose any device with those switches were affected. However, I've modified the patch keeping the ar8216/ar8236 as much untouched as possible. Could anyone test it on those devices? BTW, this works for me on a TP-Link WDR4300 (ar8327). I tested the patch on TL-WR1043ND v2 with Atheros AR8327 rev. 4. Vlans are working as expected. Please include this into BB (might need repost) Thanks! Tested-by: Jiri Pirko j...@resnulli.us Unless there are further objections, we should probably just go ahead and apply this patch since it affects a bunch of users. and then the other bunch complains, as we had before. we keep applying and reversing this i think. maybe we should just see what the real bug is ? John I'm interested in this feature. I tried to understand what the revoked patch changes and rewrote it. I submitted my changes two months ago: http://patchwork.openwrt.org/patch/5957/ http://patchwork.openwrt.org/patch/5958/ My patches attempt to minimize changes in non-ar8327-specific code. Neither the revert commit nor ticket #12181 describe the issues. So I'm not sure, if my patches have them too. Does anyone know details about the issues? - Valentin Spreckels Signed-off-by: Saverio Proto ziopr...@gmail.com Signed-off-by: Álvaro Fernández nolt...@gmail.com --- diff --git a/target/linux/generic/files/drivers/net/phy/ar8216.c b/target/linux/generic/files/drivers/net/phy/ar8216.c index 3846159..9eae624 100644 --- a/target/linux/generic/files/drivers/net/phy/ar8216.c +++ b/target/linux/generic/files/drivers/net/phy/ar8216.c @@ -78,7 +78,7 @@ struct ar8xxx_chip { u32 (*read_port_status)(struct ar8xxx_priv *priv, int port); int (*atu_flush)(struct ar8xxx_priv *priv); void (*vtu_flush)(struct ar8xxx_priv *priv); - void (*vtu_load_vlan)(struct ar8xxx_priv *priv, u32 vid, u32 port_mask); + void (*vtu_load_vlan)(struct ar8xxx_priv *priv, u32 vlan); const struct ar8xxx_mib_desc *mib_decs; unsigned num_mibs; @@ -112,7 +112,12 @@ struct ar8327_led { enum ar8327_led_pattern pattern; }; +struct ar8216_data { +u8 vlan_tagged; +}; + struct ar8327_data { +u8 vlan_tagged[AR8X16_MAX_VLANS]; u32 port0_status; u32 port6_status; @@ -138,6 +143,7 @@ struct ar8xxx_priv { u8 chip_rev; const struct ar8xxx_chip *chip; union { +struct ar8216_data ar8216; struct ar8327_data ar8327; } chip_data; bool initialized; @@ -159,7 +165,6 @@ struct ar8xxx_priv { bool vlan; u16 vlan_id[AR8X16_MAX_VLANS]; u8 vlan_table[AR8X16_MAX_VLANS]; -u8 vlan_tagged; u16 pvid[AR8X16_MAX_PORTS]; /* mirroring */ @@ -641,7 +646,7 @@ ar8216_mangle_rx(struct net_device *dev, struct sk_buff *skb) port = buf[0] 0xf; /* no need to fix up packets coming from a tagged source */ - if (priv-vlan_tagged (1 port)) + if (priv-chip_data.ar8216.vlan_tagged BIT(port)) return; /* lookup port vid from local table, the switch passes an invalid vlan id */ @@ -695,10 +700,13 @@ ar8216_vtu_flush(struct ar8xxx_priv *priv) } static void -ar8216_vtu_load_vlan(struct ar8xxx_priv *priv, u32 vid, u32 port_mask) +ar8216_vtu_load_vlan(struct ar8xxx_priv *priv, u32 vlan) { u32 op; + u32 vid = priv-vlan_id[vlan]; +u32 port_mask = priv-vlan_table[vlan]; + op = AR8216_VTU_OP_LOAD | (vid AR8216_VTU_VID_S); ar8216_vtu_op(priv, op, port_mask); } @@ -1705,12 +1713,16 @@ ar8327_vtu_flush(struct ar8xxx_priv *priv) } static void -ar8327_vtu_load_vlan(struct ar8xxx_priv *priv, u32 vid, u32 port_mask) +ar8327_vtu_load_vlan(struct ar8xxx_priv *priv, u32 vlan) { u32 op; u32 val; int i; + u32 vid = priv-vlan_id[vlan]; +u32 port_mask = priv-vlan_table[vlan]; + u32 tagged = priv-chip_data.ar8327.vlan_tagged[vlan]; + op = AR8327_VTU_FUNC1_OP_LOAD | (vid AR8327_VTU_FUNC1_VID_S); val = AR8327_VTU_FUNC0_VALID | AR8327_VTU_FUNC0_IVL; for (i = 0; i AR8327_NUM_PORTS; i++) { @@ -1720,7 +1732,7 @@ ar8327_vtu_load_vlan(struct ar8xxx_priv *priv, u32 vid, u32 port_mask) mode = AR8327_VTU_FUNC0_EG_MODE_NOT; else if (priv-vlan == 0) mode = AR8327_VTU_FUNC0_EG_MODE_KEEP; - else if (priv-vlan_tagged BIT(i)) + else if (tagged BIT(i)) mode = AR8327_VTU_FUNC0_EG_MODE_TAG; else mode = AR8327_VTU_FUNC0_EG_MODE_UNTAG; @@ -1734,26 +1746,22 @@ static void ar8327_setup_port(struct ar8xxx_priv *priv, int port, u32 egress, u32 ingress, u32 members, u32 pvid) { -u32 t; -u32 mode; +u32 mode, t; + +
Re: [OpenWrt-Devel] [RFC] Fix VLAN on Atheros AR8327N
Sat, Jul 19, 2014 at 09:49:38PM CEST, nolt...@gmail.com wrote: Commit 40842 reverted the fix for tagged+untagged VLANs on AR8327: https://dev.openwrt.org/changeset/40777 https://dev.openwrt.org/changeset/40842 According to jow, some people experienced some issues on older devices. Can anyone tell me what were those issues? Anyway, that patch modified some parts of the ar8216/ar8236, so I suppose any device with those switches were affected. However, I've modified the patch keeping the ar8216/ar8236 as much untouched as possible. Could anyone test it on those devices? BTW, this works for me on a TP-Link WDR4300 (ar8327). I tested the patch on TL-WR1043ND v2 with Atheros AR8327 rev. 4. Vlans are working as expected. Please include this into BB (might need repost) Thanks! Tested-by: Jiri Pirko j...@resnulli.us Signed-off-by: Saverio Proto ziopr...@gmail.com Signed-off-by: Álvaro Fernández nolt...@gmail.com --- diff --git a/target/linux/generic/files/drivers/net/phy/ar8216.c b/target/linux/generic/files/drivers/net/phy/ar8216.c index 3846159..9eae624 100644 --- a/target/linux/generic/files/drivers/net/phy/ar8216.c +++ b/target/linux/generic/files/drivers/net/phy/ar8216.c @@ -78,7 +78,7 @@ struct ar8xxx_chip { u32 (*read_port_status)(struct ar8xxx_priv *priv, int port); int (*atu_flush)(struct ar8xxx_priv *priv); void (*vtu_flush)(struct ar8xxx_priv *priv); - void (*vtu_load_vlan)(struct ar8xxx_priv *priv, u32 vid, u32 port_mask); + void (*vtu_load_vlan)(struct ar8xxx_priv *priv, u32 vlan); const struct ar8xxx_mib_desc *mib_decs; unsigned num_mibs; @@ -112,7 +112,12 @@ struct ar8327_led { enum ar8327_led_pattern pattern; }; +struct ar8216_data { + u8 vlan_tagged; +}; + struct ar8327_data { + u8 vlan_tagged[AR8X16_MAX_VLANS]; u32 port0_status; u32 port6_status; @@ -138,6 +143,7 @@ struct ar8xxx_priv { u8 chip_rev; const struct ar8xxx_chip *chip; union { + struct ar8216_data ar8216; struct ar8327_data ar8327; } chip_data; bool initialized; @@ -159,7 +165,6 @@ struct ar8xxx_priv { bool vlan; u16 vlan_id[AR8X16_MAX_VLANS]; u8 vlan_table[AR8X16_MAX_VLANS]; - u8 vlan_tagged; u16 pvid[AR8X16_MAX_PORTS]; /* mirroring */ @@ -641,7 +646,7 @@ ar8216_mangle_rx(struct net_device *dev, struct sk_buff *skb) port = buf[0] 0xf; /* no need to fix up packets coming from a tagged source */ - if (priv-vlan_tagged (1 port)) + if (priv-chip_data.ar8216.vlan_tagged BIT(port)) return; /* lookup port vid from local table, the switch passes an invalid vlan id */ @@ -695,10 +700,13 @@ ar8216_vtu_flush(struct ar8xxx_priv *priv) } static void -ar8216_vtu_load_vlan(struct ar8xxx_priv *priv, u32 vid, u32 port_mask) +ar8216_vtu_load_vlan(struct ar8xxx_priv *priv, u32 vlan) { u32 op; + u32 vid = priv-vlan_id[vlan]; + u32 port_mask = priv-vlan_table[vlan]; + op = AR8216_VTU_OP_LOAD | (vid AR8216_VTU_VID_S); ar8216_vtu_op(priv, op, port_mask); } @@ -1705,12 +1713,16 @@ ar8327_vtu_flush(struct ar8xxx_priv *priv) } static void -ar8327_vtu_load_vlan(struct ar8xxx_priv *priv, u32 vid, u32 port_mask) +ar8327_vtu_load_vlan(struct ar8xxx_priv *priv, u32 vlan) { u32 op; u32 val; int i; + u32 vid = priv-vlan_id[vlan]; + u32 port_mask = priv-vlan_table[vlan]; + u32 tagged = priv-chip_data.ar8327.vlan_tagged[vlan]; + op = AR8327_VTU_FUNC1_OP_LOAD | (vid AR8327_VTU_FUNC1_VID_S); val = AR8327_VTU_FUNC0_VALID | AR8327_VTU_FUNC0_IVL; for (i = 0; i AR8327_NUM_PORTS; i++) { @@ -1720,7 +1732,7 @@ ar8327_vtu_load_vlan(struct ar8xxx_priv *priv, u32 vid, u32 port_mask) mode = AR8327_VTU_FUNC0_EG_MODE_NOT; else if (priv-vlan == 0) mode = AR8327_VTU_FUNC0_EG_MODE_KEEP; - else if (priv-vlan_tagged BIT(i)) + else if (tagged BIT(i)) mode = AR8327_VTU_FUNC0_EG_MODE_TAG; else mode = AR8327_VTU_FUNC0_EG_MODE_UNTAG; @@ -1734,26 +1746,22 @@ static void ar8327_setup_port(struct ar8xxx_priv *priv, int port, u32 egress, u32 ingress, u32 members, u32 pvid) { - u32 t; - u32 mode; + u32 mode, t; + + if (priv-vlan) { + pvid = priv-vlan_id[priv-pvid[port]]; + mode = AR8327_PORT_VLAN1_OUT_MODE_UNMOD; + ingress = AR8216_IN_SECURE; + } else { + pvid = port; + mode = AR8327_PORT_VLAN1_OUT_MODE_UNTOUCH; + ingress = AR8216_IN_PORT_ONLY; + } t = pvid AR8327_PORT_VLAN0_DEF_SVID_S; t |= pvid AR8327_PORT_VLAN0_DEF_CVID_S; priv-write(priv, AR8327_REG_PORT_VLAN0(port), t); - mode = AR8327_PORT_VLAN1_OUT_MODE_UNMOD; - switch