Forum | Documentation | Website | Blog

Skip to content
Snippets Groups Projects
  1. Aug 06, 2021
    • David S. Miller's avatar
      Merge branch 'dsa-cpu-flood' · 9b9311af
      David S. Miller authored
      Vladimir Oltean says:
      
      ====================
      Always flood multicast to the DSA CPU port
      
      Discussing with Qingfang, it became obvious that DSA is not prepared to
      disable multicast flooding towards the CPU port under any circumstance
      right now, and this in fact breaks traffic quite blatantly.
      
      This series is a revert done in reverse chronological order. These
      should be propagated to stable trees up to commit a8b659e7
      
       ("net:
      dsa: act as passthrough for bridge port flags") which is in v5.12.
      For older kernels, that commit blocks further backporting, so I need to
      send a modified version of patch 3 separately to Greg after these go
      into "net".
      
      v1->v2: delete unused b53_set_mrouter function prototype
      ====================
      
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      9b9311af
    • Vladimir Oltean's avatar
      net: dsa: don't disable multicast flooding to the CPU even without an IGMP querier · c73c5708
      Vladimir Oltean authored
      Commit 08cc83cc ("net: dsa: add support for BRIDGE_MROUTER
      attribute") added an option for users to turn off multicast flooding
      towards the CPU if they turn off the IGMP querier on a bridge which
      already has enslaved ports (echo 0 > /sys/class/net/br0/bridge/multicast_router).
      
      And commit a8b659e7 ("net: dsa: act as passthrough for bridge port flags")
      simply papered over that issue, because it moved the decision to flood
      the CPU with multicast (or not) from the DSA core down to individual drivers,
      instead of taking a more radical position then.
      
      The truth is that disabling multicast flooding to the CPU is simply
      something we are not prepared to do now, if at all. Some reasons:
      
      - ICMP6 neighbor solicitation messages are unregistered multicast
        packets as far as the bridge is concerned. So if we stop flooding
        multicast, the outside world cannot ping the bridge device's IPv6
        link-local address.
      
      - There might be foreign interfaces bridged with our DSA switch ports
        (sending a packet towards the host does not necessarily equal
        termination, but maybe software forwarding). So if there is no one
        interested in that multicast traffic in the local network stack, that
        doesn't mean nobody is.
      
      - PTP over L4 (IPv4, IPv6) is multicast, but is unregistered as far as
        the bridge is concerned. This should reach the CPU port.
      
      - The switch driver might not do FDB partitioning. And since we don't
        even bother to do more fine-grained flood disabling (such as "disable
        flooding _from_port_N_ towards the CPU port" as opposed to "disable
        flooding _from_any_port_ towards the CPU port"), this breaks standalone
        ports, or even multiple bridges where one has an IGMP querier and one
        doesn't.
      
      Reverting the logic makes all of the above work.
      
      Fixes: a8b659e7 ("net: dsa: act as passthrough for bridge port flags")
      Fixes: 08cc83cc
      
       ("net: dsa: add support for BRIDGE_MROUTER attribute")
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      c73c5708
    • Vladimir Oltean's avatar
      net: dsa: mt7530: remove the .port_set_mrouter implementation · cbbf09b5
      Vladimir Oltean authored
      DSA's idea of optimizing out multicast flooding to the CPU port leaves
      quite a few holes open, so it should be reverted.
      
      The mt7530 driver is the only new driver which added a .port_set_mrouter
      implementation after the reorg from commit a8b659e7 ("net: dsa: act
      as passthrough for bridge port flags"), so it needs to be reverted
      separately so that the other revert commit can go a bit further down the
      git history.
      
      Fixes: 5a30833b
      
       ("net: dsa: mt7530: support MDB and bridge flag operations")
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      cbbf09b5
    • Vladimir Oltean's avatar
      net: dsa: stop syncing the bridge mcast_router attribute at join time · 7df4e744
      Vladimir Oltean authored
      Qingfang points out that when a bridge with the default settings is
      created and a port joins it:
      
      ip link add br0 type bridge
      ip link set swp0 master br0
      
      DSA calls br_multicast_router() on the bridge to see if the br0 device
      is a multicast router port, and if it is, it enables multicast flooding
      to the CPU port, otherwise it disables it.
      
      If we look through the multicast_router_show() sysfs or at the
      IFLA_BR_MCAST_ROUTER netlink attribute, we see that the default mrouter
      attribute for the bridge device is "1" (MDB_RTR_TYPE_TEMP_QUERY).
      
      However, br_multicast_router() will return "0" (MDB_RTR_TYPE_DISABLED),
      because an mrouter port in the MDB_RTR_TYPE_TEMP_QUERY state may not be
      actually _active_ until it receives an actual IGMP query. So, the
      br_multicast_router() function should really have been called
      br_multicast_router_active() perhaps.
      
      When/if an IGMP query is received, the bridge device will transition via
      br_multicast_mark_router() into the active state until the
      ip4_mc_router_timer expires after an multicast_querier_interval.
      
      Of course, this does not happen if the bridge is created with an
      mcast_router attribute of "2" (MDB_RTR_TYPE_PERM).
      
      The point is that in lack of any IGMP query messages, and in the default
      bridge configuration, unregistered multicast packets will not be able to
      reach the CPU port through flooding, and this breaks many use cases
      (most obviously, IPv6 ND, with its ICMP6 neighbor solicitation multicast
      messages).
      
      Leave the multicast flooding setting towards the CPU port down to a driver
      level decision.
      
      Fixes: 010e269f
      
       ("net: dsa: sync up switchdev objects and port attributes when joining the bridge")
      Reported-by: default avatarDENG Qingfang <dqfext@gmail.com>
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      7df4e744
    • Grygorii Strashko's avatar
      net: ethernet: ti: am65-cpsw: use napi_complete_done() in TX completion · 3bacbe04
      Grygorii Strashko authored
      This patch enables support for hard irqs deferral feature from Eric Dumazet
      [1] for TI K3 CPSW driver by using napi_complete_done() in TX completion
      path.
      
      Depending on gro_flush_timeout and napi_defer_hard_irqs at gives up to 30%
      CPU utilization reduction:
      
      gro_flush_timeout=50000
      napi_defer_hard_irqs=2
      
      netperf -l 10 -H 192.168.1.1  -t UDP_STREAM -c -C -- -m 1470
      MIGRATED UDP STREAM TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to 192.168.1.1 () port 0 AF_INET
      Socket  Message  Elapsed      Messages                   CPU      Service
      Size    Size     Time         Okay Errors   Throughput   Util     Demand
      bytes   bytes    secs            #      #   10^6bits/sec % SS     us/KB
      
      before:
      212992    1470   10.00      809632      0      952.0     42.98    14.792
      212992           10.00      809630             952.0     50.66    8.719
      
      after:
      212992    1470   10.00      813686      0      956.8     32.14    11.009
      212992           10.00      813686             956.8     50.05    8.570
      
      [1] https://lore.kernel.org/netdev/20200422161329.56026-1-edumazet@google.com/
      
      
      
      Signed-off-by: default avatarGrygorii Strashko <grygorii.strashko@ti.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      3bacbe04
    • Vignesh Raghavendra's avatar
      net: ti: am65-cpsw-nuss: fix RX IRQ state after .ndo_stop() · 47bfc4d1
      Vignesh Raghavendra authored
      On TI K3 am64x platform the issue with RX IRQ is observed - it's become
      disabled forever after .ndo_stop(). The K3 CPSW driver manipulates RX IRQ
      by using standard Linux enable_irq()/disable_irq_nosync() API as there is
      no IRQ enable/disable options in CPSW HW itself, as result during
      .ndo_stop() following sequence happens
      
        phy_stop()
        teardown TX/RX channels
        wait for TX tdown complete
        napi_disable(TX)
        clean up TX channels
      
        (a)
      
        napi_disable(RX)
      
      At point (a) it's not possible to predict if RX IRQ was triggered or not.
      if RX IRQ was triggered then it also not possible to definitely say if RX
      NAPI was run or only scheduled and immediately canceled by
      napi_disable(RX). Actually the last case causes RX IRQ to be permanently
      disabled.
      
      Another observed issue is that RX IRQ enable counter become unbalanced if
      (gro_flush_timeout =! 0) while (napi_defer_hard_irqs == 0):
      
      Unbalanced enable for IRQ 44
      WARNING: CPU: 0 PID: 10 at ../kernel/irq/manage.c:776 __enable_irq+0x38/0x80
      __enable_irq+0x38/0x80
      enable_irq+0x54/0xb0
      am65_cpsw_nuss_rx_poll+0x2f4/0x368
      __napi_poll+0x34/0x1b8
      net_rx_action+0xe4/0x220
      _stext+0x11c/0x284
      run_ksoftirqd+0x4c/0x60
      
      To avoid above issues introduce flag indicating if RX was actually disabled
      before enabling it in am65_cpsw_nuss_rx_poll() and restore RX IRQ state in
      .ndo_open()
      
      Fixes: 4f7cce27
      
       ("net: ethernet: ti: am65-cpsw: add support for am64x cpsw3g")
      Signed-off-by: default avatarVignesh Raghavendra <vigneshr@ti.com>
      Signed-off-by: default avatarGrygorii Strashko <grygorii.strashko@ti.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      47bfc4d1
    • David S. Miller's avatar
      Merge branch 'ptp-ocp-fixes' · 370cb73a
      David S. Miller authored
      
      Jonathan Lemon says:
      
      ====================
      ptp: ocp: assorted fixes.
      
      Assorted fixes for the ocp timecard.
      ====================
      
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      370cb73a
    • Jonathan Lemon's avatar
      ptp: ocp: Remove pending_image indicator from devlink · 8ef8ccbc
      Jonathan Lemon authored
      
      After writing an image blob to the flash memory, a reboot is required
      to reload the FPGA.  There is no versioning prsent in the FPGA image
      file, so only a running version is available.  The 'stored version'
      was set to 'pending' in order to indicate a reboot was needed.
      
      This isn't reliable, as the module could be unloaded/loaded, losing
      the "reboot needed" indicator.  Also, the devlink 'stored version'
      information is designed to refer to the actual image version.
      
      Unfortunately, there is no method to determine the flash image version
      other than booting it, so remove the devlink stored version setting.
      
      Signed-off-by: default avatarJonathan Lemon <jonathan.lemon@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      8ef8ccbc
    • Jonathan Lemon's avatar
      ptp: ocp: Rename version string shown by devlink. · 1a052da9
      Jonathan Lemon authored
      
      The TimeCard has two FPGA images in the flash: the actual firmware,
      and a manufacturing fallback version which is intended to act as a
      loader in case the flash update failed.
      
      Name these "fw" and "loader", which are reflected in devlink:
      
          [root@timecard drv]# devlink dev info
          pci/0000:04:00.0:
            driver ptp_ocp
            serial_number fc:c2:3d:2e:d7:c0
            versions:
                running:
                  fw 5
      
      Signed-off-by: default avatarJonathan Lemon <jonathan.lemon@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      1a052da9
    • Jonathan Lemon's avatar
      ptp: ocp: Use 'gnss' naming instead of 'gps' · ef0cfb34
      Jonathan Lemon authored
      
      GPS is not the only available positioning system.  Use the generic
      naming of "GNSS" instead.
      
      Signed-off-by: default avatarJonathan Lemon <jonathan.lemon@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      ef0cfb34
    • Jonathan Lemon's avatar
      ptp: ocp: Remove devlink health and unused parameters. · 37a156ba
      Jonathan Lemon authored
      
      "devlink health" was used as a way to monitor the GNSS signal
      status.  This isn't really the intended use, and the same
      functionality can be achived by monitoring the status file.
      
      Remove the devlink heath support entirely, and also remove the
      currently unused devlink parameters.
      
      Signed-off-by: default avatarJonathan Lemon <jonathan.lemon@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      37a156ba
    • Jonathan Lemon's avatar
      ptp: ocp: Add the mapping for the external PPS registers. · 0d43d4f2
      Jonathan Lemon authored
      
      There are two PPS blocks: one handles the external PPS signal output,
      with the other handling the PPS signal input to the internal clock.
      Add controls for the external PPS block.
      
      Rename the fields so they match their function.
      
      Add cable_delay to the register definitions.
      
      Signed-off-by: default avatarJonathan Lemon <jonathan.lemon@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      0d43d4f2
    • Jonathan Lemon's avatar
      ptp: ocp: Fix the error handling path for the class device. · d12f23fa
      Jonathan Lemon authored
      
      Move the put_device() call to the error handling path, so the
      device is released after the .release callback, avoiding a
      use-after-free.
      
      Signed-off-by: default avatarJonathan Lemon <jonathan.lemon@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      d12f23fa
    • Heiner Kallweit's avatar
      ethtool: return error from ethnl_ops_begin if dev is NULL · 596690e9
      Heiner Kallweit authored
      Julian reported that after d43c65b0 Coverity complains about a
      missing check whether dev is NULL in ethnl_ops_complete().
      There doesn't seem to be any valid case where dev could be NULL when
      calling ethnl_ops_begin(), therefore return an error if dev is NULL.
      
      Fixes: d43c65b0
      
       ("ethtool: runtime-resume netdev parent in ethnl_ops_begin")
      Reported-by: default avatarJulian Wiedmann <jwi@linux.ibm.com>
      Signed-off-by: default avatarHeiner Kallweit <hkallweit1@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      596690e9
    • Leon Romanovsky's avatar
      netdevsim: Protect both reload_down and reload_up paths · 5c0418ed
      Leon Romanovsky authored
      Don't progress with adding and deleting ports as long as devlink
      reload is running.
      
      Fixes: 23809a72
      
       ("netdevsim: Forbid devlink reload when adding or deleting ports")
      Signed-off-by: default avatarLeon Romanovsky <leonro@nvidia.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      5c0418ed
    • David S. Miller's avatar
      Merge branch 'cpsw-emac-skb_put_padto' · a5516053
      David S. Miller authored
      Grygorii Strashko says:
      
      ====================
      net: ethernet: ti: cpsw/emac: switch to use skb_put_padto()
      
      Now frame padding in TI TI CPSW/EMAC is implemented in a bit of entangled way as
      frame SKB padded in drivers (without skb->len) while frame length fixed in CPDMA.
      Things became even more confusing hence CPSW switcdev driver need to perform min
      TX frame length correction in switch mode [1].
      
      To avoid further confusion, make xmit path more clear and linear, and avoid
      updating CPDMA configuration interface for min TX frame length correction
      (which is not CPDMA job in general) this series switches TI CPSW/EMAC
      drivers to skb_put_padto() instead of skb_padto() in their xmit path, so
      skb->len also got updated properly and then removes TX frame length
      fixup from CPDMA code.
      
      [1] https://patchwork.kernel.org/project/netdevbpf/patch/20210611132732.10690-1-grygorii.strashko@ti.com/
      
      
      ====================
      
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      a5516053
    • Grygorii Strashko's avatar
      net: ethernet: ti: davinci_cpdma: drop frame padding · 9ffc513f
      Grygorii Strashko authored
      
      Hence all users of davinci_cpdma switched to skb_put_padto() the frame
      padding can be removed from it.
      
      Signed-off-by: default avatarGrygorii Strashko <grygorii.strashko@ti.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      9ffc513f
    • Grygorii Strashko's avatar
      net: ethernet: ti: davinci_emac: switch to use skb_put_padto() · 61e7a22d
      Grygorii Strashko authored
      
      Use skb_put_padto() instead of skb_padto() so skb->len also got updated, as
      preparation for further removing frame padding from cpdma.
      It also makes xmit path more clear and linear.
      
      Signed-off-by: default avatarGrygorii Strashko <grygorii.strashko@ti.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      61e7a22d
    • Grygorii Strashko's avatar
      net: ethernet: ti: cpsw: switch to use skb_put_padto() · 1f88d5d5
      Grygorii Strashko authored
      
      Use skb_put_padto() instead of skb_padto() so skb->len also got updated, as
      preparation for further removing frame padding from cpdma.
      It also makes xmit path more clear and linear.
      
      Signed-off-by: default avatarGrygorii Strashko <grygorii.strashko@ti.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      1f88d5d5
  2. Aug 05, 2021