Skip to contentSkip to conversation

add OCTEON TX2 crypto PMD

PATCH Superseded Anoob Joseph 5 participants 53 messages Aug 30, 2019 – Oct 17, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover add OCTEON TX2 crypto PMD

This series introduces poll mode driver to enable crypto offload engine on Marvell OCTEON TX2 SoC.

Ankur Dwivedi (5):
crypto/octeontx2: add PMD skeleton
crypto/octeontx2: add device control ops
crypto/octeontx2: add hardware definitions
crypto/octeontx2: add session related functions
crypto/octeontx2: add dequeue burst

Anoob Joseph (6):
crypto/octeontx2: add device init sequence in probe crypto/octeontx2: add symmetric capabilities crypto/octeontx2: add queue pair functions crypto/octeontx2: add enqueue burst
test: add OCTEON TX2 tests
doc: add documentation for OCTEON TX2 crypto PMD

 MAINTAINERS                                        |   7 +
 app/test/meson.build                               |   1 +
 app/test/test_cryptodev.c                          | 323 ++++++++
 app/test/test_cryptodev.h                          |   1 +
 app/test/test_cryptodev_aes_test_vectors.h         | 112 ++-
 app/test/test_cryptodev_blockcipher.c              |   7 +
 app/test/test_cryptodev_blockcipher.h              |   1 +
 app/test/test_cryptodev_des_test_vectors.h         |  12 +-
 app/test/test_cryptodev_hash_test_vectors.h        |  75 +-
 config/common_base                                 |   5 +
 doc/guides/cryptodevs/features/octeontx2.ini       |  62 ++
 doc/guides/cryptodevs/index.rst                    |   1 +
 doc/guides/cryptodevs/octeontx2.rst                | 142 ++++
 doc/guides/platform/octeontx2.rst                  |   3 +
 drivers/common/Makefile                            |   5 +-
 drivers/common/cpt/cpt_hw_types.h                  |  52 ++
 drivers/common/cpt/cpt_mcode_defines.h             |   2 +
 drivers/crypto/Makefile                            |   1 +
 drivers/crypto/meson.build                         |   4 +-
 drivers/crypto/octeontx2/Makefile                  |  50 ++
 drivers/crypto/octeontx2/meson.build               |  34 +
 drivers/crypto/octeontx2/otx2_cryptodev.c          | 158 ++++
 drivers/crypto/octeontx2/otx2_cryptodev.h          |  39 +
 .../crypto/octeontx2/otx2_cryptodev_capabilities.c | 604 +++++++++++++++
 .../crypto/octeontx2/otx2_cryptodev_capabilities.h |  16 +
 .../crypto/octeontx2/otx2_cryptodev_hw_access.c    | 225 ++++++
 .../crypto/octeontx2/otx2_cryptodev_hw_access.h    | 223 ++++++
 drivers/crypto/octeontx2/otx2_cryptodev_mbox.c     | 175 +++++
 drivers/crypto/octeontx2/otx2_cryptodev_mbox.h     |  25 +
 drivers/crypto/octeontx2/otx2_cryptodev_ops.c      | 839 +++++++++++++++++++++
 drivers/crypto/octeontx2/otx2_cryptodev_ops.h      |  20 +
 .../octeontx2/rte_pmd_octeontx2_crypto_version.map |   4 +
 mk/rte.app.mk                                      |   6 +-
 33 files changed, 3164 insertions(+), 70 deletions(-)
 create mode 100644 doc/guides/cryptodevs/features/octeontx2.ini
 create mode 100644 doc/guides/cryptodevs/octeontx2.rst
 create mode 100644 drivers/crypto/octeontx2/Makefile
 create mode 100644 drivers/crypto/octeontx2/meson.build
 create mode 100644 drivers/crypto/octeontx2/otx2_cryptodev.c
 create mode 100644 drivers/crypto/octeontx2/otx2_cryptodev.h
 create mode 100644 drivers/crypto/octeontx2/otx2_cryptodev_capabilities.c
 create mode 100644 drivers/crypto/octeontx2/otx2_cryptodev_capabilities.h
 create mode 100644 drivers/crypto/octeontx2/otx2_cryptodev_hw_access.c
 create mode 100644 drivers/crypto/octeontx2/otx2_cryptodev_hw_access.h
 create mode 100644 drivers/crypto/octeontx2/otx2_cryptodev_mbox.c
 create mode 100644 drivers/crypto/octeontx2/otx2_cryptodev_mbox.h
 create mode 100644 drivers/crypto/octeontx2/otx2_cryptodev_ops.c
 create mode 100644 drivers/crypto/octeontx2/otx2_cryptodev_ops.h
 create mode 100644 drivers/crypto/octeontx2/rte_pmd_octeontx2_crypto_version.map
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/11 crypto/octeontx2: add PMD skeleton

From: Ankur Dwivedi <[email protected]>

Adding OCTEON TX2 crypto PMD skeleton. Enabling the driver by default in common_base.

---
 config/common_base                                 |   5 +
 drivers/common/Makefile                            |   5 +-
 drivers/crypto/Makefile                            |   1 +
 drivers/crypto/meson.build                         |   4 +-
 drivers/crypto/octeontx2/Makefile                  |  37 +++++++
 drivers/crypto/octeontx2/meson.build               |  29 +++++
 drivers/crypto/octeontx2/otx2_cryptodev.c          | 118 +++++++++++++++++++++
 drivers/crypto/octeontx2/otx2_cryptodev.h          |  25 +++++
 drivers/crypto/octeontx2/otx2_cryptodev_ops.c      |  27 +++++
 drivers/crypto/octeontx2/otx2_cryptodev_ops.h      |  12 +++
 .../octeontx2/rte_pmd_octeontx2_crypto_version.map |   4 +
 mk/rte.app.mk                                      |   6 +-
 12 files changed, 269 insertions(+), 4 deletions(-)
 create mode 100644 drivers/crypto/octeontx2/Makefile
 create mode 100644 drivers/crypto/octeontx2/meson.build
 create mode 100644 drivers/crypto/octeontx2/otx2_cryptodev.c
 create mode 100644 drivers/crypto/octeontx2/otx2_cryptodev.h
 create mode 100644 drivers/crypto/octeontx2/otx2_cryptodev_ops.c
 create mode 100644 drivers/crypto/octeontx2/otx2_cryptodev_ops.h
 create mode 100644 drivers/crypto/octeontx2/rte_pmd_octeontx2_crypto_version.map
config/common_base +5 -0
index 8ef75c2..b8143ea 100644
@@ -593,6 +593,11 @@ CONFIG_RTE_LIBRTE_DPAA_MAX_CRYPTODEV=4
 CONFIG_RTE_LIBRTE_PMD_OCTEONTX_CRYPTO=y
 
 #
+# Compile PMD for Marvell OCTEON TX2 crypto device
+#
+CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_CRYPTO=y
+
+#
 # Compile PMD for QuickAssist based devices - see docs for details
 #
 CONFIG_RTE_LIBRTE_PMD_QAT=y
drivers/common/Makefile +4 -1
index bc6f972..1ff033b 100644
@@ -4,7 +4,9 @@
 
 include $(RTE_SDK)/mk/rte.vars.mk
 
-ifeq ($(CONFIG_RTE_LIBRTE_PMD_OCTEONTX_CRYPTO),y)
+CPT-y := $(CONFIG_RTE_LIBRTE_PMD_OCTEONTX_CRYPTO)
+CPT-y += $(CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_CRYPTO)
+ifneq (,$(findstring y,$(CPT-y)))
 DIRS-y += cpt
 endif
 
@@ -12,6 +14,7 @@ ifeq ($(CONFIG_RTE_LIBRTE_PMD_OCTEONTX_SSOVF)$(CONFIG_RTE_LIBRTE_OCTEONTX_MEMPOO
 DIRS-y += octeontx
 endif
 OCTEONTX2-y := $(CONFIG_RTE_LIBRTE_OCTEONTX2_MEMPOOL)
+OCTEONTX2-y += $(CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_CRYPTO)
 ifeq ($(findstring y,$(OCTEONTX2-y)),y)
 DIRS-y += octeontx2
 endif
drivers/crypto/Makefile +1 -0
index 009f844..0ac999c 100644
@@ -8,6 +8,7 @@ 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_OCTEONTX2_CRYPTO) += octeontx2
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_OPENSSL) += openssl
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_CRYPTO_SCHEDULER) += scheduler
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_SNOW3G) += snow3g
drivers/crypto/meson.build +2 -2
index 83e7886..3c88f3c 100644
@@ -2,8 +2,8 @@
 # Copyright(c) 2017 Intel Corporation
 
 drivers = ['aesni_gcm', 'aesni_mb', 'caam_jr', 'ccp', 'dpaa_sec', 'dpaa2_sec',
-	'kasumi', 'mvsam', 'null', 'octeontx', 'openssl', 'qat', 'scheduler',
-	'snow3g', 'virtio', 'zuc']
+	'kasumi', 'mvsam', 'null', 'octeontx', 'octeontx2', 'openssl', 'qat',
+	'scheduler', 'snow3g', 'virtio', 'zuc']
 
 std_deps = ['cryptodev'] # cryptodev pulls in all other needed deps
 config_flag_fmt = 'RTE_LIBRTE_@0@_PMD'
drivers/crypto/octeontx2/Makefile new file +37 -0
new file mode 100644
index 0000000..3273178
@@ -0,0 +1,37 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright (C) 2019 Marvell International Ltd.
+#
+
+include $(RTE_SDK)/mk/rte.vars.mk
+
+# library name
+LIB = librte_pmd_octeontx2_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
+LDLIBS += -lrte_common_cpt -lrte_common_octeontx2
+
+VPATH += $(RTE_SDK)/drivers/crypto/octeontx2
+
+CFLAGS += -O3
+CFLAGS += -I$(RTE_SDK)/drivers/common/cpt
+CFLAGS += -I$(RTE_SDK)/drivers/common/octeontx2
+
+# PMD code
+SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_CRYPTO) += otx2_cryptodev.c
+SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_CRYPTO) += otx2_cryptodev_ops.c
+
+# export include files
+SYMLINK-y-include +=
+
+# versioning export map
+EXPORT_MAP := rte_pmd_octeontx2_crypto_version.map
+
+include $(RTE_SDK)/mk/rte.lib.mk
drivers/crypto/octeontx2/meson.build new file +29 -0
new file mode 100644
index 0000000..2b55d2a
@@ -0,0 +1,29 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright (C) 2019 Marvell International Ltd.
+
+if host_machine.system() != 'linux'
+        build = false
+endif
+
+deps += ['bus_pci']
+deps += ['common_cpt']
+deps += ['common_octeontx2']
+name = 'octeontx2_crypto'
+
+sources = files('otx2_cryptodev.c',
+		'otx2_cryptodev_ops.c')
+
+extra_flags = []
+# This integrated controller runs only on a arm64 machine, remove 32bit warnings
+if not dpdk_conf.get('RTE_ARCH_64')
+	extra_flags += ['-Wno-int-to-pointer-cast', '-Wno-pointer-to-int-cast']
+endif
+
+foreach flag: extra_flags
+	if cc.has_argument(flag)
+		cflags += flag
+	endif
+endforeach
+
+includes += include_directories('../../common/cpt')
+includes += include_directories('../../common/octeontx2')
drivers/crypto/octeontx2/otx2_cryptodev.c new file +118 -0

118 lines not on this page · raw message

drivers/crypto/octeontx2/otx2_cryptodev.h new file +25 -0
new file mode 100644
index 0000000..da0f653
@@ -0,0 +1,25 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (C) 2019 Marvell International Ltd.
+ */
+
+#ifndef _OTX2_CRYPTODEV_H_
+#define _OTX2_CRYPTODEV_H_
+
+#include "cpt_common.h"
+
+/* Marvell OCTEON TX2 Crypto PMD device name */
+#define CRYPTODEV_NAME_OCTEONTX2_PMD	crypto_octeontx2
+
+/**
+ * Device private data
+ */
+struct otx2_cpt_vf {
+	/* To be populated */
+};
+
+/*
+ * Crypto device driver ID
+ */
+uint8_t otx2_cryptodev_driver_id;
+
+#endif /* _OTX2_CRYPTODEV_H_ */
drivers/crypto/octeontx2/otx2_cryptodev_ops.c new file +27 -0
new file mode 100644
index 0000000..18ad470
@@ -0,0 +1,27 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (C) 2019 Marvell International Ltd.
+ */
+
+#include <rte_cryptodev_pmd.h>
+
+#include "otx2_cryptodev_ops.h"
+
+struct rte_cryptodev_ops otx2_cpt_ops = {
+	/* Device control ops */
+	.dev_configure = NULL,
+	.dev_start = NULL,
+	.dev_stop = NULL,
+	.dev_close = NULL,
+	.dev_infos_get = NULL,
+
+	.stats_get = NULL,
+	.stats_reset = NULL,
+	.queue_pair_setup = NULL,
+	.queue_pair_release = NULL,
+	.queue_pair_count = NULL,
+
+	/* Symmetric crypto ops */
+	.sym_session_get_size = NULL,
+	.sym_session_configure = NULL,
+	.sym_session_clear = NULL,
+};
drivers/crypto/octeontx2/otx2_cryptodev_ops.h new file +12 -0
new file mode 100644
index 0000000..545614e
@@ -0,0 +1,12 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (C) 2019 Marvell International Ltd.
+ */
+
+#ifndef _OTX2_CRYPTODEV_OPS_H_
+#define _OTX2_CRYPTODEV_OPS_H_
+
+#include <rte_cryptodev_pmd.h>
+
+struct rte_cryptodev_ops otx2_cpt_ops;
+
+#endif /* _OTX2_CRYPTODEV_OPS_H_ */
drivers/crypto/octeontx2/rte_pmd_octeontx2_crypto_version.map new file +4 -0
new file mode 100644
index 0000000..9a61188
@@ -0,0 +1,4 @@
+DPDK_19.08 {
+
+	local: *;
+};
mk/rte.app.mk +5 -1
index ba5c39e..f85e50e 100644
@@ -101,7 +101,9 @@ ifeq ($(CONFIG_RTE_EXEC_ENV_LINUX),y)
 _LDLIBS-$(CONFIG_RTE_LIBRTE_KNI)            += -lrte_kni
 endif
 
-ifeq ($(CONFIG_RTE_LIBRTE_PMD_OCTEONTX_CRYPTO),y)
+OTX-CPT-y := $(CONFIG_RTE_LIBRTE_PMD_OCTEONTX_CRYPTO)
+OTX-CPT-y += $(CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_CRYPTO)
+ifeq ($(findstring y,$(OTX-CPT-y)),y)
 _LDLIBS-y += -lrte_common_cpt
 endif
 
@@ -109,6 +111,7 @@ ifeq ($(CONFIG_RTE_LIBRTE_PMD_OCTEONTX_SSOVF)$(CONFIG_RTE_LIBRTE_OCTEONTX_MEMPOO
 _LDLIBS-y += -lrte_common_octeontx
 endif
 OCTEONTX2-y := $(CONFIG_RTE_LIBRTE_OCTEONTX2_MEMPOOL)
+OCTEONTX2-y += $(CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_CRYPTO)
 OCTEONTX2-y += $(CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_EVENTDEV)
 OCTEONTX2-y += $(CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_DMA_RAWDEV)
 OCTEONTX2-y += $(CONFIG_RTE_LIBRTE_OCTEONTX2_PMD)
@@ -268,6 +271,7 @@ _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_OCTEONTX2_CRYPTO) += -lrte_pmd_octeontx2_crypto
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_CRYPTO_SCHEDULER) += -lrte_pmd_crypto_scheduler
 ifeq ($(CONFIG_RTE_LIBRTE_SECURITY),y)
 ifeq ($(CONFIG_RTE_EAL_VFIO)$(CONFIG_RTE_LIBRTE_FSLMC_BUS),yy)
Signature · 1 line
2.7.4
#2 lore raw

Re: [dpdk-dev] [PATCH 01/11] crypto/octeontx2: add PMD skeleton

Hi Anoob,

drivers/crypto/meson.build line 7

Quoted 13 lines
drivers/crypto/meson.build +2 -2
index 83e7886..3c88f3c 100644
@@ -2,8 +2,8 @@
 # Copyright(c) 2017 Intel Corporation
 
 drivers = ['aesni_gcm', 'aesni_mb', 'caam_jr', 'ccp', 'dpaa_sec', 'dpaa2_sec',
-	'kasumi', 'mvsam', 'null', 'octeontx', 'openssl', 'qat', 'scheduler',
-	'snow3g', 'virtio', 'zuc']
+	'kasumi', 'mvsam', 'null', 'octeontx', 'octeontx2', 'openssl', 'qat',
+	'scheduler', 'snow3g', 'virtio', 'zuc']
 

Could you please rearrange this list as every pmd in a separate line as it is there in net/meson.build.

Every time a new PMD is added people need to realign this list.

drivers/crypto/meson.build line 9

Quoted 2 lines
drivers/crypto/meson.build +0 -0
 std_deps = ['cryptodev'] # cryptodev pulls in all other needed deps
 config_flag_fmt = 'RTE_LIBRTE_@0@_PMD'

Regards,
Akhil

#3 lore raw

Re: [dpdk-dev] [PATCH 01/11] crypto/octeontx2: add PMD skeleton

Hi Akhil,

Quoted 30 lines

-----Original Message-----
From: Akhil Goyal <[email protected]>
Sent: Friday, October 4, 2019 4:52 PM
To: Anoob Joseph <[email protected]>; Pablo de Lara <[email protected]>; Thomas Monjalon <[email protected]>
Cc: Ankur Dwivedi <[email protected]>; Jerin Jacob Kollanukkaran <[email protected]>; Narayana Prasad Raju Athreya <[email protected]>; Tejasree Kondoj <[email protected]>; [email protected]
Subject: RE: [PATCH 01/11] crypto/octeontx2: add PMD skeleton

Hi Anoob,

drivers/crypto/meson.build line 7

Quoted 13 lines
drivers/crypto/meson.build +2 -2
index 83e7886..3c88f3c 100644
@@ -2,8 +2,8 @@
 # Copyright(c) 2017 Intel Corporation
 
 drivers = ['aesni_gcm', 'aesni_mb', 'caam_jr', 'ccp', 'dpaa_sec', 'dpaa2_sec',
-	'kasumi', 'mvsam', 'null', 'octeontx', 'openssl', 'qat', 'scheduler',
-	'snow3g', 'virtio', 'zuc']
+	'kasumi', 'mvsam', 'null', 'octeontx', 'octeontx2', 'openssl', 'qat',
+	'scheduler', 'snow3g', 'virtio', 'zuc']
 

Could you please rearrange this list as every pmd in a separate line as it is there in net/meson.build.

Quoted 7 lines

Every time a new PMD is added people need to realign this list.

Quoted 2 lines
drivers/crypto/meson.build +0 -0
 std_deps = ['cryptodev'] # cryptodev pulls in all other needed deps

config_flag_fmt = 'RTE_LIBRTE_@0@_PMD'

Regards,
Akhil

Will make the suggested change.

Thanks,
Anoob

#4 lore raw

PATCH 2/11 crypto/octeontx2: add device init sequence in probe

In reply to Anoob Joseph

This patch adds the device init sequence for OCTEON TX2 crypto device.

---
 drivers/crypto/octeontx2/Makefile              | 10 +++++++
 drivers/crypto/octeontx2/meson.build           |  2 ++
 drivers/crypto/octeontx2/otx2_cryptodev.c      | 40 ++++++++++++++++++++++++++
 drivers/crypto/octeontx2/otx2_cryptodev.h      | 10 ++++++-
 drivers/crypto/octeontx2/otx2_cryptodev_mbox.c | 30 +++++++++++++++++++
 drivers/crypto/octeontx2/otx2_cryptodev_mbox.h | 13 +++++++++
 6 files changed, 104 insertions(+), 1 deletion(-)
 create mode 100644 drivers/crypto/octeontx2/otx2_cryptodev_mbox.c
 create mode 100644 drivers/crypto/octeontx2/otx2_cryptodev_mbox.h
drivers/crypto/octeontx2/Makefile +10 -0
index 3273178..10d8c39 100644
@@ -23,9 +23,19 @@ VPATH += $(RTE_SDK)/drivers/crypto/octeontx2
 CFLAGS += -O3
 CFLAGS += -I$(RTE_SDK)/drivers/common/cpt
 CFLAGS += -I$(RTE_SDK)/drivers/common/octeontx2
+CFLAGS += -I$(RTE_SDK)/drivers/mempool/octeontx2
+
+ifneq ($(CONFIG_RTE_ARCH_64),y)
+CFLAGS += -Wno-int-to-pointer-cast
+CFLAGS += -Wno-pointer-to-int-cast
+ifeq ($(CONFIG_RTE_TOOLCHAIN_ICC),y)
+CFLAGS += -diag-disable 2259
+endif
+endif
 
 # PMD code
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_CRYPTO) += otx2_cryptodev.c
+SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_CRYPTO) += otx2_cryptodev_mbox.c
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_CRYPTO) += otx2_cryptodev_ops.c
 
 # export include files
drivers/crypto/octeontx2/meson.build +2 -0
index 2b55d2a..845d50d 100644
@@ -11,6 +11,7 @@ deps += ['common_octeontx2']
 name = 'octeontx2_crypto'
 
 sources = files('otx2_cryptodev.c',
+		'otx2_cryptodev_mbox.c',
 		'otx2_cryptodev_ops.c')
 
 extra_flags = []
@@ -27,3 +28,4 @@ endforeach
 
 includes += include_directories('../../common/cpt')
 includes += include_directories('../../common/octeontx2')
+includes += include_directories('../../mempool/octeontx2')
drivers/crypto/octeontx2/otx2_cryptodev.c +40 -0
index cf3a010..814b9ed 100644
@@ -18,7 +18,9 @@
 
 #include "otx2_common.h"
 #include "otx2_cryptodev.h"
+#include "otx2_cryptodev_mbox.h"
 #include "otx2_cryptodev_ops.h"
+#include "otx2_dev.h"
 
 static int otx2_cryptodev_logtype;
 
@@ -44,6 +46,9 @@ otx2_cpt_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
 	};
 	char name[RTE_CRYPTODEV_NAME_MAX_LEN];
 	struct rte_cryptodev *dev;
+	struct otx2_dev *otx2_dev;
+	struct otx2_cpt_vf *vf;
+	uint16_t nb_queues;
 	int ret;
 
 	/* Initialize logtype used in common */
@@ -61,6 +66,37 @@ otx2_cpt_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
 
 	dev->driver_id = otx2_cryptodev_driver_id;
 
+	/* Get private data space allocated */
+	vf = dev->data->dev_private;
+
+	otx2_dev = &vf->otx2_dev;
+
+	/* Initialize the base otx2_dev object */
+	ret = otx2_dev_init(pci_dev, otx2_dev);
+	if (ret) {
+		CPT_LOG_ERR("Could not initialize otx2_dev");
+		goto pmd_destroy;
+	}
+
+	/* Get number of queues available on the device */
+	ret = otx2_cpt_available_queues_get(dev, &nb_queues);
+	if (ret) {
+		CPT_LOG_ERR("Could not determine the number of queues available");
+		goto otx2_dev_fini;
+	}
+
+	/* Don't exceed the limits set per VF */
+	nb_queues = RTE_MIN(nb_queues, OTX2_CPT_MAX_QUEUES_PER_VF);
+
+	if (nb_queues == 0) {
+		CPT_LOG_ERR("No free queues available on the device");
+		goto otx2_dev_fini;
+	}
+
+	vf->max_queues = nb_queues;
+
+	CPT_LOG_INFO("Max queues supported by device: %d", vf->max_queues);
+
 	dev->feature_flags = RTE_CRYPTODEV_FF_SYMMETRIC_CRYPTO |
 			     RTE_CRYPTODEV_FF_HW_ACCELERATED |
 			     RTE_CRYPTODEV_FF_SYM_OPERATION_CHAINING |
@@ -70,6 +106,10 @@ otx2_cpt_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
 
 	return 0;
 
+otx2_dev_fini:
+	otx2_dev_fini(pci_dev, otx2_dev);
+pmd_destroy:
+	rte_cryptodev_pmd_destroy(dev);
 exit:
 	CPT_LOG_ERR("Could not create device (vendor_id: 0x%x device_id: 0x%x)",
 		    pci_dev->id.vendor_id, pci_dev->id.device_id);
drivers/crypto/octeontx2/otx2_cryptodev.h +9 -1
index da0f653..531bd6d 100644
@@ -7,14 +7,22 @@
 
 #include "cpt_common.h"
 
+#include "otx2_dev.h"
+
 /* Marvell OCTEON TX2 Crypto PMD device name */
 #define CRYPTODEV_NAME_OCTEONTX2_PMD	crypto_octeontx2
 
+#define OTX2_CPT_MAX_LFS		64
+#define OTX2_CPT_MAX_QUEUES_PER_VF	64
+
 /**
  * Device private data
  */
 struct otx2_cpt_vf {
-	/* To be populated */
+	struct otx2_dev otx2_dev;
+	/**< Base class */
+	uint16_t max_queues;
+	/**< Max queues supported */
 };
 
 /*
drivers/crypto/octeontx2/otx2_cryptodev_mbox.c new file +30 -0
new file mode 100644
index 0000000..48d86ef
@@ -0,0 +1,30 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (C) 2019 Marvell International Ltd.
+ */
+#include <rte_cryptodev.h>
+
+#include "cpt_pmd_logs.h"
+
+#include "otx2_cryptodev.h"
+#include "otx2_cryptodev_mbox.h"
+#include "otx2_dev.h"
+#include "otx2_mbox.h"
+
+int
+otx2_cpt_available_queues_get(const struct rte_cryptodev *dev,
+			      uint16_t *nb_queues)
+{
+	struct otx2_cpt_vf *vf = dev->data->dev_private;
+	struct otx2_dev *otx2_dev = &vf->otx2_dev;
+	struct free_rsrcs_rsp *rsp;
+	int ret;
+
+	otx2_mbox_alloc_msg_free_rsrc_cnt(otx2_dev->mbox);
+
+	ret = otx2_mbox_process_msg(otx2_dev->mbox, (void *)&rsp);
+	if (ret)
+		return -EIO;
+
+	*nb_queues = rsp->cpt;
+	return 0;
+}
drivers/crypto/octeontx2/otx2_cryptodev_mbox.h new file +13 -0
new file mode 100644
index 0000000..648c009
@@ -0,0 +1,13 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (C) 2019 Marvell International Ltd.
+ */
+
+#ifndef _OTX2_CRYPTODEV_MBOX_H_
+#define _OTX2_CRYPTODEV_MBOX_H_
+
+#include <rte_cryptodev.h>
+
+int otx2_cpt_available_queues_get(const struct rte_cryptodev *dev,
+				  uint16_t *nb_queues);
+
+#endif /* _OTX2_CRYPTODEV_MBOX_H_ */
Signature · 1 line
2.7.4
#5 lore raw

PATCH 3/11 crypto/octeontx2: add device control ops

In reply to Anoob Joseph

From: Ankur Dwivedi <[email protected]>

This patch adds the device control functions.

---
 drivers/crypto/octeontx2/Makefile                  |   1 +
 drivers/crypto/octeontx2/meson.build               |   1 +
 drivers/crypto/octeontx2/otx2_cryptodev.h          |   6 +
 .../crypto/octeontx2/otx2_cryptodev_hw_access.c    | 126 +++++++++++++++++++++
 .../crypto/octeontx2/otx2_cryptodev_hw_access.h    |  27 +++++
 drivers/crypto/octeontx2/otx2_cryptodev_mbox.c     |  64 +++++++++++
 drivers/crypto/octeontx2/otx2_cryptodev_mbox.h     |   6 +
 drivers/crypto/octeontx2/otx2_cryptodev_ops.c      | 123 +++++++++++++++++++-
 drivers/crypto/octeontx2/otx2_cryptodev_ops.h      |   3 +
 9 files changed, 352 insertions(+), 5 deletions(-)
 create mode 100644 drivers/crypto/octeontx2/otx2_cryptodev_hw_access.c
 create mode 100644 drivers/crypto/octeontx2/otx2_cryptodev_hw_access.h
drivers/crypto/octeontx2/Makefile +1 -0
index 10d8c39..71bc4d1 100644
@@ -35,6 +35,7 @@ endif
 
 # PMD code
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_CRYPTO) += otx2_cryptodev.c
+SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_CRYPTO) += otx2_cryptodev_hw_access.c
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_CRYPTO) += otx2_cryptodev_mbox.c
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_CRYPTO) += otx2_cryptodev_ops.c
 
drivers/crypto/octeontx2/meson.build +1 -0
index 845d50d..944fa2c 100644
@@ -11,6 +11,7 @@ deps += ['common_octeontx2']
 name = 'octeontx2_crypto'
 
 sources = files('otx2_cryptodev.c',
+		'otx2_cryptodev_hw_access.c',
 		'otx2_cryptodev_mbox.c',
 		'otx2_cryptodev_ops.c')
 
drivers/crypto/octeontx2/otx2_cryptodev.h +6 -0
index 531bd6d..941bbc4 100644
@@ -23,6 +23,12 @@ struct otx2_cpt_vf {
 	/**< Base class */
 	uint16_t max_queues;
 	/**< Max queues supported */
+	uint8_t nb_queues;
+	/**< Number of crypto queues attached */
+	uint16_t lf_msixoff[OTX2_CPT_MAX_LFS];
+	/**< MSI-X offsets */
+	uint8_t err_intr_registered:1;
+	/**< Are error interrupts registered? */
 };
 
 /*
drivers/crypto/octeontx2/otx2_cryptodev_hw_access.c new file +126 -0

126 lines not on this page · raw message

drivers/crypto/octeontx2/otx2_cryptodev_hw_access.h new file +27 -0
new file mode 100644
index 0000000..2af674d
@@ -0,0 +1,27 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (C) 2019 Marvell International Ltd.
+ */
+
+#ifndef _OTX2_CRYPTODEV_HW_ACCESS_H_
+#define _OTX2_CRYPTODEV_HW_ACCESS_H_
+
+#include <rte_cryptodev.h>
+
+#include "otx2_dev.h"
+
+/* Register offsets */
+
+/* CPT LF registers */
+#define OTX2_CPT_LF_MISC_INT		0xb0ull
+#define OTX2_CPT_LF_MISC_INT_ENA_W1S	0xd0ull
+#define OTX2_CPT_LF_MISC_INT_ENA_W1C	0xe0ull
+
+#define OTX2_CPT_LF_BAR2(vf, q_id) \
+		((vf)->otx2_dev.bar2 + \
+		 ((RVU_BLOCK_ADDR_CPT0 << 20) | ((q_id) << 12)))
+
+void otx2_cpt_err_intr_unregister(const struct rte_cryptodev *dev);
+
+int otx2_cpt_err_intr_register(const struct rte_cryptodev *dev);
+
+#endif /* _OTX2_CRYPTODEV_HW_ACCESS_H_ */
drivers/crypto/octeontx2/otx2_cryptodev_mbox.c +64 -0

67 lines not on this page · raw message

drivers/crypto/octeontx2/otx2_cryptodev_mbox.h +6 -0
index 648c009..0a43061 100644
@@ -10,4 +10,10 @@
 int otx2_cpt_available_queues_get(const struct rte_cryptodev *dev,
 				  uint16_t *nb_queues);
 
+int otx2_cpt_queues_attach(const struct rte_cryptodev *dev, uint8_t nb_queues);
+
+int otx2_cpt_queues_detach(const struct rte_cryptodev *dev);
+
+int otx2_cpt_msix_offsets_get(const struct rte_cryptodev *dev);
+
 #endif /* _OTX2_CRYPTODEV_MBOX_H_ */
drivers/crypto/octeontx2/otx2_cryptodev_ops.c +118 -5

133 lines not on this page · raw message

drivers/crypto/octeontx2/otx2_cryptodev_ops.h +3 -0
index 545614e..9bd24e7 100644
@@ -7,6 +7,9 @@
 
 #include <rte_cryptodev_pmd.h>
 
+#define OTX2_CPT_MIN_HEADROOM_REQ	24
+#define OTX2_CPT_MIN_TAILROOM_REQ	8
+
 struct rte_cryptodev_ops otx2_cpt_ops;
 
 #endif /* _OTX2_CRYPTODEV_OPS_H_ */
Signature · 1 line
2.7.4
#6 lore raw

PATCH 4/11 crypto/octeontx2: add symmetric capabilities

In reply to Anoob Joseph

This patch adds the symmetric capabilities for OCTEON TX2 crypto PMD.

---
 drivers/crypto/octeontx2/Makefile                  |   1 +
 drivers/crypto/octeontx2/meson.build               |   1 +
 .../crypto/octeontx2/otx2_cryptodev_capabilities.c | 604 +++++++++++++++++++++
 .../crypto/octeontx2/otx2_cryptodev_capabilities.h |  16 +
 drivers/crypto/octeontx2/otx2_cryptodev_ops.c      |   3 +-
 5 files changed, 624 insertions(+), 1 deletion(-)
 create mode 100644 drivers/crypto/octeontx2/otx2_cryptodev_capabilities.c
 create mode 100644 drivers/crypto/octeontx2/otx2_cryptodev_capabilities.h
drivers/crypto/octeontx2/Makefile +1 -0
index 71bc4d1..968efac 100644
@@ -35,6 +35,7 @@ endif
 
 # PMD code
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_CRYPTO) += otx2_cryptodev.c
+SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_CRYPTO) += otx2_cryptodev_capabilities.c
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_CRYPTO) += otx2_cryptodev_hw_access.c
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_CRYPTO) += otx2_cryptodev_mbox.c
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_CRYPTO) += otx2_cryptodev_ops.c
drivers/crypto/octeontx2/meson.build +1 -0
index 944fa2c..ee2e907 100644
@@ -11,6 +11,7 @@ deps += ['common_octeontx2']
 name = 'octeontx2_crypto'
 
 sources = files('otx2_cryptodev.c',
+		'otx2_cryptodev_capabilities.c',
 		'otx2_cryptodev_hw_access.c',
 		'otx2_cryptodev_mbox.c',
 		'otx2_cryptodev_ops.c')
drivers/crypto/octeontx2/otx2_cryptodev_capabilities.c new file +604 -0

604 lines not on this page · raw message

drivers/crypto/octeontx2/otx2_cryptodev_capabilities.h new file +16 -0
new file mode 100644
index 0000000..f103c32
@@ -0,0 +1,16 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (C) 2019 Marvell International Ltd.
+ */
+
+#ifndef _OTX2_CRYPTODEV_CAPABILITIES_H_
+#define _OTX2_CRYPTODEV_CAPABILITIES_H_
+
+#include <rte_cryptodev.h>
+
+/*
+ * Get capabilities list for the device
+ *
+ */
+const struct rte_cryptodev_capabilities *otx2_cpt_capabilities_get(void);
+
+#endif /* _OTX2_CRYPTODEV_CAPABILITIES_H_ */
drivers/crypto/octeontx2/otx2_cryptodev_ops.c +2 -1
index 784fea6..eafb2d3 100644
@@ -8,6 +8,7 @@
 #include "cpt_pmd_logs.h"
 
 #include "otx2_cryptodev.h"
