Skip to content
Snippets Groups Projects
  1. Jan 05, 2022
  2. Dec 22, 2021
  3. Dec 16, 2021
  4. Nov 05, 2021
  5. Oct 21, 2021
    • Erik Ekman's avatar
      sfc: Don't use netif_info before net_device setup · bf6abf34
      Erik Ekman authored
      
      Use pci_info instead to avoid unnamed/uninitialized noise:
      
      [197088.688729] sfc 0000:01:00.0: Solarflare NIC detected
      [197088.690333] sfc 0000:01:00.0: Part Number : SFN5122F
      [197088.729061] sfc 0000:01:00.0 (unnamed net_device) (uninitialized): no SR-IOV VFs probed
      [197088.729071] sfc 0000:01:00.0 (unnamed net_device) (uninitialized): no PTP support
      
      Inspired by fa44821a ("sfc: don't use netif_info et al before
      net_device is registered") from Heiner Kallweit.
      
      Signed-off-by: default avatarErik Ekman <erik@kryo.se>
      Acked-by: default avatarMartin Habets <habetsm.xilinx@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      bf6abf34
    • Erik Ekman's avatar
      sfc: Export fibre-specific supported link modes · c62041c5
      Erik Ekman authored
      The 1/10GbaseT modes were set up for cards with SFP+ cages in
      3497ed8c ("sfc: report supported link speeds on SFP connections").
      10GbaseT was likely used since no 10G fibre mode existed.
      
      The missing fibre modes for 1/10G were added to ethtool.h in 5711a982
      ("net: ethtool: add support for 1000BaseX and missing 10G link modes")
      shortly thereafter.
      
      The user guide available at https://support-nic.xilinx.com/wp/drivers
      
      
      lists support for the following cable and transceiver types in section 2.9:
      - QSFP28 100G Direct Attach Cables
      - QSFP28 100G SR Optical Transceivers (with SR4 modules listed)
      - SFP28 25G Direct Attach Cables
      - SFP28 25G SR Optical Transceivers
      - QSFP+ 40G Direct Attach Cables
      - QSFP+ 40G Active Optical Cables
      - QSFP+ 40G SR4 Optical Transceivers
      - QSFP+ to SFP+ Breakout Direct Attach Cables
      - QSFP+ to SFP+ Breakout Active Optical Cables
      - SFP+ 10G Direct Attach Cables
      - SFP+ 10G SR Optical Transceivers
      - SFP+ 10G LR Optical Transceivers
      - SFP 1000BASE‐T Transceivers
      - 1G Optical Transceivers
      (From user guide issue 28. Issue 16 which also includes older cards like
      SFN5xxx/SFN6xxx has matching lists for 1/10/40G transceiver types.)
      
      Regarding SFP+ 10GBASE‐T transceivers the latest guide says:
      "Solarflare adapters do not support 10GBASE‐T transceiver modules."
      
      Tested using SFN5122F-R7 (with 2 SFP+ ports). Supported link modes do not change
      depending on module used (tested with 1000BASE-T, 1000BASE-BX10, 10GBASE-LR).
      Before:
      
      $ ethtool ext
      Settings for ext:
      	Supported ports: [ FIBRE ]
      	Supported link modes:   1000baseT/Full
      	                        10000baseT/Full
      	Supported pause frame use: Symmetric Receive-only
      	Supports auto-negotiation: No
      	Supported FEC modes: Not reported
      	Advertised link modes:  Not reported
      	Advertised pause frame use: No
      	Advertised auto-negotiation: No
      	Advertised FEC modes: Not reported
      	Link partner advertised link modes:  Not reported
      	Link partner advertised pause frame use: No
      	Link partner advertised auto-negotiation: No
      	Link partner advertised FEC modes: Not reported
      	Speed: 1000Mb/s
      	Duplex: Full
      	Auto-negotiation: off
      	Port: FIBRE
      	PHYAD: 255
      	Transceiver: internal
              Current message level: 0x000020f7 (8439)
                                     drv probe link ifdown ifup rx_err tx_err hw
      	Link detected: yes
      
      After:
      
      $ ethtool ext
      Settings for ext:
      	Supported ports: [ FIBRE ]
      	Supported link modes:   1000baseT/Full
      	                        1000baseX/Full
      	                        10000baseCR/Full
      	                        10000baseSR/Full
      	                        10000baseLR/Full
      	Supported pause frame use: Symmetric Receive-only
      	Supports auto-negotiation: No
      	Supported FEC modes: Not reported
      	Advertised link modes:  Not reported
      	Advertised pause frame use: No
      	Advertised auto-negotiation: No
      	Advertised FEC modes: Not reported
      	Link partner advertised link modes:  Not reported
      	Link partner advertised pause frame use: No
      	Link partner advertised auto-negotiation: No
      	Link partner advertised FEC modes: Not reported
      	Speed: 1000Mb/s
      	Duplex: Full
      	Auto-negotiation: off
      	Port: FIBRE
      	PHYAD: 255
      	Transceiver: internal
      	Supports Wake-on: g
      	Wake-on: d
              Current message level: 0x000020f7 (8439)
                                     drv probe link ifdown ifup rx_err tx_err hw
      	Link detected: yes
      
      Signed-off-by: default avatarErik Ekman <erik@kryo.se>
      Acked-by: default avatarMartin Habets <habetsm.xilinx@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      c62041c5
  6. Oct 18, 2021
  7. Oct 14, 2021
  8. Oct 02, 2021
  9. Sep 09, 2021
    • Íñigo Huguet's avatar
      sfc: last resort fallback for lack of xdp tx queues · 6215b608
      Íñigo Huguet authored
      
      Previous patch addressed the situation of having some free resources for
      xdp tx but not enough for one tx queue per CPU. This patch address the
      worst case of not having resources at all for xdp tx.
      
      Instead of using queues dedicated to xdp, normal queues used by network
      stack are shared for both cases, using __netif_tx_lock for
      synchronization. Also queue stop/restart must be considered in the xdp
      path to avoid freezing the queue.
      
      This is not the ideal situation we might want to be, and a performance
      penalty is expected both for normal and xdp traffic, but at least XDP
      will work in all possible situations (with a warning in the logs),
      improving a bit the pain of not knowing in what situations we can use it
      and in what situations we cannot.
      
      Signed-off-by: default avatarÍñigo Huguet <ihuguet@redhat.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      6215b608
    • Íñigo Huguet's avatar
      sfc: fallback for lack of xdp tx queues · 41544618
      Íñigo Huguet authored
      
      If there are not enough resources to allocate one TX queue per core for
      XDP TX it was completely disabled.
      
      This patch implements a fallback solution for sharing the available
      queues using __netif_tx_lock for synchronization. In the normal case that
      there is one TX queue per CPU, no locking is done, as it was before.
      
      With this fallback solution, XDP TX will work in much more cases that
      were failing, specially in machines with many CPUs. It's hard for XDP
      users to know what features are supported across different NICs and
      configurations, so they will benefit on having wider support.
      
      Signed-off-by: default avatarÍñigo Huguet <ihuguet@redhat.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      41544618
  10. Aug 24, 2021
  11. Aug 23, 2021
  12. Aug 22, 2021
  13. Aug 20, 2021
  14. Aug 14, 2021
    • Arnd Bergmann's avatar
      ethernet: fix PTP_1588_CLOCK dependencies · e5f31552
      Arnd Bergmann authored
      The 'imply' keyword does not do what most people think it does, it only
      politely asks Kconfig to turn on another symbol, but does not prevent
      it from being disabled manually or built as a loadable module when the
      user is built-in. In the ICE driver, the latter now causes a link failure:
      
      aarch64-linux-ld: drivers/net/ethernet/intel/ice/ice_main.o: in function `ice_eth_ioctl':
      ice_main.c:(.text+0x13b0): undefined reference to `ice_ptp_get_ts_config'
      ice_main.c:(.text+0x13b0): relocation truncated to fit: R_AARCH64_CALL26 against undefined symbol `ice_ptp_get_ts_config'
      aarch64-linux-ld: ice_main.c:(.text+0x13bc): undefined reference to `ice_ptp_set_ts_config'
      ice_main.c:(.text+0x13bc): relocation truncated to fit: R_AARCH64_CALL26 against undefined symbol `ice_ptp_set_ts_config'
      aarch64-linux-ld: drivers/net/ethernet/intel/ice/ice_main.o: in function `ice_prepare_for_reset':
      ice_main.c:(.text+0x31fc): undefined reference to `ice_ptp_release'
      ice_main.c:(.text+0x31fc): relocation truncated to fit: R_AARCH64_CALL26 against undefined symbol `ice_ptp_release'
      aarch64-linux-ld: drivers/net/ethernet/intel/ice/ice_main.o: in function `ice_rebuild':
      
      This is a recurring problem in many drivers, and we have discussed
      it several times befores, without reaching a consensus. I'm providing
      a link to the previous email thread for reference, which discusses
      some related problems.
      
      To solve the dependency issue better than the 'imply' keyword, introduce a
      separate Kconfig symbol "CONFIG_PTP_1588_CLOCK_OPTIONAL" that any driver
      can depend on if it is able to use PTP support when available, but works
      fine without it. Whenever CONFIG_PTP_1588_CLOCK=m, those drivers are
      then prevented from being built-in, the same way as with a 'depends on
      PTP_1588_CLOCK || !PTP_1588_CLOCK' dependency that does the same trick,
      but that can be rather confusing when you first see it.
      
      Since this should cover the dependencies correctly, the IS_REACHABLE()
      hack in the header is no longer needed now, and can be turned back
      into a normal IS_ENABLED() check. Any driver that gets the dependency
      wrong will now cause a link time failure rather than being unable to use
      PTP support when that is in a loadable module.
      
      However, the two recently added ptp_get_vclocks_index() and
      ptp_convert_timestamp() interfaces are only called from builtin code with
      ethtool and socket timestamps, so keep the current behavior by stubbing
      those out completely when PTP is in a loadable module. This should be
      addressed properly in a follow-up.
      
      As Richard suggested, we may want to actually turn PTP support into a
      'bool' option later on, preventing it from being a loadable module
      altogether, which would be one way to solve the problem with the ethtool
      interface.
      
      Fixes: 06c16d89 ("ice: register 1588 PTP clock device object for E810 devices")
      Link: https://lore.kernel.org/netdev/20210804121318.337276-1-arnd@kernel.org/
      Link: https://lore.kernel.org/netdev/CAK8P3a06enZOf=XyZ+zcAwBczv41UuCTz+=0FMf2gBz1_cOnZQ@mail.gmail.com/
      Link: https://lore.kernel.org/netdev/CAK8P3a3=eOxE-K25754+fB_-i_0BZzf9a9RfPTX3ppSwu9WZXw@mail.gmail.com/
      Link: https://lore.kernel.org/netdev/20210726084540.3282344-1-arnd@kernel.org/
      
      
      Acked-by: default avatarShannon Nelson <snelson@pensando.io>
      Acked-by: default avatarJacob Keller <jacob.e.keller@intel.com>
      Acked-by: default avatarRichard Cochran <richardcochran@gmail.com>
      Reviewed-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Link: https://lore.kernel.org/r/20210812183509.1362782-1-arnd@kernel.org
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      e5f31552
  15. Jul 27, 2021
    • Arnd Bergmann's avatar
      dev_ioctl: split out ndo_eth_ioctl · a7605370
      Arnd Bergmann authored
      
      Most users of ndo_do_ioctl are ethernet drivers that implement
      the MII commands SIOCGMIIPHY/SIOCGMIIREG/SIOCSMIIREG, or hardware
      timestamping with SIOCSHWTSTAMP/SIOCGHWTSTAMP.
      
      Separate these from the few drivers that use ndo_do_ioctl to
      implement SIOCBOND, SIOCBR and SIOCWANDEV commands.
      
      This is a purely cosmetic change intended to help readers find
      their way through the implementation.
      
      Cc: Doug Ledford <dledford@redhat.com>
      Cc: Jason Gunthorpe <jgg@ziepe.ca>
      Cc: Jay Vosburgh <j.vosburgh@gmail.com>
      Cc: Veaceslav Falico <vfalico@gmail.com>
      Cc: Andy Gospodarek <andy@greyhouse.net>
      Cc: Andrew Lunn <andrew@lunn.ch>
      Cc: Vivien Didelot <vivien.didelot@gmail.com>
      Cc: Florian Fainelli <f.fainelli@gmail.com>
      Cc: Vladimir Oltean <olteanv@gmail.com>
      Cc: Leon Romanovsky <leon@kernel.org>
      Cc: linux-rdma@vger.kernel.org
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Acked-by: default avatarJason Gunthorpe <jgg@nvidia.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      a7605370
  16. Jul 13, 2021
    • Íñigo Huguet's avatar
      sfc: add logs explaining XDP_TX/REDIRECT is not available · d2a16bde
      Íñigo Huguet authored
      
      If it's not possible to allocate enough channels for XDP, XDP_TX and
      XDP_REDIRECT don't work. However, only a message saying that not enough
      channels were available was shown, but not saying what are the
      consequences in that case. The user didn't know if he/she can use XDP
      or not, if the performance is reduced, or what.
      
      Signed-off-by: default avatarÍñigo Huguet <ihuguet@redhat.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      d2a16bde
    • Íñigo Huguet's avatar
      sfc: ensure correct number of XDP queues · 788bc000
      Íñigo Huguet authored
      
      Commit 99ba0ea6 ("sfc: adjust efx->xdp_tx_queue_count with the real
      number of initialized queues") intended to fix a problem caused by a
      round up when calculating the number of XDP channels and queues.
      However, this was not the real problem. The real problem was that the
      number of XDP TX queues had been reduced to half in
      commit e26ca4b5 ("sfc: reduce the number of requested xdp ev queues"),
      but the variable xdp_tx_queue_count had remained the same.
      
      Once the correct number of XDP TX queues is created again in the
      previous patch of this series, this also can be reverted since the error
      doesn't actually exist.
      
      Only in the case that there is a bug in the code we can have different
      values in xdp_queue_number and efx->xdp_tx_queue_count. Because of this,
      and per Edward Cree's suggestion, I add instead a WARN_ON to catch if it
      happens again in the future.
      
      Note that the number of allocated queues can be higher than the number
      of used ones due to the round up, as explained in the existing comment
      in the code. That's why we also have to stop increasing xdp_queue_number
      beyond efx->xdp_tx_queue_count.
      
      Signed-off-by: default avatarÍñigo Huguet <ihuguet@redhat.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      788bc000
    • Íñigo Huguet's avatar
      sfc: fix lack of XDP TX queues - error XDP TX failed (-22) · f28100cb
      Íñigo Huguet authored
      Fixes: e26ca4b5 sfc: reduce the number of requested xdp ev queues
      
      The buggy commit intended to allocate less channels for XDP in order to
      be more unlikely to reach the limit of 32 channels of the driver.
      
      The idea was to use each IRQ/eventqeue for more XDP TX queues than
      before, calculating which is the maximum number of TX queues that one
      event queue can handle. For example, in EF10 each event queue could
      handle up to 8 queues, better than the 4 they were handling before the
      change. This way, it would have to allocate half of channels than before
      for XDP TX.
      
      The problem is that the TX queues are also contained inside the channel
      structs, and there are only 4 queues per channel. Reducing the number of
      channels means also reducing the number of queues, resulting in not
      having the desired number of 1 queue per CPU.
      
      This leads to getting errors on XDP_TX and XDP_REDIRECT if they're
      executed from a high numbered CPU, because there only exist queues for
      the low half of CPUs, actually. If XDP_TX/REDIRECT is executed in a low
      numbered CPU, the error doesn't happen. This is the error in the logs
      (repeated many times, even rate limited):
      sfc 0000:5e:00.0 ens3f0np0: XDP TX failed (-22)
      
      This errors happens in function efx_xdp_tx_buffers, where it expects to
      have a dedicated XDP TX queue per CPU.
      
      Reverting the change makes again more likely to reach the limit of 32
      channels in machines with many CPUs. If this happen, no XDP_TX/REDIRECT
      will be possible at all, and we will have this log error messages:
      
      At interface probe:
      sfc 0000:5e:00.0: Insufficient resources for 12 XDP event queues (24 other channels, max 32)
      
      At every subsequent XDP_TX/REDIRECT failure, rate limited:
      sfc 0000:5e:00.0 ens3f0np0: XDP TX failed (-22)
      
      However, without reverting the change, it makes the user to think that
      everything is OK at probe time, but later it fails in an unpredictable
      way, depending on the CPU that handles the packet.
      
      It is better to restore the predictable behaviour. If the user sees the
      error message at probe time, he/she can try to configure the best way it
      fits his/her needs. At least, he/she will have 2 options:
      - Accept that XDP_TX/REDIRECT is not available (he/she may not need it)
      - Load sfc module with modparam 'rss_cpus' with a lower number, thus
        creating less normal RX queues/channels, letting more free resources
        for XDP, with some performance penalty.
      
      Anyway, let the calculation of maximum TX queues that can be handled by
      a single event queue, and use it only if it's less than the number of TX
      queues per channel. This doesn't happen in practice, but could happen if
      some constant values are tweaked in the future, such us
      EFX_MAX_TXQ_PER_CHANNEL, EFX_MAX_EVQ_SIZE or EFX_MAX_DMAQ_SIZE.
      
      Related mailing list thread:
      https://lore.kernel.org/bpf/20201215104327.2be76156@carbon/
      
      
      
      Signed-off-by: default avatarÍñigo Huguet <ihuguet@redhat.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      f28100cb
  17. Jun 24, 2021
  18. Jun 22, 2021
    • Íñigo Huguet's avatar
      sfc: avoid duplicated code in ef10_sriov · 3ddd6e2f
      Íñigo Huguet authored
      
      The fail path of efx_ef10_sriov_alloc_vf_vswitching is identical to the
      full content of efx_ef10_sriov_free_vf_vswitching, so replace it for a
      single call to efx_ef10_sriov_free_vf_vswitching.
      
      Signed-off-by: default avatarÍñigo Huguet <ihuguet@redhat.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      3ddd6e2f
    • Íñigo Huguet's avatar
      sfc: explain that "attached" VFs only refer to Xen · 9a022e76
      Íñigo Huguet authored
      
      During SRIOV disabling it is checked wether any VF is currently attached
      to a guest, using pci_vfs_assigned function. However, this check only
      works with VFs attached with Xen, not with vfio/KVM. Added comments
      clarifying this point.
      
      Also, replaced manual check of PCI_DEV_FLAGS_ASSIGNED flag and used the
      helper function pci_is_dev_assigned instead.
      
      Signed-off-by: default avatarÍñigo Huguet <ihuguet@redhat.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      9a022e76
    • Íñigo Huguet's avatar
      sfc: error code if SRIOV cannot be disabled · 1ebe4feb
      Íñigo Huguet authored
      
      If SRIOV cannot be disabled during device removal or module unloading,
      return error code so it can be logged properly in the calling function.
      
      Note that this can only happen if any VF is currently attached to a
      guest using Xen, but not with vfio/KVM. Despite that in that case the
      VFs won't work properly with PF removed and/or the module unloaded, I
      have let it as is because I don't know what side effects may have
      changing it, and also it seems to be the same that other drivers are
      doing in this situation.
      
      In the case of being called during SRIOV reconfiguration, the behavior
      hasn't changed because the function is called with force=false.
      
      Signed-off-by: default avatarÍñigo Huguet <ihuguet@redhat.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      1ebe4feb
    • Íñigo Huguet's avatar
      sfc: avoid double pci_remove of VFs · 45423cff
      Íñigo Huguet authored
      
      If pci_remove was called for a PF with VFs, the removal of the VFs was
      called twice from efx_ef10_sriov_fini: one directly with pci_driver->remove
      and another implicit by calling pci_disable_sriov, which also perform
      the VFs remove. This was leading to crashing the kernel on the second
      attempt.
      
      Given that pci_disable_sriov already calls to pci remove function, get
      rid of the direct call to pci_driver->remove from the driver.
      
      2 different ways to trigger the bug:
      - Create one or more VFs, then attach the PF to a virtual machine (at
        least with qemu/KVM)
      - Create one or more VFs, then remove the PF with:
        echo 1 > /sys/bus/pci/devices/PF_PCI_ID/remove
      
      Removing sfc module does not trigger the error, at least for me, because
      it removes the VF first, and then the PF.
      
      Example of a log with the error:
          list_del corruption, ffff967fd20a8ad0->next is LIST_POISON1 (dead000000000100)
          ------------[ cut here ]------------
          kernel BUG at lib/list_debug.c:47!
          [...trimmed...]
          RIP: 0010:__list_del_entry_valid.cold.1+0x12/0x4c
          [...trimmed...]
          Call Trace:
          efx_dissociate+0x1f/0x140 [sfc]
          efx_pci_remove+0x27/0x150 [sfc]
          pci_device_remove+0x3b/0xc0
          device_release_driver_internal+0x103/0x1f0
          pci_stop_bus_device+0x69/0x90
          pci_stop_and_remove_bus_device+0xe/0x20
          pci_iov_remove_virtfn+0xba/0x120
          sriov_disable+0x2f/0xe0
          efx_ef10_pci_sriov_disable+0x52/0x80 [sfc]
          ? pcie_aer_is_native+0x12/0x40
          efx_ef10_sriov_fini+0x72/0x110 [sfc]
          efx_pci_remove+0x62/0x150 [sfc]
          pci_device_remove+0x3b/0xc0
          device_release_driver_internal+0x103/0x1f0
          unbind_store+0xf6/0x130
          kernfs_fop_write+0x116/0x190
          vfs_write+0xa5/0x1a0
          ksys_write+0x4f/0xb0
          do_syscall_64+0x5b/0x1a0
          entry_SYSCALL_64_after_hwframe+0x65/0xca
      
      Signed-off-by: default avatarÍñigo Huguet <ihuguet@redhat.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      45423cff
  19. May 24, 2021
  20. May 21, 2021
    • Íñigo Huguet's avatar
      net:sfc: fix non-freed irq in legacy irq mode · 8f03eeb6
      Íñigo Huguet authored
      
      SFC driver can be configured via modparam to work using MSI-X, MSI or
      legacy IRQ interrupts. In the last one, the interrupt was not properly
      released on module remove.
      
      It was not freed because the flag irqs_hooked was not set during
      initialization in the case of using legacy IRQ.
      
      Example of (trimmed) trace during module remove without this fix:
      
      remove_proc_entry: removing non-empty directory 'irq/125', leaking at least '0000:3b:00.1'
      WARNING: CPU: 39 PID: 3658 at fs/proc/generic.c:715 remove_proc_entry+0x15c/0x170
      ...trimmed...
      Call Trace:
       unregister_irq_proc+0xe3/0x100
       free_desc+0x29/0x70
       irq_free_descs+0x47/0x70
       mp_unmap_irq+0x58/0x60
       acpi_unregister_gsi_ioapic+0x2a/0x40
       acpi_pci_irq_disable+0x78/0xb0
       pci_disable_device+0xd1/0x100
       efx_pci_remove+0xa1/0x1e0 [sfc]
       pci_device_remove+0x38/0xa0
       __device_release_driver+0x177/0x230
       driver_detach+0xcb/0x110
       bus_remove_driver+0x58/0xd0
       pci_unregister_driver+0x2a/0xb0
       efx_exit_module+0x24/0xf40 [sfc]
       __do_sys_delete_module.constprop.0+0x171/0x280
       ? exit_to_user_mode_prepare+0x83/0x1d0
       do_syscall_64+0x3d/0x80
       entry_SYSCALL_64_after_hwframe+0x44/0xae
      RIP: 0033:0x7f9f9385800b
      ...trimmed...
      
      Signed-off-by: default avatarÍñigo Huguet <ihuguet@redhat.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      8f03eeb6
    • Yang Yingliang's avatar
      sfc: farch: fix compile warning in efx_farch_dimension_resources() · 31d990cb
      Yang Yingliang authored
      
      Fix the following kernel build warning when CONFIG_SFC_SRIOV is disabled:
      
        drivers/net/ethernet/sfc/farch.c: In function ‘efx_farch_dimension_resources’:
        drivers/net/ethernet/sfc/farch.c:1671:21: warning: variable ‘buftbl_min’ set but not used [-Wunused-but-set-variable]
          unsigned vi_count, buftbl_min, total_tx_channels;
      
      Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      31d990cb
  21. May 14, 2021
  22. Apr 30, 2021
  23. Apr 27, 2021
    • Ignat Korchagin's avatar
      sfc: adjust efx->xdp_tx_queue_count with the real number of initialized queues · 99ba0ea6
      Ignat Korchagin authored
      
      efx->xdp_tx_queue_count is initially initialized to num_possible_cpus() and is
      later used to allocate and traverse efx->xdp_tx_queues lookup array. However,
      we may end up not initializing all the array slots with real queues during
      probing. This results, for example, in a NULL pointer dereference, when running
      "# ethtool -S <iface>", similar to below
      
      [2570283.664955][T4126959] BUG: kernel NULL pointer dereference, address: 00000000000000f8
      [2570283.681283][T4126959] #PF: supervisor read access in kernel mode
      [2570283.695678][T4126959] #PF: error_code(0x0000) - not-present page
      [2570283.710013][T4126959] PGD 0 P4D 0
      [2570283.721649][T4126959] Oops: 0000 [#1] SMP PTI
      [2570283.734108][T4126959] CPU: 23 PID: 4126959 Comm: ethtool Tainted: G           O      5.10.20-cloudflare-2021.3.1 #1
      [2570283.752641][T4126959] Hardware name: <redacted>
      [2570283.781408][T4126959] RIP: 0010:efx_ethtool_get_stats+0x2ca/0x330 [sfc]
      [2570283.796073][T4126959] Code: 00 85 c0 74 39 48 8b 95 a8 0f 00 00 48 85 d2 74 2d 31 c0 eb 07 48 8b 95 a8 0f 00 00 48 63 c8 49 83 c4 08 83 c0 01 48 8b 14 ca <48> 8b 92 f8 00 00 00 49 89 54 24 f8 39 85 a0 0f 00 00 77 d7 48 8b
      [2570283.831259][T4126959] RSP: 0018:ffffb79a77657ce8 EFLAGS: 00010202
      [2570283.845121][T4126959] RAX: 0000000000000019 RBX: ffffb799cd0c9280 RCX: 0000000000000018
      [2570283.860872][T4126959] RDX: 0000000000000000 RSI: ffff96dd970ce000 RDI: 0000000000000005
      [2570283.876525][T4126959] RBP: ffff96dd86f0a000 R08: ffff96dd970ce480 R09: 000000000000005f
      [2570283.892014][T4126959] R10: ffffb799cd0c9fff R11: ffffb799cd0c9000 R12: ffffb799cd0c94f8
      [2570283.907406][T4126959] R13: ffffffffc11b1090 R14: ffff96dd970ce000 R15: ffffffffc11cd66c
      [2570283.922705][T4126959] FS:  00007fa7723f8740(0000) GS:ffff96f51fac0000(0000) knlGS:0000000000000000
      [2570283.938848][T4126959] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      [2570283.952524][T4126959] CR2: 00000000000000f8 CR3: 0000001a73e6e006 CR4: 00000000007706e0
      [2570283.967529][T4126959] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      [2570283.982400][T4126959] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
      [2570283.997308][T4126959] PKRU: 55555554
      [25702840.007649][T4126959] Call Trace:
      [25702840.017598][T4126959]  dev_ethtool+0x1832/0x2830
      
      Fix this by adjusting efx->xdp_tx_queue_count after probing to reflect the true
      value of initialized slots in efx->xdp_tx_queues.
      
      Signed-off-by: default avatarIgnat Korchagin <ignat@cloudflare.com>
      Fixes: e26ca4b5 ("sfc: reduce the number of requested xdp ev queues")
      Cc: <stable@vger.kernel.org> # 5.12.x
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      99ba0ea6
  24. Apr 21, 2021
Loading