Received: by 10.192.165.156 with SMTP id m28csp68432imm; Tue, 10 Apr 2018 16:35:47 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+UML2+cJ2DWiyWTytjFT6xx2hQ4H1AE9Lgely6hnAWy8VgBZTb0kHLt5YQ2woWOr2xZYxY X-Received: by 2002:a17:902:bc89:: with SMTP id bb9-v6mr2403043plb.285.1523403347718; Tue, 10 Apr 2018 16:35:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523403347; cv=none; d=google.com; s=arc-20160816; b=LUO2ZR5c3LDn1+rifXFd2LIsbQrj4mBWZEitel+vvCqS2Eo/tK2furZQUUN6J/6f18 O0X9hL1KgVVc6SZF2RcNULh8GiuK8eq0zE8FZePwUq6vBJ5Uefg+vusEhb9eGMr1V6Pq Pbx8P5A2V5u1Jj9fdqpcWfRzqmFv7O62qUwz7p3Iz9ANA40Y2DxLZ2rUJdvKPKzHLn0e jhSNEGznLjhyaiInmfC5ftAri+3EzWwZ9D3pvPUGNZFtBfmCNkDrcSn0XXBUVxlhbbJQ cZzPcj4nMZkvw3ZMdej5Uh5NBCTYhMfsW3bMjzCchyXrLf4JhCBJIV2+QmNfKF68K8oy LeqA== 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=TGrRXSxrVQcad35tIBivESRDU53D40KE8Ej4hgoFd2c=; b=g0kr1GIBio6DPyMSzC/IRiaPGMpPRTkyHp1kceNsdVQg3t9vlpEL0lN/DPcqfauGC1 4sxagrKJaWF//UyCtkXEI50+tYvPaQPenaxW+X47CbOmeQQJwUd+SeJTq5p+G/Bagc+w gP78vONQva15KSrQ9khnveKANr0hDXZOqp5jpYt0mv3GUTtKcnq6u9LFsXu6nx9JSmNh 53yEnhRpzIFNxQvxW+ebFn8iLTW0RK1JdwZSw5pjw+ogiE3EIelExGeW0QL2VbzLvG5+ 4GM8zNX9g0F7lHzeD8omXRlT9LUduboLDWXml/EctvE5AF7UhwELJ27QMcxCRY9k6BaP 5crA== 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 z9si2491670pgz.62.2018.04.10.16.35.11; Tue, 10 Apr 2018 16:35:47 -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 S1754152AbeDJW2w (ORCPT + 99 others); Tue, 10 Apr 2018 18:28:52 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:39224 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754123AbeDJW2t (ORCPT ); Tue, 10 Apr 2018 18:28: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 DF09CD09; Tue, 10 Apr 2018 22:28: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.15 068/168] net: hns3: Fix an error of total drop packet statistics Date: Wed, 11 Apr 2018 00:23:30 +0200 Message-Id: <20180410212803.096339984@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180410212800.144079021@linuxfoundation.org> References: <20180410212800.144079021@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.15-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 @@ -1055,6 +1055,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 */ @@ -1063,6 +1065,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 */ @@ -1071,6 +1075,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)); } @@ -1086,8 +1093,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;