From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR02-HE1-obe.outbound.protection.outlook.com (mail-eopbgr10046.outbound.protection.outlook.com [40.107.1.46]) by dpdk.org (Postfix) with ESMTP id 2681D6841; Mon, 11 Sep 2017 14:51:08 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=AxTuQuLCvj1Vc+ZZuHItbEphhU3j6g5YkT5lr1bwttg=; b=DN86bpWhflzBj0vXS3b07TLYTLdYH52BVidWF0ufu5UIGuKscYSDl2fv+ytrj5haxg7wpaEQVQHd44H+4BbNOS9zc+HiY/uSwBlzSJHz2N1a/LGYpPEQnuQJH2YzvC/bmFYzBdxXAxfFRBKh3PyTC12tRrK26eIeh3CfVe4hUOI= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=shahafs@mellanox.com; Received: from mellanox.com (82.166.227.17) by DB6PR05MB3143.eurprd05.prod.outlook.com (2603:10a6:6:1a::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.35.12; Mon, 11 Sep 2017 12:51:06 +0000 From: Shahaf Shuler To: nelio.laranjeiro@6wind.com Cc: dev@dpdk.org, stable@dpdk.org, adrien.mazarguil@6wind.com Date: Mon, 11 Sep 2017 15:50:57 +0300 Message-Id: X-Mailer: git-send-email 2.12.0 In-Reply-To: <1e7320c4ee4162c9e509b7560be215077f43ca87.1504076528.git.shahafs@mellanox.com> References: <1e7320c4ee4162c9e509b7560be215077f43ca87.1504076528.git.shahafs@mellanox.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [82.166.227.17] X-ClientProxiedBy: AM5PR0602CA0015.eurprd06.prod.outlook.com (2603:10a6:203:a3::25) To DB6PR05MB3143.eurprd05.prod.outlook.com (2603:10a6:6:1a::17) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 208118a3-d2ab-4b37-c986-08d4f913c4b4 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(2017030254152)(48565401081)(300000503095)(300135400095)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095); SRVR:DB6PR05MB3143; X-Microsoft-Exchange-Diagnostics: 1; DB6PR05MB3143; 3:2Nn1h+X90gy7WeSjRiHLKyU/cCYpzqvBR98/HyNnrEz4qT/b0H4Ssx65JVoUGfcD1Wj0F5J8+HXVjvgrV+TOLCvncmxxxnlhQgdOJiD5Cs3hJiUaLYhhD410qaWrbF7FSwaUVB4CacxyYXBYK4fhXFOVmzMLYlMIzRP8NVkLcrjnKncMCjzux+zEwvzeqYtfYTWW5wvdecyYyFS8aKG7qjsYehzeBfmtyASrZdOUWt2beaceeY/aq1k+NCUBqTBT; 25:Qm5TQkVrnokFEkfu3T9tO+iAWHwF/4HQCQeEr3dK1EvJFEtKbJdrEcbymPGJNCvOG1oSNW7gdY5mtN+odceE5B0PZLdQoe06zINy1C8AIREu617MXuf//xiGUi9Z46Fz+Xsuy/vYB3uR6iKPcM9Bf4OAY7e4EnEGssZMIDhGQIHcDXgjWYzhMP2eakS+U9xgwQYJt+a1pLgf0mlSLrvrqs3BfyzBlZ7o5X1mLQafJs1fgwiRU+XBQSzBoKJ0K05hYyhSnDdD4zCtAe6HVklDpsuiS3nR2fjpV50P5pPjHnzJs091WSHmdXdcvODvLuNfJ8F3z1xJIMmReW0gFSFmUw==; 31:JlyJJK2CDj21Kxrryck0BszpQhg2gM4J4JOSTifZyJAr6JbXem1eTSKWnX3mR/PBRO2iFJBcXJ99104Gu/7rj0PW3y7M/2/X+4+0CzwOI0Xrl81vyvDZHJXmwmu3S+H2T7kSDDtZpbQBEd/GztsrUbbKiPCJ/5vdgLlZBxbnxeA1hBIHXe1qWvxNnf7HfB3uiFchnAPY7we1QeCqhtjCGpmwZTVj/LphjZcifjwbbto= X-MS-TrafficTypeDiagnostic: DB6PR05MB3143: X-LD-Processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr X-Microsoft-Exchange-Diagnostics: 1; DB6PR05MB3143; 20:oZqxA1GZ+FZXEkj0q4AHhT7yWFgXPxz9nwxcPusDBQBJSSiUeUoqk8lXZG5Ja32yFyMSAjV5DALhvLo0cf0DOkxSy+vWtBie0zPjGhReJWe/jwPYacLTZ2ATx4ny9aFZorkVY3c7yudGj2D4ONDUzRDeRbzV+o72V9iQ9gmdthUu+GDaP7RvWzugMpZr93wME3Y690buh3IV5nHu6SrJqbE5NI4RKtaks4RxQJV2wBE3ngq/F7MrZobzrnHWesfI5hi/jnKwslvHIIh1ebDSe6FPP3sNmjzj21Yld7c1i9Aln6E1Bpu61WZyumOkSKOny+9Y4vifrKP4TytT2IM2/xWE4+GDwgRCJLSsbLhX7bjFZ/7igDQxUreM18/FOSZxNECyjvGtQdqiYfkBZrSxEX+1b8gFEEwPrFqQUR40Ai6Z56jB8Pek+EQTFpppT3/HKG2slMrPWMGKpLgX6CWKyqfMhoPqt+zO0mHE6VU/dd/fCAX9lLv/I8R6QDLbu2UI; 4:4Nt6FDi2zQX4+70EfH+J+wkAiYyl8Sj0d1RzRAleC2gn182kbE4kP143GOwkKQIOYIW/eCLboEelVgWzu75MGwgwPMUSAAgwmqBx+AudaX9r0ylOcQ8eMD0tWo21GgOndeEfTxsk204+3p4+bwacJpNfCgahWXEIP4rVpgsDyl54wQj/nqdlvGETmFbrV8yg8iEt6fLM8iEtMn4byIK57g+pwhHehV+NHgBDg1V5u8Tw18bBXqOflAY70vrWDL5BuN9Evt95s3X411j7VFHlGnYho1bygKOdvSm8eBbwPFU= X-Exchange-Antispam-Report-Test: UriScan:(788757137089); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(5005006)(8121501046)(3002001)(100000703101)(100105400095)(10201501046)(93006095)(93001095)(6055026)(6041248)(20161123558100)(20161123555025)(20161123560025)(20161123564025)(20161123562025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:DB6PR05MB3143; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:DB6PR05MB3143; X-Forefront-PRVS: 04270EF89C X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(7370300001)(6009001)(39860400002)(189002)(199003)(101416001)(5660300001)(3846002)(6116002)(25786009)(8676002)(110136004)(86362001)(575784001)(4326008)(2906002)(33026002)(36756003)(50226002)(42186005)(81156014)(305945005)(7736002)(68736007)(118296001)(33646002)(69596002)(6916009)(2950100002)(66066001)(21086003)(7350300001)(6666003)(47776003)(2361001)(81166006)(105586002)(106356001)(478600001)(53936002)(2351001)(50466002)(5003940100001)(97736004)(48376002)(189998001)(50986999)(76176999)(55016002); DIR:OUT; SFP:1101; SCL:1; SRVR:DB6PR05MB3143; H:mellanox.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DB6PR05MB3143; 23:slV/VdK3W6HyVrFfiEzVZvERlwWSXAkvQaHySUeqD?= =?us-ascii?Q?W27r9f7lqDF/cbn8bVIK52zWLeqzR377yX+D0lNtMBfozSA+gEhw/fIUsKWL?= =?us-ascii?Q?9R902vxjH6lithx2WjqD8mtFhinb2AQW7tQLuUpQQZpM3DLA9ZMiARfVK3is?= =?us-ascii?Q?KpA87qATP2LUx0eSC+52bIPKVZFfhhlF8jldqefvXg8EF7Pw4e+7O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xQnVKs7r4ckpIm+pa+deaT8230Ss9g= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Sep 2017 12:51:06.0490 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR05MB3143 Subject: [dpdk-stable] [PATCH v3 2/3] net/mlx5: fix Tx stats error counter X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Sep 2017 12:51:08 -0000 The current Tx error counter counts, according to its description, the total number of packets not sent when TX ring full. It is reported to application as part of oerrors field. Putting aside the fact there is no logic which increment this counter, the behaviour of the PMD is wrong. The drop due to full ring is not the statistic that should be set on oerrors field. Such number can be counted by the application using the return value of the Tx burst function. The number that should be set there is the number of packets the device could not transmit in any way, even when it has resources. Therefore, replace this counter to count the total number of failed transmitted packets. In addition, add the logic to increment it on the different cases. Fixes: 87011737b715 ("mlx5: add software counters") Cc: stable@dpdk.org Cc: adrien.mazarguil@6wind.com Signed-off-by: Shahaf Shuler --- on v3: - This patch is new on v3 to address the comment provided on v2. --- drivers/net/mlx5/mlx5_rxtx.c | 20 +++++++++++++++----- drivers/net/mlx5/mlx5_rxtx.h | 2 +- drivers/net/mlx5/mlx5_stats.c | 4 ++-- 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/drivers/net/mlx5/mlx5_rxtx.c b/drivers/net/mlx5/mlx5_rxtx.c index fe9e7eac0..7567f2329 100644 --- a/drivers/net/mlx5/mlx5_rxtx.c +++ b/drivers/net/mlx5/mlx5_rxtx.c @@ -406,8 +406,10 @@ mlx5_tx_burst(void *dpdk_txq, struct rte_mbuf **pkts, uint16_t pkts_n) #ifdef MLX5_PMD_SOFT_COUNTERS total_length = length; #endif - if (length < (MLX5_WQE_DWORD_SIZE + 2)) + if (length < (MLX5_WQE_DWORD_SIZE + 2)) { + txq->stats.oerrors++; break; + } /* Update element. */ (*txq->elts)[elts_head & elts_m] = buf; /* Prefetch next buffer data. */ @@ -481,8 +483,10 @@ mlx5_tx_burst(void *dpdk_txq, struct rte_mbuf **pkts, uint16_t pkts_n) cs_flags |= MLX5_ETH_WQE_L4_CSUM; } if (unlikely(tso_header_sz > - MLX5_MAX_TSO_HEADER)) + MLX5_MAX_TSO_HEADER)) { + txq->stats.oerrors++; break; + } copy_b = tso_header_sz - pkt_inline_sz; /* First seg must contain all headers. */ assert(copy_b <= length); @@ -843,8 +847,10 @@ mlx5_tx_burst_mpw(void *dpdk_txq, struct rte_mbuf **pkts, uint16_t pkts_n) if (max_elts < segs_n) break; /* Do not bother with large packets MPW cannot handle. */ - if (segs_n > MLX5_MPW_DSEG_MAX) + if (segs_n > MLX5_MPW_DSEG_MAX) { + txq->stats.oerrors++; break; + } max_elts -= segs_n; --pkts_n; /* Should we enable HW CKSUM offload */ @@ -1064,8 +1070,10 @@ mlx5_tx_burst_mpw_inline(void *dpdk_txq, struct rte_mbuf **pkts, if (max_elts < segs_n) break; /* Do not bother with large packets MPW cannot handle. */ - if (segs_n > MLX5_MPW_DSEG_MAX) + if (segs_n > MLX5_MPW_DSEG_MAX) { + txq->stats.oerrors++; break; + } max_elts -= segs_n; --pkts_n; /* @@ -1353,8 +1361,10 @@ mlx5_tx_burst_empw(void *dpdk_txq, struct rte_mbuf **pkts, uint16_t pkts_n) if (max_elts - j < segs_n) break; /* Do not bother with large packets MPW cannot handle. */ - if (segs_n > MLX5_MPW_DSEG_MAX) + if (segs_n > MLX5_MPW_DSEG_MAX) { + txq->stats.oerrors++; break; + } /* Should we enable HW CKSUM offload. */ if (buf->ol_flags & (PKT_TX_IP_CKSUM | PKT_TX_TCP_CKSUM | PKT_TX_UDP_CKSUM)) diff --git a/drivers/net/mlx5/mlx5_rxtx.h b/drivers/net/mlx5/mlx5_rxtx.h index 033e70f25..107ada0f5 100644 --- a/drivers/net/mlx5/mlx5_rxtx.h +++ b/drivers/net/mlx5/mlx5_rxtx.h @@ -75,7 +75,7 @@ struct mlx5_txq_stats { uint64_t opackets; /**< Total of successfully sent packets. */ uint64_t obytes; /**< Total of successfully sent bytes. */ #endif - uint64_t odropped; /**< Total of packets not sent when TX ring full. */ + uint64_t oerrors; /**< Total number of failed transmitted packets. */ }; /* Flow director queue structure. */ diff --git a/drivers/net/mlx5/mlx5_stats.c b/drivers/net/mlx5/mlx5_stats.c index d443e1336..06348c8a1 100644 --- a/drivers/net/mlx5/mlx5_stats.c +++ b/drivers/net/mlx5/mlx5_stats.c @@ -360,13 +360,13 @@ mlx5_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats) tmp.q_opackets[idx] += txq->stats.opackets; tmp.q_obytes[idx] += txq->stats.obytes; #endif - tmp.q_errors[idx] += txq->stats.odropped; + tmp.q_errors[idx] += txq->stats.oerrors; } #ifdef MLX5_PMD_SOFT_COUNTERS tmp.opackets += txq->stats.opackets; tmp.obytes += txq->stats.obytes; #endif - tmp.oerrors += txq->stats.odropped; + tmp.oerrors += txq->stats.oerrors; } #ifndef MLX5_PMD_SOFT_COUNTERS /* FIXME: retrieve and add hardware counters. */ -- 2.12.0