Re: [PATCH v3 net-next 16/24] net: dsa: sja1105: Add support for VLAN operations

From: Vladimir Oltean
Date: Sat Apr 13 2019 - 17:40:16 EST


On Sat, 13 Apr 2019 at 23:56, Jiri Pirko <jiri@xxxxxxxxxxx> wrote:
>
> Sat, Apr 13, 2019 at 03:28:14AM CEST, olteanv@xxxxxxxxx wrote:
> >VLAN filtering cannot be properly disabled in SJA1105. So in order to
> >emulate the "no VLAN awareness" behavior (not dropping traffic that is
> >tagged with a VID that isn't configured on the port), we need to hack
> >another switch feature: programmable TPID (which is 0x8100 for 802.1Q).
> >We are reprogramming the TPID to a bogus value (ETH_P_EDSA) which leaves
> >the switch thinking that all traffic is untagged, and therefore accepts
> >it.
> >
> >Under a vlan_filtering bridge, the proper TPID of ETH_P_8021Q is
> >installed again, and the switch starts identifying 802.1Q-tagged
> >traffic.
> >
> >Signed-off-by: Vladimir Oltean <olteanv@xxxxxxxxx>
> >Reviewed-by: Florian Fainelli <f.fainelli@xxxxxxxxx>
> >---
> >Changes from v3:
> >Changed back to ETH_P_EDSA.
> >
> >Changes from v2:
> >Changed the TPID from ETH_P_EDSA (0xDADA) to a newly introduced one:
> >ETH_P_DSA_8021Q (0xDADB).
> >
> > drivers/net/dsa/sja1105/sja1105_main.c | 254 +++++++++++++++++-
> > .../net/dsa/sja1105/sja1105_static_config.c | 38 +++
> > .../net/dsa/sja1105/sja1105_static_config.h | 3 +
> > 3 files changed, 293 insertions(+), 2 deletions(-)
> >
>
> [...]
>
>
> >+#define sja1105_vlan_filtering_enabled(priv) \
> >+ (((struct sja1105_general_params_entry *) \
> >+ ((struct sja1105_private *)priv)->static_config. \
> >+ tables[BLK_IDX_GENERAL_PARAMS].entries)->tpid == ETH_P_8021Q)
>
> This is unreadable. Please have it as function.
>

I admit to that. If I reach to a consensus with Andrew on 12/24
ideally I could just say cpu_dp->vlan_filtering.

Thanks,
-Vladimir