• Vladimir Oltean's avatar
    net: dsa: sja1105: deny alterations of dsa_8021q VLANs from the bridge · 60b33aeb
    Vladimir Oltean authored
    At the moment, this can never happen. The 2 modes that we operate in do
    not permit that:
    
     - SJA1105_VLAN_UNAWARE: we are guarded from bridge VLANs added by the
       user by the DSA core. We will later lift this restriction by setting
       ds->vlan_bridge_vtu = true, and that is where we'll need it.
    
     - SJA1105_VLAN_FILTERING_FULL: in this mode, dsa_8021q configuration is
       disabled. So the user is free to add these VLANs in the 1024-3071
       range.
    
    The reason for the patch is that we'll introduce a third VLAN awareness
    state, where both dsa_8021q as well as the bridge are going to call our
    .port_vlan_add and .port_vlan_del methods.
    
    For that, we need a good way to discriminate between the 2. The easiest
    (and less intrusive way for upper layers) is to recognize the fact that
    dsa_8021q configurations are always driven by our driver - we _know_
    when a .port_vlan_add method will be called from dsa_8021q because _we_
    initiated it.
    
    So introduce an expect_dsa_8021q boolean which is only used, at the
    moment, for blacklisting VLANs in range 1024-3071 in the modes when
    dsa_8021q is active.
    Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
    Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    60b33aeb
sja1105_main.c 76.6 KB