net: dsa: tag_8021q: Allow DSA tags and VLAN filtering simultaneously
Subsystems (6)
Vladimir Oltean
maintainerRFC PATCH 1/1 net: dsa: tag_8021q: Allow DSA tags and VLAN filtering simultaneously
There are very good reasons to want this (see documentation reference to br_if.c), and there are also very good reasons for not enabling it by default. So a devlink param named best_effort_vlan_filtering, currently driver-specific and exported only by sja1105, is used to configure this.
In practice, this is perhaps the way that most users are going to use the switch in. Best-effort untagged traffic can be bridged with any net device in the system or terminated locally, and VLAN-tagged streams are forwarded autonomously in a time-sensitive manner according to their PCP (they need not transit the CPU). For those cases where the CPU needs to terminate some VLAN-tagged traffic, using the DSA master is still an option.
A complication while implementing this was the fact that __netif_receive_skb_core calls __vlan_hwaccel_clear_tag right before passing the skb to the DSA packet_type handler. This means that the tagger does not see the VLAN tag in the skb, nor in the skb meta data. The patch that starting zeroing the skb VLAN tag is:
commit d4b812dea4a236f729526facf97df1a9d18e191c
Author: Eric Dumazet <[email protected]>
Date: Thu Jul 18 07:19:26 2013 -0700
vlan: mask vlan prio bits
In commit 48cc32d38a52d0b68f91a171a8d00531edc6a46e ("vlan: don't deliver frames for unknown vlans to protocols") Florian made sure we set pkt_type to PACKET_OTHERHOST if the vlan id is set and we could find a vlan device for this particular id.
But we also have a problem if prio bits are set.
Steinar reported an issue on a router receiving IPv6 frames with a vlan tag of 4000 (id 0, prio 2), and tunneled into a sit device, because skb->vlan_tci is set.
Forwarded frame is completely corrupted : We can see (8100:4000) being inserted in the middle of IPv6 source address :
16:48:00.780413 IP6 2001:16d8:8100:4000:ee1c:0:9d9:bc87 > 9f94:4d95:2001:67c:29f4::: ICMP6, unknown icmp6 type (0), length 64
0x0000: 0000 0029 8000 c7c3 7103 0001 a0ae e651 0x0010: 0000 0000 ccce 0b00 0000 0000 1011 1213 0x0020: 1415 1617 1819 1a1b 1c1d 1e1f 2021 2223 0x0030: 2425 2627 2829 2a2b 2c2d 2e2f 3031 3233
It seems we are not really ready to properly cope with this right now.
We can probably do better in future kernels :
vlan_get_ingress_priority() should be a netdev property instead of a per vlan_dev one.
For stable kernels, lets clear vlan_tci to fix the bugs.
The patch doesn't say why "we are not really ready to properly cope with this right now", and hence why the best solution is to remove the VLAN tag from skb's that don't have a local VLAN sub-interface interested in them. And I have no idea either.
But the above patch has a loophole: if the VLAN tag is not hw-accelerated, it isn't removed from the skb if there is no VLAN sub-interface interested in it (our case). So we are hooking into the .ndo_fix_features callback of the DSA master and clearing the rxvlan offload feature, so the DSA tagger will always see the VLAN as part of the skb data. This is symmetrical with the ETH_P_DSA_8021Q case and does not need special treatment in the tagger. But perhaps the workaround is brittle and might break if not understood well enough.
The disabling of the rxvlan feature of the DSA master is unconditional. The reasoning is that at first sight, no DSA master with regular frame parsing abilities could be able to locate the VLAN tag with any of the existing taggers anyway, and therefore, adding a property in dsa_switch to control the rxvlan feature of the master would seem like useless boilerplate.
--- .../networking/devlink-params-sja1105.txt | 24 ++++++ Documentation/networking/dsa/sja1105.rst | 74 ++++++++++++++--- drivers/net/dsa/sja1105/sja1105.h | 1 + drivers/net/dsa/sja1105/sja1105_main.c | 81 +++++++++++++++++-- include/linux/dsa/8021q.h | 7 ++ include/linux/dsa/sja1105.h | 2 + net/dsa/master.c | 7 ++ net/dsa/tag_8021q.c | 62 ++++++++++++++ net/dsa/tag_sja1105.c | 16 ++-- 9 files changed, 250 insertions(+), 24 deletions(-)
Documentation/networking/devlink-params-sja1105.txt +24 -0
@@ -7,3 +7,27 @@ hostprio [DEVICE, DRIVER-SPECIFIC] your PTP frames. Configuration mode: runtime Type: u8. 0-7 valid. + +best_effort_vlan_filtering + [DEVICE, DRIVER-SPECIFIC] + Allow plain ETH_P_8021Q headers to be used as DSA tags. + Benefits: + - Can terminate untagged traffic over switch net + devices even when enslaved to a bridge with + vlan_filtering=1. + - Can do QoS based on VLAN PCP for autonomously + forwarded frames. + Drawbacks: + - User cannot change pvid via 'bridge' commands. This + would break source port identification on RX for + untagged traffic. + - User cannot use VLANs in range 1024-3071. If the + switch receives frames with such VIDs, it will + misinterpret them as DSA tags. + - Cannot terminate VLAN-tagged traffic on local device. + There is no way to deduce the source port from these. + One could still use the DSA master though. + - Switch uses Shared VLAN Learning (FDB lookup uses + only DMAC as key). + Configuration mode: runtime + Type: bool.
Documentation/networking/dsa/sja1105.rst +64 -10
92 lines not on this page · raw message
drivers/net/dsa/sja1105/sja1105.h +1 -0
@@ -94,6 +94,7 @@ struct sja1105_private {struct sja1105_static_config static_config;bool rgmii_rx_delay[SJA1105_NUM_PORTS ];bool rgmii_tx_delay[SJA1105_NUM_PORTS ]; +bool best_effort_vlan_filtering;const struct sja1105_info *info;struct gpio_desc *reset_gpio;struct spi_device *spidev;
drivers/net/dsa/sja1105/sja1105_main.c +76 -5
145 lines not on this page · raw message
include/linux/dsa/8021q.h +7 -0
@@ -17,6 +17,8 @@ struct packet_type;int dsa_port_setup_8021q_tagging (struct dsa_switch *ds,int index,bool enabled); +int dsa_8021q_vid_validate (struct dsa_switch *ds,int port,u16 vid,u16 flags); +struct sk_buff *dsa_8021q_xmit (struct sk_buff *skb,struct net_device *netdev,u16 tpid,u16 tci);
@@ -38,6 +40,11 @@ int dsa_port_setup_8021q_tagging(struct dsa_switch *ds, int index,return 0 ; } +int dsa_8021q_vid_validate (struct dsa_switch *ds,int port,u16 vid,u16 flags) +{ +return 0 ; +} +struct sk_buff *dsa_8021q_xmit (struct sk_buff *skb,struct net_device *netdev,u16 tpid,u16 tci) {
include/linux/dsa/sja1105.h +2 -0
@@ -61,4 +61,6 @@ struct sja1105_port { int mgmt_slot; }; +bool sja1105_can_use_vlan_as_tags (struct dsa_port *dp); +#endif /* _NET_DSA_SJA1105_H */
net/dsa/master.c +7 -0
@@ -197,6 +197,12 @@ static int dsa_master_get_phys_port_name(struct net_device *dev,return 0 ; } +static netdev_features_t dsa_master_fix_features (struct net_device *dev, +netdev_features_t features) +{ +return features & ~NETIF_F_HW_VLAN_CTAG_RX ; +} +static int dsa_master_ethtool_setup (struct net_device *dev) {struct dsa_port *cpu_dp = dev->dsa_ptr;
@@ -249,6 +255,7 @@ static int dsa_master_ndo_setup(struct net_device *dev)memcpy (ops, cpu_dp->orig_ndo_ops,sizeof (*ops)); ops->ndo_get_phys_port_name = dsa_master_get_phys_port_name; + ops->ndo_fix_features = dsa_master_fix_features; dev->netdev_ops = ops;
net/dsa/tag_8021q.c +62 -0
68 lines not on this page · raw message
net/dsa/tag_sja1105.c +7 -9
@@ -74,7 +74,7 @@ static inline bool sja1105_is_meta_frame(const struct sk_buff *skb)*/ static bool sja1105_filter (const struct sk_buff *skb,struct net_device *dev) { -if (!dsa_port_is_vlan_filtering (dev->dsa_ptr)) +if (sja1105_can_use_vlan_as_tags (skb->dev->dsa_ptr))return true;if (sja1105_is_link_local (skb))return true;
@@ -91,6 +91,7 @@ static struct sk_buff *sja1105_xmit(struct sk_buff *skb,u16 tx_vid =dsa_8021q_tx_vid (ds, dp->index);u16 queue_mapping =skb_get_queue_mapping (skb);u8 pcp =netdev_txq_to_tc (netdev, queue_mapping); +u16 tpid;/* Transmitting management traffic does not rely upon switch tagging, * but instead SPI-installed management routes. Part 2 of this
@@ -99,15 +100,12 @@ static struct sk_buff *sja1105_xmit(struct sk_buff *skb,if (unlikely (sja1105_is_link_local (skb)))return dsa_defer_xmit (skb, netdev); -/* If we are under a vlan_filtering bridge, IP termination on -* switch ports based on 802.1Q tags is simply too brittle to -* be passable. So just defer to the dsa_slave_notag_xmit -* implementation. -*/ if (dsa_port_is_vlan_filtering (dp)) -return skb; + tpid =ETH_P_8021Q ; +else + tpid =ETH_P_SJA1105 ; -return dsa_8021q_xmit (skb, netdev,ETH_P_SJA1105 , +return dsa_8021q_xmit (skb, netdev, tpid, ((pcp <<VLAN_PRIO_SHIFT ) | tx_vid)); }
@@ -250,7 +248,7 @@ static struct sk_buff *sja1105_rcv(struct sk_buff *skb, hdr =vlan_eth_hdr (skb); tpid =ntohs (hdr->h_vlan_proto); - is_tagged = (tpid ==ETH_P_SJA1105 ); + is_tagged = (tpid ==ETH_P_SJA1105 || tpid ==ETH_P_8021Q ); is_link_local =sja1105_is_link_local (skb); is_meta =sja1105_is_meta_frame (skb);
Signature · 1 line
2.17.1
Quoted 82 lines · Vladimir Oltean
There are very good reasons to want this (see documentation reference to
br_if.c), and there are also very good reasons for not enabling it by default. So a devlink param namedbest_effort_vlan_filtering, currently driver-specific and exported only by sja1105, is used to configure this.In practice, this is perhaps the way that most users are going to use the switch in. Best-effort untagged traffic can be bridged with any net device in the system or terminated locally, and VLAN-tagged streams are forwarded autonomously in a time-sensitive manner according to their PCP (they need not transit the CPU). For those cases where the CPU needs to terminate some VLAN-tagged traffic, using the DSA master is still an option.
A complication while implementing this was the fact that
__netif_receive_skb_corecalls__vlan_hwaccel_clear_tagright before passing the skb to the DSApacket_typehandler. This means that the tagger does not see the VLAN tag in the skb, nor in the skb meta data. The patch that starting zeroing the skb VLAN tag is:commit
d4b812dea4a236f729526facf97df1a9d18e191c
Author: Eric Dumazet <[email protected]>
Date: Thu Jul 18 07:19:26 2013 -0700vlan: mask vlan prio bits
In commit
48cc32d38a52d0b68f91a171a8d00531edc6a46e("vlan: don't deliver frames for unknown vlans to protocols") Florian made sure we setpkt_typetoPACKET_OTHERHOSTif the vlan id is set and we could find a vlan device for this particular id.But we also have a problem if prio bits are set.
Steinar reported an issue on a router receiving IPv6 frames with a vlan tag of 4000 (id 0, prio 2), and tunneled into a sit device, because
skb->vlan_tciis set.Forwarded frame is completely corrupted : We can see (8100:4000) being inserted in the middle of IPv6 source address :
16:48:00.780413 IP6 2001:16d8:8100:4000:ee1c:0:9d9:bc87 > 9f94:4d95:2001:67c:29f4::: ICMP6, unknown icmp6 type (0), length 64
0x0000: 0000 0029 8000 c7c3 7103 0001 a0ae e6510x0010: 0000 0000 ccce 0b00 0000 0000 1011 12130x0020: 1415 1617 1819 1a1b 1c1d 1e1f 2021 22230x0030: 2425 2627 2829 2a2b 2c2d 2e2f 3031 3233It seems we are not really ready to properly cope with this right now.
We can probably do better in future kernels :
vlan_get_ingress_priority()should be a netdev property instead of a pervlan_devone.For stable kernels, lets clear
vlan_tcito fix the bugs.Reported-by Steinar H. Gunderson <[email protected]>Signed-off-by Eric Dumazet <[email protected]>Signed-off-by David S. Miller <[email protected]>The patch doesn't say why "we are not really ready to properly cope with this right now", and hence why the best solution is to remove the VLAN tag from skb's that don't have a local VLAN sub-interface interested in them. And I have no idea either.
But the above patch has a loophole: if the VLAN tag is not hw-accelerated, it isn't removed from the skb if there is no VLAN sub-interface interested in it (our case). So we are hooking into the .ndo_fix_features callback of the DSA master and clearing the rxvlan offload feature, so the DSA tagger will always see the VLAN as part of the skb data. This is symmetrical with the
ETH_P_DSA_8021Qcase and does not need special treatment in the tagger. But perhaps the workaround is brittle and might break if not understood well enough.The disabling of the rxvlan feature of the DSA master is unconditional. The reasoning is that at first sight, no DSA master with regular frame parsing abilities could be able to locate the VLAN tag with any of the existing taggers anyway, and therefore, adding a property in
dsa_switchto control the rxvlan feature of the master would seem like useless boilerplate.Signed-off-by Vladimir Oltean <[email protected]>---
[snip]
Quoted 9 lines
Documentation/networking/devlink-params-sja1105.txt +9
-0+best_effort_vlan_filtering + [DEVICE, DRIVER-SPECIFIC] + Allow plain ETH_P_8021Q headers to be used as DSA tags. + Benefits: + - Can terminate untagged traffic over switch net + devices even when enslaved to a bridge with + vlan_filtering=1. + - Can do QoS based on VLAN PCP for autonomously + forwarded frames.
Documentation/networking/devlink-params-sja1105.txt hostprio [DEVICE, DRIVER-SPECIFIC] · line 29
Quoted 10 lines
Documentation/networking/devlink-params-sja1105.txt +10
-0+ Drawbacks: + - User cannot change pvid via 'bridge' commands. This + would break source port identification on RX for + untagged traffic. + - User cannot use VLANs in range 1024-3071. If the + switch receives frames with such VIDs, it will + misinterpret them as DSA tags. + - Cannot terminate VLAN-tagged traffic on local device. + There is no way to deduce the source port from these. + One could still use the DSA master though.
Could we use QinQ to possibly solve these problems and would that work for your switch? I do not really mind being restricted to not being able to change the default_pvid or have a reduced VLAN range, but being able to test VLAN tags terminated on DSA slave network devices is a valuable thing to do.
Signature · 1 line
Florian
Vladimir Oltean
maintainerQuoted 109 lines · Florian Fainelli
Quoted 82 lines · Vladimir Oltean
There are very good reasons to want this (see documentation reference to
br_if.c), and there are also very good reasons for not enabling it by default. So a devlink param namedbest_effort_vlan_filtering, currently driver-specific and exported only by sja1105, is used to configure this.In practice, this is perhaps the way that most users are going to use the switch in. Best-effort untagged traffic can be bridged with any net device in the system or terminated locally, and VLAN-tagged streams are forwarded autonomously in a time-sensitive manner according to their PCP (they need not transit the CPU). For those cases where the CPU needs to terminate some VLAN-tagged traffic, using the DSA master is still an option.
A complication while implementing this was the fact that
__netif_receive_skb_corecalls__vlan_hwaccel_clear_tagright before passing the skb to the DSApacket_typehandler. This means that the tagger does not see the VLAN tag in the skb, nor in the skb meta data. The patch that starting zeroing the skb VLAN tag is:commit
d4b812dea4a236f729526facf97df1a9d18e191c
Author: Eric Dumazet <[email protected]>
Date: Thu Jul 18 07:19:26 2013 -0700vlan: mask vlan prio bits
In commit
48cc32d38a52d0b68f91a171a8d00531edc6a46e("vlan: don't deliver frames for unknown vlans to protocols") Florian made sure we setpkt_typetoPACKET_OTHERHOSTif the vlan id is set and we could find a vlan device for this particular id.But we also have a problem if prio bits are set.
Steinar reported an issue on a router receiving IPv6 frames with a vlan tag of 4000 (id 0, prio 2), and tunneled into a sit device, because
skb->vlan_tciis set.Forwarded frame is completely corrupted : We can see (8100:4000) being inserted in the middle of IPv6 source address :
16:48:00.780413 IP6 2001:16d8:8100:4000:ee1c:0:9d9:bc87 > 9f94:4d95:2001:67c:29f4::: ICMP6, unknown icmp6 type (0), length 64
0x0000: 0000 0029 8000 c7c3 7103 0001 a0ae e6510x0010: 0000 0000 ccce 0b00 0000 0000 1011 12130x0020: 1415 1617 1819 1a1b 1c1d 1e1f 2021 22230x0030: 2425 2627 2829 2a2b 2c2d 2e2f 3031 3233It seems we are not really ready to properly cope with this right now.
We can probably do better in future kernels :
vlan_get_ingress_priority()should be a netdev property instead of a pervlan_devone.For stable kernels, lets clear
vlan_tcito fix the bugs.Reported-by Steinar H. Gunderson <[email protected]>Signed-off-by Eric Dumazet <[email protected]>Signed-off-by David S. Miller <[email protected]>The patch doesn't say why "we are not really ready to properly cope with this right now", and hence why the best solution is to remove the VLAN tag from skb's that don't have a local VLAN sub-interface interested in them. And I have no idea either.
But the above patch has a loophole: if the VLAN tag is not hw-accelerated, it isn't removed from the skb if there is no VLAN sub-interface interested in it (our case). So we are hooking into the .ndo_fix_features callback of the DSA master and clearing the rxvlan offload feature, so the DSA tagger will always see the VLAN as part of the skb data. This is symmetrical with the
ETH_P_DSA_8021Qcase and does not need special treatment in the tagger. But perhaps the workaround is brittle and might break if not understood well enough.The disabling of the rxvlan feature of the DSA master is unconditional. The reasoning is that at first sight, no DSA master with regular frame parsing abilities could be able to locate the VLAN tag with any of the existing taggers anyway, and therefore, adding a property in
dsa_switchto control the rxvlan feature of the master would seem like useless boilerplate.Signed-off-by Vladimir Oltean <[email protected]>---
[snip]
Quoted 9 lines
Documentation/networking/devlink-params-sja1105.txt +9
-0+best_effort_vlan_filtering + [DEVICE, DRIVER-SPECIFIC] + Allow plain ETH_P_8021Q headers to be used as DSA tags. + Benefits: + - Can terminate untagged traffic over switch net + devices even when enslaved to a bridge with + vlan_filtering=1. + - Can do QoS based on VLAN PCP for autonomously + forwarded frames.Documentation/networking/devlink-params-sja1105.txt hostprio [DEVICE, DRIVER-SPECIFIC] · line 29
Quoted 10 lines
Documentation/networking/devlink-params-sja1105.txt +10
-0+ Drawbacks: + - User cannot change pvid via 'bridge' commands. This + would break source port identification on RX for + untagged traffic. + - User cannot use VLANs in range 1024-3071. If the + switch receives frames with such VIDs, it will + misinterpret them as DSA tags. + - Cannot terminate VLAN-tagged traffic on local device. + There is no way to deduce the source port from these. + One could still use the DSA master though.
Quoted 7 lines
Could we use QinQ to possibly solve these problems and would that work for your switch? I do not really mind being restricted to not being able to change the
default_pvidor have a reduced VLAN range, but being able to test VLAN tags terminated on DSA slave network devices is a valuable thing to do.
--
Florian
Hi Florian,
Unfortunately the sja1105 supports only detecting double-tagged frames. It doesn't have the concept of pushing/popping an S-tag on top of frames detected as having a C-tag. A workaround would be to lie to it about the C-tag EtherType, so it will push an S-tag unconditionally (thinking VLAN-tagged frames are untagged, therefore pushing the 802.1ad pvid), but then you lose VLAN filtering based on the C-tag. To be fair I don't completely understand the Linux abstraction of a bridge with vlan_protocol 802.1ad either. It seems to me like such a bridge would ignore the C-tag and treat those frames as untagged, basically operating only at the S-tag level very similar to the workaround I would have to do in sja1105. But a correct implementation would have to do VLAN filtering based on the C-tag, and _in addition_ push an 802.1ad unique pvid (C-tag).
But I digress. The sja1105 doesn't support stacked VLANs so that is part of the reason why I made dsa_8021q more flexible (just functions that can be called from other drivers/taggers) and less tied to sja1105. I would be happy to see this tagger getting used with stacked VLANs as long as the hardware permits it.
Hope this helps,
-Vladimir
Vladimir Oltean
maintainerQuoted 5 lines · Florian Fainelli
On 11/17/2019 1:14 PM, Vladimir Oltean wrote:
[snip]Quoted 1 line
+best_effort_vlan_filtering
[snip]
Quoted 11 lines
Documentation/networking/devlink-params-sja1105.txt hostprio [DEVICE, DRIVER-SPECIFIC] · line 29
Quoted 3 lines
Documentation/networking/devlink-params-sja1105.txt +3
-0+ - Cannot terminate VLAN-tagged traffic on local device. + There is no way to deduce the source port from these. + One could still use the DSA master though.Could we use QinQ to possibly solve these problems and would that work for your switch? I do not really mind being restricted to not being able to change the
default_pvidor have a reduced VLAN range, but being able to test VLAN tags terminated on DSA slave network devices is a valuable thing to do.
--
Florian
I took another look at the hardware manual and there exists a feature called the Retagging Table whose purpose I did not understand originally. It can do classification on frames with a given { ingress port mask, egress port mask, vlan id }, and clone them towards a given list of destination ports with a new VID. The table only has space for 32 entries though. I think I can use it to keep the CPU copied to all non-pvid VLANs received on the front-panel ports. The CPU will still see a pvid-tagged frame for each of those, but with the PCP from the original frame. The result is that VLAN filtering is still performed correctly (non-member VIDs of the front-panel ports are dropped), but the tag is consumed by DSA and sockets still see those frames as untagged. To me that's fine except for the fact that the CPU will now be spammed by offloaded flows even if the switch learns the destination to be a front-panel. Just wanted to hear your opinion before attempting to prototype this.
Thanks,
-Vladimir
Quoted 21 lines · Vladimir Oltean
Quoted 5 lines · Florian Fainelli
On 11/17/2019 1:14 PM, Vladimir Oltean wrote:
[snip]Quoted 1 line
+best_effort_vlan_filtering
[snip]
Quoted 11 lines
Documentation/networking/devlink-params-sja1105.txt hostprio [DEVICE, DRIVER-SPECIFIC] · line 29
Quoted 3 lines
Documentation/networking/devlink-params-sja1105.txt +3
-0+ - Cannot terminate VLAN-tagged traffic on local device. + There is no way to deduce the source port from these. + One could still use the DSA master though.Could we use QinQ to possibly solve these problems and would that work for your switch? I do not really mind being restricted to not being able to change the
default_pvidor have a reduced VLAN range, but being able to test VLAN tags terminated on DSA slave network devices is a valuable thing to do.
--
Florian
Quoted 15 lines
I took another look at the hardware manual and there exists a feature called the Retagging Table whose purpose I did not understand originally. It can do classification on frames with a given { ingress port mask, egress port mask, vlan id }, and clone them towards a given list of destination ports with a new VID. The table only has space for 32 entries though. I think I can use it to keep the CPU copied to all non-pvid VLANs received on the front-panel ports. The CPU will still see a pvid-tagged frame for each of those, but with the PCP from the original frame. The result is that VLAN filtering is still performed correctly (non-member VIDs of the front-panel ports are dropped), but the tag is consumed by DSA and sockets still see those frames as untagged. To me that's fine except for the fact that the CPU will now be spammed by offloaded flows even if the switch learns the destination to be a front-panel. Just wanted to hear your opinion before attempting to prototype this.
That seems like a good idea to me. Back to your RFC patch here, instead of introducing a "best effort vlan filtering" configuration knob, how about just restricting the possible VID range when vlan_filtering=1 through the port_vlan_prepare() callback to exclude the problematic dsa_tag_8021q VID ranges used for port discrimination?
Signature · 1 line
Florian
Vladimir Oltean
maintainerQuoted 39 lines · Florian Fainelli
Quoted 21 lines · Vladimir Oltean
Quoted 5 lines · Florian Fainelli
On 11/17/2019 1:14 PM, Vladimir Oltean wrote:
[snip]Quoted 1 line
+best_effort_vlan_filtering
[snip]
Quoted 11 lines
Documentation/networking/devlink-params-sja1105.txt hostprio [DEVICE, DRIVER-SPECIFIC] · line 29
Quoted 3 lines
Documentation/networking/devlink-params-sja1105.txt +3
-0+ - Cannot terminate VLAN-tagged traffic on local device. + There is no way to deduce the source port from these. + One could still use the DSA master though.Could we use QinQ to possibly solve these problems and would that work for your switch? I do not really mind being restricted to not being able to change the
default_pvidor have a reduced VLAN range, but being able to test VLAN tags terminated on DSA slave network devices is a valuable thing to do.
--
FlorianQuoted 15 lines
I took another look at the hardware manual and there exists a feature called the Retagging Table whose purpose I did not understand originally. It can do classification on frames with a given { ingress port mask, egress port mask, vlan id }, and clone them towards a given list of destination ports with a new VID. The table only has space for 32 entries though. I think I can use it to keep the CPU copied to all non-pvid VLANs received on the front-panel ports. The CPU will still see a pvid-tagged frame for each of those, but with the PCP from the original frame. The result is that VLAN filtering is still performed correctly (non-member VIDs of the front-panel ports are dropped), but the tag is consumed by DSA and sockets still see those frames as untagged. To me that's fine except for the fact that the CPU will now be spammed by offloaded flows even if the switch learns the destination to be a front-panel. Just wanted to hear your opinion before attempting to prototype this.
Quoted 7 lines
That seems like a good idea to me. Back to your RFC patch here, instead of introducing a "best effort vlan filtering" configuration knob, how about just restricting the possible VID range when vlan_filtering=1 through the
port_vlan_prepare()callback to exclude the problematicdsa_tag_8021qVID ranges used for port discrimination?
--
Florian
Ugh. I'll have to think about that. The "best effort" vlan_filtering is a good enough approximation for probably lots of use cases, but if you just want STP and PTP on your switch (aka traffic that this switch doesn't need VLANs to decode) and you otherwise need the more advanced VLAN features (your own pvid, more than 32 VLANs, independent VLAN learning), then plain vlan_filtering is clearly the better option and the "best effort" compromises only bring insanity to it.
By the way, I _think_ it's actually possible to retag frames towards the CPU without even creating clones, but this is very poorly documented. I really need to experiment a bit.
Thanks,
-Vladimir