1. 20 Apr, 2020 17 commits
  2. 19 Apr, 2020 21 commits
  3. 18 Apr, 2020 2 commits
    • Vladimir Oltean's avatar
      enetc: permit configuration of rx-vlan-filter with ethtool · 7070eea5
      Vladimir Oltean authored
      Each ENETC station interface (SI) has a VLAN filter list and a port
      flag (PSIPVMR) by which it can be put in "VLAN promiscuous" mode, which
      enables the reception of VLAN-tagged traffic even if it is not in the
      VLAN filtering list.
      
      Currently the handling of this setting works like this: the port starts
      off as VLAN promiscuous, then it switches to enabling VLAN filtering as
      soon as the first VLAN is installed in its filter via
      .ndo_vlan_rx_add_vid. In practice that does not work out very well,
      because more often than not, the first VLAN to be installed is out of
      the control of the user: the 8021q module, if loaded, adds its rule for
      802.1p (VID 0) traffic upon bringing the interface up.
      
      What the user is currently seeing in ethtool is this:
      ethtool -k eno2
      rx-vlan-filter: on [fixed]
      
      which doesn't match the intention of the code, but the practical reality
      of having the 8021q module install its VID which has the side-effect of
      turning on VLAN filtering in this driver. All in all, a slightly
      confusing experience.
      
      So instead of letting this driver switch the VLAN filtering state by
      itself, just wire it up with the rx-vlan-filter feature from ethtool,
      and let it be user-configurable just through that knob, except for one
      case, see below.
      
      In promiscuous mode, it is more intuitive that all traffic is received,
      including VLAN tagged traffic. It appears that it is necessary to set
      the flag in PSIPVMR for that to be the case, so VLAN promiscuous mode is
      also temporarily enabled. On exit from promiscuous mode, the setting
      made by ethtool is restored.
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Reviewed-by: default avatarClaudiu Manoil <claudiu.manoil@nxp.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      7070eea5
    • Vladimir Oltean's avatar
      net: mscc: ocelot: deal with problematic MAC_ETYPE VCAP IS2 rules · 89f9ffd3
      Vladimir Oltean authored
      By default, the VCAP IS2 will produce a single match for each frame, on
      the most specific classification.
      
      Example: a ping packet (ICMP over IPv4 over Ethernet) sent from an IP
      address of 10.0.0.1 and a MAC address of 96:18:82:00:04:01 will match
      this rule:
      
      tc filter add dev swp0 ingress protocol ipv4 \
      	flower skip_sw src_ip 10.0.0.1 action drop
      
      but not this one:
      
      tc filter add dev swp0 ingress \
      	flower skip_sw src_mac 96:18:82:00:04:01 action drop
      
      Currently the driver does not really warn the user in any way about
      this, and the behavior is rather strange anyway.
      
      The current patch is a workaround to force matches on MAC_ETYPE keys
      (DMAC and SMAC) for all packets irrespective of higher layer protocol.
      The setting is made at the port level.
      
      Of course this breaks all other non-src_mac and non-dst_mac matches, so
      rule exclusivity checks have been added to the driver, in order to never
      have rules of both types on any ingress port.
      
      The bits that discard higher-level protocol information are set only
      once a MAC_ETYPE rule is added to a filter block, and only for the ports
      that are bound to that filter block. Then all further non-MAC_ETYPE
      rules added to that filter block should be denied by the ports bound to
      it.
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      89f9ffd3