net/mlx5: Register a unique thermal zone per device
authorSaeed Mahameed <saeedm@nvidia.com>
Tue, 27 Jun 2023 03:36:41 +0000 (20:36 -0700)
committerSaeed Mahameed <saeedm@nvidia.com>
Wed, 5 Jul 2023 17:57:03 +0000 (10:57 -0700)
commit631079e08aa4a20b73e70de4cf457886194f029f
tree036038e4c59aa44ebdda06795485570512ac9313
parent2e2d1965794d22fbe86df45bf4f933216743577d
net/mlx5: Register a unique thermal zone per device

Prior to this patch only one "mlx5" thermal zone could have been
registered regardless of the number of individual mlx5 devices in the
system.

To fix this setup a unique name per device to register its own thermal
zone.

In order to not register a thermal zone for a virtual device (VF/SF) add
a check for PF device type.

The new name is a concatenation between "mlx5_" and "<PCI_DEV_BDF>", which
will also help associating a thermal zone with its PCI device.

$ lspci | grep ConnectX
00:04.0 Ethernet controller: Mellanox Technologies MT2892 Family [ConnectX-6 Dx]
00:05.0 Ethernet controller: Mellanox Technologies MT2892 Family [ConnectX-6 Dx]

$ cat /sys/devices/virtual/thermal/thermal_zone0/type
mlx5_0000:00:04.0
$ cat /sys/devices/virtual/thermal/thermal_zone1/type
mlx5_0000:00:05.0

Fixes: c1fef618d611 ("net/mlx5: Implement thermal zone")
CC: Sandipan Patra <spatra@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
drivers/net/ethernet/mellanox/mlx5/core/thermal.c