+#include "otx2_cryptodev_capabilities.h"
 #include "otx2_cryptodev_hw_access.h"
 #include "otx2_cryptodev_mbox.h"
 #include "otx2_cryptodev_ops.h"
@@ -111,7 +112,7 @@ otx2_cpt_dev_info_get(struct rte_cryptodev *dev,
 	if (info != NULL) {
 		info->max_nb_queue_pairs = vf->max_queues;
 		info->feature_flags = dev->feature_flags;
-		info->capabilities = NULL;
+		info->capabilities = otx2_cpt_capabilities_get();
 		info->sym.max_nb_sessions = 0;
 		info->driver_id = otx2_cryptodev_driver_id;
 		info->min_mbuf_headroom_req = OTX2_CPT_MIN_HEADROOM_REQ;
Signature · 1 line
2.7.4
#7 lore raw

PATCH 5/11 crypto/octeontx2: add hardware definitions

In reply to Anoob Joseph

From: Ankur Dwivedi <[email protected]>

This patch adds the hardware definitions for OCTEON TX2 crypto hardware.

---
 .../crypto/octeontx2/otx2_cryptodev_hw_access.h    | 117 +++++++++++++++++++++
 1 file changed, 117 insertions(+)
drivers/crypto/octeontx2/otx2_cryptodev_hw_access.h +117 -0
index 2af674d..441494e 100644
@@ -11,15 +11,132 @@
 
 /* Register offsets */
 
+/* LMT LF registers */
+#define OTX2_LMT_LF_LMTLINE(a)		(0x0ull | (uint64_t)(a) << 3)
+
 /* CPT LF registers */
+#define OTX2_CPT_LF_CTL			0x10ull
+#define OTX2_CPT_LF_INPROG		0x40ull
 #define OTX2_CPT_LF_MISC_INT		0xb0ull
 #define OTX2_CPT_LF_MISC_INT_ENA_W1S	0xd0ull
 #define OTX2_CPT_LF_MISC_INT_ENA_W1C	0xe0ull
+#define OTX2_CPT_LF_Q_BASE		0xf0ull
+#define OTX2_CPT_LF_Q_SIZE		0x100ull
+#define OTX2_CPT_LF_NQ(a)		(0x400ull | (uint64_t)(a) << 3)
+
+#define OTX2_CPT_AF_LF_CTL(a)		(0x27000ull | (uint64_t)(a) << 3)
 
 #define OTX2_CPT_LF_BAR2(vf, q_id) \
 		((vf)->otx2_dev.bar2 + \
 		 ((RVU_BLOCK_ADDR_CPT0 << 20) | ((q_id) << 12)))
 
+union otx2_cpt_lf_ctl {
+	uint64_t u;
+	struct {
+#if (RTE_BYTE_ORDER == RTE_BIG_ENDIAN) /* Word 0 - Big Endian */
+		uint64_t reserved_8_63               : 56;
+		uint64_t fc_hyst_bits                : 4;
+		uint64_t reserved_3_3                : 1;
+		uint64_t fc_up_crossing              : 1;
+		uint64_t fc_ena                      : 1;
+		uint64_t ena                         : 1;
+#else /* Word 0 - Little Endian */
+		uint64_t ena                         : 1;
+		uint64_t fc_ena                      : 1;
+		uint64_t fc_up_crossing              : 1;
+		uint64_t reserved_3_3                : 1;
+		uint64_t fc_hyst_bits                : 4;
+		uint64_t reserved_8_63               : 56;
+#endif
+	} s;
+};
+
+union otx2_cpt_lf_inprog {
+	uint64_t u;
+	struct {
+#if (RTE_BYTE_ORDER == RTE_BIG_ENDIAN) /* Word 0 - Big Endian */
+		uint64_t reserved_48_63              : 16;
+		uint64_t gwb_cnt                     : 8;
+		uint64_t grb_cnt                     : 8;
+		uint64_t grb_partial                 : 1;
+		uint64_t reserved_18_30              : 13;
+		uint64_t grp_drp                     : 1;
+		uint64_t eena                        : 1;
+		uint64_t reserved_9_15               : 7;
+		uint64_t inflight                    : 9;
+#else /* Word 0 - Little Endian */
+		uint64_t inflight                    : 9;
+		uint64_t reserved_9_15               : 7;
+		uint64_t eena                        : 1;
+		uint64_t grp_drp                     : 1;
+		uint64_t reserved_18_30              : 13;
+		uint64_t grb_partial                 : 1;
+		uint64_t grb_cnt                     : 8;
+		uint64_t gwb_cnt                     : 8;
+		uint64_t reserved_48_63              : 16;
+#endif
+	} s;
+};
+
+union otx2_cpt_lf_q_base {
+	uint64_t u;
+	struct {
+#if (RTE_BYTE_ORDER == RTE_BIG_ENDIAN) /* Word 0 - Big Endian */
+		uint64_t reserved_53_63              : 11;
+		uint64_t addr                        : 46;
+		uint64_t reserved_2_6                : 5;
+		uint64_t stopped                     : 1;
+		uint64_t fault                       : 1;
+#else /* Word 0 - Little Endian */
+		uint64_t fault                       : 1;
+		uint64_t stopped                     : 1;
+		uint64_t reserved_2_6                : 5;
+		uint64_t addr                        : 46;
+		uint64_t reserved_53_63              : 11;
+#endif
+	} s;
+};
+
+union otx2_cpt_lf_q_size {
+	uint64_t u;
+	struct {
+#if (RTE_BYTE_ORDER == RTE_BIG_ENDIAN) /* Word 0 - Big Endian */
+		uint64_t reserved_15_63              : 49;
+		uint64_t size_div40                  : 15;
+#else /* Word 0 - Little Endian */
+		uint64_t size_div40                  : 15;
+		uint64_t reserved_15_63              : 49;
+#endif
+	} s;
+};
+
+union otx2_cpt_af_lf_ctl {
+	uint64_t u;
+	struct {
+#if (RTE_BYTE_ORDER == RTE_BIG_ENDIAN) /* Word 0 - Big Endian */
+		uint64_t reserved_56_63              : 8;
+		uint64_t grp                         : 8;
+		uint64_t reserved_17_47              : 31;
+		uint64_t nixtx_en                    : 1;
+		uint64_t reserved_11_15              : 5;
+		uint64_t cont_err                    : 1;
+		uint64_t pf_func_inst                : 1;
+		uint64_t reserved_1_8                : 8;
+		uint64_t pri                         : 1;
+#else /* Word 0 - Little Endian */
+		uint64_t pri                         : 1;
+		uint64_t reserved_1_8                : 8;
+		uint64_t pf_func_inst                : 1;
+		uint64_t cont_err                    : 1;
+		uint64_t reserved_11_15              : 5;
+		uint64_t nixtx_en                    : 1;
+		uint64_t reserved_17_47              : 31;
+		uint64_t grp                         : 8;
+		uint64_t reserved_56_63              : 8;
+#endif
+	} s;
+};
+
 void otx2_cpt_err_intr_unregister(const struct rte_cryptodev *dev);
 
 int otx2_cpt_err_intr_register(const struct rte_cryptodev *dev);
Signature · 1 line
2.7.4
#8 lore raw

PATCH 6/11 crypto/octeontx2: add queue pair functions

In reply to Anoob Joseph

This patch adds the queue pair setup and queue pair release functions for OCTEON TX2 crypto pmd.

---
 .../crypto/octeontx2/otx2_cryptodev_hw_access.c    |  99 +++++++
 .../crypto/octeontx2/otx2_cryptodev_hw_access.h    |  63 +++++
 drivers/crypto/octeontx2/otx2_cryptodev_mbox.c     |  81 ++++++
 drivers/crypto/octeontx2/otx2_cryptodev_mbox.h     |   6 +
 drivers/crypto/octeontx2/otx2_cryptodev_ops.c      | 306 ++++++++++++++++++++-
 5 files changed, 552 insertions(+), 3 deletions(-)
drivers/crypto/octeontx2/otx2_cryptodev_hw_access.c +99 -0
index 88b5510..20ec60e 100644
@@ -1,12 +1,16 @@
 /* SPDX-License-Identifier: BSD-3-Clause
  * Copyright (C) 2019 Marvell International Ltd.
  */
+#include <rte_cryptodev.h>
 
 #include "cpt_pmd_logs.h"
 
 #include "otx2_common.h"
 #include "otx2_cryptodev.h"
 #include "otx2_cryptodev_hw_access.h"
+#include "otx2_cryptodev_mbox.h"
+#include "otx2_cryptodev_ops.h"
+#include "otx2_dev.h"
 
 static void
 otx2_cpt_lf_err_intr_handler(void *param)
@@ -124,3 +128,98 @@ otx2_cpt_err_intr_register(const struct rte_cryptodev *dev)
 	 */
 	return 0;
 }
+
+int
+otx2_cpt_iq_enable(const struct rte_cryptodev *dev,
+		   const struct otx2_cpt_qp *qp, uint8_t grp_mask, uint8_t pri,
+		   uint32_t size_div40)
+{
+	union otx2_cpt_af_lf_ctl af_lf_ctl;
+	union otx2_cpt_lf_inprog inprog;
+	union otx2_cpt_lf_q_base base;
+	union otx2_cpt_lf_q_size size;
+	union otx2_cpt_lf_ctl lf_ctl;
+	int ret;
+
+	/* Set engine group mask and priority */
+
+	ret = otx2_cpt_af_reg_read(dev, OTX2_CPT_AF_LF_CTL(qp->id),
+				   &af_lf_ctl.u);
+	if (ret)
+		return ret;
+	af_lf_ctl.s.grp = grp_mask;
+	af_lf_ctl.s.pri = pri ? 1 : 0;
+	ret = otx2_cpt_af_reg_write(dev, OTX2_CPT_AF_LF_CTL(qp->id),
+				    af_lf_ctl.u);
+	if (ret)
+		return ret;
+
+	/* Set instruction queue base address */
+
+	base.u = otx2_read64(qp->base + OTX2_CPT_LF_Q_BASE);
+	base.s.fault = 0;
+	base.s.stopped = 0;
+	base.s.addr = qp->iq_dma_addr >> 7;
+	otx2_write64(base.u, qp->base + OTX2_CPT_LF_Q_BASE);
+
+	/* Set instruction queue size */
+
+	size.u = otx2_read64(qp->base + OTX2_CPT_LF_Q_SIZE);
+	size.s.size_div40 = size_div40;
+	otx2_write64(size.u, qp->base + OTX2_CPT_LF_Q_SIZE);
+
+	/* Enable instruction queue */
+
+	lf_ctl.u = otx2_read64(qp->base + OTX2_CPT_LF_CTL);
+	lf_ctl.s.ena = 1;
+	otx2_write64(lf_ctl.u, qp->base + OTX2_CPT_LF_CTL);
+
+	/* Start instruction execution */
+
+	inprog.u = otx2_read64(qp->base + OTX2_CPT_LF_INPROG);
+	inprog.s.eena = 1;
+	otx2_write64(inprog.u, qp->base + OTX2_CPT_LF_INPROG);
+
+	return 0;
+}
+
+void
+otx2_cpt_iq_disable(struct otx2_cpt_qp *qp)
+{
+	union otx2_cpt_lf_q_grp_ptr grp_ptr;
+	union otx2_cpt_lf_inprog inprog;
+	union otx2_cpt_lf_ctl ctl;
+	int cnt;
+
+	/* Stop instruction execution */
+	inprog.u = otx2_read64(qp->base + OTX2_CPT_LF_INPROG);
+	inprog.s.eena = 0x0;
+	otx2_write64(inprog.u, qp->base + OTX2_CPT_LF_INPROG);
+
+	/* Disable instructions enqueuing */
+	ctl.u = otx2_read64(qp->base + OTX2_CPT_LF_CTL);
+	ctl.s.ena = 0;
+	otx2_write64(ctl.u, qp->base + OTX2_CPT_LF_CTL);
+
+	/* Wait for instruction queue to become empty */
+	cnt = 0;
+	do {
+		inprog.u = otx2_read64(qp->base + OTX2_CPT_LF_INPROG);
+		if (inprog.s.grb_partial)
+			cnt = 0;
+		else
+			cnt++;
+		grp_ptr.u = otx2_read64(qp->base + OTX2_CPT_LF_Q_GRP_PTR);
+	} while ((cnt < 10) && (grp_ptr.s.nq_ptr != grp_ptr.s.dq_ptr));
+
+	cnt = 0;
+	do {
+		inprog.u = otx2_read64(qp->base + OTX2_CPT_LF_INPROG);
+		if ((inprog.s.inflight == 0) &&
+		    (inprog.s.gwb_cnt < 40) &&
+		    ((inprog.s.grb_cnt == 0) || (inprog.s.grb_cnt == 40)))
+			cnt++;
+		else
+			cnt = 0;
+	} while (cnt < 10);
+}
drivers/crypto/octeontx2/otx2_cryptodev_hw_access.h +63 -0

93 lines not on this page · raw message

drivers/crypto/octeontx2/otx2_cryptodev_mbox.c +81 -0

84 lines not on this page · raw message

drivers/crypto/octeontx2/otx2_cryptodev_mbox.h +6 -0
index 0a43061..a298718 100644
@@ -16,4 +16,10 @@ int otx2_cpt_queues_detach(const struct rte_cryptodev *dev);
 
 int otx2_cpt_msix_offsets_get(const struct rte_cryptodev *dev);
 
+int otx2_cpt_af_reg_read(const struct rte_cryptodev *dev, uint64_t reg,
+			 uint64_t *val);
+
+int otx2_cpt_af_reg_write(const struct rte_cryptodev *dev, uint64_t reg,
+			  uint64_t val);
+
 #endif /* _OTX2_CRYPTODEV_MBOX_H_ */
drivers/crypto/octeontx2/otx2_cryptodev_ops.c +303 -3

340 lines not on this page · raw message

Signature · 1 line
2.7.4
#9 lore raw

PATCH 7/11 crypto/octeontx2: add session related functions

In reply to Anoob Joseph

From: Ankur Dwivedi <[email protected]>

This patch adds the symmetric session related callbacks.

---
 drivers/common/cpt/cpt_mcode_defines.h        |   2 +
 drivers/crypto/octeontx2/otx2_cryptodev_ops.c | 117 +++++++++++++++++++++++++-
 drivers/crypto/octeontx2/otx2_cryptodev_ops.h |   5 ++
 3 files changed, 121 insertions(+), 3 deletions(-)
drivers/common/cpt/cpt_mcode_defines.h +2 -0
index b7c3feb..c197c7b 100644
@@ -213,6 +213,8 @@ struct cpt_sess_misc {
 	uint16_t is_null:1;
 	/** Flag for GMAC */
 	uint16_t is_gmac:1;
+	/** Engine group */
+	uint16_t egrp:3;
 	/** AAD length */
 	uint16_t aad_length;
 	/** MAC len in bytes */
drivers/crypto/octeontx2/otx2_cryptodev_ops.c +114 -3

139 lines not on this page · raw message

drivers/crypto/octeontx2/otx2_cryptodev_ops.h +5 -0
index 9bd24e7..ba93a66 100644
@@ -10,6 +10,11 @@
 #define OTX2_CPT_MIN_HEADROOM_REQ	24
 #define OTX2_CPT_MIN_TAILROOM_REQ	8
 
+enum otx2_cpt_egrp {
+	OTX2_CPT_EGRP_SE = 0,
+	OTX2_CPT_EGRP_SE_IE = 1,
+};
+
 struct rte_cryptodev_ops otx2_cpt_ops;
 
 #endif /* _OTX2_CRYPTODEV_OPS_H_ */
Signature · 1 line
2.7.4
#10 lore raw

PATCH 8/11 crypto/octeontx2: add enqueue burst

In reply to Anoob Joseph

This patch adds the enqueue burst callbacks for the OCTEON TX2 crypto driver. Other required functions and data structures which are used to enqueue the instruction to the hardware are also added.

---
 drivers/common/cpt/cpt_hw_types.h             |  38 ++++++
 drivers/crypto/octeontx2/otx2_cryptodev_ops.c | 159 ++++++++++++++++++++++++++
 2 files changed, 197 insertions(+)
drivers/common/cpt/cpt_hw_types.h +38 -0
index 4c2893b..4286512 100644
@@ -197,6 +197,44 @@ typedef union cpt_inst_s {
 		};
 #endif /* Word 7 - End */
 	} s8x;
+	struct cpt_inst_s_9s {
+#if (RTE_BYTE_ORDER == RTE_BIG_ENDIAN) /* Word 0 - Big Endian */
+		uint64_t nixtx_addr            : 60;
+		uint64_t doneint               : 1;
+		uint64_t nixtxl                : 3;
+#else /* Word 0 - Little Endian */
+		uint64_t nixtxl                : 3;
+		uint64_t doneint               : 1;
+		uint64_t nixtx_addr            : 60;
+#endif /* Word 0 - End */
+		uint64_t res_addr;
+#if (RTE_BYTE_ORDER == RTE_BIG_ENDIAN) /* Word 2 - Big Endian */
+		uint64_t rvu_pf_func           : 16;
+		uint64_t reserved_172_175      : 4;
+		uint64_t grp                   : 10;
+		uint64_t tt                    : 2;
+		uint64_t tag                   : 32;
+#else /* Word 2 - Little Endian */
+		uint64_t tag                   : 32;
+		uint64_t tt                    : 2;
+		uint64_t grp                   : 10;
+		uint64_t reserved_172_175      : 4;
+		uint64_t rvu_pf_func           : 16;
+#endif /* Word 2 - End */
+#if (RTE_BYTE_ORDER == RTE_BIG_ENDIAN) /* Word 3 - Big Endian */
+		uint64_t wq_ptr                : 61;
+		uint64_t reserved_194_193      : 2;
+		uint64_t qord                  : 1;
+#else /* Word 3 - Little Endian */
+		uint64_t qord                  : 1;
+		uint64_t reserved_194_193      : 2;
+		uint64_t wq_ptr                : 61;
+#endif /* Word 3 - End */
+		uint64_t ei0;
+		uint64_t ei1;
+		uint64_t ei2;
+		uint64_t ei3;
+	} s9x;
 } cpt_inst_s_t;
 
 /**
drivers/crypto/octeontx2/otx2_cryptodev_ops.c +159 -0

171 lines not on this page · raw message

Signature · 1 line
2.7.4
#11 lore raw

PATCH 9/11 crypto/octeontx2: add dequeue burst

In reply to Anoob Joseph

From: Ankur Dwivedi <[email protected]>

This patch adds the dequeue burst callbacks for the OCTEON TX2 crypto driver. The completion code is checked during the dequeue and the respective status is set in the crypto operation.

---
 drivers/common/cpt/cpt_hw_types.h                  |  14 +++
 drivers/crypto/octeontx2/Makefile                  |   1 +
 drivers/crypto/octeontx2/meson.build               |   1 +
 .../crypto/octeontx2/otx2_cryptodev_hw_access.h    |  16 +++
 drivers/crypto/octeontx2/otx2_cryptodev_ops.c      | 128 +++++++++++++++++++++
 5 files changed, 160 insertions(+)
drivers/common/cpt/cpt_hw_types.h +14 -0
index 4286512..e2b127d 100644
@@ -281,6 +281,20 @@ typedef union cpt_res_s {
 		uint64_t reserved_64_127       : 64;
 #endif /* Word 1 - End */
 	} s8x;
