From patchwork Fri Jan 23 06:23:44 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 2495 Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id 1D1255AD6; Fri, 23 Jan 2015 07:23:57 +0100 (CET) Received: from mail-pa0-f46.google.com (mail-pa0-f46.google.com [209.85.220.46]) by dpdk.org (Postfix) with ESMTP id C6B355AD4 for ; Fri, 23 Jan 2015 07:23:53 +0100 (CET) Received: by mail-pa0-f46.google.com with SMTP id lj1so2044740pab.5 for ; Thu, 22 Jan 2015 22:23:53 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=3URV9z4tHKdPCQZceOLz3fXPqfbfqi5g/zSUu1LKRY4=; b=IdifN/nPoOVlk0UFgNDgpw4qOQIfvr0eWogZQ8Ono7nlW0FbXI4M8ZS4j/sGHvPR4t VWynYdBVHrJK7vlxGchB4gQ5S8gWu5w3Lqi8C9Ya0oVf6wSoTsXKLN3dxNDJwmgznadg ebMCjpdZ0xINeY8G0duTNYxFnLSeTwAS1nbiuphGMZmUhTQ9bu3j778PNbGQGTRLTn/+ r/NNylnfBjDXJyaz26RulJ25KHc1+eTBqH77XEtUA1eW+EK3D4GVbf7s1Rya6ezm98Rg Bqsu/SS0PavfaeOA6sAl4nlLfwZFbuxKtQpkyKmC3c0IkV+UKc/xFqybzFfG0o78GKgi pl8A== X-Gm-Message-State: ALoCoQlOAgT2hVkqWIU/3BzqGsdBqXnfesXSFQGA77GVNZSZQtQOpTWGnWmBqNPKhmvvVOrd0gk9 X-Received: by 10.68.196.231 with SMTP id ip7mr8502098pbc.156.1421994232945; Thu, 22 Jan 2015 22:23:52 -0800 (PST) Received: from urahara.brocade.com (static-50-53-82-155.bvtn.or.frontiernet.net. [50.53.82.155]) by mx.google.com with ESMTPSA id nj2sm725755pbc.16.2015.01.22.22.23.50 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 22 Jan 2015 22:23:52 -0800 (PST) From: stephen@networkplumber.org To: dev@dpdk.org Date: Thu, 22 Jan 2015 22:23:44 -0800 Message-Id: <1421994224-2127-1-git-send-email-stephen@networkplumber.org> X-Mailer: git-send-email 2.1.4 Cc: Stephen Hemminger Subject: [dpdk-dev] [PATCH] ixgbe: do not include CRC in Tx byte count 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Stephen Hemminger The ixgbe driver was including CRC in the transmit packet byte count, but not for packets received. This was notice when forwarding and the number of bytes received was greater than the number of bytes transmitted for the same number of packets. Make the driver behave like other virtual devices and not include CRC in byte count. Use the same queue counters already computed and used for Rx. Signed-off-by: Stephen Hemminger --- lib/librte_pmd_ixgbe/ixgbe_ethdev.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/librte_pmd_ixgbe/ixgbe_ethdev.c b/lib/librte_pmd_ixgbe/ixgbe_ethdev.c index b58ec45..27355eb 100644 --- a/lib/librte_pmd_ixgbe/ixgbe_ethdev.c +++ b/lib/librte_pmd_ixgbe/ixgbe_ethdev.c @@ -1724,12 +1724,15 @@ ixgbe_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats) struct ixgbe_hw_stats *hw_stats = IXGBE_DEV_PRIVATE_TO_STATS(dev->data->dev_private); uint32_t bprc, lxon, lxoff, total; - uint64_t total_missed_rx, total_qbrc, total_qprc; + uint64_t total_missed_rx; + uint64_t total_qbrc, total_qprc, total_qbtc, total_qptc; unsigned i; total_missed_rx = 0; total_qbrc = 0; total_qprc = 0; + total_qbtc = 0; + total_qptc = 0; hw_stats->crcerrs += IXGBE_READ_REG(hw, IXGBE_CRCERRS); hw_stats->illerrc += IXGBE_READ_REG(hw, IXGBE_ILLERRC); @@ -1770,6 +1773,8 @@ ixgbe_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats) total_qprc += hw_stats->qprc[i]; total_qbrc += hw_stats->qbrc[i]; + total_qptc += hw_stats->qptc[i]; + total_qbtc += hw_stats->qbtc[i]; } hw_stats->mlfc += IXGBE_READ_REG(hw, IXGBE_MLFC); hw_stats->mrfc += IXGBE_READ_REG(hw, IXGBE_MRFC); @@ -1860,8 +1865,8 @@ ixgbe_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats) /* Fill out the rte_eth_stats statistics structure */ stats->ipackets = total_qprc; stats->ibytes = total_qbrc; - stats->opackets = hw_stats->gptc; - stats->obytes = hw_stats->gotc; + stats->opackets = total_qptc; + stats->obytes = total_qbtc; stats->imcasts = hw_stats->mprc; for (i = 0; i < IXGBE_QUEUE_STAT_COUNTERS; i++) {