Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mlx5: Create an auxiliary device for fwctl_mlx5

If the device supports User Context then it can support fwctl. Create an
auxiliary device to allow fwctl to bind to it.

Create a sysfs like:

$ ls /sys/devices/pci0000:00/0000:00:0a.0/mlx5_core.fwctl.0/driver -l
lrwxrwxrwx 1 root root 0 Apr 25 19:46 /sys/devices/pci0000:00/0000:00:0a.0/mlx5_core.fwctl.0/driver -> ../../../../bus/auxiliary/drivers/mlx5_fwctl.mlx5_fwctl

Link: https://patch.msgid.link/r/8-v5-642aa0c94070+4447f-fwctl_jgg@nvidia.com
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
Acked-by: Leon Romanovsky <leonro@nvidia.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>

authored by

Saeed Mahameed and committed by
Jason Gunthorpe
a1ded2c1 52929c21

+9
+9
drivers/net/ethernet/mellanox/mlx5/core/dev.c
··· 228 228 MLX5_INTERFACE_PROTOCOL_VNET, 229 229 230 230 MLX5_INTERFACE_PROTOCOL_DPLL, 231 + MLX5_INTERFACE_PROTOCOL_FWCTL, 231 232 }; 233 + 234 + static bool is_fwctl_supported(struct mlx5_core_dev *dev) 235 + { 236 + /* fwctl is most useful on PFs, prevent fwctl on SFs for now */ 237 + return MLX5_CAP_GEN(dev, uctx_cap) && !mlx5_core_is_sf(dev); 238 + } 232 239 233 240 static const struct mlx5_adev_device { 234 241 const char *suffix; ··· 259 252 .is_supported = &is_mp_supported }, 260 253 [MLX5_INTERFACE_PROTOCOL_DPLL] = { .suffix = "dpll", 261 254 .is_supported = &is_dpll_supported }, 255 + [MLX5_INTERFACE_PROTOCOL_FWCTL] = { .suffix = "fwctl", 256 + .is_supported = &is_fwctl_supported }, 262 257 }; 263 258 264 259 int mlx5_adev_idx_alloc(void)