+	struct cpt_res_s_9s {
+#if (RTE_BYTE_ORDER == RTE_BIG_ENDIAN) /* Word 0 - Big Endian */
+		uint64_t reserved_17_63:47;
+		uint64_t doneint:1;
+		uint64_t uc_compcode:8;
+		uint64_t compcode:8;
+#else /* Word 0 - Little Endian */
+		uint64_t compcode:8;
+		uint64_t uc_compcode:8;
+		uint64_t doneint:1;
+		uint64_t reserved_17_63:47;
+#endif /* Word 0 - End */
+		uint64_t reserved_64_127;
+	} s9x;
 } cpt_res_s_t;
 
 /**
drivers/crypto/octeontx2/Makefile +1 -0
index 968efac..ce116b8 100644
@@ -24,6 +24,7 @@ CFLAGS += -O3
 CFLAGS += -I$(RTE_SDK)/drivers/common/cpt
 CFLAGS += -I$(RTE_SDK)/drivers/common/octeontx2
 CFLAGS += -I$(RTE_SDK)/drivers/mempool/octeontx2
+CFLAGS += -DALLOW_EXPERIMENTAL_API
 
 ifneq ($(CONFIG_RTE_ARCH_64),y)
 CFLAGS += -Wno-int-to-pointer-cast
drivers/crypto/octeontx2/meson.build +1 -0
index ee2e907..b6e5b73 100644
@@ -10,6 +10,7 @@ deps += ['common_cpt']
 deps += ['common_octeontx2']
 name = 'octeontx2_crypto'
 
+allow_experimental_apis = true
 sources = files('otx2_cryptodev.c',
 		'otx2_cryptodev_capabilities.c',
 		'otx2_cryptodev_hw_access.c',
drivers/crypto/octeontx2/otx2_cryptodev_hw_access.h +16 -0
index 82718df..d787d74 100644
@@ -12,6 +12,7 @@
 
 #include "cpt_common.h"
 #include "cpt_hw_types.h"
+#include "cpt_mcode_defines.h"
 
 #include "otx2_dev.h"
 
@@ -173,6 +174,21 @@ union otx2_cpt_lf_q_grp_ptr {
 	} s;
 };
 
+/*
+ * Enumeration cpt_9x_comp_e
+ *
+ * CPT 9X Completion Enumeration
+ * Enumerates the values of CPT_RES_S[COMPCODE].
+ */
+enum cpt_9x_comp_e {
+	CPT_9X_COMP_E_NOTDONE = 0x00,
+	CPT_9X_COMP_E_GOOD = 0x01,
+	CPT_9X_COMP_E_FAULT = 0x02,
+	CPT_9X_COMP_E_HWERR = 0x04,
+	CPT_9X_COMP_E_INSTERR = 0x05,
+	CPT_9X_COMP_E_LAST_ENTRY = 0x06
+};
+
 struct otx2_cpt_qp {
 	uint32_t id;
 	/**< Queue pair id */
drivers/crypto/octeontx2/otx2_cryptodev_ops.c +128 -0

140 lines not on this page · raw message

Signature · 1 line
2.7.4
#12 lore raw

PATCH 10/11 test: add OCTEON TX2 tests

In reply to Anoob Joseph

This patch adds the OCTEON TX2 crypto validation tests.

---
 app/test/meson.build                        |   1 +
 app/test/test_cryptodev.c                   | 323 ++++++++++++++++++++++++++++
 app/test/test_cryptodev.h                   |   1 +
 app/test/test_cryptodev_aes_test_vectors.h  | 112 ++++++----
 app/test/test_cryptodev_blockcipher.c       |   7 +
 app/test/test_cryptodev_blockcipher.h       |   1 +
 app/test/test_cryptodev_des_test_vectors.h  |  12 +-
 app/test/test_cryptodev_hash_test_vectors.h |  75 ++++---
 8 files changed, 466 insertions(+), 66 deletions(-)
app/test/meson.build +1 -0
index ec40943..b40fe9d 100644
@@ -270,6 +270,7 @@ driver_test_names = [
         'cryptodev_dpaa_sec_autotest',
         'cryptodev_dpaa2_sec_autotest',
         'cryptodev_null_autotest',
+        'cryptodev_octeontx2_autotest',
         'cryptodev_openssl_autotest',
         'cryptodev_openssl_asym_autotest',
         'cryptodev_qat_autotest',
app/test/test_cryptodev.c +323 -0

345 lines not on this page · raw message

app/test/test_cryptodev.h +1 -0
index 14b54dc..241ed72 100644
@@ -66,6 +66,7 @@
 #define CRYPTODEV_NAME_CCP_PMD		crypto_ccp
 #define CRYPTODEV_NAME_VIRTIO_PMD	crypto_virtio
 #define CRYPTODEV_NAME_OCTEONTX_SYM_PMD	crypto_octeontx
+#define CRYPTODEV_NAME_OCTEONTX2_PMD	crypto_octeontx2
 #define CRYPTODEV_NAME_CAAM_JR_PMD	crypto_caam_jr
 
 /**
app/test/test_cryptodev_aes_test_vectors.h +75 -37

340 lines not on this page · raw message

app/test/test_cryptodev_blockcipher.c +7 -0
index b8dcc39..4f0278c 100644
@@ -77,6 +77,8 @@ test_blockcipher_one_case(const struct blockcipher_test_case *t,
 			RTE_STR(CRYPTODEV_NAME_VIRTIO_PMD));
 	int octeontx_pmd = rte_cryptodev_driver_id_get(
 			RTE_STR(CRYPTODEV_NAME_OCTEONTX_SYM_PMD));
+	int octeontx2_pmd = rte_cryptodev_driver_id_get(
+			RTE_STR(CRYPTODEV_NAME_OCTEONTX2_PMD));
 	int null_pmd = rte_cryptodev_driver_id_get(
 				RTE_STR(CRYPTODEV_NAME_NULL_PMD));
 
@@ -125,6 +127,7 @@ test_blockcipher_one_case(const struct blockcipher_test_case *t,
 			driver_id == ccp_pmd ||
 			driver_id == virtio_pmd ||
 			driver_id == octeontx_pmd ||
+			driver_id == octeontx2_pmd ||
 			driver_id == null_pmd) { /* Fall through */
 		digest_len = tdata->digest.len;
 	} else if (driver_id == aesni_mb_pmd ||
@@ -715,6 +718,8 @@ test_blockcipher_all_tests(struct rte_mempool *mbuf_pool,
 			RTE_STR(CRYPTODEV_NAME_VIRTIO_PMD));
 	int octeontx_pmd = rte_cryptodev_driver_id_get(
 			RTE_STR(CRYPTODEV_NAME_OCTEONTX_SYM_PMD));
+	int octeontx2_pmd = rte_cryptodev_driver_id_get(
+			RTE_STR(CRYPTODEV_NAME_OCTEONTX2_PMD));
 	int null_pmd = rte_cryptodev_driver_id_get(
 				RTE_STR(CRYPTODEV_NAME_NULL_PMD));
 
@@ -787,6 +792,8 @@ test_blockcipher_all_tests(struct rte_mempool *mbuf_pool,
 		target_pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_VIRTIO;
 	else if (driver_id == octeontx_pmd)
 		target_pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX;
+	else if (driver_id == octeontx2_pmd)
+		target_pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX2;
 	else if (driver_id == null_pmd)
 		target_pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_NULL;
 	else
app/test/test_cryptodev_blockcipher.h +1 -0
index 3d4b975..d5e0801 100644
@@ -32,6 +32,7 @@
 #define BLOCKCIPHER_TEST_TARGET_PMD_CAAM_JR	0x0400 /* CAAM_JR flag */
 #define BLOCKCIPHER_TEST_TARGET_PMD_CCP		0x0800 /* CCP flag */
 #define BLOCKCIPHER_TEST_TARGET_PMD_NULL	0x1000 /* NULL flag */
+#define BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX2	0x2000 /* OCTEON TX2 flag */
 
 #define BLOCKCIPHER_TEST_OP_CIPHER	(BLOCKCIPHER_TEST_OP_ENCRYPT | \
 					BLOCKCIPHER_TEST_OP_DECRYPT)
app/test/test_cryptodev_des_test_vectors.h +8 -4
index a71b0e9..9d2d0e7 100644
@@ -1114,7 +1114,8 @@ static const struct blockcipher_test_case triple_des_chain_test_cases[] = {
 			BLOCKCIPHER_TEST_TARGET_PMD_CAAM_JR |
 			BLOCKCIPHER_TEST_TARGET_PMD_MVSAM |
 			BLOCKCIPHER_TEST_TARGET_PMD_CCP |
-			BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX
+			BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX |
+			BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX2
 	},
 	{
 		.test_descr = "3DES-192-CBC HMAC-SHA1 Decryption Digest Verify",
@@ -1127,7 +1128,8 @@ static const struct blockcipher_test_case triple_des_chain_test_cases[] = {
 			BLOCKCIPHER_TEST_TARGET_PMD_CAAM_JR |
 			BLOCKCIPHER_TEST_TARGET_PMD_MVSAM |
 			BLOCKCIPHER_TEST_TARGET_PMD_CCP |
-			BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX
+			BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX |
+			BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX2
 	},
 	{
 		.test_descr = "3DES-192-CBC SHA1 Encryption Digest",
@@ -1296,7 +1298,8 @@ static const struct blockcipher_test_case triple_des_cipheronly_test_cases[] = {
 			BLOCKCIPHER_TEST_TARGET_PMD_MVSAM |
 			BLOCKCIPHER_TEST_TARGET_PMD_CCP |
 			BLOCKCIPHER_TEST_TARGET_PMD_MB |
-			BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX
+			BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX |
+			BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX2
 	},
 	{
 		.test_descr = "3DES-192-CBC Decryption",
@@ -1310,7 +1313,8 @@ static const struct blockcipher_test_case triple_des_cipheronly_test_cases[] = {
 			BLOCKCIPHER_TEST_TARGET_PMD_MVSAM |
 			BLOCKCIPHER_TEST_TARGET_PMD_CCP |
 			BLOCKCIPHER_TEST_TARGET_PMD_MB |
-			BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX
+			BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX |
+			BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX2
 	},
 	{
 		.test_descr = "3DES-128-CTR Encryption",
app/test/test_cryptodev_hash_test_vectors.h +50 -25

225 lines not on this page · raw message

Signature · 1 line
2.7.4
#13 lore raw

PATCH 11/11 doc: add documentation for OCTEON TX2 crypto PMD

In reply to Anoob Joseph

Adding feature list and user guide for OCTEONTX2 crypto PMD.

---
 MAINTAINERS                                  |   7 ++
 doc/guides/cryptodevs/features/octeontx2.ini |  62 ++++++++++++
 doc/guides/cryptodevs/index.rst              |   1 +
 doc/guides/cryptodevs/octeontx2.rst          | 142 +++++++++++++++++++++++++++
 doc/guides/platform/octeontx2.rst            |   3 +
 5 files changed, 215 insertions(+)
 create mode 100644 doc/guides/cryptodevs/features/octeontx2.ini
 create mode 100644 doc/guides/cryptodevs/octeontx2.rst
MAINTAINERS +7 -0
index 4100260..eef64f7 100644
@@ -965,6 +965,13 @@ F: drivers/crypto/mvsam/
 F: doc/guides/cryptodevs/mvsam.rst
 F: doc/guides/cryptodevs/features/mvsam.ini
 
+Marvell OCTEON TX2 crypto
+M: Ankur Dwivedi <[email protected]>
+M: Anoob Joseph <[email protected]>
+F: drivers/crypto/octeontx2/
+F: doc/guides/cryptodevs/octeontx2.rst
+F: doc/guides/cryptodevs/features/octeontx2.ini
+
 Null Crypto
 M: Declan Doherty <[email protected]>
 F: drivers/crypto/null/
doc/guides/cryptodevs/features/octeontx2.ini new file +62 -0

62 lines not on this page · raw message

doc/guides/cryptodevs/index.rst +1 -0
index 83610e6..1efb3fa 100644
@@ -19,6 +19,7 @@ Crypto Device Drivers
     dpaa_sec
     kasumi
     octeontx
+    octeontx2
     openssl
     mvsam
     null
doc/guides/cryptodevs/octeontx2.rst new file +142 -0

142 lines not on this page · raw message

doc/guides/platform/octeontx2.rst +3 -0
index 4194a43..f06dc68 100644
@@ -132,6 +132,9 @@ This section lists dataplane H/W block(s) available in OCTEON TX2 SoC.
 #. **DMA Rawdev Driver**
    See :doc:`../rawdevs/octeontx2_dma` for DMA driver information.
 
+#. **Crypto Device Driver**
+   See :doc:`../cryptodevs/octeontx2` for CPT crypto device driver information.
+
 Procedure to Setup Platform
 ---------------------------
 
Signature · 1 line
2.7.4
#14 lore raw

Re: [dpdk-dev] [PATCH 11/11] doc: add documentation for OCTEON TX2 crypto PMD

Quoted 16 lines

-----Original Message-----
From: Anoob Joseph <[email protected]>
Sent: Friday, August 30, 2019 11:58 AM
To: Akhil Goyal <[email protected]>; Pablo de Lara <[email protected]>; Thomas Monjalon <[email protected]>
Cc: Anoob Joseph <[email protected]>; Jerin Jacob Kollanukkaran <[email protected]>; Narayana Prasad Raju Athreya <[email protected]>; Ankur Dwivedi <[email protected]>; Tejasree Kondoj <[email protected]>; [email protected]
Subject: [PATCH 11/11] doc: add documentation for OCTEON TX2 crypto PMD

Adding feature list and user guide for OCTEONTX2 crypto PMD.

Quoted 7 lines
---
 MAINTAINERS                                  |   7 ++
 doc/guides/cryptodevs/features/octeontx2.ini |  62 ++++++++++++
 doc/guides/cryptodevs/index.rst              |   1 +
 doc/guides/cryptodevs/octeontx2.rst          | 142
+++++++++++++++++++++++++++
 doc/guides/platform/octeontx2.rst            |   3 +

Please update the doc/guides/rel_notes/release_19_11.rst

Quoted 9 lines
 5 files changed, 215 insertions(+)
 create mode 100644 doc/guides/cryptodevs/features/octeontx2.ini
 create mode 100644 doc/guides/cryptodevs/octeontx2.rst
MAINTAINERS +0 -0
index 4100260..eef64f7 100644

MAINTAINERS F: drivers/crypto/mvsam/ · line 973

Quoted 9 lines
MAINTAINERS +6 -0
@@ -965,6 +965,13 @@ F: drivers/crypto/mvsam/
 F: doc/guides/cryptodevs/mvsam.rst
 F: doc/guides/cryptodevs/features/mvsam.ini
 
+Marvell OCTEON TX2 crypto
+M: Ankur Dwivedi <[email protected]>
+M: Anoob Joseph <[email protected]>
+F: drivers/crypto/octeontx2/
+F: doc/guides/cryptodevs/octeontx2.rst
+F: doc/guides/cryptodevs/features/octeontx2.ini

Move this section, next to OCTEON TX.

Quoted 8 lines
MAINTAINERS +1 -0
+
 Null Crypto
 M: Declan Doherty <[email protected]>
 F: drivers/crypto/null/
doc/guides/cryptodevs/features/octeontx2.ini new file +0 -0
new file mode 100644
index 0000000..ac76b11

doc/guides/cryptodevs/features/octeontx2.ini

Quoted 8 lines
doc/guides/cryptodevs/features/octeontx2.ini new file +8 -0
+Initialization
+--------------
+
+List the CPT PF devices available on your OCTEON TX2 platform:
+
+.. code-block:: console
+
+    lspci -d:a0fd

Change to use standard DPDK usertools/dpdk-devbind.py script.

Quoted 12 lines
doc/guides/cryptodevs/features/octeontx2.ini new file +12 -0
+
+``a0fd`` is the CPT PF device id. You should see output similar to:
+
+.. code-block:: console
+
+    0002:10:00.0 Class 1080: Device 177d:a0fd
+
+Set ``sriov_numvfs`` on the CPT PF device, to create a VF:
+
+.. code-block:: console
+
+    echo 1 > /sys/bus/pci/drivers/octeontx2-cpt/0002:10:00.0/sriov_numvfs

doc/guides/cryptodevs/features/octeontx2.ini

Quoted 10 lines
doc/guides/cryptodevs/features/octeontx2.ini new file +10 -0
+
+Bind the CPT VF device to the vfio_pci driver:
+
+.. code-block:: console
+
+    echo '177d a0fe' > /sys/bus/pci/drivers/vfio-pci/new_id
+    echo 0002:10:00.1 > /sys/bus/pci/devices/0002:10:00.1/driver/unbind
+    echo 0002:10:00.1 > /sys/bus/pci/drivers/vfio-pci/bind
+
+Another way to bind the VF would be to use the ``dpdk-devbind.py`` script:

I think, we can mention only the standard usertools/dpdk-devbind.py scheme.

#15 lore raw

Re: [dpdk-dev] [PATCH 11/11] doc: add documentation for OCTEON TX2 crypto PMD

Hi Jerin,

Please see inline.

Thanks,
Anoob

Quoted 38 lines

-----Original Message-----
From: Jerin Jacob Kollanukkaran <[email protected]>
Sent: Tuesday, September 3, 2019 10:52 AM
To: Anoob Joseph <[email protected]>; Akhil Goyal <[email protected]>; Pablo de Lara <[email protected]>; Thomas Monjalon <[email protected]>
Cc: Anoob Joseph <[email protected]>; Narayana Prasad Raju Athreya <[email protected]>; Ankur Dwivedi <[email protected]>; Tejasree Kondoj <[email protected]>; [email protected]
Subject: RE: [PATCH 11/11] doc: add documentation for OCTEON TX2 crypto PMD

Quoted 9 lines

-----Original Message-----
From: Anoob Joseph <[email protected]>
Sent: Friday, August 30, 2019 11:58 AM
To: Akhil Goyal <[email protected]>; Pablo de Lara <[email protected]>; Thomas Monjalon <[email protected]>
Cc: Anoob Joseph <[email protected]>; Jerin Jacob Kollanukkaran <[email protected]>; Narayana Prasad Raju Athreya <[email protected]>; Ankur Dwivedi <[email protected]>;

Tejasree

Quoted 8 lines

Kondoj <[email protected]>; [email protected]
Subject: [PATCH 11/11] doc: add documentation for OCTEON TX2 crypto PMD

Adding feature list and user guide for OCTEONTX2 crypto PMD.

Quoted 7 lines
---
 MAINTAINERS                                  |   7 ++
 doc/guides/cryptodevs/features/octeontx2.ini |  62 ++++++++++++
 doc/guides/cryptodevs/index.rst              |   1 +
 doc/guides/cryptodevs/octeontx2.rst          | 142
+++++++++++++++++++++++++++
 doc/guides/platform/octeontx2.rst            |   3 +
Quoted 1 line

Please update the doc/guides/rel_notes/release_19_11.rst

[Anoob] Will do this in v2.

Quoted 12 lines
Quoted 12 lines
 5 files changed, 215 insertions(+)
 create mode 100644 doc/guides/cryptodevs/features/octeontx2.ini
 create mode 100644 doc/guides/cryptodevs/octeontx2.rst
MAINTAINERS +0 -0
@@ -965,6 +965,13 @@ F: drivers/crypto/mvsam/
 F: doc/guides/cryptodevs/mvsam.rst
 F: doc/guides/cryptodevs/features/mvsam.ini
 
Quoted 9 lines

MAINTAINERS F: drivers/crypto/mvsam/ · line 973

Quoted 6 lines
MAINTAINERS +6 -0
+Marvell OCTEON TX2 crypto
+M: Ankur Dwivedi <[email protected]>
+M: Anoob Joseph <[email protected]>
+F: drivers/crypto/octeontx2/
+F: doc/guides/cryptodevs/octeontx2.rst
+F: doc/guides/cryptodevs/features/octeontx2.ini

Move this section, next to OCTEON TX.

[Anoob] All the entries are sorted with the "first name", which happens to be Marvell here. OCTEON TX2 networking driver is also added following the same logic.

Quoted 45 lines
Quoted 9 lines
MAINTAINERS +1 -0
+
 Null Crypto
 M: Declan Doherty <[email protected]>
 F: drivers/crypto/null/
doc/guides/cryptodevs/features/octeontx2.ini new file +0 -0
new file mode 100644
index 0000000..ac76b11

doc/guides/cryptodevs/features/octeontx2.ini

Quoted 8 lines
doc/guides/cryptodevs/features/octeontx2.ini new file +8 -0
+Initialization
+--------------
+
+List the CPT PF devices available on your OCTEON TX2 platform:
+
+.. code-block:: console
+
+    lspci -d:a0fd

Change to use standard DPDK usertools/dpdk-devbind.py script.

Quoted 13 lines
doc/guides/cryptodevs/features/octeontx2.ini new file +13 -0
+
+``a0fd`` is the CPT PF device id. You should see output similar to:
+
+.. code-block:: console
+
+    0002:10:00.0 Class 1080: Device 177d:a0fd
+
+Set ``sriov_numvfs`` on the CPT PF device, to create a VF:
+
+.. code-block:: console
+
+    echo 1 >
+ /sys/bus/pci/drivers/octeontx2-cpt/0002:10:00.0/sriov_numvfs

doc/guides/cryptodevs/features/octeontx2.ini

Quoted 10 lines
doc/guides/cryptodevs/features/octeontx2.ini new file +10 -0
+
+Bind the CPT VF device to the vfio_pci driver:
+
+.. code-block:: console
+
+    echo '177d a0fe' > /sys/bus/pci/drivers/vfio-pci/new_id
+    echo 0002:10:00.1 > /sys/bus/pci/devices/0002:10:00.1/driver/unbind
+    echo 0002:10:00.1 > /sys/bus/pci/drivers/vfio-pci/bind
+
+Another way to bind the VF would be to use the ``dpdk-devbind.py``

script:

Quoted 2 lines

I think, we can mention only the standard usertools/dpdk-devbind.py scheme.

[Anoob] The standard dpdk-devbind script is also mentioned in the steps. The other steps can be used in systems where python is not available. Few other drivers are already doing the same. Do you suggest documenting only the steps to use dpdk-devbind.py script?

#16 lore raw

Re: [dpdk-dev] [PATCH 11/11] doc: add documentation for OCTEON TX2 crypto PMD

03/09/2019 13:18, Anoob Joseph:

Quoted 11 lines

From: Jerin Jacob Kollanukkaran <[email protected]>

Quoted 9 lines

MAINTAINERS F: drivers/crypto/mvsam/ · line 973

Quoted 6 lines
MAINTAINERS +6 -0
+Marvell OCTEON TX2 crypto
+M: Ankur Dwivedi <[email protected]>
+M: Anoob Joseph <[email protected]>
+F: drivers/crypto/octeontx2/
+F: doc/guides/cryptodevs/octeontx2.rst
+F: doc/guides/cryptodevs/features/octeontx2.ini

Move this section, next to OCTEON TX.

Quoted 1 line

[Anoob] All the entries are sorted with the "first name", which happens to be Marvell here. OCTEON TX2 networking driver is also added following the same logic.

It raises the question why OCTEON TX is still "Cavium" while OCTEON TX2 is "Marvell"?

#17 lore raw

Re: [dpdk-dev] [PATCH 11/11] doc: add documentation for OCTEON TX2 crypto PMD

Hi Thomas,

Please see inline.

Thanks,
Anoob

Quoted 24 lines

-----Original Message-----
From: dev <[email protected]> On Behalf Of Thomas Monjalon
Sent: Tuesday, September 3, 2019 11:12 PM
To: Anoob Joseph <[email protected]>; Jerin Jacob Kollanukkaran <[email protected]>
Cc: Akhil Goyal <[email protected]>; Pablo de Lara <[email protected]>; Narayana Prasad Raju Athreya <[email protected]>; Ankur Dwivedi <[email protected]>; Tejasree Kondoj <[email protected]>; [email protected]
Subject: Re: [dpdk-dev] [PATCH 11/11] doc: add documentation for OCTEON TX2 crypto PMD

03/09/2019 13:18, Anoob Joseph:

Quoted 11 lines

From: Jerin Jacob Kollanukkaran <[email protected]>

Quoted 9 lines

MAINTAINERS F: drivers/crypto/mvsam/ · line 973

Quoted 6 lines
MAINTAINERS +6 -0
+Marvell OCTEON TX2 crypto
+M: Ankur Dwivedi <[email protected]>
+M: Anoob Joseph <[email protected]>
+F: drivers/crypto/octeontx2/
+F: doc/guides/cryptodevs/octeontx2.rst
+F: doc/guides/cryptodevs/features/octeontx2.ini

Move this section, next to OCTEON TX.

Quoted 6 lines
Quoted 1 line

[Anoob] All the entries are sorted with the "first name", which happens to

be Marvell here. OCTEON TX2 networking driver is also added following the same logic.

It raises the question why OCTEON TX is still "Cavium" while OCTEON TX2 is "Marvell"?

[Anoob] We are awaiting legal team confirmation on whether existing "Cavium OCTEON TX" can be updated to "Marvell OCTEON TX". Will update once we get a go ahead.

#18 lore raw

Re: [dpdk-dev] [PATCH 11/11] doc: add documentation for OCTEON TX2 crypto PMD

In reply to Anoob Joseph
Quoted 35 lines
Quoted 35 lines

-----Original Message-----
From: Jerin Jacob Kollanukkaran <[email protected]>
Sent: Tuesday, September 3, 2019 10:52 AM
To: Anoob Joseph <[email protected]>; Akhil Goyal <[email protected]>; Pablo de Lara <[email protected]>; Thomas Monjalon <[email protected]>
Cc: Anoob Joseph <[email protected]>; Narayana Prasad Raju Athreya <[email protected]>; Ankur Dwivedi <[email protected]>; Tejasree Kondoj <[email protected]>; [email protected]
Subject: RE: [PATCH 11/11] doc: add documentation for OCTEON TX2 crypto PMD

Quoted 12 lines

+``a0fd`` is the CPT PF device id. You should see output similar to:

doc/guides/cryptodevs/octeontx2.rst new file +11 -0
+
+.. code-block:: console
+
+    0002:10:00.0 Class 1080: Device 177d:a0fd
+
+Set ``sriov_numvfs`` on the CPT PF device, to create a VF:
+
+.. code-block:: console
+
+    echo 1 >
+ /sys/bus/pci/drivers/octeontx2-cpt/0002:10:00.0/sriov_numvfs

doc/guides/cryptodevs/octeontx2.rst

Quoted 10 lines
doc/guides/cryptodevs/octeontx2.rst new file +10 -0
+
+Bind the CPT VF device to the vfio_pci driver:
+
+.. code-block:: console
+
+    echo '177d a0fe' > /sys/bus/pci/drivers/vfio-pci/new_id
+    echo 0002:10:00.1 > /sys/bus/pci/devices/0002:10:00.1/driver/unbind
+    echo 0002:10:00.1 > /sys/bus/pci/drivers/vfio-pci/bind
+
+Another way to bind the VF would be to use the ``dpdk-devbind.py``

script:

Quoted 7 lines
Quoted 2 lines

I think, we can mention only the standard usertools/dpdk-devbind.py scheme.

[Anoob] The standard dpdk-devbind script is also mentioned in the steps. The other steps can be used in systems where python is not available. Few other drivers are already doing the same. Do you suggest documenting only the steps to use dpdk-devbind.py script?

If you think there is value addition in keeping both then keep both.

#19 lore raw
In reply to Anoob Joseph

Hi Akhil, Pablo,

Can you review this series?

Thanks,
Anoob

Quoted 89 lines

-----Original Message-----
From: Anoob Joseph <[email protected]>
Sent: Friday, August 30, 2019 11:58 AM
To: Akhil Goyal <[email protected]>; Pablo de Lara <[email protected]>; Thomas Monjalon <[email protected]>
Cc: Anoob Joseph <[email protected]>; Jerin Jacob Kollanukkaran <[email protected]>; Narayana Prasad Raju Athreya <[email protected]>; Ankur Dwivedi <[email protected]>; Tejasree Kondoj <[email protected]>; [email protected]
Subject: [PATCH 00/11] add OCTEON TX2 crypto PMD

This series introduces poll mode driver to enable crypto offload engine on Marvell OCTEON TX2 SoC.

Ankur Dwivedi (5):
crypto/octeontx2: add PMD skeleton
crypto/octeontx2: add device control ops
crypto/octeontx2: add hardware definitions
crypto/octeontx2: add session related functions
crypto/octeontx2: add dequeue burst

Anoob Joseph (6):
crypto/octeontx2: add device init sequence in probe crypto/octeontx2: add symmetric capabilities crypto/octeontx2: add queue pair functions crypto/octeontx2: add enqueue burst
test: add OCTEON TX2 tests
doc: add documentation for OCTEON TX2 crypto PMD

 MAINTAINERS                                        |   7 +
 app/test/meson.build                               |   1 +
 app/test/test_cryptodev.c                          | 323 ++++++++
 app/test/test_cryptodev.h                          |   1 +
 app/test/test_cryptodev_aes_test_vectors.h         | 112 ++-
 app/test/test_cryptodev_blockcipher.c              |   7 +
 app/test/test_cryptodev_blockcipher.h              |   1 +
 app/test/test_cryptodev_des_test_vectors.h         |  12 +-
 app/test/test_cryptodev_hash_test_vectors.h        |  75 +-
 config/common_base                                 |   5 +
 doc/guides/cryptodevs/features/octeontx2.ini       |  62 ++
 doc/guides/cryptodevs/index.rst                    |   1 +
 doc/guides/cryptodevs/octeontx2.rst                | 142 ++++
 doc/guides/platform/octeontx2.rst                  |   3 +
 drivers/common/Makefile                            |   5 +-
 drivers/common/cpt/cpt_hw_types.h                  |  52 ++
 drivers/common/cpt/cpt_mcode_defines.h             |   2 +
 drivers/crypto/Makefile                            |   1 +
 drivers/crypto/meson.build                         |   4 +-
 drivers/crypto/octeontx2/Makefile                  |  50 ++
 drivers/crypto/octeontx2/meson.build               |  34 +
 drivers/crypto/octeontx2/otx2_cryptodev.c          | 158 ++++
 drivers/crypto/octeontx2/otx2_cryptodev.h          |  39 +
 .../crypto/octeontx2/otx2_cryptodev_capabilities.c | 604
+++++++++++++++  .../crypto/octeontx2/otx2_cryptodev_capabilities.h |
16 +
 .../crypto/octeontx2/otx2_cryptodev_hw_access.c    | 225 ++++++
 .../crypto/octeontx2/otx2_cryptodev_hw_access.h    | 223 ++++++
 drivers/crypto/octeontx2/otx2_cryptodev_mbox.c     | 175 +++++
 drivers/crypto/octeontx2/otx2_cryptodev_mbox.h     |  25 +
 drivers/crypto/octeontx2/otx2_cryptodev_ops.c      | 839
+++++++++++++++++++++
 drivers/crypto/octeontx2/otx2_cryptodev_ops.h      |  20 +
 .../octeontx2/rte_pmd_octeontx2_crypto_version.map |   4 +
 mk/rte.app.mk                                      |   6 +-
 33 files changed, 3164 insertions(+), 70 deletions(-)  create mode 100644
doc/guides/cryptodevs/features/octeontx2.ini
 create mode 100644 doc/guides/cryptodevs/octeontx2.rst
 create mode 100644 drivers/crypto/octeontx2/Makefile  create mode
100644 drivers/crypto/octeontx2/meson.build
 create mode 100644 drivers/crypto/octeontx2/otx2_cryptodev.c
 create mode 100644 drivers/crypto/octeontx2/otx2_cryptodev.h
 create mode 100644
drivers/crypto/octeontx2/otx2_cryptodev_capabilities.c
 create mode 100644
drivers/crypto/octeontx2/otx2_cryptodev_capabilities.h
 create mode 100644
drivers/crypto/octeontx2/otx2_cryptodev_hw_access.c
 create mode 100644
drivers/crypto/octeontx2/otx2_cryptodev_hw_access.h
 create mode 100644 drivers/crypto/octeontx2/otx2_cryptodev_mbox.c
 create mode 100644 drivers/crypto/octeontx2/otx2_cryptodev_mbox.h
 create mode 100644 drivers/crypto/octeontx2/otx2_cryptodev_ops.c
 create mode 100644 drivers/crypto/octeontx2/otx2_cryptodev_ops.h
 create mode 100644

drivers/crypto/octeontx2/rte_pmd_octeontx2_crypto_version.map

--
2.7.4

#20 lore raw

Hi Anoob,

The series is in my pipeline for the coming week.
I have given some comments on nitrox PMD. Please have a look in case they are valid for your PMD as well and send a v2.

Regards,
Akhil

Quoted 106 lines

-----Original Message-----
From: Anoob Joseph <[email protected]>
Sent: Thursday, September 26, 2019 4:34 PM
To: Akhil Goyal <[email protected]>; Pablo de Lara <[email protected]>; Thomas Monjalon <[email protected]>
Cc: Jerin Jacob Kollanukkaran <[email protected]>; Narayana Prasad Raju Athreya <[email protected]>; Ankur Dwivedi <[email protected]>; Tejasree Kondoj <[email protected]>; [email protected]
Subject: RE: [PATCH 00/11] add OCTEON TX2 crypto PMD

Hi Akhil, Pablo,

Can you review this series?

Thanks,
Anoob

Quoted 89 lines

-----Original Message-----
From: Anoob Joseph <[email protected]>
Sent: Friday, August 30, 2019 11:58 AM
To: Akhil Goyal <[email protected]>; Pablo de Lara <[email protected]>; Thomas Monjalon <[email protected]>
Cc: Anoob Joseph <[email protected]>; Jerin Jacob Kollanukkaran <[email protected]>; Narayana Prasad Raju Athreya <[email protected]>; Ankur Dwivedi <[email protected]>; Tejasree Kondoj <[email protected]>; [email protected]
Subject: [PATCH 00/11] add OCTEON TX2 crypto PMD

This series introduces poll mode driver to enable crypto offload engine on Marvell OCTEON TX2 SoC.

Ankur Dwivedi (5):
crypto/octeontx2: add PMD skeleton
crypto/octeontx2: add device control ops
crypto/octeontx2: add hardware definitions
crypto/octeontx2: add session related functions
crypto/octeontx2: add dequeue burst

Anoob Joseph (6):
crypto/octeontx2: add device init sequence in probe crypto/octeontx2: add symmetric capabilities crypto/octeontx2: add queue pair functions crypto/octeontx2: add enqueue burst
test: add OCTEON TX2 tests
doc: add documentation for OCTEON TX2 crypto PMD

 MAINTAINERS                                        |   7 +
 app/test/meson.build                               |   1 +
 app/test/test_cryptodev.c                          | 323 ++++++++
 app/test/test_cryptodev.h                          |   1 +
 app/test/test_cryptodev_aes_test_vectors.h         | 112 ++-
 app/test/test_cryptodev_blockcipher.c              |   7 +
 app/test/test_cryptodev_blockcipher.h              |   1 +
 app/test/test_cryptodev_des_test_vectors.h         |  12 +-
 app/test/test_cryptodev_hash_test_vectors.h        |  75 +-
 config/common_base                                 |   5 +
 doc/guides/cryptodevs/features/octeontx2.ini       |  62 ++
 doc/guides/cryptodevs/index.rst                    |   1 +
 doc/guides/cryptodevs/octeontx2.rst                | 142 ++++
 doc/guides/platform/octeontx2.rst                  |   3 +
 drivers/common/Makefile                            |   5 +-
 drivers/common/cpt/cpt_hw_types.h                  |  52 ++
 drivers/common/cpt/cpt_mcode_defines.h             |   2 +
 drivers/crypto/Makefile                            |   1 +
 drivers/crypto/meson.build                         |   4 +-
 drivers/crypto/octeontx2/Makefile                  |  50 ++
 drivers/crypto/octeontx2/meson.build               |  34 +
 drivers/crypto/octeontx2/otx2_cryptodev.c          | 158 ++++
 drivers/crypto/octeontx2/otx2_cryptodev.h          |  39 +
 .../crypto/octeontx2/otx2_cryptodev_capabilities.c | 604
+++++++++++++++  .../crypto/octeontx2/otx2_cryptodev_capabilities.h |
16 +
 .../crypto/octeontx2/otx2_cryptodev_hw_access.c    | 225 ++++++
 .../crypto/octeontx2/otx2_cryptodev_hw_access.h    | 223 ++++++
 drivers/crypto/octeontx2/otx2_cryptodev_mbox.c     | 175 +++++
 drivers/crypto/octeontx2/otx2_cryptodev_mbox.h     |  25 +
 drivers/crypto/octeontx2/otx2_cryptodev_ops.c      | 839
+++++++++++++++++++++
 drivers/crypto/octeontx2/otx2_cryptodev_ops.h      |  20 +
 .../octeontx2/rte_pmd_octeontx2_crypto_version.map |   4 +
 mk/rte.app.mk                                      |   6 +-
 33 files changed, 3164 insertions(+), 70 deletions(-)  create mode 100644
doc/guides/cryptodevs/features/octeontx2.ini
 create mode 100644 doc/guides/cryptodevs/octeontx2.rst
 create mode 100644 drivers/crypto/octeontx2/Makefile  create mode
100644 drivers/crypto/octeontx2/meson.build
 create mode 100644 drivers/crypto/octeontx2/otx2_cryptodev.c
 create mode 100644 drivers/crypto/octeontx2/otx2_cryptodev.h
 create mode 100644
drivers/crypto/octeontx2/otx2_cryptodev_capabilities.c
 create mode 100644
drivers/crypto/octeontx2/otx2_cryptodev_capabilities.h
 create mode 100644
drivers/crypto/octeontx2/otx2_cryptodev_hw_access.c
 create mode 100644
drivers/crypto/octeontx2/otx2_cryptodev_hw_access.h
 create mode 100644 drivers/crypto/octeontx2/otx2_cryptodev_mbox.c
 create mode 100644 drivers/crypto/octeontx2/otx2_cryptodev_mbox.h
 create mode 100644 drivers/crypto/octeontx2/otx2_cryptodev_ops.c
 create mode 100644 drivers/crypto/octeontx2/otx2_cryptodev_ops.h
 create mode 100644

drivers/crypto/octeontx2/rte_pmd_octeontx2_crypto_version.map

--
2.7.4

#21 lore raw

v2 cover add OCTEON TX2 crypto PMD

In reply to Anoob Joseph

The series introduces poll mode driver to enable crypto offload engine on Marvell OCTEON TX2 SoC.

Changes in v2:
* Merged series adding sym features and asym features into one.
* Squashed patches as directed by Akhil.
* Added check for ASYM SESSIONLESS (not supported currently)
* Minor updates to documentation

Ankur Dwivedi (3):
crypto/octeontx2: add device control ops
crypto/octeontx2: add queue pair functions
crypto/octeontx2: add session related functions

Anoob Joseph (5):
crypto/octeontx2: add PMD skeleton crypto/octeontx2: add device init sequence in probe crypto/octeontx2: add symmetric capabilities crypto/octeontx2: add enqueue/dequeue ops
test: add OCTEON TX2 tests

Kanaka Durga Kotamarthy (2):
crypto/octeontx2: allocate memory for asymmetric operation crypto/octeontx2: add asymmetric session operations

Sunila Sahu (2):
crypto/octeontx2: add asymmetric in enqueue/dequeue ops app/test: register octeontx2 PMD to asym testsuite

 MAINTAINERS                                        |    7 +
 app/test/meson.build                               |    1 +
 app/test/test_cryptodev.c                          |  323 ++++++
 app/test/test_cryptodev.h                          |    1 +
 app/test/test_cryptodev_aes_test_vectors.h         |  114 +-
 app/test/test_cryptodev_asym.c                     |   20 +
 app/test/test_cryptodev_blockcipher.c              |    7 +
 app/test/test_cryptodev_blockcipher.h              |    1 +
 app/test/test_cryptodev_des_test_vectors.h         |   12 +-
 app/test/test_cryptodev_hash_test_vectors.h        |   75 +-
 config/common_base                                 |    5 +
 doc/guides/cryptodevs/features/octeontx2.ini       |   71 ++
 doc/guides/cryptodevs/index.rst                    |    1 +
 doc/guides/cryptodevs/octeontx2.rst                |  159 +++
 doc/guides/platform/octeontx2.rst                  |    3 +
 doc/guides/rel_notes/release_19_11.rst             |    6 +
 drivers/common/Makefile                            |    5 +-
 drivers/common/cpt/cpt_hw_types.h                  |   52 +
 drivers/common/cpt/cpt_mcode_defines.h             |    2 +
 drivers/crypto/Makefile                            |    1 +
 drivers/crypto/meson.build                         |   21 +-
 drivers/crypto/octeontx2/Makefile                  |   50 +
 drivers/crypto/octeontx2/meson.build               |   34 +
 drivers/crypto/octeontx2/otx2_cryptodev.c          |  157 +++
 drivers/crypto/octeontx2/otx2_cryptodev.h          |   43 +
 .../crypto/octeontx2/otx2_cryptodev_capabilities.c |  639 ++++++++++++
 .../crypto/octeontx2/otx2_cryptodev_capabilities.h |   16 +
 .../crypto/octeontx2/otx2_cryptodev_hw_access.c    |  225 ++++
 .../crypto/octeontx2/otx2_cryptodev_hw_access.h    |  169 +++
 drivers/crypto/octeontx2/otx2_cryptodev_mbox.c     |  175 ++++
 drivers/crypto/octeontx2/otx2_cryptodev_mbox.h     |   25 +
 drivers/crypto/octeontx2/otx2_cryptodev_ops.c      | 1100 ++++++++++++++++++++
 drivers/crypto/octeontx2/otx2_cryptodev_ops.h      |   21 +
 .../octeontx2/rte_pmd_octeontx2_crypto_version.map |    4 +
 mk/rte.app.mk                                      |    6 +-
 35 files changed, 3479 insertions(+), 72 deletions(-)
 create mode 100644 doc/guides/cryptodevs/features/octeontx2.ini
 create mode 100644 doc/guides/cryptodevs/octeontx2.rst
 create mode 100644 drivers/crypto/octeontx2/Makefile
 create mode 100644 drivers/crypto/octeontx2/meson.build
 create mode 100644 drivers/crypto/octeontx2/otx2_cryptodev.c
 create mode 100644 drivers/crypto/octeontx2/otx2_cryptodev.h
 create mode 100644 drivers/crypto/octeontx2/otx2_cryptodev_capabilities.c
 create mode 100644 drivers/crypto/octeontx2/otx2_cryptodev_capabilities.h
 create mode 100644 drivers/crypto/octeontx2/otx2_cryptodev_hw_access.c
 create mode 100644 drivers/crypto/octeontx2/otx2_cryptodev_hw_access.h
 create mode 100644 drivers/crypto/octeontx2/otx2_cryptodev_mbox.c
 create mode 100644 drivers/crypto/octeontx2/otx2_cryptodev_mbox.h
 create mode 100644 drivers/crypto/octeontx2/otx2_cryptodev_ops.c
 create mode 100644 drivers/crypto/octeontx2/otx2_cryptodev_ops.h
 create mode 100644 drivers/crypto/octeontx2/rte_pmd_octeontx2_crypto_version.map
Signature · 1 line
2.7.4
#22 lore raw

PATCH v2 1/12 crypto/octeontx2: add PMD skeleton

Adding OCTEON TX2 crypto PMD skeleton. Enabling the driver by default in common_base.

---
 MAINTAINERS                                        |   7 ++
 config/common_base                                 |   5 +
 doc/guides/cryptodevs/features/octeontx2.ini       |   8 ++
 doc/guides/cryptodevs/index.rst                    |   1 +
 doc/guides/cryptodevs/octeontx2.rst                |  93 +++++++++++++++++
 doc/guides/platform/octeontx2.rst                  |   3 +
 doc/guides/rel_notes/release_19_11.rst             |   6 ++
 drivers/common/Makefile                            |   5 +-
 drivers/crypto/Makefile                            |   1 +
 drivers/crypto/meson.build                         |  21 +++-
 drivers/crypto/octeontx2/Makefile                  |  37 +++++++
 drivers/crypto/octeontx2/meson.build               |  29 ++++++
 drivers/crypto/octeontx2/otx2_cryptodev.c          | 111 +++++++++++++++++++++
 drivers/crypto/octeontx2/otx2_cryptodev.h          |  29 ++++++
 drivers/crypto/octeontx2/otx2_cryptodev_ops.c      |  27 +++++
 drivers/crypto/octeontx2/otx2_cryptodev_ops.h      |  12 +++
 .../octeontx2/rte_pmd_octeontx2_crypto_version.map |   4 +
 mk/rte.app.mk                                      |   6 +-
 18 files changed, 400 insertions(+), 5 deletions(-)
 create mode 100644 doc/guides/cryptodevs/features/octeontx2.ini
 create mode 100644 doc/guides/cryptodevs/octeontx2.rst
 create mode 100644 drivers/crypto/octeontx2/Makefile
 create mode 100644 drivers/crypto/octeontx2/meson.build
 create mode 100644 drivers/crypto/octeontx2/otx2_cryptodev.c
 create mode 100644 drivers/crypto/octeontx2/otx2_cryptodev.h
 create mode 100644 drivers/crypto/octeontx2/otx2_cryptodev_ops.c
 create mode 100644 drivers/crypto/octeontx2/otx2_cryptodev_ops.h
 create mode 100644 drivers/crypto/octeontx2/rte_pmd_octeontx2_crypto_version.map
MAINTAINERS +7 -0
index 61f7911..d9977e6 100644
@@ -970,6 +970,13 @@ F: drivers/crypto/nitrox/
 F: doc/guides/cryptodevs/nitrox.rst
 F: doc/guides/cryptodevs/features/nitrox.ini
 
+Marvell OCTEON TX2 crypto
+M: Ankur Dwivedi <[email protected]>
+M: Anoob Joseph <[email protected]>
+F: drivers/crypto/octeontx2/
+F: doc/guides/cryptodevs/octeontx2.rst
+F: doc/guides/cryptodevs/features/octeontx2.ini
+
 Null Crypto
 M: Declan Doherty <[email protected]>
 F: drivers/crypto/null/
config/common_base +5 -0
index 19a4523..8ae5ed4 100644
@@ -593,6 +593,11 @@ CONFIG_RTE_LIBRTE_DPAA_MAX_CRYPTODEV=4
 CONFIG_RTE_LIBRTE_PMD_OCTEONTX_CRYPTO=y
 
 #
+# Compile PMD for Marvell OCTEON TX2 crypto device
+#
+CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_CRYPTO=y
+
+#
 # Compile PMD for QuickAssist based devices - see docs for details
 #
 CONFIG_RTE_LIBRTE_PMD_QAT=y
doc/guides/cryptodevs/features/octeontx2.ini new file +8 -0
new file mode 100644
index 0000000..35c9bee
@@ -0,0 +1,8 @@
+;
+; Supported features of the 'octeontx2' crypto driver.
+;
+; Refer to default.ini for the full list of available PMD features.
+;
+[Features]
+Symmetric crypto       = Y
+HW Accelerated         = Y
doc/guides/cryptodevs/index.rst +1 -0
index d1e0d32..a67ed5a 100644
@@ -19,6 +19,7 @@ Crypto Device Drivers
     dpaa_sec
     kasumi
     octeontx
+    octeontx2
     openssl
     mvsam
     nitrox
doc/guides/cryptodevs/octeontx2.rst new file +93 -0

93 lines not on this page · raw message

doc/guides/platform/octeontx2.rst +3 -0
index 4194a43..f06dc68 100644
@@ -132,6 +132,9 @@ This section lists dataplane H/W block(s) available in OCTEON TX2 SoC.
 #. **DMA Rawdev Driver**
    See :doc:`../rawdevs/octeontx2_dma` for DMA driver information.
 
+#. **Crypto Device Driver**
+   See :doc:`../cryptodevs/octeontx2` for CPT crypto device driver information.
+
 Procedure to Setup Platform
 ---------------------------
 
doc/guides/rel_notes/release_19_11.rst +6 -0
index 02fc8fb..06394ac 100644
@@ -85,6 +85,12 @@ New Features
   Added stateful decompression support in the Intel QuickAssist Technology PMD.
   Please note that stateful compression is not supported.
 
+* **Added Marvell OCTEON TX2 crypto PMD**
+
+  Added a new PMD driver for h/w crypto offload block on ``OCTEON TX2`` SoC.
+
+  See :doc:`../cryptodevs/octeontx2` for more details
+
 
 Removed Items
 -------------
drivers/common/Makefile +4 -1
index bc6f972..1ff033b 100644
@@ -4,7 +4,9 @@
 
 include $(RTE_SDK)/mk/rte.vars.mk
 
-ifeq ($(CONFIG_RTE_LIBRTE_PMD_OCTEONTX_CRYPTO),y)
+CPT-y := $(CONFIG_RTE_LIBRTE_PMD_OCTEONTX_CRYPTO)
+CPT-y += $(CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_CRYPTO)
+ifneq (,$(findstring y,$(CPT-y)))
 DIRS-y += cpt
 endif
 
@@ -12,6 +14,7 @@ ifeq ($(CONFIG_RTE_LIBRTE_PMD_OCTEONTX_SSOVF)$(CONFIG_RTE_LIBRTE_OCTEONTX_MEMPOO
 DIRS-y += octeontx
 endif
 OCTEONTX2-y := $(CONFIG_RTE_LIBRTE_OCTEONTX2_MEMPOOL)
+OCTEONTX2-y += $(CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_CRYPTO)
 ifeq ($(findstring y,$(OCTEONTX2-y)),y)
 DIRS-y += octeontx2
 endif
drivers/crypto/Makefile +1 -0
index 7129bcf..8b00857 100644
@@ -8,6 +8,7 @@ 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_OCTEONTX2_CRYPTO) += octeontx2
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_OPENSSL) += openssl
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_CRYPTO_SCHEDULER) += scheduler
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_SNOW3G) += snow3g
drivers/crypto/meson.build +18 -3
index 1a358ff..229debd 100644
@@ -1,9 +1,24 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2017 Intel Corporation
 
-drivers = ['aesni_gcm', 'aesni_mb', 'caam_jr', 'ccp', 'dpaa_sec', 'dpaa2_sec',
-	'kasumi', 'mvsam', 'nitrox', 'null', 'octeontx', 'openssl', 'qat',
-	'scheduler', 'snow3g', 'virtio', 'zuc']
+drivers = ['aesni_gcm',
+	   'aesni_mb',
+	   'caam_jr',
+	   'ccp',
+	   'dpaa_sec',
+	   'dpaa2_sec',
+	   'kasumi',
+	   'mvsam',
+	   'nitrox',
+	   'null',
+	   'octeontx',
+	   'octeontx2',
+	   'openssl',
+	   'qat',
+	   'scheduler',
+	   'snow3g',
+	   'virtio',
+	   'zuc']
 
 std_deps = ['cryptodev'] # cryptodev pulls in all other needed deps
 config_flag_fmt = 'RTE_LIBRTE_@0@_PMD'
drivers/crypto/octeontx2/Makefile new file +37 -0
new file mode 100644
index 0000000..3273178
@@ -0,0 +1,37 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright (C) 2019 Marvell International Ltd.
+#
+
+include $(RTE_SDK)/mk/rte.vars.mk
+
+# library name
+LIB = librte_pmd_octeontx2_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
+LDLIBS += -lrte_common_cpt -lrte_common_octeontx2
+
+VPATH += $(RTE_SDK)/drivers/crypto/octeontx2
+
+CFLAGS += -O3
+CFLAGS += -I$(RTE_SDK)/drivers/common/cpt
+CFLAGS += -I$(RTE_SDK)/drivers/common/octeontx2
+
+# PMD code
+SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_CRYPTO) += otx2_cryptodev.c
+SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_CRYPTO) += otx2_cryptodev_ops.c
+
+# export include files
+SYMLINK-y-include +=
+
+# versioning export map
+EXPORT_MAP := rte_pmd_octeontx2_crypto_version.map
+
+include $(RTE_SDK)/mk/rte.lib.mk
drivers/crypto/octeontx2/meson.build new file +29 -0
new file mode 100644
index 0000000..2b55d2a
@@ -0,0 +1,29 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright (C) 2019 Marvell International Ltd.
+
+if host_machine.system() != 'linux'
+        build = false
+endif
+
+deps += ['bus_pci']
+deps += ['common_cpt']
+deps += ['common_octeontx2']
+name = 'octeontx2_crypto'
+
+sources = files('otx2_cryptodev.c',
+		'otx2_cryptodev_ops.c')
+
+extra_flags = []
+# This integrated controller runs only on a arm64 machine, remove 32bit warnings
+if not dpdk_conf.get('RTE_ARCH_64')
+	extra_flags += ['-Wno-int-to-pointer-cast', '-Wno-pointer-to-int-cast']
+endif
+
+foreach flag: extra_flags
+	if cc.has_argument(flag)
+		cflags += flag
+	endif
+endforeach
+
+includes += include_directories('../../common/cpt')
+includes += include_directories('../../common/octeontx2')
drivers/crypto/octeontx2/otx2_cryptodev.c new file +111 -0

111 lines not on this page · raw message

drivers/crypto/octeontx2/otx2_cryptodev.h new file +29 -0
new file mode 100644
index 0000000..c9fe0c8
@@ -0,0 +1,29 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (C) 2019 Marvell International Ltd.
+ */
+
+#ifndef _OTX2_CRYPTODEV_H_
+#define _OTX2_CRYPTODEV_H_
+
+#include "cpt_common.h"
+
+/* Marvell OCTEON TX2 Crypto PMD device name */
+#define CRYPTODEV_NAME_OCTEONTX2_PMD	crypto_octeontx2
+
+/**
+ * Device private data
+ */
+struct otx2_cpt_vf {
+	/* To be populated */
+};
+
+#define CPT_LOGTYPE otx2_cpt_logtype
+
+extern int otx2_cpt_logtype;
+
+/*
+ * Crypto device driver ID
+ */
+uint8_t otx2_cryptodev_driver_id;
+
+#endif /* _OTX2_CRYPTODEV_H_ */
drivers/crypto/octeontx2/otx2_cryptodev_ops.c new file +27 -0
new file mode 100644
index 0000000..18ad470
@@ -0,0 +1,27 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (C) 2019 Marvell International Ltd.
+ */
+
+#include <rte_cryptodev_pmd.h>
+
+#include "otx2_cryptodev_ops.h"
+
+struct rte_cryptodev_ops otx2_cpt_ops = {
+	/* Device control ops */
+	.dev_configure = NULL,
+	.dev_start = NULL,
+	.dev_stop = NULL,
+	.dev_close = NULL,
+	.dev_infos_get = NULL,
+
+	.stats_get = NULL,
+	.stats_reset = NULL,
+	.queue_pair_setup = NULL,
+	.queue_pair_release = NULL,
+	.queue_pair_count = NULL,
+
+	/* Symmetric crypto ops */
+	.sym_session_get_size = NULL,
+	.sym_session_configure = NULL,
+	.sym_session_clear = NULL,
+};
drivers/crypto/octeontx2/otx2_cryptodev_ops.h new file +12 -0
new file mode 100644
index 0000000..545614e
@@ -0,0 +1,12 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (C) 2019 Marvell International Ltd.
+ */
+
+#ifndef _OTX2_CRYPTODEV_OPS_H_
+#define _OTX2_CRYPTODEV_OPS_H_
+
+#include <rte_cryptodev_pmd.h>
+
+struct rte_cryptodev_ops otx2_cpt_ops;
+
+#endif /* _OTX2_CRYPTODEV_OPS_H_ */
drivers/crypto/octeontx2/rte_pmd_octeontx2_crypto_version.map new file +4 -0
new file mode 100644
index 0000000..9a61188
@@ -0,0 +1,4 @@
+DPDK_19.08 {
+
+	local: *;
+};
mk/rte.app.mk +5 -1
index 219c540..dbbb437 100644
@@ -101,7 +101,9 @@ ifeq ($(CONFIG_RTE_EXEC_ENV_LINUX),y)
 _LDLIBS-$(CONFIG_RTE_LIBRTE_KNI)            += -lrte_kni
 endif
 
-ifeq ($(CONFIG_RTE_LIBRTE_PMD_OCTEONTX_CRYPTO),y)
+OTX-CPT-y := $(CONFIG_RTE_LIBRTE_PMD_OCTEONTX_CRYPTO)
+OTX-CPT-y += $(CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_CRYPTO)
+ifeq ($(findstring y,$(OTX-CPT-y)),y)
 _LDLIBS-y += -lrte_common_cpt
 endif
 
@@ -109,6 +111,7 @@ ifeq ($(CONFIG_RTE_LIBRTE_PMD_OCTEONTX_SSOVF)$(CONFIG_RTE_LIBRTE_OCTEONTX_MEMPOO
 _LDLIBS-y += -lrte_common_octeontx
 endif
 OCTEONTX2-y := $(CONFIG_RTE_LIBRTE_OCTEONTX2_MEMPOOL)
+OCTEONTX2-y += $(CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_CRYPTO)
 OCTEONTX2-y += $(CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_EVENTDEV)
 OCTEONTX2-y += $(CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_DMA_RAWDEV)
 OCTEONTX2-y += $(CONFIG_RTE_LIBRTE_OCTEONTX2_PMD)
@@ -269,6 +272,7 @@ _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_ARMV8_CRYPTO)    += -L$(ARMV8_CRYPTO_LIB_PATH) -
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_MVSAM_CRYPTO) += -L$(LIBMUSDK_PATH)/lib -lrte_pmd_mvsam_crypto -lmusdk
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_NITROX)      += -lrte_pmd_nitrox
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX_CRYPTO) += -lrte_pmd_octeontx_crypto
+_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_CRYPTO) += -lrte_pmd_octeontx2_crypto
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_CRYPTO_SCHEDULER) += -lrte_pmd_crypto_scheduler
 ifeq ($(CONFIG_RTE_LIBRTE_SECURITY),y)
 ifeq ($(CONFIG_RTE_EAL_VFIO)$(CONFIG_RTE_LIBRTE_FSLMC_BUS),yy)
