From patchwork Mon Oct 18 14:41:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akhil Goyal X-Patchwork-Id: 102059 X-Patchwork-Delegate: gakhil@marvell.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 93184A0C43; Mon, 18 Oct 2021 16:42:54 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8030F4111E; Mon, 18 Oct 2021 16:42:54 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id 2FEEA410E1 for ; Mon, 18 Oct 2021 16:42:53 +0200 (CEST) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 19ICWLSi009543; Mon, 18 Oct 2021 07:42:47 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=OGCoyZiyDHZQg8ucZm5Z9/nw4Tw9cVX5cF+Z6OHbWLI=; b=lXD8c75Pzjv7HML87r0z05Tb/uUsyDD+K+YfmgvLbj0gkdZER3fOzZMgssm41uxYgnNw qCPimr2Cl4dAkRM4x/E4hH+3oRqmAh9cq3x4SK0UfIZASyM3puXJ4Qc6+f0sH+M/VfGG jDGCDHF9Dr3xxPpPf/LkpWXiXdaaDvkd+mtmkSRunxCT8HmJJ96YPkwltncv2qwKzsyW YY3wbBCuGj0HfU2ROKTpfLyMXeXj9kY+6W1YnZw207KIGqA3kOQKxgk06UsrVjy9Pwn8 Y41lqb3oHut8BiwKWleDIJuWzlljbVxy/2z9Vs27EnVLegwV/xTEHlesoQU8UnMMxLf4 lw== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0b-0016f401.pphosted.com with ESMTP id 3brt1s34r5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Mon, 18 Oct 2021 07:42:47 -0700 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Mon, 18 Oct 2021 07:42:44 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.18 via Frontend Transport; Mon, 18 Oct 2021 07:42:44 -0700 Received: from localhost.localdomain (unknown [10.28.36.185]) by maili.marvell.com (Postfix) with ESMTP id 243BE5C68E6; Mon, 18 Oct 2021 07:42:36 -0700 (PDT) From: Akhil Goyal To: CC: , , , , , , , , , , , , , , , , , , , Akhil Goyal Date: Mon, 18 Oct 2021 20:11:58 +0530 Message-ID: <20211018144201.2028022-5-gakhil@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211018144201.2028022-1-gakhil@marvell.com> References: <20211011124309.4066491-1-gakhil@marvell.com> <20211018144201.2028022-1-gakhil@marvell.com> MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: TF2yFO4SkxT7vUioL4ZLITsyUDAccfeb X-Proofpoint-GUID: TF2yFO4SkxT7vUioL4ZLITsyUDAccfeb X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.182.1,Aquarius:18.0.790,Hydra:6.0.425,FMLib:17.0.607.475 definitions=2021-10-18_06,2021-10-18_01,2020-04-07_01 Subject: [dpdk-dev] [PATCH v3 4/7] cryptodev: add PMD device probe finish API 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" Added a rte_cryptodev_pmd_probing_finish API which need to be called by the PMD after the device is initialized completely. This will set the fast path function pointers in the flat array for secondary process. For primary process, these are set in rte_cryptodev_start. Signed-off-by: Akhil Goyal Acked-by: Fan Zhang --- lib/cryptodev/cryptodev_pmd.c | 16 ++++++++++++++++ lib/cryptodev/cryptodev_pmd.h | 13 +++++++++++++ lib/cryptodev/version.map | 1 + 3 files changed, 30 insertions(+) diff --git a/lib/cryptodev/cryptodev_pmd.c b/lib/cryptodev/cryptodev_pmd.c index fd74543682..739a0b3f34 100644 --- a/lib/cryptodev/cryptodev_pmd.c +++ b/lib/cryptodev/cryptodev_pmd.c @@ -161,6 +161,22 @@ rte_cryptodev_pmd_destroy(struct rte_cryptodev *cryptodev) return 0; } +void +rte_cryptodev_pmd_probing_finish(struct rte_cryptodev *cryptodev) +{ + if (cryptodev == NULL) + return; + /* + * for secondary process, at that point we expect device + * to be already 'usable', so shared data and all function + * pointers for fast-path devops have to be setup properly + * inside rte_cryptodev. + */ + if (rte_eal_process_type() == RTE_PROC_SECONDARY) + cryptodev_fp_ops_set(rte_crypto_fp_ops + + cryptodev->data->dev_id, cryptodev); +} + static uint16_t dummy_crypto_enqueue_burst(__rte_unused void *qp, __rte_unused struct rte_crypto_op **ops, diff --git a/lib/cryptodev/cryptodev_pmd.h b/lib/cryptodev/cryptodev_pmd.h index a71edbb991..9bb1e47ae4 100644 --- a/lib/cryptodev/cryptodev_pmd.h +++ b/lib/cryptodev/cryptodev_pmd.h @@ -509,6 +509,19 @@ __rte_internal uint8_t rte_cryptodev_allocate_driver(struct cryptodev_driver *crypto_drv, const struct rte_driver *drv); +/** + * @internal + * This is the last step of device probing. It must be called after a + * cryptodev is allocated and initialized successfully. + * + * @param dev Pointer to cryptodev struct + * + * @return + * void + */ +__rte_internal +void +rte_cryptodev_pmd_probing_finish(struct rte_cryptodev *dev); #define RTE_PMD_REGISTER_CRYPTO_DRIVER(crypto_drv, drv, driver_id)\ RTE_INIT(init_ ##driver_id)\ diff --git a/lib/cryptodev/version.map b/lib/cryptodev/version.map index ed62ced221..157dac521d 100644 --- a/lib/cryptodev/version.map +++ b/lib/cryptodev/version.map @@ -123,5 +123,6 @@ INTERNAL { rte_cryptodev_pmd_get_dev; rte_cryptodev_pmd_get_named_dev; rte_cryptodev_pmd_parse_input_args; + rte_cryptodev_pmd_probing_finish; rte_cryptodev_pmd_release_device; };