On Sun, Oct 06, 2019 at 06:51:39PM +0300, Leon Romanovsky wrote: > From: Erez Alfasi <ereza@xxxxxxxxxxxx> > > Add RDMA nldev netlink interface for dumping MR > statistics information. > > Output example: > ereza@dev~$: ./ibv_rc_pingpong -o -P -s 500000000 > local address: LID 0x0001, QPN 0x00008a, PSN 0xf81096, GID :: > > ereza@dev~$: rdma stat show mr > dev mlx5_0 mrn 2 page_faults 122071 page_invalidations 0 > prefetched_pages 122071 > > Signed-off-by: Erez Alfasi <ereza@xxxxxxxxxxxx> > Signed-off-by: Leon Romanovsky <leonro@xxxxxxxxxxxx> > drivers/infiniband/core/device.c | 1 + > drivers/infiniband/core/nldev.c | 41 ++++++++++++++++++++++--- > drivers/infiniband/hw/mlx5/main.c | 2 ++ > drivers/infiniband/hw/mlx5/mlx5_ib.h | 2 ++ > drivers/infiniband/hw/mlx5/restrack.c | 44 +++++++++++++++++++++++++++ > include/rdma/ib_verbs.h | 7 +++++ > include/rdma/restrack.h | 3 ++ > 7 files changed, 96 insertions(+), 4 deletions(-) > > diff --git a/drivers/infiniband/core/device.c b/drivers/infiniband/core/device.c > index a667636f74bf..2e53aa25f0c7 100644 > +++ b/drivers/infiniband/core/device.c > @@ -2606,6 +2606,7 @@ void ib_set_device_ops(struct ib_device *dev, const struct ib_device_ops *ops) > SET_DEVICE_OP(dev_ops, drain_sq); > SET_DEVICE_OP(dev_ops, enable_driver); > SET_DEVICE_OP(dev_ops, fill_res_entry); > + SET_DEVICE_OP(dev_ops, fill_stat_entry); > SET_DEVICE_OP(dev_ops, get_dev_fw_str); > SET_DEVICE_OP(dev_ops, get_dma_mr); > SET_DEVICE_OP(dev_ops, get_hw_stats); > diff --git a/drivers/infiniband/core/nldev.c b/drivers/infiniband/core/nldev.c > index 6114465959e1..1d9d89fd9ce9 100644 > +++ b/drivers/infiniband/core/nldev.c > @@ -454,6 +454,14 @@ static bool fill_res_entry(struct ib_device *dev, struct sk_buff *msg, > return dev->ops.fill_res_entry(msg, res); > } > > +static bool fill_stat_entry(struct ib_device *dev, struct sk_buff *msg, > + struct rdma_restrack_entry *res) > +{ > + if (!dev->ops.fill_stat_entry) > + return false; > + return dev->ops.fill_stat_entry(msg, res); > +} Why do we need this function called in only one place? Jason