Signature · 1 line
2.7.4
#23 lore raw

Re: [dpdk-dev] [PATCH v2 01/12] crypto/octeontx2: add PMD skeleton

drivers/crypto/octeontx2/rte_pmd_octeontx2_crypto_version.map line 4

Quoted 11 lines
drivers/crypto/octeontx2/rte_pmd_octeontx2_crypto_version.map new file +4 -0
new file mode 100644
index 0000000..9a61188
@@ -0,0 +1,4 @@
+DPDK_19.08 {
+
+	local: *;
+};

19.08?? Should be 19.11

#24 lore raw

Re: [dpdk-dev] [PATCH v2 01/12] crypto/octeontx2: add PMD skeleton

Hi Akhil,

Will fix the issue. Please do let me know if there are more comments. I can send v3 once you confirm.

Thanks,
Anoob

Quoted 30 lines

-----Original Message-----
From: Akhil Goyal <[email protected]>
Sent: Tuesday, October 15, 2019 1:26 PM
To: Anoob Joseph <[email protected]>; Pablo de Lara <[email protected]>
Cc: Fiona Trahe <[email protected]>; Jerin Jacob Kollanukkaran <[email protected]>; Narayana Prasad Raju Athreya <[email protected]>; Shally Verma <[email protected]>; Ankur Dwivedi <[email protected]>; Kanaka Durga Kotamarthy <[email protected]>; Sunila Sahu <[email protected]>; Tejasree Kondoj <[email protected]>; [email protected]
Subject: [EXT] RE: [PATCH v2 01/12] crypto/octeontx2: add PMD skeleton

External Email

----------------------------------------------------------------------

Quoted 1 line

diff --git

a/drivers/crypto/octeontx2/rte_pmd_octeontx2_crypto_version.map

drivers/crypto/octeontx2/rte_pmd_octeontx2_crypto_version.map line 4

Quoted 10 lines

b/drivers/crypto/octeontx2/rte_pmd_octeontx2_crypto_version.map new file mode 100644
index 0000000..9a61188

drivers/crypto/octeontx2/rte_pmd_octeontx2_crypto_version.map new file +4 -0
@@ -0,0 +1,4 @@
+DPDK_19.08 {
+
+	local: *;
+};

19.08?? Should be 19.11

#25 lore raw

PATCH v2 2/12 crypto/octeontx2: add device init sequence in probe

In reply to Anoob Joseph

This patch adds the device init sequence for OCTEON TX2 crypto device.

---
 drivers/crypto/octeontx2/Makefile              | 10 +++++++
 drivers/crypto/octeontx2/meson.build           |  2 ++
 drivers/crypto/octeontx2/otx2_cryptodev.c      | 40 ++++++++++++++++++++++++++
 drivers/crypto/octeontx2/otx2_cryptodev.h      | 10 ++++++-
 drivers/crypto/octeontx2/otx2_cryptodev_mbox.c | 28 ++++++++++++++++++
 drivers/crypto/octeontx2/otx2_cryptodev_mbox.h | 13 +++++++++
 6 files changed, 102 insertions(+), 1 deletion(-)
 create mode 100644 drivers/crypto/octeontx2/otx2_cryptodev_mbox.c
 create mode 100644 drivers/crypto/octeontx2/otx2_cryptodev_mbox.h
drivers/crypto/octeontx2/Makefile +10 -0
index 3273178..10d8c39 100644
@@ -23,9 +23,19 @@ VPATH += $(RTE_SDK)/drivers/crypto/octeontx2
 CFLAGS += -O3
 CFLAGS += -I$(RTE_SDK)/drivers/common/cpt
 CFLAGS += -I$(RTE_SDK)/drivers/common/octeontx2
+CFLAGS += -I$(RTE_SDK)/drivers/mempool/octeontx2
+
+ifneq ($(CONFIG_RTE_ARCH_64),y)
+CFLAGS += -Wno-int-to-pointer-cast
+CFLAGS += -Wno-pointer-to-int-cast
+ifeq ($(CONFIG_RTE_TOOLCHAIN_ICC),y)
+CFLAGS += -diag-disable 2259
+endif
+endif
 
 # PMD code
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_CRYPTO) += otx2_cryptodev.c
+SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_CRYPTO) += otx2_cryptodev_mbox.c
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_CRYPTO) += otx2_cryptodev_ops.c
 
 # export include files
drivers/crypto/octeontx2/meson.build +2 -0
index 2b55d2a..845d50d 100644
@@ -11,6 +11,7 @@ deps += ['common_octeontx2']
 name = 'octeontx2_crypto'
 
 sources = files('otx2_cryptodev.c',
+		'otx2_cryptodev_mbox.c',
 		'otx2_cryptodev_ops.c')
 
 extra_flags = []
@@ -27,3 +28,4 @@ endforeach
 
 includes += include_directories('../../common/cpt')
 includes += include_directories('../../common/octeontx2')
+includes += include_directories('../../mempool/octeontx2')
drivers/crypto/octeontx2/otx2_cryptodev.c +40 -0
index ca9f227..efc17cb 100644
@@ -14,7 +14,9 @@
 
 #include "otx2_common.h"
 #include "otx2_cryptodev.h"
+#include "otx2_cryptodev_mbox.h"
 #include "otx2_cryptodev_ops.h"
+#include "otx2_dev.h"
 
 /* CPT common headers */
 #include "cpt_common.h"
@@ -44,6 +46,9 @@ otx2_cpt_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
 	};
 	char name[RTE_CRYPTODEV_NAME_MAX_LEN];
 	struct rte_cryptodev *dev;
+	struct otx2_dev *otx2_dev;
+	struct otx2_cpt_vf *vf;
+	uint16_t nb_queues;
 	int ret;
 
 	rte_pci_device_name(&pci_dev->addr, name, sizeof(name));
@@ -58,11 +63,46 @@ otx2_cpt_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
 
 	dev->driver_id = otx2_cryptodev_driver_id;
 
+	/* Get private data space allocated */
+	vf = dev->data->dev_private;
+
+	otx2_dev = &vf->otx2_dev;
+
+	/* Initialize the base otx2_dev object */
+	ret = otx2_dev_init(pci_dev, otx2_dev);
+	if (ret) {
+		CPT_LOG_ERR("Could not initialize otx2_dev");
+		goto pmd_destroy;
+	}
+
+	/* Get number of queues available on the device */
+	ret = otx2_cpt_available_queues_get(dev, &nb_queues);
+	if (ret) {
+		CPT_LOG_ERR("Could not determine the number of queues available");
+		goto otx2_dev_fini;
+	}
+
+	/* Don't exceed the limits set per VF */
+	nb_queues = RTE_MIN(nb_queues, OTX2_CPT_MAX_QUEUES_PER_VF);
+
+	if (nb_queues == 0) {
+		CPT_LOG_ERR("No free queues available on the device");
+		goto otx2_dev_fini;
+	}
+
+	vf->max_queues = nb_queues;
+
+	CPT_LOG_INFO("Max queues supported by device: %d", vf->max_queues);
+
 	dev->feature_flags = RTE_CRYPTODEV_FF_SYMMETRIC_CRYPTO |
 			     RTE_CRYPTODEV_FF_HW_ACCELERATED;
 
 	return 0;
 
+otx2_dev_fini:
+	otx2_dev_fini(pci_dev, otx2_dev);
+pmd_destroy:
+	rte_cryptodev_pmd_destroy(dev);
 exit:
 	CPT_LOG_ERR("Could not create device (vendor_id: 0x%x device_id: 0x%x)",
 		    pci_dev->id.vendor_id, pci_dev->id.device_id);
drivers/crypto/octeontx2/otx2_cryptodev.h +9 -1
index c9fe0c8..d26c1f3 100644
@@ -7,14 +7,22 @@
 
 #include "cpt_common.h"
 
+#include "otx2_dev.h"
+
 /* Marvell OCTEON TX2 Crypto PMD device name */
 #define CRYPTODEV_NAME_OCTEONTX2_PMD	crypto_octeontx2
 
+#define OTX2_CPT_MAX_LFS		64
+#define OTX2_CPT_MAX_QUEUES_PER_VF	64
+
 /**
  * Device private data
  */
 struct otx2_cpt_vf {
-	/* To be populated */
+	struct otx2_dev otx2_dev;
+	/**< Base class */
+	uint16_t max_queues;
+	/**< Max queues supported */
 };
 
 #define CPT_LOGTYPE otx2_cpt_logtype
drivers/crypto/octeontx2/otx2_cryptodev_mbox.c new file +28 -0
new file mode 100644
index 0000000..20fc1ac
@@ -0,0 +1,28 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (C) 2019 Marvell International Ltd.
+ */
+#include <rte_cryptodev.h>
+
+#include "otx2_cryptodev.h"
+#include "otx2_cryptodev_mbox.h"
+#include "otx2_dev.h"
+#include "otx2_mbox.h"
+
+int
+otx2_cpt_available_queues_get(const struct rte_cryptodev *dev,
+			      uint16_t *nb_queues)
+{
+	struct otx2_cpt_vf *vf = dev->data->dev_private;
+	struct otx2_dev *otx2_dev = &vf->otx2_dev;
+	struct free_rsrcs_rsp *rsp;
+	int ret;
+
+	otx2_mbox_alloc_msg_free_rsrc_cnt(otx2_dev->mbox);
+
+	ret = otx2_mbox_process_msg(otx2_dev->mbox, (void *)&rsp);
+	if (ret)
+		return -EIO;
+
+	*nb_queues = rsp->cpt;
+	return 0;
+}
drivers/crypto/octeontx2/otx2_cryptodev_mbox.h new file +13 -0
new file mode 100644
index 0000000..648c009
@@ -0,0 +1,13 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (C) 2019 Marvell International Ltd.
+ */
+
+#ifndef _OTX2_CRYPTODEV_MBOX_H_
+#define _OTX2_CRYPTODEV_MBOX_H_
+
+#include <rte_cryptodev.h>
+
+int otx2_cpt_available_queues_get(const struct rte_cryptodev *dev,
+				  uint16_t *nb_queues);
+
+#endif /* _OTX2_CRYPTODEV_MBOX_H_ */
Signature · 1 line
2.7.4
#26 lore raw

PATCH v2 3/12 crypto/octeontx2: add device control ops

In reply to Anoob Joseph

From: Ankur Dwivedi <[email protected]>

This patch adds the device control functions.

---
 drivers/crypto/octeontx2/Makefile                  |   1 +
 drivers/crypto/octeontx2/meson.build               |   1 +
 drivers/crypto/octeontx2/otx2_cryptodev.h          |   6 +
 .../crypto/octeontx2/otx2_cryptodev_hw_access.c    | 126 +++++++++++++++++++++
 .../crypto/octeontx2/otx2_cryptodev_hw_access.h    |  27 +++++
 drivers/crypto/octeontx2/otx2_cryptodev_mbox.c     |  64 +++++++++++
 drivers/crypto/octeontx2/otx2_cryptodev_mbox.h     |   6 +
 drivers/crypto/octeontx2/otx2_cryptodev_ops.c      | 123 +++++++++++++++++++-
 drivers/crypto/octeontx2/otx2_cryptodev_ops.h      |   3 +
 9 files changed, 352 insertions(+), 5 deletions(-)
 create mode 100644 drivers/crypto/octeontx2/otx2_cryptodev_hw_access.c
 create mode 100644 drivers/crypto/octeontx2/otx2_cryptodev_hw_access.h
drivers/crypto/octeontx2/Makefile +1 -0
index 10d8c39..71bc4d1 100644
@@ -35,6 +35,7 @@ endif
 
 # PMD code
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_CRYPTO) += otx2_cryptodev.c
+SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_CRYPTO) += otx2_cryptodev_hw_access.c
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_CRYPTO) += otx2_cryptodev_mbox.c
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_CRYPTO) += otx2_cryptodev_ops.c
 
drivers/crypto/octeontx2/meson.build +1 -0
index 845d50d..944fa2c 100644
@@ -11,6 +11,7 @@ deps += ['common_octeontx2']
 name = 'octeontx2_crypto'
 
 sources = files('otx2_cryptodev.c',
+		'otx2_cryptodev_hw_access.c',
 		'otx2_cryptodev_mbox.c',
 		'otx2_cryptodev_ops.c')
 
drivers/crypto/octeontx2/otx2_cryptodev.h +6 -0
index d26c1f3..8e0ebc2 100644
@@ -23,6 +23,12 @@ struct otx2_cpt_vf {
 	/**< Base class */
 	uint16_t max_queues;
 	/**< Max queues supported */
+	uint8_t nb_queues;
+	/**< Number of crypto queues attached */
+	uint16_t lf_msixoff[OTX2_CPT_MAX_LFS];
+	/**< MSI-X offsets */
+	uint8_t err_intr_registered:1;
+	/**< Are error interrupts registered? */
 };
 
 #define CPT_LOGTYPE otx2_cpt_logtype
drivers/crypto/octeontx2/otx2_cryptodev_hw_access.c new file +126 -0

126 lines not on this page · raw message

drivers/crypto/octeontx2/otx2_cryptodev_hw_access.h new file +27 -0
new file mode 100644
index 0000000..2af674d
@@ -0,0 +1,27 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (C) 2019 Marvell International Ltd.
+ */
+
+#ifndef _OTX2_CRYPTODEV_HW_ACCESS_H_
+#define _OTX2_CRYPTODEV_HW_ACCESS_H_
+
+#include <rte_cryptodev.h>
+
+#include "otx2_dev.h"
+
+/* Register offsets */
+
+/* CPT LF registers */
+#define OTX2_CPT_LF_MISC_INT		0xb0ull
+#define OTX2_CPT_LF_MISC_INT_ENA_W1S	0xd0ull
+#define OTX2_CPT_LF_MISC_INT_ENA_W1C	0xe0ull
+
+#define OTX2_CPT_LF_BAR2(vf, q_id) \
+		((vf)->otx2_dev.bar2 + \
+		 ((RVU_BLOCK_ADDR_CPT0 << 20) | ((q_id) << 12)))
+
+void otx2_cpt_err_intr_unregister(const struct rte_cryptodev *dev);
+
+int otx2_cpt_err_intr_register(const struct rte_cryptodev *dev);
+
+#endif /* _OTX2_CRYPTODEV_HW_ACCESS_H_ */
drivers/crypto/octeontx2/otx2_cryptodev_mbox.c +64 -0

67 lines not on this page · raw message

drivers/crypto/octeontx2/otx2_cryptodev_mbox.h +6 -0
index 648c009..0a43061 100644
@@ -10,4 +10,10 @@
 int otx2_cpt_available_queues_get(const struct rte_cryptodev *dev,
 				  uint16_t *nb_queues);
 
+int otx2_cpt_queues_attach(const struct rte_cryptodev *dev, uint8_t nb_queues);
+
+int otx2_cpt_queues_detach(const struct rte_cryptodev *dev);
+
+int otx2_cpt_msix_offsets_get(const struct rte_cryptodev *dev);
+
 #endif /* _OTX2_CRYPTODEV_MBOX_H_ */
drivers/crypto/octeontx2/otx2_cryptodev_ops.c +118 -5

133 lines not on this page · raw message

drivers/crypto/octeontx2/otx2_cryptodev_ops.h +3 -0
index 545614e..9bd24e7 100644
@@ -7,6 +7,9 @@
 
 #include <rte_cryptodev_pmd.h>
 
+#define OTX2_CPT_MIN_HEADROOM_REQ	24
+#define OTX2_CPT_MIN_TAILROOM_REQ	8
+
 struct rte_cryptodev_ops otx2_cpt_ops;
 
 #endif /* _OTX2_CRYPTODEV_OPS_H_ */
Signature · 1 line
2.7.4
#27 lore raw

PATCH v2 4/12 crypto/octeontx2: add queue pair functions

In reply to Anoob Joseph

From: Ankur Dwivedi <[email protected]>

This patch adds the queue pair setup and queue pair release functions for OCTEON TX2 crypto pmd.

---
 .../crypto/octeontx2/otx2_cryptodev_hw_access.c    |  99 +++++++
 .../crypto/octeontx2/otx2_cryptodev_hw_access.h    | 126 +++++++++
 drivers/crypto/octeontx2/otx2_cryptodev_mbox.c     |  83 ++++++
 drivers/crypto/octeontx2/otx2_cryptodev_mbox.h     |   6 +
 drivers/crypto/octeontx2/otx2_cryptodev_ops.c      | 306 ++++++++++++++++++++-
 5 files changed, 617 insertions(+), 3 deletions(-)
drivers/crypto/octeontx2/otx2_cryptodev_hw_access.c +99 -0
index 663f9ca..9e4f782 100644
@@ -1,10 +1,14 @@
 /* SPDX-License-Identifier: BSD-3-Clause
  * Copyright (C) 2019 Marvell International Ltd.
  */
+#include <rte_cryptodev.h>
 
 #include "otx2_common.h"
 #include "otx2_cryptodev.h"
 #include "otx2_cryptodev_hw_access.h"
+#include "otx2_cryptodev_mbox.h"
+#include "otx2_cryptodev_ops.h"
+#include "otx2_dev.h"
 
 #include "cpt_pmd_logs.h"
 
@@ -124,3 +128,98 @@ otx2_cpt_err_intr_register(const struct rte_cryptodev *dev)
 	 */
 	return 0;
 }
+
+int
+otx2_cpt_iq_enable(const struct rte_cryptodev *dev,
+		   const struct otx2_cpt_qp *qp, uint8_t grp_mask, uint8_t pri,
+		   uint32_t size_div40)
+{
+	union otx2_cpt_af_lf_ctl af_lf_ctl;
+	union otx2_cpt_lf_inprog inprog;
+	union otx2_cpt_lf_q_base base;
+	union otx2_cpt_lf_q_size size;
+	union otx2_cpt_lf_ctl lf_ctl;
+	int ret;
+
+	/* Set engine group mask and priority */
+
+	ret = otx2_cpt_af_reg_read(dev, OTX2_CPT_AF_LF_CTL(qp->id),
+				   &af_lf_ctl.u);
+	if (ret)
+		return ret;
+	af_lf_ctl.s.grp = grp_mask;
+	af_lf_ctl.s.pri = pri ? 1 : 0;
+	ret = otx2_cpt_af_reg_write(dev, OTX2_CPT_AF_LF_CTL(qp->id),
+				    af_lf_ctl.u);
+	if (ret)
+		return ret;
+
+	/* Set instruction queue base address */
+
+	base.u = otx2_read64(qp->base + OTX2_CPT_LF_Q_BASE);
+	base.s.fault = 0;
+	base.s.stopped = 0;
+	base.s.addr = qp->iq_dma_addr >> 7;
+	otx2_write64(base.u, qp->base + OTX2_CPT_LF_Q_BASE);
+
+	/* Set instruction queue size */
+
+	size.u = otx2_read64(qp->base + OTX2_CPT_LF_Q_SIZE);
+	size.s.size_div40 = size_div40;
+	otx2_write64(size.u, qp->base + OTX2_CPT_LF_Q_SIZE);
+
+	/* Enable instruction queue */
+
+	lf_ctl.u = otx2_read64(qp->base + OTX2_CPT_LF_CTL);
+	lf_ctl.s.ena = 1;
+	otx2_write64(lf_ctl.u, qp->base + OTX2_CPT_LF_CTL);
+
+	/* Start instruction execution */
+
+	inprog.u = otx2_read64(qp->base + OTX2_CPT_LF_INPROG);
+	inprog.s.eena = 1;
+	otx2_write64(inprog.u, qp->base + OTX2_CPT_LF_INPROG);
+
+	return 0;
+}
+
+void
+otx2_cpt_iq_disable(struct otx2_cpt_qp *qp)
+{
+	union otx2_cpt_lf_q_grp_ptr grp_ptr;
+	union otx2_cpt_lf_inprog inprog;
+	union otx2_cpt_lf_ctl ctl;
+	int cnt;
+
+	/* Stop instruction execution */
+	inprog.u = otx2_read64(qp->base + OTX2_CPT_LF_INPROG);
+	inprog.s.eena = 0x0;
+	otx2_write64(inprog.u, qp->base + OTX2_CPT_LF_INPROG);
+
+	/* Disable instructions enqueuing */
+	ctl.u = otx2_read64(qp->base + OTX2_CPT_LF_CTL);
+	ctl.s.ena = 0;
+	otx2_write64(ctl.u, qp->base + OTX2_CPT_LF_CTL);
+
+	/* Wait for instruction queue to become empty */
+	cnt = 0;
+	do {
+		inprog.u = otx2_read64(qp->base + OTX2_CPT_LF_INPROG);
+		if (inprog.s.grb_partial)
+			cnt = 0;
+		else
+			cnt++;
+		grp_ptr.u = otx2_read64(qp->base + OTX2_CPT_LF_Q_GRP_PTR);
+	} while ((cnt < 10) && (grp_ptr.s.nq_ptr != grp_ptr.s.dq_ptr));
+
+	cnt = 0;
+	do {
+		inprog.u = otx2_read64(qp->base + OTX2_CPT_LF_INPROG);
+		if ((inprog.s.inflight == 0) &&
+		    (inprog.s.gwb_cnt < 40) &&
+		    ((inprog.s.grb_cnt == 0) || (inprog.s.grb_cnt == 40)))
+			cnt++;
+		else
+			cnt = 0;
+	} while (cnt < 10);
+}
drivers/crypto/octeontx2/otx2_cryptodev_hw_access.h +126 -0

149 lines not on this page · raw message

drivers/crypto/octeontx2/otx2_cryptodev_mbox.c +83 -0

92 lines not on this page · raw message

drivers/crypto/octeontx2/otx2_cryptodev_mbox.h +6 -0
index 0a43061..a298718 100644
@@ -16,4 +16,10 @@ int otx2_cpt_queues_detach(const struct rte_cryptodev *dev);
 
 int otx2_cpt_msix_offsets_get(const struct rte_cryptodev *dev);
 
+int otx2_cpt_af_reg_read(const struct rte_cryptodev *dev, uint64_t reg,
+			 uint64_t *val);
+
+int otx2_cpt_af_reg_write(const struct rte_cryptodev *dev, uint64_t reg,
+			  uint64_t val);
+
 #endif /* _OTX2_CRYPTODEV_MBOX_H_ */
drivers/crypto/octeontx2/otx2_cryptodev_ops.c +303 -3

337 lines not on this page · raw message

Signature · 1 line
2.7.4
#28 lore raw

PATCH v2 5/12 crypto/octeontx2: add symmetric capabilities

In reply to Anoob Joseph

This patch adds the symmetric capabilities for OCTEON TX2 crypto PMD.

---
 doc/guides/cryptodevs/features/octeontx2.ini       |  59 ++
 doc/guides/cryptodevs/octeontx2.rst                |  41 ++
 drivers/crypto/octeontx2/Makefile                  |   1 +
 drivers/crypto/octeontx2/meson.build               |   1 +
 drivers/crypto/octeontx2/otx2_cryptodev.c          |   6 +-
 .../crypto/octeontx2/otx2_cryptodev_capabilities.c | 604 +++++++++++++++++++++
 .../crypto/octeontx2/otx2_cryptodev_capabilities.h |  16 +
 drivers/crypto/octeontx2/otx2_cryptodev_ops.c      |   3 +-
 8 files changed, 729 insertions(+), 2 deletions(-)
 create mode 100644 drivers/crypto/octeontx2/otx2_cryptodev_capabilities.c
 create mode 100644 drivers/crypto/octeontx2/otx2_cryptodev_capabilities.h
doc/guides/cryptodevs/features/octeontx2.ini +59 -0
index 35c9bee..4e82463 100644
@@ -5,4 +5,63 @@
 ;
 [Features]
 Symmetric crypto       = Y
+Sym operation chaining = Y
 HW Accelerated         = Y
+In Place SGL           = Y
+OOP SGL In LB  Out     = Y
+OOP SGL In SGL Out     = Y
+
+;
+; Supported crypto algorithms of 'octeontx2' crypto driver.
+;
+[Cipher]
+NULL           = Y
+3DES CBC       = Y
+3DES ECB       = Y
+AES CBC (128)  = Y
+AES CBC (192)  = Y
+AES CBC (256)  = Y
+AES CTR (128)  = Y
+AES CTR (192)  = Y
+AES CTR (256)  = Y
+AES XTS (128)  = Y
+AES XTS (256)  = Y
+DES CBC        = Y
+KASUMI F8      = Y
+SNOW3G UEA2    = Y
+ZUC EEA3       = Y
+
+;
+; Supported authentication algorithms of 'octeontx2' crypto driver.
+;
+[Auth]
+NULL         = Y
+AES GMAC     = Y
+KASUMI F9    = Y
+MD5          = Y
+MD5 HMAC     = Y
+SHA1         = Y
+SHA1 HMAC    = Y
+SHA224       = Y
+SHA224 HMAC  = Y
+SHA256       = Y
+SHA256 HMAC  = Y
+SHA384       = Y
+SHA384 HMAC  = Y
+SHA512       = Y
+SHA512 HMAC  = Y
+SNOW3G UIA2  = Y
+ZUC EIA3     = Y
+
+;
+; Supported AEAD algorithms of 'octeontx2' crypto driver.
+;
+[AEAD]
+AES GCM (128) = Y
+AES GCM (192) = Y
+AES GCM (256) = Y
+
+;
+; Supported Asymmetric algorithms of the 'octeontx2' crypto driver.
+;
+[Asymmetric]
doc/guides/cryptodevs/octeontx2.rst +41 -0

47 lines not on this page · raw message

drivers/crypto/octeontx2/Makefile +1 -0
index 71bc4d1..968efac 100644
@@ -35,6 +35,7 @@ endif
 
 # PMD code
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_CRYPTO) += otx2_cryptodev.c
+SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_CRYPTO) += otx2_cryptodev_capabilities.c
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_CRYPTO) += otx2_cryptodev_hw_access.c
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_CRYPTO) += otx2_cryptodev_mbox.c
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_CRYPTO) += otx2_cryptodev_ops.c
drivers/crypto/octeontx2/meson.build +1 -0
index 944fa2c..ee2e907 100644
@@ -11,6 +11,7 @@ deps += ['common_octeontx2']
 name = 'octeontx2_crypto'
 
 sources = files('otx2_cryptodev.c',
+		'otx2_cryptodev_capabilities.c',
 		'otx2_cryptodev_hw_access.c',
 		'otx2_cryptodev_mbox.c',
 		'otx2_cryptodev_ops.c')
