net/mlx5e: Create separate devlink instance for ethernet auxiliary device
authorJiri Pirko <jiri@nvidia.com>
Wed, 18 Jan 2023 15:21:06 +0000 (16:21 +0100)
committerJakub Kicinski <kuba@kernel.org>
Fri, 20 Jan 2023 03:08:37 +0000 (19:08 -0800)
commitee75f1fc44dd73f0323118f31cf91f9b6db147fa
treece976feaa6c056c01af12b0ea4848c97a3a9d21a
parent3a10173f48aa1bae64baf0fea228c6045996b117
net/mlx5e: Create separate devlink instance for ethernet auxiliary device

The fact that devlink instance lock is held over mlx5 auxiliary devices
probe and remove routines brought a need to conditionally take devlink
instance lock there. The code is checking a MLX5E_LOCKED_FLOW flag
in mlx5 priv struct.

This is racy and may lead to access devlink objects without holding
instance lock or deadlock.

To avoid this, the only lock-wise sane solution is to make the
devlink entities created by the auxiliary device independent on
the original pci devlink instance. Create devlink instance for the
auxiliary device and put the uplink port instance there alongside with
the port health reporters.

Signed-off-by: Jiri Pirko <jiri@nvidia.com>
Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/mellanox/mlx5/core/en.h
drivers/net/ethernet/mellanox/mlx5/core/en/devlink.c
drivers/net/ethernet/mellanox/mlx5/core/en/devlink.h
drivers/net/ethernet/mellanox/mlx5/core/en_main.c