DPDK patches and discussions
 help / color / mirror / Atom feed
From: Jerin Jacob <jerin.jacob@caviumnetworks.com>
To: akhil.goyal@nxp.com
Cc: dev@dpdk.org, hemant.agrawal@nxp.com,
	pablo.de.lara.guarch@intel.com, abhinandan.gujjar@intel.com
Subject: Re: [dpdk-dev] [PATCH 3/3] event/dpaa2: support for crypto adapter
Date: Tue, 25 Sep 2018 08:41:31 +0530	[thread overview]
Message-ID: <20180925031130.GA10106@jerin> (raw)
In-Reply-To: <20180914114810.14960-4-akhil.goyal@nxp.com>

-----Original Message-----
> Date: Fri, 14 Sep 2018 17:18:10 +0530
> From: akhil.goyal@nxp.com
> To: dev@dpdk.org
> CC: hemant.agrawal@nxp.com, pablo.de.lara.guarch@intel.com, Akhil Goyal
>  <akhil.goyal@nxp.com>
> Subject: [dpdk-dev] [PATCH 3/3] event/dpaa2: support for crypto adapter
> X-Mailer: git-send-email 2.17.1
> 
> 
> From: Akhil Goyal <akhil.goyal@nxp.com>
> 
> Signed-off-by: Akhil Goyal <akhil.goyal@nxp.com>
> Signed-off-by: Ashish Jain <ashish.jain@nxp.com>
> Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>


Adding Eventdev Crypto Adapter maintainer

+ Abhinandan Gujjar <abhinandan.gujjar@intel.com>


