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 1F03AA0548; Sun, 9 May 2021 18:06:58 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id F12494115D; Sun, 9 May 2021 18:05:54 +0200 (CEST) Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2058.outbound.protection.outlook.com [40.107.92.58]) by mails.dpdk.org (Postfix) with ESMTP id 795B74113D for ; Sun, 9 May 2021 18:05:50 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LKRRFBhd61fSVFgPIjBWnpbG1WT0ODxxIITUQwjqfuqQvgDYZHETiR+BSah6g6M/STUzDaKdxfDh6GRGcR4W24tVepHrQg4nuBoStamX3bJTVQ7D5gQyXZnSiDCGqzSBQ76Np8IYmECJoDTspTrKqJF2bVfJwJ38GMGNkpahiZXyhAMfsEOzO+LHrGb5fTuwSv0K8uuDyTm8VubZPMpqq97GH40bAg7+NLRW/eA9uN3DA/KKPiCNvbZ1oXklxYvI/dKw09aVNnrvqIUcdKHllVziqepaNrzL5yIf1ykQW4ZTqyEjJNkRynbcbZbVakULFSMdO17qt43mq/0ITMadfw== 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=B2BTarki8Sx2nKb0TGZxmiULRvSPeCyg6WJp+hAUCKw=; b=e+K+VVKpHtdTzxW/qchRD7dA2K7QRrjTrJ9IZydfkZSvTYJPJ3B1Xpn7WieIzQPYaivMM0dKu82Vq/zVd2p9Mf6cAHKRIP6bYi2+FAewMfHrLmtE33Hjo6HiJ17obvM5BKezImKtFQ63Y5KI8TqlCnIXBZTpSXGUDMXv7C24Kaz64wpwBIUGq4OUqcgSqP9tHXx6YkPDMDga/rNOq5pVL5G5j836c7of8njqFqupKGvkoSSVHOup9szdXwvuQqN3ibz9e3eo8EADH02eYCtWD/Lr/dRA6DIliUdawEtSVRtrxbv4WhGQPPv96/1BlnN62zHgmUGnLX1b2N3xqrIAWg== 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=B2BTarki8Sx2nKb0TGZxmiULRvSPeCyg6WJp+hAUCKw=; b=UuzhAuBv9nYVW65NnXnM6GBdSRvta/JsOEtdwVwb/bZGPOQc7j/T72hO1g1BP8RJA2uZOxgjJ+Ib0ncwJCpYeY6LYKKpvtA6hvfZH3hgK1X6Jp37VbULS9LLuO7Gio9cl/hfLQX92EAS5oXztwg68EtzPz/4i7LXg9rPnDBSNSLV4/Q8wcHxlI2KoF8OB4RIpdmocoSovw43xJpk8R5l50B8WyBjnOjZN767L18GKCQFBhu8SEvJdyt/h91Z2OJ4UNUGigmyLOF1bzc+h9OwX2UFR2QVuhKx8JPVlgtiFzPbmpzoC2NBPEn4XGMzmWJyLyFNkDcNQ+6tajF2QpJ21A== Received: from MWHPR14CA0024.namprd14.prod.outlook.com (2603:10b6:300:ae::34) by DM5PR12MB1818.namprd12.prod.outlook.com (2603:10b6:3:114::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.25; Sun, 9 May 2021 16:05:49 +0000 Received: from CO1NAM11FT005.eop-nam11.prod.protection.outlook.com (2603:10b6:300:ae:cafe::7a) by MWHPR14CA0024.outlook.office365.com (2603:10b6:300:ae::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.25 via Frontend Transport; Sun, 9 May 2021 16:05:49 +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 CO1NAM11FT005.mail.protection.outlook.com (10.13.174.147) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4108.25 via Frontend Transport; Sun, 9 May 2021 16:05:48 +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; Sun, 9 May 2021 16:05:46 +0000 From: Matan Azrad To: CC: , , , "Thomas Monjalon" Date: Sun, 9 May 2021 19:05:06 +0300 Message-ID: <20210509160507.224644-14-matan@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210509160507.224644-1-matan@nvidia.com> References: <20210504210857.3398397-1-matan@nvidia.com> <20210509160507.224644-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: HQMAIL105.nvidia.com (172.20.187.12) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 58e12afe-66fe-4722-80b3-08d913044f94 X-MS-TrafficTypeDiagnostic: DM5PR12MB1818: 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: 1VB+cSiK98tP3VcHVC/FsPHPdJ75ZLNmDJPf6f5H4UyMEl1Xnw6LPPfanybwBybOIowAbWjQ+gMXEERmZ0zIB6XiKsvnYE2yLn4Ha0RqZQbKqlGSGy4NZD9DqniReaiaN4Kw8yVagC44/2RfplrfyawWJ/jVqIDlQT4FqdJZ4qrUOSIN7YRYLjdOrZEFdR+KZVxfJnwJ1I1eiSuh3qPmrdRg/poUVpaPCvUfVDQV+SN11HYgRRNG+4QZphVyC6CvdkKcWMUC0SBPLXzVB4wGziIFBLtR9a3xG1LE30z+sgWyKJbDRw+JTL2tzhvNqoIlBsnk6oVWiS8kFsAwTsUVP+xTJfI2pYc0AhOcAolY1ywDyaScj2ndz+PMiTSREMluSepyureNr55PunQoefr8cv9EqX4ogiD1nPfI+wId/4+rN7BniCfAyurhTOKgPC94V+ato2cN6V2DQEd1qsqNK9MEDBEHL5o+5poOPHj+PljzGpZZN6w6izgnBX1qZj4LtYC5GFp2D2eWCLqXKFzSxRL2a0yboDoesgWWtZCyKzclBt5Yjx09K635yKdo+mZkmOQAVLhJt0k5GE4GPoaAny1Iykl+pLAM+GHIXAVyQtEcp0InuWSbkaUp2V4AG680U5S5+6Lztohv0MW9FX4O5g== 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)(376002)(136003)(346002)(39860400002)(396003)(36840700001)(46966006)(1076003)(356005)(55016002)(82310400003)(2616005)(5660300002)(426003)(83380400001)(6286002)(36860700001)(16526019)(8936002)(8676002)(186003)(70206006)(54906003)(70586007)(4326008)(336012)(47076005)(36906005)(316002)(36756003)(478600001)(6916009)(7696005)(7636003)(26005)(6666004)(82740400003)(86362001)(2906002); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 May 2021 16:05:48.4365 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 58e12afe-66fe-4722-80b3-08d913044f94 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: CO1NAM11FT005.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR12MB1818 Subject: [dpdk-dev] [PATCH v4 13/14] 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 29e59de702..60ffa6951e 100644 --- a/drivers/crypto/mlx5/mlx5_crypto.c +++ b/drivers/crypto/mlx5/mlx5_crypto.c @@ -438,11 +438,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(); @@ -459,6 +462,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)); } @@ -498,6 +502,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; } @@ -656,14 +661,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