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 997D5A0C43; Wed, 20 Oct 2021 13:28:32 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0D1D94118F; Wed, 20 Oct 2021 13:28:31 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id 26509411FD for ; Wed, 20 Oct 2021 13:28:30 +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 19K8kiWp020984; Wed, 20 Oct 2021 04:28:23 -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=nzybg0JJejNCCop6BqF7461gKDp7Ql8YPonwXvLx9is=; b=XW228ngzjZfGaOpqGenl0pnWIvTehvnMVunRNfgn3ReeGQhFcQ4hso8NB3YpXcGYujRn WyldmsLUtfTBs1CWx3sPrix1VAVKelXagmzKfgs0s7ei/7300ABWOupa+YAMFxLRI7z1 n2779mlEgyiPRpm9nh69vs1ty7OIH9XsVUFLaTc1Kh5MNMrx6OAajjbsTPB2+eo7T06Z rMBtvu41l0tzmxc+VZ5q2JXWMAJ5g/rBR6qG83hb1e3IY1tFrhma/X047FnPPeMrKpOZ NZjUFtuDePGw7HoXdOhgkCQRO8K95fzmJiDNyVcKFmiG3CpaE+AEgR6I4XPTSqTOqrka 1A== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0b-0016f401.pphosted.com with ESMTP id 3bt05g4pv6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Wed, 20 Oct 2021 04:28:23 -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; Wed, 20 Oct 2021 04:28:21 -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; Wed, 20 Oct 2021 04:28:21 -0700 Received: from localhost.localdomain (unknown [10.28.36.185]) by maili.marvell.com (Postfix) with ESMTP id 0D8953F7098; Wed, 20 Oct 2021 04:28:14 -0700 (PDT) From: Akhil Goyal To: CC: , , , , , , , , , , , , , , , , , , , Akhil Goyal Date: Wed, 20 Oct 2021 16:57:48 +0530 Message-ID: <20211020112754.1270163-3-gakhil@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211020112754.1270163-1-gakhil@marvell.com> References: <20211018144201.2028022-1-gakhil@marvell.com> <20211020112754.1270163-1-gakhil@marvell.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-GUID: bijQ647aR5uECrNrlbiCn9BUZGHrO9Hy X-Proofpoint-ORIG-GUID: bijQ647aR5uECrNrlbiCn9BUZGHrO9Hy 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-20_04,2021-10-20_02,2020-04-07_01 Subject: [dpdk-dev] [PATCH v4 2/8] cryptodev: allocate max space for internal qp array 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" At queue_pair config stage, allocate memory for maximum number of queue pair pointers that a device can support. This will allow fast path APIs(enqueue_burst/dequeue_burst) to refer pointer to internal QP data without checking for currently configured QPs. This is required to hide the rte_cryptodev and rte_cryptodev_data structure from user. Signed-off-by: Akhil Goyal Acked-by: Fan Zhang Acked-by: Konstantin Ananyev --- lib/cryptodev/rte_cryptodev.c | 21 +++------------------ 1 file changed, 3 insertions(+), 18 deletions(-) diff --git a/lib/cryptodev/rte_cryptodev.c b/lib/cryptodev/rte_cryptodev.c index b913c434c5..eb86e629aa 100644 --- a/lib/cryptodev/rte_cryptodev.c +++ b/lib/cryptodev/rte_cryptodev.c @@ -978,7 +978,8 @@ rte_cryptodev_queue_pairs_config(struct rte_cryptodev *dev, uint16_t nb_qpairs, if (dev->data->queue_pairs == NULL) { /* first time configuration */ dev->data->queue_pairs = rte_zmalloc_socket( "cryptodev->queue_pairs", - sizeof(dev->data->queue_pairs[0]) * nb_qpairs, + sizeof(dev->data->queue_pairs[0]) * + dev_info.max_nb_queue_pairs, RTE_CACHE_LINE_SIZE, socket_id); if (dev->data->queue_pairs == NULL) { @@ -1001,25 +1002,9 @@ rte_cryptodev_queue_pairs_config(struct rte_cryptodev *dev, uint16_t nb_qpairs, ret = (*dev->dev_ops->queue_pair_release)(dev, i); if (ret < 0) return ret; + qp[i] = NULL; } - qp = rte_realloc(qp, sizeof(qp[0]) * nb_qpairs, - RTE_CACHE_LINE_SIZE); - if (qp == NULL) { - CDEV_LOG_ERR("failed to realloc qp meta data," - " nb_queues %u", nb_qpairs); - return -(ENOMEM); - } - - if (nb_qpairs > old_nb_queues) { - uint16_t new_qs = nb_qpairs - old_nb_queues; - - memset(qp + old_nb_queues, 0, - sizeof(qp[0]) * new_qs); - } - - dev->data->queue_pairs = qp; - } dev->data->nb_queue_pairs = nb_qpairs; return 0; -- 2.25.1