diff options
author | Jason Gunthorpe <jgg@nvidia.com> | 2021-06-11 19:00:20 +0300 |
---|---|---|
committer | Jason Gunthorpe <jgg@nvidia.com> | 2021-06-16 20:58:29 -0300 |
commit | 4b5f4d3fb40898a9f2ccf58030e69ea11fbd6eed (patch) | |
tree | a191b8ab07bb64e542a5c27f37dddc2b58766634 /drivers/infiniband/core/sysfs.c | |
parent | 570d2b99d00d9e023328c0a0b8000ab485113384 (diff) | |
download | linux-4b5f4d3fb40898a9f2ccf58030e69ea11fbd6eed.tar.gz linux-4b5f4d3fb40898a9f2ccf58030e69ea11fbd6eed.tar.bz2 linux-4b5f4d3fb40898a9f2ccf58030e69ea11fbd6eed.zip |
RDMA: Split the alloc_hw_stats() ops to port and device variants
This is being used to implement both the port and device global stats,
which is causing some confusion in the drivers. For instance EFA and i40iw
both seem to be misusing the device stats.
Split it into two ops so drivers that don't support one or the other can
leave the op NULL'd, making the calling code a little simpler to
understand.
Link: https://lore.kernel.org/r/1955c154197b2a159adc2dc97266ddc74afe420c.1623427137.git.leonro@nvidia.com
Tested-by: Gal Pressman <galpress@amazon.com>
Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Diffstat (limited to 'drivers/infiniband/core/sysfs.c')
-rw-r--r-- | drivers/infiniband/core/sysfs.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/infiniband/core/sysfs.c b/drivers/infiniband/core/sysfs.c index 05b702de00e8..d11ceff2b4e4 100644 --- a/drivers/infiniband/core/sysfs.c +++ b/drivers/infiniband/core/sysfs.c @@ -981,8 +981,10 @@ static void setup_hw_stats(struct ib_device *device, struct ib_port *port, struct rdma_hw_stats *stats; int i, ret; - stats = device->ops.alloc_hw_stats(device, port_num); - + if (port_num) + stats = device->ops.alloc_hw_port_stats(device, port_num); + else + stats = device->ops.alloc_hw_device_stats(device); if (!stats) return; @@ -1165,7 +1167,7 @@ static int add_port(struct ib_core_device *coredev, int port_num) * port, so holder should be device. Therefore skip per port conunter * initialization. */ - if (device->ops.alloc_hw_stats && port_num && is_full_dev) + if (device->ops.alloc_hw_port_stats && port_num && is_full_dev) setup_hw_stats(device, p, port_num); list_add_tail(&p->kobj.entry, &coredev->port_list); @@ -1409,7 +1411,7 @@ int ib_device_register_sysfs(struct ib_device *device) if (ret) return ret; - if (device->ops.alloc_hw_stats) + if (device->ops.alloc_hw_device_stats) setup_hw_stats(device, NULL, 0); return 0; |