> ---
>  drivers/event/dpaa2/Makefile         |   3 +-
>  drivers/event/dpaa2/dpaa2_eventdev.c | 150 +++++++++++++++++++++++++++
>  drivers/event/dpaa2/dpaa2_eventdev.h |   9 ++
>  drivers/event/dpaa2/meson.build      |   3 +-
>  4 files changed, 163 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/event/dpaa2/Makefile b/drivers/event/dpaa2/Makefile
> index 5e1a63200..46f7d061e 100644
> --- a/drivers/event/dpaa2/Makefile
> +++ b/drivers/event/dpaa2/Makefile
> @@ -20,9 +20,10 @@ CFLAGS += -I$(RTE_SDK)/drivers/event/dpaa2
>  CFLAGS += -I$(RTE_SDK)/lib/librte_eal/linuxapp/eal
>  LDLIBS += -lrte_eal -lrte_eventdev
>  LDLIBS += -lrte_bus_fslmc -lrte_mempool_dpaa2 -lrte_pmd_dpaa2
> -LDLIBS += -lrte_bus_vdev
> +LDLIBS += -lrte_bus_vdev -lrte_pmd_dpaa2_sec
>  CFLAGS += -I$(RTE_SDK)/drivers/net/dpaa2
>  CFLAGS += -I$(RTE_SDK)/drivers/net/dpaa2/mc
> +CFLAGS += -I$(RTE_SDK)/drivers/crypto/dpaa2_sec
> 
>  # versioning export map
>  EXPORT_MAP := rte_pmd_dpaa2_event_version.map
> diff --git a/drivers/event/dpaa2/dpaa2_eventdev.c b/drivers/event/dpaa2/dpaa2_eventdev.c
> index cadbdb13b..890ab461c 100644
> --- a/drivers/event/dpaa2/dpaa2_eventdev.c
> +++ b/drivers/event/dpaa2/dpaa2_eventdev.c
> @@ -27,6 +27,7 @@
>  #include <rte_pci.h>
>  #include <rte_bus_vdev.h>
>  #include <rte_ethdev_driver.h>
> +#include <rte_cryptodev.h>
>  #include <rte_event_eth_rx_adapter.h>
> 
>  #include <fslmc_vfio.h>
> @@ -34,6 +35,7 @@
>  #include <dpaa2_hw_mempool.h>
>  #include <dpaa2_hw_dpio.h>
>  #include <dpaa2_ethdev.h>
> +#include <dpaa2_sec_event.h>
>  #include "dpaa2_eventdev.h"
>  #include "dpaa2_eventdev_logs.h"
>  #include <portal/dpaa2_hw_pvt.h>
> @@ -793,6 +795,149 @@ dpaa2_eventdev_eth_stop(const struct rte_eventdev *dev,
>         return 0;
>  }
> 
> +static int
> +dpaa2_eventdev_crypto_caps_get(const struct rte_eventdev *dev,
> +                           const struct rte_cryptodev *cdev,
> +                           uint32_t *caps)
> +{
> +       const char *name = cdev->data->name;
> +
> +       EVENTDEV_INIT_FUNC_TRACE();
> +
> +       RTE_SET_USED(dev);
> +
> +       if (!strncmp(name, "dpsec-", 6))
> +               *caps = RTE_EVENT_CRYPTO_ADAPTER_DPAA2_CAP;
> +       else
> +               return -1;
> +
> +       return 0;
> +}
> +
> +static int
> +dpaa2_eventdev_crypto_queue_add_all(const struct rte_eventdev *dev,
> +               const struct rte_cryptodev *cryptodev,
> +               const struct rte_event *ev)
> +{
> +       struct dpaa2_eventdev *priv = dev->data->dev_private;
> +       uint8_t ev_qid = ev->queue_id;
> +       uint16_t dpcon_id = priv->evq_info[ev_qid].dpcon->dpcon_id;
> +       int i, ret;
> +
> +       EVENTDEV_INIT_FUNC_TRACE();
> +
> +       for (i = 0; i < cryptodev->data->nb_queue_pairs; i++) {
> +               ret = dpaa2_sec_eventq_attach(cryptodev, i,
> +                               dpcon_id, ev);
> +               if (ret) {
> +                       DPAA2_EVENTDEV_ERR("dpaa2_sec_eventq_attach failed: ret %d\n",
> +                                   ret);
> +                       goto fail;
> +               }
> +       }
> +       return 0;
> +fail:
> +       for (i = (i - 1); i >= 0 ; i--)
> +               dpaa2_sec_eventq_detach(cryptodev, i);
> +
> +       return ret;
> +}
> +
> +static int
> +dpaa2_eventdev_crypto_queue_add(const struct rte_eventdev *dev,
> +               const struct rte_cryptodev *cryptodev,
> +               int32_t rx_queue_id,
> +               const struct rte_event *ev)
> +{
> +       struct dpaa2_eventdev *priv = dev->data->dev_private;
> +       uint8_t ev_qid = ev->queue_id;
> +       uint16_t dpcon_id = priv->evq_info[ev_qid].dpcon->dpcon_id;
> +       int ret;
> +
> +       EVENTDEV_INIT_FUNC_TRACE();
> +
> +       if (rx_queue_id == -1)
> +               return dpaa2_eventdev_crypto_queue_add_all(dev,
> +                               cryptodev, ev);
> +
> +       ret = dpaa2_sec_eventq_attach(cryptodev, rx_queue_id,
> +                       dpcon_id, ev);
> +       if (ret) {
> +               DPAA2_EVENTDEV_ERR(
> +                       "dpaa2_sec_eventq_attach failed: ret: %d\n", ret);
> +               return ret;
> +       }
> +       return 0;
> +}
> +
> +static int
> +dpaa2_eventdev_crypto_queue_del_all(const struct rte_eventdev *dev,
> +                            const struct rte_cryptodev *cdev)
> +{
> +       int i, ret;
> +
> +       EVENTDEV_INIT_FUNC_TRACE();
> +
> +       RTE_SET_USED(dev);
> +
> +       for (i = 0; i < cdev->data->nb_queue_pairs; i++) {
> +               ret = dpaa2_sec_eventq_detach(cdev, i);
> +               if (ret) {
> +                       DPAA2_EVENTDEV_ERR(
> +                               "dpaa2_sec_eventq_detach failed:ret %d\n", ret);
> +                       return ret;
> +               }
> +       }
> +
> +       return 0;
> +}
> +
> +static int
> +dpaa2_eventdev_crypto_queue_del(const struct rte_eventdev *dev,
> +                            const struct rte_cryptodev *cryptodev,
> +                            int32_t rx_queue_id)
> +{
> +       int ret;
> +
> +       EVENTDEV_INIT_FUNC_TRACE();
> +
> +       if (rx_queue_id == -1)
> +               return dpaa2_eventdev_crypto_queue_del_all(dev, cryptodev);
> +
> +       ret = dpaa2_sec_eventq_detach(cryptodev, rx_queue_id);
> +       if (ret) {
> +               DPAA2_EVENTDEV_ERR(
> +                       "dpaa2_sec_eventq_detach failed: ret: %d\n", ret);
> +               return ret;
> +       }
> +
> +       return 0;
> +}
> +
> +static int
> +dpaa2_eventdev_crypto_start(const struct rte_eventdev *dev,
> +                           const struct rte_cryptodev *cryptodev)
> +{
> +       EVENTDEV_INIT_FUNC_TRACE();
> +
> +       RTE_SET_USED(dev);
> +       RTE_SET_USED(cryptodev);
> +
> +       return 0;
> +}
> +
> +static int
> +dpaa2_eventdev_crypto_stop(const struct rte_eventdev *dev,
> +                          const struct rte_cryptodev *cryptodev)
> +{
> +       EVENTDEV_INIT_FUNC_TRACE();
> +
> +       RTE_SET_USED(dev);
> +       RTE_SET_USED(cryptodev);
> +
> +       return 0;
> +}
> +
>  static struct rte_eventdev_ops dpaa2_eventdev_ops = {
>         .dev_infos_get    = dpaa2_eventdev_info_get,
>         .dev_configure    = dpaa2_eventdev_configure,
> @@ -814,6 +959,11 @@ static struct rte_eventdev_ops dpaa2_eventdev_ops = {
>         .eth_rx_adapter_queue_del = dpaa2_eventdev_eth_queue_del,
>         .eth_rx_adapter_start = dpaa2_eventdev_eth_start,
>         .eth_rx_adapter_stop = dpaa2_eventdev_eth_stop,
> +       .crypto_adapter_caps_get        = dpaa2_eventdev_crypto_caps_get,
> +       .crypto_adapter_queue_pair_add  = dpaa2_eventdev_crypto_queue_add,
> +       .crypto_adapter_queue_pair_del  = dpaa2_eventdev_crypto_queue_del,
> +       .crypto_adapter_start           = dpaa2_eventdev_crypto_start,
> +       .crypto_adapter_stop            = dpaa2_eventdev_crypto_stop,
>  };
> 
>  static int
> diff --git a/drivers/event/dpaa2/dpaa2_eventdev.h b/drivers/event/dpaa2/dpaa2_eventdev.h
> index 720e0c63b..c847b3eab 100644
> --- a/drivers/event/dpaa2/dpaa2_eventdev.h
> +++ b/drivers/event/dpaa2/dpaa2_eventdev.h
> @@ -42,6 +42,15 @@ enum {
>                 (RTE_EVENT_ETH_RX_ADAPTER_CAP_INTERNAL_PORT | \
>                 RTE_EVENT_ETH_RX_ADAPTER_CAP_MULTI_EVENTQ | \
>                 RTE_EVENT_ETH_RX_ADAPTER_CAP_OVERRIDE_FLOW_ID)
> +
> +/**< Crypto Rx adapter cap to return If the packet transfers from
> + * the cryptodev to eventdev with DPAA2 devices.
> + */
> +#define RTE_EVENT_CRYPTO_ADAPTER_DPAA2_CAP \
> +               (RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_OP_NEW | \
> +               RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_QP_EV_BIND | \
> +               RTE_EVENT_CRYPTO_ADAPTER_CAP_SESSION_PRIVATE_DATA)
> +
>  /**< Ethernet Rx adapter cap to return If the packet transfers from
>   * the ethdev to eventdev with DPAA2 devices.
>   */
> diff --git a/drivers/event/dpaa2/meson.build b/drivers/event/dpaa2/meson.build
> index de7a46155..c1bd63384 100644
> --- a/drivers/event/dpaa2/meson.build
> +++ b/drivers/event/dpaa2/meson.build
> @@ -4,8 +4,9 @@
>  if host_machine.system() != 'linux'
>         build = false
>  endif
> -deps += ['bus_vdev', 'pmd_dpaa2']
> +deps += ['bus_vdev', 'pmd_dpaa2', 'pmd_dpaa2_sec']
>  sources = files('dpaa2_hw_dpcon.c',
>                 'dpaa2_eventdev.c')
> 
>  allow_experimental_apis = true
> +includes += include_directories('../../crypto/dpaa2_sec/')
> --
> 2.17.1
> 

  reply	other threads:[~2018-09-25  3:27 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-14 11:48 [dpdk-dev] [PATCH 0/3] dpaa2: " akhil.goyal
2018-09-14 11:48 ` [dpdk-dev] [PATCH 1/3] crypto/dpaa2_sec: support for event " akhil.goyal
2018-09-14 11:48 ` [dpdk-dev] [PATCH 2/3] crypto/dpaa2_sec: support for atomic queues akhil.goyal
2018-09-14 11:48 ` [dpdk-dev] [PATCH 3/3] event/dpaa2: support for crypto adapter akhil.goyal
2018-09-25  3:11   ` Jerin Jacob [this message]
2018-10-02  9:49     ` Gujjar, Abhinandan S
2018-10-09 13:22 ` [dpdk-dev] [PATCH 0/3] dpaa2: " Akhil Goyal

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180925031130.GA10106@jerin \
    --to=jerin.jacob@caviumnetworks.com \
    --cc=abhinandan.gujjar@intel.com \
    --cc=akhil.goyal@nxp.com \
    --cc=dev@dpdk.org \
    --cc=hemant.agrawal@nxp.com \
    --cc=pablo.de.lara.guarch@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).