* [PATCH rdma-next] IB/ipoib: Let lower driver handle get_stats64 call
@ 2017-06-12 7:45 Leon Romanovsky
[not found] ` <20170612074521.15785-1-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
0 siblings, 1 reply; 3+ messages in thread
From: Leon Romanovsky @ 2017-06-12 7:45 UTC (permalink / raw)
To: Doug Ledford; +Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, Erez Shitrit
From: Erez Shitrit <erezsh-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
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-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Reviewed-by: Alex Vesker <valex-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Signed-off-by: Leon Romanovsky <leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
---
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,
};
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-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 3+ messages in thread[parent not found: <20170612074521.15785-1-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>]
* Re: [PATCH rdma-next] IB/ipoib: Let lower driver handle get_stats64 call [not found] ` <20170612074521.15785-1-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org> @ 2017-06-12 8:06 ` Yuval Shaia 2017-07-22 17:11 ` Doug Ledford 1 sibling, 0 replies; 3+ messages in thread From: Yuval Shaia @ 2017-06-12 8:06 UTC (permalink / raw) To: Leon Romanovsky Cc: Doug Ledford, linux-rdma-u79uwXL29TY76Z2rM5mHXA, Erez Shitrit On Mon, Jun 12, 2017 at 10:45:21AM +0300, Leon Romanovsky wrote: > From: Erez Shitrit <erezsh-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org> > > 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-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org> > Reviewed-by: Alex Vesker <valex-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org> > Signed-off-by: Leon Romanovsky <leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org> > --- > 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-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org> > > 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-u79uwXL29TY76Z2rM5mHXA@public.gmane.org > 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-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH rdma-next] IB/ipoib: Let lower driver handle get_stats64 call [not found] ` <20170612074521.15785-1-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org> 2017-06-12 8:06 ` Yuval Shaia @ 2017-07-22 17:11 ` Doug Ledford 1 sibling, 0 replies; 3+ messages in thread From: Doug Ledford @ 2017-07-22 17:11 UTC (permalink / raw) To: Leon Romanovsky; +Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, Erez Shitrit [-- Attachment #1.1: Type: text/plain, Size: 772 bytes --] On 6/12/2017 3:45 AM, Leon Romanovsky wrote: > From: Erez Shitrit <erezsh-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org> > > 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-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org> > Reviewed-by: Alex Vesker <valex-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org> > Signed-off-by: Leon Romanovsky <leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org> This has been accepted into 4.13-rc, thanks. -- Doug Ledford <dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> GPG Key ID: B826A3330E572FDD Key fingerprint = AE6B 1BDA 122B 23B4 265B 1274 B826 A333 0E57 2FDD [-- Attachment #2: OpenPGP digital signature --] [-- Type: application/pgp-signature, Size: 884 bytes --] ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-07-22 17:11 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-06-12 7:45 [PATCH rdma-next] IB/ipoib: Let lower driver handle get_stats64 call Leon Romanovsky
[not found] ` <20170612074521.15785-1-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2017-06-12 8:06 ` Yuval Shaia
2017-07-22 17:11 ` Doug Ledford
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox