On Mon, Jun 12, 2017 at 10:45:21AM +0300, Leon Romanovsky wrote: > From: Erez Shitrit <erezsh@xxxxxxxxxxxx> > > The driver checks if the lower level driver supports get_stats, and if > so calls it to get the updated statistics, otherwise takes from the > current netdevice stats object. > > Signed-off-by: Erez Shitrit <erezsh@xxxxxxxxxxxx> > Reviewed-by: Alex Vesker <valex@xxxxxxxxxxxx> > Signed-off-by: Leon Romanovsky <leon@xxxxxxxxxx> > --- > drivers/infiniband/ulp/ipoib/ipoib_main.c | 12 ++++++++++++ > 1 file changed, 12 insertions(+) > > diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c > index a115c0b7a310..6ff924111d5a 100644 > --- a/drivers/infiniband/ulp/ipoib/ipoib_main.c > +++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c > @@ -261,6 +261,17 @@ static int ipoib_change_mtu(struct net_device *dev, int new_mtu) > return 0; > } > > +static void ipoib_get_stats(struct net_device *dev, > + struct rtnl_link_stats64 *stats) > +{ > + struct ipoib_dev_priv *priv = ipoib_priv(dev); > + > + if (priv->rn_ops->ndo_get_stats64) > + priv->rn_ops->ndo_get_stats64(dev, stats); > + else > + netdev_stats_to_stats64(stats, &dev->stats); > +} > + > /* Called with an RCU read lock taken */ > static bool ipoib_is_dev_match_addr_rcu(const struct sockaddr *addr, > struct net_device *dev) > @@ -1805,6 +1816,7 @@ static const struct net_device_ops ipoib_netdev_ops_pf = { > .ndo_get_vf_stats = ipoib_get_vf_stats, > .ndo_set_vf_guid = ipoib_set_vf_guid, > .ndo_set_mac_address = ipoib_set_mac, > + .ndo_get_stats64 = ipoib_get_stats, > }; Reviewed-by: Yuval Shaia <yuval.shaia@xxxxxxxxxx> > > static const struct net_device_ops ipoib_netdev_ops_vf = { > -- > 2.12.2 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-rdma" in > the body of a message to majordomo@xxxxxxxxxxxxxxx > More majordomo info at http://vger.kernel.org/majordomo-info.html -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html