[ovs-dev] [PATCH branch-2.7 11/25] datapath: make ndo_get_stats64 a void function

Jarno Rajahalme jarno at ovn.org
Wed Mar 15 23:31:15 UTC 2017

From: stephen hemminger <stephen at networkplumber.org>

Upstream commit:
    commit bc1f44709cf27fb2a5766cadafe7e2ad5e9cb221
    Author: stephen hemminger <stephen at networkplumber.org>
    Date:   Fri Jan 6 19:12:52 2017 -0800

    net: make ndo_get_stats64 a void function

    The network device operation for reading statistics is only called
    in one place, and it ignores the return value. Having a structure
    return value is potentially confusing because some future driver could
    incorrectly assume that the return value was used.

    Fix all drivers with ndo_get_stats64 to have a void function.

    Signed-off-by: Stephen Hemminger <sthemmin at microsoft.com>
    Signed-off-by: David S. Miller <davem at davemloft.net>

This seems to be fine for all prior Linux versions as well.

Signed-off-by: Jarno Rajahalme <jarno at ovn.org>
Signed-off-by: Joe Stringer <joe at ovn.org>
 datapath/vport-internal_dev.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/datapath/vport-internal_dev.c b/datapath/vport-internal_dev.c
index 2988e8c..2fa9ab9 100644
--- a/datapath/vport-internal_dev.c
+++ b/datapath/vport-internal_dev.c
@@ -117,7 +117,7 @@ static void internal_dev_destructor(struct net_device *dev)
-static struct rtnl_link_stats64 *
+static void
 internal_get_stats(struct net_device *dev, struct rtnl_link_stats64 *stats)
 	int i;
@@ -145,8 +145,6 @@ internal_get_stats(struct net_device *dev, struct rtnl_link_stats64 *stats)
 		stats->tx_bytes         += local_stats.tx_bytes;
 		stats->tx_packets       += local_stats.tx_packets;
-	return stats;
@@ -164,7 +162,7 @@ static const struct net_device_ops internal_dev_netdev_ops = {
 	.ndo_change_mtu = internal_dev_change_mtu,
-	.ndo_get_stats64 = internal_get_stats,
+	.ndo_get_stats64 = (void *)internal_get_stats,
 	.ndo_set_rx_headroom = internal_set_rx_headroom,

More information about the dev mailing list