event/dpaa2: support crypto adapter
event dpaa2 device support both ethernet as well as crypto queues to be attached to it. eth_rx_adapter provide infrastructure to attach ethernet queues and crypto_adapter provide support for crypto queues. This patch add support for dpaa2_eventdev to attach dpaa2_sec queues. 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> Acked-by: Abhinandan Gujjar <abhinandan.gujjar@intel.com>
This commit is contained in:
parent
a77db24643
commit
3721c39f40
@ -22,8 +22,10 @@ LDLIBS += -lrte_eal -lrte_eventdev
|
|||||||
LDLIBS += -lrte_bus_fslmc -lrte_mempool_dpaa2 -lrte_pmd_dpaa2
|
LDLIBS += -lrte_bus_fslmc -lrte_mempool_dpaa2 -lrte_pmd_dpaa2
|
||||||
LDLIBS += -lrte_bus_vdev
|
LDLIBS += -lrte_bus_vdev
|
||||||
LDLIBS += -lrte_common_dpaax
|
LDLIBS += -lrte_common_dpaax
|
||||||
|
LDLIBS += -lrte_pmd_dpaa2_sec
|
||||||
CFLAGS += -I$(RTE_SDK)/drivers/net/dpaa2
|
CFLAGS += -I$(RTE_SDK)/drivers/net/dpaa2
|
||||||
CFLAGS += -I$(RTE_SDK)/drivers/net/dpaa2/mc
|
CFLAGS += -I$(RTE_SDK)/drivers/net/dpaa2/mc
|
||||||
|
CFLAGS += -I$(RTE_SDK)/drivers/crypto/dpaa2_sec
|
||||||
|
|
||||||
# versioning export map
|
# versioning export map
|
||||||
EXPORT_MAP := rte_pmd_dpaa2_event_version.map
|
EXPORT_MAP := rte_pmd_dpaa2_event_version.map
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
#include <rte_pci.h>
|
#include <rte_pci.h>
|
||||||
#include <rte_bus_vdev.h>
|
#include <rte_bus_vdev.h>
|
||||||
#include <rte_ethdev_driver.h>
|
#include <rte_ethdev_driver.h>
|
||||||
|
#include <rte_cryptodev.h>
|
||||||
#include <rte_event_eth_rx_adapter.h>
|
#include <rte_event_eth_rx_adapter.h>
|
||||||
|
|
||||||
#include <fslmc_vfio.h>
|
#include <fslmc_vfio.h>
|
||||||
@ -34,6 +35,7 @@
|
|||||||
#include <dpaa2_hw_mempool.h>
|
#include <dpaa2_hw_mempool.h>
|
||||||
#include <dpaa2_hw_dpio.h>
|
#include <dpaa2_hw_dpio.h>
|
||||||
#include <dpaa2_ethdev.h>
|
#include <dpaa2_ethdev.h>
|
||||||
|
#include <dpaa2_sec_event.h>
|
||||||
#include "dpaa2_eventdev.h"
|
#include "dpaa2_eventdev.h"
|
||||||
#include "dpaa2_eventdev_logs.h"
|
#include "dpaa2_eventdev_logs.h"
|
||||||
#include <portal/dpaa2_hw_pvt.h>
|
#include <portal/dpaa2_hw_pvt.h>
|
||||||
@ -793,6 +795,149 @@ dpaa2_eventdev_eth_stop(const struct rte_eventdev *dev,
|
|||||||
return 0;
|
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 = {
|
static struct rte_eventdev_ops dpaa2_eventdev_ops = {
|
||||||
.dev_infos_get = dpaa2_eventdev_info_get,
|
.dev_infos_get = dpaa2_eventdev_info_get,
|
||||||
.dev_configure = dpaa2_eventdev_configure,
|
.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_queue_del = dpaa2_eventdev_eth_queue_del,
|
||||||
.eth_rx_adapter_start = dpaa2_eventdev_eth_start,
|
.eth_rx_adapter_start = dpaa2_eventdev_eth_start,
|
||||||
.eth_rx_adapter_stop = dpaa2_eventdev_eth_stop,
|
.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
|
static int
|
||||||
|
@ -42,6 +42,15 @@ enum {
|
|||||||
(RTE_EVENT_ETH_RX_ADAPTER_CAP_INTERNAL_PORT | \
|
(RTE_EVENT_ETH_RX_ADAPTER_CAP_INTERNAL_PORT | \
|
||||||
RTE_EVENT_ETH_RX_ADAPTER_CAP_MULTI_EVENTQ | \
|
RTE_EVENT_ETH_RX_ADAPTER_CAP_MULTI_EVENTQ | \
|
||||||
RTE_EVENT_ETH_RX_ADAPTER_CAP_OVERRIDE_FLOW_ID)
|
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
|
/**< Ethernet Rx adapter cap to return If the packet transfers from
|
||||||
* the ethdev to eventdev with DPAA2 devices.
|
* the ethdev to eventdev with DPAA2 devices.
|
||||||
*/
|
*/
|
||||||
|
@ -6,8 +6,9 @@ version = 2
|
|||||||
if host_machine.system() != 'linux'
|
if host_machine.system() != 'linux'
|
||||||
build = false
|
build = false
|
||||||
endif
|
endif
|
||||||
deps += ['bus_vdev', 'pmd_dpaa2']
|
deps += ['bus_vdev', 'pmd_dpaa2', 'pmd_dpaa2_sec']
|
||||||
sources = files('dpaa2_hw_dpcon.c',
|
sources = files('dpaa2_hw_dpcon.c',
|
||||||
'dpaa2_eventdev.c')
|
'dpaa2_eventdev.c')
|
||||||
|
|
||||||
allow_experimental_apis = true
|
allow_experimental_apis = true
|
||||||
|
includes += include_directories('../../crypto/dpaa2_sec/')
|
||||||
|
Loading…
Reference in New Issue
Block a user