From patchwork Thu Jun 17 09:49:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Esben Haabendal X-Patchwork-Id: 12327195 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8EF8CC2B9F4 for ; Thu, 17 Jun 2021 09:49:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 78FDB613D5 for ; Thu, 17 Jun 2021 09:49:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231881AbhFQJv0 (ORCPT ); Thu, 17 Jun 2021 05:51:26 -0400 Received: from first.geanix.com ([116.203.34.67]:41892 "EHLO first.geanix.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231845AbhFQJvZ (ORCPT ); Thu, 17 Jun 2021 05:51:25 -0400 Received: from localhost (unknown [185.17.218.86]) by first.geanix.com (Postfix) with ESMTPSA id A788A4C325D; Thu, 17 Jun 2021 09:49:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=geanix.com; s=first; t=1623923355; bh=IoCXtXJsUbap8V+xD8LLq4yWJQOOPHd9bY+uNZyTmtI=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=h92R3X3MIoTX+PyZqVzLxvBcdkD9GKH6GJ7/sHPVE04LX2p90vqLAiUUgbpMqI2Yl YrdTQVDr25wqG+xiaAVpB6tD28va4qsT2RQF3XKq1uAau3JOuCcem60SynoZc/dLse mxXn2PDauo1QI30FVclAO7RkLgNuUBpKuY2Phr9M66a2/M/xRJjDy3eINUD6x1WuLi znjGB5DCELW7KQNvDX/P0Fi1tWubgX/wXVpGYaZg/z8S6KJURSvE29/HAHQ2i1D9h1 qp7djyr0eawQLGYXQguaVs/iwuTd9OjkZE5P+Htj1GmJSJQuC4XR3Z7ZhbTy0r4eSi JV0S4PNlBR2Wg== From: Esben Haabendal To: netdev@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Rasmus Villemoes , Claudiu Manoil , "David S. Miller" , Jakub Kicinski Subject: [PATCH 1/6] net: gianfar: Convert to ndo_get_stats64 interface Date: Thu, 17 Jun 2021 11:49:15 +0200 Message-Id: X-Mailer: git-send-email 2.32.0 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org No reason to produce the legacy net_device_stats struct, only to have it converted to rtnl_link_stats64. And as a bonus, this allows for improving counter size to 64 bit. Signed-off-by: Esben Haabendal --- drivers/net/ethernet/freescale/gianfar.c | 25 +++++++----------------- 1 file changed, 7 insertions(+), 18 deletions(-) diff --git a/drivers/net/ethernet/freescale/gianfar.c b/drivers/net/ethernet/freescale/gianfar.c index f2945abdb041..a0277fe8cc60 100644 --- a/drivers/net/ethernet/freescale/gianfar.c +++ b/drivers/net/ethernet/freescale/gianfar.c @@ -274,32 +274,21 @@ static void gfar_configure_coalescing_all(struct gfar_private *priv) gfar_configure_coalescing(priv, 0xFF, 0xFF); } -static struct net_device_stats *gfar_get_stats(struct net_device *dev) +static void gfar_get_stats64(struct net_device *dev, struct rtnl_link_stats64 *stats) { struct gfar_private *priv = netdev_priv(dev); - unsigned long rx_packets = 0, rx_bytes = 0, rx_dropped = 0; - unsigned long tx_packets = 0, tx_bytes = 0; int i; for (i = 0; i < priv->num_rx_queues; i++) { - rx_packets += priv->rx_queue[i]->stats.rx_packets; - rx_bytes += priv->rx_queue[i]->stats.rx_bytes; - rx_dropped += priv->rx_queue[i]->stats.rx_dropped; + stats->rx_packets += priv->rx_queue[i]->stats.rx_packets; + stats->rx_bytes += priv->rx_queue[i]->stats.rx_bytes; + stats->rx_dropped += priv->rx_queue[i]->stats.rx_dropped; } - dev->stats.rx_packets = rx_packets; - dev->stats.rx_bytes = rx_bytes; - dev->stats.rx_dropped = rx_dropped; - for (i = 0; i < priv->num_tx_queues; i++) { - tx_bytes += priv->tx_queue[i]->stats.tx_bytes; - tx_packets += priv->tx_queue[i]->stats.tx_packets; + stats->tx_bytes += priv->tx_queue[i]->stats.tx_bytes; + stats->tx_packets += priv->tx_queue[i]->stats.tx_packets; } - - dev->stats.tx_bytes = tx_bytes; - dev->stats.tx_packets = tx_packets; - - return &dev->stats; } /* Set the appropriate hash bit for the given addr */ @@ -3157,7 +3146,7 @@ static const struct net_device_ops gfar_netdev_ops = { .ndo_set_rx_mode = gfar_set_multi, .ndo_tx_timeout = gfar_timeout, .ndo_do_ioctl = gfar_ioctl, - .ndo_get_stats = gfar_get_stats, + .ndo_get_stats64 = gfar_get_stats64, .ndo_change_carrier = fixed_phy_change_carrier, .ndo_set_mac_address = gfar_set_mac_addr, .ndo_validate_addr = eth_validate_addr,