From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-SN1-obe.outbound.protection.outlook.com (mail-sn1nam01on0072.outbound.protection.outlook.com [104.47.32.72]) by dpdk.org (Postfix) with ESMTP id 1AA51FADE for ; Tue, 21 Feb 2017 10:30:24 +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=CXChGGMyGY7Lkaeo3s7sjKPFLGW7QXWlBukzA5I8RRk=; b=RHMEEeEw4wHa20xsJqUbeUsPkD2YBvg9j9T/7gyidC9eLjqd7dfbacxaKHtq4ZDj6v7ZpUxkW+xpLHV/TEFWTnCcdUUeQ1rEGTIhZlQzpalOTidICp/WAmXXuQ9Gif480SBdnIqWIRdzqjV1WjCwO4/YcZDajRCFnmrlOr4JDAU= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Shijith.Thotton@cavium.com; Received: from lio357.in.caveonetworks.com (14.140.2.178) by SN1PR07MB2285.namprd07.prod.outlook.com (10.164.47.155) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.919.13; Tue, 21 Feb 2017 09:30:20 +0000 From: Shijith Thotton To: dev@dpdk.org Cc: Jerin Jacob , Derek Chickles , Venkat Koppula , Mallesham Jatharakonda Date: Tue, 21 Feb 2017 14:56:59 +0530 Message-Id: <1487669225-30091-45-git-send-email-shijith.thotton@caviumnetworks.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1487669225-30091-1-git-send-email-shijith.thotton@caviumnetworks.com> References: <1487669225-30091-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: MA1PR01CA0089.INDPRD01.PROD.OUTLOOK.COM (10.174.56.29) To SN1PR07MB2285.namprd07.prod.outlook.com (10.164.47.155) X-MS-Office365-Filtering-Correlation-Id: 8d8398c5-1a53-45f8-204f-08d45a3c4275 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:SN1PR07MB2285; X-Microsoft-Exchange-Diagnostics: 1; SN1PR07MB2285; 3:N4Pomo8X24mvUgq0lRnhSueym7hK12ex0f4exjFhJk9Z8U7Y7lVXXu8GqXqNq2TDAZc86tbS4wpokaha6rkOtqoZb+CXrNqx/zhUxjMUMzrgYY8/YI2MYqBT9uXqMKlg7o61dMtIyT3DDH8BzqAaqTWIe5fvGmPkW+xluM3JvoTvUL3NuInfDm/d0zdpQEsycCvFFr4STUn6+MYtin/AhNZn58i1lVMF8yYtjmKhv30XQTlHW7BoANFvlCcTyGHwnAsm8XGJ0l5i7ne9onFq4g==; 25:2clmD4VBPDe3oGWS8O5y/XE8DgQmzOczLWT0SRp3LbCMzKIO6UofnVeqmg/KtY1NqNDLdUSB9X+BldpbYpDm1W+ZaxhSoguZAos8jifwJHSla3rW3NnU6D9UbgKl4vrRkB+itkNfR5l/1p0DKrH9HEg4PfVFzonUCfBF3oDywLuVEqiHc0PMTGKNYnQrPwwAWzmBqFylyM7IBQAz9joraTHugGOcE0F1ywobTYwpPOkMYGWkyZeQHVU/uoY/5IR28e0dJkRka5jsdNoigvfXjo+QRhqrz9uzTzd7Dm3uu9hMDy1x+rcZhVqmexcTSWy8wJ5XUY26ilu5cHJr8SQcgjkwbMOo36EH+p/9Xi/dJWQqMhqZC4zA/C59P7FwqUDdCWuOS/gVxdMbyms/caqo68WQkLPSw5JdcoR41977Q/WizW9KOXfqKDTZMWURS12d0j3l6s0qf7n3w7iBiNTP9w== X-Microsoft-Exchange-Diagnostics: 1; SN1PR07MB2285; 31:UsxSXW6tU1U01TBo4Sq8h09A+N2EmcHHnx35f97lmUVTUYoGVF5Mw4XkR4Nbaq5UJrKdyE32N14e+i2R9FELFXfQ35obnIBDE6AGYPXFKOAyfzAb1zvTw+rOks9X8b4Fz5adcC9aHmn1B4wyGIRmBq5hkDfKwSffJ9J8tUe1ZmNZ5CqFbtPfZwBjK5NJM5Nh01Sr0n0Th7d25ixTX64ks76MgYEMwElROEo3O51Rt5qS1V7/X8ZfxL1E2aj8dxwl; 20:UTHY2P9e7nubWpNfx0ex7979SbhJYR+/1duDISAHuvOba+te50edcdmTXXwKkwDWOL6p3f39mk45+sxLL+X4zIYgFFCEvQ7Bw2KK+WKXMTijkPeK5FdX7CTjIQYiMiGAtZCYnMCSXQ3Ucw6QReHabM+ZdlMZP/0lzEUEVDaxsB0irc0DY/Z+DrxZrWkcY6gbkcNr0Mwq03Eaka5D0lwzEDp97344/Ve7+UK1vAqd8kj9EMBHKjGo0BaHOMFX2HVKz7X8uj7sBwlPnsI4JlF9GorntVJdid7KAMIiFwlIX2eODA1neDiWhudqsvmi0e1xcBnCBTXfvLji4+rGWEwj/48cD0eZBvwyG41ELcBqTyfhbJse+0Gx3Iwk3iHJ5GS4sNr+ahFZOW1FxIVdinAO0hjhZYFvBTVoGzfN9JuOCnCCGKzAjIryt5xK9yEw5E+TKsshfGhJHJxumety00kc/1owIo9LGjqvLkC0BkXGpo4qKE7sh2ryojotTS7DlEhWd2bIux0xAMFElYDmg7uixh9k0JUb/S7taI56bmUgjk7KNQM189AR50pH7fSkxpepYMsl9zKxV/wyGc9RGDWjZoYC8pab2FL7o0YYX00vJA0= 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)(3002001)(10201501046)(6041248)(20161123555025)(20161123564025)(20161123562025)(20161123560025)(20161123558025)(6072148); SRVR:SN1PR07MB2285; BCL:0; PCL:0; RULEID:; SRVR:SN1PR07MB2285; X-Microsoft-Exchange-Diagnostics: 1; SN1PR07MB2285; 4:iPDoKKS+HSlc5MKezr4b/OrOTYq7ZiyL309CDE4lzBP2zGy3k8hz9GP1U6WtsL+FiTxhteg9FGrEPKQXcJtuDXrAnqrDCC1fpvV+LzGNar/ZqwfW9MWzpLGCuREQjnqa9861xCLj6f2aYdyGuKev826k5vwXH3R5vxpG9rALuSGX68Y8XksX5Uj0Xwd952V8TVjZzt4toIlB3UGWN209oRXh0AFAx/W6in1j0FZY8CIMpbodiqZUquid0cmP9xk+aIAhay7clZw+O9U/oW68/2mLfv0QAGEZ2S4sDQNyNvHLacean8/C3N+BMpaOP6xYkbQ2AskB632Z2HdCZgfKOgD7vMmf9vyGa9OM/D0UG8Z3UfjxZAmeXwIKVgiGY5B0NJRh3/D4eOxnJA3uDKqNN9Jy09LI4MrxiPG6S1Jq08umTaaXWCEoVLzDrMcG7qStBTSsfSFgap7/TRJlBtBtpsSUdhZ2507QbMJemrq46tF5PtmZ1WdrCBfQiRxEQfRGshRpou2JsONsJMJxH+iBNZl2lAXhXrJjn2m3jfCTMCSnYobvGfU5UrjrnYUdG7zngYcBi74ztDRsYOWkj6j7MzN7TBAtT1wfAprfoTtMaaE= X-Forefront-PRVS: 0225B0D5BC X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(7916002)(39450400003)(39410400002)(39830400002)(189002)(199003)(50226002)(81166006)(42186005)(2361001)(101416001)(81156014)(305945005)(3846002)(6116002)(5009440100003)(8676002)(105586002)(7736002)(53936002)(36756003)(110136004)(106356001)(6506006)(25786008)(38730400002)(2351001)(92566002)(48376002)(6486002)(97736004)(50466002)(5003940100001)(189998001)(68736007)(2906002)(4326007)(33646002)(76176999)(54906002)(5660300001)(6666003)(6916009)(50986999)(2950100002)(6512007)(4720700003)(42882006)(66066001)(47776003)(7099028)(110426004); DIR:OUT; SFP:1101; SCL:1; SRVR:SN1PR07MB2285; H:lio357.in.caveonetworks.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; SN1PR07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JvsN6D0n40fi77dXXnCcRulYO3GKswQ7S9V3PRMwe6bBC+Ln8kWWztP0WlfIsIMDIzoyI6Oypfb4oA==; 24:6bf+IFfSXU10Vl6qNcWmnwWy0y2wlmy+ohoCSE/Oil1qEaz81eIbzBskIncJYbHPOvd4TWhpzVuXSuB0w9V5cqFW12idK4AEWgRQRa4d0UI= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; SN1PR07MB2285; 7:3MuFlYtJDo0JuL46AldXfnw7Nsq7hFNn9tGHk7BcEWR6HaEQBPAny1wNoNVIBzS3jz6KbMrJCTGkL9CL7iaeeuPbFaJEF016xBXesRsZtFWc7LCFPJf4lEFJ6eCEfKEFf4MjPYH2rOM47VJNyE7G+9EfjNv+Nqqd0FDRAm06e6QYe+c2k68v9lshIqriCLf4u1ssGMQ7jKmnWJ05go72GgdEw1JqsNsI5vphaGdhgz5GvgBcNyXc0M3u6itho+Ny/DwI/vPknLveveSCc+KC9hHq7kJLCfBoYRtr39fGn9XWp1Equ3gV6WMln1Mx+RgirJSXspOBccoEQHZl1ZJtww== X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Feb 2017 09:30:20.6685 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR07MB2285 Subject: [dpdk-dev] [PATCH 44/50] 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: Tue, 21 Feb 2017 09:30:24 -0000 Signed-off-by: Shijith Thotton Signed-off-by: Jerin Jacob Signed-off-by: Derek Chickles Signed-off-by: Venkat Koppula 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 5f8f1c0..2bdba09 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) @@ -1391,6 +1439,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 9c587ef..794db32 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 bdcc301..6788da1 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