mbox series

[v3,0/7] cryptodev: hide internal structures

Message ID 20211018144201.2028022-1-gakhil@marvell.com (mailing list archive)
Headers
Series cryptodev: hide internal structures |

Message

Akhil Goyal Oct. 18, 2021, 2:41 p.m. UTC
  Structures rte_cryptodev and rte_cryptodev_data are not
supposed to be directly used by the application. These
are made public as they are used by inline datapath
public APIs.
This patchset, creates a new rte_cryptodev_core.h file
which helps in defining a data structure to hold datapath
APIs in a flat array based on the device identifier which
is filled by the PMD.

Similar series for ethdev and eventdev are also floated on ML.
https://patchwork.dpdk.org/project/dpdk/list/?series=19428
https://patchwork.dpdk.org/project/dpdk/list/?series=19405


changes in
v3: fixed multiprocess and enq-deq callback handling.
v2: align with the latest versions of above series.


Akhil Goyal (7):
  cryptodev: separate out internal structures
  cryptodev: allocate max space for internal qp array
  cryptodev: move inline APIs into separate structure
  cryptodev: add PMD device probe finish API
  drivers/crypto: invoke probing finish function
  cryptodev: update fast path APIs to use new flat array
  cryptodev: move device specific structures

 drivers/crypto/armv8/rte_armv8_pmd.c          |   2 +
 drivers/crypto/bcmfs/bcmfs_sym_pmd.c          |   2 +
 drivers/crypto/caam_jr/caam_jr.c              |   2 +
 drivers/crypto/ccp/ccp_dev.h                  |   2 +-
 drivers/crypto/ccp/rte_ccp_pmd.c              |   2 +
 drivers/crypto/cnxk/cn10k_cryptodev.c         |   2 +
 drivers/crypto/cnxk/cn10k_ipsec.c             |   2 +-
 drivers/crypto/cnxk/cn9k_cryptodev.c          |   2 +
 drivers/crypto/cnxk/cn9k_ipsec.c              |   2 +-
 .../crypto/cnxk/cnxk_cryptodev_capabilities.c |   2 +-
 drivers/crypto/cnxk/cnxk_cryptodev_sec.c      |   2 +-
 drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c   |   4 +-
 drivers/crypto/dpaa_sec/dpaa_sec.c            |   4 +-
 drivers/crypto/ipsec_mb/ipsec_mb_private.c    |   2 +
 drivers/crypto/mlx5/mlx5_crypto.c             |   3 +
 drivers/crypto/mvsam/rte_mrvl_pmd.c           |   2 +
 drivers/crypto/nitrox/nitrox_sym.c            |   3 +
 drivers/crypto/nitrox/nitrox_sym_reqmgr.c     |   2 +-
 drivers/crypto/null/null_crypto_pmd.c         |   2 +
 drivers/crypto/octeontx/otx_cryptodev.c       |   5 +-
 .../crypto/octeontx/otx_cryptodev_hw_access.c |   2 +-
 .../crypto/octeontx/otx_cryptodev_hw_access.h |   2 +-
 drivers/crypto/octeontx/otx_cryptodev_ops.h   |   2 +-
 drivers/crypto/octeontx2/otx2_cryptodev.c     |   2 +
 .../crypto/octeontx2/otx2_cryptodev_mbox.c    |   2 +-
 drivers/crypto/openssl/rte_openssl_pmd.c      |   2 +
 drivers/crypto/qat/qat_asym_pmd.c             |   3 +
 drivers/crypto/qat/qat_sym_pmd.c              |   2 +
 drivers/crypto/scheduler/scheduler_failover.c |   2 +-
 .../crypto/scheduler/scheduler_multicore.c    |   2 +-
 .../scheduler/scheduler_pkt_size_distr.c      |   2 +-
 drivers/crypto/scheduler/scheduler_pmd.c      |   2 +
 .../crypto/scheduler/scheduler_roundrobin.c   |   2 +-
 drivers/crypto/virtio/virtio_cryptodev.c      |   2 +
 drivers/event/cnxk/cnxk_eventdev.h            |   2 +-
 drivers/event/dpaa/dpaa_eventdev.c            |   2 +-
 drivers/event/dpaa2/dpaa2_eventdev.c          |   2 +-
 drivers/event/octeontx/ssovf_evdev.c          |   2 +-
 .../event/octeontx2/otx2_evdev_crypto_adptr.c |   2 +-
 lib/cryptodev/cryptodev_pmd.c                 |  69 +++-
 lib/cryptodev/cryptodev_pmd.h                 |  95 ++++-
 lib/cryptodev/meson.build                     |   4 +-
 lib/cryptodev/rte_cryptodev.c                 |  40 +-
 lib/cryptodev/rte_cryptodev.h                 | 367 +++++++-----------
 lib/cryptodev/rte_cryptodev_core.h            |  62 +++
 lib/cryptodev/version.map                     |   8 +-
 46 files changed, 465 insertions(+), 268 deletions(-)
 create mode 100644 lib/cryptodev/rte_cryptodev_core.h
  

