From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from rcdn-iport-1.cisco.com (rcdn-iport-1.cisco.com [173.37.86.72]) by dpdk.org (Postfix) with ESMTP id 41EA2301 for ; Wed, 13 Jul 2016 18:52:48 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=cisco.com; i=@cisco.com; l=1221; q=dns/txt; s=iport; t=1468428768; x=1469638368; h=from:to:cc:subject:date:message-id; bh=djK5ch4qYXBbtWhVRM2tIEeQON6KP9xO1DsLnRrIBk8=; b=fE3Jqtr8N45t0rsgKd35UMTy175JLPAGa64GrgDp6IYJywMZH5PVE5oV 3QOqo5uARe+eFaQYeWd9iX57PiKHv/CDrd1m5YsK8YGzizb2lyx3knAGT TZZOfe0mog0TvvBxwb5DHgOWv/89qTD5QvfVeY0oJ2JG6tZF93tAQjL95 w=; X-IronPort-AV: E=Sophos;i="5.28,358,1464652800"; d="scan'208";a="129202679" Received: from rcdn-core-2.cisco.com ([173.37.93.153]) by rcdn-iport-1.cisco.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 13 Jul 2016 16:52:47 +0000 Received: from cisco.com (savbu-usnic-a.cisco.com [10.193.184.48]) by rcdn-core-2.cisco.com (8.14.5/8.14.5) with ESMTP id u6DGql93024294; Wed, 13 Jul 2016 16:52:47 GMT Received: by cisco.com (Postfix, from userid 412739) id 4CED63FAADB0; Wed, 13 Jul 2016 09:52:47 -0700 (PDT) From: Nelson Escobar To: dev@dpdk.org Cc: bruce.richardson@intel.com, Nelson Escobar Date: Wed, 13 Jul 2016 09:52:34 -0700 Message-Id: <1468428754-13809-1-git-send-email-neescoba@cisco.com> X-Mailer: git-send-email 2.7.0 Subject: [dpdk-dev] [PATCH] net/enic: fix calculation of truncated packets X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jul 2016 16:52:48 -0000 The calculation of truncated packets didn't take into account packet errors due to the adapter not having buffers, causing both the ipackets, and imissed counts to be wrong if such errors occurred. In order to properly calculate the number of packets truncated, we need to subtract the count of errors due to no buffers. Fixes: c44d9f01adf3 ("net/enic: count truncated packets") Signed-off-by: Nelson Escobar --- drivers/net/enic/enic_main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/enic/enic_main.c b/drivers/net/enic/enic_main.c index d8669cc..9ec2a2d 100644 --- a/drivers/net/enic/enic_main.c +++ b/drivers/net/enic/enic_main.c @@ -172,7 +172,8 @@ void enic_dev_stats_get(struct enic *enic, struct rte_eth_stats *r_stats) * which can make ibytes be slightly higher than it should be. */ rx_packet_errors = rte_atomic64_read(&soft_stats->rx_packet_errors); - rx_truncated = rx_packet_errors - stats->rx.rx_errors; + rx_truncated = rx_packet_errors - stats->rx.rx_errors - + stats->rx.rx_no_bufs; r_stats->ipackets = stats->rx.rx_frames_ok - rx_truncated; r_stats->opackets = stats->tx.tx_frames_ok; -- 2.7.0