1. 30 Nov, 2023 10 commits
    • Claudiu Beznea's avatar
      net: ravb: Keep reverse order of operations in ravb_remove() · edf9bc39
      Claudiu Beznea authored
      On RZ/G3S SMARC Carrier II board having RGMII connections b/w Ethernet
      MACs and PHYs it has been discovered that doing unbind/bind for ravb
      driver in a loop leads to wrong speed and duplex for Ethernet links and
      broken connectivity (the connectivity cannot be restored even with
      bringing interface down/up). Before doing unbind/bind the Ethernet
      interfaces were configured though systemd. The sh instructions used to
      do unbind/bind were:
      
      $ cd /sys/bus/platform/drivers/ravb/
      $ while :; do echo 11c30000.ethernet > unbind ; \
        echo 11c30000.ethernet > bind; done
      
      It has been discovered that there is a race b/w IOCTLs initialized by
      systemd at the response of success binding and the
      "ravb_write(ndev, CCC_OPC_RESET, CCC)" call in ravb_remove() as
      follows:
      
      1/ as a result of bind success the user space open/configures the
         interfaces tough an IOCTL; the following stack trace has been
         identified on RZ/G3S:
      
      Call trace:
      dump_backtrace+0x9c/0x100
      show_stack+0x20/0x38
      dump_stack_lvl+0x48/0x60
      dump_stack+0x18/0x28
      ravb_open+0x70/0xa58
      __dev_open+0xf4/0x1e8
      __dev_change_flags+0x198/0x218
      dev_change_flags+0x2c/0x80
      devinet_ioctl+0x640/0x708
      inet_ioctl+0x1e4/0x200
      sock_do_ioctl+0x50/0x108
      sock_ioctl+0x240/0x358
      __arm64_sys_ioctl+0xb0/0x100
      invoke_syscall+0x50/0x128
      el0_svc_common.constprop.0+0xc8/0xf0
      do_el0_svc+0x24/0x38
      el0_svc+0x34/0xb8
      el0t_64_sync_handler+0xc0/0xc8
      el0t_64_sync+0x190/0x198
      
      2/ this call may execute concurrently with ravb_remove() as the
         unbind/bind operation was executed in a loop
      3/ if the operation mode is changed to RESET (through
         ravb_write(ndev, CCC_OPC_RESET, CCC) call in ravb_remove())
         while the above ravb_open() is in progress it may lead to MAC
         (or PHY, or MAC-PHY connection, the right point hasn't been identified
         at the moment) to be broken, thus the Ethernet connectivity fails to
         restore.
      
      The simple fix for this is to move ravb_write(ndev, CCC_OPC_RESET, CCC))
      after unregister_netdev() to avoid resetting the controller while the
      netdev interface is still registered.
      
      To avoid future issues in ravb_remove(), the patch follows the proper order
      of operations in ravb_remove(): reverse order compared with ravb_probe().
      This avoids described races as the IOCTLs as well as unregister_netdev()
      (called now at the beginning of ravb_remove()) calls rtnl_lock() before
      continuing and IOCTLs check (though devinet_ioctl()) if device is still
      registered just after taking the lock:
      
      int devinet_ioctl(struct net *net, unsigned int cmd, struct ifreq *ifr)
      {
      	// ...
      
              rtnl_lock();
      
              ret = -ENODEV;
              dev = __dev_get_by_name(net, ifr->ifr_name);
              if (!dev)
                      goto done;
      
      	// ...
      done:
              rtnl_unlock();
      out:
              return ret;
      }
      
      Fixes: c156633f ("Renesas Ethernet AVB driver proper")
      Reviewed-by: default avatarSergey Shtylyov <s.shtylyov@omp.ru>
      Signed-off-by: default avatarClaudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      edf9bc39
    • Claudiu Beznea's avatar
      net: ravb: Stop DMA in case of failures on ravb_open() · eac16a73
      Claudiu Beznea authored
      In case ravb_phy_start() returns with error the settings applied in
      ravb_dmac_init() are not reverted (e.g. config mode). For this call
      ravb_stop_dma() on failure path of ravb_open().
      
      Fixes: a0d2f206 ("Renesas Ethernet AVB PTP clock driver")
      Reviewed-by: default avatarSergey Shtylyov <s.shtylyov@omp.ru>
      Signed-off-by: default avatarClaudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      eac16a73
    • Claudiu Beznea's avatar
      net: ravb: Start TX queues after HW initialization succeeded · 6f32c086
      Claudiu Beznea authored
      ravb_phy_start() may fail. If that happens, the TX queues will remain
      started. Thus, move the netif_tx_start_all_queues() after PHY is
      successfully initialized.
      
      Fixes: c156633f ("Renesas Ethernet AVB driver proper")
      Reviewed-by: default avatarSergey Shtylyov <s.shtylyov@omp.ru>
      Signed-off-by: default avatarClaudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
      Reviewed-by: default avatarKalesh AP <kalesh-anakkur.purayil@broadcom.com>
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      6f32c086
    • Claudiu Beznea's avatar
      net: ravb: Make write access to CXR35 first before accessing other EMAC registers · d78c0ced
      Claudiu Beznea authored
      Hardware manual of RZ/G3S (and RZ/G2L) specifies the following on the
      description of CXR35 register (chapter "PHY interface select register
      (CXR35)"): "After release reset, make write-access to this register before
      making write-access to other registers (except MDIOMOD). Even if not need
      to change the value of this register, make write-access to this register
      at least one time. Because RGMII/MII MODE is recognized by accessing this
      register".
      
      The setup procedure for EMAC module (chapter "Setup procedure" of RZ/G3S,
      RZ/G2L manuals) specifies the E-MAC.CXR35 register is the first EMAC
      register that is to be configured.
      
      Note [A] from chapter "PHY interface select register (CXR35)" specifies
      the following:
      [A] The case which CXR35 SEL_XMII is used for the selection of RGMII/MII
      in APB Clock 100 MHz.
      (1) To use RGMII interface, Set ‘H’03E8_0000’ to this register.
      (2) To use MII interface, Set ‘H’03E8_0002’ to this register.
      
      Take into account these indication.
      
      Fixes: 1089877a ("ravb: Add RZ/G2L MII interface support")
      Reviewed-by: default avatarSergey Shtylyov <s.shtylyov@omp.ru>
      Signed-off-by: default avatarClaudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      d78c0ced
    • Claudiu Beznea's avatar
      net: ravb: Use pm_runtime_resume_and_get() · 88b74831
      Claudiu Beznea authored
      pm_runtime_get_sync() may return an error. In case it returns with an error
      dev->power.usage_count needs to be decremented. pm_runtime_resume_and_get()
      takes care of this. Thus use it.
      
      Fixes: c156633f ("Renesas Ethernet AVB driver proper")
      Reviewed-by: default avatarSergey Shtylyov <s.shtylyov@omp.ru>
      Signed-off-by: default avatarClaudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      88b74831
    • Claudiu Beznea's avatar
      net: ravb: Check return value of reset_control_deassert() · d8eb6ea4
      Claudiu Beznea authored
      reset_control_deassert() could return an error. Some devices cannot work
      if reset signal de-assert operation fails. To avoid this check the return
      code of reset_control_deassert() in ravb_probe() and take proper action.
      
      Along with it, the free_netdev() call from the error path was moved after
      reset_control_assert() on its own label (out_free_netdev) to free
      netdev in case reset_control_deassert() fails.
      
      Fixes: 0d13a1a4 ("ravb: Add reset support")
      Reviewed-by: default avatarSergey Shtylyov <s.shtylyov@omp.ru>
      Reviewed-by: default avatarPhilipp Zabel <p.zabel@pengutronix.de>
      Signed-off-by: default avatarClaudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      d8eb6ea4
    • Jiawen Wu's avatar
      net: libwx: fix memory leak on msix entry · 91fdb30d
      Jiawen Wu authored
      Since pci_free_irq_vectors() set pdev->msix_enabled as 0 in the
      calling of pci_msix_shutdown(), wx->msix_entries is never freed.
      Reordering the lines to fix the memory leak.
      
      Cc: stable@vger.kernel.org
      Fixes: 3f703186 ("net: libwx: Add irq flow functions")
      Signed-off-by: default avatarJiawen Wu <jiawenwu@trustnetic.com>
      Reviewed-by: default avatarKalesh AP <kalesh-anakkur.purayil@broadcom.com>
      Link: https://lore.kernel.org/r/20231128095928.1083292-1-jiawenwu@trustnetic.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      91fdb30d
    • Dave Ertman's avatar
      ice: Fix VF Reset paths when interface in a failed over aggregate · 9f74a3df
      Dave Ertman authored
      There is an error when an interface has the following conditions:
      - PF is in an aggregate (bond)
      - PF has VFs created on it
      - bond is in a state where it is failed-over to the secondary interface
      - A VF reset is issued on one or more of those VFs
      
      The issue is generated by the originating PF trying to rebuild or
      reconfigure the VF resources.  Since the bond is failed over to the
      secondary interface the queue contexts are in a modified state.
      
      To fix this issue, have the originating interface reclaim its resources
      prior to the tear-down and rebuild or reconfigure.  Then after the process
      is complete, move the resources back to the currently active interface.
      
      There are multiple paths that can be used depending on what triggered the
      event, so create a helper function to move the queues and use paired calls
      to the helper (back to origin, process, then move back to active interface)
      under the same lag_mutex lock.
      
      Fixes: 1e0f9881 ("ice: Flesh out implementation of support for SRIOV on bonded interface")
      Signed-off-by: default avatarDave Ertman <david.m.ertman@intel.com>
      Tested-by: default avatarSujai Buvaneswaran <sujai.buvaneswaran@intel.com>
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      Reviewed-by: default avatarPrzemek Kitszel <przemyslaw.kitszel@intel.com>
      Link: https://lore.kernel.org/r/20231127212340.1137657-1-anthony.l.nguyen@intel.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      9f74a3df
    • Jakub Kicinski's avatar
      Merge tag 'wireless-2023-11-29' of git://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless · 300fbb24
      Jakub Kicinski authored
      Johannes Berg says:
      
      ====================
      wireless fixes:
       - debugfs had a deadlock (removal vs. use of files),
         fixes going through wireless ACKed by Greg
       - support for HT STAs on 320 MHz channels, even if it's
         not clear that should ever happen (that's 6 GHz), best
         not to WARN()
       - fix for the previous CQM fix that broke most cases
       - various wiphy locking fixes
       - various small driver fixes
      
      * tag 'wireless-2023-11-29' of git://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless:
        wifi: mac80211: use wiphy locked debugfs for sdata/link
        wifi: mac80211: use wiphy locked debugfs helpers for agg_status
        wifi: cfg80211: add locked debugfs wrappers
        debugfs: add API to allow debugfs operations cancellation
        debugfs: annotate debugfs handlers vs. removal with lockdep
        debugfs: fix automount d_fsdata usage
        wifi: mac80211: handle 320 MHz in ieee80211_ht_cap_ie_to_sta_ht_cap
        wifi: avoid offset calculation on NULL pointer
        wifi: cfg80211: hold wiphy mutex for send_interface
        wifi: cfg80211: lock wiphy mutex for rfkill poll
        wifi: cfg80211: fix CQM for non-range use
        wifi: mac80211: do not pass AP_VLAN vif pointer to drivers during flush
        wifi: iwlwifi: mvm: fix an error code in iwl_mvm_mld_add_sta()
        wifi: mt76: mt7925: fix typo in mt7925_init_he_caps
        wifi: mt76: mt7921: fix 6GHz disabled by the missing default CLC config
      ====================
      
      Link: https://lore.kernel.org/r/20231129150809.31083-3-johannes@sipsolutions.netSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      300fbb24
    • Jakub Kicinski's avatar
      Merge tag 'for-netdev' of https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf · 0d47fa5c
      Jakub Kicinski authored
      Daniel Borkmann says:
      
      ====================
      pull-request: bpf 2023-11-30
      
      We've added 5 non-merge commits during the last 7 day(s) which contain
      a total of 10 files changed, 66 insertions(+), 15 deletions(-).
      
      The main changes are:
      
      1) Fix AF_UNIX splat from use after free in BPF sockmap,
         from John Fastabend.
      
      2) Fix a syzkaller splat in netdevsim by properly handling offloaded
         programs (and not device-bound ones), from Stanislav Fomichev.
      
      3) Fix bpf_mem_cache_alloc_flags() to initialize the allocation hint,
         from Hou Tao.
      
      4) Fix netkit by rejecting IFLA_NETKIT_PEER_INFO in changelink,
         from Daniel Borkmann.
      
      * tag 'for-netdev' of https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf:
        bpf, sockmap: Add af_unix test with both sockets in map
        bpf, sockmap: af_unix stream sockets need to hold ref for pair sock
        netkit: Reject IFLA_NETKIT_PEER_INFO in netkit_change_link
        bpf: Add missed allocation hint for bpf_mem_cache_alloc_flags()
        netdevsim: Don't accept device bound programs
      ====================
      
      Link: https://lore.kernel.org/r/20231129234916.16128-1-daniel@iogearbox.netSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      0d47fa5c
  2. 29 Nov, 2023 5 commits
  3. 28 Nov, 2023 13 commits
  4. 27 Nov, 2023 7 commits
  5. 26 Nov, 2023 5 commits
    • David S. Miller's avatar
      Merge branch 'dpaa2-eth-fixes' · ccf49ceb
      David S. Miller authored
      Ioana Ciornei says:
      
      ====================
      dpaa2-eth: various fixes
      
      The first patch fixes a memory corruption issue happening between the Tx
      and Tx confirmation of a packet by making the Tx alignment at 64bytes
      mandatory instead of optional as it was previously.
      
      The second patch fixes the Rx copybreak code path which recycled the
      initial data buffer before all processing was done on the packet.
      
      Changes in v2:
      - squashed patches #1 and #2
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      ccf49ceb
    • Ioana Ciornei's avatar
      dpaa2-eth: recycle the RX buffer only after all processing done · beb1930f
      Ioana Ciornei authored
      The blamed commit added support for Rx copybreak. This meant that for
      certain frame sizes, a new skb was allocated and the initial data buffer
      was recycled. Instead of waiting to recycle the Rx buffer only after all
      processing was done on it (like accessing the parse results or timestamp
      information), the code path just went ahead and re-used the buffer right
      away.
      
      This sometimes lead to corrupted HW and SW annotation areas.
      Fix this by delaying the moment when the buffer is recycled.
      
      Fixes: 50f82699 ("dpaa2-eth: add rx copybreak support")
      Signed-off-by: default avatarIoana Ciornei <ioana.ciornei@nxp.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      beb1930f
    • Ioana Ciornei's avatar
      dpaa2-eth: increase the needed headroom to account for alignment · f422abe3
      Ioana Ciornei authored
      Increase the needed headroom to account for a 64 byte alignment
      restriction which, with this patch, we make mandatory on the Tx path.
      The case in which the amount of headroom needed is not available is
      already handled by the driver which instead sends a S/G frame with the
      first buffer only holding the SW and HW annotation areas.
      
      Without this patch, we can empirically see data corruption happening
      between Tx and Tx confirmation which sometimes leads to the SW
      annotation area being overwritten.
      
      Since this is an old IP where the hardware team cannot help to
      understand the underlying behavior, we make the Tx alignment mandatory
      for all frames to avoid the crash on Tx conf. Also, remove the comment
      that suggested that this is just an optimization.
      
      This patch also sets the needed_headroom net device field to the usual
      value that the driver would need on the Tx path:
      	- 64 bytes for the software annotation area
      	- 64 bytes to account for a 64 byte aligned buffer address
      
      Fixes: 6e2387e8 ("staging: fsl-dpaa2/eth: Add Freescale DPAA2 Ethernet driver")
      Closes: https://lore.kernel.org/netdev/aa784d0c-85eb-4e5d-968b-c8f74fa86be6@gin.de/Signed-off-by: default avatarIoana Ciornei <ioana.ciornei@nxp.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      f422abe3
    • Greg Ungerer's avatar
      net: dsa: mv88e6xxx: fix marvell 6350 probe crash · a524eabc
      Greg Ungerer authored
      As of commit b92143d4 ("net: dsa: mv88e6xxx: add infrastructure for
      phylink_pcs") probing of a Marvell 88e6350 switch causes a NULL pointer
      de-reference like this example:
      
          ...
          mv88e6085 d0072004.mdio-mii:11: switch 0x3710 detected: Marvell 88E6350, revision 2
          8<--- cut here ---
          Unable to handle kernel NULL pointer dereference at virtual address 00000000 when read
          [00000000] *pgd=00000000
          Internal error: Oops: 5 [#1] ARM
          Modules linked in:
          CPU: 0 PID: 8 Comm: kworker/u2:0 Not tainted 6.7.0-rc2-dirty #26
          Hardware name: Marvell Armada 370/XP (Device Tree)
          Workqueue: events_unbound deferred_probe_work_func
          PC is at mv88e6xxx_port_setup+0x1c/0x44
          LR is at dsa_port_devlink_setup+0x74/0x154
          pc : [<c057ea24>]    lr : [<c0819598>]    psr: a0000013
          sp : c184fce0  ip : c542b8f4  fp : 00000000
          r10: 00000001  r9 : c542a540  r8 : c542bc00
          r7 : c542b838  r6 : c5244580  r5 : 00000005  r4 : c5244580
          r3 : 00000000  r2 : c542b840  r1 : 00000005  r0 : c1a02040
          ...
      
      The Marvell 6350 switch has no SERDES interface and so has no
      corresponding pcs_ops defined for it. But during probing a call is made
      to mv88e6xxx_port_setup() which unconditionally expects pcs_ops to exist -
      though the presence of the pcs_ops->pcs_init function is optional.
      
      Modify code to check for pcs_ops first, before checking for and calling
      pcs_ops->pcs_init. Modify checking and use of pcs_ops->pcs_teardown
      which may potentially suffer the same problem.
      
      Fixes: b92143d4 ("net: dsa: mv88e6xxx: add infrastructure for phylink_pcs")
      Signed-off-by: default avatarGreg Ungerer <gerg@kernel.org>
      Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      a524eabc
    • Greg Ungerer's avatar
      net: dsa: mv88e6xxx: fix marvell 6350 switch probing · b3f1a164
      Greg Ungerer authored
      As of commit de5c9bf4 ("net: phylink: require supported_interfaces to
      be filled") Marvell 88e6350 switches fail to be probed:
      
          ...
          mv88e6085 d0072004.mdio-mii:11: switch 0x3710 detected: Marvell 88E6350, revision 2
          mv88e6085 d0072004.mdio-mii:11: phylink: error: empty supported_interfaces
          error creating PHYLINK: -22
          mv88e6085: probe of d0072004.mdio-mii:11 failed with error -22
          ...
      
      The problem stems from the use of mv88e6185_phylink_get_caps() to get
      the device capabilities. Create a new dedicated phylink_get_caps for the
      6351 family (which the 6350 is one of) to properly support their set of
      capabilities.
      
      According to chip.h the 6351 switch family includes the 6171, 6175, 6350
      and 6351 switches, so update each of these to use the correct
      phylink_get_caps.
      
      Fixes: de5c9bf4 ("net: phylink: require supported_interfaces to be filled")
      Signed-off-by: default avatarGreg Ungerer <gerg@kernel.org>
      Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      b3f1a164