From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id E1D20A0A02; Tue, 4 May 2021 23:10:59 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A24F641139; Tue, 4 May 2021 23:09:52 +0200 (CEST) Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2084.outbound.protection.outlook.com [40.107.223.84]) by mails.dpdk.org (Postfix) with ESMTP id 29F734110B for ; Tue, 4 May 2021 23:09:51 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kI9bXDN9PZpV2p/5ghKSpLrGctNaj7InxP82S9gJ+sjRE/cY69a6EpqK11FCwVZL52kBaAmkJ0t2j6YG8BwM9Ur1nfMWCQ/rYQdApoQDfIyAdP1FEGDL67Ji9pn3hs5cMS6BU3wcTOVyemz4t+DA/p17H9Uz/LkI1z+GNS85ww/Gy+HG9jeHQn1HkIpHFXNoW0uPuDCjlQcSw3S+dntqutkn9fAn9gHM1/NNTL7ctcX1rTkYwelbW4FnFB1BuOns7SQmUGGek+S3gBCiVrGrCyi8+Ll/UnfUXiLRZDx6khGJGXeDTkWa/S4LNraGmbVME4Gnvz55svvoV5yqkCIE9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=4xTAdjQsZNVJ0rQDGxqgqy46+GpYW9WwqLsZijLQgCM=; b=NQZWXGN5hL06CaHK/L1u2O2uqmIDGel3aNVgpo5KOxY0gs6Uk73WCOKmeVLsS5PTxXtn8sxV62MP8gmDb4kvfErgKQXUbaN1XdT9+pxcf3A0+k8sMSG4dFdhryZLUk3lbYA3geDd7NQIm4iIt8rDEMQZBrVz48rShZ48zBgnE5G9GNLvNuvbxSsXfoRTAqaCRdR3PmdcRT25j29WHtheGEOIXadV+yZBTB5DBlTcL7tLPkTe1gdiZ4YQaKU131zifq2Ul5R0DjVuzEOOfBQ0tcw7ln1DX2EgpLVD8hwBF4I4gu0CQqSap8Yfb9zyiaTFa3UlFFRdXnnHda/7nZ8FBg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.34) smtp.rcpttodomain=monjalon.net smtp.mailfrom=nvidia.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=4xTAdjQsZNVJ0rQDGxqgqy46+GpYW9WwqLsZijLQgCM=; b=gEO/cGbKDClqHDEEFwLwcBgujX6pLInGzm7fiVaFHtGYKzoCs+O9lIKr76LfhC3xduZr9Ff+JcgHxz8Y4QF3p9RuVVrdtNs5xURcJ7Ffwa8Zj9FhdqLnX26g0HVBwbPz0g+rju6HKpEt9zGzx4mcra40uPAwdhHB9w8+9wPUxFNE29fd8ko/e78y/4d0+gHO12chOfnQWZEGOjkGTDxgscNhV2GpZTZQCyIdCYIFmJeMZ77RGdUAVWFBKCtYnGKAVjEXE9qrcC99OA++G4aYSDN+mXtEJQhqWBLsKRriX0Fzt+9SownWkhsmahTf1VojUoFvm1wWZg69S8WSskMOsw== Received: from MWHPR13CA0046.namprd13.prod.outlook.com (2603:10b6:300:95::32) by MWHPR12MB1389.namprd12.prod.outlook.com (2603:10b6:300:13::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4087.41; Tue, 4 May 2021 21:09:48 +0000 Received: from CO1NAM11FT060.eop-nam11.prod.protection.outlook.com (2603:10b6:300:95:cafe::e0) by MWHPR13CA0046.outlook.office365.com (2603:10b6:300:95::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.8 via Frontend Transport; Tue, 4 May 2021 21:09:48 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) smtp.mailfrom=nvidia.com; monjalon.net; dkim=none (message not signed) header.d=none;monjalon.net; dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.112.34 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.34; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.34) by CO1NAM11FT060.mail.protection.outlook.com (10.13.175.132) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4087.27 via Frontend Transport; Tue, 4 May 2021 21:09:47 +0000 Received: from nvidia.com (172.20.145.6) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 4 May 2021 21:09:45 +0000 From: Matan Azrad To: CC: , , , "Thomas Monjalon" Date: Wed, 5 May 2021 00:08:56 +0300 Message-ID: <20210504210857.3398397-15-matan@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210504210857.3398397-1-matan@nvidia.com> References: <20210429154712.2820159-1-matan@nvidia.com> <20210504210857.3398397-1-matan@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [172.20.145.6] X-ClientProxiedBy: HQMAIL111.nvidia.com (172.20.187.18) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 3a1556fd-4987-46e1-a5f9-08d90f40f310 X-MS-TrafficTypeDiagnostic: MWHPR12MB1389: X-LD-Processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:158; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: jXrSV2gxiHdZJFcm+jQsfmwcJfT5wDiqr10EM/wtn2J+s+/En/FF6OjFBaesiWJU4eMXS8Pmnz2p4zy9nOjE25wllArV1yZxXOJ3q17KdQDQTcTUFONTWTuIS5Lx9vFjYbxglwkTLn+a5FEqVzB1pvZFcXVSlT/6sKc3Yj0Wkju2DJ1R6FHUAesNrj1lswlirFhWHVlsqh0eUJTsX6RmtbAhog23+b5XXaV0S7xM25h6ttOjbcoS3XDOjG0RoouAoCvcrA7tG7voRVnXTBr8rgyymCbCEV6AyXCYgAWe0p0T4OeAn/TfKBi6vGsxGAQDID8cgIy0zPWRpE5+wfKUrhpq5FSr0DAKZdhL0ncVEK4mpzbwkOGBhDBAElr1NgGW6diPsxapk5dRSwHFyOTMQtws/wdjGT6AAUz1SlRyojIwdzdvEzERTiXjKbKb+XM55KGK6m+qdFdTAVho5wINbrDQIeUvqXl0gTp1+sVVLuTDm0gPhl+wXjmTuiWzuAxSu00qqeboJr9G2QPhQdzY1obauoQ1IePBSQQrzanuT9dg7LZTSkCtud5YTY5Jqofpid7ruMoPednXYHBb/H6rNkQk+h9V9PRmeGxl98t6PNqplmiL6E6XOTHpUD++tO+80TsIQsNaMONpv427TEo0XueMKqSthaCrt2kL3/kixfY= X-Forefront-Antispam-Report: CIP:216.228.112.34; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid03.nvidia.com; CAT:NONE; SFS:(4636009)(396003)(136003)(39860400002)(346002)(376002)(46966006)(36840700001)(2616005)(47076005)(86362001)(356005)(6286002)(336012)(54906003)(82310400003)(6916009)(6666004)(8676002)(8936002)(55016002)(7696005)(70206006)(82740400003)(1076003)(83380400001)(316002)(36906005)(478600001)(5660300002)(36756003)(4326008)(7636003)(26005)(16526019)(426003)(36860700001)(2906002)(186003)(70586007); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 May 2021 21:09:47.8874 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3a1556fd-4987-46e1-a5f9-08d90f40f310 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.112.34]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT060.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR12MB1389 Subject: [dpdk-dev] [PATCH v3 14/15] crypto/mlx5: add statistic get and reset operations X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 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: Suanming Mou This commit adds mlx5 crypto statistic get and reset operations. Signed-off-by: Suanming Mou Signed-off-by: Matan Azrad --- drivers/crypto/mlx5/mlx5_crypto.c | 39 ++++++++++++++++++++++++++++--- 1 file changed, 36 insertions(+), 3 deletions(-) diff --git a/drivers/crypto/mlx5/mlx5_crypto.c b/drivers/crypto/mlx5/mlx5_crypto.c index fd0afb9fb2..896ca60866 100644 --- a/drivers/crypto/mlx5/mlx5_crypto.c +++ b/drivers/crypto/mlx5/mlx5_crypto.c @@ -437,11 +437,14 @@ mlx5_crypto_enqueue_burst(void *queue_pair, struct rte_crypto_op **ops, do { op = *ops++; umr = RTE_PTR_ADD(qp->umem_buf, priv->wqe_set_size * qp->pi); - if (unlikely(mlx5_crypto_wqe_set(priv, qp, op, umr) == 0)) + if (unlikely(mlx5_crypto_wqe_set(priv, qp, op, umr) == 0)) { + qp->stats.enqueue_err_count++; break; + } qp->ops[qp->pi] = op; qp->pi = (qp->pi + 1) & mask; } while (--remain); + qp->stats.enqueued_count += nb_ops; rte_io_wmb(); qp->db_rec[MLX5_SND_DBR] = rte_cpu_to_be_32(qp->db_pi); rte_wmb(); @@ -458,6 +461,7 @@ mlx5_crypto_cqe_err_handle(struct mlx5_crypto_qp *qp, struct rte_crypto_op *op) &qp->cq_obj.cqes[idx]; op->status = RTE_CRYPTO_OP_STATUS_ERROR; + qp->stats.dequeue_err_count++; DRV_LOG(ERR, "CQE ERR:%x.\n", rte_be_to_cpu_32(cqe->syndrome)); } @@ -497,6 +501,7 @@ mlx5_crypto_dequeue_burst(void *queue_pair, struct rte_crypto_op **ops, if (likely(i != 0)) { rte_io_wmb(); qp->cq_obj.db_rec[0] = rte_cpu_to_be_32(qp->ci); + qp->stats.dequeued_count += i; } return i; } @@ -655,14 +660,42 @@ mlx5_crypto_queue_pair_setup(struct rte_cryptodev *dev, uint16_t qp_id, return -1; } +static void +mlx5_crypto_stats_get(struct rte_cryptodev *dev, + struct rte_cryptodev_stats *stats) +{ + int qp_id; + + for (qp_id = 0; qp_id < dev->data->nb_queue_pairs; qp_id++) { + struct mlx5_crypto_qp *qp = dev->data->queue_pairs[qp_id]; + + stats->enqueued_count += qp->stats.enqueued_count; + stats->dequeued_count += qp->stats.dequeued_count; + stats->enqueue_err_count += qp->stats.enqueue_err_count; + stats->dequeue_err_count += qp->stats.dequeue_err_count; + } +} + +static void +mlx5_crypto_stats_reset(struct rte_cryptodev *dev) +{ + int qp_id; + + for (qp_id = 0; qp_id < dev->data->nb_queue_pairs; qp_id++) { + struct mlx5_crypto_qp *qp = dev->data->queue_pairs[qp_id]; + + memset(&qp->stats, 0, sizeof(qp->stats)); + } +} + static struct rte_cryptodev_ops mlx5_crypto_ops = { .dev_configure = mlx5_crypto_dev_configure, .dev_start = mlx5_crypto_dev_start, .dev_stop = mlx5_crypto_dev_stop, .dev_close = mlx5_crypto_dev_close, .dev_infos_get = mlx5_crypto_dev_infos_get, - .stats_get = NULL, - .stats_reset = NULL, + .stats_get = mlx5_crypto_stats_get, + .stats_reset = mlx5_crypto_stats_reset, .queue_pair_setup = mlx5_crypto_queue_pair_setup, .queue_pair_release = mlx5_crypto_queue_pair_release, .sym_session_get_size = mlx5_crypto_sym_session_get_size, -- 2.25.1