1. 16 12月, 2021 7 次提交
    • J
      ice: use prefetch methods · cc14db11
      Jesse Brandeburg 提交于
      The kernel provides some prefetch mechanisms to speed up commonly
      cold cache line accesses during receive processing. Since these are
      software structures it helps to have these strategically placed
      prefetches.
      
      Be careful to call BQL prefetch complete only for non XDP queues.
      Co-developed-by: NPiotr Raczynski <piotr.raczynski@intel.com>
      Signed-off-by: NPiotr Raczynski <piotr.raczynski@intel.com>
      Signed-off-by: NJesse Brandeburg <jesse.brandeburg@intel.com>
      Tested-by: NGurucharan G <gurucharanx.g@intel.com>
      Signed-off-by: NTony Nguyen <anthony.l.nguyen@intel.com>
      cc14db11
    • J
      ice: update to newer kernel API · 1c96c168
      Jesse Brandeburg 提交于
      Use the netif_tx_* API from netdevice.h which has simpler parameters.
      Signed-off-by: NJesse Brandeburg <jesse.brandeburg@intel.com>
      Tested-by: NGurucharan G <gurucharanx.g@intel.com>
      Signed-off-by: NTony Nguyen <anthony.l.nguyen@intel.com>
      1c96c168
    • J
      ice: support immediate firmware activation via devlink reload · 399e27db
      Jacob Keller 提交于
      The ice hardware contains an embedded chip with firmware which can be
      updated using devlink flash. The firmware which runs on this chip is
      referred to as the Embedded Management Processor firmware (EMP
      firmware).
      
      Activating the new firmware image currently requires that the system be
      rebooted. This is not ideal as rebooting the system can cause unwanted
      downtime.
      
      In practical terms, activating the firmware does not always require a
      full system reboot. In many cases it is possible to activate the EMP
      firmware immediately. There are a couple of different scenarios to
      cover.
      
       * The EMP firmware itself can be reloaded by issuing a special update
         to the device called an Embedded Management Processor reset (EMP
         reset). This reset causes the device to reset and reload the EMP
         firmware.
      
       * PCI configuration changes are only reloaded after a cold PCIe reset.
         Unfortunately there is no generic way to trigger this for a PCIe
         device without a system reboot.
      
      When performing a flash update, firmware is capable of responding with
      some information about the specific update requirements.
      
      The driver updates the flash by programming a secondary inactive bank
      with the contents of the new image, and then issuing a command to
      request to switch the active bank starting from the next load.
      
      The response to the final command for updating the inactive NVM flash
      bank includes an indication of the minimum reset required to fully
      update the device. This can be one of the following:
      
       * A full power on is required
       * A cold PCIe reset is required
       * An EMP reset is required
      
      The response to the command to switch flash banks includes an indication
      of whether or not the firmware will allow an EMP reset request.
      
      For most updates, an EMP reset is sufficient to load the new EMP
      firmware without issues. In some cases, this reset is not sufficient
      because the PCI configuration space has changed. When this could cause
      incompatibility with the new EMP image, the firmware is capable of
      rejecting the EMP reset request.
      
      Add logic to ice_fw_update.c to handle the response data flash update
      AdminQ commands.
      
      For the reset level, issue a devlink status notification informing the
      user of how to complete the update with a simple suggestion like
      "Activate new firmware by rebooting the system".
      
      Cache the status of whether or not firmware will restrict the EMP reset
      for use in implementing devlink reload.
      
      Implement support for devlink reload with the "fw_activate" flag. This
      allows user space to request the firmware be activated immediately.
      
      For the .reload_down handler, we will issue a request for the EMP reset
      using the appropriate firmware AdminQ command. If we know that the
      firmware will not allow an EMP reset, simply exit with a suitable
      netlink extended ACK message indicating that the EMP reset is not
      available.
      
      For the .reload_up handler, simply wait until the driver has finished
      resetting. Logic to handle processing of an EMP reset already exists in
      the driver as part of its reset and rebuild flows.
      
      Implement support for the devlink reload interface with the
      "fw_activate" action. This allows userspace to request activation of
      firmware without a reboot.
      
      Note that support for indicating the required reset and EMP reset
      restriction is not supported on old versions of firmware. The driver can
      determine if the two features are supported by checking the device
      capabilities report. I confirmed support has existed since at least
      version 5.5.2 as reported by the 'fw.mgmt' version. Support to issue the
      EMP reset request has existed in all version of the EMP firmware for the
      ice hardware.
      
      Check the device capabilities report to determine whether or not the
      indications are reported by the running firmware. If the reset
      requirement indication is not supported, always assume a full power on
      is necessary. If the reset restriction capability is not supported,
      always assume the EMP reset is available.
      
      Users can verify if the EMP reset has activated the firmware by using
      the devlink info report to check that the 'running' firmware version has
      updated. For example a user might do the following:
      
       # Check current version
       $ devlink dev info
      
       # Update the device
       $ devlink dev flash pci/0000:af:00.0 file firmware.bin
      
       # Confirm stored version updated
       $ devlink dev info
      
       # Reload to activate new firmware
       $ devlink dev reload pci/0000:af:00.0 action fw_activate
      
       # Confirm running version updated
       $ devlink dev info
      
      Finally, this change does *not* implement basic driver-only reload
      support. I did look into trying to do this. However, it requires
      significant refactor of how the ice driver probes and loads everything.
      The ice driver probe and allocation flows were not designed with such
      a reload in mind. Refactoring the flow to support this is beyond the
      scope of this change.
      Signed-off-by: NJacob Keller <jacob.e.keller@intel.com>
      Tested-by: NGurucharan G <gurucharanx.g@intel.com>
      Signed-off-by: NTony Nguyen <anthony.l.nguyen@intel.com>
      399e27db
    • J
      ice: reduce time to read Option ROM CIVD data · af18d886
      Jacob Keller 提交于
      During probe and device reset, the ice driver reads some data from the
      NVM image as part of ice_init_nvm. Part of this data includes a section
      of the Option ROM which contains version information.
      
      The function ice_get_orom_civd_data is used to locate the '$CIV' data
      section of the Option ROM.
      
      Timing of ice_probe and ice_rebuild indicate that the
      ice_get_orom_civd_data function takes about 10 seconds to finish
      executing.
      
      The function locates the section by scanning the Option ROM every 512
      bytes. This requires a significant number of NVM read accesses, since
      the Option ROM bank is 500KB. In the worst case it would take about 1000
      reads. Worse, all PFs serialize this operation during reload because of
      acquiring the NVM semaphore.
      
      The CIVD section is located at the end of the Option ROM image data.
      Unfortunately, the driver has no easy method to determine the offset
      manually. Practical experiments have shown that the data could be at
      a variety of locations, so simply reversing the scanning order is not
      sufficient to reduce the overall read time.
      
      Instead, copy the entire contents of the Option ROM into memory. This
      allows reading the data using 4Kb pages instead of 512 bytes at a time.
      This reduces the total number of firmware commands by a factor of 8. In
      addition, reading the whole section together at once allows better
      indication to firmware of when we're "done".
      
      Re-write ice_get_orom_civd_data to allocate virtual memory to store the
      Option ROM data. Copy the entire OptionROM contents at once using
      ice_read_flash_module. Finally, use this memory copy to scan for the
      '$CIV' section.
      
      This change significantly reduces the time to read the Option ROM CIVD
      section from ~10 seconds down to ~1 second. This has a significant
      impact on the total time to complete a driver rebuild or probe.
      Signed-off-by: NJacob Keller <jacob.e.keller@intel.com>
      Tested-by: NGurucharan G <gurucharanx.g@intel.com>
      Signed-off-by: NTony Nguyen <anthony.l.nguyen@intel.com>
      af18d886
    • J
      ice: move ice_devlink_flash_update and merge with ice_flash_pldm_image · c9f7a483
      Jacob Keller 提交于
      The ice_devlink_flash_update function performs a few upfront checks and
      then calls ice_flash_pldm_image.
      
      Most if these checks make more sense in the context of code within
      ice_flash_pldm_image. Merge ice_devlink_flash_update and
      ice_flash_pldm_image into one function, placing it in ice_fw_update.c
      
      Since this is still the entry point for devlink, call the function
      ice_devlink_flash_update instead of ice_flash_pldm_image. This leaves a
      single function which handles the devlink parameters and then initiates
      a PLDM update.
      
      With this change, the ice_devlink_flash_update function in
      ice_fw_update.c becomes the main entry point for flash update. It
      elimintes some unnecessary boiler plate code between the two previous
      functions. The ultimate motivation for this is that it eases supporting
      a dry run with the PLDM library in a future change.
      Signed-off-by: NJacob Keller <jacob.e.keller@intel.com>
      Tested-by: NGurucharan G <gurucharanx.g@intel.com>
      Signed-off-by: NTony Nguyen <anthony.l.nguyen@intel.com>
      c9f7a483
    • J
      ice: move and rename ice_check_for_pending_update · c356eaa8
      Jacob Keller 提交于
      The ice_devlink_flash_update function performs a few checks and then
      calls ice_flash_pldm_image. One of these checks is to call
      ice_check_for_pending_update. This function checks if the device has
      a pending update, and cancels it if so. This is necessary to allow
      a new flash update to proceed.
      
      We want to refactor the ice code to eliminate ice_devlink_flash_update,
      moving its checks into ice_flash_pldm_image.
      
      To do this, ice_check_for_pending_update will become static, and only
      called by ice_flash_pldm_image. To make this change easier to review,
      first just move the function up within the ice_fw_update.c file.
      
      While at it, note that the function has a misleading name. Its primary
      action is to cancel a pending update. Using the verb "check" does not
      imply this. Rename it to ice_cancel_pending_update.
      Signed-off-by: NJacob Keller <jacob.e.keller@intel.com>
      Tested-by: NGurucharan G <gurucharanx.g@intel.com>
      Signed-off-by: NTony Nguyen <anthony.l.nguyen@intel.com>
      c356eaa8
    • J
      ice: devlink: add shadow-ram region to snapshot Shadow RAM · 78ad87da
      Jacob Keller 提交于
      We have a region for reading the contents of the NVM flash as
      a snapshot. This region does not allow reading the Shadow RAM, as it
      always passes the FLASH_ONLY bit to the low level firmware interface.
      
      Add a separate shadow-ram region which will allow snapshot of the
      current contents of the Shadow RAM. This data is built from the NVM
      contents but is distinct as the device builds up the Shadow RAM during
      initialization, so being able to snapshot its contents can be useful
      when attempting to debug flash related issues.
      
      Fix the comment description of the nvm-flash region which incorrectly
      stated that it filled the shadow-ram region, and add a comment
      explaining that the nvm-flash region does not actually read the Shadow
      RAM.
      Signed-off-by: NJacob Keller <jacob.e.keller@intel.com>
      Tested-by: NGurucharan G <gurucharanx.g@intel.com>
      Signed-off-by: NTony Nguyen <anthony.l.nguyen@intel.com>
      78ad87da
  2. 15 12月, 2021 12 次提交
  3. 14 12月, 2021 1 次提交
    • H
      net_tstamp: add new flag HWTSTAMP_FLAG_BONDED_PHC_INDEX · 9c9211a3
      Hangbin Liu 提交于
      Since commit 94dd016a ("bond: pass get_ts_info and SIOC[SG]HWTSTAMP
      ioctl to active device") the user could get bond active interface's
      PHC index directly. But when there is a failover, the bond active
      interface will change, thus the PHC index is also changed. This may
      break the user's program if they did not update the PHC timely.
      
      This patch adds a new hwtstamp_config flag HWTSTAMP_FLAG_BONDED_PHC_INDEX.
      When the user wants to get the bond active interface's PHC, they need to
      add this flag and be aware the PHC index may be changed.
      
      With the new flag. All flag checks in current drivers are removed. Only
      the checking in net_hwtstamp_validate() is kept.
      Suggested-by: NJakub Kicinski <kuba@kernel.org>
      Signed-off-by: NHangbin Liu <liuhangbin@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      9c9211a3
  4. 09 12月, 2021 1 次提交
  5. 08 12月, 2021 6 次提交
  6. 01 12月, 2021 2 次提交
  7. 30 11月, 2021 1 次提交
    • M
      ice: xsk: clear status_error0 for each allocated desc · d1ec975f
      Maciej Fijalkowski 提交于
      Fix a bug in which the receiving of packets can stop in the zero-copy
      driver. Ice HW ignores 3 lower bits from QRX_TAIL register, which means
      that tail is bumped only on intervals of 8. Currently with XSK RX
      batching in place, ice_alloc_rx_bufs_zc() clears the status_error0 only
      of the last descriptor that has been allocated/taken from the XSK buffer
      pool. status_error0 includes DD bit that is looked upon by the
      ice_clean_rx_irq_zc() to tell if a descriptor can be processed.
      
      The bug can be triggered when driver updates the ntu but not the
      QRX_TAIL, so HW wouldn't have a chance to write to the ready
      descriptors. Later on driver moves the ntc to the mentioned set of
      descriptors and interprets them as a ready to be processed, since
      corresponding DD bits were not cleared nor any writeback has happened
      that would clear it. This can then lead to ntc == ntu case which means
      that ring is empty and no further packet processing.
      
      Fix the XSK traffic hang that can be observed when l2fwd scenario from
      xdpsock is used by making sure that status_error0 is cleared for each
      descriptor that is fed to HW and therefore we are sure that driver will
      not processed non-valid DD bits. This will also prevent the driver from
      processing the descriptors that were allocated in favor of the
      previously processed ones, but writeback didn't happen yet.
      
      Fixes: db804cfc ("ice: Use the xsk batched rx allocation interface")
      Signed-off-by: NMaciej Fijalkowski <maciej.fijalkowski@intel.com>
      Reviewed-by: NAlexander Lobakin <alexandr.lobakin@intel.com>
      Signed-off-by: NTony Nguyen <anthony.l.nguyen@intel.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      d1ec975f
  8. 23 11月, 2021 3 次提交
    • S
      net/ice: Add support for enable_iwarp and enable_roce devlink param · e523af4e
      Shiraz Saleem 提交于
      Allow support for 'enable_iwarp' and 'enable_roce' devlink params to turn
      on/off iWARP or RoCE protocol support for E800 devices.
      
      For example, a user can turn on iWARP functionality with,
      
      devlink dev param set pci/0000:07:00.0 name enable_iwarp value true cmode runtime
      
      This add an iWARP auxiliary rdma device, ice.iwarp.<>, under this PF.
      
      A user request to enable both iWARP and RoCE under the same PF is rejected
      since this device does not support both protocols simultaneously on the
      same port.
      Signed-off-by: NShiraz Saleem <shiraz.saleem@intel.com>
      Tested-by: NLeszek Kaliszczuk <leszek.kaliszczuk@intel.com>
      Signed-off-by: NTony Nguyen <anthony.l.nguyen@intel.com>
      e523af4e
    • M
      ice: avoid bpf_prog refcount underflow · f65ee535
      Marta Plantykow 提交于
      Ice driver has the routines for managing XDP resources that are shared
      between ndo_bpf op and VSI rebuild flow. The latter takes place for
      example when user changes queue count on an interface via ethtool's
      set_channels().
      
      There is an issue around the bpf_prog refcounting when VSI is being
      rebuilt - since ice_prepare_xdp_rings() is called with vsi->xdp_prog as
      an argument that is used later on by ice_vsi_assign_bpf_prog(), same
      bpf_prog pointers are swapped with each other. Then it is also
      interpreted as an 'old_prog' which in turn causes us to call
      bpf_prog_put on it that will decrement its refcount.
      
      Below splat can be interpreted in a way that due to zero refcount of a
      bpf_prog it is wiped out from the system while kernel still tries to
      refer to it:
      
      [  481.069429] BUG: unable to handle page fault for address: ffffc9000640f038
      [  481.077390] #PF: supervisor read access in kernel mode
      [  481.083335] #PF: error_code(0x0000) - not-present page
      [  481.089276] PGD 100000067 P4D 100000067 PUD 1001cb067 PMD 106d2b067 PTE 0
      [  481.097141] Oops: 0000 [#1] PREEMPT SMP PTI
      [  481.101980] CPU: 12 PID: 3339 Comm: sudo Tainted: G           OE     5.15.0-rc5+ #1
      [  481.110840] Hardware name: Intel Corp. GRANTLEY/GRANTLEY, BIOS GRRFCRB1.86B.0276.D07.1605190235 05/19/2016
      [  481.122021] RIP: 0010:dev_xdp_prog_id+0x25/0x40
      [  481.127265] Code: 80 00 00 00 00 0f 1f 44 00 00 89 f6 48 c1 e6 04 48 01 fe 48 8b 86 98 08 00 00 48 85 c0 74 13 48 8b 50 18 31 c0 48 85 d2 74 07 <48> 8b 42 38 8b 40 20 c3 48 8b 96 90 08 00 00 eb e8 66 2e 0f 1f 84
      [  481.148991] RSP: 0018:ffffc90007b63868 EFLAGS: 00010286
      [  481.155034] RAX: 0000000000000000 RBX: ffff889080824000 RCX: 0000000000000000
      [  481.163278] RDX: ffffc9000640f000 RSI: ffff889080824010 RDI: ffff889080824000
      [  481.171527] RBP: ffff888107af7d00 R08: 0000000000000000 R09: ffff88810db5f6e0
      [  481.179776] R10: 0000000000000000 R11: ffff8890885b9988 R12: ffff88810db5f4bc
      [  481.188026] R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
      [  481.196276] FS:  00007f5466d5bec0(0000) GS:ffff88903fb00000(0000) knlGS:0000000000000000
      [  481.205633] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      [  481.212279] CR2: ffffc9000640f038 CR3: 000000014429c006 CR4: 00000000003706e0
      [  481.220530] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      [  481.228771] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
      [  481.237029] Call Trace:
      [  481.239856]  rtnl_fill_ifinfo+0x768/0x12e0
      [  481.244602]  rtnl_dump_ifinfo+0x525/0x650
      [  481.249246]  ? __alloc_skb+0xa5/0x280
      [  481.253484]  netlink_dump+0x168/0x3c0
      [  481.257725]  netlink_recvmsg+0x21e/0x3e0
      [  481.262263]  ____sys_recvmsg+0x87/0x170
      [  481.266707]  ? __might_fault+0x20/0x30
      [  481.271046]  ? _copy_from_user+0x66/0xa0
      [  481.275591]  ? iovec_from_user+0xf6/0x1c0
      [  481.280226]  ___sys_recvmsg+0x82/0x100
      [  481.284566]  ? sock_sendmsg+0x5e/0x60
      [  481.288791]  ? __sys_sendto+0xee/0x150
      [  481.293129]  __sys_recvmsg+0x56/0xa0
      [  481.297267]  do_syscall_64+0x3b/0xc0
      [  481.301395]  entry_SYSCALL_64_after_hwframe+0x44/0xae
      [  481.307238] RIP: 0033:0x7f5466f39617
      [  481.311373] Code: 0c 00 f7 d8 64 89 02 48 c7 c0 ff ff ff ff eb bd 0f 1f 00 f3 0f 1e fa 64 8b 04 25 18 00 00 00 85 c0 75 10 b8 2f 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 51 c3 48 83 ec 28 89 54 24 1c 48 89 74 24 10
      [  481.342944] RSP: 002b:00007ffedc7f4308 EFLAGS: 00000246 ORIG_RAX: 000000000000002f
      [  481.361783] RAX: ffffffffffffffda RBX: 00007ffedc7f5460 RCX: 00007f5466f39617
      [  481.380278] RDX: 0000000000000000 RSI: 00007ffedc7f5360 RDI: 0000000000000003
      [  481.398500] RBP: 00007ffedc7f53f0 R08: 0000000000000000 R09: 000055d556f04d50
      [  481.416463] R10: 0000000000000077 R11: 0000000000000246 R12: 00007ffedc7f5360
      [  481.434131] R13: 00007ffedc7f5350 R14: 00007ffedc7f5344 R15: 0000000000000e98
      [  481.451520] Modules linked in: ice(OE) af_packet binfmt_misc nls_iso8859_1 ipmi_ssif intel_rapl_msr intel_rapl_common x86_pkg_temp_thermal intel_powerclamp mxm_wmi mei_me coretemp mei ipmi_si ipmi_msghandler wmi acpi_pad acpi_power_meter ip_tables x_tables autofs4 crct10dif_pclmul crc32_pclmul ghash_clmulni_intel aesni_intel ahci crypto_simd cryptd libahci lpc_ich [last unloaded: ice]
      [  481.528558] CR2: ffffc9000640f038
      [  481.542041] ---[ end trace d1f24c9ecf5b61c1 ]---
      
      Fix this by only calling ice_vsi_assign_bpf_prog() inside
      ice_prepare_xdp_rings() when current vsi->xdp_prog pointer is NULL.
      This way set_channels() flow will not attempt to swap the vsi->xdp_prog
      pointers with itself.
      
      Also, sprinkle around some comments that provide a reasoning about
      correlation between driver and kernel in terms of bpf_prog refcount.
      
      Fixes: efc2214b ("ice: Add support for XDP")
      Reviewed-by: NAlexander Lobakin <alexandr.lobakin@intel.com>
      Signed-off-by: NMarta Plantykow <marta.a.plantykow@intel.com>
      Co-developed-by: NMaciej Fijalkowski <maciej.fijalkowski@intel.com>
      Signed-off-by: NMaciej Fijalkowski <maciej.fijalkowski@intel.com>
      Tested-by: NKiran Bhandare <kiranx.bhandare@intel.com>
      Signed-off-by: NTony Nguyen <anthony.l.nguyen@intel.com>
      f65ee535
    • M
      ice: fix vsi->txq_map sizing · 792b2086
      Maciej Fijalkowski 提交于
      The approach of having XDP queue per CPU regardless of user's setting
      exposed a hidden bug that could occur in case when Rx queue count differ
      from Tx queue count. Currently vsi->txq_map's size is equal to the
      doubled vsi->alloc_txq, which is not correct due to the fact that XDP
      rings were previously based on the Rx queue count. Below splat can be
      seen when ethtool -L is used and XDP rings are configured:
      
      [  682.875339] BUG: kernel NULL pointer dereference, address: 000000000000000f
      [  682.883403] #PF: supervisor read access in kernel mode
      [  682.889345] #PF: error_code(0x0000) - not-present page
      [  682.895289] PGD 0 P4D 0
      [  682.898218] Oops: 0000 [#1] PREEMPT SMP PTI
      [  682.903055] CPU: 42 PID: 2878 Comm: ethtool Tainted: G           OE     5.15.0-rc5+ #1
      [  682.912214] Hardware name: Intel Corp. GRANTLEY/GRANTLEY, BIOS GRRFCRB1.86B.0276.D07.1605190235 05/19/2016
      [  682.923380] RIP: 0010:devres_remove+0x44/0x130
      [  682.928527] Code: 49 89 f4 55 48 89 fd 4c 89 ff 53 48 83 ec 10 e8 92 b9 49 00 48 8b 9d a8 02 00 00 48 8d 8d a0 02 00 00 49 89 c2 48 39 cb 74 0f <4c> 3b 63 10 74 25 48 8b 5b 08 48 39 cb 75 f1 4c 89 ff 4c 89 d6 e8
      [  682.950237] RSP: 0018:ffffc90006a679f0 EFLAGS: 00010002
      [  682.956285] RAX: 0000000000000286 RBX: ffffffffffffffff RCX: ffff88908343a370
      [  682.964538] RDX: 0000000000000001 RSI: ffffffff81690d60 RDI: 0000000000000000
      [  682.972789] RBP: ffff88908343a0d0 R08: 0000000000000000 R09: 0000000000000000
      [  682.981040] R10: 0000000000000286 R11: 3fffffffffffffff R12: ffffffff81690d60
      [  682.989282] R13: ffffffff81690a00 R14: ffff8890819807a8 R15: ffff88908343a36c
      [  682.997535] FS:  00007f08c7bfa740(0000) GS:ffff88a03fd00000(0000) knlGS:0000000000000000
      [  683.006910] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      [  683.013557] CR2: 000000000000000f CR3: 0000001080a66003 CR4: 00000000003706e0
      [  683.021819] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      [  683.030075] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
      [  683.038336] Call Trace:
      [  683.041167]  devm_kfree+0x33/0x50
      [  683.045004]  ice_vsi_free_arrays+0x5e/0xc0 [ice]
      [  683.050380]  ice_vsi_rebuild+0x4c8/0x750 [ice]
      [  683.055543]  ice_vsi_recfg_qs+0x9a/0x110 [ice]
      [  683.060697]  ice_set_channels+0x14f/0x290 [ice]
      [  683.065962]  ethnl_set_channels+0x333/0x3f0
      [  683.070807]  genl_family_rcv_msg_doit+0xea/0x150
      [  683.076152]  genl_rcv_msg+0xde/0x1d0
      [  683.080289]  ? channels_prepare_data+0x60/0x60
      [  683.085432]  ? genl_get_cmd+0xd0/0xd0
      [  683.089667]  netlink_rcv_skb+0x50/0xf0
      [  683.094006]  genl_rcv+0x24/0x40
      [  683.097638]  netlink_unicast+0x239/0x340
      [  683.102177]  netlink_sendmsg+0x22e/0x470
      [  683.106717]  sock_sendmsg+0x5e/0x60
      [  683.110756]  __sys_sendto+0xee/0x150
      [  683.114894]  ? handle_mm_fault+0xd0/0x2a0
      [  683.119535]  ? do_user_addr_fault+0x1f3/0x690
      [  683.134173]  __x64_sys_sendto+0x25/0x30
      [  683.148231]  do_syscall_64+0x3b/0xc0
      [  683.161992]  entry_SYSCALL_64_after_hwframe+0x44/0xae
      
      Fix this by taking into account the value that num_possible_cpus()
      yields in addition to vsi->alloc_txq instead of doubling the latter.
      
      Fixes: efc2214b ("ice: Add support for XDP")
      Fixes: 22bf877e ("ice: introduce XDP_TX fallback path")
      Reviewed-by: NAlexander Lobakin <alexandr.lobakin@intel.com>
      Signed-off-by: NMaciej Fijalkowski <maciej.fijalkowski@intel.com>
      Tested-by: NKiran Bhandare <kiranx.bhandare@intel.com>
      Signed-off-by: NTony Nguyen <anthony.l.nguyen@intel.com>
      792b2086
  9. 22 11月, 2021 1 次提交
  10. 03 11月, 2021 5 次提交
    • B
      ice: Fix race conditions between virtchnl handling and VF ndo ops · e6ba5273
      Brett Creeley 提交于
      The VF can be configured via the PF's ndo ops at the same time the PF is
      receiving/handling virtchnl messages. This has many issues, with
      one of them being the ndo op could be actively resetting a VF (i.e.
      resetting it to the default state and deleting/re-adding the VF's VSI)
      while a virtchnl message is being handled. The following error was seen
      because a VF ndo op was used to change a VF's trust setting while the
      VIRTCHNL_OP_CONFIG_VSI_QUEUES was ongoing:
      
      [35274.192484] ice 0000:88:00.0: Failed to set LAN Tx queue context, error: ICE_ERR_PARAM
      [35274.193074] ice 0000:88:00.0: VF 0 failed opcode 6, retval: -5
      [35274.193640] iavf 0000:88:01.0: PF returned error -5 (IAVF_ERR_PARAM) to our request 6
      
      Fix this by making sure the virtchnl handling and VF ndo ops that
      trigger VF resets cannot run concurrently. This is done by adding a
      struct mutex cfg_lock to each VF structure. For VF ndo ops, the mutex
      will be locked around the critical operations and VFR. Since the ndo ops
      will trigger a VFR, the virtchnl thread will use mutex_trylock(). This
      is done because if any other thread (i.e. VF ndo op) has the mutex, then
      that means the current VF message being handled is no longer valid, so
      just ignore it.
      
      This issue can be seen using the following commands:
      
      for i in {0..50}; do
              rmmod ice
              modprobe ice
      
              sleep 1
      
              echo 1 > /sys/class/net/ens785f0/device/sriov_numvfs
              echo 1 > /sys/class/net/ens785f1/device/sriov_numvfs
      
              ip link set ens785f1 vf 0 trust on
              ip link set ens785f0 vf 0 trust on
      
              sleep 2
      
              echo 0 > /sys/class/net/ens785f0/device/sriov_numvfs
              echo 0 > /sys/class/net/ens785f1/device/sriov_numvfs
              sleep 1
              echo 1 > /sys/class/net/ens785f0/device/sriov_numvfs
              echo 1 > /sys/class/net/ens785f1/device/sriov_numvfs
      
              ip link set ens785f1 vf 0 trust on
              ip link set ens785f0 vf 0 trust on
      done
      
      Fixes: 7c710869 ("ice: Add handlers for VF netdevice operations")
      Signed-off-by: NBrett Creeley <brett.creeley@intel.com>
      Tested-by: NKonrad Jankowski <konrad0.jankowski@intel.com>
      Signed-off-by: NTony Nguyen <anthony.l.nguyen@intel.com>
      e6ba5273
    • B
      ice: Fix not stopping Tx queues for VFs · b385cca4
      Brett Creeley 提交于
      When a VF is removed and/or reset its Tx queues need to be
      stopped from the PF. This is done by calling the ice_dis_vf_qs()
      function, which calls ice_vsi_stop_lan_tx_rings(). Currently
      ice_dis_vf_qs() is protected by the VF state bit ICE_VF_STATE_QS_ENA.
      Unfortunately, this is causing the Tx queues to not be disabled in some
      cases and when the VF tries to re-enable/reconfigure its Tx queues over
      virtchnl the op is failing. This is because a VF can be reset and/or
      removed before the ICE_VF_STATE_QS_ENA bit is set, but the Tx queues
      were already configured via ice_vsi_cfg_single_txq() in the
      VIRTCHNL_OP_CONFIG_VSI_QUEUES op. However, the ICE_VF_STATE_QS_ENA bit
      is set on a successful VIRTCHNL_OP_ENABLE_QUEUES, which will always
      happen after the VIRTCHNL_OP_CONFIG_VSI_QUEUES op.
      
      This was causing the following error message when loading the ice
      driver, creating VFs, and modifying VF trust in an endless loop:
      
      [35274.192484] ice 0000:88:00.0: Failed to set LAN Tx queue context, error: ICE_ERR_PARAM
      [35274.193074] ice 0000:88:00.0: VF 0 failed opcode 6, retval: -5
      [35274.193640] iavf 0000:88:01.0: PF returned error -5 (IAVF_ERR_PARAM) to our request 6
      
      Fix this by always calling ice_dis_vf_qs() and silencing the error
      message in ice_vsi_stop_tx_ring() since the calling code ignores the
      return anyway. Also, all other places that call ice_vsi_stop_tx_ring()
      catch the error, so this doesn't affect those flows since there was no
      change to the values the function returns.
      
      Other solutions were considered (i.e. tracking which VF queues had been
      "started/configured" in VIRTCHNL_OP_CONFIG_VSI_QUEUES, but it seemed
      more complicated than it was worth. This solution also brings in the
      chance for other unexpected conditions due to invalid state bit checks.
      So, the proposed solution seemed like the best option since there is no
      harm in failing to stop Tx queues that were never started.
      
      This issue can be seen using the following commands:
      
      for i in {0..50}; do
              rmmod ice
              modprobe ice
      
              sleep 1
      
              echo 1 > /sys/class/net/ens785f0/device/sriov_numvfs
              echo 1 > /sys/class/net/ens785f1/device/sriov_numvfs
      
              ip link set ens785f1 vf 0 trust on
              ip link set ens785f0 vf 0 trust on
      
              sleep 2
      
              echo 0 > /sys/class/net/ens785f0/device/sriov_numvfs
              echo 0 > /sys/class/net/ens785f1/device/sriov_numvfs
              sleep 1
              echo 1 > /sys/class/net/ens785f0/device/sriov_numvfs
              echo 1 > /sys/class/net/ens785f1/device/sriov_numvfs
      
              ip link set ens785f1 vf 0 trust on
              ip link set ens785f0 vf 0 trust on
      done
      
      Fixes: 77ca27c4 ("ice: add support for virtchnl_queue_select.[tx|rx]_queues bitmap")
      Signed-off-by: NBrett Creeley <brett.creeley@intel.com>
      Tested-by: NKonrad Jankowski <konrad0.jankowski@intel.com>
      Signed-off-by: NTony Nguyen <anthony.l.nguyen@intel.com>
      b385cca4
    • S
      ice: Fix replacing VF hardware MAC to existing MAC filter · ce572a5b
      Sylwester Dziedziuch 提交于
      VF was not able to change its hardware MAC address in case
      the new address was already present in the MAC filter list.
      Change the handling of VF add mac request to not return
      if requested MAC address is already present on the list
      and check if its hardware MAC needs to be updated in this case.
      
      Fixes: ed4c068d ("ice: Enable ip link show on the PF to display VF unicast MAC(s)")
      Signed-off-by: NSylwester Dziedziuch <sylwesterx.dziedziuch@intel.com>
      Tested-by: NTony Brelinski <tony.brelinski@intel.com>
      Signed-off-by: NTony Nguyen <anthony.l.nguyen@intel.com>
      ce572a5b
    • B
      ice: Remove toggling of antispoof for VF trusted promiscuous mode · 0299faea
      Brett Creeley 提交于
      Currently when a trusted VF enables promiscuous mode spoofchk will be
      disabled. This is wrong and should only be modified from the
      ndo_set_vf_spoofchk callback. Fix this by removing the call to toggle
      spoofchk for trusted VFs.
      
      Fixes: 01b5e89a ("ice: Add VF promiscuous support")
      Signed-off-by: NBrett Creeley <brett.creeley@intel.com>
      Tested-by: NTony Brelinski <tony.brelinski@intel.com>
      Signed-off-by: NTony Nguyen <anthony.l.nguyen@intel.com>
      0299faea
    • B
      ice: Fix VF true promiscuous mode · 1a8c7778
      Brett Creeley 提交于
      When a VF requests promiscuous mode and it's trusted and true promiscuous
      mode is enabled the PF driver attempts to enable unicast and/or
      multicast promiscuous mode filters based on the request. This is fine,
      but there are a couple issues with the current code.
      
      [1] The define to configure the unicast promiscuous mode mask also
          includes bits to configure the multicast promiscuous mode mask, which
          causes multicast to be set/cleared unintentionally.
      [2] All 4 cases for enable/disable unicast/multicast mode are not
          handled in the promiscuous mode message handler, which causes
          unexpected results regarding the current promiscuous mode settings.
      
      To fix [1] make sure any promiscuous mask defines include the correct
      bits for each of the promiscuous modes.
      
      To fix [2] make sure that all 4 cases are handled since there are 2 bits
      (FLAG_VF_UNICAST_PROMISC and FLAG_VF_MULTICAST_PROMISC) that can be
      either set or cleared. Also, since either unicast and/or multicast
      promiscuous configuration can fail, introduce two separate error values
      to handle each of these cases.
      
      Fixes: 01b5e89a ("ice: Add VF promiscuous support")
      Signed-off-by: NBrett Creeley <brett.creeley@intel.com>
      Tested-by: NTony Brelinski <tony.brelinski@intel.com>
      Signed-off-by: NTony Nguyen <anthony.l.nguyen@intel.com>
      1a8c7778
  11. 30 10月, 2021 1 次提交
    • M
      ice: Hide bus-info in ethtool for PRs in switchdev mode · bfaaba99
      Marcin Szycik 提交于
      Disable showing bus-info information for port representors in switchdev
      mode. This fixes a bug that caused displaying wrong netdev descriptions in
      lshw tool - one port representor displayed PF branding string, and in turn
      one PF displayed a "generic" description. The bug occurs when many devices
      show the same bus-info in ethtool, which was the case in switchdev mode (PF
      and its port representors displayed the same bus-info). The bug occurs only
      if a port representor netdev appears before PF netdev in /proc/net/dev.
      
      In the examples below:
      ens6fX is PF
      ens6fXvY is VF
      ethX is port representor
      One irrelevant column was removed from output
      
      Before:
      $ sudo lshw -c net -businfo
      Bus info          Device      Description
      =========================================
      pci@0000:02:00.0  eth102       Ethernet Controller E810-XXV for SFP
      pci@0000:02:00.1  ens6f1       Ethernet Controller E810-XXV for SFP
      pci@0000:02:01.0  ens6f0v0     Ethernet Adaptive Virtual Function
      pci@0000:02:01.1  ens6f0v1     Ethernet Adaptive Virtual Function
      pci@0000:02:01.2  ens6f0v2     Ethernet Adaptive Virtual Function
      pci@0000:02:00.0  ens6f0       Ethernet interface
      
      Notice that eth102 and ens6f0 have the same bus-info and their descriptions
      are swapped.
      
      After:
      $ sudo lshw -c net -businfo
      Bus info          Device      Description
      =========================================
      pci@0000:02:00.0  ens6f0      Ethernet Controller E810-XXV for SFP
      pci@0000:02:00.1  ens6f1      Ethernet Controller E810-XXV for SFP
      pci@0000:02:01.0  ens6f0v0    Ethernet Adaptive Virtual Function
      pci@0000:02:01.1  ens6f0v1    Ethernet Adaptive Virtual Function
      pci@0000:02:01.2  ens6f0v2    Ethernet Adaptive Virtual Function
      
      Fixes: 7aae80ce ("ice: add port representor ethtool ops and stats")
      Signed-off-by: NMarcin Szycik <marcin.szycik@linux.intel.com>
      Tested-by: NSandeep Penigalapati <sandeep.penigalapati@intel.com>
      Signed-off-by: NTony Nguyen <anthony.l.nguyen@intel.com>
      bfaaba99