drivers/crypto/octeontx2/otx2_cryptodev.c +5 -1
index efc17cb..32c0b48 100644
@@ -95,7 +95,11 @@ otx2_cpt_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
 	CPT_LOG_INFO("Max queues supported by device: %d", vf->max_queues);
 
 	dev->feature_flags = RTE_CRYPTODEV_FF_SYMMETRIC_CRYPTO |
-			     RTE_CRYPTODEV_FF_HW_ACCELERATED;
+			     RTE_CRYPTODEV_FF_HW_ACCELERATED |
+			     RTE_CRYPTODEV_FF_SYM_OPERATION_CHAINING |
+			     RTE_CRYPTODEV_FF_IN_PLACE_SGL |
+			     RTE_CRYPTODEV_FF_OOP_SGL_IN_LB_OUT |
+			     RTE_CRYPTODEV_FF_OOP_SGL_IN_SGL_OUT;
 
 	return 0;
 
drivers/crypto/octeontx2/otx2_cryptodev_capabilities.c new file +604 -0

604 lines not on this page · raw message

drivers/crypto/octeontx2/otx2_cryptodev_capabilities.h new file +16 -0
new file mode 100644
index 0000000..f103c32
@@ -0,0 +1,16 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (C) 2019 Marvell International Ltd.
+ */
+
+#ifndef _OTX2_CRYPTODEV_CAPABILITIES_H_
+#define _OTX2_CRYPTODEV_CAPABILITIES_H_
+
+#include <rte_cryptodev.h>
+
+/*
+ * Get capabilities list for the device
+ *
+ */
+const struct rte_cryptodev_capabilities *otx2_cpt_capabilities_get(void);
+
+#endif /* _OTX2_CRYPTODEV_CAPABILITIES_H_ */
drivers/crypto/octeontx2/otx2_cryptodev_ops.c +2 -1
index de53055..79961f3 100644
@@ -8,6 +8,7 @@
 #include <rte_errno.h>
 
 #include "otx2_cryptodev.h"
+#include "otx2_cryptodev_capabilities.h"
 #include "otx2_cryptodev_hw_access.h"
 #include "otx2_cryptodev_mbox.h"
 #include "otx2_cryptodev_ops.h"
@@ -347,7 +348,7 @@ otx2_cpt_dev_info_get(struct rte_cryptodev *dev,
 	if (info != NULL) {
 		info->max_nb_queue_pairs = vf->max_queues;
 		info->feature_flags = dev->feature_flags;
-		info->capabilities = NULL;
+		info->capabilities = otx2_cpt_capabilities_get();
 		info->sym.max_nb_sessions = 0;
 		info->driver_id = otx2_cryptodev_driver_id;
 		info->min_mbuf_headroom_req = OTX2_CPT_MIN_HEADROOM_REQ;
Signature · 1 line
2.7.4
#29 lore raw

PATCH v2 6/12 crypto/octeontx2: add session related functions

In reply to Anoob Joseph

From: Ankur Dwivedi <[email protected]>

This patch adds the symmetric session related callbacks.

---
 drivers/common/cpt/cpt_mcode_defines.h        |   2 +
 drivers/crypto/octeontx2/otx2_cryptodev_ops.c | 117 +++++++++++++++++++++++++-
 drivers/crypto/octeontx2/otx2_cryptodev_ops.h |   5 ++
 3 files changed, 121 insertions(+), 3 deletions(-)
drivers/common/cpt/cpt_mcode_defines.h +2 -0
index 91d30a5..f356e62 100644
@@ -226,6 +226,8 @@ struct cpt_sess_misc {
 	uint16_t is_null:1;
 	/** Flag for GMAC */
 	uint16_t is_gmac:1;
+	/** Engine group */
+	uint16_t egrp:3;
 	/** AAD length */
 	uint16_t aad_length;
 	/** MAC len in bytes */
drivers/crypto/octeontx2/otx2_cryptodev_ops.c +114 -3

139 lines not on this page · raw message

drivers/crypto/octeontx2/otx2_cryptodev_ops.h +5 -0
index 9bd24e7..ba93a66 100644
@@ -10,6 +10,11 @@
 #define OTX2_CPT_MIN_HEADROOM_REQ	24
 #define OTX2_CPT_MIN_TAILROOM_REQ	8
 
+enum otx2_cpt_egrp {
+	OTX2_CPT_EGRP_SE = 0,
+	OTX2_CPT_EGRP_SE_IE = 1,
+};
+
 struct rte_cryptodev_ops otx2_cpt_ops;
 
 #endif /* _OTX2_CRYPTODEV_OPS_H_ */
Signature · 1 line
2.7.4
#30 lore raw

PATCH v2 7/12 crypto/octeontx2: add enqueue/dequeue ops

In reply to Anoob Joseph

This patch adds the enqueue burst and dequeue burst callbacks for the OCTEON TX2 crypto driver.

---
 drivers/common/cpt/cpt_hw_types.h                  |  52 ++++
 drivers/crypto/octeontx2/Makefile                  |   1 +
 drivers/crypto/octeontx2/meson.build               |   1 +
 .../crypto/octeontx2/otx2_cryptodev_hw_access.h    |  16 ++
 drivers/crypto/octeontx2/otx2_cryptodev_ops.c      | 289 +++++++++++++++++++++
 5 files changed, 359 insertions(+)
drivers/common/cpt/cpt_hw_types.h +52 -0
index 4c2893b..e2b127d 100644
@@ -197,6 +197,44 @@ typedef union cpt_inst_s {
 		};
 #endif /* Word 7 - End */
 	} s8x;
+	struct cpt_inst_s_9s {
+#if (RTE_BYTE_ORDER == RTE_BIG_ENDIAN) /* Word 0 - Big Endian */
+		uint64_t nixtx_addr            : 60;
+		uint64_t doneint               : 1;
+		uint64_t nixtxl                : 3;
+#else /* Word 0 - Little Endian */
+		uint64_t nixtxl                : 3;
+		uint64_t doneint               : 1;
+		uint64_t nixtx_addr            : 60;
+#endif /* Word 0 - End */
+		uint64_t res_addr;
+#if (RTE_BYTE_ORDER == RTE_BIG_ENDIAN) /* Word 2 - Big Endian */
+		uint64_t rvu_pf_func           : 16;
+		uint64_t reserved_172_175      : 4;
+		uint64_t grp                   : 10;
+		uint64_t tt                    : 2;
+		uint64_t tag                   : 32;
+#else /* Word 2 - Little Endian */
+		uint64_t tag                   : 32;
+		uint64_t tt                    : 2;
+		uint64_t grp                   : 10;
+		uint64_t reserved_172_175      : 4;
+		uint64_t rvu_pf_func           : 16;
+#endif /* Word 2 - End */
+#if (RTE_BYTE_ORDER == RTE_BIG_ENDIAN) /* Word 3 - Big Endian */
+		uint64_t wq_ptr                : 61;
+		uint64_t reserved_194_193      : 2;
+		uint64_t qord                  : 1;
+#else /* Word 3 - Little Endian */
+		uint64_t qord                  : 1;
+		uint64_t reserved_194_193      : 2;
+		uint64_t wq_ptr                : 61;
+#endif /* Word 3 - End */
+		uint64_t ei0;
+		uint64_t ei1;
+		uint64_t ei2;
+		uint64_t ei3;
+	} s9x;
 } cpt_inst_s_t;
 
 /**
@@ -243,6 +281,20 @@ typedef union cpt_res_s {
 		uint64_t reserved_64_127       : 64;
 #endif /* Word 1 - End */
 	} s8x;
