1. 10 Mar, 2022 25 commits
  2. 09 Mar, 2022 15 commits
    • Vladimir Oltean's avatar
      net: tcp: fix shim definition of tcp_inbound_md5_hash · 24055bb8
      Vladimir Oltean authored
      When CONFIG_TCP_MD5SIG isn't enabled, there is a compilation bug due to
      the fact that the static inline definition of tcp_inbound_md5_hash() has
      an unexpected semicolon. Remove it.
      
      Fixes: 1330b6ef ("skb: make drop reason booleanable")
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Link: https://lore.kernel.org/r/20220309122012.668986-1-vladimir.oltean@nxp.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      24055bb8
    • Lukas Bulwahn's avatar
      MAINTAINERS: rectify entry for REALTEK RTL83xx SMI DSA ROUTER CHIPS · 7f415828
      Lukas Bulwahn authored
      Commit 429c83c7 ("dt-bindings: net: dsa: realtek: convert to YAML
      schema, add MDIO") converts realtek-smi.txt to realtek.yaml, but missed to
      adjust its reference in MAINTAINERS.
      
      Hence, ./scripts/get_maintainer.pl --self-test=patterns complains about a
      broken reference.
      
      Repair this file reference in REALTEK RTL83xx SMI DSA ROUTER CHIPS.
      Signed-off-by: default avatarLukas Bulwahn <lukas.bulwahn@gmail.com>
      Reviewed-by: default avatarVladimir Oltean <olteanv@gmail.com>
      Reviewed-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      Reviewed-by: default avatarAlvin Šipraga <alsi@bang-olufsen.dk>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      7f415828
    • Horatiu Vultur's avatar
      net: lan966x: Add spinlock for frame transmission from CPU. · 0dbdf819
      Horatiu Vultur authored
      The registers used to inject a frame to one of the ports is shared
      between all the net devices. Therefore, there can be race conditions for
      accessing the registers when two processes send frames at the same time
      on different ports.
      
      To fix this, add a spinlock around the function
      'lan966x_port_ifh_xmit()'.
      Signed-off-by: default avatarHoratiu Vultur <horatiu.vultur@microchip.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      0dbdf819
    • Changcheng Deng's avatar
      net: ethernet: sun: use min_t() to make code cleaner · 2c9ec169
      Changcheng Deng authored
      Use min_t() in order to make code cleaner.
      Reported-by: default avatarZeal Robot <zealci@zte.com.cn>
      Signed-off-by: default avatarChangcheng Deng <deng.changcheng@zte.com.cn>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      2c9ec169
    • Dimitris Michailidis's avatar
      net/fungible: CONFIG_FUN_CORE needs SBITMAP · 40bb09c8
      Dimitris Michailidis authored
      fun_core.ko uses sbitmaps and needs to select SBITMAP.
      Fixes below errors:
      
      ERROR: modpost: "__sbitmap_queue_get"
      [drivers/net/ethernet/fungible/funcore/funcore.ko] undefined!
      ERROR: modpost: "sbitmap_finish_wait"
      [drivers/net/ethernet/fungible/funcore/funcore.ko] undefined!
      ERROR: modpost: "sbitmap_queue_clear"
      [drivers/net/ethernet/fungible/funcore/funcore.ko] undefined!
      ERROR: modpost: "sbitmap_prepare_to_wait"
      [drivers/net/ethernet/fungible/funcore/funcore.ko] undefined!
      ERROR: modpost: "sbitmap_queue_init_node"
      [drivers/net/ethernet/fungible/funcore/funcore.ko] undefined!
      ERROR: modpost: "sbitmap_queue_wake_all"
      [drivers/net/ethernet/fungible/funcore/funcore.ko] undefined!
      
      v2: correct "Fixes" SHA
      
      Fixes: 749efb1e ("net/fungible: Kconfig, Makefiles, and MAINTAINERS")
      Reported-by: default avatarRandy Dunlap <rdunlap@infradead.org>
      Signed-off-by: default avatarDimitris Michailidis <dmichail@fungible.com>
      Acked-by: default avatarRandy Dunlap <rdunlap@infradead.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      40bb09c8
    • Dimitris Michailidis's avatar
      net/fungible: Fix local_memory_node error · cdba2490
      Dimitris Michailidis authored
      Stephen Rothwell reported the following failure on powerpc:
      
      ERROR: modpost: ".local_memory_node"
      [drivers/net/ethernet/fungible/funeth/funeth.ko] undefined!
      
      AFAICS this is because local_memory_node() is a non-inline non-exported
      function when CONFIG_HAVE_MEMORYLESS_NODES=y. It is also the wrong API
      to get a CPU's memory node. Use cpu_to_mem() in the two spots it's used.
      
      Fixes: ee6373dd ("net/funeth: probing and netdev ops")
      Fixes: db37bc17 ("net/funeth: add the data path")
      Reported-by: default avatarStephen Rothwell <sfr@canb.auug.org.au>
      Signed-off-by: default avatarDimitris Michailidis <dmichail@fungible.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      cdba2490
    • Jakub Kicinski's avatar
      skb: make drop reason booleanable · 1330b6ef
      Jakub Kicinski authored
      We have a number of cases where function returns drop/no drop
      decision as a boolean. Now that we want to report the reason
      code as well we have to pass extra output arguments.
      
      We can make the reason code evaluate correctly as bool.
      
      I believe we're good to reorder the reasons as they are
      reported to user space as strings.
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Reviewed-by: default avatarDavid Ahern <dsahern@kernel.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      1330b6ef
    • David S. Miller's avatar
      Merge branch 'dsa-next-fixups' · 11633199
      David S. Miller authored
      Vladimir Oltean says:
      
      ====================
      Incremental fixups for DSA unicast filtering
      
      There are some bugs I've discovered in the recently merged "DSA unicast
      filtering" series:
      https://patchwork.kernel.org/project/netdevbpf/cover/20220302191417.1288145-1-vladimir.oltean@nxp.com/
      
      First bug is the dereference of an uninitialized list (dp->fdbs) when
      the "initial" tag protocol is placed in the device tree for the Felix
      switch driver. This is a scenario I hadn't tested. It is handled by
      patches 1-3.
      
      Second bug is actually a sum of bugs that canceled each other out during
      my previous testing. The MAC address change of a DSA slave interface
      breaks termination for the other slave interfaces. But this actually
      does not happen if the slave interface whose address is changing is
      down. And even when up, traffic termination is still not broken because
      we fail to properly disable host flooding. Patches 4-6 handle this for
      the Felix driver (the only one benefiting from unicast filtering so far).
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      11633199
    • Vladimir Oltean's avatar
      net: dsa: felix: avoid early deletion of host FDB entries · 7e580490
      Vladimir Oltean authored
      The Felix driver declares FDB isolation but puts all standalone ports in
      VID 0. This is mostly problem-free as discussed with Alvin here:
      https://patchwork.kernel.org/project/netdevbpf/cover/20220302191417.1288145-1-vladimir.oltean@nxp.com/#24763870
      
      however there is one catch. DSA still thinks that FDB entries are
      installed on the CPU port as many times as there are user ports, and
      this is problematic when multiple user ports share the same MAC address.
      
      Consider the default case where all user ports inherit their MAC address
      from the DSA master, and then the user runs:
      
      ip link set swp0 address 00:01:02:03:04:05
      
      The above will make dsa_slave_set_mac_address() call
      dsa_port_standalone_host_fdb_add() for 00:01:02:03:04:05 in port 0's
      standalone database, and dsa_port_standalone_host_fdb_del() for the old
      address of swp0, again in swp0's standalone database.
      
      Both the ->port_fdb_add() and ->port_fdb_del() will be propagated down
      to the felix driver, which will end up deleting the old MAC address from
      the CPU port. But this is still in use by other user ports, so we end up
      breaking unicast termination for them.
      
      There isn't a problem in the fact that DSA keeps track of host
      standalone addresses in the individual database of each user port: some
      drivers like sja1105 need this. There also isn't a problem in the fact
      that some drivers choose the same VID/FID for all standalone ports.
      It is just that the deletion of these host addresses must be delayed
      until they are known to not be in use any longer, and only the driver
      has this knowledge. Since DSA keeps these addresses in &cpu_dp->fdbs and
      &cpu_db->mdbs, it is just a matter of walking over those lists and see
      whether the same MAC address is present on the CPU port in the port db
      of another user port.
      
      I have considered reusing the generic dsa_port_walk_fdbs() and
      dsa_port_walk_mdbs() schemes for this, but locking makes it difficult.
      In the ->port_fdb_add() method and co, &dp->addr_lists_lock is held, but
      dsa_port_walk_fdbs() also acquires that lock. Also, even assuming that
      we introduce an unlocked variant of the address iterator, we'd still
      need some relatively complex data structures, and a void *ctx in the
      dsa_fdb_walk_cb_t which we don't currently pass, such that drivers are
      able to figure out, after iterating, whether the same MAC address is or
      isn't present in the port db of another port.
      
      All the above, plus the fact that I expect other drivers to follow the
      same model as felix where all standalone ports use the same FID, made me
      conclude that a generic method provided by DSA is necessary:
      dsa_fdb_present_in_other_db() and the mdb equivalent. Felix calls this
      from the ->port_fdb_del() handler for the CPU port, when the database
      was classified to either a port db, or a LAG db.
      
      For symmetry, we also call this from ->port_fdb_add(), because if the
      address was installed once, then installing it a second time serves no
      purpose: it's already in hardware in VID 0 and it affects all standalone
      ports.
      
      This change moves dsa_db_equal() from switch.c to dsa.c, since it now
      has one more caller.
      
      Fixes: 54c31984 ("net: mscc: ocelot: enforce FDB isolation when VLAN-unaware")
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      7e580490
    • Vladimir Oltean's avatar
      net: dsa: felix: actually disable flooding towards NPI port · f2e2662c
      Vladimir Oltean authored
      The two blamed commits were written/tested individually but not
      together.
      
      When put together, commit 90897569 ("net: dsa: felix: start off with
      flooding disabled on the CPU port"), which deletes a reinitialization of
      PGID_UC/PGID_MC/PGID_BC, is no longer sufficient to ensure that these
      port masks don't contain the CPU port module.
      
      This is because commit b903a6bd ("net: dsa: felix: migrate flood
      settings from NPI to tag_8021q CPU port") overwrites the hardware
      default settings towards the CPU port module with the settings that used
      to be present on the NPI port treated as a regular port. There, flooding
      is enabled, so flooding would get enabled on the CPU port module too.
      
      Adding conditional logic somewhere within felix_setup_tag_npi() to
      configure either the default no-flood policy or the flood policy
      inherited from the tag_8021q CPU port from a previous call to
      dsa_port_manage_cpu_flood() is getting complicated. So just let the
      migration logic do its thing during initial setup (which will
      temporarily turn on flooding), then turn flooding off for the NPI port
      after felix_set_tag_protocol() finishes. Here we are in felix_setup(),
      so the DSA slave interfaces are not yet created, and this doesn't affect
      traffic in any way.
      
      Fixes: 90897569 ("net: dsa: felix: start off with flooding disabled on the CPU port")
      Fixes: b903a6bd ("net: dsa: felix: migrate flood settings from NPI to tag_8021q CPU port")
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      f2e2662c
    • Vladimir Oltean's avatar
      net: dsa: be mostly no-op in dsa_slave_set_mac_address when down · e2d0576f
      Vladimir Oltean authored
      Since the slave unicast address is synced to hardware and to the DSA
      master during dsa_slave_open(), this means that a call to
      dsa_slave_set_mac_address() while the slave interface is down will
      result to a call to dsa_port_standalone_host_fdb_del() and to
      dev_uc_del() for the MAC address while there was no previous
      dsa_port_standalone_host_fdb_add() or dev_uc_add().
      
      This is a partial revert of the blamed commit below, which was too
      aggressive.
      
      Fixes: 35aae5ab ("net: dsa: remove workarounds for changing master promisc/allmulti only while up")
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      e2d0576f
    • Vladimir Oltean's avatar
      net: dsa: felix: drop "bool change" from felix_set_tag_protocol · c69f40ac
      Vladimir Oltean authored
      We no longer need the workaround in the felix driver to avoid calling
      dsa_port_walk_fdbs() when &dp->fdbs is an uninitialized list, because
      that list is now initialized from all call paths of felix_set_tag_protocol().
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      c69f40ac
    • Vladimir Oltean's avatar
      net: dsa: move port lists initialization to dsa_port_touch · fe95784f
      Vladimir Oltean authored
      &cpu_db->fdbs and &cpu_db->mdbs may be uninitialized lists during some
      call paths of felix_set_tag_protocol().
      
      There was an attempt to avoid calling dsa_port_walk_fdbs() during setup
      by using a "bool change" in the felix driver, but this doesn't work when
      the tagging protocol is defined in the device tree, and a change is
      triggered by DSA at pseudo-runtime:
      
      dsa_tree_setup_switches
      -> dsa_switch_setup
         -> dsa_switch_setup_tag_protocol
            -> ds->ops->change_tag_protocol
      dsa_tree_setup_ports
      -> dsa_port_setup
         -> &dp->fdbs and &db->mdbs only get initialized here
      
      So it seems like the only way to fix this is to move the initialization
      of these lists earlier.
      
      dsa_port_touch() is called from dsa_switch_touch_ports() which is called
      from dsa_switch_parse_of(), and this runs completely before
      dsa_tree_setup(). Similarly, dsa_switch_release_ports() runs after
      dsa_tree_teardown().
      
      Fixes: f9cef64f ("net: dsa: felix: migrate host FDB and MDB entries when changing tag proto")
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      fe95784f
    • Vladimir Oltean's avatar
      net: dsa: warn if port lists aren't empty in dsa_port_teardown · 0832cd9f
      Vladimir Oltean authored
      There has been recent work towards matching each switchdev object
      addition with a corresponding deletion.
      
      Therefore, having elements in the fdbs, mdbs, vlans lists at the time of
      a shared (DSA, CPU) port's teardown is indicative of a bug somewhere
      else, and not something that is to be expected.
      
      We shouldn't try to silently paper over that. Instead, print a warning
      and a stack trace.
      
      This change is a prerequisite for moving the initialization/teardown of
      these lists. Make it clear that clearing the lists isn't needed.
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      0832cd9f
    • David S. Miller's avatar
      Merge branch 'ptrp-ocp-next' · ce7ec1b8
      David S. Miller authored
      Jonathan Lemon says:
      
      ====================
      ptp: ocp: update devlink information
      
      Both of these patches update the information displayed via devlink.
      
      v1 -> v2: remove board.manufacture information
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      ce7ec1b8