Comments

Power, Ciara Oct. 20, 2021, 10:25 a.m. UTC | #1
Hi Akhil,


>-----Original Message-----
>From: Akhil Goyal <gakhil@marvell.com>
>Sent: Monday 18 October 2021 15:42
>To: dev@dpdk.org
>Cc: thomas@monjalon.net; david.marchand@redhat.com;
>hemant.agrawal@nxp.com; anoobj@marvell.com; De Lara Guarch, Pablo
><pablo.de.lara.guarch@intel.com>; Trahe, Fiona <fiona.trahe@intel.com>;
>Doherty, Declan <declan.doherty@intel.com>; matan@nvidia.com;
>g.singh@nxp.com; Zhang, Roy Fan <roy.fan.zhang@intel.com>;
>jianjay.zhou@huawei.com; asomalap@amd.com; ruifeng.wang@arm.com;
>Ananyev, Konstantin <konstantin.ananyev@intel.com>; Nicolau, Radu
><radu.nicolau@intel.com>; ajit.khaparde@broadcom.com;
>rnagadheeraj@marvell.com; adwivedi@marvell.com; Power, Ciara
><ciara.power@intel.com>; Akhil Goyal <gakhil@marvell.com>
>Subject: [PATCH v3 0/7] cryptodev: hide internal structures
>
>Structures rte_cryptodev and rte_cryptodev_data are not supposed to be
>directly used by the application. These are made public as they are used by
>inline datapath public APIs.
>This patchset, creates a new rte_cryptodev_core.h file which helps in defining
>a data structure to hold datapath APIs in a flat array based on the device
>identifier which is filled by the PMD.
>
>Similar series for ethdev and eventdev are also floated on ML.
>https://patchwork.dpdk.org/project/dpdk/list/?series=19428
>https://patchwork.dpdk.org/project/dpdk/list/?series=19405
>
>
<snip>

With this patchset I see a seg fault with the cryptodev_scheduler_autotest.
It is due to the worker PMDs using the direct device start functions rather than rte_cryptodev_start(), so fp_ops never get set.

I believe this fix is needed:

diff --git a/drivers/crypto/scheduler/scheduler_pmd_ops.c b/drivers/crypto/scheduler/scheduler_pmd_ops.c
index 465b88ade8..d6f8d3ab78 100644
--- a/drivers/crypto/scheduler/scheduler_pmd_ops.c
+++ b/drivers/crypto/scheduler/scheduler_pmd_ops.c
@@ -181,10 +181,8 @@ scheduler_pmd_start(struct rte_cryptodev *dev)
        /* start all workers */
        for (i = 0; i < sched_ctx->nb_workers; i++) {
                uint8_t worker_dev_id = sched_ctx->workers[i].dev_id;
-               struct rte_cryptodev *worker_dev =
-                               rte_cryptodev_pmd_get_dev(worker_dev_id);
 
-               ret = (*worker_dev->dev_ops->dev_start)(worker_dev);
+               ret = rte_cryptodev_start(worker_dev_id);
                if (ret < 0) {
                        CR_SCHED_LOG(ERR, "Failed to start worker dev %u",
                                        worker_dev_id);
@@ -208,10 +206,8 @@ scheduler_pmd_stop(struct rte_cryptodev *dev)
        /* stop all workers first */
        for (i = 0; i < sched_ctx->nb_workers; i++) {
                uint8_t worker_dev_id = sched_ctx->workers[i].dev_id;
-               struct rte_cryptodev *worker_dev =
-                               rte_cryptodev_pmd_get_dev(worker_dev_id);
 
-               (*worker_dev->dev_ops->dev_stop)(worker_dev);
+               rte_cryptodev_stop(worker_dev_id);
        }
 
        if (*sched_ctx->ops.scheduler_stop)


Thanks,
Ciara