From: Akhil Goyal Subject: [PATCH 6/6] crypto/dpaa2_sec: support multi process Date: Wed, 27 Mar 2019 11:53:37 +0000 Message-ID: <20190327114407.13697-7-akhil.goyal@nxp.com> References: <20190327114407.13697-1-akhil.goyal@nxp.com> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Cc: Hemant Agrawal , Akhil Goyal To: "dev@dpdk.org" Return-path: Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-eopbgr140070.outbound.protection.outlook.com [40.107.14.70]) by dpdk.org (Postfix) with ESMTP id 3B7481B209 for ; Wed, 27 Mar 2019 12:53:38 +0100 (CET) In-Reply-To: <20190327114407.13697-1-akhil.goyal@nxp.com> Content-Language: en-US List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" - fle pool allocations should be done for each process. - cryptodev->data is shared across muliple processes but cryptodev itself is allocated for each process. So any information which needs to be shared between processes, should be kept in cryptodev->data. Signed-off-by: Akhil Goyal --- drivers/bus/fslmc/portal/dpaa2_hw_pvt.h | 2 +- drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c | 26 ++++++++++----------- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h b/drivers/bus/fslmc/po= rtal/dpaa2_hw_pvt.h index 4679e9340..0cbde8a9b 100644 --- a/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h +++ b/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h @@ -152,7 +152,7 @@ struct dpaa2_queue { struct rte_mempool *mb_pool; /**< mbuf pool to populate RX ring. */ union { struct rte_eth_dev_data *eth_data; - void *dev; + struct rte_cryptodev_data *crypto_data; }; int32_t eventfd; /*!< Event Fd of this queue */ uint32_t fqid; /*!< Unique ID of this queue */ diff --git a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c b/drivers/crypto/d= paa2_sec/dpaa2_sec_dpseci.c index 31b7de679..5b72b9ee4 100644 --- a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c +++ b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c @@ -7,6 +7,7 @@ =20 #include #include +#include =20 #include #include @@ -1297,7 +1298,7 @@ dpaa2_sec_enqueue_burst(void *qp, struct rte_crypto_o= p **ops, } =20 static inline struct rte_crypto_op * -sec_simple_fd_to_mbuf(const struct qbman_fd *fd, __rte_unused uint8_t id) +sec_simple_fd_to_mbuf(const struct qbman_fd *fd) { struct rte_crypto_op *op; uint16_t len =3D DPAA2_GET_FD_LEN(fd); @@ -1326,7 +1327,7 @@ sec_simple_fd_to_mbuf(const struct qbman_fd *fd, __rt= e_unused uint8_t id) } =20 static inline struct rte_crypto_op * -sec_fd_to_mbuf(const struct qbman_fd *fd, uint8_t driver_id) +sec_fd_to_mbuf(const struct qbman_fd *fd) { struct qbman_fle *fle; struct rte_crypto_op *op; @@ -1334,7 +1335,7 @@ sec_fd_to_mbuf(const struct qbman_fd *fd, uint8_t dri= ver_id) struct rte_mbuf *dst, *src; =20 if (DPAA2_FD_GET_FORMAT(fd) =3D=3D qbman_fd_single) - return sec_simple_fd_to_mbuf(fd, driver_id); + return sec_simple_fd_to_mbuf(fd); =20 fle =3D (struct qbman_fle *)DPAA2_IOVA_TO_VADDR(DPAA2_GET_FD_ADDR(fd)); =20 @@ -1401,8 +1402,6 @@ dpaa2_sec_dequeue_burst(void *qp, struct rte_crypto_o= p **ops, { /* Function is responsible to receive frames for a given device and VQ*/ struct dpaa2_sec_qp *dpaa2_qp =3D (struct dpaa2_sec_qp *)qp; - struct rte_cryptodev *dev =3D - (struct rte_cryptodev *)(dpaa2_qp->rx_vq.dev); struct qbman_result *dq_storage; uint32_t fqid =3D dpaa2_qp->rx_vq.fqid; int ret, num_rx =3D 0; @@ -1472,7 +1471,7 @@ dpaa2_sec_dequeue_burst(void *qp, struct rte_crypto_o= p **ops, } =20 fd =3D qbman_result_DQ_fd(dq_storage); - ops[num_rx] =3D sec_fd_to_mbuf(fd, dev->driver_id); + ops[num_rx] =3D sec_fd_to_mbuf(fd); =20 if (unlikely(fd->simple.frc)) { /* TODO Parse SEC errors */ @@ -1546,8 +1545,8 @@ dpaa2_sec_queue_pair_setup(struct rte_cryptodev *dev,= uint16_t qp_id, return -1; } =20 - qp->rx_vq.dev =3D dev; - qp->tx_vq.dev =3D dev; + qp->rx_vq.crypto_data =3D dev->data; + qp->tx_vq.crypto_data =3D dev->data; qp->rx_vq.q_storage =3D rte_malloc("sec dq storage", sizeof(struct queue_storage_info_t), RTE_CACHE_LINE_SIZE); @@ -3116,8 +3115,7 @@ dpaa2_sec_process_parallel_event(struct qbman_swp *sw= p, ev->sched_type =3D rxq->ev.sched_type; ev->queue_id =3D rxq->ev.queue_id; ev->priority =3D rxq->ev.priority; - ev->event_ptr =3D sec_fd_to_mbuf(fd, ((struct rte_cryptodev *) - (rxq->dev))->driver_id); + ev->event_ptr =3D sec_fd_to_mbuf(fd); =20 qbman_swp_dqrr_consume(swp, dq); } @@ -3145,8 +3143,7 @@ dpaa2_sec_process_atomic_event(struct qbman_swp *swp = __attribute__((unused)), ev->queue_id =3D rxq->ev.queue_id; ev->priority =3D rxq->ev.priority; =20 - ev->event_ptr =3D sec_fd_to_mbuf(fd, ((struct rte_cryptodev *) - (rxq->dev))->driver_id); + ev->event_ptr =3D sec_fd_to_mbuf(fd); dqrr_index =3D qbman_get_dqrr_idx(dq); crypto_op->sym->m_src->seqn =3D dqrr_index + 1; DPAA2_PER_LCORE_DQRR_SIZE++; @@ -3275,7 +3272,7 @@ dpaa2_sec_dev_init(struct rte_cryptodev *cryptodev) uint16_t token; struct dpseci_attr attr; int retcode, hw_id; - char str[20]; + char str[30]; =20 PMD_INIT_FUNC_TRACE(); dpaa2_dev =3D container_of(dev, struct rte_dpaa2_device, device); @@ -3353,7 +3350,8 @@ dpaa2_sec_dev_init(struct rte_cryptodev *cryptodev) internals->hw =3D dpseci; internals->token =3D token; =20 - snprintf(str, sizeof(str), "fle_pool_%d", cryptodev->data->dev_id); + snprintf(str, sizeof(str), "sec_fle_pool_p%d_%d", + getpid(), cryptodev->data->dev_id); internals->fle_pool =3D rte_mempool_create((const char *)str, FLE_POOL_NUM_BUFS, FLE_POOL_BUF_SIZE, --=20 2.17.1