1. 09 10月, 2021 1 次提交
    • V
      net: dsa: mv88e6xxx: keep the pvid at 0 when VLAN-unaware · 8b6836d8
      Vladimir Oltean 提交于
      The VLAN support in mv88e6xxx has a loaded history. Commit 2ea7a679
      ("net: dsa: Don't add vlans when vlan filtering is disabled") noticed
      some issues with VLAN and decided the best way to deal with them was to
      make the DSA core ignore VLANs added by the bridge while VLAN awareness
      is turned off. Those issues were never explained, just presented as
      "at least one corner case".
      
      That approach had problems of its own, presented by
      commit 54a0ed0d ("net: dsa: provide an option for drivers to always
      receive bridge VLANs") for the DSA core, followed by
      commit 1fb74191 ("net: dsa: mv88e6xxx: fix vlan setup") which
      applied ds->configure_vlan_while_not_filtering = true for mv88e6xxx in
      particular.
      
      We still don't know what corner case Andrew saw when he wrote
      commit 2ea7a679 ("net: dsa: Don't add vlans when vlan filtering is
      disabled"), but Tobias now reports that when we use TX forwarding
      offload, pinging an external station from the bridge device is broken if
      the front-facing DSA user port has flooding turned off. The full
      description is in the link below, but for short, when a mv88e6xxx port
      is under a VLAN-unaware bridge, it inherits that bridge's pvid.
      So packets ingressing a user port will be classified to e.g. VID 1
      (assuming that value for the bridge_default_pvid), whereas when
      tag_dsa.c xmits towards a user port, it always sends packets using a VID
      of 0 if that port is standalone or under a VLAN-unaware bridge - or at
      least it did so prior to commit d82f8ab0 ("net: dsa: tag_dsa:
      offload the bridge forwarding process").
      
      In any case, when there is a conversation between the CPU and a station
      connected to a user port, the station's MAC address is learned in VID 1
      but the CPU tries to transmit through VID 0. The packets reach the
      intended station, but via flooding and not by virtue of matching the
      existing ATU entry.
      
      DSA has established (and enforced in other drivers: sja1105, felix,
      mt7530) that a VLAN-unaware port should use a private pvid, and not
      inherit the one from the bridge. The bridge's pvid should only be
      inherited when that bridge is VLAN-aware, so all state transitions need
      to be handled. On the other hand, all bridge VLANs should sit in the VTU
      starting with the moment when the bridge offloads them via switchdev,
      they are just not used.
      
      This solves the problem that Tobias sees because packets ingressing on
      VLAN-unaware user ports now get classified to VID 0, which is also the
      VID used by tag_dsa.c on xmit.
      
      Fixes: d82f8ab0 ("net: dsa: tag_dsa: offload the bridge forwarding process")
      Link: https://patchwork.kernel.org/project/netdevbpf/patch/20211003222312.284175-2-vladimir.oltean@nxp.com/#24491503Reported-by: NTobias Waldekranz <tobias@waldekranz.com>
      Signed-off-by: NVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      8b6836d8
  2. 19 3月, 2021 1 次提交
  3. 18 3月, 2021 2 次提交
    • M
      net: dsa: mv88e6xxx: implement .port_set_policy for Amethyst · 6584b260
      Marek Behún 提交于
      The 16-bit Port Policy CTL register from older chips is on 6393x changed
      to Port Policy MGMT CTL, which can access more data, but indirectly and
      via 8-bit registers.
      
      The original 16-bit value is divided into first two 8-bit register in
      the Port Policy MGMT CTL.
      
      We can therefore use the previous code to compute the mask and shift,
      and then
      - if 0 <= shift < 8, we access register 0 in Port Policy MGMT CTL
      - if 8 <= shift < 16, we access register 1 in Port Policy MGMT CTL
      
      There are in fact other possible policy settings for Amethyst which
      could be added here, but this can be done in the future.
      Signed-off-by: NMarek Behún <kabel@kernel.org>
      Reviewed-by: NPavana Sharma <pavana.sharma@digi.com>
      Reviewed-by: NVladimir Oltean <olteanv@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      6584b260
    • P
      net: dsa: mv88e6xxx: add support for mv88e6393x family · de776d0d
      Pavana Sharma 提交于
      The Marvell 88E6393X device is a single-chip integration of a 11-port
      Ethernet switch with eight integrated Gigabit Ethernet (GbE)
      transceivers and three 10-Gigabit interfaces.
      
      This patch adds functionalities specific to mv88e6393x family (88E6393X,
      88E6193X and 88E6191X).
      
      The main differences between previous devices and this one are:
      - port 0 can be a SERDES port
      - all SERDESes are one-lane, eg. no XAUI nor RXAUI
      - on the other hand the SERDESes can do USXGMII, 10GBASER and 5GBASER
        (on 6191X only one SERDES is capable of more than 1g; USXGMII is not
        yet supported with this change)
      - Port Policy CTL register is changed to Port Policy MGMT CTL register,
        via which several more registers can be accessed indirectly
      - egress monitor port is configured differently
      - ingress monitor/CPU/mirror ports are configured differently and can be
        configured per port (ie. each port can have different ingress monitor
        port, for example)
      - port speed AltBit works differently than previously
      - PHY registers can be also accessed via MDIO address 0x18 and 0x19
        (on previous devices they could be accessed only via Global 2 offsets
         0x18 and 0x19, which means two indirections; this feature is not yet
         leveraged with thiis commit)
      Co-developed-by: NAshkan Boldaji <ashkan.boldaji@digi.com>
      Signed-off-by: NAshkan Boldaji <ashkan.boldaji@digi.com>
      Signed-off-by: NPavana Sharma <pavana.sharma@digi.com>
      Co-developed-by: NMarek Behún <kabel@kernel.org>
      Signed-off-by: NMarek Behún <kabel@kernel.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      de776d0d
  4. 13 2月, 2021 1 次提交
    • V
      net: dsa: act as passthrough for bridge port flags · a8b659e7
      Vladimir Oltean 提交于
      There are multiple ways in which a PORT_BRIDGE_FLAGS attribute can be
      expressed by the bridge through switchdev, and not all of them can be
      emulated by DSA mid-layer API at the same time.
      
      One possible configuration is when the bridge offloads the port flags
      using a mask that has a single bit set - therefore only one feature
      should change. However, DSA currently groups together unicast and
      multicast flooding in the .port_egress_floods method, which limits our
      options when we try to add support for turning off broadcast flooding:
      do we extend .port_egress_floods with a third parameter which b53 and
      mv88e6xxx will ignore? But that means that the DSA layer, which
      currently implements the PRE_BRIDGE_FLAGS attribute all by itself, will
      see that .port_egress_floods is implemented, and will report that all 3
      types of flooding are supported - not necessarily true.
      
      Another configuration is when the user specifies more than one flag at
      the same time, in the same netlink message. If we were to create one
      individual function per offloadable bridge port flag, we would limit the
      expressiveness of the switch driver of refusing certain combinations of
      flag values. For example, a switch may not have an explicit knob for
      flooding of unknown multicast, just for flooding in general. In that
      case, the only correct thing to do is to allow changes to BR_FLOOD and
      BR_MCAST_FLOOD in tandem, and never allow mismatched values. But having
      a separate .port_set_unicast_flood and .port_set_multicast_flood would
      not allow the driver to possibly reject that.
      
      Also, DSA doesn't consider it necessary to inform the driver that a
      SWITCHDEV_ATTR_ID_BRIDGE_MROUTER attribute was offloaded, because it
      just calls .port_egress_floods for the CPU port. When we'll add support
      for the plain SWITCHDEV_ATTR_ID_PORT_MROUTER, that will become a real
      problem because the flood settings will need to be held statefully in
      the DSA middle layer, otherwise changing the mrouter port attribute will
      impact the flooding attribute. And that's _assuming_ that the underlying
      hardware doesn't have anything else to do when a multicast router
      attaches to a port than flood unknown traffic to it.  If it does, there
      will need to be a dedicated .port_set_mrouter anyway.
      
      So we need to let the DSA drivers see the exact form that the bridge
      passes this switchdev attribute in, otherwise we are standing in the
      way. Therefore we also need to use this form of language when
      communicating to the driver that it needs to configure its initial
      (before bridge join) and final (after bridge leave) port flags.
      
      The b53 and mv88e6xxx drivers are converted to the passthrough API and
      their implementation of .port_egress_floods is split into two: a
      function that configures unicast flooding and another for multicast.
      The mv88e6xxx implementation is quite hairy, and it turns out that
      the implementations of unknown unicast flooding are actually the same
      for 6185 and for 6352:
      
      behind the confusing names actually lie two individual bits:
      NO_UNKNOWN_MC -> FLOOD_UC = 0x4 = BIT(2)
      NO_UNKNOWN_UC -> FLOOD_MC = 0x8 = BIT(3)
      
      so there was no reason to entangle them in the first place.
      
      Whereas the 6185 writes to MV88E6185_PORT_CTL0_FORWARD_UNKNOWN of
      PORT_CTL0, which has the exact same bit index. I have left the
      implementations separate though, for the only reason that the names are
      different enough to confuse me, since I am not able to double-check with
      a user manual. The multicast flooding setting for 6185 is in a different
      register than for 6352 though.
      Signed-off-by: NVladimir Oltean <vladimir.oltean@nxp.com>
      Reviewed-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      a8b659e7
  5. 15 1月, 2021 1 次提交
  6. 26 11月, 2020 1 次提交
  7. 16 3月, 2020 2 次提交
  8. 12 11月, 2019 1 次提交
  9. 10 9月, 2019 1 次提交
  10. 30 8月, 2019 1 次提交
  11. 28 8月, 2019 3 次提交
  12. 17 8月, 2019 1 次提交
    • M
      net: dsa: mv88e6xxx: check for mode change in port_setup_mac · 927441ad
      Marek Behún 提交于
      The mv88e6xxx_port_setup_mac checks if the requested MAC settings are
      different from the current ones, and if not, does nothing (since chaning
      them requires putting the link down).
      
      In this check it only looks if the triplet [link, speed, duplex] is
      being changed.
      
      This patch adds support to also check if the mode parameter (of type
      phy_interface_t) is requested to be changed. The current mode is
      computed by the ->port_link_state() method, and if it is different from
      PHY_INTERFACE_MODE_NA, we check for equality with the requested mode.
      
      In the implementations of the mv88e6250_port_link_state() method we set
      the current mode to PHY_INTERFACE_MODE_NA - so the code does not check
      for mode change on 6250.
      
      In the mv88e6352_port_link_state() method, we use the cached cmode of
      the port to determine the mode as phy_interface_t (and if it is not
      enough, eg. for RGMII, we also look at the port control register for
      RX/TX timings).
      Signed-off-by: NMarek Behún <marek.behun@nic.cz>
      Reviewed-by: NAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      927441ad
  13. 03 8月, 2019 1 次提交
  14. 05 6月, 2019 3 次提交
    • R
      net: dsa: mv88e6xxx: add support for mv88e6250 · 1f71836f
      Rasmus Villemoes 提交于
      This adds support for the Marvell 88E6250. I've checked that each
      member in the ops-structure makes sense, and basic switchdev
      functionality works fine.
      
      It uses the new dual_chip option, and since its port registers start
      at SMI address 0x08 or 0x18 (i.e., always sw_addr + 0x08), we need to
      introduce a new compatible string in order for the auto-identification
      in mv88e6xxx_detect() to work.
      
      The chip has four per port 16-bits statistics registers, two of which
      correspond to the existing "sw_in_filtered" and "sw_out_filtered" (but
      at offsets 0x13 and 0x10 rather than 0x12 and 0x13, because why should
      this be easy...). Wiring up those four statistics seems to require
      introducing a STATS_TYPE_PORT_6250 bit or similar, which seems a tad
      ugly, so for now this just allows access to the STATS_TYPE_BANK0 ones.
      
      The chip does have ptp support, and the existing
      mv88e6352_{gpio,avb,ptp}_ops at first glance seem like they would work
      out-of-the-box, but for simplicity (and lack of testing) I'm eliding
      this.
      Reviewed-by: NAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: NRasmus Villemoes <rasmus.villemoes@prevas.dk>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      1f71836f
    • R
      net: dsa: mv88e6xxx: implement port_link_state for mv88e6250 · ce91c453
      Rasmus Villemoes 提交于
      The mv88e6250 has a rather different way of reporting the link, speed
      and duplex status. A simple difference is that the link bit is bit 12
      rather than bit 11 of the port status register.
      
      It gets more complicated for speed and duplex, which do not have
      separate fields. Instead, there's a four-bit PortMode field, and
      decoding that depends on whether it's a phy or mii port. For the phy
      ports, only four of the 16 values have defined meaning; the rest are
      called "reserved", so returning {SPEED,DUPLEX}_UNKNOWN seems
      reasonable.
      
      For the mii ports, most possible values are documented (0x3 and 0x5
      are reserved), but I'm unable to make sense of them all. Since the
      bits simply reflect the Px_MODE[3:0] configuration pins, just support
      the subset that I'm certain about. Support for other setups can be
      added later.
      Reviewed-by: NAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: NRasmus Villemoes <rasmus.villemoes@prevas.dk>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      ce91c453
    • R
      net: dsa: mv88e6xxx: implement port_set_speed for mv88e6250 · a528e5be
      Rasmus Villemoes 提交于
      The data sheet also mentions the possibility of selecting 200 Mbps for
      the MII ports (ports 5 and 6) by setting the ForceSpd field to
      0x2 (aka MV88E6065_PORT_MAC_CTL_SPEED_200). However, there's a note
      that "actual speed is determined by bit 8 above", and flipping back a
      page, one finds that bits 13:8 are reserved...
      
      So without further information on what bit 8 means, let's stick to
      supporting just 10 and 100 Mbps on all ports.
      Reviewed-by: NAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: NRasmus Villemoes <rasmus.villemoes@prevas.dk>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      a528e5be
  15. 31 5月, 2019 1 次提交
  16. 28 3月, 2019 1 次提交
  17. 09 3月, 2019 1 次提交
  18. 02 3月, 2019 1 次提交
    • H
      net: dsa: mv88e6xxx: prevent interrupt storm caused by mv88e6390x_port_set_cmode · ed8fe202
      Heiner Kallweit 提交于
      When debugging another issue I faced an interrupt storm in this
      driver (88E6390, port 9 in SGMII mode), consisting of alternating
      link-up / link-down interrupts. Analysis showed that the driver
      wanted to set a cmode that was set already. But so far
      mv88e6390x_port_set_cmode() doesn't check this and powers down
      SERDES, what causes the link to break, and eventually results in
      the described interrupt storm.
      
      Fix this by checking whether the cmode actually changes. We want
      that the very first call to mv88e6390x_port_set_cmode() always
      configures the registers, therefore initialize port.cmode with
      a value that is different from any supported cmode value.
      We have to take care that we only init the ports cmode once
      chip->info->num_ports is set.
      
      v2:
      - add small helper and init the number of actual ports only
      
      Fixes: 364e9d77 ("net: dsa: mv88e6xxx: Power on/off SERDES on cmode change")
      Signed-off-by: NHeiner Kallweit <hkallweit1@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      ed8fe202
  19. 11 1月, 2019 1 次提交
  20. 12 11月, 2018 1 次提交
  21. 18 10月, 2018 1 次提交
  22. 10 8月, 2018 3 次提交
  23. 12 5月, 2018 1 次提交
  24. 02 8月, 2017 1 次提交
  25. 19 7月, 2017 2 次提交
  26. 21 6月, 2017 1 次提交
  27. 13 6月, 2017 5 次提交