1. 19 7月, 2022 4 次提交
    • J
      net: devlink: add unlocked variants of devlink_sb*() functions · 755cfa69
      Jiri Pirko 提交于
      Add unlocked variants of devlink_sb*() functions to be used
      in drivers called-in with devlink->lock held.
      Signed-off-by: NJiri Pirko <jiri@nvidia.com>
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      755cfa69
    • J
      net: devlink: add unlocked variants of devlink_resource*() functions · c223d6a4
      Jiri Pirko 提交于
      Add unlocked variants of devlink_resource*() functions to be used
      in drivers called-in with devlink->lock held.
      Signed-off-by: NJiri Pirko <jiri@nvidia.com>
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      c223d6a4
    • J
      net: devlink: add unlocked variants of devling_trap*() functions · 852e85a7
      Jiri Pirko 提交于
      Add unlocked variants of devl_trap*() functions to be used in drivers
      called-in with devlink->lock held.
      Signed-off-by: NJiri Pirko <jiri@nvidia.com>
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      852e85a7
    • M
      net: devlink: avoid false DEADLOCK warning reported by lockdep · e26fde2f
      Moshe Shemesh 提交于
      Add a lock_class_key per devlink instance to avoid DEADLOCK warning by
      lockdep, while locking more than one devlink instance in driver code,
      for example in opening VFs flow.
      
      Kernel log:
      [  101.433802] ============================================
      [  101.433803] WARNING: possible recursive locking detected
      [  101.433810] 5.19.0-rc1+ #35 Not tainted
      [  101.433812] --------------------------------------------
      [  101.433813] bash/892 is trying to acquire lock:
      [  101.433815] ffff888127bfc2f8 (&devlink->lock){+.+.}-{3:3}, at: probe_one+0x3c/0x690 [mlx5_core]
      [  101.433909]
                     but task is already holding lock:
      [  101.433910] ffff888118f4c2f8 (&devlink->lock){+.+.}-{3:3}, at: mlx5_core_sriov_configure+0x62/0x280 [mlx5_core]
      [  101.433989]
                     other info that might help us debug this:
      [  101.433990]  Possible unsafe locking scenario:
      
      [  101.433991]        CPU0
      [  101.433991]        ----
      [  101.433992]   lock(&devlink->lock);
      [  101.433993]   lock(&devlink->lock);
      [  101.433995]
                      *** DEADLOCK ***
      
      [  101.433996]  May be due to missing lock nesting notation
      
      [  101.433996] 6 locks held by bash/892:
      [  101.433998]  #0: ffff88810eb50448 (sb_writers#3){.+.+}-{0:0}, at: ksys_write+0xf3/0x1d0
      [  101.434009]  #1: ffff888114777c88 (&of->mutex){+.+.}-{3:3}, at: kernfs_fop_write_iter+0x20d/0x520
      [  101.434017]  #2: ffff888102b58660 (kn->active#231){.+.+}-{0:0}, at: kernfs_fop_write_iter+0x230/0x520
      [  101.434023]  #3: ffff888102d70198 (&dev->mutex){....}-{3:3}, at: sriov_numvfs_store+0x132/0x310
      [  101.434031]  #4: ffff888118f4c2f8 (&devlink->lock){+.+.}-{3:3}, at: mlx5_core_sriov_configure+0x62/0x280 [mlx5_core]
      [  101.434108]  #5: ffff88812adce198 (&dev->mutex){....}-{3:3}, at: __device_attach+0x76/0x430
      [  101.434116]
                     stack backtrace:
      [  101.434118] CPU: 5 PID: 892 Comm: bash Not tainted 5.19.0-rc1+ #35
      [  101.434120] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.13.0-0-gf21b5a4aeb02-prebuilt.qemu.org 04/01/2014
      [  101.434130] Call Trace:
      [  101.434133]  <TASK>
      [  101.434135]  dump_stack_lvl+0x57/0x7d
      [  101.434145]  __lock_acquire.cold+0x1df/0x3e7
      [  101.434151]  ? register_lock_class+0x1880/0x1880
      [  101.434157]  lock_acquire+0x1c1/0x550
      [  101.434160]  ? probe_one+0x3c/0x690 [mlx5_core]
      [  101.434229]  ? lockdep_hardirqs_on_prepare+0x400/0x400
      [  101.434232]  ? __xa_alloc+0x1ed/0x2d0
      [  101.434236]  ? ksys_write+0xf3/0x1d0
      [  101.434239]  __mutex_lock+0x12c/0x14b0
      [  101.434243]  ? probe_one+0x3c/0x690 [mlx5_core]
      [  101.434312]  ? probe_one+0x3c/0x690 [mlx5_core]
      [  101.434380]  ? devlink_alloc_ns+0x11b/0x910
      [  101.434385]  ? mutex_lock_io_nested+0x1320/0x1320
      [  101.434388]  ? lockdep_init_map_type+0x21a/0x7d0
      [  101.434391]  ? lockdep_init_map_type+0x21a/0x7d0
      [  101.434393]  ? __init_swait_queue_head+0x70/0xd0
      [  101.434397]  probe_one+0x3c/0x690 [mlx5_core]
      [  101.434467]  pci_device_probe+0x1b4/0x480
      [  101.434471]  really_probe+0x1e0/0xaa0
      [  101.434474]  __driver_probe_device+0x219/0x480
      [  101.434478]  driver_probe_device+0x49/0x130
      [  101.434481]  __device_attach_driver+0x1b8/0x280
      [  101.434484]  ? driver_allows_async_probing+0x140/0x140
      [  101.434487]  bus_for_each_drv+0x123/0x1a0
      [  101.434489]  ? bus_for_each_dev+0x1a0/0x1a0
      [  101.434491]  ? lockdep_hardirqs_on_prepare+0x286/0x400
      [  101.434494]  ? trace_hardirqs_on+0x2d/0x100
      [  101.434498]  __device_attach+0x1a3/0x430
      [  101.434501]  ? device_driver_attach+0x1e0/0x1e0
      [  101.434503]  ? pci_bridge_d3_possible+0x1e0/0x1e0
      [  101.434506]  ? pci_create_resource_files+0xeb/0x190
      [  101.434511]  pci_bus_add_device+0x6c/0xa0
      [  101.434514]  pci_iov_add_virtfn+0x9e4/0xe00
      [  101.434517]  ? trace_hardirqs_on+0x2d/0x100
      [  101.434521]  sriov_enable+0x64a/0xca0
      [  101.434524]  ? pcibios_sriov_disable+0x10/0x10
      [  101.434528]  mlx5_core_sriov_configure+0xab/0x280 [mlx5_core]
      [  101.434602]  sriov_numvfs_store+0x20a/0x310
      [  101.434605]  ? sriov_totalvfs_show+0xc0/0xc0
      [  101.434608]  ? sysfs_file_ops+0x170/0x170
      [  101.434611]  ? sysfs_file_ops+0x117/0x170
      [  101.434614]  ? sysfs_file_ops+0x170/0x170
      [  101.434616]  kernfs_fop_write_iter+0x348/0x520
      [  101.434619]  new_sync_write+0x2e5/0x520
      [  101.434621]  ? new_sync_read+0x520/0x520
      [  101.434624]  ? lock_acquire+0x1c1/0x550
      [  101.434626]  ? lockdep_hardirqs_on_prepare+0x400/0x400
      [  101.434630]  vfs_write+0x5cb/0x8d0
      [  101.434633]  ksys_write+0xf3/0x1d0
      [  101.434635]  ? __x64_sys_read+0xb0/0xb0
      [  101.434638]  ? lockdep_hardirqs_on_prepare+0x286/0x400
      [  101.434640]  ? syscall_enter_from_user_mode+0x1d/0x50
      [  101.434643]  do_syscall_64+0x3d/0x90
      [  101.434647]  entry_SYSCALL_64_after_hwframe+0x46/0xb0
      [  101.434650] RIP: 0033:0x7f5ff536b2f7
      [  101.434658] Code: 0d 00 f7 d8 64 89 02 48 c7 c0 ff ff ff ff eb b7 0f
      1f 00 f3 0f 1e fa 64 8b 04 25 18 00 00 00 85 c0 75 10 b8 01 00 00 00 0f
      05 <48> 3d 00 f0 ff ff 77 51 c3 48 83 ec 28 48 89 54 24 18 48 89 74 24
      [  101.434661] RSP: 002b:00007ffd9ea85d58 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
      [  101.434664] RAX: ffffffffffffffda RBX: 0000000000000002 RCX: 00007f5ff536b2f7
      [  101.434666] RDX: 0000000000000002 RSI: 000055c4c279e230 RDI: 0000000000000001
      [  101.434668] RBP: 000055c4c279e230 R08: 000000000000000a R09: 0000000000000001
      [  101.434669] R10: 000055c4c283cbf0 R11: 0000000000000246 R12: 0000000000000002
      [  101.434670] R13: 00007f5ff543d500 R14: 0000000000000002 R15: 00007f5ff543d700
      [  101.434673]  </TASK>
      Signed-off-by: NMoshe Shemesh <moshe@nvidia.com>
      Signed-off-by: NJiri Pirko <jiri@nvidia.com>
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      e26fde2f
  2. 15 7月, 2022 3 次提交
  3. 13 7月, 2022 2 次提交
  4. 12 7月, 2022 3 次提交
  5. 10 6月, 2022 1 次提交
  6. 06 5月, 2022 1 次提交
  7. 25 4月, 2022 3 次提交
  8. 18 4月, 2022 4 次提交
    • J
      devlink: add port to line card relationship set · b8375859
      Jiri Pirko 提交于
      In order to properly inform user about relationship between port and
      line card, introduce a driver API to set line card for a port. Use this
      information to extend port devlink netlink message by line card index
      and also include the line card index into phys_port_name and by that
      into a netdevice name.
      Signed-off-by: NJiri Pirko <jiri@nvidia.com>
      Signed-off-by: NIdo Schimmel <idosch@nvidia.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      b8375859
    • J
      devlink: implement line card active state · fc9f50d5
      Jiri Pirko 提交于
      Allow driver to mark a line card as active. Expose this state to the
      userspace over devlink netlink interface with proper notifications.
      'active' state means that line card was plugged in after
      being provisioned.
      Signed-off-by: NJiri Pirko <jiri@nvidia.com>
      Signed-off-by: NIdo Schimmel <idosch@nvidia.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      fc9f50d5
    • J
      devlink: implement line card provisioning · fcdc8ce2
      Jiri Pirko 提交于
      In order to be able to configure all needed stuff on a port/netdevice
      of a line card without the line card being present, introduce line card
      provisioning. Basically by setting a type, provisioning process will
      start and driver is supposed to create a placeholder for instances
      (ports/netdevices) for a line card type.
      
      Allow the user to query the supported line card types over line card
      get command. Then implement two netlink command SET to allow user to
      set/unset the card type.
      
      On the driver API side, add provision/unprovision ops and supported
      types array to be advertised. Upon provision op call, the driver should
      take care of creating the instances for the particular line card type.
      Introduce provision_set/clear() functions to be called by the driver
      once the provisioning/unprovisioning is done on its side. These helpers
      are not to be called directly due to the async nature of provisioning.
      
      Example:
      $ devlink port # No ports are listed
      $ devlink lc
      pci/0000:01:00.0:
        lc 1 state unprovisioned
          supported_types:
             16x100G
        lc 2 state unprovisioned
          supported_types:
             16x100G
        lc 3 state unprovisioned
          supported_types:
             16x100G
        lc 4 state unprovisioned
          supported_types:
             16x100G
        lc 5 state unprovisioned
          supported_types:
             16x100G
        lc 6 state unprovisioned
          supported_types:
             16x100G
        lc 7 state unprovisioned
          supported_types:
             16x100G
        lc 8 state unprovisioned
          supported_types:
             16x100G
      
      $ devlink lc set pci/0000:01:00.0 lc 8 type 16x100G
      $ devlink lc show pci/0000:01:00.0 lc 8
      pci/0000:01:00.0:
        lc 8 state active type 16x100G
          supported_types:
             16x100G
      $ devlink port
      pci/0000:01:00.0/0: type notset flavour cpu port 0 splittable false
      pci/0000:01:00.0/53: type eth netdev enp1s0nl8p1 flavour physical lc 8 port 1 splittable true lanes 4
      pci/0000:01:00.0/54: type eth netdev enp1s0nl8p2 flavour physical lc 8 port 2 splittable true lanes 4
      pci/0000:01:00.0/55: type eth netdev enp1s0nl8p3 flavour physical lc 8 port 3 splittable true lanes 4
      pci/0000:01:00.0/56: type eth netdev enp1s0nl8p4 flavour physical lc 8 port 4 splittable true lanes 4
      pci/0000:01:00.0/57: type eth netdev enp1s0nl8p5 flavour physical lc 8 port 5 splittable true lanes 4
      pci/0000:01:00.0/58: type eth netdev enp1s0nl8p6 flavour physical lc 8 port 6 splittable true lanes 4
      pci/0000:01:00.0/59: type eth netdev enp1s0nl8p7 flavour physical lc 8 port 7 splittable true lanes 4
      pci/0000:01:00.0/60: type eth netdev enp1s0nl8p8 flavour physical lc 8 port 8 splittable true lanes 4
      pci/0000:01:00.0/61: type eth netdev enp1s0nl8p9 flavour physical lc 8 port 9 splittable true lanes 4
      pci/0000:01:00.0/62: type eth netdev enp1s0nl8p10 flavour physical lc 8 port 10 splittable true lanes 4
      pci/0000:01:00.0/63: type eth netdev enp1s0nl8p11 flavour physical lc 8 port 11 splittable true lanes 4
      pci/0000:01:00.0/64: type eth netdev enp1s0nl8p12 flavour physical lc 8 port 12 splittable true lanes 4
      pci/0000:01:00.0/125: type eth netdev enp1s0nl8p13 flavour physical lc 8 port 13 splittable true lanes 4
      pci/0000:01:00.0/126: type eth netdev enp1s0nl8p14 flavour physical lc 8 port 14 splittable true lanes 4
      pci/0000:01:00.0/127: type eth netdev enp1s0nl8p15 flavour physical lc 8 port 15 splittable true lanes 4
      pci/0000:01:00.0/128: type eth netdev enp1s0nl8p16 flavour physical lc 8 port 16 splittable true lanes 4
      
      $ devlink lc set pci/0000:01:00.0 lc 8 notype
      Signed-off-by: NJiri Pirko <jiri@nvidia.com>
      Signed-off-by: NIdo Schimmel <idosch@nvidia.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      fcdc8ce2
    • J
      devlink: add support to create line card and expose to user · c246f9b5
      Jiri Pirko 提交于
      Extend the devlink API so the driver is going to be able to create and
      destroy linecard instances. There can be multiple line cards per devlink
      device. Expose this new type of object over devlink netlink API to the
      userspace, with notifications.
      Signed-off-by: NJiri Pirko <jiri@nvidia.com>
      Signed-off-by: NIdo Schimmel <idosch@nvidia.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      c246f9b5
  9. 21 3月, 2022 2 次提交
  10. 17 3月, 2022 3 次提交
  11. 30 12月, 2021 1 次提交
  12. 22 12月, 2021 2 次提交
  13. 07 12月, 2021 1 次提交
  14. 30 11月, 2021 1 次提交
  15. 29 11月, 2021 1 次提交
  16. 23 11月, 2021 1 次提交
  17. 18 11月, 2021 1 次提交
  18. 05 11月, 2021 1 次提交
  19. 01 11月, 2021 2 次提交
    • J
      ethtool: don't drop the rtnl_lock half way thru the ioctl · 1af0a094
      Jakub Kicinski 提交于
      devlink compat code needs to drop rtnl_lock to take
      devlink->lock to ensure correct lock ordering.
      
      This is problematic because we're not strictly guaranteed
      that the netdev will not disappear after we re-lock.
      It may open a possibility of nested ->begin / ->complete
      calls.
      
      Instead of calling into devlink under rtnl_lock take
      a ref on the devlink instance and make the call after
      we've dropped rtnl_lock.
      
      We (continue to) assume that netdevs have an implicit
      reference on the devlink returned from ndo_get_devlink_port
      
      Note that ndo_get_devlink_port will now get called
      under rtnl_lock. That should be fine since none of
      the drivers seem to be taking serious locks inside
      ndo_get_devlink_port.
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      Reviewed-by: NLeon Romanovsky <leonro@nvidia.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      1af0a094
    • J
      devlink: expose get/put functions · 46db1b77
      Jakub Kicinski 提交于
      Allow those who hold implicit reference on a devlink instance
      to try to take a full ref on it. This will be used from netdev
      code which has an implicit ref because of driver call ordering.
      
      Note that after recent changes devlink_unregister() may happen
      before netdev unregister, but devlink_free() should still happen
      after, so we are safe to try, but we can't just refcount_inc()
      and assume it's not zero.
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      Reviewed-by: NLeon Romanovsky <leonro@nvidia.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      46db1b77
  20. 29 10月, 2021 1 次提交
  21. 28 10月, 2021 2 次提交