1. 18 5月, 2022 3 次提交
  2. 17 5月, 2022 1 次提交
  3. 13 5月, 2022 9 次提交
    • V
      net: mscc: ocelot: move ocelot_port_private :: chip_port to ocelot_port :: index · 7e708760
      Vladimir Oltean 提交于
      Currently the ocelot switch lib is unaware of the index of a struct
      ocelot_port, since that is kept in the encapsulating structures of outer
      drivers (struct dsa_port :: index, struct ocelot_port_private :: chip_port).
      
      With the upcoming increase in complexity associated with assigning DSA
      tag_8021q CPU ports to certain user ports, it becomes necessary for the
      switch lib to be able to retrieve the index of a certain ocelot_port.
      
      Therefore, introduce a new u8 to ocelot_port (same size as the chip_port
      used by the ocelot switchdev driver) and rework the existing code to
      populate and use it.
      Signed-off-by: NVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      7e708760
    • V
      net: dsa: felix: reimplement tagging protocol change with function pointers · 7a29d220
      Vladimir Oltean 提交于
      The error handling for the current tagging protocol change procedure is
      a bit brittle (we dismantle the previous tagging protocol entirely
      before setting up the new one). By identifying which parts of a tagging
      protocol are unique to itself and which parts are shared with the other,
      we can implement a protocol change procedure where error handling is a
      bit more robust, because we start setting up the new protocol first, and
      tear down the old one only after the setup of the specific and shared
      parts succeeded.
      
      The protocol change is a bit too open-coded too, in the area of
      migrating host flood settings and MDBs. By identifying what differs
      between tagging protocols (the forwarding masks for host flooding) we
      can implement a more straightforward migration procedure which is
      handled in the shared portion of the protocol change, rather than
      individually by each protocol.
      
      Therefore, a more structured approach calls for the introduction of a
      structure of function pointers per tagging protocol. This covers setup,
      teardown and the host forwarding mask. In the future it will also cover
      how to prepare for a new DSA master.
      
      The initial tagging protocol setup (at driver probe time) and the final
      teardown (at driver removal time) are also adapted to call into the
      structured methods of the specific protocol in current use. This is
      especially relevant for teardown, where we previously called
      felix_del_tag_protocol() only for the first CPU port. But by not
      specifying which CPU port this is for, we gain more flexibility to
      support multiple CPU ports in the future.
      Signed-off-by: NVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      7a29d220
    • V
      net: dsa: felix: dynamically determine tag_8021q CPU port for traps · c352e5e8
      Vladimir Oltean 提交于
      Ocelot switches support a single active CPU port at a time (at least as
      a trapping destination, i.e. for control traffic). This is true
      regardless of whether we are using the native copy-to-CPU-port-module
      functionality, or a redirect action towards the software-defined
      tag_8021q CPU port.
      
      Currently we assume that the trapping destination in tag_8021q mode is
      the first CPU port, yet in the future we may want to migrate the user
      ports to the second CPU port.
      
      For that to work, we need to make sure that the tag_8021q trapping
      destination is a CPU port that is active, i.e. is used by at least some
      user port on which the trap was added. Otherwise, we may end up
      redirecting the traffic to a CPU port which isn't even up.
      
      Note that due to the current design where we simply choose the CPU port
      of the first port from the trap's ingress port mask, it may be that a
      CPU port absorbes control traffic from user ports which aren't affine to
      it as per user space's request. This isn't ideal, but is the lesser of
      two evils. Following the user-configured affinity for traps would mean
      that we can no longer reuse a single TCAM entry for multiple traps,
      which is what we actually do for e.g. PTP. Either we duplicate and
      deduplicate TCAM entries on the fly when user-to-CPU-port mappings
      change (which is unnecessarily complicated), or we redirect trapped
      traffic to all tag_8021q CPU ports if multiple such ports are in use.
      The latter would have actually been nice, if it actually worked, but it
      doesn't, since a OCELOT_MASK_MODE_REDIRECT action towards multiple ports
      would not take PGID_SRC into consideration, and it would just duplicate
      the packet towards each (CPU) port, leading to duplicates in software.
      Signed-off-by: NVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      c352e5e8
    • V
      net: dsa: remove port argument from ->change_tag_protocol() · bacf93b0
      Vladimir Oltean 提交于
      DSA has not supported (and probably will not support in the future
      either) independent tagging protocols per CPU port.
      
      Different switch drivers have different requirements, some may need to
      replicate some settings for each CPU port, some may need to apply some
      settings on a single CPU port, while some may have to configure some
      global settings and then some per-CPU-port settings.
      
      In any case, the current model where DSA calls ->change_tag_protocol for
      each CPU port turns out to be impractical for drivers where there are
      global things to be done. For example, felix calls dsa_tag_8021q_register(),
      which makes no sense per CPU port, so it suppresses the second call.
      
      Let drivers deal with replication towards all CPU ports, and remove the
      CPU port argument from the function prototype.
      Signed-off-by: NVladimir Oltean <vladimir.oltean@nxp.com>
      Acked-by: NLuiz Angelo Daros de Luca <luizluca@gmail.com>
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      bacf93b0
    • V
      net: dsa: felix: manage host flooding using a specific driver callback · 72c3b0c7
      Vladimir Oltean 提交于
      At the time - commit 7569459a ("net: dsa: manage flooding on the CPU
      ports") - not introducing a dedicated switch callback for host flooding
      made sense, because for the only user, the felix driver, there was
      nothing different to do for the CPU port than set the flood flags on the
      CPU port just like on any other bridge port.
      
      There are 2 reasons why this approach is not good enough, however.
      
      (1) Other drivers, like sja1105, support configuring flooding as a
          function of {ingress port, egress port}, whereas the DSA
          ->port_bridge_flags() function only operates on an egress port.
          So with that driver we'd have useless host flooding from user ports
          which don't need it.
      
      (2) Even with the felix driver, support for multiple CPU ports makes it
          difficult to piggyback on ->port_bridge_flags(). The way in which
          the felix driver is going to support host-filtered addresses with
          multiple CPU ports is that it will direct these addresses towards
          both CPU ports (in a sort of multicast fashion), then restrict the
          forwarding to only one of the two using the forwarding masks.
          Consequently, flooding will also be enabled towards both CPU ports.
          However, ->port_bridge_flags() gets passed the index of a single CPU
          port, and that leaves the flood settings out of sync between the 2
          CPU ports.
      
      This is to say, it's better to have a specific driver method for host
      flooding, which takes the user port as argument. This solves problem (1)
      by allowing the driver to do different things for different user ports,
      and problem (2) by abstracting the operation and letting the driver do
      whatever, rather than explicitly making the DSA core point to the CPU
      port it thinks needs to be touched.
      
      This new method also creates a problem, which is that cross-chip setups
      are not handled. However I don't have hardware right now where I can
      test what is the proper thing to do, and there isn't hardware compatible
      with multi-switch trees that supports host flooding. So it remains a
      problem to be tackled in the future.
      Signed-off-by: NVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      72c3b0c7
    • V
      net: dsa: felix: bring the NPI port indirection for host flooding to surface · 910ee6cc
      Vladimir Oltean 提交于
      For symmetry with host FDBs and MDBs where the indirection is now
      handled outside the ocelot switch lib, do the same for bridge port
      flags (unicast/multicast/broadcast flooding).
      
      The only caller of the ocelot switch lib which uses the NPI port is the
      Felix DSA driver.
      Signed-off-by: NVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      910ee6cc
    • V
      net: dsa: felix: bring the NPI port indirection for host MDBs to surface · 0ddf83cd
      Vladimir Oltean 提交于
      For symmetry with host FDBs where the indirection is now handled outside
      the ocelot switch lib, do the same for host MDB entries. The only caller
      of the ocelot switch lib which uses the NPI port is the Felix DSA driver.
      Signed-off-by: NVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      0ddf83cd
    • V
      net: dsa: felix: program host FDB entries towards PGID_CPU for tag_8021q too · e9b3ba43
      Vladimir Oltean 提交于
      I remembered why we had the host FDB migration procedure in place.
      
      It is true that host FDB entry migration can be done by changing the
      value of PGID_CPU, but the problem is that only host FDB entries learned
      while operating in NPI mode go to PGID_CPU. When the CPU port operates
      in tag_8021q mode, the FDB entries are learned towards the unicast PGID
      equal to the physical port number of this CPU port, bypassing the
      PGID_CPU indirection.
      
      So host FDB entries learned in tag_8021q mode are not migrated any
      longer towards the NPI port.
      
      Fix this by extracting the NPI port -> PGID_CPU redirection from the
      ocelot switch lib, moving it to the Felix DSA driver, and applying it
      for any CPU port regardless of its kind (NPI or tag_8021q).
      
      Fixes: a51c1c3f ("net: dsa: felix: stop migrating FDBs back and forth on tag proto change")
      Signed-off-by: NVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      e9b3ba43
    • F
      net: dsa: bcm_sf2: Fix Wake-on-LAN with mac_link_down() · b7be130c
      Florian Fainelli 提交于
      After commit 2d1f90f9 ("net: dsa/bcm_sf2: fix incorrect usage of
      state->link") the interface suspend path would call our mac_link_down()
      call back which would forcibly set the link down, thus preventing
      Wake-on-LAN packets from reaching our management port.
      
      Fix this by looking at whether the port is enabled for Wake-on-LAN and
      not clearing the link status in that case to let packets go through.
      
      Fixes: 2d1f90f9 ("net: dsa/bcm_sf2: fix incorrect usage of state->link")
      Signed-off-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Link: https://lore.kernel.org/r/20220512021731.2494261-1-f.fainelli@gmail.comSigned-off-by: NJakub Kicinski <kuba@kernel.org>
      b7be130c
  4. 12 5月, 2022 1 次提交
  5. 07 5月, 2022 3 次提交
    • V
      net: dsa: felix: perform MDB migration based on ocelot->multicast list · 28de0f9f
      Vladimir Oltean 提交于
      The felix driver is the only user of dsa_port_walk_mdbs(), and there
      isn't even a good reason for it, considering that the host MDB entries
      are already saved by the ocelot switch lib in the ocelot->multicast list.
      
      Rewrite the multicast entry migration procedure around the
      ocelot->multicast list so we can delete dsa_port_walk_mdbs().
      Signed-off-by: NVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      28de0f9f
    • V
      net: dsa: felix: stop migrating FDBs back and forth on tag proto change · a51c1c3f
      Vladimir Oltean 提交于
      I just realized we don't need to migrate the host-filtered FDB entries
      when the tagging protocol changes from "ocelot" to "ocelot-8021q".
      
      Host-filtered addresses are learned towards the PGID_CPU "multicast"
      port group, reserved by software, which contains BIT(ocelot->num_phys_ports).
      That is the "special" port entry in the analyzer block for the CPU port
      module.
      
      In "ocelot" mode, the CPU port module's packets are redirected to the
      NPI port.
      
      In "ocelot-8021q" mode, felix_8021q_cpu_port_init() does something funny
      anyway, and changes PGID_CPU to stop pointing at the CPU port module and
      start pointing at the physical port where the DSA master is attached.
      
      The fact that we can alter the destination of packets learned towards
      PGID_CPU without altering the MAC table entries themselves means that it
      is pointless to walk through the FDB entries, forget that they were
      learned towards PGID_CPU, and re-learn them towards the "unicast" PGID
      associated with the physical port connected to the DSA master. We can
      let the PGID_CPU value change simply alter the destination of the
      host-filtered unicast packets in one fell swoop.
      Signed-off-by: NVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      a51c1c3f
    • V
      net: dsa: felix: use PGID_CPU for FDB entry migration on NPI port · 2c110abc
      Vladimir Oltean 提交于
      ocelot_fdb_add() redirects FDB entries installed on the NPI port towards
      the special reserved PGID_CPU used for host-filtered addresses. PGID_CPU
      contains BIT(ocelot->num_phys_ports) in the destination port mask, which
      is code name for the CPU port module.
      
      Whereas felix_migrate_fdbs_to_*_port() uses the ocelot->num_phys_ports
      PGID directly, and it appears that this works too. Even if this PGID is
      set to zero, apparently its number is special and packets still reach
      the CPU port module.
      
      Nonetheless, in the end, these addresses end up in the same place
      regardless of whether they go through an extra indirection layer or not.
      Use PGID_CPU across to have more uniformity.
      Signed-off-by: NVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      2c110abc
  6. 06 5月, 2022 1 次提交
    • V
      net: mscc: ocelot: mark traps with a bool instead of keeping them in a list · e1846cff
      Vladimir Oltean 提交于
      Since the blamed commit, VCAP filters can appear on more than one list.
      If their action is "trap", they are chained on ocelot->traps via
      filter->trap_list. This is in addition to their normal placement on the
      VCAP block->rules list head.
      
      Therefore, when we free a VCAP filter, we must remove it from all lists
      it is a member of, including ocelot->traps.
      
      There are at least 2 bugs which are direct consequences of this design
      decision.
      
      First is the incorrect usage of list_empty(), meant to denote whether
      "filter" is chained into ocelot->traps via filter->trap_list.
      This does not do the correct thing, because list_empty() checks whether
      "head->next == head", but in our case, head->next == head->prev == NULL.
      So we dereference NULL pointers and die when we call list_del().
      
      Second is the fact that not all places that should remove the filter
      from ocelot->traps do so. One example is ocelot_vcap_block_remove_filter(),
      which is where we have the main kfree(filter). By keeping freed filters
      in ocelot->traps we end up in a use-after-free in
      felix_update_trapping_destinations().
      
      Attempting to fix all the buggy patterns is a whack-a-mole game which
      makes the driver unmaintainable. Actually this is what the previous
      patch version attempted to do:
      https://patchwork.kernel.org/project/netdevbpf/patch/20220503115728.834457-3-vladimir.oltean@nxp.com/
      
      but it introduced another set of bugs, because there are other places in
      which create VCAP filters, not just ocelot_vcap_filter_create():
      
      - ocelot_trap_add()
      - felix_tag_8021q_vlan_add_rx()
      - felix_tag_8021q_vlan_add_tx()
      
      Relying on the convention that all those code paths must call
      INIT_LIST_HEAD(&filter->trap_list) is not going to scale.
      
      So let's do what should have been done in the first place and keep a
      bool in struct ocelot_vcap_filter which denotes whether we are looking
      at a trapping rule or not. Iterating now happens over the main VCAP IS2
      block->rules. The advantage is that we no longer risk having stale
      references to a freed filter, since it is only present in that list.
      
      Fixes: e42bd4ed ("net: mscc: ocelot: keep traps in a list")
      Signed-off-by: NVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      e1846cff
  7. 02 5月, 2022 3 次提交
  8. 30 4月, 2022 3 次提交
  9. 29 4月, 2022 1 次提交
    • N
      net: dsa: mv88e6xxx: Single chip mode detection for MV88E6*41 · 5da66099
      Nathan Rossi 提交于
      The mv88e6xxx driver expects switches that are configured in single chip
      addressing mode to have the MDIO address configured as 0. This is due to
      the switch ADDR pins representing the single chip addressing mode as 0.
      However depending on the device (e.g. MV88E6*41) the switch does not
      respond on address 0 or any other address below 16 (the first port
      address) in single chip addressing mode. This allows for other devices
      to be on the same shared MDIO bus despite the switch being in single
      chip addressing mode.
      
      When using a switch that works this way it is not possible to configure
      switch driver as single chip addressing via device tree, along with
      another MDIO device on the same bus with address 0, as both devices
      would have the same address of 0 resulting in mdiobus_register_device
      -EBUSY errors for one of the devices with address 0.
      
      In order to support this configuration the switch node can have its MDIO
      address configured as 16 (the first address that the device responds
      to). During initialization the driver will treat this address similar to
      how address 0 is, however because this address is also a valid
      multi-chip address (in certain switch models, but not all) the driver
      will configure the SMI in single chip addressing mode and attempt to
      detect the switch model. If the device is configured in single chip
      addressing mode this will succeed and the initialization process can
      continue. If it fails to detect a valid model this is because the switch
      model register is not a valid register when in multi-chip mode, it will
      then fall back to the existing SMI initialization process using the MDIO
      address as the multi-chip mode address.
      
      This detection method is safe if the device is in either mode because
      the single chip addressing mode read is a direct SMI/MDIO read operation
      and has no side effects compared to the SMI writes required for the
      multi-chip addressing mode.
      
      In order to implement this change, the reset gpio configuration is moved
      to occur before any SMI initialization. This ensures that the device has
      the same/correct reset gpio state for both mv88e6xxx_smi_init calls.
      Signed-off-by: NNathan Rossi <nathan@nathanrossi.com>
      Reviewed-by: NAndrew Lunn <andrew@lunn.ch>
      Link: https://lore.kernel.org/r/20220427130928.540007-1-nathan@nathanrossi.comSigned-off-by: NJakub Kicinski <kuba@kernel.org>
      5da66099
  10. 28 4月, 2022 1 次提交
  11. 27 4月, 2022 2 次提交
    • M
      net: dsa: lantiq_gswip: Don't set GSWIP_MII_CFG_RMII_CLK · 71cffebf
      Martin Blumenstingl 提交于
      Commit 4b592324 ("net: dsa: lantiq_gswip: Configure all remaining
      GSWIP_MII_CFG bits") added all known bits in the GSWIP_MII_CFGp
      register. It helped bring this register into a well-defined state so the
      driver has to rely less on the bootloader to do things right.
      Unfortunately it also sets the GSWIP_MII_CFG_RMII_CLK bit without any
      possibility to configure it. Upon further testing it turns out that all
      boards which are supported by the GSWIP driver in OpenWrt which use an
      RMII PHY have a dedicated oscillator on the board which provides the
      50MHz RMII reference clock.
      
      Don't set the GSWIP_MII_CFG_RMII_CLK bit (but keep the code which always
      clears it) to fix support for the Fritz!Box 7362 SL in OpenWrt. This is
      a board with two Atheros AR8030 RMII PHYs. With the "RMII clock" bit set
      the MAC also generates the RMII reference clock whose signal then
      conflicts with the signal from the oscillator on the board. This results
      in a constant cycle of the PHY detecting link up/down (and as a result
      of that: the two ports using the AR8030 PHYs are not working).
      
      At the time of writing this patch there's no known board where the MAC
      (GSWIP) has to generate the RMII reference clock. If needed this can be
      implemented in future by providing a device-tree flag so the
      GSWIP_MII_CFG_RMII_CLK bit can be toggled per port.
      
      Fixes: 4b592324 ("net: dsa: lantiq_gswip: Configure all remaining GSWIP_MII_CFG bits")
      Tested-by: NJan Hoffmann <jan@3e8.eu>
      Signed-off-by: NMartin Blumenstingl <martin.blumenstingl@googlemail.com>
      Acked-by: NHauke Mehrtens <hauke@hauke-m.de>
      Link: https://lore.kernel.org/r/20220425152027.2220750-1-martin.blumenstingl@googlemail.comSigned-off-by: NJakub Kicinski <kuba@kernel.org>
      71cffebf
    • R
      net: dsa: mt753x: fix pcs conversion regression · fae46308
      Russell King (Oracle) 提交于
      Daniel Golle reports that the conversion of mt753x to phylink PCS caused
      an oops as below.
      
      The problem is with the placement of the PCS initialisation, which
      occurs after mt7531_setup() has been called. However, burited in this
      function is a call to setup the CPU port, which requires the PCS
      structure to be already setup.
      
      Fix this by changing the initialisation order.
      
      Unable to handle kernel NULL pointer dereference at virtual address 0000000000000020
      Mem abort info:
        ESR = 0x96000005
        EC = 0x25: DABT (current EL), IL = 32 bits
        SET = 0, FnV = 0
        EA = 0, S1PTW = 0
        FSC = 0x05: level 1 translation fault
      Data abort info:
        ISV = 0, ISS = 0x00000005
        CM = 0, WnR = 0
      user pgtable: 4k pages, 39-bit VAs, pgdp=0000000046057000
      [0000000000000020] pgd=0000000000000000, p4d=0000000000000000, pud=0000000000000000
      Internal error: Oops: 96000005 [#1] SMP
      Modules linked in:
      CPU: 0 PID: 32 Comm: kworker/u4:1 Tainted: G S 5.18.0-rc3-next-20220422+ #0
      Hardware name: Bananapi BPI-R64 (DT)
      Workqueue: events_unbound deferred_probe_work_func
      pstate: 60000005 (nZCv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--)
      pc : mt7531_cpu_port_config+0xcc/0x1b0
      lr : mt7531_cpu_port_config+0xc0/0x1b0
      sp : ffffffc008d5b980
      x29: ffffffc008d5b990 x28: ffffff80060562c8 x27: 00000000f805633b
      x26: ffffff80001a8880 x25: 00000000000009c4 x24: 0000000000000016
      x23: ffffff8005eb6470 x22: 0000000000003600 x21: ffffff8006948080
      x20: 0000000000000000 x19: 0000000000000006 x18: 0000000000000000
      x17: 0000000000000001 x16: 0000000000000001 x15: 02963607fcee069e
      x14: 0000000000000000 x13: 0000000000000030 x12: 0101010101010101
      x11: ffffffc037302000 x10: 0000000000000870 x9 : ffffffc008d5b800
      x8 : ffffff800028f950 x7 : 0000000000000001 x6 : 00000000662b3000
      x5 : 00000000000002f0 x4 : 0000000000000000 x3 : ffffff800028f080
      x2 : 0000000000000000 x1 : ffffff800028f080 x0 : 0000000000000000
      Call trace:
       mt7531_cpu_port_config+0xcc/0x1b0
       mt753x_cpu_port_enable+0x24/0x1f0
       mt7531_setup+0x49c/0x5c0
       mt753x_setup+0x20/0x31c
       dsa_register_switch+0x8bc/0x1020
       mt7530_probe+0x118/0x200
       mdio_probe+0x30/0x64
       really_probe.part.0+0x98/0x280
       __driver_probe_device+0x94/0x140
       driver_probe_device+0x40/0x114
       __device_attach_driver+0xb0/0x10c
       bus_for_each_drv+0x64/0xa0
       __device_attach+0xa8/0x16c
       device_initial_probe+0x10/0x20
       bus_probe_device+0x94/0x9c
       deferred_probe_work_func+0x80/0xb4
       process_one_work+0x200/0x3a0
       worker_thread+0x260/0x4c0
       kthread+0xd4/0xe0
       ret_from_fork+0x10/0x20
      Code: 9409e911 937b7e60 8b0002a0 f9405800 (f9401005)
      ---[ end trace 0000000000000000 ]---
      Reported-by: NDaniel Golle <daniel@makrotopia.org>
      Tested-by: NDaniel Golle <daniel@makrotopia.org>
      Fixes: cbd1f243 ("net: dsa: mt7530: partially convert to phylink_pcs")
      Signed-off-by: NRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
      Reviewed-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Link: https://lore.kernel.org/r/E1nj6FW-007WZB-5Y@rmk-PC.armlinux.org.ukSigned-off-by: NJakub Kicinski <kuba@kernel.org>
      fae46308
  12. 26 4月, 2022 2 次提交
  13. 23 4月, 2022 1 次提交
  14. 20 4月, 2022 1 次提交
  15. 17 4月, 2022 6 次提交
  16. 14 4月, 2022 1 次提交
    • V
      net: dsa: felix: fix tagging protocol changes with multiple CPU ports · 00fa91bc
      Vladimir Oltean 提交于
      When the device tree has 2 CPU ports defined, a single one is active
      (has any dp->cpu_dp pointers point to it). Yet the second one is still a
      CPU port, and DSA still calls ->change_tag_protocol on it.
      
      On the NXP LS1028A, the CPU ports are ports 4 and 5. Port 4 is the
      active CPU port and port 5 is inactive.
      
      After the following commands:
      
       # Initial setting
       cat /sys/class/net/eno2/dsa/tagging
       ocelot
       echo ocelot-8021q > /sys/class/net/eno2/dsa/tagging
       echo ocelot > /sys/class/net/eno2/dsa/tagging
      
      traffic is now broken, because the driver has moved the NPI port from
      port 4 to port 5, unbeknown to DSA.
      
      The problem can be avoided by detecting that the second CPU port is
      unused, and not doing anything for it. Further rework will be needed
      when proper support for multiple CPU ports is added.
      
      Treat this as a bug and prepare current kernels to work in single-CPU
      mode with multiple-CPU DT blobs.
      
      Fixes: adb3dccf ("net: dsa: felix: convert to the new .change_tag_protocol DSA API")
      Signed-off-by: NVladimir Oltean <vladimir.oltean@nxp.com>
      Link: https://lore.kernel.org/r/20220412172209.2531865-1-vladimir.oltean@nxp.comSigned-off-by: NPaolo Abeni <pabeni@redhat.com>
      00fa91bc
  17. 13 4月, 2022 1 次提交