• Linus Walleij's avatar
    net: dsa: rtl8366rb: Rewrite weird VLAN filering enablement · a4eff910
    Linus Walleij authored
    While we were defining one VLAN per port for isolating the ports
    the port_vlan_filtering() callback was implemented to enable a
    VLAN on the port + 1. This function makes no sense, not only is
    it incomplete as it only enables the VLAN, it doesn't do what
    the callback is supposed to do, which is to selectively enable
    and disable filtering on a certain port.
    
    Implement the correct callback: we have two registers dealing
    with filtering on the RTL9366RB, so we implement an ASIC-specific
    callback and implement filering using the register bit that makes
    the switch drop frames if the port is not in the VLAN member set.
    
    The DSA documentation Documentation/networking/switchdev.rst states:
    
      When the bridge has VLAN filtering enabled and a PVID is not
      configured on the ingress port, untagged and 802.1p tagged
      packets must be dropped. When the bridge has VLAN filtering
      enabled and a PVID exists on the ingress port, untagged and
      priority-tagged packets must be accepted and forwarded according
      to the bridge's port membership of the PVID VLAN. When the
      bridge has VLAN filtering disabled, the presence/lack of a
      PVID should not influence the packet forwarding decision.
    
    To comply with this, we add two arrays of bool in the RTL8366RB
    state that keeps track of if filtering and PVID is enabled or
    not for each port. We then add code such that whenever filtering
    or PVID changes, we update the filter according to the
    specification.
    
    Cc: Vladimir Oltean <olteanv@gmail.com>
    Cc: Mauri Sandberg <sandberg@mailfence.com>
    Cc: Alvin Šipraga <alsi@bang-olufsen.dk>
    Cc: Florian Fainelli <f.fainelli@gmail.com>
    Cc: DENG Qingfang <dqfext@gmail.com>
    Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    a4eff910
rtl8366rb.c 51.1 KB