RDMA/core: Do not expose unsupported counters
authorParav Pandit <parav@mellanox.com>
Sun, 7 Oct 2018 09:12:40 +0000 (12:12 +0300)
committerDoug Ledford <dledford@redhat.com>
Tue, 16 Oct 2018 18:09:44 +0000 (14:09 -0400)
commit0f6ef65d1c6ec8deb5d0f11f86631ec4cfe8f22e
treec3945ab32a08f417d255908d8cf1b182408a016a
parent60f1fc204940fc0352394866b2af0987fd5b2563
RDMA/core: Do not expose unsupported counters

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>
drivers/infiniband/core/sysfs.c