1. May 16, 2022
    • Phil Edworthy's avatar
      ravb: Separate handling of irq enable/disable regs into feature · cb99badd
      Phil Edworthy authored
      
      
      Currently, when the HW has a single interrupt, the driver uses the
      GIC, TIC, RIC0 registers to enable and disable interrupts.
      When the HW has multiple interrupts, it uses the GIE, GID, TIE, TID,
      RIE0, RID0 registers.
      
      However, other devices, e.g. RZ/V2M, have multiple irqs and only have
      the GIC, TIC, RIC0 registers.
      Therefore, split this into a separate feature.
      
      Signed-off-by: default avatarPhil Edworthy <phil.edworthy@renesas.com>
      Reviewed-by: default avatarBiju Das <biju.das.jz@bp.renesas.com>
      Reviewed-by: default avatarSergey Shtylyov <s.shtylyov@omp.ru>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      cb99badd
    • Phil Edworthy's avatar
      dt-bindings: net: renesas,etheravb: Document RZ/V2M SoC · a7931ac1
      Phil Edworthy authored
      
      
      Document the Ethernet AVB IP found on RZ/V2M SoC.
      It includes the Ethernet controller (E-MAC) and Dedicated Direct memory
      access controller (DMAC) for transferring transmitted Ethernet frames
      to and received Ethernet frames from respective storage areas in the
      RAM at high speed.
      The AVB-DMAC is compliant with IEEE 802.1BA, IEEE 802.1AS timing and
      synchronization protocol, IEEE 802.1Qav real-time transfer, and the
      IEEE 802.1Qat stream reservation protocol.
      
      R-Car has a pair of combined interrupt lines:
       ch22 = Line0_DiA | Line1_A | Line2_A
       ch23 = Line0_DiB | Line1_B | Line2_B
      Line0 for descriptor interrupts (which we call dia and dib).
      Line1 for error related interrupts (which we call err_a and err_b).
      Line2 for management and gPTP related interrupts (mgmt_a and mgmt_b).
      
      RZ/V2M hardware has separate interrupt lines for each of these.
      
      It has 3 clocks; the main AXI clock, the AMBA CHI (Coherent Hub
      Interface) clock and a gPTP reference clock.
      
      Signed-off-by: default avatarPhil Edworthy <phil.edworthy@renesas.com>
      Reviewed-by: default avatarBiju Das <biju.das.jz@bp.renesas.com>
      Reviewed-by: default avatarSergey Shtylyov <s.shtylyov@omp.ru>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      a7931ac1
    • David S. Miller's avatar
      Merge git://git.kernel.org/pub/scm/linux/kernel/git/netfilter/nf-next · 1a01a075
      David S. Miller authored
      
      
      Pablo Neira Ayuso says:
      
      ====================
      Netfilter updates for net-next
      
      This is v2 including deadlock fix in conntrack ecache rework
      reported by Jakub Kicinski.
      
      The following patchset contains Netfilter updates for net-next,
      mostly updates to conntrack from Florian Westphal.
      
      1) Add a dedicated list for conntrack event redelivery.
      
      2) Include event redelivery list in conntrack dumps of dying type.
      
      3) Remove per-cpu dying list for event redelivery, not used anymore.
      
      4) Add netns .pre_exit to cttimeout to zap timeout objects before
         synchronize_rcu() call.
      
      5) Remove nf_ct_unconfirmed_destroy.
      
      6) Add generation id for conntrack extensions for conntrack
         timeout and helpers.
      
      7) Detach timeout policy from conntrack on cttimeout module removal.
      
      8) Remove __nf_ct_unconfirmed_destroy.
      
      9) Remove unconfirmed list.
      
      10) Remove unconditional local_bh_disable in init_conntrack().
      
      11) Consolidate conntrack iterator nf_ct_iterate_cleanup().
      
      12) Detect if ctnetlink listeners exist to short-circuit event
          path early.
      
      13) Un-inline nf_ct_ecache_ext_add().
      
      14) Add nf_conntrack_events autodetect ctnetlink listener mode
          and make it default.
      
      15) Add nf_ct_ecache_exist() to check for event cache extension.
      
      16) Extend flowtable reverse route lookup to include source, iif,
          tos and mark, from Sven Auhagen.
      
      17) Do not verify zero checksum UDP packets in nf_reject,
          from Kevin Mitchell.
      
      ====================
      
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      1a01a075
  2. May 14, 2022
  3. May 13, 2022
    • David S. Miller's avatar
      Merge branch 'bnxt_en-next' · a65cc843
      David S. Miller authored
      
      
      Michael Chan says:
      
      ====================
      bnxt_en: Updates for net-next
      
      This small patchset updates the firmware interface, adds timestamping
      support for all receive packets, and adds revised NVRAM package error
      messages for ethtool and devlink.
      ====================
      
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      a65cc843
    • Kalesh AP's avatar
      bnxt_en: parse and report result field when NVRAM package install fails · ab0bed4b
      Kalesh AP authored
      Instead of always returning -ENOPKG, decode the firmware error
      code further when the HWRM_NVM_INSTALL_UPDATE firmware call fails.
      Return a more suitable error code to userspace and log an error
      in dmesg.
      
      This is version 2 of the earlier patch that was reverted:
      
      02acd399 ("bnxt_en: parse result field when NVRAM package install fails")
      
      In this new version, if the call is made through devlink instead of
      ethtool, we'll also set the error message in extack.
      
      Link: https://lore.kernel.org/netdev/20220307141358.4d52462e@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com/
      
      
      Reviewed-by: default avatarSomnath Kotur <somnath.kotur@broadcom.com>
      Reviewed-by: default avatarPavan Chebbi <pavan.chebbi@broadcom.com>
      Signed-off-by: default avatarKalesh AP <kalesh-anakkur.purayil@broadcom.com>
      Signed-off-by: default avatarMichael Chan <michael.chan@broadcom.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      ab0bed4b
    • Pavan Chebbi's avatar
      bnxt_en: Enable packet timestamping for all RX packets · 66ed81dc
      Pavan Chebbi authored
      
      
      Add driver support to enable timestamping on all RX packets
      that are received by the NIC. This capability can be requested
      by the applications using SIOCSHWTSTAMP ioctl with filter type
      HWTSTAMP_FILTER_ALL.
      
      Cc: Richard Cochran <richardcochran@gmail.com>
      Signed-off-by: default avatarPavan Chebbi <pavan.chebbi@broadcom.com>
      Signed-off-by: default avatarMichael Chan <michael.chan@broadcom.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      66ed81dc
    • Pavan Chebbi's avatar
      bnxt_en: Configure ptp filters during bnxt open · 11862689
      Pavan Chebbi authored
      
      
      For correctness, we need to configure the packet filters for timestamping
      during bnxt_open.  This way they are always configured after firmware
      reset or chip reset.  We should not assume that the filters will always
      be retained across resets.
      
      This patch modifies the ioctl handler and always configures the PTP
      filters in the bnxt_open() path.
      
      Cc: Richard Cochran <richardcochran@gmail.com>
      Signed-off-by: default avatarPavan Chebbi <pavan.chebbi@broadcom.com>
      Signed-off-by: default avatarMichael Chan <michael.chan@broadcom.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      11862689
    • Michael Chan's avatar
      bnxt_en: Update firmware interface to 1.10.2.95 · ad04cc05
      Michael Chan authored
      
      
      The main changes are timestamp support for all RX packets and new PCIe
      statistics.
      
      Signed-off-by: default avatarMichael Chan <michael.chan@broadcom.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      ad04cc05
    • Robert Hancock's avatar
      net: axienet: Use NAPI for TX completion path · 9e2bc267
      Robert Hancock authored
      
      
      This driver was using the TX IRQ handler to perform all TX completion
      tasks. Under heavy TX network load, this can cause significant irqs-off
      latencies (found to be in the hundreds of microseconds using ftrace).
      This can cause other issues, such as overrunning serial UART FIFOs when
      using high baud rates with limited UART FIFO sizes.
      
      Switch to using a NAPI poll handler to perform the TX completion work
      to get this out of hard IRQ context and avoid the IRQ latency impact.
      A separate poll handler is used for TX and RX since they have separate
      IRQs on this controller, so that the completion work for each of them
      stays on the same CPU as the interrupt.
      
      Testing on a Xilinx MPSoC ZU9EG platform using iperf3 from a Linux PC
      through a switch at 1G link speed showed no significant change in TX or
      RX throughput, with approximately 941 Mbps before and after. Hard IRQ
      time in the TX throughput test was significantly reduced from 12% to
      below 1% on the CPU handling TX interrupts, with total hard+soft IRQ CPU
      usage dropping from about 56% down to 48%.
      
      Signed-off-by: default avatarRobert Hancock <robert.hancock@calian.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      9e2bc267
    • Robert Hancock's avatar
      net: axienet: Be more careful about updating tx_bd_tail · f0cf4000
      Robert Hancock authored
      
      
      The axienet_start_xmit function was updating the tx_bd_tail variable
      multiple times, with potential rollbacks on error or invalid
      intermediate positions, even though this variable is also used in the
      TX completion path. Use READ_ONCE where this variable is read and
      WRITE_ONCE where it is written to make this update more atomic, and
      move the write before the MMIO write to start the transfer, so it is
      protected by that implicit write barrier.
      
      Signed-off-by: default avatarRobert Hancock <robert.hancock@calian.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      f0cf4000
    • Eric Dumazet's avatar
      inet: add READ_ONCE(sk->sk_bound_dev_if) in INET_MATCH() · 4915d50e
      Eric Dumazet authored
      
      
      INET_MATCH() runs without holding a lock on the socket.
      
      We probably need to annotate most reads.
      
      This patch makes INET_MATCH() an inline function
      to ease our changes.
      
      v2:
      
      We remove the 32bit version of it, as modern compilers
      should generate the same code really, no need to
      try to be smarter.
      
      Also make 'struct net *net' the first argument.
      
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      4915d50e
    • Amit Cohen's avatar
      selftests: fib_nexthops: Make the test more robust · 49bb39bd
      Amit Cohen authored
      
      
      Rarely some of the test cases fail. Make the test more robust by increasing
      the timeout of ping commands to 5 seconds.
      
      Signed-off-by: default avatarAmit Cohen <amcohen@nvidia.com>
      Reviewed-by: default avatarDavid Ahern <dsahern@kernel.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      49bb39bd
    • David S. Miller's avatar
      Merge branch 'lan95xx-no-polling' · b7da9c6b
      David S. Miller authored
      Lukas Wunner says:
      
      ====================
      Polling be gone on LAN95xx
      
      Do away with link status polling on LAN95xx USB Ethernet
      and rely on interrupts instead, thereby reducing bus traffic,
      CPU overhead and improving interface bringup latency.
      
      Link to v2:
      https://lore.kernel.org/netdev/cover.1651574194.git.lukas@wunner.de/
      
      Only change since v2:
      
      * Patch [5/7]:
        * Drop call to __irq_enter_raw() which worked around a warning in
          generic_handle_domain_irq().  That warning is gone since
          792ea6a0 (queued on tip.git/irq/urgent).
          (Marc Zyngier, Thomas Gleixner)
      ====================
      b7da9c6b
    • Lukas Wunner's avatar
      net: phy: smsc: Cope with hot-removal in interrupt handler · 1e7b81ed
      Lukas Wunner authored
      
      
      If reading the Interrupt Source Flag register fails with -ENODEV, then
      the PHY has been hot-removed and the correct response is to bail out
      instead of throwing a WARN splat and attempting to suspend the PHY.
      The PHY should be stopped in due course anyway as the kernel
      asynchronously tears down the device.
      
      Tested-by: Oleksij Rempel <o.rempel@pengutronix.de> # LAN9514/9512/9500
      Tested-by: Ferry Toth <fntoth@gmail.com> # LAN9514
      Signed-off-by: default avatarLukas Wunner <lukas@wunner.de>
      Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      1e7b81ed
    • Lukas Wunner's avatar
      net: phy: smsc: Cache interrupt mask · 7e8b617e
      Lukas Wunner authored
      
      
      Cache the interrupt mask to avoid re-reading it from the PHY upon every
      interrupt.
      
      This will simplify a subsequent commit which detects hot-removal in the
      interrupt handler and bails out.
      
      Analyzing and debugging PHY transactions also becomes simpler if such
      redundant reads are avoided.
      
      Last not least, interrupt overhead and latency is slightly improved.
      
      Tested-by: Oleksij Rempel <o.rempel@pengutronix.de> # LAN9514/9512/9500
      Tested-by: Ferry Toth <fntoth@gmail.com> # LAN9514
      Signed-off-by: default avatarLukas Wunner <lukas@wunner.de>
      Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      7e8b617e
    • Lukas Wunner's avatar
      usbnet: smsc95xx: Forward PHY interrupts to PHY driver to avoid polling · 1ce8b372
      Lukas Wunner authored
      Link status of SMSC LAN95xx chips is polled once per second, even though
      they're capable of signaling PHY interrupts through the MAC layer.
      
      Forward those interrupts to the PHY driver to avoid polling.  Benefits
      are reduced bus traffic, reduced CPU overhead and quicker interface
      bringup.
      
      Polling was introduced in 2016 by commit d69d1694 ("usbnet:
      smsc95xx: fix link detection for disabled autonegotiation").
      Back then, the LAN95xx driver neglected to enable the ENERGYON interrupt,
      hence couldn't detect link-up events when auto-negotiation was disabled.
      The proper solution would have been to enable the ENERGYON interrupt
      instead of polling.
      
      Since then, PHY handling was moved from the LAN95xx driver to the SMSC
      PHY driver with commit 05b35e7e ("smsc95xx: add phylib support").
      That PHY driver is capable of link detection with auto-negotiation
      disabled because it enables the ENERGYON interrupt.
      
      Note that signaling interrupts through the MAC layer not only works with
      the integrated PHY, but also with an external PHY, provided its
      interrupt pin is attached to LAN95xx's nPHY_INT pin.
      
      In the unlikely event that the interrupt pin of an external PHY is
      attached to a GPIO of the SoC (or not connected at all), the driver can
      be amended to retrieve the irq from the PHY's of_node.
      
      To forward PHY interrupts to phylib, it is not sufficient to call
      phy_mac_interrupt().  Instead, the PHY's interrupt handler needs to run
      so that PHY interrupts are cleared.  That's because according to page
      119 of the LAN950x datasheet, "The source of this interrupt is a level.
      The interrupt persists until it is cleared in the PHY."
      
      https://www.microchip.com/content/dam/mchp/documents/UNG/ProductDocuments/DataSheets/LAN950x-Data-Sheet-DS00001875D.pdf
      
      
      
      Therefore, create an IRQ domain with a single IRQ for the PHY.  In the
      future, the IRQ domain may be extended to support the 11 GPIOs on the
      LAN95xx.
      
      Normally the PHY interrupt should be masked until the PHY driver has
      cleared it.  However masking requires a (sleeping) USB transaction and
      interrupts are received in (non-sleepable) softirq context.  I decided
      not to mask the interrupt at all (by using the dummy_irq_chip's noop
      ->irq_mask() callback):  The USB interrupt endpoint is polled in 1 msec
      intervals and normally that's sufficient to wake the PHY driver's IRQ
      thread and have it clear the interrupt.  If it does take longer, worst
      thing that can happen is the IRQ thread is woken again.  No big deal.
      
      Because PHY interrupts are now perpetually enabled, there's no need to
      selectively enable them on suspend.  So remove all invocations of
      smsc95xx_enable_phy_wakeup_interrupts().
      
      In smsc95xx_resume(), move the call of phy_init_hw() before
      usbnet_resume() (which restarts the status URB) to ensure that the PHY
      is fully initialized when an interrupt is handled.
      
      Tested-by: Oleksij Rempel <o.rempel@pengutronix.de> # LAN9514/9512/9500
      Tested-by: Ferry Toth <fntoth@gmail.com> # LAN9514
      Signed-off-by: default avatarLukas Wunner <lukas@wunner.de>
      Reviewed-by: Andrew Lunn <andrew@lunn.ch> # from a PHY perspective
      Cc: Andre Edich <andre.edich@microchip.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      1ce8b372
    • Lukas Wunner's avatar
      usbnet: smsc95xx: Avoid link settings race on interrupt reception · 8960f878
      Lukas Wunner authored
      
      
      When a PHY interrupt is signaled, the SMSC LAN95xx driver updates the
      MAC full duplex mode and PHY flow control registers based on cached data
      in struct phy_device:
      
        smsc95xx_status()                 # raises EVENT_LINK_RESET
          usbnet_deferred_kevent()
            smsc95xx_link_reset()         # uses cached data in phydev
      
      Simultaneously, phylib polls link status once per second and updates
      that cached data:
      
        phy_state_machine()
          phy_check_link_status()
            phy_read_status()
              lan87xx_read_status()
                genphy_read_status()      # updates cached data in phydev
      
      If smsc95xx_link_reset() wins the race against genphy_read_status(),
      the registers may be updated based on stale data.
      
      E.g. if the link was previously down, phydev->duplex is set to
      DUPLEX_UNKNOWN and that's what smsc95xx_link_reset() will use, even
      though genphy_read_status() may update it to DUPLEX_FULL afterwards.
      
      PHY interrupts are currently only enabled on suspend to trigger wakeup,
      so the impact of the race is limited, but we're about to enable them
      perpetually.
      
      Avoid the race by delaying execution of smsc95xx_link_reset() until
      phy_state_machine() has done its job and calls back via
      smsc95xx_handle_link_change().
      
      Signaling EVENT_LINK_RESET on wakeup is not necessary because phylib
      picks up link status changes through polling.  So drop the declaration
      of a ->link_reset() callback.
      
      Note that the semicolon on a line by itself added in smsc95xx_status()
      is a placeholder for a function call which will be added in a subsequent
      commit.  That function call will actually handle the INT_ENP_PHY_INT_
      interrupt.
      
      Tested-by: Oleksij Rempel <o.rempel@pengutronix.de> # LAN9514/9512/9500
      Tested-by: Ferry Toth <fntoth@gmail.com> # LAN9514
      Signed-off-by: default avatarLukas Wunner <lukas@wunner.de>
      Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      8960f878
    • Lukas Wunner's avatar
      usbnet: smsc95xx: Don't reset PHY behind PHY driver's back · 14021da6
      Lukas Wunner authored
      
      
      smsc95xx_reset() resets the PHY behind the PHY driver's back, which
      seems like a bad idea generally.  Remove that portion of the function.
      
      We're about to use PHY interrupts instead of polling to detect link
      changes on SMSC LAN95xx chips.  Because smsc95xx_reset() is called from
      usbnet_open(), PHY interrupt settings are lost whenever the net_device
      is brought up.
      
      There are two other callers of smsc95xx_reset(), namely smsc95xx_bind()
      and smsc95xx_reset_resume(), and both may indeed benefit from a PHY
      reset.  However they already perform one through their calls to
      phy_connect_direct() and phy_init_hw().
      
      Tested-by: Oleksij Rempel <o.rempel@pengutronix.de> # LAN9514/9512/9500
      Tested-by: Ferry Toth <fntoth@gmail.com> # LAN9514
      Signed-off-by: default avatarLukas Wunner <lukas@wunner.de>
      Cc: Martyn Welch <martyn.welch@collabora.com>
      Cc: Gabriel Hojda <ghojda@yo2urs.ro>
      Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      14021da6