From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-CO1-obe.outbound.protection.outlook.com (mail-co1nam03on0076.outbound.protection.outlook.com [104.47.40.76]) by dpdk.org (Postfix) with ESMTP id 17919F955 for ; Thu, 2 Mar 2017 12:40:03 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=0GUgYj7Hd4XJCo/x4gIofKflEziYrLgbCtBCi0DQg8w=; b=Jh6sRqfhbNVnR9Q/y7EiwAkgectvcNTvRk52ThaJTGk31MD/ymjCDRajY8w0V0N8J/NZs3oo0HO3GNY4c7Gc2y1W7zG/bDY5UDlfcdtgvARZgMTA6EHxstRRuNNsid/dCDVdmRvbTwAZv0LaSMzveY4Od6ZaS4gXt8w1M9PisZE= Authentication-Results: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=caviumnetworks.com; Received: from lio357.in.caveonetworks.com (14.140.2.178) by CY1PR07MB2277.namprd07.prod.outlook.com (10.164.112.155) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.947.12; Thu, 2 Mar 2017 11:39:59 +0000 From: Shijith Thotton To: ferruh.yigit@intel.com Cc: dev@dpdk.org, Jerin Jacob , Derek Chickles , Venkat Koppula , Srisivasubramanian S , Mallesham Jatharakonda Date: Thu, 2 Mar 2017 17:02:45 +0530 Message-Id: <1488454371-3342-41-git-send-email-shijith.thotton@caviumnetworks.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1488454371-3342-1-git-send-email-shijith.thotton@caviumnetworks.com> References: <1487669225-30091-1-git-send-email-shijith.thotton@caviumnetworks.com> <1488454371-3342-1-git-send-email-shijith.thotton@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [14.140.2.178] X-ClientProxiedBy: BM1PR01CA0021.INDPRD01.PROD.OUTLOOK.COM (10.163.198.156) To CY1PR07MB2277.namprd07.prod.outlook.com (10.164.112.155) X-MS-Office365-Filtering-Correlation-Id: 1ae05e62-4ca0-48c4-2f32-08d46160dd83 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:CY1PR07MB2277; X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2277; 3:WZNq7ZdmtEek/pp81G+twhwcR5TRvz8RglQUqgmmoXpd/lzlUXOrLgedBSN8lQUYPJdbBCn5I9upCS1VYEIxFs3+8cQ/U7bKtTdA2u3Ku43oMqy6eAu2fc7qNkjrMqhBzdWreu58mzyl/BY79ZpHjQu+OdlnL2YU2VKRZOinJOlIWh7z5qNcduR3r4635e2I7MQBk8Qyfw03DOzUP4ZqBLsMrWE5q+dnfOORUqc8Lzbj7zJZ0jZnM8DesX7wG5TnVbYh++6AezApAQ5yDMRoMw==; 25:ld3BhKMk9Yd2iH6qYfUlpVMolStyOE5WJftSEKTQlsQ6VX52pAhtM5GzlRsk+BW3nm3NDkYG36JeEUf5fn4NKJvYVCD9fB/nPjzgFoppERy9SePoNIG1SiFAbJX/5BbDJ7GpPrlgHK+XnYR5/+6oFaGyvg/9qVFSkeO8iMO4enGB7EjKrDKP5zMVizb7CGt0hEk/Yj2z5Cw1FA9eZfvF1J8mxWxb/sRELVEDS7W2JNo6RMd5oQVfMD7hOk8gP0WTGoAppcMNHzmwRpBj60UK3okzuWIyiFtOUenK1+FO7rMYmOZ7SfYdjikZeQH4UtcbwRZdAlAqbt+cDzDCRdZQFYfa5FyPjUkRmOv/MO5LNNirwr3UVQ0CWUPZpoan+gFXWdJblHTbXgcrFSqokvKw45tdvIl8spcRt3nwFr8RVMOTnimkMa8oQYPkNeSm1aYK8jqIX7o/ii6AxfAhEPKbGw== X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2277; 31:fzoY+0GyNGOCtuzE+F3Z8NGFvgGB/+SKVqi69iUAQzz5vh/jA7jb8cPG6TqxHfzJbKO6JxbSF12OGx1IpXaZrTOa2AidLb29UjmDEd4rNdvjz0j0lKhEg85Jn6OdBIH620AD5/CHUE84Z2BdYtqW5o+PWWAbvf4DLqAaDyQLf+7OTNKvY0tR+4ZeUxEOZdHFi84hzmYaD4c7fp8sAxrcWu3p40J4VMMNwN43i1f/cc0=; 20:E4mqpzehv5gM1TSWn4usyg0hiHFv+wz+EXX5eFXEjRqCkAo0lQCIDwgeqLSNJbigV08J8fDjXvpOgrakQktZ+mQwDz3PnJ5J0hFeqn1fGWTMM5wQGGxNbERxjAUy2+CD8jyIEig07/18aXgM7JYhaaX/hzjPXh3Bi6nmEbcmEDOIr8Eaz8Ld8+ihI4OYNbmLeVAxisySLuyM+I6XlGmBpk+YahkoxfYnF1m64kcnACTQSS1m4VOd9YXotg+tgtlblGeI2VAqHadgGos04N7OIcR5Upe9loDfhbK21lwmwX/t5tJdLzvGZCQWVThytZDm049s4gXZsnH4wov/aznzHiSvdXanIXBHtmTlIMcBHL8LVY99RXSHa5HTq1Pu/e8DZmVW5AeLFkR7m6nxyd9dKts/lFZc5L7cE4K5IVKiQh0DHJtleMHae3tFK+EeX28v6BWM07rGMHgAMr5rNMivAY8oBTX/Pn03JjbKVWDcdu7ym4T14iu1+QXhrPoqd85XCpyXNHWNhwY1yXuHjUwanjWkzePmi5simOUSQ3yI1B6dcczEv05K5aG/mWSWDao0OpZbZrCMdme78qOvB5wIO2WEqnDBNnHbW1ti7TjzK7Y= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040375)(601004)(2401047)(5005006)(8121501046)(10201501046)(3002001)(6041248)(20161123558025)(20161123555025)(20161123560025)(20161123564025)(20161123562025)(6072148); SRVR:CY1PR07MB2277; BCL:0; PCL:0; RULEID:; SRVR:CY1PR07MB2277; X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2277; 4:3TcEwjN9kiJGLKB6YNs5Gfzvb4CtpQJG3gWr2WORgpQBWIO6d7aMUdYhLTMZew2mQl430vY7zxywuUj19Je+moV4lUqskPhBKSgPd0etS94PJ3Ne+P3ATeRQo5sO/6nTU+qsAfxBNgIUaYVjv92a5CxWa81hxXbEjXqZT1KQVBhUD6PqAKbLymDa2SkPxNbXTxp852psPlKTZFUFcaWsLiAdkvL4bi/lMyrQSbvfV2dFy1ezD7Q5CNe9miuq9TRJd5sOh+Cg8THS05XkkXXKj6bmvH0qHAiRIj13gGlqP1lrRSwPnH4KGQ6xm04jPbOTSi5JvnNmsj+CRF+j2p9O05ThoMTYNOgB2butODhse5lcqiayl6Baj3NgHtOfcVKJ3BQyOs0xtZ5uWLIfmBuX/T54a2+hEoU6p+a3/q291tW6qs1QdLs5HnbSyZr4XES9Zr4xH65ajfTWY+LdkC87aArBOZbuAXEKg7opnAuINPcHijJeVhUdYLsmCOhRySCufYYAYiDm28xmh8AlXTriFrqyJUtviQybfbwbotM4QwoP99ckkYN7gTEdryZrVvlz23yWCrLC6tRzcIRP6/Pzcz6OAfRwo4rs3gtyWzzpV+k= X-Forefront-PRVS: 023495660C X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(7916002)(39450400003)(2950100002)(6916009)(42882006)(5660300001)(92566002)(4720700003)(33646002)(48376002)(50226002)(6666003)(2906002)(5003940100001)(36756003)(8676002)(50466002)(81166006)(110136004)(38730400002)(4326008)(305945005)(2361001)(53936002)(2351001)(25786008)(6512007)(189998001)(54906002)(47776003)(6506006)(6486002)(66066001)(6116002)(3846002)(50986999)(76176999)(5009440100003)(42186005)(7736002)(7099028)(110426004); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR07MB2277; H:lio357.in.caveonetworks.com; FPR:; SPF:None; MLV:nov; PTR:InfoNoRecords; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY1PR07MB2277; 23:9g4wPrEMRKwWKZN2L6eEto0+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j3tsRqEiLCqYSGO8KXphgI7pqi+H+SwH9?= =?us-ascii?Q?nHjfD764vs9wWHsa6I6i7BzF83oDmgTTYN1ewkx61eXAgTPCdgfBF8p3ab/l?= =?us-ascii?Q?/NKb7WER2VmT2q4LRjk8aWLtxcF+C9CHrYBukppwWFW4Jm0rqD45upg8ZUgd?= =?us-ascii?Q?mtexqSxQaldxEXdJLx2BRW6farOnynSgPImZZhVE0/9cKqupg=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2277; 6:E+QWij/PUqrY/+RtdXMYNafFT8yw0eua2ahuinHkk0uvwUYLN17CqSxfW6xVCgJ1qe0n5XmSyxI82DIscCC+m0w+tKSr5dqpuZ1bdeT00ors46hBrPDU6lFgaQwndbuP+Yv80jL0c8LtVoNJii1TK6s6kdVV2IaaeKz+jrKGwQTxQsMgNKliSzyaGK8DARX3SD3slrvnS04kZVINqQdY33Jy4Athjfr5RFK3peMdCJ4AwY0k9onNK9HN4hjpfQSTYMi7UA1AYzrSCe0c1UhC1EwOL51/bpJw4zEWHHEDWAPGVZ7FckQV5kI3zHpIh/ojXg09HjTimWeWJH+VKfZzKMOrO+frmpEFkVYVCvSVkwfShZJKdu1j/i8DXanX5Xka7TsYgTDBhQi0SIs0sSTYSw==; 5:D3hZld+e4W0cjTnR6z/2mx3InbcFnyT2/iWvFx27weLXK8DNHniZcUK8jYGRZt8qgscs1ZZBS0m/kJhvsFt/1crm3YLFwH0mm5N/5QhIOOJJa9IGT4UkBzcv7KPJEvtXL/ZSCaQDGQyQEHFKVnfPxA==; 24:SNCfAH2qwv4oJBG5jJwQpvtA9Vz503/sJmNWLdFDxiAVKFhS6nYxGX9tEwgikw5jWVSf0RyPwXzm29ldDhTYRwiedoXWq7MpKaToNjbzA5E= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2277; 7:6NqUP8ZgOvq21zfoAXpT7PTl5BeOm8ni4yk1XMIA/jUmcEcr8ZcVTugJSUPTpv/YRXdG6B6FM74oNX9V46kP5eDumLpmoWerHJRPAFcjZ38Lp+EeMIztxNj5BCoKt5Jj3S0L4UkJH9veJqHGM9g+30q/V9C311KEJUlV5aM0OikKkfaNKGw1fZSl3x//sUfrG5idcqVV5LCfUmduuTGGGGfshLhpYSZyiyLRLH3qOrltOT97qaZ27v0gz2IZOyAautogEL5N7gajqtmM/maV5dGkDnw4M+3D9Loiw2m41DPu2vglpBgcmmnRAsgJ+OjVtcDkJvfAmKz/DzGgTSiqFw== X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Mar 2017 11:39:59.6104 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR07MB2277 Subject: [dpdk-dev] [PATCH v2 40/46] net/liquidio: add support for Rx stats X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Mar 2017 11:40:04 -0000 Signed-off-by: Shijith Thotton Signed-off-by: Jerin Jacob Signed-off-by: Derek Chickles Signed-off-by: Venkat Koppula Signed-off-by: Srisivasubramanian S Signed-off-by: Mallesham Jatharakonda --- drivers/net/liquidio/lio_ethdev.c | 50 +++++++++++++++++++++++++++++++++++++++ drivers/net/liquidio/lio_rxtx.c | 10 +++++++- drivers/net/liquidio/lio_struct.h | 34 ++++++++++++++++++++++++++ 3 files changed, 93 insertions(+), 1 deletion(-) diff --git a/drivers/net/liquidio/lio_ethdev.c b/drivers/net/liquidio/lio_ethdev.c index eb8e921..794ec78 100644 --- a/drivers/net/liquidio/lio_ethdev.c +++ b/drivers/net/liquidio/lio_ethdev.c @@ -117,6 +117,54 @@ return 0; } +/* Retrieve the device statistics (# packets in/out, # bytes in/out, etc */ +static void +lio_dev_stats_get(struct rte_eth_dev *eth_dev, + struct rte_eth_stats *stats) +{ + struct lio_device *lio_dev = LIO_DEV(eth_dev); + struct lio_droq_stats *oq_stats; + struct lio_droq *droq; + uint64_t bytes = 0; + uint64_t pkts = 0; + uint64_t drop = 0; + int i, oq_no; + + for (i = 0; i < eth_dev->data->nb_rx_queues; i++) { + oq_no = lio_dev->linfo.rxpciq[i].s.q_no; + droq = lio_dev->droq[oq_no]; + if (droq != NULL) { + oq_stats = &droq->stats; + pkts += oq_stats->rx_pkts_received; + drop += (oq_stats->rx_dropped + + oq_stats->dropped_toomany + + oq_stats->dropped_nomem); + bytes += oq_stats->rx_bytes_received; + } + } + stats->ibytes = bytes; + stats->ipackets = pkts; + stats->ierrors = drop; +} + +static void +lio_dev_stats_reset(struct rte_eth_dev *eth_dev) +{ + struct lio_device *lio_dev = LIO_DEV(eth_dev); + struct lio_droq_stats *oq_stats; + struct lio_droq *droq; + int i, oq_no; + + for (i = 0; i < eth_dev->data->nb_rx_queues; i++) { + oq_no = lio_dev->linfo.rxpciq[i].s.q_no; + droq = lio_dev->droq[oq_no]; + if (droq != NULL) { + oq_stats = &droq->stats; + memset(oq_stats, 0, sizeof(struct lio_droq_stats)); + } + } +} + static void lio_dev_info_get(struct rte_eth_dev *eth_dev, struct rte_eth_dev_info *devinfo) @@ -1390,6 +1438,8 @@ static int lio_dev_configure(struct rte_eth_dev *eth_dev) .allmulticast_enable = lio_dev_allmulticast_enable, .allmulticast_disable = lio_dev_allmulticast_disable, .link_update = lio_dev_link_update, + .stats_get = lio_dev_stats_get, + .stats_reset = lio_dev_stats_reset, .dev_infos_get = lio_dev_info_get, .mtu_set = lio_dev_change_vf_mtu, .rx_queue_setup = lio_dev_rx_queue_setup, diff --git a/drivers/net/liquidio/lio_rxtx.c b/drivers/net/liquidio/lio_rxtx.c index f105457..adbd990 100644 --- a/drivers/net/liquidio/lio_rxtx.c +++ b/drivers/net/liquidio/lio_rxtx.c @@ -115,6 +115,7 @@ buf = lio_recv_buffer_alloc(lio_dev, droq->q_no); if (buf == NULL) { lio_dev_err(lio_dev, "buffer alloc failed\n"); + droq->stats.rx_alloc_failure++; lio_droq_destroy_ring_buffers(droq); return -ENOMEM; } @@ -410,8 +411,10 @@ /* If a buffer could not be allocated, no point in * continuing */ - if (buf == NULL) + if (buf == NULL) { + droq->stats.rx_alloc_failure++; break; + } droq->recv_buf_list[droq->refill_idx].buffer = buf; } @@ -629,6 +632,11 @@ info->length = 0; info->rh.rh64 = 0; + droq->stats.pkts_received++; + droq->stats.rx_pkts_received += data_pkts; + droq->stats.rx_bytes_received += data_total_len; + droq->stats.bytes_received += total_len; + return data_pkts; } diff --git a/drivers/net/liquidio/lio_struct.h b/drivers/net/liquidio/lio_struct.h index c2293f7..50d5e86 100644 --- a/drivers/net/liquidio/lio_struct.h +++ b/drivers/net/liquidio/lio_struct.h @@ -56,6 +56,37 @@ struct lio_version { uint16_t reserved; }; +/** Output Queue statistics. Each output queue has four stats fields. */ +struct lio_droq_stats { + /** Number of packets received in this queue. */ + uint64_t pkts_received; + + /** Bytes received by this queue. */ + uint64_t bytes_received; + + /** Packets dropped due to no memory available. */ + uint64_t dropped_nomem; + + /** Packets dropped due to large number of pkts to process. */ + uint64_t dropped_toomany; + + /** Number of packets sent to stack from this queue. */ + uint64_t rx_pkts_received; + + /** Number of Bytes sent to stack from this queue. */ + uint64_t rx_bytes_received; + + /** Num of Packets dropped due to receive path failures. */ + uint64_t rx_dropped; + + /** Num of vxlan packets received; */ + uint64_t rx_vxlan; + + /** Num of failures of lio_recv_buffer_alloc() */ + uint64_t rx_alloc_failure; + +}; + /** The Descriptor Ring Output Queue structure. * This structure has all the information required to implement a * DROQ. @@ -117,6 +148,9 @@ struct lio_droq { */ void *pkts_sent_reg; + /** Statistics for this DROQ. */ + struct lio_droq_stats stats; + /** DMA mapped address of the DROQ descriptor ring. */ size_t desc_ring_dma; -- 1.8.3.1