crypto/octeontx: add PMD skeleton
Adding OCTEON TX crypto PMD skeleton. Updating the maintainers files to claim responsibility. Also enabling driver by default by adding the component in common_base. Signed-off-by: Ankur Dwivedi <ankur.dwivedi@caviumnetworks.com> Signed-off-by: Anoob Joseph <anoob.joseph@caviumnetworks.com> Signed-off-by: Murthy NSSR <nidadavolu.murthy@caviumnetworks.com> Signed-off-by: Nithin Dabilpuram <nithin.dabilpuram@caviumnetworks.com> Signed-off-by: Ragothaman Jayaraman <rjayaraman@caviumnetworks.com> Signed-off-by: Srisivasubramanian S <ssrinivasan@caviumnetworks.com> Signed-off-by: Tejasree Kondoj <kondoj.tejasree@caviumnetworks.com>
This commit is contained in:
parent
f1597231ac
commit
bfe2ae495e
@ -798,6 +798,11 @@ F: drivers/crypto/armv8/
|
||||
F: doc/guides/cryptodevs/armv8.rst
|
||||
F: doc/guides/cryptodevs/features/armv8.ini
|
||||
|
||||
Cavium OCTEON TX crypto
|
||||
M: Anoob Joseph <anoob.joseph@caviumnetworks.com>
|
||||
F: drivers/common/cpt/
|
||||
F: drivers/crypto/octeontx/
|
||||
|
||||
Crypto Scheduler
|
||||
M: Fan Zhang <roy.fan.zhang@intel.com>
|
||||
F: drivers/crypto/scheduler/
|
||||
|
@ -506,6 +506,11 @@ CONFIG_RTE_LIBRTE_PMD_DPAA2_SEC=n
|
||||
CONFIG_RTE_LIBRTE_PMD_DPAA_SEC=n
|
||||
CONFIG_RTE_LIBRTE_DPAA_MAX_CRYPTODEV=4
|
||||
|
||||
#
|
||||
# Compile PMD for Cavium OCTEON TX crypto device
|
||||
#
|
||||
CONFIG_RTE_LIBRTE_PMD_OCTEONTX_CRYPTO=y
|
||||
|
||||
#
|
||||
# Compile PMD for QuickAssist based devices - see docs for details
|
||||
#
|
||||
|
50
drivers/common/cpt/cpt_pmd_logs.h
Normal file
50
drivers/common/cpt/cpt_pmd_logs.h
Normal file
@ -0,0 +1,50 @@
|
||||
/* SPDX-License-Identifier: BSD-3-Clause
|
||||
* Copyright(c) 2018 Cavium, Inc
|
||||
*/
|
||||
|
||||
#ifndef _CPT_PMD_LOGS_H_
|
||||
#define _CPT_PMD_LOGS_H_
|
||||
|
||||
#include <rte_log.h>
|
||||
|
||||
/*
|
||||
* This file defines log macros
|
||||
*/
|
||||
|
||||
#define CPT_PMD_DRV_LOG_RAW(level, fmt, args...) \
|
||||
rte_log(RTE_LOG_ ## level, cpt_logtype, \
|
||||
"cpt: %s(): " fmt "\n", __func__, ##args)
|
||||
|
||||
#define CPT_PMD_INIT_FUNC_TRACE() CPT_PMD_DRV_LOG_RAW(DEBUG, " >>")
|
||||
|
||||
#define CPT_LOG_INFO(fmt, args...) \
|
||||
CPT_PMD_DRV_LOG_RAW(INFO, fmt, ## args)
|
||||
#define CPT_LOG_WARN(fmt, args...) \
|
||||
CPT_PMD_DRV_LOG_RAW(WARNING, fmt, ## args)
|
||||
#define CPT_LOG_ERR(fmt, args...) \
|
||||
CPT_PMD_DRV_LOG_RAW(ERR, fmt, ## args)
|
||||
|
||||
/*
|
||||
* DP logs, toggled out at compile time if level lower than current level.
|
||||
* DP logs would be logged under 'PMD' type. So for dynamic logging, the
|
||||
* level of 'pmd' has to be used.
|
||||
*/
|
||||
#define CPT_LOG_DP(level, fmt, args...) \
|
||||
RTE_LOG_DP(level, PMD, fmt "\n", ## args)
|
||||
|
||||
#define CPT_LOG_DP_DEBUG(fmt, args...) \
|
||||
CPT_LOG_DP(DEBUG, fmt, ## args)
|
||||
#define CPT_LOG_DP_INFO(fmt, args...) \
|
||||
CPT_LOG_DP(INFO, fmt, ## args)
|
||||
#define CPT_LOG_DP_WARN(fmt, args...) \
|
||||
CPT_LOG_DP(WARNING, fmt, ## args)
|
||||
#define CPT_LOG_DP_ERR(fmt, args...) \
|
||||
CPT_LOG_DP(ERR, fmt, ## args)
|
||||
|
||||
/*
|
||||
* cpt_logtype will be used for common logging. This field would be initialized
|
||||
* by otx_* driver routines during PCI probe.
|
||||
*/
|
||||
int cpt_logtype;
|
||||
|
||||
#endif /* _CPT_PMD_LOGS_H_ */
|
@ -7,6 +7,7 @@ DIRS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_GCM) += aesni_gcm
|
||||
DIRS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_MB) += aesni_mb
|
||||
DIRS-$(CONFIG_RTE_LIBRTE_PMD_ARMV8_CRYPTO) += armv8
|
||||
DIRS-$(CONFIG_RTE_LIBRTE_PMD_CCP) += ccp
|
||||
DIRS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX_CRYPTO) += octeontx
|
||||
DIRS-$(CONFIG_RTE_LIBRTE_PMD_OPENSSL) += openssl
|
||||
DIRS-$(CONFIG_RTE_LIBRTE_PMD_CRYPTO_SCHEDULER) += scheduler
|
||||
DIRS-$(CONFIG_RTE_LIBRTE_PMD_SNOW3G) += snow3g
|
||||
|
@ -2,7 +2,7 @@
|
||||
# Copyright(c) 2017 Intel Corporation
|
||||
|
||||
drivers = ['ccp', 'dpaa_sec', 'dpaa2_sec', 'mvsam',
|
||||
'null', 'openssl', 'qat', 'scheduler', 'virtio']
|
||||
'null', 'octeontx', 'openssl', 'qat', 'scheduler', 'virtio']
|
||||
|
||||
std_deps = ['cryptodev'] # cryptodev pulls in all other needed deps
|
||||
config_flag_fmt = 'RTE_LIBRTE_@0@_PMD'
|
||||
|
42
drivers/crypto/octeontx/Makefile
Normal file
42
drivers/crypto/octeontx/Makefile
Normal file
@ -0,0 +1,42 @@
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
# Copyright(c) 2018 Cavium, Inc
|
||||
#
|
||||
|
||||
include $(RTE_SDK)/mk/rte.vars.mk
|
||||
|
||||
# library name
|
||||
LIB = librte_pmd_octeontx_crypto.a
|
||||
|
||||
# library version
|
||||
LIBABIVER := 1
|
||||
|
||||
# build flags
|
||||
CFLAGS += $(WERROR_FLAGS)
|
||||
|
||||
LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
|
||||
LDLIBS += -lrte_cryptodev
|
||||
LDLIBS += -lrte_pci -lrte_bus_pci
|
||||
|
||||
VPATH += $(RTE_SDK)/drivers/crypto/octeontx
|
||||
|
||||
CFLAGS += -O3 -DCPT_MODEL=CRYPTO_OCTEONTX
|
||||
CFLAGS += -I$(RTE_SDK)/drivers/common/cpt
|
||||
|
||||
# PMD code
|
||||
SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX_CRYPTO) += otx_cryptodev.c
|
||||
SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX_CRYPTO) += otx_cryptodev_ops.c
|
||||
|
||||
# export include files
|
||||
SYMLINK-y-include +=
|
||||
|
||||
# versioning export map
|
||||
EXPORT_MAP := rte_pmd_octeontx_crypto_version.map
|
||||
|
||||
# library dependencies
|
||||
DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX_CRYPTO) += lib/librte_eal
|
||||
DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX_CRYPTO) += lib/librte_cryptodev
|
||||
DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX_CRYPTO) += lib/librte_mempool
|
||||
DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX_CRYPTO) += lib/librte_mbuf
|
||||
DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX_CRYPTO) += lib/librte_malloc
|
||||
|
||||
include $(RTE_SDK)/mk/rte.lib.mk
|
14
drivers/crypto/octeontx/meson.build
Normal file
14
drivers/crypto/octeontx/meson.build
Normal file
@ -0,0 +1,14 @@
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
# Copyright(c) 2018 Cavium, Inc
|
||||
if host_machine.system() != 'linux'
|
||||
build = false
|
||||
endif
|
||||
|
||||
deps += ['bus_pci']
|
||||
name = 'octeontx_crypto'
|
||||
|
||||
sources = files('otx_cryptodev.c',
|
||||
'otx_cryptodev_ops.c')
|
||||
|
||||
cflags += '-DCPT_MODEL=CRYPTO_OCTEONTX'
|
||||
includes += include_directories('../../common/cpt')
|
130
drivers/crypto/octeontx/otx_cryptodev.c
Normal file
130
drivers/crypto/octeontx/otx_cryptodev.c
Normal file
@ -0,0 +1,130 @@
|
||||
/* SPDX-License-Identifier: BSD-3-Clause
|
||||
* Copyright(c) 2018 Cavium, Inc
|
||||
*/
|
||||
|
||||
#include <rte_bus_pci.h>
|
||||
#include <rte_common.h>
|
||||
#include <rte_cryptodev.h>
|
||||
#include <rte_cryptodev_pmd.h>
|
||||
#include <rte_log.h>
|
||||
#include <rte_pci.h>
|
||||
|
||||
/* CPT common headers */
|
||||
#include "cpt_pmd_logs.h"
|
||||
|
||||
#include "otx_cryptodev.h"
|
||||
#include "otx_cryptodev_ops.h"
|
||||
|
||||
static int otx_cryptodev_logtype;
|
||||
|
||||
static struct rte_pci_id pci_id_cpt_table[] = {
|
||||
{
|
||||
RTE_PCI_DEVICE(PCI_VENDOR_ID_CAVIUM, CPT_81XX_PCI_VF_DEVICE_ID),
|
||||
},
|
||||
/* sentinel */
|
||||
{
|
||||
.device_id = 0
|
||||
},
|
||||
};
|
||||
|
||||
static void
|
||||
otx_cpt_logtype_init(void)
|
||||
{
|
||||
cpt_logtype = otx_cryptodev_logtype;
|
||||
}
|
||||
|
||||
static int
|
||||
otx_cpt_pci_probe(struct rte_pci_driver *pci_drv,
|
||||
struct rte_pci_device *pci_dev)
|
||||
{
|
||||
struct rte_cryptodev *cryptodev;
|
||||
char name[RTE_CRYPTODEV_NAME_MAX_LEN];
|
||||
int retval;
|
||||
|
||||
if (pci_drv == NULL)
|
||||
return -ENODEV;
|
||||
|
||||
rte_pci_device_name(&pci_dev->addr, name, sizeof(name));
|
||||
|
||||
cryptodev = rte_cryptodev_pmd_allocate(name, rte_socket_id());
|
||||
if (cryptodev == NULL)
|
||||
return -ENOMEM;
|
||||
|
||||
cryptodev->device = &pci_dev->device;
|
||||
cryptodev->device->driver = &pci_drv->driver;
|
||||
cryptodev->driver_id = otx_cryptodev_driver_id;
|
||||
|
||||
/* init user callbacks */
|
||||
TAILQ_INIT(&(cryptodev->link_intr_cbs));
|
||||
|
||||
/* init logtype used in common */
|
||||
otx_cpt_logtype_init();
|
||||
|
||||
/* Invoke PMD device initialization function */
|
||||
retval = otx_cpt_dev_create(cryptodev);
|
||||
if (retval == 0)
|
||||
return 0;
|
||||
|
||||
CPT_LOG_ERR("[DRV %s]: Failed to create device "
|
||||
"(vendor_id: 0x%x device_id: 0x%x",
|
||||
pci_drv->driver.name,
|
||||
(unsigned int) pci_dev->id.vendor_id,
|
||||
(unsigned int) pci_dev->id.device_id);
|
||||
|
||||
cryptodev->attached = RTE_CRYPTODEV_DETACHED;
|
||||
|
||||
return -ENXIO;
|
||||
}
|
||||
|
||||
static int
|
||||
otx_cpt_pci_remove(struct rte_pci_device *pci_dev)
|
||||
{
|
||||
struct rte_cryptodev *cryptodev;
|
||||
char name[RTE_CRYPTODEV_NAME_MAX_LEN];
|
||||
|
||||
if (pci_dev == NULL)
|
||||
return -EINVAL;
|
||||
|
||||
rte_pci_device_name(&pci_dev->addr, name, sizeof(name));
|
||||
|
||||
cryptodev = rte_cryptodev_pmd_get_named_dev(name);
|
||||
if (cryptodev == NULL)
|
||||
return -ENODEV;
|
||||
|
||||
if (pci_dev->driver == NULL)
|
||||
return -ENODEV;
|
||||
|
||||
/* free crypto device */
|
||||
rte_cryptodev_pmd_release_device(cryptodev);
|
||||
|
||||
if (rte_eal_process_type() == RTE_PROC_PRIMARY)
|
||||
rte_free(cryptodev->data->dev_private);
|
||||
|
||||
cryptodev->device = NULL;
|
||||
cryptodev->device->driver = NULL;
|
||||
cryptodev->data = NULL;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct rte_pci_driver otx_cryptodev_pmd = {
|
||||
.id_table = pci_id_cpt_table,
|
||||
.drv_flags = RTE_PCI_DRV_NEED_MAPPING,
|
||||
.probe = otx_cpt_pci_probe,
|
||||
.remove = otx_cpt_pci_remove,
|
||||
};
|
||||
|
||||
static struct cryptodev_driver otx_cryptodev_drv;
|
||||
|
||||
RTE_PMD_REGISTER_PCI(CRYPTODEV_NAME_OCTEONTX_PMD, otx_cryptodev_pmd);
|
||||
RTE_PMD_REGISTER_PCI_TABLE(CRYPTODEV_NAME_OCTEONTX_PMD, pci_id_cpt_table);
|
||||
RTE_PMD_REGISTER_CRYPTO_DRIVER(otx_cryptodev_drv, otx_cryptodev_pmd.driver,
|
||||
otx_cryptodev_driver_id);
|
||||
|
||||
RTE_INIT(otx_cpt_init_log)
|
||||
{
|
||||
/* Bus level logs */
|
||||
otx_cryptodev_logtype = rte_log_register("pmd.crypto.octeontx");
|
||||
if (otx_cryptodev_logtype >= 0)
|
||||
rte_log_set_level(otx_cryptodev_logtype, RTE_LOG_NOTICE);
|
||||
}
|
20
drivers/crypto/octeontx/otx_cryptodev.h
Normal file
20
drivers/crypto/octeontx/otx_cryptodev.h
Normal file
@ -0,0 +1,20 @@
|
||||
/* SPDX-License-Identifier: BSD-3-Clause
|
||||
* Copyright(c) 2018 Cavium, Inc
|
||||
*/
|
||||
|
||||
#ifndef _OTX_CRYPTODEV_H_
|
||||
#define _OTX_CRYPTODEV_H_
|
||||
|
||||
/* Cavium OCTEON TX crypto PMD device name */
|
||||
#define CRYPTODEV_NAME_OCTEONTX_PMD crypto_octeontx
|
||||
|
||||
/* Device ID */
|
||||
#define PCI_VENDOR_ID_CAVIUM 0x177d
|
||||
#define CPT_81XX_PCI_VF_DEVICE_ID 0xa041
|
||||
|
||||
/*
|
||||
* Crypto device driver ID
|
||||
*/
|
||||
uint8_t otx_cryptodev_driver_id;
|
||||
|
||||
#endif /* _OTX_CRYPTODEV_H_ */
|
15
drivers/crypto/octeontx/otx_cryptodev_ops.c
Normal file
15
drivers/crypto/octeontx/otx_cryptodev_ops.c
Normal file
@ -0,0 +1,15 @@
|
||||
/* SPDX-License-Identifier: BSD-3-Clause
|
||||
* Copyright(c) 2018 Cavium, Inc
|
||||
*/
|
||||
|
||||
#include <rte_cryptodev.h>
|
||||
|
||||
#include "otx_cryptodev.h"
|
||||
#include "otx_cryptodev_ops.h"
|
||||
|
||||
int
|
||||
otx_cpt_dev_create(struct rte_cryptodev *c_dev)
|
||||
{
|
||||
RTE_SET_USED(c_dev);
|
||||
return 0;
|
||||
}
|
11
drivers/crypto/octeontx/otx_cryptodev_ops.h
Normal file
11
drivers/crypto/octeontx/otx_cryptodev_ops.h
Normal file
@ -0,0 +1,11 @@
|
||||
/* SPDX-License-Identifier: BSD-3-Clause
|
||||
* Copyright(c) 2018 Cavium, Inc
|
||||
*/
|
||||
|
||||
#ifndef _OTX_CRYPTODEV_OPS_H_
|
||||
#define _OTX_CRYPTODEV_OPS_H_
|
||||
|
||||
int
|
||||
otx_cpt_dev_create(struct rte_cryptodev *c_dev);
|
||||
|
||||
#endif /* _OTX_CRYPTODEV_OPS_H_ */
|
@ -0,0 +1,4 @@
|
||||
DPDK_18.11 {
|
||||
|
||||
local: *;
|
||||
};
|
@ -227,6 +227,7 @@ _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_ZUC) += -L$(LIBSSO_ZUC_PATH)/build -lsso
|
||||
_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_ARMV8_CRYPTO) += -lrte_pmd_armv8
|
||||
_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_ARMV8_CRYPTO) += -L$(ARMV8_CRYPTO_LIB_PATH) -larmv8_crypto
|
||||
_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_MVSAM_CRYPTO) += -L$(LIBMUSDK_PATH)/lib -lrte_pmd_mvsam_crypto -lmusdk
|
||||
_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX_CRYPTO) += -lrte_pmd_octeontx_crypto
|
||||
_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_CRYPTO_SCHEDULER) += -lrte_pmd_crypto_scheduler
|
||||
ifeq ($(CONFIG_RTE_EAL_VFIO)$(CONFIG_RTE_LIBRTE_FSLMC_BUS),yy)
|
||||
_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_DPAA2_SEC) += -lrte_pmd_dpaa2_sec
|
||||
|
Loading…
Reference in New Issue
Block a user