+	struct cpt_res_s_9s {
+#if (RTE_BYTE_ORDER == RTE_BIG_ENDIAN) /* Word 0 - Big Endian */
+		uint64_t reserved_17_63:47;
+		uint64_t doneint:1;
+		uint64_t uc_compcode:8;
+		uint64_t compcode:8;
+#else /* Word 0 - Little Endian */
+		uint64_t compcode:8;
+		uint64_t uc_compcode:8;
+		uint64_t doneint:1;
+		uint64_t reserved_17_63:47;
+#endif /* Word 0 - End */
+		uint64_t reserved_64_127;
+	} s9x;
 } cpt_res_s_t;
 
 /**
drivers/crypto/octeontx2/Makefile +1 -0
index 968efac..ce116b8 100644
@@ -24,6 +24,7 @@ CFLAGS += -O3
 CFLAGS += -I$(RTE_SDK)/drivers/common/cpt
 CFLAGS += -I$(RTE_SDK)/drivers/common/octeontx2
 CFLAGS += -I$(RTE_SDK)/drivers/mempool/octeontx2
+CFLAGS += -DALLOW_EXPERIMENTAL_API
 
 ifneq ($(CONFIG_RTE_ARCH_64),y)
 CFLAGS += -Wno-int-to-pointer-cast
drivers/crypto/octeontx2/meson.build +1 -0
index ee2e907..b6e5b73 100644
@@ -10,6 +10,7 @@ deps += ['common_cpt']
 deps += ['common_octeontx2']
 name = 'octeontx2_crypto'
 
+allow_experimental_apis = true
 sources = files('otx2_cryptodev.c',
 		'otx2_cryptodev_capabilities.c',
 		'otx2_cryptodev_hw_access.c',
drivers/crypto/octeontx2/otx2_cryptodev_hw_access.h +16 -0
index 87d4e77..6f78aa4 100644
@@ -12,6 +12,7 @@
 
 #include "cpt_common.h"
 #include "cpt_hw_types.h"
+#include "cpt_mcode_defines.h"
 
 #include "otx2_dev.h"
 
@@ -119,6 +120,21 @@ union otx2_cpt_lf_q_grp_ptr {
 	} s;
 };
 
+/*
+ * Enumeration cpt_9x_comp_e
+ *
+ * CPT 9X Completion Enumeration
+ * Enumerates the values of CPT_RES_S[COMPCODE].
+ */
+enum cpt_9x_comp_e {
+	CPT_9X_COMP_E_NOTDONE = 0x00,
+	CPT_9X_COMP_E_GOOD = 0x01,
+	CPT_9X_COMP_E_FAULT = 0x02,
+	CPT_9X_COMP_E_HWERR = 0x04,
+	CPT_9X_COMP_E_INSTERR = 0x05,
+	CPT_9X_COMP_E_LAST_ENTRY = 0x06
+};
+
 struct otx2_cpt_qp {
 	uint32_t id;
 	/**< Queue pair id */
drivers/crypto/octeontx2/otx2_cryptodev_ops.c +289 -0

301 lines not on this page · raw message

Signature · 1 line
2.7.4
#31 lore raw

Re: [dpdk-dev] [PATCH v2 07/12] crypto/octeontx2: add enqueue/dequeue ops

Hi Anoob,

This is a typical producer-consumer case, enqueue and dequeue operations must be conducted in a synchronized way, otherwise stale or earlier-than-arrival data will be got. Out-of-synchronization issues are more prone to happen on weak memory ordered platforms, like arm and PPC, if execution in the program order is assumed. I see in this patch MOD_INC() and other reads/writes of the indexes might get reordered with regard to real enqueue and deque operations, this may cause synchronization errors. I have a fix for rte ring using C11 to keep synchronized operations, please refer to: http://patches.dpdk.org/patch/47733/
/Gavin

Quoted 15 lines

-----Original Message-----
From: dev <[email protected]> On Behalf Of Anoob Joseph
Sent: Sunday, October 13, 2019 8:40 PM
To: [email protected]; Pablo de Lara <[email protected]>
Cc: Anoob Joseph <[email protected]>; Fiona Trahe <[email protected]>; [email protected]; Narayana Prasad <[email protected]>; Shally Verma <[email protected]>; Ankur Dwivedi <[email protected]>; Kanaka Durga Kotamarthy <[email protected]>; Sunila Sahu <[email protected]>; Tejasree Kondoj <[email protected]>; [email protected]
Subject: [dpdk-dev] [PATCH v2 07/12] crypto/octeontx2: add enqueue/dequeue ops

This patch adds the enqueue burst and dequeue burst callbacks for the OCTEON TX2 crypto driver.

<snip>

#32 lore raw

Re: [dpdk-dev] [PATCH v2 07/12] crypto/octeontx2: add enqueue/dequeue ops

Hi Gavin,

Thanks for your review and suggestion. I agree with your suggestion and would be taking up the rework. But since we are close to RC1, I would like to defer this to the next release cycle. This change would touch all features supported and hence, will require an extensive QA internally.

Thanks,
Anoob

Quoted 56 lines

-----Original Message-----
From: Gavin Hu (Arm Technology China) <[email protected]>
Sent: Tuesday, October 15, 2019 4:50 PM
To: Anoob Joseph <[email protected]>; [email protected]; Pablo de Lara <[email protected]>
Cc: Fiona Trahe <[email protected]>; Jerin Jacob Kollanukkaran <[email protected]>; Narayana Prasad Raju Athreya <[email protected]>; Shally Verma <[email protected]>; Ankur Dwivedi <[email protected]>; Kanaka Durga Kotamarthy <[email protected]>; Sunila Sahu <[email protected]>; Tejasree Kondoj <[email protected]>; [email protected]; Honnappa Nagarahalli <[email protected]>; nd <[email protected]>; nd <[email protected]>
Subject: [EXT] RE: [dpdk-dev] [PATCH v2 07/12] crypto/octeontx2: add enqueue/dequeue ops

External Email

----------------------------------------------------------------------
Hi Anoob,

This is a typical producer-consumer case, enqueue and dequeue operations must be conducted in a synchronized way, otherwise stale or earlier-than- arrival data will be got.
Out-of-synchronization issues are more prone to happen on weak memory ordered platforms, like arm and PPC, if execution in the program order is assumed.
I see in this patch MOD_INC() and other reads/writes of the indexes might get reordered with regard to real enqueue and deque operations, this may cause synchronization errors.
I have a fix for rte ring using C11 to keep synchronized operations, please refer to: https://urldefense.proofpoint.com/v2/url?u=http-
3A__patches.dpdk.org_patch_47733_&d=DwIFAg&c=nKjWec2b6R0mOyPaz7 xtfQ&r=jPfB8rwwviRSxyLWs2n6B-WYLn1v9SyTMrT5EQqh2TU&m=- CQNFLhmDggI38cEto5lpU668oUfOgbIO8Akw7ViaVM&s=c5- AH2gQk6Kqi_AKdacCs0k-w42Qrisy4Ev9SF3fG6w&e=
/Gavin

Quoted 10 lines

-----Original Message-----
From: dev <[email protected]> On Behalf Of Anoob Joseph
Sent: Sunday, October 13, 2019 8:40 PM
To: [email protected]; Pablo de Lara <[email protected]>
Cc: Anoob Joseph <[email protected]>; Fiona Trahe <[email protected]>; [email protected]; Narayana Prasad <[email protected]>; Shally Verma <[email protected]>; Ankur Dwivedi <[email protected]>; Kanaka Durga Kotamarthy <[email protected]>; Sunila Sahu <[email protected]>;

Tejasree

Quoted 6 lines

Kondoj <[email protected]>; [email protected]
Subject: [dpdk-dev] [PATCH v2 07/12] crypto/octeontx2: add enqueue/dequeue ops

This patch adds the enqueue burst and dequeue burst callbacks for the OCTEON TX2 crypto driver.

<snip>

#33 lore raw

PATCH v2 8/12 test: add OCTEON TX2 tests

In reply to Anoob Joseph

This patch adds the OCTEON TX2 crypto validation tests.

---
 app/test/meson.build                        |   1 +
 app/test/test_cryptodev.c                   | 323 ++++++++++++++++++++++++++++
 app/test/test_cryptodev.h                   |   1 +
 app/test/test_cryptodev_aes_test_vectors.h  | 114 ++++++----
 app/test/test_cryptodev_blockcipher.c       |   7 +
 app/test/test_cryptodev_blockcipher.h       |   1 +
 app/test/test_cryptodev_des_test_vectors.h  |  12 +-
 app/test/test_cryptodev_hash_test_vectors.h |  75 ++++---
 doc/guides/cryptodevs/octeontx2.rst         |  11 +
 9 files changed, 478 insertions(+), 67 deletions(-)
app/test/meson.build +1 -0
index 2c23c63..a88b0eb 100644
@@ -271,6 +271,7 @@ driver_test_names = [
         'cryptodev_dpaa_sec_autotest',
         'cryptodev_dpaa2_sec_autotest',
         'cryptodev_null_autotest',
+        'cryptodev_octeontx2_autotest',
         'cryptodev_openssl_autotest',
         'cryptodev_openssl_asym_autotest',
         'cryptodev_qat_autotest',
app/test/test_cryptodev.c +323 -0

346 lines not on this page · raw message

app/test/test_cryptodev.h +1 -0
index d20586e..def304e 100644
@@ -66,6 +66,7 @@
 #define CRYPTODEV_NAME_CCP_PMD		crypto_ccp
 #define CRYPTODEV_NAME_VIRTIO_PMD	crypto_virtio
 #define CRYPTODEV_NAME_OCTEONTX_SYM_PMD	crypto_octeontx
+#define CRYPTODEV_NAME_OCTEONTX2_PMD	crypto_octeontx2
 #define CRYPTODEV_NAME_CAAM_JR_PMD	crypto_caam_jr
 #define CRYPTODEV_NAME_NITROX_PMD	crypto_nitrox_sym
 
app/test/test_cryptodev_aes_test_vectors.h +76 -38

342 lines not on this page · raw message

app/test/test_cryptodev_blockcipher.c +7 -0
index 885a20e..5bfe2d0 100644
@@ -77,6 +77,8 @@ test_blockcipher_one_case(const struct blockcipher_test_case *t,
 			RTE_STR(CRYPTODEV_NAME_VIRTIO_PMD));
 	int octeontx_pmd = rte_cryptodev_driver_id_get(
 			RTE_STR(CRYPTODEV_NAME_OCTEONTX_SYM_PMD));
+	int octeontx2_pmd = rte_cryptodev_driver_id_get(
+			RTE_STR(CRYPTODEV_NAME_OCTEONTX2_PMD));
 	int null_pmd = rte_cryptodev_driver_id_get(
 				RTE_STR(CRYPTODEV_NAME_NULL_PMD));
 	int nitrox_pmd = rte_cryptodev_driver_id_get(
@@ -127,6 +129,7 @@ test_blockcipher_one_case(const struct blockcipher_test_case *t,
 			driver_id == ccp_pmd ||
 			driver_id == virtio_pmd ||
 			driver_id == octeontx_pmd ||
+			driver_id == octeontx2_pmd ||
 			driver_id == null_pmd ||
 			driver_id == nitrox_pmd) { /* Fall through */
 		digest_len = tdata->digest.len;
@@ -718,6 +721,8 @@ test_blockcipher_all_tests(struct rte_mempool *mbuf_pool,
 			RTE_STR(CRYPTODEV_NAME_VIRTIO_PMD));
 	int octeontx_pmd = rte_cryptodev_driver_id_get(
 			RTE_STR(CRYPTODEV_NAME_OCTEONTX_SYM_PMD));
+	int octeontx2_pmd = rte_cryptodev_driver_id_get(
+			RTE_STR(CRYPTODEV_NAME_OCTEONTX2_PMD));
 	int null_pmd = rte_cryptodev_driver_id_get(
 				RTE_STR(CRYPTODEV_NAME_NULL_PMD));
 	int nitrox_pmd = rte_cryptodev_driver_id_get(
@@ -792,6 +797,8 @@ test_blockcipher_all_tests(struct rte_mempool *mbuf_pool,
 		target_pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_VIRTIO;
 	else if (driver_id == octeontx_pmd)
 		target_pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX;
+	else if (driver_id == octeontx2_pmd)
+		target_pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX2;
 	else if (driver_id == null_pmd)
 		target_pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_NULL;
 	else if (driver_id == nitrox_pmd)
app/test/test_cryptodev_blockcipher.h +1 -0
index 1a65cda..204ba7b 100644
@@ -33,6 +33,7 @@
 #define BLOCKCIPHER_TEST_TARGET_PMD_CCP		0x0800 /* CCP flag */
 #define BLOCKCIPHER_TEST_TARGET_PMD_NULL	0x1000 /* NULL flag */
 #define BLOCKCIPHER_TEST_TARGET_PMD_NITROX	0x2000 /* NITROX flag */
+#define BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX2	0x4000 /* OCTEON TX2 flag */
 
 #define BLOCKCIPHER_TEST_OP_CIPHER	(BLOCKCIPHER_TEST_OP_ENCRYPT | \
 					BLOCKCIPHER_TEST_OP_DECRYPT)
app/test/test_cryptodev_des_test_vectors.h +8 -4
index a71b0e9..9d2d0e7 100644
@@ -1114,7 +1114,8 @@ static const struct blockcipher_test_case triple_des_chain_test_cases[] = {
 			BLOCKCIPHER_TEST_TARGET_PMD_CAAM_JR |
 			BLOCKCIPHER_TEST_TARGET_PMD_MVSAM |
 			BLOCKCIPHER_TEST_TARGET_PMD_CCP |
-			BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX
+			BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX |
+			BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX2
 	},
 	{
 		.test_descr = "3DES-192-CBC HMAC-SHA1 Decryption Digest Verify",
@@ -1127,7 +1128,8 @@ static const struct blockcipher_test_case triple_des_chain_test_cases[] = {
 			BLOCKCIPHER_TEST_TARGET_PMD_CAAM_JR |
 			BLOCKCIPHER_TEST_TARGET_PMD_MVSAM |
 			BLOCKCIPHER_TEST_TARGET_PMD_CCP |
-			BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX
+			BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX |
+			BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX2
 	},
 	{
 		.test_descr = "3DES-192-CBC SHA1 Encryption Digest",
@@ -1296,7 +1298,8 @@ static const struct blockcipher_test_case triple_des_cipheronly_test_cases[] = {
 			BLOCKCIPHER_TEST_TARGET_PMD_MVSAM |
 			BLOCKCIPHER_TEST_TARGET_PMD_CCP |
 			BLOCKCIPHER_TEST_TARGET_PMD_MB |
-			BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX
+			BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX |
+			BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX2
 	},
 	{
 		.test_descr = "3DES-192-CBC Decryption",
@@ -1310,7 +1313,8 @@ static const struct blockcipher_test_case triple_des_cipheronly_test_cases[] = {
 			BLOCKCIPHER_TEST_TARGET_PMD_MVSAM |
 			BLOCKCIPHER_TEST_TARGET_PMD_CCP |
 			BLOCKCIPHER_TEST_TARGET_PMD_MB |
-			BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX
+			BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX |
+			BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX2
 	},
 	{
 		.test_descr = "3DES-128-CTR Encryption",
app/test/test_cryptodev_hash_test_vectors.h +50 -25

225 lines not on this page · raw message

doc/guides/cryptodevs/octeontx2.rst +11 -0
index 47e9150..406d746 100644
@@ -132,3 +132,14 @@ Debugging Options
     +===+============+=======================================================+
     | 1 | CPT        | --log-level='pmd\.crypto\.octeontx2,8'                |
     +---+------------+-------------------------------------------------------+
+
+Testing
+-------
+
+The symmetric crypto operations on OCTEON TX2 crypto PMD may be verified by running the test
+application:
+
+.. code-block:: console
+
+    ./test
+    RTE>>cryptodev_octeontx2_autotest
Signature · 1 line
2.7.4
#34 lore raw

PATCH v2 9/12 crypto/octeontx2: allocate memory for asymmetric operation

In reply to Anoob Joseph

From: Kanaka Durga Kotamarthy <[email protected]>

This patch determines metabuf length needed to perform asymmetric crypto operation.

---
 drivers/crypto/octeontx2/otx2_cryptodev_ops.c | 37 +++++++++++++++++++--------
 1 file changed, 26 insertions(+), 11 deletions(-)
drivers/crypto/octeontx2/otx2_cryptodev_ops.c +26 -11
index ef6e7e7..1d35379 100644
@@ -38,24 +38,39 @@ otx2_cpt_metabuf_mempool_create(const struct rte_cryptodev *dev,
 				int nb_elements)
 {
 	char mempool_name[RTE_MEMPOOL_NAMESIZE];
-	int sg_mlen, lb_mlen, max_mlen, ret;
 	struct cpt_qp_meta_info *meta_info;
 	struct rte_mempool *pool;
+	int ret, max_mlen;
+	int asym_mlen = 0;
+	int lb_mlen = 0;
+	int sg_mlen = 0;
 
-	/* Get meta len for scatter gather mode */
-	sg_mlen = cpt_pmd_ops_helper_get_mlen_sg_mode();
+	if (dev->feature_flags & RTE_CRYPTODEV_FF_SYMMETRIC_CRYPTO) {
 
-	/* Extra 32B saved for future considerations */
-	sg_mlen += 4 * sizeof(uint64_t);
+		/* Get meta len for scatter gather mode */
+		sg_mlen = cpt_pmd_ops_helper_get_mlen_sg_mode();
 
-	/* Get meta len for linear buffer (direct) mode */
-	lb_mlen = cpt_pmd_ops_helper_get_mlen_direct_mode();
+		/* Extra 32B saved for future considerations */
+		sg_mlen += 4 * sizeof(uint64_t);
 
-	/* Extra 32B saved for future considerations */
-	lb_mlen += 4 * sizeof(uint64_t);
+		/* Get meta len for linear buffer (direct) mode */
+		lb_mlen = cpt_pmd_ops_helper_get_mlen_direct_mode();
 
-	/* Check max requirement for meta buffer */
-	max_mlen = RTE_MAX(lb_mlen, sg_mlen);
+		/* Extra 32B saved for future considerations */
+		lb_mlen += 4 * sizeof(uint64_t);
+	}
+
+	if (dev->feature_flags & RTE_CRYPTODEV_FF_ASYMMETRIC_CRYPTO) {
+
+		/* Get meta len required for asymmetric operations */
+		asym_mlen = cpt_pmd_ops_helper_asym_get_mlen();
+	}
+
+	/*
+	 * Check max requirement for meta buffer to
+	 * support crypto op of any type (sym/asym).
+	 */
+	max_mlen = RTE_MAX(RTE_MAX(lb_mlen, sg_mlen), asym_mlen);
 
 	/* Allocate mempool */
 
Signature · 1 line
2.7.4
#35 lore raw

PATCH v2 10/12 crypto/octeontx2: add asymmetric session operations

In reply to Anoob Joseph

From: Kanaka Durga Kotamarthy <[email protected]>

This patch adds asymmetric session setup and free routines. RSA and modexp operations are supported.

---
 doc/guides/cryptodevs/features/octeontx2.ini       |  4 ++
 doc/guides/cryptodevs/octeontx2.rst                |  6 ++
 drivers/crypto/octeontx2/otx2_cryptodev.c          |  4 +-
 .../crypto/octeontx2/otx2_cryptodev_capabilities.c | 39 ++++++++++++-
 drivers/crypto/octeontx2/otx2_cryptodev_ops.c      | 67 ++++++++++++++++++++++
 5 files changed, 117 insertions(+), 3 deletions(-)
doc/guides/cryptodevs/features/octeontx2.ini +4 -0
index 4e82463..7d07053 100644
@@ -5,11 +5,13 @@
 ;
 [Features]
 Symmetric crypto       = Y
+Asymmetric crypto      = Y
 Sym operation chaining = Y
 HW Accelerated         = Y
 In Place SGL           = Y
 OOP SGL In LB  Out     = Y
 OOP SGL In SGL Out     = Y
+RSA PRIV OP KEY QT     = Y
 
 ;
 ; Supported crypto algorithms of 'octeontx2' crypto driver.
@@ -65,3 +67,5 @@ AES GCM (256) = Y
 ; Supported Asymmetric algorithms of the 'octeontx2' crypto driver.
 ;
 [Asymmetric]
+RSA                    = Y
+Modular Exponentiation = Y
doc/guides/cryptodevs/octeontx2.rst +6 -0
index 406d746..ad33c66 100644
@@ -56,6 +56,12 @@ AEAD algorithms:
 
 * ``RTE_CRYPTO_AEAD_AES_GCM``
 
+Asymmetric Crypto Algorithms
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+* ``RTE_CRYPTO_ASYM_XFORM_RSA``
+* ``RTE_CRYPTO_ASYM_XFORM_MODEX``
+
 
 Installation
 ------------
drivers/crypto/octeontx2/otx2_cryptodev.c +3 -1
index 32c0b48..7fd216b 100644
@@ -99,7 +99,9 @@ otx2_cpt_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
 			     RTE_CRYPTODEV_FF_SYM_OPERATION_CHAINING |
 			     RTE_CRYPTODEV_FF_IN_PLACE_SGL |
 			     RTE_CRYPTODEV_FF_OOP_SGL_IN_LB_OUT |
-			     RTE_CRYPTODEV_FF_OOP_SGL_IN_SGL_OUT;
+			     RTE_CRYPTODEV_FF_OOP_SGL_IN_SGL_OUT |
+			     RTE_CRYPTODEV_FF_ASYMMETRIC_CRYPTO |
+			     RTE_CRYPTODEV_FF_RSA_PRIV_OP_KEY_QT;
 
 	return 0;
 
drivers/crypto/octeontx2/otx2_cryptodev_capabilities.c +37 -2
index 3a70470..b9e3fe3 100644
@@ -6,7 +6,8 @@
 
 #include "otx2_cryptodev_capabilities.h"
 
-static const struct rte_cryptodev_capabilities otx2_cpt_sym_capabilities[] = {
+static const struct
+rte_cryptodev_capabilities otx2_cpt_capabilities[] = {
 	/* Symmetric capabilities */
 	{	/* NULL (AUTH) */
 		.op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
@@ -594,11 +595,45 @@ static const struct rte_cryptodev_capabilities otx2_cpt_sym_capabilities[] = {
 		}, }
 	},
 	/* End of symmetric capabilities */
+
+	/* Asymmetric capabilities */
+	{	/* RSA */
+		.op = RTE_CRYPTO_OP_TYPE_ASYMMETRIC,
+		{.asym = {
+			.xform_capa = {
+				.xform_type = RTE_CRYPTO_ASYM_XFORM_RSA,
+				.op_types = ((1 << RTE_CRYPTO_ASYM_OP_SIGN) |
+					(1 << RTE_CRYPTO_ASYM_OP_VERIFY) |
+					(1 << RTE_CRYPTO_ASYM_OP_ENCRYPT) |
+					(1 << RTE_CRYPTO_ASYM_OP_DECRYPT)),
+				{.modlen = {
+					.min = 17,
+					.max = 1024,
+					.increment = 1
+				}, }
+			}
+		}, }
+	},
+	{	/* MOD_EXP */
+		.op = RTE_CRYPTO_OP_TYPE_ASYMMETRIC,
+		{.asym = {
+			.xform_capa = {
+				.xform_type = RTE_CRYPTO_ASYM_XFORM_MODEX,
+				.op_types = 0,
+				{.modlen = {
+					.min = 17,
+					.max = 1024,
+					.increment = 1
+				}, }
+			}
+		}, }
+	},
+	/* End of asymmetric capabilities */
 	RTE_CRYPTODEV_END_OF_CAPABILITIES_LIST()
 };
 
 const struct rte_cryptodev_capabilities *
 otx2_cpt_capabilities_get(void)
 {
-	return otx2_cpt_sym_capabilities;
+	return otx2_cpt_capabilities;
 }
drivers/crypto/octeontx2/otx2_cryptodev_ops.c +67 -0

83 lines not on this page · raw message

Signature · 1 line
2.7.4
#36 lore raw

PATCH v2 11/12 crypto/octeontx2: add asymmetric in enqueue/dequeue ops

In reply to Anoob Joseph

From: Sunila Sahu <[email protected]>

This patch adds asymmetric support in enqueue/dequeue ops.

---
 drivers/crypto/octeontx2/otx2_cryptodev_ops.c | 177 ++++++++++++++++++++++++++
 drivers/crypto/octeontx2/otx2_cryptodev_ops.h |   1 +
 2 files changed, 178 insertions(+)
drivers/crypto/octeontx2/otx2_cryptodev_ops.c +177 -0
index fbca4dc..db8fe66 100644
@@ -393,6 +393,78 @@ otx2_cpt_enqueue_req(const struct otx2_cpt_qp *qp,
 	return 0;
 }
 
+static __rte_always_inline int32_t __hot
+otx2_cpt_enqueue_asym(struct otx2_cpt_qp *qp,
+		      struct rte_crypto_op *op,
+		      struct pending_queue *pend_q)
+{
+	struct cpt_qp_meta_info *minfo = &qp->meta_info;
+	struct rte_crypto_asym_op *asym_op = op->asym;
+	struct asym_op_params params = {0};
+	struct cpt_asym_sess_misc *sess;
+	vq_cmd_word3_t *w3;
+	uintptr_t *cop;
+	void *mdata;
+	int ret;
+
+	if (unlikely(rte_mempool_get(minfo->pool, &mdata) < 0)) {
+		CPT_LOG_ERR("Could not allocate meta buffer for request");
+		return -ENOMEM;
+	}
+
+	sess = get_asym_session_private_data(asym_op->session,
+					     otx2_cryptodev_driver_id);
+
+	/* Store IO address of the mdata to meta_buf */
+	params.meta_buf = rte_mempool_virt2iova(mdata);
+
+	cop = mdata;
+	cop[0] = (uintptr_t)mdata;
+	cop[1] = (uintptr_t)op;
+	cop[2] = cop[3] = 0ULL;
+
+	params.req = RTE_PTR_ADD(cop, 4 * sizeof(uintptr_t));
+	params.req->op = cop;
+
+	/* Adjust meta_buf to point to end of cpt_request_info structure */
+	params.meta_buf += (4 * sizeof(uintptr_t)) +
+			    sizeof(struct cpt_request_info);
+	switch (sess->xfrm_type) {
+	case RTE_CRYPTO_ASYM_XFORM_MODEX:
+		ret = cpt_modex_prep(&params, &sess->mod_ctx);
+		if (unlikely(ret))
+			goto req_fail;
+		break;
+	case RTE_CRYPTO_ASYM_XFORM_RSA:
+		ret = cpt_enqueue_rsa_op(op, &params, sess);
+		if (unlikely(ret))
+			goto req_fail;
+		break;
+	default:
+		op->status = RTE_CRYPTO_OP_STATUS_INVALID_ARGS;
+		ret = -EINVAL;
+		goto req_fail;
+	}
+
+	/* Set engine group of AE */
+	w3 = (vq_cmd_word3_t *)&params.req->ist.ei3;
+	w3->s.grp = OTX2_CPT_EGRP_AE;
+
+	ret = otx2_cpt_enqueue_req(qp, pend_q, params.req);
+
+	if (unlikely(ret)) {
+		CPT_LOG_DP_ERR("Could not enqueue crypto req");
+		goto req_fail;
+	}
+
+	return 0;
+
+req_fail:
+	free_op_meta(mdata, minfo->pool);
+
+	return ret;
+}
+
 static __rte_always_inline int __hot
 otx2_cpt_enqueue_sym(struct otx2_cpt_qp *qp, struct rte_crypto_op *op,
 		     struct pending_queue *pend_q)
@@ -494,6 +566,11 @@ otx2_cpt_enqueue_burst(void *qptr, struct rte_crypto_op **ops, uint16_t nb_ops)
 			else
 				ret = otx2_cpt_enqueue_sym_sessless(qp, op,
 								    pend_q);
+		} else if (op->type == RTE_CRYPTO_OP_TYPE_ASYMMETRIC) {
+			if (op->sess_type == RTE_CRYPTO_OP_WITH_SESSION)
+				ret = otx2_cpt_enqueue_asym(qp, op, pend_q);
+			else
+				break;
 		} else
 			break;
 
@@ -504,6 +581,92 @@ otx2_cpt_enqueue_burst(void *qptr, struct rte_crypto_op **ops, uint16_t nb_ops)
 	return count;
 }
 
+static __rte_always_inline void
+otx2_cpt_asym_rsa_op(struct rte_crypto_op *cop, struct cpt_request_info *req,
+		     struct rte_crypto_rsa_xform *rsa_ctx)
+{
+	struct rte_crypto_rsa_op_param *rsa = &cop->asym->rsa;
+
+	switch (rsa->op_type) {
+	case RTE_CRYPTO_ASYM_OP_ENCRYPT:
+		rsa->cipher.length = rsa_ctx->n.length;
+		memcpy(rsa->cipher.data, req->rptr, rsa->cipher.length);
+		break;
+	case RTE_CRYPTO_ASYM_OP_DECRYPT:
+		if (rsa->pad == RTE_CRYPTO_RSA_PADDING_NONE) {
+			rsa->message.length = rsa_ctx->n.length;
+			memcpy(rsa->message.data, req->rptr,
+			       rsa->message.length);
+		} else {
+			/* Get length of decrypted output */
+			rsa->message.length = rte_cpu_to_be_16
+					     (*((uint16_t *)req->rptr));
+			/*
+			 * Offset output data pointer by length field
+			 * (2 bytes) and copy decrypted data.
+			 */
+			memcpy(rsa->message.data, req->rptr + 2,
+			       rsa->message.length);
+		}
+		break;
+	case RTE_CRYPTO_ASYM_OP_SIGN:
+		rsa->sign.length = rsa_ctx->n.length;
+		memcpy(rsa->sign.data, req->rptr, rsa->sign.length);
+		break;
+	case RTE_CRYPTO_ASYM_OP_VERIFY:
+		if (rsa->pad == RTE_CRYPTO_RSA_PADDING_NONE) {
+			rsa->sign.length = rsa_ctx->n.length;
+			memcpy(rsa->sign.data, req->rptr, rsa->sign.length);
+		} else {
+			/* Get length of signed output */
+			rsa->sign.length = rte_cpu_to_be_16
+					  (*((uint16_t *)req->rptr));
+			/*
+			 * Offset output data pointer by length field
+			 * (2 bytes) and copy signed data.
+			 */
+			memcpy(rsa->sign.data, req->rptr + 2,
+			       rsa->sign.length);
+		}
+		if (memcmp(rsa->sign.data, rsa->message.data,
+			   rsa->message.length)) {
+			CPT_LOG_DP_ERR("RSA verification failed");
+			cop->status = RTE_CRYPTO_OP_STATUS_ERROR;
+		}
+		break;
+	default:
+		CPT_LOG_DP_DEBUG("Invalid RSA operation type");
+		cop->status = RTE_CRYPTO_OP_STATUS_INVALID_ARGS;
+		break;
+	}
+}
+
+static void
+otx2_cpt_asym_post_process(struct rte_crypto_op *cop,
+			   struct cpt_request_info *req)
+{
+	struct rte_crypto_asym_op *op = cop->asym;
+	struct cpt_asym_sess_misc *sess;
+
+	sess = get_asym_session_private_data(op->session,
+					     otx2_cryptodev_driver_id);
+
+	switch (sess->xfrm_type) {
+	case RTE_CRYPTO_ASYM_XFORM_RSA:
+		otx2_cpt_asym_rsa_op(cop, req, &sess->rsa_ctx);
+		break;
+	case RTE_CRYPTO_ASYM_XFORM_MODEX:
+		op->modex.result.length = sess->mod_ctx.modulus.length;
+		memcpy(op->modex.result.data, req->rptr,
+		       op->modex.result.length);
+		break;
+	default:
+		CPT_LOG_DP_DEBUG("Invalid crypto xform type");
+		cop->status = RTE_CRYPTO_OP_STATUS_INVALID_ARGS;
+		break;
+	}
+}
+
 static inline void
 otx2_cpt_dequeue_post_process(struct otx2_cpt_qp *qp, struct rte_crypto_op *cop,
 			      uintptr_t *rsp, uint8_t cc)
@@ -530,6 +693,20 @@ otx2_cpt_dequeue_post_process(struct otx2_cpt_qp *qp, struct rte_crypto_op *cop,
 			cop->sym->session = NULL;
 		}
 	}
+
+	if (cop->type == RTE_CRYPTO_OP_TYPE_ASYMMETRIC) {
+		if (likely(cc == NO_ERR)) {
+			cop->status = RTE_CRYPTO_OP_STATUS_SUCCESS;
+			/*
+			 * Pass cpt_req_info stored in metabuf during
+			 * enqueue.
+			 */
+			rsp = RTE_PTR_ADD(rsp, 4 * sizeof(uintptr_t));
+			otx2_cpt_asym_post_process(cop,
+					(struct cpt_request_info *)rsp);
+		} else
+			cop->status = RTE_CRYPTO_OP_STATUS_ERROR;
+	}
 }
 
 static __rte_always_inline uint8_t
drivers/crypto/octeontx2/otx2_cryptodev_ops.h +1 -0
index ba93a66..a2724f7 100644
@@ -13,6 +13,7 @@
 enum otx2_cpt_egrp {
 	OTX2_CPT_EGRP_SE = 0,
 	OTX2_CPT_EGRP_SE_IE = 1,
+	OTX2_CPT_EGRP_AE = 2
 };
 
 struct rte_cryptodev_ops otx2_cpt_ops;
Signature · 1 line
2.7.4
#37 lore raw

PATCH v2 12/12 app/test: register octeontx2 PMD to asym testsuite

In reply to Anoob Joseph

From: Sunila Sahu <[email protected]>

This patch updates asymmetric crypto unit-test application to validate asymmetric crypto operation supported by octeontx2 PMD.

---
 app/test/test_cryptodev_asym.c      | 20 ++++++++++++++++++++
 doc/guides/cryptodevs/octeontx2.rst |  8 ++++++++
 2 files changed, 28 insertions(+)
app/test/test_cryptodev_asym.c +20 -0
index 241c384..6cc2f97 100644
@@ -1851,6 +1851,23 @@ test_cryptodev_octeontx_asym(void)
 	return unit_test_suite_runner(&cryptodev_octeontx_asym_testsuite);
 }
 
+static int
+test_cryptodev_octeontx2_asym(void)
+{
+	gbl_driver_id = rte_cryptodev_driver_id_get(
+			RTE_STR(CRYPTODEV_NAME_OCTEONTX2_PMD));
+	if (gbl_driver_id == -1) {
+		RTE_LOG(ERR, USER1, "OCTEONTX2 PMD must be loaded. Check if "
+				"CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_CRYPTO is "
+				"enabled in config file to run this "
+				"testsuite.\n");
+		return TEST_FAILED;
+	}
+
+	/* Use test suite registered for crypto_octeontx PMD */
+	return unit_test_suite_runner(&cryptodev_octeontx_asym_testsuite);
+}
+
 REGISTER_TEST_COMMAND(cryptodev_openssl_asym_autotest,
 					  test_cryptodev_openssl_asym);
 
@@ -1858,3 +1875,6 @@ REGISTER_TEST_COMMAND(cryptodev_qat_asym_autotest, test_cryptodev_qat_asym);
 
 REGISTER_TEST_COMMAND(cryptodev_octeontx_asym_autotest,
 					  test_cryptodev_octeontx_asym);
+
+REGISTER_TEST_COMMAND(cryptodev_octeontx2_asym_autotest,
+					  test_cryptodev_octeontx2_asym);
doc/guides/cryptodevs/octeontx2.rst +8 -0
index ad33c66..8bdb83f 100644
@@ -149,3 +149,11 @@ application:
 
     ./test
     RTE>>cryptodev_octeontx2_autotest
+
+The asymmetric crypto operations on OCTEON TX2 crypto PMD may be verified by running the test
+application:
+
+.. code-block:: console
+
+    ./test
+    RTE>>cryptodev_octeontx2_asym_autotest
Signature · 1 line
2.7.4
#38 lore raw
In reply to Anoob Joseph

Please rebase this series. Build cannot be verified by CI. There are apply issues.

Quoted 86 lines

The series introduces poll mode driver to enable crypto offload engine on Marvell OCTEON TX2 SoC.

Changes in v2:
* Merged series adding sym features and asym features into one.
* Squashed patches as directed by Akhil.
* Added check for ASYM SESSIONLESS (not supported currently)
* Minor updates to documentation

Ankur Dwivedi (3):
crypto/octeontx2: add device control ops
crypto/octeontx2: add queue pair functions
crypto/octeontx2: add session related functions

Anoob Joseph (5):
crypto/octeontx2: add PMD skeleton crypto/octeontx2: add device init sequence in probe crypto/octeontx2: add symmetric capabilities crypto/octeontx2: add enqueue/dequeue ops
test: add OCTEON TX2 tests

Kanaka Durga Kotamarthy (2):
crypto/octeontx2: allocate memory for asymmetric operation crypto/octeontx2: add asymmetric session operations

Sunila Sahu (2):
crypto/octeontx2: add asymmetric in enqueue/dequeue ops app/test: register octeontx2 PMD to asym testsuite

 MAINTAINERS                                        |    7 +
 app/test/meson.build                               |    1 +
 app/test/test_cryptodev.c                          |  323 ++++++
 app/test/test_cryptodev.h                          |    1 +
 app/test/test_cryptodev_aes_test_vectors.h         |  114 +-
 app/test/test_cryptodev_asym.c                     |   20 +
 app/test/test_cryptodev_blockcipher.c              |    7 +
 app/test/test_cryptodev_blockcipher.h              |    1 +
 app/test/test_cryptodev_des_test_vectors.h         |   12 +-
 app/test/test_cryptodev_hash_test_vectors.h        |   75 +-
 config/common_base                                 |    5 +
 doc/guides/cryptodevs/features/octeontx2.ini       |   71 ++
 doc/guides/cryptodevs/index.rst                    |    1 +
 doc/guides/cryptodevs/octeontx2.rst                |  159 +++
 doc/guides/platform/octeontx2.rst                  |    3 +
 doc/guides/rel_notes/release_19_11.rst             |    6 +
 drivers/common/Makefile                            |    5 +-
 drivers/common/cpt/cpt_hw_types.h                  |   52 +
 drivers/common/cpt/cpt_mcode_defines.h             |    2 +
 drivers/crypto/Makefile                            |    1 +
 drivers/crypto/meson.build                         |   21 +-
 drivers/crypto/octeontx2/Makefile                  |   50 +
 drivers/crypto/octeontx2/meson.build               |   34 +
 drivers/crypto/octeontx2/otx2_cryptodev.c          |  157 +++
 drivers/crypto/octeontx2/otx2_cryptodev.h          |   43 +
 .../crypto/octeontx2/otx2_cryptodev_capabilities.c |  639 ++++++++++++
 .../crypto/octeontx2/otx2_cryptodev_capabilities.h |   16 +
 .../crypto/octeontx2/otx2_cryptodev_hw_access.c    |  225 ++++
 .../crypto/octeontx2/otx2_cryptodev_hw_access.h    |  169 +++
 drivers/crypto/octeontx2/otx2_cryptodev_mbox.c     |  175 ++++
 drivers/crypto/octeontx2/otx2_cryptodev_mbox.h     |   25 +
 drivers/crypto/octeontx2/otx2_cryptodev_ops.c      | 1100
++++++++++++++++++++
 drivers/crypto/octeontx2/otx2_cryptodev_ops.h      |   21 +
 .../octeontx2/rte_pmd_octeontx2_crypto_version.map |    4 +
 mk/rte.app.mk                                      |    6 +-
 35 files changed, 3479 insertions(+), 72 deletions(-)
 create mode 100644 doc/guides/cryptodevs/features/octeontx2.ini
 create mode 100644 doc/guides/cryptodevs/octeontx2.rst
 create mode 100644 drivers/crypto/octeontx2/Makefile
 create mode 100644 drivers/crypto/octeontx2/meson.build
 create mode 100644 drivers/crypto/octeontx2/otx2_cryptodev.c
 create mode 100644 drivers/crypto/octeontx2/otx2_cryptodev.h
 create mode 100644 drivers/crypto/octeontx2/otx2_cryptodev_capabilities.c
 create mode 100644 drivers/crypto/octeontx2/otx2_cryptodev_capabilities.h
 create mode 100644 drivers/crypto/octeontx2/otx2_cryptodev_hw_access.c
 create mode 100644 drivers/crypto/octeontx2/otx2_cryptodev_hw_access.h
 create mode 100644 drivers/crypto/octeontx2/otx2_cryptodev_mbox.c
 create mode 100644 drivers/crypto/octeontx2/otx2_cryptodev_mbox.h
 create mode 100644 drivers/crypto/octeontx2/otx2_cryptodev_ops.c
 create mode 100644 drivers/crypto/octeontx2/otx2_cryptodev_ops.h
 create mode 100644

drivers/crypto/octeontx2/rte_pmd_octeontx2_crypto_version.map

--
2.7.4

#39 lore raw

Hi Akhil,

I'll rebase the series and send in a short while.

Thanks,
Anoob

Quoted 107 lines

-----Original Message-----
From: Akhil Goyal <[email protected]>
Sent: Wednesday, October 16, 2019 7:02 PM
To: Anoob Joseph <[email protected]>; Pablo de Lara <[email protected]>
Cc: Fiona Trahe <[email protected]>; Jerin Jacob Kollanukkaran <[email protected]>; Narayana Prasad Raju Athreya <[email protected]>; Shally Verma <[email protected]>; Ankur Dwivedi <[email protected]>; Kanaka Durga Kotamarthy <[email protected]>; Sunila Sahu <[email protected]>; Tejasree Kondoj <[email protected]>; [email protected]
Subject: [EXT] RE: [PATCH v2 00/12] add OCTEON TX2 crypto PMD

External Email

----------------------------------------------------------------------
Please rebase this series. Build cannot be verified by CI. There are apply issues.

Quoted 90 lines

The series introduces poll mode driver to enable crypto offload engine on Marvell OCTEON TX2 SoC.

Changes in v2:
* Merged series adding sym features and asym features into one.
* Squashed patches as directed by Akhil.
* Added check for ASYM SESSIONLESS (not supported currently)
* Minor updates to documentation

Ankur Dwivedi (3):
crypto/octeontx2: add device control ops
crypto/octeontx2: add queue pair functions
crypto/octeontx2: add session related functions

Anoob Joseph (5):
crypto/octeontx2: add PMD skeleton crypto/octeontx2: add device init sequence in probe crypto/octeontx2: add symmetric capabilities crypto/octeontx2: add enqueue/dequeue ops
test: add OCTEON TX2 tests

Kanaka Durga Kotamarthy (2):
crypto/octeontx2: allocate memory for asymmetric operation crypto/octeontx2: add asymmetric session operations

Sunila Sahu (2):
crypto/octeontx2: add asymmetric in enqueue/dequeue ops app/test: register octeontx2 PMD to asym testsuite

 MAINTAINERS                                        |    7 +
 app/test/meson.build                               |    1 +
 app/test/test_cryptodev.c                          |  323 ++++++
 app/test/test_cryptodev.h                          |    1 +
 app/test/test_cryptodev_aes_test_vectors.h         |  114 +-
 app/test/test_cryptodev_asym.c                     |   20 +
 app/test/test_cryptodev_blockcipher.c              |    7 +
 app/test/test_cryptodev_blockcipher.h              |    1 +
 app/test/test_cryptodev_des_test_vectors.h         |   12 +-
 app/test/test_cryptodev_hash_test_vectors.h        |   75 +-
 config/common_base                                 |    5 +
 doc/guides/cryptodevs/features/octeontx2.ini       |   71 ++
 doc/guides/cryptodevs/index.rst                    |    1 +
 doc/guides/cryptodevs/octeontx2.rst                |  159 +++
 doc/guides/platform/octeontx2.rst                  |    3 +
 doc/guides/rel_notes/release_19_11.rst             |    6 +
 drivers/common/Makefile                            |    5 +-
 drivers/common/cpt/cpt_hw_types.h                  |   52 +
 drivers/common/cpt/cpt_mcode_defines.h             |    2 +
 drivers/crypto/Makefile                            |    1 +
 drivers/crypto/meson.build                         |   21 +-
 drivers/crypto/octeontx2/Makefile                  |   50 +
 drivers/crypto/octeontx2/meson.build               |   34 +
 drivers/crypto/octeontx2/otx2_cryptodev.c          |  157 +++
 drivers/crypto/octeontx2/otx2_cryptodev.h          |   43 +
 .../crypto/octeontx2/otx2_cryptodev_capabilities.c |  639 ++++++++++++
 .../crypto/octeontx2/otx2_cryptodev_capabilities.h |   16 +
 .../crypto/octeontx2/otx2_cryptodev_hw_access.c    |  225 ++++
 .../crypto/octeontx2/otx2_cryptodev_hw_access.h    |  169 +++
 drivers/crypto/octeontx2/otx2_cryptodev_mbox.c     |  175 ++++
 drivers/crypto/octeontx2/otx2_cryptodev_mbox.h     |   25 +
 drivers/crypto/octeontx2/otx2_cryptodev_ops.c      | 1100
++++++++++++++++++++
 drivers/crypto/octeontx2/otx2_cryptodev_ops.h      |   21 +
 .../octeontx2/rte_pmd_octeontx2_crypto_version.map |    4 +
 mk/rte.app.mk                                      |    6 +-
 35 files changed, 3479 insertions(+), 72 deletions(-)  create mode
100644 doc/guides/cryptodevs/features/octeontx2.ini
 create mode 100644 doc/guides/cryptodevs/octeontx2.rst
 create mode 100644 drivers/crypto/octeontx2/Makefile  create mode
100644 drivers/crypto/octeontx2/meson.build
 create mode 100644 drivers/crypto/octeontx2/otx2_cryptodev.c
 create mode 100644 drivers/crypto/octeontx2/otx2_cryptodev.h
 create mode 100644
drivers/crypto/octeontx2/otx2_cryptodev_capabilities.c
 create mode 100644
drivers/crypto/octeontx2/otx2_cryptodev_capabilities.h
 create mode 100644
drivers/crypto/octeontx2/otx2_cryptodev_hw_access.c
 create mode 100644
drivers/crypto/octeontx2/otx2_cryptodev_hw_access.h
 create mode 100644 drivers/crypto/octeontx2/otx2_cryptodev_mbox.c
 create mode 100644 drivers/crypto/octeontx2/otx2_cryptodev_mbox.h
 create mode 100644 drivers/crypto/octeontx2/otx2_cryptodev_ops.c
 create mode 100644 drivers/crypto/octeontx2/otx2_cryptodev_ops.h
 create mode 100644

drivers/crypto/octeontx2/rte_pmd_octeontx2_crypto_version.map

--
2.7.4

#40 lore raw

v3 cover add OCTEON TX2 crypto PMD

In reply to Anoob Joseph

The series introduces poll mode driver to enable crypto offload engine on Marvell OCTEON TX2 SoC.

Changes in v3:
* Rebased on tip of dpdk-next-crypto("36112de91a44")
* Updated version map to use right DPDK version
* Added sanity checks in dev_close() routine.

Changes in v2:
* Merged series adding sym features and asym features into one.
* Squashed patches as directed by Akhil.
* Added check for ASYM SESSIONLESS (not supported currently)
* Minor updates to documentation

Ankur Dwivedi (3):
crypto/octeontx2: add device control ops
crypto/octeontx2: add queue pair functions
crypto/octeontx2: add session related functions

Anoob Joseph (5):
crypto/octeontx2: add PMD skeleton crypto/octeontx2: add device init sequence in probe crypto/octeontx2: add symmetric capabilities crypto/octeontx2: add enqueue/dequeue ops
test: add OCTEON TX2 tests

Kanaka Durga Kotamarthy (1):
crypto/octeontx2: add asymmetric session operations

Sunila Sahu (2):
crypto/octeontx2: add asymmetric in enqueue/dequeue ops app/test: register octeontx2 PMD to asym testsuite

 MAINTAINERS                                        |    7 +
 app/test/meson.build                               |    1 +
 app/test/test_cryptodev.c                          |  323 ++++++
 app/test/test_cryptodev.h                          |    1 +
 app/test/test_cryptodev_aes_test_vectors.h         |  114 +-
 app/test/test_cryptodev_asym.c                     |   20 +
 app/test/test_cryptodev_blockcipher.c              |    7 +
 app/test/test_cryptodev_blockcipher.h              |    1 +
 app/test/test_cryptodev_des_test_vectors.h         |   12 +-
 app/test/test_cryptodev_hash_test_vectors.h        |   75 +-
 config/common_base                                 |    5 +
 doc/guides/cryptodevs/features/octeontx2.ini       |   71 ++
 doc/guides/cryptodevs/index.rst                    |    1 +
 doc/guides/cryptodevs/octeontx2.rst                |  159 +++
 doc/guides/platform/octeontx2.rst                  |    3 +
 doc/guides/rel_notes/release_19_11.rst             |    6 +
 drivers/common/Makefile                            |    5 +-
 drivers/common/cpt/cpt_hw_types.h                  |   52 +
 drivers/common/cpt/cpt_mcode_defines.h             |    2 +
 drivers/crypto/Makefile                            |    1 +
 drivers/crypto/meson.build                         |   21 +-
 drivers/crypto/octeontx2/Makefile                  |   50 +
 drivers/crypto/octeontx2/meson.build               |   34 +
 drivers/crypto/octeontx2/otx2_cryptodev.c          |  157 +++
 drivers/crypto/octeontx2/otx2_cryptodev.h          |   43 +
 .../crypto/octeontx2/otx2_cryptodev_capabilities.c |  639 +++++++++++
 .../crypto/octeontx2/otx2_cryptodev_capabilities.h |   16 +
 .../crypto/octeontx2/otx2_cryptodev_hw_access.c    |  225 ++++
 .../crypto/octeontx2/otx2_cryptodev_hw_access.h    |  169 +++
 drivers/crypto/octeontx2/otx2_cryptodev_mbox.c     |  175 ++++
 drivers/crypto/octeontx2/otx2_cryptodev_mbox.h     |   25 +
 drivers/crypto/octeontx2/otx2_cryptodev_ops.c      | 1106 ++++++++++++++++++++
 drivers/crypto/octeontx2/otx2_cryptodev_ops.h      |   21 +
 .../octeontx2/rte_pmd_octeontx2_crypto_version.map |    4 +
 mk/rte.app.mk                                      |    6 +-
 35 files changed, 3485 insertions(+), 72 deletions(-)
 create mode 100644 doc/guides/cryptodevs/features/octeontx2.ini
 create mode 100644 doc/guides/cryptodevs/octeontx2.rst
 create mode 100644 drivers/crypto/octeontx2/Makefile
 create mode 100644 drivers/crypto/octeontx2/meson.build
 create mode 100644 drivers/crypto/octeontx2/otx2_cryptodev.c
 create mode 100644 drivers/crypto/octeontx2/otx2_cryptodev.h
 create mode 100644 drivers/crypto/octeontx2/otx2_cryptodev_capabilities.c
 create mode 100644 drivers/crypto/octeontx2/otx2_cryptodev_capabilities.h
 create mode 100644 drivers/crypto/octeontx2/otx2_cryptodev_hw_access.c
 create mode 100644 drivers/crypto/octeontx2/otx2_cryptodev_hw_access.h
 create mode 100644 drivers/crypto/octeontx2/otx2_cryptodev_mbox.c
 create mode 100644 drivers/crypto/octeontx2/otx2_cryptodev_mbox.h
 create mode 100644 drivers/crypto/octeontx2/otx2_cryptodev_ops.c
 create mode 100644 drivers/crypto/octeontx2/otx2_cryptodev_ops.h
 create mode 100644 drivers/crypto/octeontx2/rte_pmd_octeontx2_crypto_version.map
Signature · 1 line
2.7.4
#41 lore raw

PATCH v3 1/11 crypto/octeontx2: add PMD skeleton

Adding OCTEON TX2 crypto PMD skeleton. Enabling the driver by default in common_base.

---
 MAINTAINERS                                        |   7 ++
 config/common_base                                 |   5 +
 doc/guides/cryptodevs/features/octeontx2.ini       |   8 ++
 doc/guides/cryptodevs/index.rst                    |   1 +
 doc/guides/cryptodevs/octeontx2.rst                |  93 +++++++++++++++++
 doc/guides/platform/octeontx2.rst                  |   3 +
 doc/guides/rel_notes/release_19_11.rst             |   6 ++
 drivers/common/Makefile                            |   5 +-
 drivers/crypto/Makefile                            |   1 +
 drivers/crypto/meson.build                         |  21 +++-
 drivers/crypto/octeontx2/Makefile                  |  37 +++++++
 drivers/crypto/octeontx2/meson.build               |  29 ++++++
 drivers/crypto/octeontx2/otx2_cryptodev.c          | 111 +++++++++++++++++++++
 drivers/crypto/octeontx2/otx2_cryptodev.h          |  29 ++++++
 drivers/crypto/octeontx2/otx2_cryptodev_ops.c      |  27 +++++
 drivers/crypto/octeontx2/otx2_cryptodev_ops.h      |  12 +++
 .../octeontx2/rte_pmd_octeontx2_crypto_version.map |   4 +
 mk/rte.app.mk                                      |   6 +-
 18 files changed, 400 insertions(+), 5 deletions(-)
 create mode 100644 doc/guides/cryptodevs/features/octeontx2.ini
 create mode 100644 doc/guides/cryptodevs/octeontx2.rst
 create mode 100644 drivers/crypto/octeontx2/Makefile
 create mode 100644 drivers/crypto/octeontx2/meson.build
 create mode 100644 drivers/crypto/octeontx2/otx2_cryptodev.c
 create mode 100644 drivers/crypto/octeontx2/otx2_cryptodev.h
 create mode 100644 drivers/crypto/octeontx2/otx2_cryptodev_ops.c
 create mode 100644 drivers/crypto/octeontx2/otx2_cryptodev_ops.h
 create mode 100644 drivers/crypto/octeontx2/rte_pmd_octeontx2_crypto_version.map
MAINTAINERS +7 -0
index f8a56e2..b064e48 100644
@@ -980,6 +980,13 @@ F: drivers/crypto/nitrox/
 F: doc/guides/cryptodevs/nitrox.rst
 F: doc/guides/cryptodevs/features/nitrox.ini
 
+Marvell OCTEON TX2 crypto
+M: Ankur Dwivedi <[email protected]>
+M: Anoob Joseph <[email protected]>
+F: drivers/crypto/octeontx2/
+F: doc/guides/cryptodevs/octeontx2.rst
+F: doc/guides/cryptodevs/features/octeontx2.ini
+
 Null Crypto
 M: Declan Doherty <[email protected]>
 F: drivers/crypto/null/
config/common_base +5 -0
index e843a21..895db64 100644
@@ -592,6 +592,11 @@ CONFIG_RTE_LIBRTE_DPAA_MAX_CRYPTODEV=4
 CONFIG_RTE_LIBRTE_PMD_OCTEONTX_CRYPTO=y
 
 #
+# Compile PMD for Marvell OCTEON TX2 crypto device
+#
+CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_CRYPTO=y
+
+#
 # Compile PMD for QuickAssist based devices - see docs for details
 #
 CONFIG_RTE_LIBRTE_PMD_QAT=y
doc/guides/cryptodevs/features/octeontx2.ini new file +8 -0
new file mode 100644
index 0000000..35c9bee
@@ -0,0 +1,8 @@
+;
+; Supported features of the 'octeontx2' crypto driver.
+;
+; Refer to default.ini for the full list of available PMD features.
+;
+[Features]
+Symmetric crypto       = Y
+HW Accelerated         = Y
doc/guides/cryptodevs/index.rst +1 -0
index d1e0d32..a67ed5a 100644
@@ -19,6 +19,7 @@ Crypto Device Drivers
     dpaa_sec
     kasumi
     octeontx
+    octeontx2
     openssl
     mvsam
     nitrox
doc/guides/cryptodevs/octeontx2.rst new file +93 -0

93 lines not on this page · raw message

doc/guides/platform/octeontx2.rst +3 -0
index 1ee5eac..1c7d98f 100644
@@ -131,6 +131,9 @@ This section lists dataplane H/W block(s) available in OCTEON TX2 SoC.
 #. **DMA Rawdev Driver**
    See :doc:`../rawdevs/octeontx2_dma` for DMA driver information.
 
+#. **Crypto Device Driver**
+   See :doc:`../cryptodevs/octeontx2` for CPT crypto device driver information.
+
 Procedure to Setup Platform
 ---------------------------
 
doc/guides/rel_notes/release_19_11.rst +6 -0
index f1673e1..94c5a97 100644
@@ -131,6 +131,12 @@ New Features
   Added eBPF JIT support for arm64 architecture to improve the eBPF program
   performance.
 
+* **Added Marvell OCTEON TX2 crypto PMD**
+
+  Added a new PMD driver for h/w crypto offload block on ``OCTEON TX2`` SoC.
+
+  See :doc:`../cryptodevs/octeontx2` for more details
+
 
 Removed Items
 -------------
drivers/common/Makefile +4 -1
index bc6f972..1ff033b 100644
@@ -4,7 +4,9 @@
 
 include $(RTE_SDK)/mk/rte.vars.mk
 
-ifeq ($(CONFIG_RTE_LIBRTE_PMD_OCTEONTX_CRYPTO),y)
+CPT-y := $(CONFIG_RTE_LIBRTE_PMD_OCTEONTX_CRYPTO)
+CPT-y += $(CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_CRYPTO)
+ifneq (,$(findstring y,$(CPT-y)))
 DIRS-y += cpt
 endif
 
@@ -12,6 +14,7 @@ ifeq ($(CONFIG_RTE_LIBRTE_PMD_OCTEONTX_SSOVF)$(CONFIG_RTE_LIBRTE_OCTEONTX_MEMPOO
 DIRS-y += octeontx
 endif
 OCTEONTX2-y := $(CONFIG_RTE_LIBRTE_OCTEONTX2_MEMPOOL)
+OCTEONTX2-y += $(CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_CRYPTO)
 ifeq ($(findstring y,$(OCTEONTX2-y)),y)
 DIRS-y += octeontx2
 endif
drivers/crypto/Makefile +1 -0
index 7129bcf..8b00857 100644
@@ -8,6 +8,7 @@ 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_OCTEONTX2_CRYPTO) += octeontx2
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_OPENSSL) += openssl
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_CRYPTO_SCHEDULER) += scheduler
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_SNOW3G) += snow3g
drivers/crypto/meson.build +18 -3
index 1a358ff..229debd 100644
@@ -1,9 +1,24 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2017 Intel Corporation
 
-drivers = ['aesni_gcm', 'aesni_mb', 'caam_jr', 'ccp', 'dpaa_sec', 'dpaa2_sec',
-	'kasumi', 'mvsam', 'nitrox', 'null', 'octeontx', 'openssl', 'qat',
-	'scheduler', 'snow3g', 'virtio', 'zuc']
+drivers = ['aesni_gcm',
+	   'aesni_mb',
+	   'caam_jr',
+	   'ccp',
+	   'dpaa_sec',
+	   'dpaa2_sec',
+	   'kasumi',
+	   'mvsam',
+	   'nitrox',
+	   'null',
+	   'octeontx',
+	   'octeontx2',
+	   'openssl',
+	   'qat',
+	   'scheduler',
+	   'snow3g',
+	   'virtio',
+	   'zuc']
 
 std_deps = ['cryptodev'] # cryptodev pulls in all other needed deps
 config_flag_fmt = 'RTE_LIBRTE_@0@_PMD'
drivers/crypto/octeontx2/Makefile new file +37 -0
new file mode 100644
index 0000000..3273178
@@ -0,0 +1,37 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright (C) 2019 Marvell International Ltd.
+#
+
+include $(RTE_SDK)/mk/rte.vars.mk
+
+# library name
+LIB = librte_pmd_octeontx2_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
+LDLIBS += -lrte_common_cpt -lrte_common_octeontx2
+
+VPATH += $(RTE_SDK)/drivers/crypto/octeontx2
+
+CFLAGS += -O3
+CFLAGS += -I$(RTE_SDK)/drivers/common/cpt
+CFLAGS += -I$(RTE_SDK)/drivers/common/octeontx2
+
+# PMD code
+SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_CRYPTO) += otx2_cryptodev.c
+SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_CRYPTO) += otx2_cryptodev_ops.c
+
+# export include files
+SYMLINK-y-include +=
+
+# versioning export map
+EXPORT_MAP := rte_pmd_octeontx2_crypto_version.map
+
+include $(RTE_SDK)/mk/rte.lib.mk
drivers/crypto/octeontx2/meson.build new file +29 -0
new file mode 100644
index 0000000..2b55d2a
@@ -0,0 +1,29 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright (C) 2019 Marvell International Ltd.
+
+if host_machine.system() != 'linux'
+        build = false
+endif
+
+deps += ['bus_pci']
+deps += ['common_cpt']
+deps += ['common_octeontx2']
+name = 'octeontx2_crypto'
+
+sources = files('otx2_cryptodev.c',
+		'otx2_cryptodev_ops.c')
+
+extra_flags = []
+# This integrated controller runs only on a arm64 machine, remove 32bit warnings
+if not dpdk_conf.get('RTE_ARCH_64')
+	extra_flags += ['-Wno-int-to-pointer-cast', '-Wno-pointer-to-int-cast']
+endif
+
+foreach flag: extra_flags
+	if cc.has_argument(flag)
+		cflags += flag
+	endif
+endforeach
+
+includes += include_directories('../../common/cpt')
+includes += include_directories('../../common/octeontx2')
drivers/crypto/octeontx2/otx2_cryptodev.c new file +111 -0

111 lines not on this page · raw message

drivers/crypto/octeontx2/otx2_cryptodev.h new file +29 -0
new file mode 100644
index 0000000..c9fe0c8
@@ -0,0 +1,29 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (C) 2019 Marvell International Ltd.
+ */
+
+#ifndef _OTX2_CRYPTODEV_H_
+#define _OTX2_CRYPTODEV_H_
+
+#include "cpt_common.h"
+
+/* Marvell OCTEON TX2 Crypto PMD device name */
+#define CRYPTODEV_NAME_OCTEONTX2_PMD	crypto_octeontx2
+
+/**
+ * Device private data
+ */
+struct otx2_cpt_vf {
+	/* To be populated */
+};
+
+#define CPT_LOGTYPE otx2_cpt_logtype
+
+extern int otx2_cpt_logtype;
+
+/*
+ * Crypto device driver ID
+ */
+uint8_t otx2_cryptodev_driver_id;
+
+#endif /* _OTX2_CRYPTODEV_H_ */
drivers/crypto/octeontx2/otx2_cryptodev_ops.c new file +27 -0
new file mode 100644
index 0000000..18ad470
@@ -0,0 +1,27 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (C) 2019 Marvell International Ltd.
+ */
+
+#include <rte_cryptodev_pmd.h>
+
+#include "otx2_cryptodev_ops.h"
+
+struct rte_cryptodev_ops otx2_cpt_ops = {
+	/* Device control ops */
+	.dev_configure = NULL,
+	.dev_start = NULL,
+	.dev_stop = NULL,
+	.dev_close = NULL,
+	.dev_infos_get = NULL,
+
+	.stats_get = NULL,
+	.stats_reset = NULL,
+	.queue_pair_setup = NULL,
+	.queue_pair_release = NULL,
+	.queue_pair_count = NULL,
+
+	/* Symmetric crypto ops */
+	.sym_session_get_size = NULL,
+	.sym_session_configure = NULL,
+	.sym_session_clear = NULL,
+};
drivers/crypto/octeontx2/otx2_cryptodev_ops.h new file +12 -0
new file mode 100644
index 0000000..545614e
@@ -0,0 +1,12 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (C) 2019 Marvell International Ltd.
+ */
+
+#ifndef _OTX2_CRYPTODEV_OPS_H_
+#define _OTX2_CRYPTODEV_OPS_H_
+
+#include <rte_cryptodev_pmd.h>
+
+struct rte_cryptodev_ops otx2_cpt_ops;
+
+#endif /* _OTX2_CRYPTODEV_OPS_H_ */
drivers/crypto/octeontx2/rte_pmd_octeontx2_crypto_version.map new file +4 -0
new file mode 100644
index 0000000..b7b7c91
@@ -0,0 +1,4 @@
+DPDK_19.11 {
+
+	local: *;
+};
mk/rte.app.mk +5 -1
index b91273f..e79f16e 100644
@@ -101,7 +101,9 @@ ifeq ($(CONFIG_RTE_EXEC_ENV_LINUX),y)
 _LDLIBS-$(CONFIG_RTE_LIBRTE_KNI)            += -lrte_kni
 endif
 
-ifeq ($(CONFIG_RTE_LIBRTE_PMD_OCTEONTX_CRYPTO),y)
+OTX-CPT-y := $(CONFIG_RTE_LIBRTE_PMD_OCTEONTX_CRYPTO)
+OTX-CPT-y += $(CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_CRYPTO)
+ifeq ($(findstring y,$(OTX-CPT-y)),y)
 _LDLIBS-y += -lrte_common_cpt
 endif
 
@@ -109,6 +111,7 @@ ifeq ($(CONFIG_RTE_LIBRTE_PMD_OCTEONTX_SSOVF)$(CONFIG_RTE_LIBRTE_OCTEONTX_MEMPOO
 _LDLIBS-y += -lrte_common_octeontx
 endif
 OCTEONTX2-y := $(CONFIG_RTE_LIBRTE_OCTEONTX2_MEMPOOL)
+OCTEONTX2-y += $(CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_CRYPTO)
 OCTEONTX2-y += $(CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_EVENTDEV)
 OCTEONTX2-y += $(CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_DMA_RAWDEV)
 OCTEONTX2-y += $(CONFIG_RTE_LIBRTE_OCTEONTX2_PMD)
@@ -270,6 +273,7 @@ _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_ARMV8_CRYPTO)    += -L$(ARMV8_CRYPTO_LIB_PATH) -
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_MVSAM_CRYPTO) += -L$(LIBMUSDK_PATH)/lib -lrte_pmd_mvsam_crypto -lmusdk
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_NITROX)      += -lrte_pmd_nitrox
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX_CRYPTO) += -lrte_pmd_octeontx_crypto
+_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_CRYPTO) += -lrte_pmd_octeontx2_crypto
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_CRYPTO_SCHEDULER) += -lrte_pmd_crypto_scheduler
 ifeq ($(CONFIG_RTE_LIBRTE_SECURITY),y)
 ifeq ($(CONFIG_RTE_EAL_VFIO)$(CONFIG_RTE_LIBRTE_FSLMC_BUS),yy)
