Skip to content

Commit

Permalink
IB/ipoib: Let lower driver handle get_stats64 call
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-by: Alex Vesker <[email protected]>
Signed-off-by: Leon Romanovsky <[email protected]>
Reviewed-by: Yuval Shaia <[email protected]>
Signed-off-by: Doug Ledford <[email protected]>
  • Loading branch information
Erez Shitrit authored and dledford committed Jul 18, 2017
1 parent 8fe8bac commit b6c871e
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions drivers/infiniband/ulp/ipoib/ipoib_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,17 @@ static int ipoib_change_mtu(struct net_device *dev, int new_mtu)
return ret;
}

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)
Expand Down Expand Up @@ -1823,6 +1834,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 = {
Expand Down

0 comments on commit b6c871e

Please sign in to comment.