From patchwork Wed Apr 26 23:38:48 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Iyappan Subramanian X-Patchwork-Id: 9702203 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id F41EA601D3 for ; Wed, 26 Apr 2017 23:38:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E479128399 for ; Wed, 26 Apr 2017 23:38:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D916B284DB; Wed, 26 Apr 2017 23:38:12 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 590C628399 for ; Wed, 26 Apr 2017 23:38:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=h1ibx7+m0qt/iftaQjpeNjaQf//QPv6o1Bf3+SP6e+A=; b=YHr7WZbfmmZnbEMbORm0OnlIEh wfqEjXsnOzMmiayvrBcq3c35t23y1vjEeS4G+BAoSzwTIHYhP2kyHsh6WBr5aXasUIiI9mkbwc7HL kNjE8w3madZmYOpe71Xq+1f4Lypf+hl4uxDoWl2Z3dQnKbuWHdWGrAidwBYgB9CgJ1RsBxu6lT4Ej UrIVtvbvfjTXxGMMyyJG9Kd200DgPHd/N8HHo0oiYZhqXLODJQo6WgU/9xkxAqjph4cytKXI4w6Lm AAn7ITAsf1dcCdl99UmF9zfeT6sNnjdVwkGDVwrg1doYzpWoVZ4oOHy93Xym168sFoD6jzUkkmHfv xuCAVEOw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1d3WVY-0005Rb-Ko; Wed, 26 Apr 2017 23:38:04 +0000 Received: from mail-pf0-x22b.google.com ([2607:f8b0:400e:c00::22b]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1d3WUV-0004DB-5b for linux-arm-kernel@lists.infradead.org; Wed, 26 Apr 2017 23:37:06 +0000 Received: by mail-pf0-x22b.google.com with SMTP id a188so8318435pfa.0 for ; Wed, 26 Apr 2017 16:36:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=apm.com; s=apm; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=eOnyekJFuA4aO6O8CWWmIcd1QZLSoXOLUjObHYfiCYQ=; b=YlPXkEfWPjxruZsRGw0VQk2Y7HbjmJdIRXC4RU8tuoGQOOLqLdgdIRrkHj/ABGwX6r XjK9faSy7doS0R3EuTe69yFT5ScIIeJFjr67a2+f10Dh9cwJkzjReuX+Xdlfoh/q76Vj FOo7w7fvEcP+0ByUYTAu+Vs+flbXsitiMnHn8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=eOnyekJFuA4aO6O8CWWmIcd1QZLSoXOLUjObHYfiCYQ=; b=jl5NpFcD4QSjBwS+9Fbo1K9vDci1MtpkC8zTAfYAX5Jghl+qNSr2qTaGhCnUygkLmI yId+JkDvYV7Rvec1obvugivoebIS0uTGUmLZP4pEFSleNgaX+X+tk5Q+MTNkJjXYwQ0X yvr2EoRHkSviIPSFUAVjpN4o2DVbtVID9qlAN02WJs00cqx/bHnzr8qfd0d1mqG3w2nb prfG5jCGKfavI2LORbbqCiQGikA0QVHkkbR3Rh/If/eRDzd3TP1HvsPCjHsQxI5vsF4X 0+7OCdvn+L1DnhFT2FIIxwTrlOWLxbhdSSiuVF8WoCtOFomOU8pK109rkgq7ygOEt8Dt dM5Q== X-Gm-Message-State: AN3rC/7+39aGcdPGaWpoiFtY7IG91kNJDEItss7ZkknRCzwxYI7mXoCi vItITZiGUjJ5pY64 X-Received: by 10.98.61.91 with SMTP id k88mr2570015pfa.62.1493249795546; Wed, 26 Apr 2017 16:36:35 -0700 (PDT) Received: from isubrama-dev.amcc.com ([206.80.4.98]) by smtp.gmail.com with ESMTPSA id i30sm626700pgn.39.2017.04.26.16.36.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 26 Apr 2017 16:36:35 -0700 (PDT) From: Iyappan Subramanian To: davem@davemloft.net, netdev@vger.kernel.org Subject: [PATCH net-next 2/9] drivers: net: xgene: Remove redundant local stats Date: Wed, 26 Apr 2017 16:38:48 -0700 Message-Id: <1493249935-30759-3-git-send-email-isubramanian@apm.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1493249935-30759-1-git-send-email-isubramanian@apm.com> References: <1493249935-30759-1-git-send-email-isubramanian@apm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170426_163659_233091_7017290F X-CRM114-Status: GOOD ( 12.85 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Quan Nguyen , patches@apm.com, linux-arm-kernel@lists.infradead.org, Iyappan Subramanian MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Quan Nguyen Commit 5944701df90d ("net: remove useless memset's in drivers get_stats64") makes the pdata->stats redundant. This patch removes pdata->stats and updates get_stats64() callback accordingly. Signed-off-by: Quan Nguyen Signed-off-by: Iyappan Subramanian --- drivers/net/ethernet/apm/xgene/xgene_enet_ethtool.c | 7 ++++--- drivers/net/ethernet/apm/xgene/xgene_enet_main.c | 4 +--- drivers/net/ethernet/apm/xgene/xgene_enet_main.h | 1 - 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_ethtool.c b/drivers/net/ethernet/apm/xgene/xgene_enet_ethtool.c index 28fdedc..217cde8 100644 --- a/drivers/net/ethernet/apm/xgene/xgene_enet_ethtool.c +++ b/drivers/net/ethernet/apm/xgene/xgene_enet_ethtool.c @@ -25,7 +25,7 @@ struct xgene_gstrings_stats { int offset; }; -#define XGENE_STAT(m) { #m, offsetof(struct xgene_enet_pdata, stats.m) } +#define XGENE_STAT(m) { #m, offsetof(struct rtnl_link_stats64, m) } static const struct xgene_gstrings_stats gstrings_stats[] = { XGENE_STAT(rx_packets), @@ -156,11 +156,12 @@ static void xgene_get_ethtool_stats(struct net_device *ndev, struct ethtool_stats *dummy, u64 *data) { - void *pdata = netdev_priv(ndev); + struct rtnl_link_stats64 stats; int i; + dev_get_stats(ndev, &stats); for (i = 0; i < XGENE_STATS_LEN; i++) - *data++ = *(u64 *)(pdata + gstrings_stats[i].offset); + data[i] = *(u64 *)((char *)&stats + gstrings_stats[i].offset); } static void xgene_get_pauseparam(struct net_device *ndev, diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c index 9a28ac3..e4f2ef2 100644 --- a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c +++ b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c @@ -1466,10 +1466,9 @@ static int xgene_enet_create_desc_rings(struct net_device *ndev) static void xgene_enet_get_stats64( struct net_device *ndev, - struct rtnl_link_stats64 *storage) + struct rtnl_link_stats64 *stats) { struct xgene_enet_pdata *pdata = netdev_priv(ndev); - struct rtnl_link_stats64 *stats = &pdata->stats; struct xgene_enet_desc_ring *ring; int i; @@ -1493,7 +1492,6 @@ static void xgene_enet_get_stats64( stats->rx_dropped += ring->rx_dropped; } } - memcpy(storage, stats, sizeof(struct rtnl_link_stats64)); } static int xgene_enet_set_mac_address(struct net_device *ndev, void *addr) diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_main.h b/drivers/net/ethernet/apm/xgene/xgene_enet_main.h index 827b33d..5e6fd71 100644 --- a/drivers/net/ethernet/apm/xgene/xgene_enet_main.h +++ b/drivers/net/ethernet/apm/xgene/xgene_enet_main.h @@ -219,7 +219,6 @@ struct xgene_enet_pdata { int phy_mode; enum xgene_enet_rm rm; struct xgene_enet_cle cle; - struct rtnl_link_stats64 stats; const struct xgene_mac_ops *mac_ops; spinlock_t mac_lock; /* mac lock */ const struct xgene_port_ops *port_ops;