From patchwork Fri Aug 18 11:31:37 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Salil Mehta X-Patchwork-Id: 110381 Delivered-To: patch@linaro.org Received: by 10.140.95.78 with SMTP id h72csp787792qge; Fri, 18 Aug 2017 04:33:45 -0700 (PDT) X-Received: by 10.84.217.206 with SMTP id d14mr2906485plj.319.1503056025239; Fri, 18 Aug 2017 04:33:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1503056025; cv=none; d=google.com; s=arc-20160816; b=bz1rhEnNr8Y7tcku8HDi2d2eDWeR6K3Y6iaZU+QaGuunqc2OVW4WrsgseYK6lfkiTC UzLu9IPYlcE2C4Uw6tEJqY2s1KKvPy4nLvEs0p0VofTKRWfhk9NNiC8fs3L3v2ojNrfo f7y1lFOiFIxDT3Clh4L7oNldqZ7WaSV8158Uxme/AyDO2pDBrqqwXam6dkFXxFxxYp4x PdH0padq++SBMk5gz+0Tnzv3KXrI2T7cjHU7UGlhNjHgZc+JEZA+FGUaNf7tziuYzUL3 9Yc23+BED1ArIpbUJsoPZUjSy+3DQ0H4eRyxAvug4WhMCnn8b+wRRCCEr+herbciG8+H Gauw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:arc-authentication-results; bh=dPtcwKIBLS7U+mJfllDthgcaMm02MtPRxTGRe6Fzzk0=; b=MCEfubaOsrOLC6eAc/Y7c4ZWn09qlckubun33TerqZkUfob3mljYxGVL29IDm7KERz c1q+q2h7Mzv+eU0T9Ozkz3wZYxS6gSCyRwozZHvMC85CO63crVvjQiVw74xQ1f1H+8eu /0tD2zH3f25m6JfHNG58Kie6DJh7Ikb3gIKebqjlbEJTIPYZX8onUBGMRh7lR6lTQ608 vzlPNRdcMLAULXeOUtNaGb0xRaWshladv4s+QT83FVLsIaBdyYzwwW2iUQGLuqlbWyh7 xCBjVFIqhqhriK/guKuYrYGmJr+/eh/2N/+E2Y0/G9AZjbzq+fJkDIw7n34GshXtLj2Q t2aw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q15si329346pgc.932.2017.08.18.04.33.44; Fri, 18 Aug 2017 04:33:45 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752216AbdHRLdm (ORCPT + 26 others); Fri, 18 Aug 2017 07:33:42 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:4071 "EHLO szxga05-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750881AbdHRLca (ORCPT ); Fri, 18 Aug 2017 07:32:30 -0400 Received: from 172.30.72.59 (EHLO DGGEMS414-HUB.china.huawei.com) ([172.30.72.59]) by dggrg05-dlp.huawei.com (MOS 4.4.6-GA FastPath queued) with ESMTP id DFM57981; Fri, 18 Aug 2017 19:32:27 +0800 (CST) Received: from S00293818-DELL1.china.huawei.com (10.203.181.151) by DGGEMS414-HUB.china.huawei.com (10.3.19.214) with Microsoft SMTP Server id 14.3.301.0; Fri, 18 Aug 2017 19:32:15 +0800 From: Salil Mehta To: CC: , , , , , , , , Subject: [PATCH net-next 1/3] net: hns3: Fixes the missing u64_stats_fetch_begin_irq in 64-bit stats fetch Date: Fri, 18 Aug 2017 12:31:37 +0100 Message-ID: <20170818113139.153200-2-salil.mehta@huawei.com> X-Mailer: git-send-email 2.8.3 In-Reply-To: <20170818113139.153200-1-salil.mehta@huawei.com> References: <20170818113139.153200-1-salil.mehta@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.203.181.151] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020202.5996D04B.00BD, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0, so=2014-11-16 11:51:01, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: b994b4c4bf1af27004b0ad2713b79b17 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch fixes the missing u64_stats_fetch_begin_irq() while trying to atomically do 64-bit RX/TX fetch. We did not get any error during test as our SoC is 64-bit so all of these seq/lock operations results in NOOP. As such, this seq lock supports has been added for the sake of completion if this code ever runs on 32-bit platform and we are trying to do 64-bit stats fetch. Fixes: 76ad4f0ee747 ("net: hns3: Add support of HNS3 Ethernet Driver for hip08 SoC") Reported-by: Dan Carpenter Signed-off-by: Salil Mehta --- drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_enet.c | 2 ++ 1 file changed, 2 insertions(+) -- 2.7.4 diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_enet.c index 9589b7e..b12730a 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_enet.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_enet.c @@ -1054,6 +1054,7 @@ hns3_nic_get_stats64(struct net_device *netdev, struct rtnl_link_stats64 *stats) /* fetch the tx stats */ ring = priv->ring_data[idx].ring; do { + start = u64_stats_fetch_begin_irq(&ring->syncp); tx_bytes += ring->stats.tx_bytes; tx_pkts += ring->stats.tx_pkts; } while (u64_stats_fetch_retry_irq(&ring->syncp, start)); @@ -1061,6 +1062,7 @@ hns3_nic_get_stats64(struct net_device *netdev, struct rtnl_link_stats64 *stats) /* fetch the rx stats */ ring = priv->ring_data[idx + queue_num].ring; do { + start = u64_stats_fetch_begin_irq(&ring->syncp); rx_bytes += ring->stats.rx_bytes; rx_pkts += ring->stats.rx_pkts; } while (u64_stats_fetch_retry_irq(&ring->syncp, start));