From patchwork Mon Oct 22 14:57:48 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gagandeep Singh X-Patchwork-Id: 47185 X-Patchwork-Delegate: gakhil@marvell.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 37CB81B444; Mon, 22 Oct 2018 16:58:03 +0200 (CEST) Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-eopbgr20051.outbound.protection.outlook.com [40.107.2.51]) by dpdk.org (Postfix) with ESMTP id C8C7B1B419 for ; Mon, 22 Oct 2018 16:57:50 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=mfH6KZh5eniC4ZfCOj9f1yCvMuuvVNn9wOkKfWUgX+s=; b=O1gEI2lVyLKJGrKOPKq1WS8+uB52KSj4nJ/zi2VNh8ZHH2XzuwBM7uWymyANvXcvvDeCT3/BcLHajxQI0ZHNH0AbEz5HrpV0ofJGPYLc9KxVld/PS7O/Zq+NMn+9+wImrguh+2o9V2o/oF7N+5hyBMJ6FkuY6ug8qStiWDQ4kHQ= Received: from HE1PR04MB1530.eurprd04.prod.outlook.com (10.164.48.20) by HE1PR04MB1305.eurprd04.prod.outlook.com (10.162.249.27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1250.30; Mon, 22 Oct 2018 14:57:48 +0000 Received: from HE1PR04MB1530.eurprd04.prod.outlook.com ([fe80::95cd:198:d5c5:59a4]) by HE1PR04MB1530.eurprd04.prod.outlook.com ([fe80::95cd:198:d5c5:59a4%5]) with mapi id 15.20.1250.028; Mon, 22 Oct 2018 14:57:48 +0000 From: Gagandeep Singh To: "dev@dpdk.org" , Akhil Goyal CC: Hemant Agrawal , Gagandeep Singh Thread-Topic: [PATCH v5 12/15] crypto/caam_jr: add statistics ops Thread-Index: AQHUaheZXSJ/bORa5UOaamv95meWTA== Date: Mon, 22 Oct 2018 14:57:48 +0000 Message-ID: <20181022145644.29277-13-g.singh@nxp.com> References: <20181022141657.4727-1-g.singh@nxp.com> <20181022145644.29277-1-g.singh@nxp.com> In-Reply-To: <20181022145644.29277-1-g.singh@nxp.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: BM1PR0101CA0067.INDPRD01.PROD.OUTLOOK.COM (2603:1096:b00:19::29) To HE1PR04MB1530.eurprd04.prod.outlook.com (2a01:111:e400:59a8::20) authentication-results: spf=none (sender IP is ) smtp.mailfrom=G.Singh@nxp.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [14.142.187.166] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; HE1PR04MB1305; 6:NbhYUNosFj4rkTe+mCS4npMPhRoHredncQxyxAePl3q1ASY7hGG9gcQIpMqxPYUTeZn8BD5vQUZzeRss+QWSGtK2E/k90byQFIA/fXZp+n17TlfVdbYqCP8DaaKiiXiGnWDZEl7pOsZlaBKvJORLH0xhY0HC04zEmQw0MnHwOVr5PhsOJ6p8FE0Mt3eXbwQ6s9K+f4h5PuEmyDbcCeKis6lsiXxQIAj9qoc1GuXU/wWIqU4OirNiSgJdRI0tHv1ZNOTdz79n+matv7MwIBaH1oCsSLnYSIq6hqpqunr1tLxxZwFIOEJbdh0D/13iesDRjzALDozGeJH5s39hNpGk9BdueSkssIYa2f1HMV7Qr29FNHWrwMiibAWHrcLMKB5+oyEq/GLSTILuHBMEI7uRts99PLHKOiincIbl5cw9Iw/UXFzFikGlps19H/6xb1QQEqZNBE/EfjVL1+V1ogay9g==; 5:i3lfkLNXbfb5b2NuZ41evYl4BOI0FyuZvVUNGJyexkWBw8UmVoiUpWNNDo75GUIVAu/HmO9wAIkIEYZGl7NXQxLqywcW9MODs1e/rfleMNjugR7O+NjeG9UCi5aG5ySWZUGkRJQPayII8gVpir4tSTZgKNN4xd0QuYhp0vzfG0A=; 7:4nwniwjlaeFZJfSELfKtWNnov3xPpi2p5vJr71d2BWkpoct234tcaD31KHPAg3Un22HKZnLBs6x2A963ZisqHmiO/2a8xXEn1/DZoZRsHWqQ/bsG34Z7AutFWMfSLBjg0v0sXJ1rbbsabB2W14UY2rwEt+TPZ6XduTpxfAXf4N8eqLMR7IwLGq2Y8cFGZ+qSUZQ8b3ALKnxJU5ib43kusYZT0YLSigrT1y+c+jIywSK0EcwXzq/MMP9DKsN0+MDB x-ms-office365-filtering-correlation-id: 2972c4fa-c994-43aa-d18e-08d6382ebb4b x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(5600074)(711020)(4618075)(4534185)(7168020)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060)(7193020); SRVR:HE1PR04MB1305; x-ms-traffictypediagnostic: HE1PR04MB1305: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(185117386973197); x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(93006095)(93001095)(10201501046)(3002001)(3231355)(944501410)(52105095)(6055026)(148016)(149066)(150057)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123562045)(20161123564045)(20161123560045)(201708071742011)(7699051)(76991095); SRVR:HE1PR04MB1305; BCL:0; PCL:0; RULEID:; SRVR:HE1PR04MB1305; x-forefront-prvs: 08331F819E x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(376002)(39860400002)(396003)(136003)(366004)(346002)(199004)(189003)(8676002)(256004)(81156014)(81166006)(11346002)(476003)(99286004)(446003)(316002)(52116002)(2616005)(486006)(106356001)(8936002)(105586002)(186003)(71200400001)(5250100002)(78486010)(3846002)(2501003)(71190400001)(25786009)(2900100001)(305945005)(7736002)(97736004)(478600001)(4326008)(2906002)(72206003)(6636002)(53936002)(14454004)(66066001)(6512007)(5660300001)(6116002)(1076002)(6436002)(6486002)(36756003)(14444005)(54906003)(6506007)(76176011)(55236004)(386003)(68736007)(26005)(86362001)(102836004)(110136005); DIR:OUT; SFP:1101; SCL:1; SRVR:HE1PR04MB1305; H:HE1PR04MB1530.eurprd04.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: KYtoPx2tu3RuQHGcBI266m3R7fKu79U9XUSOAuetaErnj3SVmHZeHBPNUGQzFwyTCp6TzqlFS7aK+I0VdBCmIJMkkcf7Mx/Eo2EbFr1nHJ18M5jvEWGc/I8jLulujaX1MoipM/8jNl1s2qgdUqinExkkAf/yx/zQxeckLpH1FcBNlra/qqVQ7b3gEyAAvd0a7GKQYYOiH7F3nXrit2KHjX/X+5dT1aw7OcQIwWdKRzqboVHkBfYT8UZXZc1pyQU8CdMSPFp2JmSnmlkZ6Mr3JisbkC4lnenCmlz7iR5qRfrNwukMkQY8aUHrH9rQolK0BIHGv346BleUsI6nNUta6HVF5RnM/P0BLCI+i41MvbI= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2972c4fa-c994-43aa-d18e-08d6382ebb4b X-MS-Exchange-CrossTenant-originalarrivaltime: 22 Oct 2018 14:57:48.6897 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR04MB1305 Subject: [dpdk-dev] [PATCH v5 12/15] crypto/caam_jr: add statistics ops 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Hemant Agrawal This patch adds the following statistics operations: - stats_get - stats_reset Signed-off-by: Gagandeep Singh Signed-off-by: Hemant Agrawal Acked-by: Akhil Goyal --- drivers/crypto/caam_jr/caam_jr.c | 54 ++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/drivers/crypto/caam_jr/caam_jr.c b/drivers/crypto/caam_jr/caam_jr.c index 0d3a49145..c89d76dab 100644 --- a/drivers/crypto/caam_jr/caam_jr.c +++ b/drivers/crypto/caam_jr/caam_jr.c @@ -103,6 +103,58 @@ caam_jr_alloc_ctx(struct caam_jr_session *ses) return ctx; } +static +void caam_jr_stats_get(struct rte_cryptodev *dev, + struct rte_cryptodev_stats *stats) +{ + struct caam_jr_qp **qp = (struct caam_jr_qp **) + dev->data->queue_pairs; + int i; + + PMD_INIT_FUNC_TRACE(); + if (stats == NULL) { + CAAM_JR_ERR("Invalid stats ptr NULL"); + return; + } + for (i = 0; i < dev->data->nb_queue_pairs; i++) { + if (qp[i] == NULL) { + CAAM_JR_WARN("Uninitialised queue pair"); + continue; + } + + stats->enqueued_count += qp[i]->tx_pkts; + stats->dequeued_count += qp[i]->rx_pkts; + stats->enqueue_err_count += qp[i]->tx_errs; + stats->dequeue_err_count += qp[i]->rx_errs; + CAAM_JR_INFO("extra stats:\n\tRX Poll ERR = %" PRIu64 + "\n\tTX Ring Full = %" PRIu64, + qp[i]->rx_poll_err, + qp[i]->tx_ring_full); + } +} + +static +void caam_jr_stats_reset(struct rte_cryptodev *dev) +{ + int i; + struct caam_jr_qp **qp = (struct caam_jr_qp **) + (dev->data->queue_pairs); + + PMD_INIT_FUNC_TRACE(); + for (i = 0; i < dev->data->nb_queue_pairs; i++) { + if (qp[i] == NULL) { + CAAM_JR_WARN("Uninitialised queue pair"); + continue; + } + qp[i]->rx_pkts = 0; + qp[i]->rx_errs = 0; + qp[i]->rx_poll_err = 0; + qp[i]->tx_pkts = 0; + qp[i]->tx_errs = 0; + qp[i]->tx_ring_full = 0; + } +} + static inline int is_cipher_only(struct caam_jr_session *ses) { @@ -1695,6 +1747,8 @@ static struct rte_cryptodev_ops caam_jr_ops = { .dev_stop = caam_jr_dev_stop, .dev_close = caam_jr_dev_close, .dev_infos_get = caam_jr_dev_infos_get, + .stats_get = caam_jr_stats_get, + .stats_reset = caam_jr_stats_reset, .queue_pair_setup = caam_jr_queue_pair_setup, .queue_pair_release = caam_jr_queue_pair_release, .queue_pair_count = caam_jr_queue_pair_count,