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 2E34CA0C48; Thu, 8 Jul 2021 17:27:45 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C81E94167E; Thu, 8 Jul 2021 17:26:36 +0200 (CEST) Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2049.outbound.protection.outlook.com [40.107.93.49]) by mails.dpdk.org (Postfix) with ESMTP id BE7F84165C for ; Thu, 8 Jul 2021 17:26:31 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FQeOQtWraFmZ9dvjsMlFC+whf8SjCYKvLlg+lDwtWGcaNAc3sXMv81wGkilvchqrMdwaBCX3rqHzfvcVLsgVmfoFFnagQGIemkr9W1gFhUqWn6DxKGcs6fWt760F9kIYTpEbTF72SzYdj/PpPBNoJAHrTZK0e1XwiJy6rzvr985L/g1LmwtBWLNkgPxutefNQ4Xwl+q/XgPvQ5fybYG1Gl5ni+PnvYOGgPkLPYozvLUAlizNl9jEahX80ssTJD0u+Hq98GYKDjgVBXo2sJ4D3wXNBRejhYmNfc9nscZaeFfIW8Yc4R1VvxvMAgw7Jo+Y0+RhoqzJrBa+dK6age7i+A== 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=6B4z6RaT1FojXWmhe4rY3B30tW43xUwN3dCZ8+rmvOY=; b=dpf3khcehYgnnCc5A07M5Fr7pw5kIPzKk9KTQMJen8Lu98nxTRhXc8+r7pyTSRu82CMgZdbpnI5bWs8uwSd/3pwaegIRb3KUQO3qZGeXtVCJ5dadJLGNjoFD+DE1QwjhfaLb78sB/Cg0a/Ia/PmdM+M0aPWTiL1E9z9WbUvKcYoTUQsgwIbjBvf0KZsjJyiHkMEMHh++LgtDdPXqL8mD3VON619MMSDw6kiySHJQyrUDemD4WuaAWeVv4SJtAtdldYrLejLCcv0TOjvf5splb4dnxKNGAIBG5tbP3H2ymy2zxUikNQUZsza2sA9+R3OMijU0bvtjlNfwZJ4I19MR/A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.34) smtp.rcpttodomain=redhat.com 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=6B4z6RaT1FojXWmhe4rY3B30tW43xUwN3dCZ8+rmvOY=; b=U1e33iiCYgeBRnbrQJDuSovxSfSBMjT92T9tQwWFOrPB3zMDQKUAG6lx4NKGaTHHdb+ag6vbOipX5XZIxz755vhNeNkjSds66WJaUEaPVK32ailLesEbbS6623avQkbI5jsL2zPxfjY2EXbPc5rW88aWJZponObN4JHvCjyFbNNZdHcdEwG0ac6SW+UPq7cTFdpTaGlbF8H+v0SB/8ImYE/bK+2LsW/JjlWMkLkT9X0GtUO/B7W/V2/Runw2R/QaZhvHgk14iSLQQ1rv4uCYdRQpvLwXPggsU5LWd4rmP1PgRq4m0MB5qj3aayB/W9MDhjZLz3a3fLNMKAcRZOmyog== Received: from BN6PR19CA0120.namprd19.prod.outlook.com (2603:10b6:404:a0::34) by MWHPR12MB1838.namprd12.prod.outlook.com (2603:10b6:300:106::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4308.20; Thu, 8 Jul 2021 15:26:29 +0000 Received: from BN8NAM11FT019.eop-nam11.prod.protection.outlook.com (2603:10b6:404:a0:cafe::57) by BN6PR19CA0120.outlook.office365.com (2603:10b6:404:a0::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4308.19 via Frontend Transport; Thu, 8 Jul 2021 15:26:29 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) smtp.mailfrom=nvidia.com; redhat.com; dkim=none (message not signed) header.d=none;redhat.com; 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 BN8NAM11FT019.mail.protection.outlook.com (10.13.176.158) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4308.20 via Frontend Transport; Thu, 8 Jul 2021 15:26:29 +0000 Received: from nvidia.com (172.20.187.6) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 8 Jul 2021 15:26:27 +0000 From: Shiri Kuzin To: CC: , , , Date: Thu, 8 Jul 2021 18:25:28 +0300 Message-ID: <20210708152530.25835-14-shirik@nvidia.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210708152530.25835-1-shirik@nvidia.com> References: <20210701132609.53727-1-shirik@nvidia.com> <20210708152530.25835-1-shirik@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [172.20.187.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: a8e7af23-3513-4ce3-680f-08d94224c23d X-MS-TrafficTypeDiagnostic: MWHPR12MB1838: 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: N0E5rjs4vm0CjAq8T+Ni5UqVjFUVKWCz26G+jPnbswjWF60TwXlBZ0iS/EL/+Xfl7qjb715TuA7HfNgv0/RyDm8wKQ3LRG16nR11peJSxOoPdEYeSY1Qh+haGRq5rsB6WI4gYoXif4sVcezy7+z/j1zLrKile/NFgwFeAZYuGR3G169ZOwMiPvm5MEwk93rOMH1Wl7cQcQWDjVq1NjfwVwTAH9bSbyEDlyvfz2YfhxMnLEo6wofGVSNcShA5rdxmx6hKFh+lwa3pTq3FNedqzBentfahR4nNRMrRRNgX3UHD56+oMkmjjNKGgHoSldVmnCdoKB1tZNWCyFg8wHW4wx7IfQEaC563DHNW5YYlCCFYNWLd6/dTHi1IKopy8ZmkGX2PKflbxlpmNt6M0oonZsZ6NP0Zm/gUfIrnNBPzUfY6tYdQtd0BdXoU3mT1nf2scVDBAj/s+GQk41ttR/B3vW3iMXWoo+mXXXaDLtLgIo5ifYpWmQNkxUIsVALWF9mZ2DGXBQq7aJ6brTjLwgQ5zwBwnsUv/bRXXurjmPpsZ7runpeBj5iAoJYOOAR4xAM2McEeZlWRLPPXTWWfqtVQniG216/rLJy86fDu7ZtDJLT3sCdaWA8OxeEmaTptswJsSpOMTOPOl0oSwe1NJ4aNVPKhOIbHSa3hlQCn8lWwcb/Kp5zEX9++N587FQwqxR9KBY/uV3kJ5C93bttKwLCf+w== 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)(36840700001)(46966006)(2616005)(83380400001)(7636003)(6916009)(186003)(70586007)(6286002)(426003)(26005)(86362001)(36756003)(70206006)(336012)(356005)(16526019)(2906002)(4326008)(36906005)(8936002)(36860700001)(82310400003)(7696005)(5660300002)(1076003)(55016002)(498600001)(8676002)(47076005)(54906003); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Jul 2021 15:26:29.2067 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a8e7af23-3513-4ce3-680f-08d94224c23d 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: BN8NAM11FT019.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR12MB1838 Subject: [dpdk-dev] [PATCH v6 13/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 | 40 ++++++++++++++++++++++++++++--- 1 file changed, 37 insertions(+), 3 deletions(-) diff --git a/drivers/crypto/mlx5/mlx5_crypto.c b/drivers/crypto/mlx5/mlx5_crypto.c index b467739a3c..0ecca32cce 100644 --- a/drivers/crypto/mlx5/mlx5_crypto.c +++ b/drivers/crypto/mlx5/mlx5_crypto.c @@ -508,13 +508,17 @@ mlx5_crypto_enqueue_burst(void *queue_pair, struct rte_crypto_op **ops, 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 (remain != nb_ops) + qp->stats.enqueue_err_count++; + if (remain != nb_ops) { + qp->stats.enqueued_count -= remain; break; + } return 0; } 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(); @@ -531,6 +535,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)); } @@ -570,6 +575,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; } @@ -731,14 +737,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.27.0