RDMA/core: Do not expose unsupported counters
authorParav Pandit <parav@mellanox.com>
Sun, 7 Oct 2018 09:12:40 +0000 (12:12 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 13 Nov 2018 19:16:52 +0000 (11:16 -0800)
commit2537f9adf5119d895df5d4623cec84c0aa675be7
treeba832268604e4ae57ba15704b2307c0772a8fdd5
parentb18de4e8bdc55f461c03d51d91f2887254a9b1e6
RDMA/core: Do not expose unsupported counters

[ Upstream commit 0f6ef65d1c6ec8deb5d0f11f86631ec4cfe8f22e ]

If the provider driver (such as rdma_rxe) doesn't support pma counters,
avoid exposing its directory similar to optional hw_counters directory.
If core fails to read the PMA counter, return an error so that user can
retry later if needed.

Fixes: 35c4cbb17811 ("IB/core: Create get_perf_mad function in sysfs.c")
Reported-by: Holger Hoffstätte <holger@applied-asynchrony.com>
Tested-by: Holger Hoffstätte <holger@applied-asynchrony.com>
Signed-off-by: Parav Pandit <parav@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/infiniband/core/sysfs.c