Signature · 1 line
2.7.4
#42 lore raw

PATCH v3 2/11 crypto/octeontx2: add device init sequence in probe

In reply to Anoob Joseph

This patch adds the device init sequence for OCTEON TX2 crypto device.

---
 drivers/crypto/octeontx2/Makefile              | 10 +++++++
 drivers/crypto/octeontx2/meson.build           |  2 ++
 drivers/crypto/octeontx2/otx2_cryptodev.c      | 40 ++++++++++++++++++++++++++
 drivers/crypto/octeontx2/otx2_cryptodev.h      | 10 ++++++-
 drivers/crypto/octeontx2/otx2_cryptodev_mbox.c | 28 ++++++++++++++++++
 drivers/crypto/octeontx2/otx2_cryptodev_mbox.h | 13 +++++++++
 6 files changed, 102 insertions(+), 1 deletion(-)
 create mode 100644 drivers/crypto/octeontx2/otx2_cryptodev_mbox.c
 create mode 100644 drivers/crypto/octeontx2/otx2_cryptodev_mbox.h
drivers/crypto/octeontx2/Makefile +10 -0
index 3273178..10d8c39 100644
@@ -23,9 +23,19 @@ VPATH += $(RTE_SDK)/drivers/crypto/octeontx2
 CFLAGS += -O3
 CFLAGS += -I$(RTE_SDK)/drivers/common/cpt
 CFLAGS += -I$(RTE_SDK)/drivers/common/octeontx2
+CFLAGS += -I$(RTE_SDK)/drivers/mempool/octeontx2
+
+ifneq ($(CONFIG_RTE_ARCH_64),y)
+CFLAGS += -Wno-int-to-pointer-cast
+CFLAGS += -Wno-pointer-to-int-cast
+ifeq ($(CONFIG_RTE_TOOLCHAIN_ICC),y)
+CFLAGS += -diag-disable 2259
+endif
+endif
 
 # PMD code
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_CRYPTO) += otx2_cryptodev.c
+SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_CRYPTO) += otx2_cryptodev_mbox.c
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_CRYPTO) += otx2_cryptodev_ops.c
 
 # export include files
drivers/crypto/octeontx2/meson.build +2 -0
index 2b55d2a..845d50d 100644
@@ -11,6 +11,7 @@ deps += ['common_octeontx2']
 name = 'octeontx2_crypto'
 
 sources = files('otx2_cryptodev.c',
+		'otx2_cryptodev_mbox.c',
 		'otx2_cryptodev_ops.c')
 
 extra_flags = []
@@ -27,3 +28,4 @@ endforeach
 
 includes += include_directories('../../common/cpt')
 includes += include_directories('../../common/octeontx2')
+includes += include_directories('../../mempool/octeontx2')
drivers/crypto/octeontx2/otx2_cryptodev.c +40 -0
index ca9f227..efc17cb 100644
@@ -14,7 +14,9 @@
 
 #include "otx2_common.h"
 #include "otx2_cryptodev.h"
+#include "otx2_cryptodev_mbox.h"
 #include "otx2_cryptodev_ops.h"
+#include "otx2_dev.h"
 
 /* CPT common headers */
 #include "cpt_common.h"
@@ -44,6 +46,9 @@ otx2_cpt_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
 	};
 	char name[RTE_CRYPTODEV_NAME_MAX_LEN];
 	struct rte_cryptodev *dev;
+	struct otx2_dev *otx2_dev;
+	struct otx2_cpt_vf *vf;
+	uint16_t nb_queues;
 	int ret;
 
 	rte_pci_device_name(&pci_dev->addr, name, sizeof(name));
@@ -58,11 +63,46 @@ otx2_cpt_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
 
 	dev->driver_id = otx2_cryptodev_driver_id;
 
+	/* Get private data space allocated */
+	vf = dev->data->dev_private;
+
+	otx2_dev = &vf->otx2_dev;
+
+	/* Initialize the base otx2_dev object */
+	ret = otx2_dev_init(pci_dev, otx2_dev);
+	if (ret) {
+		CPT_LOG_ERR("Could not initialize otx2_dev");
+		goto pmd_destroy;
+	}
+
+	/* Get number of queues available on the device */
+	ret = otx2_cpt_available_queues_get(dev, &nb_queues);
+	if (ret) {
+		CPT_LOG_ERR("Could not determine the number of queues available");
+		goto otx2_dev_fini;
+	}
+
+	/* Don't exceed the limits set per VF */
+	nb_queues = RTE_MIN(nb_queues, OTX2_CPT_MAX_QUEUES_PER_VF);
+
+	if (nb_queues == 0) {
+		CPT_LOG_ERR("No free queues available on the device");
+		goto otx2_dev_fini;
+	}
+
+	vf->max_queues = nb_queues;
+
+	CPT_LOG_INFO("Max queues supported by device: %d", vf->max_queues);
+
 	dev->feature_flags = RTE_CRYPTODEV_FF_SYMMETRIC_CRYPTO |
 			     RTE_CRYPTODEV_FF_HW_ACCELERATED;
 
 	return 0;
 
+otx2_dev_fini:
+	otx2_dev_fini(pci_dev, otx2_dev);
+pmd_destroy:
+	rte_cryptodev_pmd_destroy(dev);
 exit:
 	CPT_LOG_ERR("Could not create device (vendor_id: 0x%x device_id: 0x%x)",
 		    pci_dev->id.vendor_id, pci_dev->id.device_id);
drivers/crypto/octeontx2/otx2_cryptodev.h +9 -1
index c9fe0c8..d26c1f3 100644
@@ -7,14 +7,22 @@
 
 #include "cpt_common.h"
 
+#include "otx2_dev.h"
+
 /* Marvell OCTEON TX2 Crypto PMD device name */
 #define CRYPTODEV_NAME_OCTEONTX2_PMD	crypto_octeontx2
 
+#define OTX2_CPT_MAX_LFS		64
+#define OTX2_CPT_MAX_QUEUES_PER_VF	64
+
 /**
  * Device private data
  */
 struct otx2_cpt_vf {
-	/* To be populated */
+	struct otx2_dev otx2_dev;
+	/**< Base class */
+	uint16_t max_queues;
+	/**< Max queues supported */
 };
 
 #define CPT_LOGTYPE otx2_cpt_logtype
drivers/crypto/octeontx2/otx2_cryptodev_mbox.c new file +28 -0
new file mode 100644
index 0000000..20fc1ac
@@ -0,0 +1,28 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (C) 2019 Marvell International Ltd.
+ */
+#include <rte_cryptodev.h>
+
+#include "otx2_cryptodev.h"
+#include "otx2_cryptodev_mbox.h"
+#include "otx2_dev.h"
+#include "otx2_mbox.h"
+
+int
+otx2_cpt_available_queues_get(const struct rte_cryptodev *dev,
+			      uint16_t *nb_queues)
+{
+	struct otx2_cpt_vf *vf = dev->data->dev_private;
+	struct otx2_dev *otx2_dev = &vf->otx2_dev;
+	struct free_rsrcs_rsp *rsp;
+	int ret;
+
+	otx2_mbox_alloc_msg_free_rsrc_cnt(otx2_dev->mbox);
+
+	ret = otx2_mbox_process_msg(otx2_dev->mbox, (void *)&rsp);
+	if (ret)
+		return -EIO;
+
+	*nb_queues = rsp->cpt;
+	return 0;
+}
drivers/crypto/octeontx2/otx2_cryptodev_mbox.h new file +13 -0
new file mode 100644
index 0000000..648c009
@@ -0,0 +1,13 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (C) 2019 Marvell International Ltd.
+ */
+
+#ifndef _OTX2_CRYPTODEV_MBOX_H_
+#define _OTX2_CRYPTODEV_MBOX_H_
+
+#include <rte_cryptodev.h>
+
+int otx2_cpt_available_queues_get(const struct rte_cryptodev *dev,
+				  uint16_t *nb_queues);
+
+#endif /* _OTX2_CRYPTODEV_MBOX_H_ */
Signature · 1 line
2.7.4
#43 lore raw

PATCH v3 3/11 crypto/octeontx2: add device control ops

In reply to Anoob Joseph

From: Ankur Dwivedi <[email protected]>

This patch adds the device control functions.

---
 drivers/crypto/octeontx2/Makefile                  |   1 +
 drivers/crypto/octeontx2/meson.build               |   1 +
 drivers/crypto/octeontx2/otx2_cryptodev.h          |   6 +
 .../crypto/octeontx2/otx2_cryptodev_hw_access.c    | 126 ++++++++++++++++++++
 .../crypto/octeontx2/otx2_cryptodev_hw_access.h    |  27 +++++
 drivers/crypto/octeontx2/otx2_cryptodev_mbox.c     |  64 ++++++++++
 drivers/crypto/octeontx2/otx2_cryptodev_mbox.h     |   6 +
 drivers/crypto/octeontx2/otx2_cryptodev_ops.c      | 129 ++++++++++++++++++++-
 drivers/crypto/octeontx2/otx2_cryptodev_ops.h      |   3 +
 9 files changed, 358 insertions(+), 5 deletions(-)
 create mode 100644 drivers/crypto/octeontx2/otx2_cryptodev_hw_access.c
 create mode 100644 drivers/crypto/octeontx2/otx2_cryptodev_hw_access.h
drivers/crypto/octeontx2/Makefile +1 -0
index 10d8c39..71bc4d1 100644
@@ -35,6 +35,7 @@ endif
 
 # PMD code
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_CRYPTO) += otx2_cryptodev.c
+SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_CRYPTO) += otx2_cryptodev_hw_access.c
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_CRYPTO) += otx2_cryptodev_mbox.c
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_CRYPTO) += otx2_cryptodev_ops.c
 
drivers/crypto/octeontx2/meson.build +1 -0
index 845d50d..944fa2c 100644
@@ -11,6 +11,7 @@ deps += ['common_octeontx2']
 name = 'octeontx2_crypto'
 
 sources = files('otx2_cryptodev.c',
+		'otx2_cryptodev_hw_access.c',
 		'otx2_cryptodev_mbox.c',
 		'otx2_cryptodev_ops.c')
 
drivers/crypto/octeontx2/otx2_cryptodev.h +6 -0
index d26c1f3..8e0ebc2 100644
@@ -23,6 +23,12 @@ struct otx2_cpt_vf {
 	/**< Base class */
 	uint16_t max_queues;
 	/**< Max queues supported */
+	uint8_t nb_queues;
+	/**< Number of crypto queues attached */
+	uint16_t lf_msixoff[OTX2_CPT_MAX_LFS];
+	/**< MSI-X offsets */
+	uint8_t err_intr_registered:1;
+	/**< Are error interrupts registered? */
 };
 
 #define CPT_LOGTYPE otx2_cpt_logtype
drivers/crypto/octeontx2/otx2_cryptodev_hw_access.c new file +126 -0

126 lines not on this page · raw message

drivers/crypto/octeontx2/otx2_cryptodev_hw_access.h new file +27 -0
new file mode 100644
index 0000000..2af674d
@@ -0,0 +1,27 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (C) 2019 Marvell International Ltd.
+ */
+
+#ifndef _OTX2_CRYPTODEV_HW_ACCESS_H_
+#define _OTX2_CRYPTODEV_HW_ACCESS_H_
+
+#include <rte_cryptodev.h>
+
+#include "otx2_dev.h"
+
+/* Register offsets */
+
+/* CPT LF registers */
+#define OTX2_CPT_LF_MISC_INT		0xb0ull
+#define OTX2_CPT_LF_MISC_INT_ENA_W1S	0xd0ull
+#define OTX2_CPT_LF_MISC_INT_ENA_W1C	0xe0ull
+
+#define OTX2_CPT_LF_BAR2(vf, q_id) \
+		((vf)->otx2_dev.bar2 + \
+		 ((RVU_BLOCK_ADDR_CPT0 << 20) | ((q_id) << 12)))
+
+void otx2_cpt_err_intr_unregister(const struct rte_cryptodev *dev);
+
+int otx2_cpt_err_intr_register(const struct rte_cryptodev *dev);
+
+#endif /* _OTX2_CRYPTODEV_HW_ACCESS_H_ */
drivers/crypto/octeontx2/otx2_cryptodev_mbox.c +64 -0

67 lines not on this page · raw message

drivers/crypto/octeontx2/otx2_cryptodev_mbox.h +6 -0
index 648c009..0a43061 100644
@@ -10,4 +10,10 @@
 int otx2_cpt_available_queues_get(const struct rte_cryptodev *dev,
 				  uint16_t *nb_queues);
 
+int otx2_cpt_queues_attach(const struct rte_cryptodev *dev, uint8_t nb_queues);
+
+int otx2_cpt_queues_detach(const struct rte_cryptodev *dev);
+
+int otx2_cpt_msix_offsets_get(const struct rte_cryptodev *dev);
+
 #endif /* _OTX2_CRYPTODEV_MBOX_H_ */
drivers/crypto/octeontx2/otx2_cryptodev_ops.c +124 -5

139 lines not on this page · raw message

drivers/crypto/octeontx2/otx2_cryptodev_ops.h +3 -0
index 545614e..9bd24e7 100644
@@ -7,6 +7,9 @@
 
 #include <rte_cryptodev_pmd.h>
 
+#define OTX2_CPT_MIN_HEADROOM_REQ	24
+#define OTX2_CPT_MIN_TAILROOM_REQ	8
+
 struct rte_cryptodev_ops otx2_cpt_ops;
 
 #endif /* _OTX2_CRYPTODEV_OPS_H_ */
Signature · 1 line
2.7.4
#44 lore raw

PATCH v3 4/11 crypto/octeontx2: add queue pair functions

In reply to Anoob Joseph

From: Ankur Dwivedi <[email protected]>

This patch adds the queue pair setup and queue pair release functions for OCTEON TX2 crypto pmd.

---
 .../crypto/octeontx2/otx2_cryptodev_hw_access.c    |  99 +++++++
 .../crypto/octeontx2/otx2_cryptodev_hw_access.h    | 126 +++++++++
 drivers/crypto/octeontx2/otx2_cryptodev_mbox.c     |  83 ++++++
 drivers/crypto/octeontx2/otx2_cryptodev_mbox.h     |   6 +
 drivers/crypto/octeontx2/otx2_cryptodev_ops.c      | 306 ++++++++++++++++++++-
 5 files changed, 617 insertions(+), 3 deletions(-)
drivers/crypto/octeontx2/otx2_cryptodev_hw_access.c +99 -0
index 663f9ca..9e4f782 100644
@@ -1,10 +1,14 @@
 /* SPDX-License-Identifier: BSD-3-Clause
  * Copyright (C) 2019 Marvell International Ltd.
  */
+#include <rte_cryptodev.h>
 
 #include "otx2_common.h"
 #include "otx2_cryptodev.h"
 #include "otx2_cryptodev_hw_access.h"
+#include "otx2_cryptodev_mbox.h"
+#include "otx2_cryptodev_ops.h"
+#include "otx2_dev.h"
 
 #include "cpt_pmd_logs.h"
 
@@ -124,3 +128,98 @@ otx2_cpt_err_intr_register(const struct rte_cryptodev *dev)
 	 */
 	return 0;
 }
+
+int
+otx2_cpt_iq_enable(const struct rte_cryptodev *dev,
+		   const struct otx2_cpt_qp *qp, uint8_t grp_mask, uint8_t pri,
+		   uint32_t size_div40)
+{
+	union otx2_cpt_af_lf_ctl af_lf_ctl;
+	union otx2_cpt_lf_inprog inprog;
+	union otx2_cpt_lf_q_base base;
+	union otx2_cpt_lf_q_size size;
+	union otx2_cpt_lf_ctl lf_ctl;
+	int ret;
+
+	/* Set engine group mask and priority */
+
+	ret = otx2_cpt_af_reg_read(dev, OTX2_CPT_AF_LF_CTL(qp->id),
+				   &af_lf_ctl.u);
+	if (ret)
+		return ret;
+	af_lf_ctl.s.grp = grp_mask;
+	af_lf_ctl.s.pri = pri ? 1 : 0;
+	ret = otx2_cpt_af_reg_write(dev, OTX2_CPT_AF_LF_CTL(qp->id),
+				    af_lf_ctl.u);
+	if (ret)
+		return ret;
+
+	/* Set instruction queue base address */
+
+	base.u = otx2_read64(qp->base + OTX2_CPT_LF_Q_BASE);
+	base.s.fault = 0;
+	base.s.stopped = 0;
+	base.s.addr = qp->iq_dma_addr >> 7;
+	otx2_write64(base.u, qp->base + OTX2_CPT_LF_Q_BASE);
+
+	/* Set instruction queue size */
+
+	size.u = otx2_read64(qp->base + OTX2_CPT_LF_Q_SIZE);
+	size.s.size_div40 = size_div40;
+	otx2_write64(size.u, qp->base + OTX2_CPT_LF_Q_SIZE);
+
+	/* Enable instruction queue */
+
+	lf_ctl.u = otx2_read64(qp->base + OTX2_CPT_LF_CTL);
+	lf_ctl.s.ena = 1;
+	otx2_write64(lf_ctl.u, qp->base + OTX2_CPT_LF_CTL);
+
+	/* Start instruction execution */
+
+	inprog.u = otx2_read64(qp->base + OTX2_CPT_LF_INPROG);
+	inprog.s.eena = 1;
+	otx2_write64(inprog.u, qp->base + OTX2_CPT_LF_INPROG);
+
+	return 0;
+}
+
+void
+otx2_cpt_iq_disable(struct otx2_cpt_qp *qp)
+{
+	union otx2_cpt_lf_q_grp_ptr grp_ptr;
+	union otx2_cpt_lf_inprog inprog;
+	union otx2_cpt_lf_ctl ctl;
+	int cnt;
+
+	/* Stop instruction execution */
+	inprog.u = otx2_read64(qp->base + OTX2_CPT_LF_INPROG);
+	inprog.s.eena = 0x0;
+	otx2_write64(inprog.u, qp->base + OTX2_CPT_LF_INPROG);
+
+	/* Disable instructions enqueuing */
+	ctl.u = otx2_read64(qp->base + OTX2_CPT_LF_CTL);
+	ctl.s.ena = 0;
+	otx2_write64(ctl.u, qp->base + OTX2_CPT_LF_CTL);
+
+	/* Wait for instruction queue to become empty */
+	cnt = 0;
+	do {
+		inprog.u = otx2_read64(qp->base + OTX2_CPT_LF_INPROG);
+		if (inprog.s.grb_partial)
+			cnt = 0;
+		else
+			cnt++;
+		grp_ptr.u = otx2_read64(qp->base + OTX2_CPT_LF_Q_GRP_PTR);
+	} while ((cnt < 10) && (grp_ptr.s.nq_ptr != grp_ptr.s.dq_ptr));
+
+	cnt = 0;
+	do {
+		inprog.u = otx2_read64(qp->base + OTX2_CPT_LF_INPROG);
+		if ((inprog.s.inflight == 0) &&
+		    (inprog.s.gwb_cnt < 40) &&
+		    ((inprog.s.grb_cnt == 0) || (inprog.s.grb_cnt == 40)))
+			cnt++;
+		else
+			cnt = 0;
+	} while (cnt < 10);
+}
drivers/crypto/octeontx2/otx2_cryptodev_hw_access.h +126 -0

149 lines not on this page · raw message

drivers/crypto/octeontx2/otx2_cryptodev_mbox.c +83 -0

92 lines not on this page · raw message

drivers/crypto/octeontx2/otx2_cryptodev_mbox.h +6 -0
index 0a43061..a298718 100644
@@ -16,4 +16,10 @@ int otx2_cpt_queues_detach(const struct rte_cryptodev *dev);
 
 int otx2_cpt_msix_offsets_get(const struct rte_cryptodev *dev);
 
+int otx2_cpt_af_reg_read(const struct rte_cryptodev *dev, uint64_t reg,
+			 uint64_t *val);
+
+int otx2_cpt_af_reg_write(const struct rte_cryptodev *dev, uint64_t reg,
+			  uint64_t val);
+
 #endif /* _OTX2_CRYPTODEV_MBOX_H_ */
drivers/crypto/octeontx2/otx2_cryptodev_ops.c +303 -3

337 lines not on this page · raw message

Signature · 1 line
2.7.4
#45 lore raw

PATCH v3 5/11 crypto/octeontx2: add symmetric capabilities

In reply to Anoob Joseph

This patch adds the symmetric capabilities for OCTEON TX2 crypto PMD.

---
 doc/guides/cryptodevs/features/octeontx2.ini       |  59 ++
 doc/guides/cryptodevs/octeontx2.rst                |  41 ++
 drivers/crypto/octeontx2/Makefile                  |   1 +
 drivers/crypto/octeontx2/meson.build               |   1 +
 drivers/crypto/octeontx2/otx2_cryptodev.c          |   6 +-
 .../crypto/octeontx2/otx2_cryptodev_capabilities.c | 604 +++++++++++++++++++++
 .../crypto/octeontx2/otx2_cryptodev_capabilities.h |  16 +
 drivers/crypto/octeontx2/otx2_cryptodev_ops.c      |   3 +-
 8 files changed, 729 insertions(+), 2 deletions(-)
 create mode 100644 drivers/crypto/octeontx2/otx2_cryptodev_capabilities.c
 create mode 100644 drivers/crypto/octeontx2/otx2_cryptodev_capabilities.h
doc/guides/cryptodevs/features/octeontx2.ini +59 -0
index 35c9bee..4e82463 100644
@@ -5,4 +5,63 @@
 ;
 [Features]
 Symmetric crypto       = Y
+Sym operation chaining = Y
 HW Accelerated         = Y
+In Place SGL           = Y
+OOP SGL In LB  Out     = Y
+OOP SGL In SGL Out     = Y
+
+;
+; Supported crypto algorithms of 'octeontx2' crypto driver.
+;
+[Cipher]
+NULL           = Y
+3DES CBC       = Y
+3DES ECB       = Y
+AES CBC (128)  = Y
+AES CBC (192)  = Y
+AES CBC (256)  = Y
+AES CTR (128)  = Y
+AES CTR (192)  = Y
+AES CTR (256)  = Y
+AES XTS (128)  = Y
+AES XTS (256)  = Y
+DES CBC        = Y
+KASUMI F8      = Y
+SNOW3G UEA2    = Y
+ZUC EEA3       = Y
+
+;
+; Supported authentication algorithms of 'octeontx2' crypto driver.
+;
+[Auth]
+NULL         = Y
+AES GMAC     = Y
+KASUMI F9    = Y
+MD5          = Y
+MD5 HMAC     = Y
+SHA1         = Y
+SHA1 HMAC    = Y
+SHA224       = Y
+SHA224 HMAC  = Y
+SHA256       = Y
+SHA256 HMAC  = Y
+SHA384       = Y
+SHA384 HMAC  = Y
+SHA512       = Y
+SHA512 HMAC  = Y
+SNOW3G UIA2  = Y
+ZUC EIA3     = Y
+
+;
+; Supported AEAD algorithms of 'octeontx2' crypto driver.
+;
+[AEAD]
+AES GCM (128) = Y
+AES GCM (192) = Y
+AES GCM (256) = Y
+
+;
+; Supported Asymmetric algorithms of the 'octeontx2' crypto driver.
+;
+[Asymmetric]
doc/guides/cryptodevs/octeontx2.rst +41 -0

47 lines not on this page · raw message

drivers/crypto/octeontx2/Makefile +1 -0
index 71bc4d1..968efac 100644
@@ -35,6 +35,7 @@ endif
 
 # PMD code
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_CRYPTO) += otx2_cryptodev.c
+SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_CRYPTO) += otx2_cryptodev_capabilities.c
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_CRYPTO) += otx2_cryptodev_hw_access.c
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_CRYPTO) += otx2_cryptodev_mbox.c
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_CRYPTO) += otx2_cryptodev_ops.c
drivers/crypto/octeontx2/meson.build +1 -0
index 944fa2c..ee2e907 100644
@@ -11,6 +11,7 @@ deps += ['common_octeontx2']
 name = 'octeontx2_crypto'
 
 sources = files('otx2_cryptodev.c',
+		'otx2_cryptodev_capabilities.c',
 		'otx2_cryptodev_hw_access.c',
 		'otx2_cryptodev_mbox.c',
 		'otx2_cryptodev_ops.c')
drivers/crypto/octeontx2/otx2_cryptodev.c +5 -1
index efc17cb..32c0b48 100644
@@ -95,7 +95,11 @@ otx2_cpt_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
 	CPT_LOG_INFO("Max queues supported by device: %d", vf->max_queues);
 
 	dev->feature_flags = RTE_CRYPTODEV_FF_SYMMETRIC_CRYPTO |
-			     RTE_CRYPTODEV_FF_HW_ACCELERATED;
+			     RTE_CRYPTODEV_FF_HW_ACCELERATED |
+			     RTE_CRYPTODEV_FF_SYM_OPERATION_CHAINING |
+			     RTE_CRYPTODEV_FF_IN_PLACE_SGL |
+			     RTE_CRYPTODEV_FF_OOP_SGL_IN_LB_OUT |
+			     RTE_CRYPTODEV_FF_OOP_SGL_IN_SGL_OUT;
 
 	return 0;
 
drivers/crypto/octeontx2/otx2_cryptodev_capabilities.c new file +604 -0

604 lines not on this page · raw message

drivers/crypto/octeontx2/otx2_cryptodev_capabilities.h new file +16 -0
new file mode 100644
index 0000000..f103c32
@@ -0,0 +1,16 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (C) 2019 Marvell International Ltd.
+ */
+
+#ifndef _OTX2_CRYPTODEV_CAPABILITIES_H_
+#define _OTX2_CRYPTODEV_CAPABILITIES_H_
+
+#include <rte_cryptodev.h>
+
+/*
+ * Get capabilities list for the device
+ *
+ */
+const struct rte_cryptodev_capabilities *otx2_cpt_capabilities_get(void);
+
+#endif /* _OTX2_CRYPTODEV_CAPABILITIES_H_ */
drivers/crypto/octeontx2/otx2_cryptodev_ops.c +2 -1
index 8419e27..f2146ba 100644
@@ -8,6 +8,7 @@
 #include <rte_errno.h>
 
 #include "otx2_cryptodev.h"
+#include "otx2_cryptodev_capabilities.h"
 #include "otx2_cryptodev_hw_access.h"
 #include "otx2_cryptodev_mbox.h"
 #include "otx2_cryptodev_ops.h"
@@ -353,7 +354,7 @@ otx2_cpt_dev_info_get(struct rte_cryptodev *dev,
 	if (info != NULL) {
 		info->max_nb_queue_pairs = vf->max_queues;
 		info->feature_flags = dev->feature_flags;
-		info->capabilities = NULL;
+		info->capabilities = otx2_cpt_capabilities_get();
 		info->sym.max_nb_sessions = 0;
 		info->driver_id = otx2_cryptodev_driver_id;
 		info->min_mbuf_headroom_req = OTX2_CPT_MIN_HEADROOM_REQ;
Signature · 1 line
2.7.4
#46 lore raw

PATCH v3 6/11 crypto/octeontx2: add session related functions

In reply to Anoob Joseph

From: Ankur Dwivedi <[email protected]>

This patch adds the symmetric session related callbacks.

---
 drivers/common/cpt/cpt_mcode_defines.h        |   2 +
 drivers/crypto/octeontx2/otx2_cryptodev_ops.c | 117 +++++++++++++++++++++++++-
 drivers/crypto/octeontx2/otx2_cryptodev_ops.h |   5 ++
 3 files changed, 121 insertions(+), 3 deletions(-)
drivers/common/cpt/cpt_mcode_defines.h +2 -0
index 91d30a5..f356e62 100644
@@ -226,6 +226,8 @@ struct cpt_sess_misc {
 	uint16_t is_null:1;
 	/** Flag for GMAC */
 	uint16_t is_gmac:1;
+	/** Engine group */
+	uint16_t egrp:3;
 	/** AAD length */
 	uint16_t aad_length;
 	/** MAC len in bytes */
drivers/crypto/octeontx2/otx2_cryptodev_ops.c +114 -3

139 lines not on this page · raw message

drivers/crypto/octeontx2/otx2_cryptodev_ops.h +5 -0
index 9bd24e7..ba93a66 100644
@@ -10,6 +10,11 @@
 #define OTX2_CPT_MIN_HEADROOM_REQ	24
 #define OTX2_CPT_MIN_TAILROOM_REQ	8
 
+enum otx2_cpt_egrp {
+	OTX2_CPT_EGRP_SE = 0,
+	OTX2_CPT_EGRP_SE_IE = 1,
+};
+
 struct rte_cryptodev_ops otx2_cpt_ops;
 
 #endif /* _OTX2_CRYPTODEV_OPS_H_ */
Signature · 1 line
2.7.4
#47 lore raw

PATCH v3 7/11 crypto/octeontx2: add enqueue/dequeue ops

In reply to Anoob Joseph

This patch adds the enqueue burst and dequeue burst callbacks for the OCTEON TX2 crypto driver.

---
 drivers/common/cpt/cpt_hw_types.h                  |  52 ++++
 drivers/crypto/octeontx2/Makefile                  |   1 +
 drivers/crypto/octeontx2/meson.build               |   1 +
 .../crypto/octeontx2/otx2_cryptodev_hw_access.h    |  16 ++
 drivers/crypto/octeontx2/otx2_cryptodev_ops.c      | 289 +++++++++++++++++++++
 5 files changed, 359 insertions(+)
drivers/common/cpt/cpt_hw_types.h +52 -0
index 4c2893b..e2b127d 100644
@@ -197,6 +197,44 @@ typedef union cpt_inst_s {
 		};
 #endif /* Word 7 - End */
 	} s8x;
+	struct cpt_inst_s_9s {
+#if (RTE_BYTE_ORDER == RTE_BIG_ENDIAN) /* Word 0 - Big Endian */
+		uint64_t nixtx_addr            : 60;
+		uint64_t doneint               : 1;
+		uint64_t nixtxl                : 3;
+#else /* Word 0 - Little Endian */
+		uint64_t nixtxl                : 3;
+		uint64_t doneint               : 1;
+		uint64_t nixtx_addr            : 60;
+#endif /* Word 0 - End */
+		uint64_t res_addr;
+#if (RTE_BYTE_ORDER == RTE_BIG_ENDIAN) /* Word 2 - Big Endian */
+		uint64_t rvu_pf_func           : 16;
+		uint64_t reserved_172_175      : 4;
+		uint64_t grp                   : 10;
+		uint64_t tt                    : 2;
+		uint64_t tag                   : 32;
+#else /* Word 2 - Little Endian */
+		uint64_t tag                   : 32;
+		uint64_t tt                    : 2;
+		uint64_t grp                   : 10;
+		uint64_t reserved_172_175      : 4;
+		uint64_t rvu_pf_func           : 16;
+#endif /* Word 2 - End */
+#if (RTE_BYTE_ORDER == RTE_BIG_ENDIAN) /* Word 3 - Big Endian */
+		uint64_t wq_ptr                : 61;
+		uint64_t reserved_194_193      : 2;
+		uint64_t qord                  : 1;
+#else /* Word 3 - Little Endian */
+		uint64_t qord                  : 1;
+		uint64_t reserved_194_193      : 2;
+		uint64_t wq_ptr                : 61;
+#endif /* Word 3 - End */
+		uint64_t ei0;
+		uint64_t ei1;
+		uint64_t ei2;
+		uint64_t ei3;
+	} s9x;
 } cpt_inst_s_t;
 
 /**
@@ -243,6 +281,20 @@ typedef union cpt_res_s {
 		uint64_t reserved_64_127       : 64;
 #endif /* Word 1 - End */
 	} s8x;
