Received: by 10.192.165.156 with SMTP id m28csp44444imm; Tue, 10 Apr 2018 16:03:05 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+2HvDFNCq8n69CMr3B2+CENYpQbNsQBaSeqLf3jYavouifkaIWYEUwnk6+u+054L1YAlvt X-Received: by 2002:a17:902:788e:: with SMTP id q14-v6mr2434040pll.396.1523401385212; Tue, 10 Apr 2018 16:03:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523401385; cv=none; d=google.com; s=arc-20160816; b=LKqBSts++U655kF/lMVFUN9Ze0TNPs/7lb3RT5DNcT8m5Vgdl6SOjnEAF/UhqJvHG5 WodGRE4jt5hq0Is2QORExMeDv1Cn+O8pJzIROJIao37+ulPU+VGmkl4/u/xUncHZ/oOd 6J8M9rKWCvcsFKZhMF7bHHahNjK2cKL78LS4A7RQR6vlyQnFtOgPqyQW1uyg/4gtkHag dFZdX0Sffa4eAXutNoSlaF62F4kDXYz17xSlUalVneJZFQOYQ/8sYJKA9tD9NtL/JOsA ADX5PgWsK/ywRZFlF9LD8A7EZkj9pIyRYaFISLuF7qP5VPnmq/Bu/RDIGtMLUKYjkUOB +CNg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=grvrTE7riouWQ7Oo/+9DD5k4U9gmV0fVp9tSOhbAiWU=; b=RzqoPd7DKb1mZTADacpbNj/rKBmyCuk12ize58joQeo+FPXx+nDWOO5Tf+d9lxwxzS Ye4EgROCipv1yuZelLNQf34L03b58yzq/x/2EashoLErqac6ExHkWUVASgvQbYUjWmK+ wLMDPDS+9ljUHAs15f1t4QLaVmmO8LElmb1PuYeVC+lMoo0xPpMpud3TN9f5U0JDQYWN qxm6DZxnUKwp3z6xdtSlBPdXBnaTaabq/fqooG2wnpEL8eW5w+VKjyEJrY2iMWk5VJ0Q iwTB0UFry0Holh34NGU70UreSGe79oy+tGE4spfNh71GnyychPVkHbTf8RkObSCJaZgP rMeg== 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 d124si2856973pfc.22.2018.04.10.16.02.28; Tue, 10 Apr 2018 16:03:05 -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 S1755739AbeDJWg5 (ORCPT + 99 others); Tue, 10 Apr 2018 18:36:57 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:43574 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755702AbeDJWgt (ORCPT ); Tue, 10 Apr 2018 18:36:49 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id E5F2E408; Tue, 10 Apr 2018 22:36:48 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jian Shen , Peng Li , "David S. Miller" , Sasha Levin Subject: [PATCH 4.14 053/138] net: hns3: Fix an error of total drop packet statistics Date: Wed, 11 Apr 2018 00:24:03 +0200 Message-Id: <20180410212908.236927046@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180410212902.121524696@linuxfoundation.org> References: <20180410212902.121524696@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Jian Shen [ Upstream commit d2a5dca8404871be683c6bbc175ebf9c56dd2865 ] The dropped tx/rx packets number of each tqp should also be counted into the total drop tx/rx packets numbers. Fixes: 76ad4f0ee74 ("net: hns3: Add support of HNS3 Ethernet Driver for hip08 SoC") Signed-off-by: Jian Shen Signed-off-by: Peng Li Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_enet.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_enet.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_enet.c @@ -1060,6 +1060,8 @@ hns3_nic_get_stats64(struct net_device * u64 rx_bytes = 0; u64 tx_pkts = 0; u64 rx_pkts = 0; + u64 tx_drop = 0; + u64 rx_drop = 0; for (idx = 0; idx < queue_num; idx++) { /* fetch the tx stats */ @@ -1068,6 +1070,8 @@ hns3_nic_get_stats64(struct net_device * start = u64_stats_fetch_begin_irq(&ring->syncp); tx_bytes += ring->stats.tx_bytes; tx_pkts += ring->stats.tx_pkts; + tx_drop += ring->stats.tx_busy; + tx_drop += ring->stats.sw_err_cnt; } while (u64_stats_fetch_retry_irq(&ring->syncp, start)); /* fetch the rx stats */ @@ -1076,6 +1080,9 @@ hns3_nic_get_stats64(struct net_device * start = u64_stats_fetch_begin_irq(&ring->syncp); rx_bytes += ring->stats.rx_bytes; rx_pkts += ring->stats.rx_pkts; + rx_drop += ring->stats.non_vld_descs; + rx_drop += ring->stats.err_pkt_len; + rx_drop += ring->stats.l2_err; } while (u64_stats_fetch_retry_irq(&ring->syncp, start)); } @@ -1091,8 +1098,8 @@ hns3_nic_get_stats64(struct net_device * stats->rx_missed_errors = netdev->stats.rx_missed_errors; stats->tx_errors = netdev->stats.tx_errors; - stats->rx_dropped = netdev->stats.rx_dropped; - stats->tx_dropped = netdev->stats.tx_dropped; + stats->rx_dropped = rx_drop + netdev->stats.rx_dropped; + stats->tx_dropped = tx_drop + netdev->stats.tx_dropped; stats->collisions = netdev->stats.collisions; stats->rx_over_errors = netdev->stats.rx_over_errors; stats->rx_frame_errors = netdev->stats.rx_frame_errors;