+	struct cpt_res_s_9s {
+#if (RTE_BYTE_ORDER == RTE_BIG_ENDIAN) /* Word 0 - Big Endian */
+		uint64_t reserved_17_63:47;
+		uint64_t doneint:1;
+		uint64_t uc_compcode:8;
+		uint64_t compcode:8;
+#else /* Word 0 - Little Endian */
+		uint64_t compcode:8;
+		uint64_t uc_compcode:8;
+		uint64_t doneint:1;
+		uint64_t reserved_17_63:47;
+#endif /* Word 0 - End */
+		uint64_t reserved_64_127;
+	} s9x;
 } cpt_res_s_t;
 
 /**
drivers/crypto/octeontx2/Makefile +1 -0
index 968efac..ce116b8 100644
@@ -24,6 +24,7 @@ CFLAGS += -O3
 CFLAGS += -I$(RTE_SDK)/drivers/common/cpt
 CFLAGS += -I$(RTE_SDK)/drivers/common/octeontx2
 CFLAGS += -I$(RTE_SDK)/drivers/mempool/octeontx2
+CFLAGS += -DALLOW_EXPERIMENTAL_API
 
 ifneq ($(CONFIG_RTE_ARCH_64),y)
 CFLAGS += -Wno-int-to-pointer-cast
drivers/crypto/octeontx2/meson.build +1 -0
index ee2e907..b6e5b73 100644
@@ -10,6 +10,7 @@ deps += ['common_cpt']
 deps += ['common_octeontx2']
 name = 'octeontx2_crypto'
 
+allow_experimental_apis = true
 sources = files('otx2_cryptodev.c',
 		'otx2_cryptodev_capabilities.c',
 		'otx2_cryptodev_hw_access.c',
drivers/crypto/octeontx2/otx2_cryptodev_hw_access.h +16 -0
index 87d4e77..6f78aa4 100644
@@ -12,6 +12,7 @@
 
 #include "cpt_common.h"
 #include "cpt_hw_types.h"
+#include "cpt_mcode_defines.h"
 
 #include "otx2_dev.h"
 
@@ -119,6 +120,21 @@ union otx2_cpt_lf_q_grp_ptr {
 	} s;
 };
 
+/*
+ * Enumeration cpt_9x_comp_e
+ *
+ * CPT 9X Completion Enumeration
+ * Enumerates the values of CPT_RES_S[COMPCODE].
+ */
+enum cpt_9x_comp_e {
+	CPT_9X_COMP_E_NOTDONE = 0x00,
+	CPT_9X_COMP_E_GOOD = 0x01,
+	CPT_9X_COMP_E_FAULT = 0x02,
+	CPT_9X_COMP_E_HWERR = 0x04,
+	CPT_9X_COMP_E_INSTERR = 0x05,
+	CPT_9X_COMP_E_LAST_ENTRY = 0x06
+};
+
 struct otx2_cpt_qp {
 	uint32_t id;
 	/**< Queue pair id */
drivers/crypto/octeontx2/otx2_cryptodev_ops.c +289 -0

301 lines not on this page · raw message

Signature · 1 line
2.7.4
#48 lore raw

PATCH v3 8/11 test: add OCTEON TX2 tests

In reply to Anoob Joseph

This patch adds the OCTEON TX2 crypto validation tests.

---
 app/test/meson.build                        |   1 +
 app/test/test_cryptodev.c                   | 323 ++++++++++++++++++++++++++++
 app/test/test_cryptodev.h                   |   1 +
 app/test/test_cryptodev_aes_test_vectors.h  | 114 ++++++----
 app/test/test_cryptodev_blockcipher.c       |   7 +
 app/test/test_cryptodev_blockcipher.h       |   1 +
 app/test/test_cryptodev_des_test_vectors.h  |  12 +-
 app/test/test_cryptodev_hash_test_vectors.h |  75 ++++---
 doc/guides/cryptodevs/octeontx2.rst         |  11 +
 9 files changed, 478 insertions(+), 67 deletions(-)
app/test/meson.build +1 -0
index 2c23c63..a88b0eb 100644
@@ -271,6 +271,7 @@ driver_test_names = [
         'cryptodev_dpaa_sec_autotest',
         'cryptodev_dpaa2_sec_autotest',
         'cryptodev_null_autotest',
+        'cryptodev_octeontx2_autotest',
         'cryptodev_openssl_autotest',
         'cryptodev_openssl_asym_autotest',
         'cryptodev_qat_autotest',
app/test/test_cryptodev.c +323 -0

346 lines not on this page · raw message

app/test/test_cryptodev.h +1 -0
index d20586e..def304e 100644
@@ -66,6 +66,7 @@
 #define CRYPTODEV_NAME_CCP_PMD		crypto_ccp
 #define CRYPTODEV_NAME_VIRTIO_PMD	crypto_virtio
 #define CRYPTODEV_NAME_OCTEONTX_SYM_PMD	crypto_octeontx
+#define CRYPTODEV_NAME_OCTEONTX2_PMD	crypto_octeontx2
 #define CRYPTODEV_NAME_CAAM_JR_PMD	crypto_caam_jr
 #define CRYPTODEV_NAME_NITROX_PMD	crypto_nitrox_sym
 
app/test/test_cryptodev_aes_test_vectors.h +76 -38

342 lines not on this page · raw message

app/test/test_cryptodev_blockcipher.c +7 -0
index 885a20e..5bfe2d0 100644
@@ -77,6 +77,8 @@ test_blockcipher_one_case(const struct blockcipher_test_case *t,
 			RTE_STR(CRYPTODEV_NAME_VIRTIO_PMD));
 	int octeontx_pmd = rte_cryptodev_driver_id_get(
 			RTE_STR(CRYPTODEV_NAME_OCTEONTX_SYM_PMD));
+	int octeontx2_pmd = rte_cryptodev_driver_id_get(
+			RTE_STR(CRYPTODEV_NAME_OCTEONTX2_PMD));
 	int null_pmd = rte_cryptodev_driver_id_get(
 				RTE_STR(CRYPTODEV_NAME_NULL_PMD));
 	int nitrox_pmd = rte_cryptodev_driver_id_get(
@@ -127,6 +129,7 @@ test_blockcipher_one_case(const struct blockcipher_test_case *t,
 			driver_id == ccp_pmd ||
 			driver_id == virtio_pmd ||
 			driver_id == octeontx_pmd ||
+			driver_id == octeontx2_pmd ||
 			driver_id == null_pmd ||
 			driver_id == nitrox_pmd) { /* Fall through */
 		digest_len = tdata->digest.len;
@@ -718,6 +721,8 @@ test_blockcipher_all_tests(struct rte_mempool *mbuf_pool,
 			RTE_STR(CRYPTODEV_NAME_VIRTIO_PMD));
 	int octeontx_pmd = rte_cryptodev_driver_id_get(
 			RTE_STR(CRYPTODEV_NAME_OCTEONTX_SYM_PMD));
+	int octeontx2_pmd = rte_cryptodev_driver_id_get(
+			RTE_STR(CRYPTODEV_NAME_OCTEONTX2_PMD));
 	int null_pmd = rte_cryptodev_driver_id_get(
 				RTE_STR(CRYPTODEV_NAME_NULL_PMD));
 	int nitrox_pmd = rte_cryptodev_driver_id_get(
@@ -792,6 +797,8 @@ test_blockcipher_all_tests(struct rte_mempool *mbuf_pool,
 		target_pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_VIRTIO;
 	else if (driver_id == octeontx_pmd)
 		target_pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX;
+	else if (driver_id == octeontx2_pmd)
+		target_pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX2;
 	else if (driver_id == null_pmd)
 		target_pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_NULL;
 	else if (driver_id == nitrox_pmd)
app/test/test_cryptodev_blockcipher.h +1 -0
index 1a65cda..204ba7b 100644
@@ -33,6 +33,7 @@
 #define BLOCKCIPHER_TEST_TARGET_PMD_CCP		0x0800 /* CCP flag */
 #define BLOCKCIPHER_TEST_TARGET_PMD_NULL	0x1000 /* NULL flag */
 #define BLOCKCIPHER_TEST_TARGET_PMD_NITROX	0x2000 /* NITROX flag */
+#define BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX2	0x4000 /* OCTEON TX2 flag */
 
 #define BLOCKCIPHER_TEST_OP_CIPHER	(BLOCKCIPHER_TEST_OP_ENCRYPT | \
 					BLOCKCIPHER_TEST_OP_DECRYPT)
app/test/test_cryptodev_des_test_vectors.h +8 -4
index a71b0e9..9d2d0e7 100644
@@ -1114,7 +1114,8 @@ static const struct blockcipher_test_case triple_des_chain_test_cases[] = {
 			BLOCKCIPHER_TEST_TARGET_PMD_CAAM_JR |
 			BLOCKCIPHER_TEST_TARGET_PMD_MVSAM |
 			BLOCKCIPHER_TEST_TARGET_PMD_CCP |
-			BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX
+			BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX |
+			BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX2
 	},
 	{
 		.test_descr = "3DES-192-CBC HMAC-SHA1 Decryption Digest Verify",
@@ -1127,7 +1128,8 @@ static const struct blockcipher_test_case triple_des_chain_test_cases[] = {
 			BLOCKCIPHER_TEST_TARGET_PMD_CAAM_JR |
 			BLOCKCIPHER_TEST_TARGET_PMD_MVSAM |
 			BLOCKCIPHER_TEST_TARGET_PMD_CCP |
-			BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX
+			BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX |
+			BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX2
 	},
 	{
 		.test_descr = "3DES-192-CBC SHA1 Encryption Digest",
@@ -1296,7 +1298,8 @@ static const struct blockcipher_test_case triple_des_cipheronly_test_cases[] = {
 			BLOCKCIPHER_TEST_TARGET_PMD_MVSAM |
 			BLOCKCIPHER_TEST_TARGET_PMD_CCP |
 			BLOCKCIPHER_TEST_TARGET_PMD_MB |
-			BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX
+			BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX |
+			BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX2
 	},
 	{
 		.test_descr = "3DES-192-CBC Decryption",
@@ -1310,7 +1313,8 @@ static const struct blockcipher_test_case triple_des_cipheronly_test_cases[] = {
 			BLOCKCIPHER_TEST_TARGET_PMD_MVSAM |
 			BLOCKCIPHER_TEST_TARGET_PMD_CCP |
 			BLOCKCIPHER_TEST_TARGET_PMD_MB |
-			BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX
+			BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX |
+			BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX2
 	},
 	{
 		.test_descr = "3DES-128-CTR Encryption",
app/test/test_cryptodev_hash_test_vectors.h +50 -25

225 lines not on this page · raw message

doc/guides/cryptodevs/octeontx2.rst +11 -0
index 47e9150..406d746 100644
@@ -132,3 +132,14 @@ Debugging Options
     +===+============+=======================================================+
     | 1 | CPT        | --log-level='pmd\.crypto\.octeontx2,8'                |
     +---+------------+-------------------------------------------------------+
+
+Testing
+-------
+
+The symmetric crypto operations on OCTEON TX2 crypto PMD may be verified by running the test
+application:
+
+.. code-block:: console
+
+    ./test
+    RTE>>cryptodev_octeontx2_autotest
Signature · 1 line
2.7.4
#49 lore raw

PATCH v3 9/11 crypto/octeontx2: add asymmetric session operations

In reply to Anoob Joseph

From: Kanaka Durga Kotamarthy <[email protected]>

This patch adds asymmetric session setup and free routines. RSA and modexp operations are supported.

---
 doc/guides/cryptodevs/features/octeontx2.ini       |   4 +
 doc/guides/cryptodevs/octeontx2.rst                |   6 ++
 drivers/crypto/octeontx2/otx2_cryptodev.c          |   4 +-
 .../crypto/octeontx2/otx2_cryptodev_capabilities.c |  39 +++++++-
 drivers/crypto/octeontx2/otx2_cryptodev_ops.c      | 104 ++++++++++++++++++---
 5 files changed, 143 insertions(+), 14 deletions(-)
doc/guides/cryptodevs/features/octeontx2.ini +4 -0
index 4e82463..7d07053 100644
@@ -5,11 +5,13 @@
 ;
 [Features]
 Symmetric crypto       = Y
+Asymmetric crypto      = Y
 Sym operation chaining = Y
 HW Accelerated         = Y
 In Place SGL           = Y
 OOP SGL In LB  Out     = Y
 OOP SGL In SGL Out     = Y
+RSA PRIV OP KEY QT     = Y
 
 ;
 ; Supported crypto algorithms of 'octeontx2' crypto driver.
@@ -65,3 +67,5 @@ AES GCM (256) = Y
 ; Supported Asymmetric algorithms of the 'octeontx2' crypto driver.
 ;
 [Asymmetric]
+RSA                    = Y
+Modular Exponentiation = Y
doc/guides/cryptodevs/octeontx2.rst +6 -0
index 406d746..ad33c66 100644
@@ -56,6 +56,12 @@ AEAD algorithms:
 
 * ``RTE_CRYPTO_AEAD_AES_GCM``
 
+Asymmetric Crypto Algorithms
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+* ``RTE_CRYPTO_ASYM_XFORM_RSA``
+* ``RTE_CRYPTO_ASYM_XFORM_MODEX``
+
 
 Installation
 ------------
drivers/crypto/octeontx2/otx2_cryptodev.c +3 -1
index 32c0b48..7fd216b 100644
@@ -99,7 +99,9 @@ otx2_cpt_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
 			     RTE_CRYPTODEV_FF_SYM_OPERATION_CHAINING |
 			     RTE_CRYPTODEV_FF_IN_PLACE_SGL |
 			     RTE_CRYPTODEV_FF_OOP_SGL_IN_LB_OUT |
-			     RTE_CRYPTODEV_FF_OOP_SGL_IN_SGL_OUT;
+			     RTE_CRYPTODEV_FF_OOP_SGL_IN_SGL_OUT |
+			     RTE_CRYPTODEV_FF_ASYMMETRIC_CRYPTO |
+			     RTE_CRYPTODEV_FF_RSA_PRIV_OP_KEY_QT;
 
 	return 0;
 
drivers/crypto/octeontx2/otx2_cryptodev_capabilities.c +37 -2
index 3a70470..b9e3fe3 100644
@@ -6,7 +6,8 @@
 
 #include "otx2_cryptodev_capabilities.h"
 
-static const struct rte_cryptodev_capabilities otx2_cpt_sym_capabilities[] = {
+static const struct
+rte_cryptodev_capabilities otx2_cpt_capabilities[] = {
 	/* Symmetric capabilities */
 	{	/* NULL (AUTH) */
 		.op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
@@ -594,11 +595,45 @@ static const struct rte_cryptodev_capabilities otx2_cpt_sym_capabilities[] = {
 		}, }
 	},
 	/* End of symmetric capabilities */
+
+	/* Asymmetric capabilities */
+	{	/* RSA */
+		.op = RTE_CRYPTO_OP_TYPE_ASYMMETRIC,
+		{.asym = {
+			.xform_capa = {
+				.xform_type = RTE_CRYPTO_ASYM_XFORM_RSA,
+				.op_types = ((1 << RTE_CRYPTO_ASYM_OP_SIGN) |
+					(1 << RTE_CRYPTO_ASYM_OP_VERIFY) |
+					(1 << RTE_CRYPTO_ASYM_OP_ENCRYPT) |
+					(1 << RTE_CRYPTO_ASYM_OP_DECRYPT)),
+				{.modlen = {
+					.min = 17,
+					.max = 1024,
+					.increment = 1
+				}, }
+			}
+		}, }
+	},
+	{	/* MOD_EXP */
+		.op = RTE_CRYPTO_OP_TYPE_ASYMMETRIC,
+		{.asym = {
+			.xform_capa = {
+				.xform_type = RTE_CRYPTO_ASYM_XFORM_MODEX,
+				.op_types = 0,
+				{.modlen = {
+					.min = 17,
+					.max = 1024,
+					.increment = 1
+				}, }
+			}
+		}, }
+	},
+	/* End of asymmetric capabilities */
 	RTE_CRYPTODEV_END_OF_CAPABILITIES_LIST()
 };
 
 const struct rte_cryptodev_capabilities *
 otx2_cpt_capabilities_get(void)
 {
-	return otx2_cpt_sym_capabilities;
+	return otx2_cpt_capabilities;
 }
drivers/crypto/octeontx2/otx2_cryptodev_ops.c +93 -11

133 lines not on this page · raw message

Signature · 1 line
2.7.4
#50 lore raw

PATCH v3 10/11 crypto/octeontx2: add asymmetric in enqueue/dequeue ops

In reply to Anoob Joseph

From: Sunila Sahu <[email protected]>

This patch adds asymmetric support in enqueue/dequeue ops.

---
 drivers/crypto/octeontx2/otx2_cryptodev_ops.c | 177 ++++++++++++++++++++++++++
 drivers/crypto/octeontx2/otx2_cryptodev_ops.h |   1 +
 2 files changed, 178 insertions(+)
drivers/crypto/octeontx2/otx2_cryptodev_ops.c +177 -0
index f8d203e..65101b0 100644
@@ -393,6 +393,78 @@ otx2_cpt_enqueue_req(const struct otx2_cpt_qp *qp,
 	return 0;
 }
 
+static __rte_always_inline int32_t __hot
+otx2_cpt_enqueue_asym(struct otx2_cpt_qp *qp,
+		      struct rte_crypto_op *op,
+		      struct pending_queue *pend_q)
+{
+	struct cpt_qp_meta_info *minfo = &qp->meta_info;
+	struct rte_crypto_asym_op *asym_op = op->asym;
+	struct asym_op_params params = {0};
+	struct cpt_asym_sess_misc *sess;
+	vq_cmd_word3_t *w3;
+	uintptr_t *cop;
+	void *mdata;
+	int ret;
+
+	if (unlikely(rte_mempool_get(minfo->pool, &mdata) < 0)) {
+		CPT_LOG_ERR("Could not allocate meta buffer for request");
+		return -ENOMEM;
+	}
+
+	sess = get_asym_session_private_data(asym_op->session,
+					     otx2_cryptodev_driver_id);
+
+	/* Store IO address of the mdata to meta_buf */
+	params.meta_buf = rte_mempool_virt2iova(mdata);
+
+	cop = mdata;
+	cop[0] = (uintptr_t)mdata;
+	cop[1] = (uintptr_t)op;
+	cop[2] = cop[3] = 0ULL;
+
+	params.req = RTE_PTR_ADD(cop, 4 * sizeof(uintptr_t));
+	params.req->op = cop;
+
+	/* Adjust meta_buf to point to end of cpt_request_info structure */
+	params.meta_buf += (4 * sizeof(uintptr_t)) +
+			    sizeof(struct cpt_request_info);
+	switch (sess->xfrm_type) {
+	case RTE_CRYPTO_ASYM_XFORM_MODEX:
+		ret = cpt_modex_prep(&params, &sess->mod_ctx);
+		if (unlikely(ret))
+			goto req_fail;
+		break;
+	case RTE_CRYPTO_ASYM_XFORM_RSA:
+		ret = cpt_enqueue_rsa_op(op, &params, sess);
+		if (unlikely(ret))
+			goto req_fail;
+		break;
+	default:
+		op->status = RTE_CRYPTO_OP_STATUS_INVALID_ARGS;
+		ret = -EINVAL;
+		goto req_fail;
+	}
+
+	/* Set engine group of AE */
+	w3 = (vq_cmd_word3_t *)&params.req->ist.ei3;
+	w3->s.grp = OTX2_CPT_EGRP_AE;
+
+	ret = otx2_cpt_enqueue_req(qp, pend_q, params.req);
+
+	if (unlikely(ret)) {
+		CPT_LOG_DP_ERR("Could not enqueue crypto req");
+		goto req_fail;
+	}
+
+	return 0;
+
+req_fail:
+	free_op_meta(mdata, minfo->pool);
+
+	return ret;
+}
+
 static __rte_always_inline int __hot
 otx2_cpt_enqueue_sym(struct otx2_cpt_qp *qp, struct rte_crypto_op *op,
 		     struct pending_queue *pend_q)
@@ -494,6 +566,11 @@ otx2_cpt_enqueue_burst(void *qptr, struct rte_crypto_op **ops, uint16_t nb_ops)
 			else
 				ret = otx2_cpt_enqueue_sym_sessless(qp, op,
 								    pend_q);
+		} else if (op->type == RTE_CRYPTO_OP_TYPE_ASYMMETRIC) {
+			if (op->sess_type == RTE_CRYPTO_OP_WITH_SESSION)
+				ret = otx2_cpt_enqueue_asym(qp, op, pend_q);
+			else
+				break;
 		} else
 			break;
 
@@ -504,6 +581,92 @@ otx2_cpt_enqueue_burst(void *qptr, struct rte_crypto_op **ops, uint16_t nb_ops)
 	return count;
 }
 
+static __rte_always_inline void
+otx2_cpt_asym_rsa_op(struct rte_crypto_op *cop, struct cpt_request_info *req,
+		     struct rte_crypto_rsa_xform *rsa_ctx)
+{
+	struct rte_crypto_rsa_op_param *rsa = &cop->asym->rsa;
+
+	switch (rsa->op_type) {
+	case RTE_CRYPTO_ASYM_OP_ENCRYPT:
+		rsa->cipher.length = rsa_ctx->n.length;
+		memcpy(rsa->cipher.data, req->rptr, rsa->cipher.length);
+		break;
+	case RTE_CRYPTO_ASYM_OP_DECRYPT:
+		if (rsa->pad == RTE_CRYPTO_RSA_PADDING_NONE) {
+			rsa->message.length = rsa_ctx->n.length;
+			memcpy(rsa->message.data, req->rptr,
+			       rsa->message.length);
+		} else {
+			/* Get length of decrypted output */
+			rsa->message.length = rte_cpu_to_be_16
+					     (*((uint16_t *)req->rptr));
+			/*
+			 * Offset output data pointer by length field
+			 * (2 bytes) and copy decrypted data.
+			 */
+			memcpy(rsa->message.data, req->rptr + 2,
+			       rsa->message.length);
+		}
+		break;
+	case RTE_CRYPTO_ASYM_OP_SIGN:
+		rsa->sign.length = rsa_ctx->n.length;
+		memcpy(rsa->sign.data, req->rptr, rsa->sign.length);
+		break;
+	case RTE_CRYPTO_ASYM_OP_VERIFY:
+		if (rsa->pad == RTE_CRYPTO_RSA_PADDING_NONE) {
+			rsa->sign.length = rsa_ctx->n.length;
+			memcpy(rsa->sign.data, req->rptr, rsa->sign.length);
+		} else {
+			/* Get length of signed output */
+			rsa->sign.length = rte_cpu_to_be_16
+					  (*((uint16_t *)req->rptr));
+			/*
+			 * Offset output data pointer by length field
+			 * (2 bytes) and copy signed data.
+			 */
+			memcpy(rsa->sign.data, req->rptr + 2,
+			       rsa->sign.length);
+		}
+		if (memcmp(rsa->sign.data, rsa->message.data,
+			   rsa->message.length)) {
+			CPT_LOG_DP_ERR("RSA verification failed");
+			cop->status = RTE_CRYPTO_OP_STATUS_ERROR;
+		}
+		break;
+	default:
+		CPT_LOG_DP_DEBUG("Invalid RSA operation type");
+		cop->status = RTE_CRYPTO_OP_STATUS_INVALID_ARGS;
+		break;
+	}
+}
+
+static void
+otx2_cpt_asym_post_process(struct rte_crypto_op *cop,
+			   struct cpt_request_info *req)
+{
+	struct rte_crypto_asym_op *op = cop->asym;
+	struct cpt_asym_sess_misc *sess;
+
+	sess = get_asym_session_private_data(op->session,
+					     otx2_cryptodev_driver_id);
+
+	switch (sess->xfrm_type) {
+	case RTE_CRYPTO_ASYM_XFORM_RSA:
+		otx2_cpt_asym_rsa_op(cop, req, &sess->rsa_ctx);
+		break;
+	case RTE_CRYPTO_ASYM_XFORM_MODEX:
+		op->modex.result.length = sess->mod_ctx.modulus.length;
+		memcpy(op->modex.result.data, req->rptr,
+		       op->modex.result.length);
+		break;
+	default:
+		CPT_LOG_DP_DEBUG("Invalid crypto xform type");
+		cop->status = RTE_CRYPTO_OP_STATUS_INVALID_ARGS;
+		break;
+	}
+}
+
 static inline void
 otx2_cpt_dequeue_post_process(struct otx2_cpt_qp *qp, struct rte_crypto_op *cop,
 			      uintptr_t *rsp, uint8_t cc)
@@ -530,6 +693,20 @@ otx2_cpt_dequeue_post_process(struct otx2_cpt_qp *qp, struct rte_crypto_op *cop,
 			cop->sym->session = NULL;
 		}
 	}
+
+	if (cop->type == RTE_CRYPTO_OP_TYPE_ASYMMETRIC) {
+		if (likely(cc == NO_ERR)) {
+			cop->status = RTE_CRYPTO_OP_STATUS_SUCCESS;
+			/*
+			 * Pass cpt_req_info stored in metabuf during
+			 * enqueue.
+			 */
+			rsp = RTE_PTR_ADD(rsp, 4 * sizeof(uintptr_t));
+			otx2_cpt_asym_post_process(cop,
+					(struct cpt_request_info *)rsp);
+		} else
+			cop->status = RTE_CRYPTO_OP_STATUS_ERROR;
+	}
 }
 
 static __rte_always_inline uint8_t
drivers/crypto/octeontx2/otx2_cryptodev_ops.h +1 -0
index ba93a66..a2724f7 100644
@@ -13,6 +13,7 @@
 enum otx2_cpt_egrp {
 	OTX2_CPT_EGRP_SE = 0,
 	OTX2_CPT_EGRP_SE_IE = 1,
+	OTX2_CPT_EGRP_AE = 2
 };
 
 struct rte_cryptodev_ops otx2_cpt_ops;
Signature · 1 line
2.7.4
#51 lore raw

PATCH v3 11/11 app/test: register octeontx2 PMD to asym testsuite

In reply to Anoob Joseph

From: Sunila Sahu <[email protected]>

This patch updates asymmetric crypto unit-test application to validate asymmetric crypto operation supported by octeontx2 PMD.

---
 app/test/test_cryptodev_asym.c      | 20 ++++++++++++++++++++
 doc/guides/cryptodevs/octeontx2.rst |  8 ++++++++
 2 files changed, 28 insertions(+)
app/test/test_cryptodev_asym.c +20 -0
index 241c384..6cc2f97 100644
@@ -1851,6 +1851,23 @@ test_cryptodev_octeontx_asym(void)
 	return unit_test_suite_runner(&cryptodev_octeontx_asym_testsuite);
 }
 
+static int
+test_cryptodev_octeontx2_asym(void)
+{
+	gbl_driver_id = rte_cryptodev_driver_id_get(
+			RTE_STR(CRYPTODEV_NAME_OCTEONTX2_PMD));
+	if (gbl_driver_id == -1) {
+		RTE_LOG(ERR, USER1, "OCTEONTX2 PMD must be loaded. Check if "
+				"CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_CRYPTO is "
+				"enabled in config file to run this "
+				"testsuite.\n");
+		return TEST_FAILED;
+	}
+
+	/* Use test suite registered for crypto_octeontx PMD */
+	return unit_test_suite_runner(&cryptodev_octeontx_asym_testsuite);
+}
+
 REGISTER_TEST_COMMAND(cryptodev_openssl_asym_autotest,
 					  test_cryptodev_openssl_asym);
 
@@ -1858,3 +1875,6 @@ REGISTER_TEST_COMMAND(cryptodev_qat_asym_autotest, test_cryptodev_qat_asym);
 
 REGISTER_TEST_COMMAND(cryptodev_octeontx_asym_autotest,
 					  test_cryptodev_octeontx_asym);
+
+REGISTER_TEST_COMMAND(cryptodev_octeontx2_asym_autotest,
+					  test_cryptodev_octeontx2_asym);
doc/guides/cryptodevs/octeontx2.rst +8 -0
index ad33c66..8bdb83f 100644
@@ -149,3 +149,11 @@ application:
 
     ./test
     RTE>>cryptodev_octeontx2_autotest
+
+The asymmetric crypto operations on OCTEON TX2 crypto PMD may be verified by running the test
+application:
+
+.. code-block:: console
+
+    ./test
+    RTE>>cryptodev_octeontx2_asym_autotest
Signature · 1 line
2.7.4
Acked-by on the v3 series Applied
#52 lore raw
In reply to Anoob Joseph
Quoted 87 lines

The series introduces poll mode driver to enable crypto offload engine on Marvell OCTEON TX2 SoC.

Changes in v3:
* Rebased on tip of dpdk-next-crypto("36112de91a44")
* Updated version map to use right DPDK version
* Added sanity checks in dev_close() routine.

Changes in v2:
* Merged series adding sym features and asym features into one.
* Squashed patches as directed by Akhil.
* Added check for ASYM SESSIONLESS (not supported currently)
* Minor updates to documentation

Ankur Dwivedi (3):
crypto/octeontx2: add device control ops
crypto/octeontx2: add queue pair functions
crypto/octeontx2: add session related functions

Anoob Joseph (5):
crypto/octeontx2: add PMD skeleton crypto/octeontx2: add device init sequence in probe crypto/octeontx2: add symmetric capabilities crypto/octeontx2: add enqueue/dequeue ops
test: add OCTEON TX2 tests

Kanaka Durga Kotamarthy (1):
crypto/octeontx2: add asymmetric session operations

Sunila Sahu (2):
crypto/octeontx2: add asymmetric in enqueue/dequeue ops app/test: register octeontx2 PMD to asym testsuite

 MAINTAINERS                                        |    7 +
 app/test/meson.build                               |    1 +
 app/test/test_cryptodev.c                          |  323 ++++++
 app/test/test_cryptodev.h                          |    1 +
 app/test/test_cryptodev_aes_test_vectors.h         |  114 +-
 app/test/test_cryptodev_asym.c                     |   20 +
 app/test/test_cryptodev_blockcipher.c              |    7 +
 app/test/test_cryptodev_blockcipher.h              |    1 +
 app/test/test_cryptodev_des_test_vectors.h         |   12 +-
 app/test/test_cryptodev_hash_test_vectors.h        |   75 +-
 config/common_base                                 |    5 +
 doc/guides/cryptodevs/features/octeontx2.ini       |   71 ++
 doc/guides/cryptodevs/index.rst                    |    1 +
 doc/guides/cryptodevs/octeontx2.rst                |  159 +++
 doc/guides/platform/octeontx2.rst                  |    3 +
 doc/guides/rel_notes/release_19_11.rst             |    6 +
 drivers/common/Makefile                            |    5 +-
 drivers/common/cpt/cpt_hw_types.h                  |   52 +
 drivers/common/cpt/cpt_mcode_defines.h             |    2 +
 drivers/crypto/Makefile                            |    1 +
 drivers/crypto/meson.build                         |   21 +-
 drivers/crypto/octeontx2/Makefile                  |   50 +
 drivers/crypto/octeontx2/meson.build               |   34 +
 drivers/crypto/octeontx2/otx2_cryptodev.c          |  157 +++
 drivers/crypto/octeontx2/otx2_cryptodev.h          |   43 +
 .../crypto/octeontx2/otx2_cryptodev_capabilities.c |  639 +++++++++++
 .../crypto/octeontx2/otx2_cryptodev_capabilities.h |   16 +
 .../crypto/octeontx2/otx2_cryptodev_hw_access.c    |  225 ++++
 .../crypto/octeontx2/otx2_cryptodev_hw_access.h    |  169 +++
 drivers/crypto/octeontx2/otx2_cryptodev_mbox.c     |  175 ++++
 drivers/crypto/octeontx2/otx2_cryptodev_mbox.h     |   25 +
 drivers/crypto/octeontx2/otx2_cryptodev_ops.c      | 1106
++++++++++++++++++++
 drivers/crypto/octeontx2/otx2_cryptodev_ops.h      |   21 +
 .../octeontx2/rte_pmd_octeontx2_crypto_version.map |    4 +
 mk/rte.app.mk                                      |    6 +-
 35 files changed, 3485 insertions(+), 72 deletions(-)
 create mode 100644 doc/guides/cryptodevs/features/octeontx2.ini
 create mode 100644 doc/guides/cryptodevs/octeontx2.rst
 create mode 100644 drivers/crypto/octeontx2/Makefile
 create mode 100644 drivers/crypto/octeontx2/meson.build
 create mode 100644 drivers/crypto/octeontx2/otx2_cryptodev.c
 create mode 100644 drivers/crypto/octeontx2/otx2_cryptodev.h
 create mode 100644 drivers/crypto/octeontx2/otx2_cryptodev_capabilities.c
 create mode 100644 drivers/crypto/octeontx2/otx2_cryptodev_capabilities.h
 create mode 100644 drivers/crypto/octeontx2/otx2_cryptodev_hw_access.c
 create mode 100644 drivers/crypto/octeontx2/otx2_cryptodev_hw_access.h
 create mode 100644 drivers/crypto/octeontx2/otx2_cryptodev_mbox.c
 create mode 100644 drivers/crypto/octeontx2/otx2_cryptodev_mbox.h
 create mode 100644 drivers/crypto/octeontx2/otx2_cryptodev_ops.c
 create mode 100644 drivers/crypto/octeontx2/otx2_cryptodev_ops.h
 create mode 100644
Quoted 2 lines

drivers/crypto/octeontx2/rte_pmd_octeontx2_crypto_version.map

Applied to dpdk-next-crypto

Thanks.