add AESNI-MB rawdev for multi-function processing
Subsystems (2)
v3 cover add AESNI-MB rawdev for multi-function processing
Introduction
============
This patchset adds a new AESNI-MB Multi-Function raw device PMD for utilizing multi-function capabilities of the Intel IPSec Multi Buffer library.
The aim of this rawdev PMD is to provide a way of combining one or more common packet-processing functions into a single operation, focused on DOCSIS and GPON MAC workloads. This allows these functions to be performed in parallel by the Intel IPSec Multi Buffer library. These functions include cryptography and CRC/BIP calculations. Performing these functions in parallel as a single operation can enable a significant performance improvement.
Background
==========
There are a number of byte-wise operations which are used across many access network data-plane pipelines, such as Cipher, CRC and Bit-Interleaved-Parity (BIP). Some prototyping has been done at Intel as part of the 01.org access-network-dataplanes project to prove that a significant performance improvement is possible when such byte-wise operations are combined into a single pass of packet data processing. This performance boost has been prototyped for both DOCSIS MAC data-plane and GPON MAC data-plane pipelines based on DPDK.
The original prototypes on 01.org used some protocol-specific modifications to the DPDK cryptodev library. In order to make this performance optimization consumable for network access equipment vendors, a better solution was required as CRC and BIP cannot be regarded as cryptographic algorithms.
Hence, the introduction of an AESNI-MB Multi-Function rawdev PMD. This PMD uses a new multi-function interface which allows different types of operations be combined together. Initially, only symmetric crypto and error detection (i.e. CRC and BIP) operations can be combined.
NOTE: In a future DPDK release, a QAT Multi-Function raw device will also be added. As multiple raw devices will share the same interface, the approach taken was to create a common interface (i.e. multi-function) which can be used by these devices. This both cuts down on code duplication across the devices and allows a DOCSIS or GPON MAC application to access multiple devices using the same interface.
Use Cases
=========
The primary use cases for the AESNI-MB Multi-Function interface have already been mentioned. These are:
- DOCSIS MAC: Crypto-CRC
- Order:
- Downstream: CRC, Encrypt
- Upstream: Decrypt, CRC
- Specifications:
- Crypto: 128-bit AES-CFB encryption variant for DOCSIS as described in section 11.1 of DOCSIS 3.1 Security Specification
(https://apps.cablelabs.com/specification/CM-SP-SECv3.1)
- CRC: Ethernet 32-bit CRC as defined in Ethernet/[ISO/IEC 8802-3]
- GPON MAC: Crypto-CRC-BIP
- Order:
- Downstream: CRC, Encrypt, BIP
- Upstream: BIP, Decrypt, CRC
- Specifications:
- Crypto: AES-128 [NIST FIPS-197] cipher, used in counter mode (AES-CTR), as described in [NIST SP800-38A].
- CRC: Ethernet 32-bit CRC as defined in Ethernet/[ISO/IEC 8802-3]
- BIP: 4-byte bit-interleaved even parity (BIP) field computed over the entire FS frame, refer to ITU-T G.989.3, sections 8.1.1.5 and 8.1.2.3
(https://www.itu.int/rec/dologin_pub.asp?lang=e&id=
T-REC-G.989.3-201510-I!!PDF-E)
Note that support for both these chained operations is already available in the Intel IPSec Multi-Buffer library.
Architecture
============
The following diagram shows where the AESNI-MB Multi-Function rawdev PMD fits in an overall application architecture.
+------------------------------------------------+
| |
| Application |
| (e.g. vCMTS (DOCSIS), vOLT (GPON), etc.) |
| |
+------------------------------------------------+
|
+-----------------------|------------------------+
| | DPDK |
| | |
| +---------------------+ |
| | | |
| | rte_rawdev | |
| | | | NOTE:
| +---------------------+ ____|______ 'MULTI-FUNCTION
| / \ / | INTERFACE'
| / \ / | is opaque to
| / \ / | rte_rawdev
| +--------------------------------+ |
| | MULTI-FUNCTION INTERFACE | |
| +--------------------------------+ |
| +------------+ +------------+ |
| | AESNI-MB | | QAT | |
| | MULTI-FN | | MULTI-FN | |
| | RAWDEV | | RAWDEV | |
| | PMD | | PMD | |
| +------------+ +------------+ | NOTE:
| | | \________|______ 'QAT MULTI-FN
| | | | RAWDEV PMD'
+--------------|------------------|--------------+ will be added in
| | later release
+------------+ +------------+
| AESNI-MB | | QAT HW |
| SW LIB | | |
+------------+ +------------+v2:
* moved unit tests under from test app to under aesni_mb rawdev.
* Added support to crypto-perf tool for multi-function processing.
* fixed checkpatch errors.
* general tidy-up and improvements.
v3:
* removed support from crypto-perf tool for multi-function processing.
* renamed driver to rawdev_mfn_aesni_mb.
* renamed files/directories/functions/etc. of new driver to have aesni_mb_mfn_ prefix.
* resolved review comments.
* updated documentation.
David Coyle (4):
raw/common: add multi-function interface raw/aesni_mb_mfn: add aesni_mb_mfn raw device PMD test/rawdev: add aesni_mb_mfn raw device tests
doc: update docs for aesni_mb_mfn raw device PMD
MAINTAINERS | 7 + app/test/test_rawdev.c | 18 + config/common_base | 11 + doc/api/doxy-api-index.md | 3 +- doc/api/doxy-api.conf.in | 1 + doc/guides/rawdevs/aesni_mb_mfn.rst | 219 +++ doc/guides/rawdevs/index.rst | 1 + doc/guides/rel_notes/release_20_05.rst | 6 + drivers/meson.build | 5 + drivers/raw/Makefile | 3 + drivers/raw/aesni_mb_mfn/Makefile | 50 + .../raw/aesni_mb_mfn/aesni_mb_mfn_rawdev.c | 1508 +++++++++++++++++ .../raw/aesni_mb_mfn/aesni_mb_mfn_rawdev.h | 118 ++ .../aesni_mb_mfn/aesni_mb_mfn_rawdev_test.c | 1123 ++++++++++++ .../aesni_mb_mfn_rawdev_test_vectors.h | 1184 +++++++++++++ drivers/raw/aesni_mb_mfn/meson.build | 26 + .../rte_rawdev_aesni_mb_mfn_version.map | 3 + drivers/raw/common/Makefile | 8 + drivers/raw/common/meson.build | 7 + drivers/raw/common/multi_fn/Makefile | 27 + drivers/raw/common/multi_fn/meson.build | 9 + .../multi_fn/rte_common_multi_fn_version.map | 12 + drivers/raw/common/multi_fn/rte_multi_fn.c | 148 ++ drivers/raw/common/multi_fn/rte_multi_fn.h | 438 +++++ .../raw/common/multi_fn/rte_multi_fn_driver.h | 97 ++ drivers/raw/meson.build | 3 +- meson.build | 4 + mk/rte.app.mk | 3 + 28 files changed, 5040 insertions(+), 2 deletions(-) create mode 100644 doc/guides/rawdevs/aesni_mb_mfn.rst create mode 100644 drivers/raw/aesni_mb_mfn/Makefile create mode 100644 drivers/raw/aesni_mb_mfn/aesni_mb_mfn_rawdev.c create mode 100644 drivers/raw/aesni_mb_mfn/aesni_mb_mfn_rawdev.h create mode 100644 drivers/raw/aesni_mb_mfn/aesni_mb_mfn_rawdev_test.c create mode 100644 drivers/raw/aesni_mb_mfn/aesni_mb_mfn_rawdev_test_vectors.h create mode 100644 drivers/raw/aesni_mb_mfn/meson.build create mode 100644 drivers/raw/aesni_mb_mfn/rte_rawdev_aesni_mb_mfn_version.map create mode 100644 drivers/raw/common/Makefile create mode 100644 drivers/raw/common/meson.build create mode 100644 drivers/raw/common/multi_fn/Makefile create mode 100644 drivers/raw/common/multi_fn/meson.build create mode 100644 drivers/raw/common/multi_fn/rte_common_multi_fn_version.map create mode 100644 drivers/raw/common/multi_fn/rte_multi_fn.c create mode 100644 drivers/raw/common/multi_fn/rte_multi_fn.h create mode 100644 drivers/raw/common/multi_fn/rte_multi_fn_driver.h
Signature · 1 line
2.17.1
PATCH v3 1/4 raw/common: add multi-function interface
The multi-function interface provides a way of combining one or more different types of packet processing functions into a single operation. The interface can be used by applications to send the combined operations to a optimized software or hardware accelerator via a raw device.
--- config/common_base | 5 + drivers/meson.build | 5 + drivers/raw/Makefile | 1 + drivers/raw/common/Makefile | 8 + drivers/raw/common/meson.build | 7 + drivers/raw/common/multi_fn/Makefile | 27 ++ drivers/raw/common/multi_fn/meson.build | 9 + .../multi_fn/rte_common_multi_fn_version.map | 12 + drivers/raw/common/multi_fn/rte_multi_fn.c | 148 ++++++ drivers/raw/common/multi_fn/rte_multi_fn.h | 438 ++++++++++++++++++ .../raw/common/multi_fn/rte_multi_fn_driver.h | 97 ++++ meson.build | 4 + mk/rte.app.mk | 1 + 13 files changed, 762 insertions(+) create mode 100644 drivers/raw/common/Makefile create mode 100644 drivers/raw/common/meson.build create mode 100644 drivers/raw/common/multi_fn/Makefile create mode 100644 drivers/raw/common/multi_fn/meson.build create mode 100644 drivers/raw/common/multi_fn/rte_common_multi_fn_version.map create mode 100644 drivers/raw/common/multi_fn/rte_multi_fn.c create mode 100644 drivers/raw/common/multi_fn/rte_multi_fn.h create mode 100644 drivers/raw/common/multi_fn/rte_multi_fn_driver.h
config/common_base +5 -0
@@ -818,6 +818,11 @@ CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_EP_RAWDEV=y # CONFIG_RTE_LIBRTE_PMD_NTB_RAWDEV=y +# +# Compile multi-fn raw device interface +# +CONFIG_RTE_LIBRTE_MULTI_FN_COMMON=y + # # Compile librte_ring #
drivers/meson.build +5 -0
@@ -10,6 +10,7 @@ dpdk_driver_classes = ['common', 'bus', 'mempool', # depends on common and bus. 'net', # depends on common, bus, mempool + 'raw/common', 'raw', # depends on common, bus and net. 'crypto', # depends on common, bus and mempool (net in future). 'compress', # depends on common, bus, mempool.
@@ -212,5 +213,9 @@ foreach class:dpdk_driver_classes endif # build endforeach + if class.contains('/') + class_split = class.split('/') + class = '_'.join(class_split) + endif set_variable(class + '_drivers', class_drivers) endforeach
drivers/raw/Makefile +1 -0
@@ -14,5 +14,6 @@ DIRS-$(CONFIG_RTE_LIBRTE_PMD_IOAT_RAWDEV) += ioat DIRS-$(CONFIG_RTE_LIBRTE_PMD_NTB_RAWDEV) += ntb DIRS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_DMA_RAWDEV) += octeontx2_dma DIRS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_EP_RAWDEV) += octeontx2_ep +DIRS-y += common include $(RTE_SDK)/mk/rte.subdir.mk
drivers/raw/common/Makefile new file +8 -0
@@ -0,0 +1,8 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2020 Intel Corporation. + +include $(RTE_SDK)/mk/rte.vars.mk + +DIRS-$(CONFIG_RTE_LIBRTE_MULTI_FN_COMMON) += multi_fn + +include $(RTE_SDK)/mk/rte.subdir.mk
drivers/raw/common/meson.build new file +7 -0
@@ -0,0 +1,7 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2020 Intel Corporation. + +drivers = ['multi_fn'] +std_deps = ['rawdev'] +config_flag_fmt = 'RTE_LIBRTE_@0@_COMMON' +driver_name_fmt = 'rte_common_@0@'
drivers/raw/common/multi_fn/Makefile new file +27 -0
@@ -0,0 +1,27 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2020 Intel Corporation. + +include $(RTE_SDK)/mk/rte.vars.mk + +# library name +LIB = librte_multi_fn.a + +# build flags +CFLAGS += -O3 +CFLAGS += $(WERROR_FLAGS) +CFLAGS += -DALLOW_EXPERIMENTAL_API + +# versioning export map +EXPORT_MAP := rte_common_multi_fn_version.map + +# external library dependencies +LDLIBS += -lrte_eal +LDLIBS += -lrte_mempool +LDLIBS += -lrte_rawdev + +SRCS-y += rte_multi_fn.c + +SYMLINK-y-include += rte_multi_fn.h +SYMLINK-y-include += rte_multi_fn_driver.h + +include $(RTE_SDK)/mk/rte.lib.mk
drivers/raw/common/multi_fn/meson.build new file +9 -0
@@ -0,0 +1,9 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2020 Intel Corporation. + +sources = files('rte_multi_fn.c') + +deps = ['rawdev', 'cryptodev'] +allow_experimental_apis = true + +install_headers('rte_multi_fn.h')
drivers/raw/common/multi_fn/rte_common_multi_fn_version.map new file +12 -0
@@ -0,0 +1,12 @@ +EXPERIMENTAL { + global: + + rte_multi_fn_op_bulk_alloc; + rte_multi_fn_op_free; + rte_multi_fn_op_pool_create; + rte_multi_fn_session_create; + rte_multi_fn_session_destroy; + rte_multi_fn_xstat_names; + + local: *; +};
drivers/raw/common/multi_fn/rte_multi_fn.c new file +148 -0
148 lines not on this page · raw message
drivers/raw/common/multi_fn/rte_multi_fn.h new file +438 -0
438 lines not on this page · raw message
drivers/raw/common/multi_fn/rte_multi_fn_driver.h new file +97 -0
97 lines not on this page · raw message
meson.build +4 -0
@@ -102,6 +102,10 @@ message(output_message + '\n') output_message = '\n===============\nDrivers Enabled\n===============\n' foreach class:dpdk_driver_classes + if class.contains('/') + class_split = class.split('/') + class = '_'.join(class_split) + endif class_drivers = get_variable(class + '_drivers') output_message += '\n' + class + ':\n\t' output_count = 0
mk/rte.app.mk +1 -0
@@ -347,6 +347,7 @@ _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_IOAT_RAWDEV) += -lrte_rawdev_ioat _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_NTB_RAWDEV) += -lrte_rawdev_ntb _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_DMA_RAWDEV) += -lrte_rawdev_octeontx2_dma _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_EP_RAWDEV) += -lrte_rawdev_octeontx2_ep +_LDLIBS-$(CONFIG_RTE_LIBRTE_MULTI_FN_COMMON) += -lrte_multi_fn endif # CONFIG_RTE_LIBRTE_RAWDEV endif # !CONFIG_RTE_BUILD_SHARED_LIBS
Signature · 1 line
2.17.1
PATCH v3 2/4 raw/aesni_mb_mfn: add aesni_mb_mfn raw device PMD
In reply to David CoyleAdd an AESNI-MB Multi-Function raw device PMD, for utilizing multi-function capabilities of the Intel IPSec Multi Buffer library. This PMD uses the multi-function interface to allow combined operations be sent to the Intel IPSec Multi Buffer library.
--- MAINTAINERS | 7 + config/common_base | 6 + drivers/raw/Makefile | 2 + drivers/raw/aesni_mb_mfn/Makefile | 50 + .../raw/aesni_mb_mfn/aesni_mb_mfn_rawdev.c | 1508 +++++++++++++++++ .../raw/aesni_mb_mfn/aesni_mb_mfn_rawdev.h | 118 ++ .../aesni_mb_mfn/aesni_mb_mfn_rawdev_test.c | 1123 ++++++++++++ .../aesni_mb_mfn_rawdev_test_vectors.h | 1184 +++++++++++++ drivers/raw/aesni_mb_mfn/meson.build | 26 + .../rte_rawdev_aesni_mb_mfn_version.map | 3 + drivers/raw/meson.build | 3 +- mk/rte.app.mk | 2 + 12 files changed, 4031 insertions(+), 1 deletion(-) create mode 100644 drivers/raw/aesni_mb_mfn/Makefile create mode 100644 drivers/raw/aesni_mb_mfn/aesni_mb_mfn_rawdev.c create mode 100644 drivers/raw/aesni_mb_mfn/aesni_mb_mfn_rawdev.h create mode 100644 drivers/raw/aesni_mb_mfn/aesni_mb_mfn_rawdev_test.c create mode 100644 drivers/raw/aesni_mb_mfn/aesni_mb_mfn_rawdev_test_vectors.h create mode 100644 drivers/raw/aesni_mb_mfn/meson.build create mode 100644 drivers/raw/aesni_mb_mfn/rte_rawdev_aesni_mb_mfn_version.map
MAINTAINERS +7 -0
@@ -1213,6 +1213,13 @@ F: doc/guides/rawdevs/ntb.rst F: examples/ntb/ F: doc/guides/sample_app_ug/ntb.rst +Intel AES-NI MB Multi-Function - EXPERIMENTAL +M: David Coyle <[email protected]> +M: Mairtin o Loingsigh <[email protected]> +F: drivers/raw/common/multi_fn/ +F: drivers/raw/aesni_mb_mfn/ +F: doc/guides/rawdevs/aesni_mb_mfn.rst + Packet processing -----------------
config/common_base +6 -0
@@ -818,6 +818,12 @@ CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_EP_RAWDEV=y # CONFIG_RTE_LIBRTE_PMD_NTB_RAWDEV=y +# +# Compile PMD for AESNI-MB Multi-Function raw device +# +CONFIG_RTE_LIBRTE_PMD_AESNI_MB_MFN_RAWDEV=n +CONFIG_RTE_LIBRTE_PMD_AESNI_MB_MFN_RAWDEV_DEBUG=n + # # Compile multi-fn raw device interface #
drivers/raw/Makefile +2 -0
@@ -15,5 +15,7 @@ DIRS-$(CONFIG_RTE_LIBRTE_PMD_NTB_RAWDEV) += ntb DIRS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_DMA_RAWDEV) += octeontx2_dma DIRS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_EP_RAWDEV) += octeontx2_ep DIRS-y += common +DIRS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_MB_MFN_RAWDEV) += aesni_mb_mfn +DEPDIRS-aesni_mb_mfn := common include $(RTE_SDK)/mk/rte.subdir.mk
drivers/raw/aesni_mb_mfn/Makefile new file +50 -0
50 lines not on this page · raw message
drivers/raw/aesni_mb_mfn/aesni_mb_mfn_rawdev.c new file +1508 -0
1,508 lines not on this page · raw message
drivers/raw/aesni_mb_mfn/aesni_mb_mfn_rawdev.h new file +118 -0
118 lines not on this page · raw message
drivers/raw/aesni_mb_mfn/aesni_mb_mfn_rawdev_test.c new file +1123 -0
1,123 lines not on this page · raw message
drivers/raw/aesni_mb_mfn/aesni_mb_mfn_rawdev_test_vectors.h new file +1184 -0
169 lines not on this page · raw message
drivers/raw/aesni_mb_mfn/meson.build new file +26 -0
Lines of this file are not shown. View the raw message.
drivers/raw/aesni_mb_mfn/rte_rawdev_aesni_mb_mfn_version.map new file +3 -0
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.17.1
Part of the diff is not shown here. View the raw message.
PATCH v3 3/4 test/rawdev: add aesni_mb_mfn raw device tests
In reply to David CoyleAdd unit tests for the AESNI-MB Multi-Function raw device PMD.
--- app/test/test_rawdev.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
app/test/test_rawdev.c +18 -0
@@ -45,3 +45,21 @@ test_rawdev_selftest_ioat(void) }REGISTER_TEST_COMMAND (ioat_rawdev_autotest, test_rawdev_selftest_ioat); + +static int +test_rawdev_selftest_aesni_mb_mfn (void ) +{ +int ret; + + ret =rte_vdev_init ("rawdev_mfn_aesni_mb" ,NULL ); +if (ret) { +printf ("Failed to create AESNI-MB Multi-Function rawdev\n" ); +return ret; + } + +return rte_rawdev_selftest (rte_rawdev_get_dev_id ( +"rawdev_mfn_aesni_mb" )); +} + +REGISTER_TEST_COMMAND (rawdev_mfn_aesni_mb_autotest, + test_rawdev_selftest_aesni_mb_mfn);
Signature · 1 line
2.17.1
PATCH v3 4/4 doc: update docs for aesni_mb_mfn raw device PMD
In reply to David CoyleUpdate documentation for the AESNI-MB Multi-Function raw device PMD.
--- doc/api/doxy-api-index.md | 3 +- doc/api/doxy-api.conf.in | 1 + doc/guides/rawdevs/aesni_mb_mfn.rst | 219 +++++++++++++++++++++++++ doc/guides/rawdevs/index.rst | 1 + doc/guides/rel_notes/release_20_05.rst | 6 + 5 files changed, 229 insertions(+), 1 deletion(-) create mode 100644 doc/guides/rawdevs/aesni_mb_mfn.rst
doc/api/doxy-api-index.md +2 -1
@@ -49,7 +49,8 @@ The public API headers are grouped by topics: [dpaa2_mempool] (@ref rte_dpaa2_mempool.h), [dpaa2_cmdif] (@ref rte_pmd_dpaa2_cmdif.h), [dpaa2_qdma] (@ref rte_pmd_dpaa2_qdma.h), - [crypto_scheduler] (@ref rte_cryptodev_scheduler.h) + [crypto_scheduler] (@ref rte_cryptodev_scheduler.h), + [multi_fn] (@ref rte_multi_fn.h) - **memory**: [memseg] (@ref rte_memory.h),
doc/api/doxy-api.conf.in +1 -0
@@ -15,6 +15,7 @@ INPUT = @TOPDIR@/doc/api/doxy-api-index.md \ @TOPDIR@/drivers/net/ice \ @TOPDIR@/drivers/net/ixgbe \ @TOPDIR@/drivers/net/softnic \ + @TOPDIR@/drivers/raw/common/multi_fn \ @TOPDIR@/drivers/raw/dpaa2_cmdif \ @TOPDIR@/drivers/raw/dpaa2_qdma \ @TOPDIR@/lib/librte_eal/include \
doc/guides/rawdevs/aesni_mb_mfn.rst new file +219 -0
219 lines not on this page · raw message
doc/guides/rawdevs/index.rst +1 -0
@@ -18,3 +18,4 @@ application through rawdev API. ntb octeontx2_dma octeontx2_ep + aesni_mb_mfn
doc/guides/rel_notes/release_20_05.rst +6 -0
@@ -62,6 +62,12 @@ New Features * Added support for matching on IPv4 Time To Live and IPv6 Hop Limit. +* **Added AES-NI MB Multi-Function rawdev PMD.** + + Added a new AESNI-MB Multi-Function raw device PMD for utilizing + multi-function capabilities of the Intel IPSec Multi Buffer library. See + the :doc:`../rawdevs/aesni_mb_mfn` guide for more details on this new PMD. + Removed Items -------------
Signature · 1 line
2.17.1
Hi,
Adding more people (crypto PMD maintainers) as Cc.
10/04/2020 16:27, David Coyle:
Quoted 7 lines
Introduction
============This patchset adds a new AESNI-MB Multi-Function raw device PMD for utilizing multi-function capabilities of the Intel IPSec Multi Buffer library.
Quoted 7 lines
The aim of this rawdev PMD is to provide a way of combining one or more common packet-processing functions into a single operation, focused on DOCSIS and GPON MAC workloads. This allows these functions to be performed in parallel by the Intel IPSec Multi Buffer library. These functions include cryptography and CRC/BIP calculations. Performing these functions in parallel as a single operation can enable a significant performance improvement.
I don't know crypto but I don't think using rawdev for crypto operations is an API improvement.
Repeating the initial comments from v1 (because got no reply):
"
As a first impression, I feel it is not the right API. DPDK is based on classes: ethdev, crypto, compress, baseband, regex I want to understand why your features cannot fit in a class.
I feel we will need a lot of time to discuss the design. If you don't see any consensus on the design in the mailing list, you should request an opinion from the Technical Board.
This feature is not a priority for 20.05 release. By the way, it has not been announced in any roadmap. "
Quoted 12 lines
Background
==========There are a number of byte-wise operations which are used across many access network data-plane pipelines, such as Cipher, CRC and Bit-Interleaved-Parity (BIP). Some prototyping has been done at Intel as part of the 01.org access-network-dataplanes project to prove that a significant performance improvement is possible when such byte-wise operations are combined into a single pass of packet data processing. This performance boost has been prototyped for both DOCSIS MAC data-plane and GPON MAC data-plane pipelines based on DPDK.
Quoted 5 lines
The original prototypes on 01.org used some protocol-specific modifications to the DPDK cryptodev library. In order to make this performance optimization consumable for network access equipment vendors, a better solution was required as CRC and BIP cannot be regarded as cryptographic algorithms.
Why not part of crypto?
If not crypto, is it a new API class? Which one?
Please do not say rawdev.
Quoted 91 lines
Hence, the introduction of an AESNI-MB Multi-Function rawdev PMD. This PMD uses a new multi-function interface which allows different types of operations be combined together. Initially, only symmetric crypto and error detection (i.e. CRC and BIP) operations can be combined.
NOTE: In a future DPDK release, a QAT Multi-Function raw device will also be added. As multiple raw devices will share the same interface, the approach taken was to create a common interface (i.e. multi-function) which can be used by these devices. This both cuts down on code duplication across the devices and allows a DOCSIS or GPON MAC application to access multiple devices using the same interface.
Use Cases
=========The primary use cases for the AESNI-MB Multi-Function interface have already been mentioned. These are:
- DOCSIS MAC: Crypto-CRC
- Order:
- Downstream: CRC, Encrypt
- Upstream: Decrypt, CRC
- Specifications:
- Crypto: 128-bit AES-CFB encryption variant for DOCSIS as described in section 11.1 of DOCSIS 3.1 Security Specification
(https://apps.cablelabs.com/specification/CM-SP-SECv3.1)
- CRC: Ethernet 32-bit CRC as defined in Ethernet/[ISO/IEC 8802-3]- GPON MAC: Crypto-CRC-BIP
- Order:
- Downstream: CRC, Encrypt, BIP
- Upstream: BIP, Decrypt, CRC
- Specifications:
- Crypto: AES-128 [NIST FIPS-197] cipher, used in counter mode (AES-CTR), as described in [NIST SP800-38A].
- CRC: Ethernet 32-bit CRC as defined in Ethernet/[ISO/IEC 8802-3]
- BIP: 4-byte bit-interleaved even parity (BIP) field computed over the entire FS frame, refer to ITU-T G.989.3, sections 8.1.1.5 and 8.1.2.3
(https://www.itu.int/rec/dologin_pub.asp?lang=e&id=
T-REC-G.989.3-201510-I!!PDF-E)Note that support for both these chained operations is already available in the Intel IPSec Multi-Buffer library.
Architecture
============The following diagram shows where the AESNI-MB Multi-Function rawdev PMD fits in an overall application architecture.
+------------------------------------------------+ | | | Application | | (e.g. vCMTS (DOCSIS), vOLT (GPON), etc.) | | | +------------------------------------------------+ | +-----------------------|------------------------+ | | DPDK | | | | | +---------------------+ | | | | | | | rte_rawdev | | | | | | NOTE: | +---------------------+ ____|______ 'MULTI-FUNCTION | / \ / | INTERFACE' | / \ / | is opaque to | / \ / | rte_rawdev | +--------------------------------+ | | | MULTI-FUNCTION INTERFACE | | | +--------------------------------+ | | +------------+ +------------+ | | | AESNI-MB | | QAT | | | | MULTI-FN | | MULTI-FN | | | | RAWDEV | | RAWDEV | | | | PMD | | PMD | | | +------------+ +------------+ | NOTE: | | | \________|______ 'QAT MULTI-FN | | | | RAWDEV PMD' +--------------|------------------|--------------+ will be added in | | later release +------------+ +------------+ | AESNI-MB | | QAT HW | | SW LIB | | | +------------+ +------------+
[...]
Quoted 7 lines
drivers/raw/common/Makefile | 8 + drivers/raw/common/meson.build | 7 + drivers/raw/common/multi_fn/Makefile | 27 + drivers/raw/common/multi_fn/meson.build | 9 + .../multi_fn/rte_common_multi_fn_version.map | 12 + drivers/raw/common/multi_fn/rte_multi_fn.c | 148 ++ drivers/raw/common/multi_fn/rte_multi_fn.h | 438 +++++
From the explanations above, I don't understand what is the exact role of the multi_fn interface. The comments in the patch 1 don't help either. It just reminds me rte_security, which was, in my opinion, a bad design.
Quoted 20 lines · Thomas Monjalon
Hi,
Adding more people (crypto PMD maintainers) as Cc.
10/04/2020 16:27, David Coyle:
Quoted 7 lines
Introduction
============This patchset adds a new AESNI-MB Multi-Function raw device PMD for utilizing multi-function capabilities of the Intel IPSec Multi Buffer library.
Quoted 7 lines
The aim of this rawdev PMD is to provide a way of combining one or more common packet-processing functions into a single operation, focused on DOCSIS and GPON MAC workloads. This allows these functions to be performed in parallel by the Intel IPSec Multi Buffer library. These functions include cryptography and CRC/BIP calculations. Performing these functions in parallel as a single operation can enable a significant performance improvement.
Quoted 8 lines
I don't know crypto but I don't think using rawdev for crypto operations is an API improvement.
Repeating the initial comments from v1 (because got no reply):
"
As a first impression, I feel it is not the right API. DPDK is based on classes: ethdev, crypto, compress, baseband, regex I want to understand why your features cannot fit in a class.
Hi Thomas,
I asked similar question, and there is already a detailed answer with some background of the issue:
http://inbox.dpdk.org/dev/MN2PR11MB35507D4B96677A41E66440C5E3C30@MN2PR11MB3550.namprd11.prod.outlook.com/
Quoted 8 lines
I feel we will need a lot of time to discuss the design. If you don't see any consensus on the design in the mailing list, you should request an opinion from the Technical Board.
This feature is not a priority for 20.05 release. By the way, it has not been announced in any roadmap. "
Is it an issue to not have it in the roadmap?
Quoted 129 lines
Quoted 13 lines
Background
==========There are a number of byte-wise operations which are used across many access network data-plane pipelines, such as Cipher, CRC and Bit-Interleaved-Parity (BIP). Some prototyping has been done at Intel as part of the 01.org access-network-dataplanes project to prove that a significant performance improvement is possible when such byte-wise operations are combined into a single pass of packet data processing. This performance boost has been prototyped for both DOCSIS MAC data-plane and GPON MAC data-plane pipelines based on DPDK.
Quoted 5 lines
The original prototypes on 01.org used some protocol-specific modifications to the DPDK cryptodev library. In order to make this performance optimization consumable for network access equipment vendors, a better solution was required as CRC and BIP cannot be regarded as cryptographic algorithms.
Why not part of crypto?
If not crypto, is it a new API class? Which one?
Please do not say rawdev.Quoted 91 lines
Hence, the introduction of an AESNI-MB Multi-Function rawdev PMD. This PMD uses a new multi-function interface which allows different types of operations be combined together. Initially, only symmetric crypto and error detection (i.e. CRC and BIP) operations can be combined.
NOTE: In a future DPDK release, a QAT Multi-Function raw device will also be added. As multiple raw devices will share the same interface, the approach taken was to create a common interface (i.e. multi-function) which can be used by these devices. This both cuts down on code duplication across the devices and allows a DOCSIS or GPON MAC application to access multiple devices using the same interface.
Use Cases
=========The primary use cases for the AESNI-MB Multi-Function interface have already been mentioned. These are:
- DOCSIS MAC: Crypto-CRC
- Order:
- Downstream: CRC, Encrypt
- Upstream: Decrypt, CRC
- Specifications:
- Crypto: 128-bit AES-CFB encryption variant for DOCSIS as described in section 11.1 of DOCSIS 3.1 Security Specification
(https://apps.cablelabs.com/specification/CM-SP-SECv3.1)
- CRC: Ethernet 32-bit CRC as defined in Ethernet/[ISO/IEC 8802-3]- GPON MAC: Crypto-CRC-BIP
- Order:
- Downstream: CRC, Encrypt, BIP
- Upstream: BIP, Decrypt, CRC
- Specifications:
- Crypto: AES-128 [NIST FIPS-197] cipher, used in counter mode (AES-CTR), as described in [NIST SP800-38A].
- CRC: Ethernet 32-bit CRC as defined in Ethernet/[ISO/IEC 8802-3]
- BIP: 4-byte bit-interleaved even parity (BIP) field computed over the entire FS frame, refer to ITU-T G.989.3, sections 8.1.1.5 and 8.1.2.3
(https://www.itu.int/rec/dologin_pub.asp?lang=e&id=
T-REC-G.989.3-201510-I!!PDF-E)Note that support for both these chained operations is already available in the Intel IPSec Multi-Buffer library.
Architecture
============The following diagram shows where the AESNI-MB Multi-Function rawdev PMD fits in an overall application architecture.
+------------------------------------------------+ | | | Application | | (e.g. vCMTS (DOCSIS), vOLT (GPON), etc.) | | | +------------------------------------------------+ | +-----------------------|------------------------+ | | DPDK | | | | | +---------------------+ | | | | | | | rte_rawdev | | | | | | NOTE: | +---------------------+ ____|______ 'MULTI-FUNCTION | / \ / | INTERFACE' | / \ / | is opaque to | / \ / | rte_rawdev | +--------------------------------+ | | | MULTI-FUNCTION INTERFACE | | | +--------------------------------+ | | +------------+ +------------+ | | | AESNI-MB | | QAT | | | | MULTI-FN | | MULTI-FN | | | | RAWDEV | | RAWDEV | | | | PMD | | PMD | | | +------------+ +------------+ | NOTE: | | | \________|______ 'QAT MULTI-FN | | | | RAWDEV PMD' +--------------|------------------|--------------+ will be added in | | later release +------------+ +------------+ | AESNI-MB | | QAT HW | | SW LIB | | | +------------+ +------------+[...]
Quoted 7 lines
drivers/raw/common/Makefile | 8 + drivers/raw/common/meson.build | 7 + drivers/raw/common/multi_fn/Makefile | 27 + drivers/raw/common/multi_fn/meson.build | 9 + .../multi_fn/rte_common_multi_fn_version.map | 12 + drivers/raw/common/multi_fn/rte_multi_fn.c | 148 ++ drivers/raw/common/multi_fn/rte_multi_fn.h | 438 +++++From the explanations above, I don't understand what is the exact role of the
multi_fninterface. The comments in the patch 1 don't help either. It just reminds merte_security, which was, in my opinion, a bad design.
14/04/2020 12:21, Ferruh Yigit:
Quoted 30 lines · Thomas Monjalon
Quoted 20 lines
Hi,
Adding more people (crypto PMD maintainers) as Cc.
10/04/2020 16:27, David Coyle:
Quoted 7 lines
Introduction
============This patchset adds a new AESNI-MB Multi-Function raw device PMD for utilizing multi-function capabilities of the Intel IPSec Multi Buffer library.
Quoted 7 lines
The aim of this rawdev PMD is to provide a way of combining one or more common packet-processing functions into a single operation, focused on DOCSIS and GPON MAC workloads. This allows these functions to be performed in parallel by the Intel IPSec Multi Buffer library. These functions include cryptography and CRC/BIP calculations. Performing these functions in parallel as a single operation can enable a significant performance improvement.
Quoted 8 lines
I don't know crypto but I don't think using rawdev for crypto operations is an API improvement.
Repeating the initial comments from v1 (because got no reply):
"
As a first impression, I feel it is not the right API. DPDK is based on classes: ethdev, crypto, compress, baseband, regex I want to understand why your features cannot fit in a class.
Quoted 4 lines
Hi Thomas,
I asked similar question, and there is already a detailed answer with some background of the issue:
Good to see that you get some reply, Ferruh.
Quoted 1 line
I am not convinced.
I don't like rawdev in general.
Rawdev is good only for hardware support which cannot be generic like SoC, FPGA management or DMA engine.
Here the intent is to use rawdev because we don't find a good API. API defeat is a no-go.
Quoted 9 lines
Quoted 7 lines
I feel we will need a lot of time to discuss the design. If you don't see any consensus on the design in the mailing list, you should request an opinion from the Technical Board.
This feature is not a priority for 20.05 release. By the way, it has not been announced in any roadmap. "
Is it an issue to not have it in the roadmap?
No roadmap is not mandatory.
But having it in the roadmap helps to remind something new will require long review effort.
Hi Thomas, David, Ferruh,
Quoted 42 lines
-----Original Message-----
Subject: Re: [dpdk-dev] [PATCH v3 0/4] add AESNI-MB rawdev for multi-function processing14/04/2020 12:21, Ferruh Yigit:
Quoted 30 lines · Thomas Monjalon
Quoted 20 lines
Hi,
Adding more people (crypto PMD maintainers) as Cc.
10/04/2020 16:27, David Coyle:
Quoted 7 lines
Introduction
============This patchset adds a new AESNI-MB Multi-Function raw device PMD for utilizing multi-function capabilities of the Intel IPSec Multi Buffer library.
Quoted 7 lines
The aim of this rawdev PMD is to provide a way of combining one or more common packet-processing functions into a single operation, focused on DOCSIS and GPON MAC workloads. This allows these functions to be performed in parallel by the Intel IPSec Multi Buffer library. These functions include cryptography and CRC/BIP calculations. Performing these functions in parallel as a single operation can enable a significant performance improvement.
Quoted 8 lines
I don't know crypto but I don't think using rawdev for crypto operations is an API improvement.
Repeating the initial comments from v1 (because got no reply):
"
As a first impression, I feel it is not the right API. DPDK is based on classes: ethdev, crypto, compress, baseband, regex I want to understand why your features cannot fit in a class.Quoted 4 lines
Hi Thomas,
I asked similar question, and there is already a detailed answer with some background of the issue:
Good to see that you get some reply, Ferruh.
Quoted 1 line
Quoted 7 lines
http://inbox.dpdk.org/dev/[email protected]
mprd11.prod.outlook.com/I am not convinced.
I don't like rawdev in general.
Rawdev is good only for hardware support which cannot be generic like SoC, FPGA management or DMA engine.
[Fiona] CRC and BIP are not crypto algorithms, they are error detection processes. So there is no class in DPDK that these readily fit into.
There was resistance to adding another xxxddev, and even if one had been added for error_detection_dev, there would still have been another layer needed to couple this with cryptodev. Various proposals for this have been discussed on the ML in RFC and recent patches, there doesn't seem to be an appetite for this as a generic API. So it seems that only Intel has software and hardware engines that provide this specialised feature coupling. In that case rawdev seems like the most appropriate vehicle to expose this.
Quoted 2 lines
Here the intent is to use rawdev because we don't find a good API. API defeat is a no-go.
[Fiona] It's not that we haven't found a good API, but that there doesn't seem to be a general requirement for such a specialised API
14/04/2020 15:04, Trahe, Fiona:
Quoted 9 lines
Quoted 8 lines
14/04/2020 12:21, Ferruh Yigit:
http://inbox.dpdk.org/dev/[email protected]
mprd11.prod.outlook.com/I am not convinced.
I don't like rawdev in general.
Rawdev is good only for hardware support which cannot be generic like SoC, FPGA management or DMA engine.
Quoted 9 lines
[Fiona] CRC and BIP are not crypto algorithms, they are error detection processes. So there is no class in DPDK that these readily fit into.
There was resistance to adding another xxxddev, and even if one had been added forerror_detection_dev, there would still have been another layer needed to couple this with cryptodev. Various proposals for this have been discussed on the ML in RFC and recent patches, there doesn't seem to be an appetite for this as a generic API. So it seems that only Intel has software and hardware engines that provide this specialised feature coupling. In that case rawdev seems like the most appropriate vehicle to expose this.
Adding some vendor-specific API is not a good answer. It will work in some cases, but it won't make DPDK better. What's the purpose of DPDK if it's not solving a common problem for different hardware?
Quoted 5 lines
Quoted 2 lines
Here the intent is to use rawdev because we don't find a good API. API defeat is a no-go.
[Fiona] It's not that we haven't found a good API, but that there doesn't seem to be a general requirement for such a specialised API
There is a requirement to combine features of different classes. In the past, rte_security was an "answer" to this issue with crypto and ethdev. This is a real topic, please let's find a generic elegant solution.
Hi Thomas,
Quoted 35 lines
-----Original Message-----
From: Thomas Monjalon <[email protected]>
Sent: Tuesday, April 14, 2020 2:24 PM
To: Yigit, Ferruh <[email protected]>; Trahe, Fiona <[email protected]>
Cc: Coyle, David <[email protected]>; [email protected]; Doherty, Declan <[email protected]>; De Lara Guarch, Pablo <[email protected]>; Ryan, Brendan <[email protected]>; [email protected]; [email protected]; [email protected]; Anoob Joseph <[email protected]>; Ruifeng Wang <[email protected]>; Liron Himi <[email protected]>; Nagadheeraj Rottela <[email protected]>; Srikanth Jampala <[email protected]>; Gagandeep Singh <[email protected]>; Jay Zhou <[email protected]>; Ravi Kumar <[email protected]>; Richardson, Bruce <[email protected]>; Trahe, Fiona <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v3 0/4] add AESNI-MB rawdev for multi-function processing14/04/2020 15:04, Trahe, Fiona:
Quoted 2 lines
Quoted 2 lines
14/04/2020 12:21, Ferruh Yigit:
http://inbox.dpdk.org/dev/[email protected]
Quoted 7 lines
Quoted 6 lines
mprd11.prod.outlook.com/
I am not convinced.
I don't like rawdev in general.
Rawdev is good only for hardware support which cannot be generic like SoC, FPGA management or DMA engine.Quoted 9 lines
[Fiona] CRC and BIP are not crypto algorithms, they are error detection processes. So there is no class in DPDK that these readily fit into.
There was resistance to adding another xxxddev, and even if one had been added forerror_detection_dev, there would still have been another layer needed to couple this with cryptodev. Various proposals for this have been discussed on the ML in RFC and recent patches, there doesn't seem to be an appetite for this as a generic API. So it seems that only Intel has software and hardware engines that provide this specialised feature coupling. In that case rawdev seems like the most appropriate vehicle to expose this.
Quoted 4 lines
Adding some vendor-specific API is not a good answer. It will work in some cases, but it won't make DPDK better. What's the purpose of DPDK if it's not solving a common problem for different hardware?
[Fiona] Based on that logic rawdev should be deprecated. But the community has agreed that it has a place. And the common problem here is device exposure. With a specialised service on top.
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
Here the intent is to use rawdev because we don't find a good API. API defeat is a no-go.
[Fiona] It's not that we haven't found a good API, but that there doesn't seem to be a general requirement for such a specialised API
There is a requirement to combine features of different classes.
[Fiona] Can you point me to that requirement please?
We suggested it, but did not get community engagement and have dropped our generic API requirement, instead focussing on this specialised case.
Quoted 2 lines
In the past,
rte_securitywas an "answer" to this issue with crypto and ethdev. This is a real topic, please let's find a generic elegant solution.
14/04/2020 16:02, Trahe, Fiona:
Quoted 24 lines
Hi Thomas,
From: Thomas Monjalon <[email protected]>
Quoted 21 lines
14/04/2020 15:04, Trahe, Fiona:
Quoted 2 lines
Quoted 2 lines
14/04/2020 12:21, Ferruh Yigit:
http://inbox.dpdk.org/dev/[email protected]
Quoted 16 lines
Quoted 6 lines
mprd11.prod.outlook.com/
I am not convinced.
I don't like rawdev in general.
Rawdev is good only for hardware support which cannot be generic like SoC, FPGA management or DMA engine.[Fiona] CRC and BIP are not crypto algorithms, they are error detection processes. So there is no class in DPDK that these readily fit into.
There was resistance to adding another xxxddev, and even if one had been added forerror_detection_dev, there would still have been another layer needed to couple this with cryptodev. Various proposals for this have been discussed on the ML in RFC and recent patches, there doesn't seem to be an appetite for this as a generic API. So it seems that only Intel has software and hardware engines that provide this specialised feature coupling. In that case rawdev seems like the most appropriate vehicle to expose this.
Quoted 7 lines
Quoted 4 lines
Adding some vendor-specific API is not a good answer. It will work in some cases, but it won't make DPDK better. What's the purpose of DPDK if it's not solving a common problem for different hardware?
[Fiona] Based on that logic rawdev should be deprecated. But the community has agreed that it has a place.
No, as I said above, rawdev is good for SoC, FPGA management or DMA engine.
Quoted 7 lines
And the common problem here is device exposure.
With a specialised service on top.Quoted 3 lines
Quoted 3 lines
Quoted 2 lines
Here the intent is to use rawdev because we don't find a good API. API defeat is a no-go.
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
[Fiona] It's not that we haven't found a good API, but that there doesn't seem to be a general requirement for such a specialised API
There is a requirement to combine features of different classes.
[Fiona] Can you point me to that requirement please?
Yes, rte_security is trying to address this exact issue.
Quoted 2 lines
We suggested it, but did not get community engagement and have dropped our generic API requirement, instead focussing on this specialised case.
I did not see such generic proposal, sorry.
Quoted 2 lines
Quoted 2 lines
In the past,
rte_securitywas an "answer" to this issue with crypto and ethdev. This is a real topic, please let's find a generic elegant solution.
Quoted 30 lines · Thomas Monjalon
14/04/2020 16:02, Trahe, Fiona:
Quoted 29 lines
Hi Thomas,
From: Thomas Monjalon <[email protected]>
Quoted 25 lines
14/04/2020 15:04, Trahe, Fiona:
Quoted 2 lines
Quoted 2 lines
14/04/2020 12:21, Ferruh Yigit:
http://inbox.dpdk.org/dev/[email protected]
Quoted 7 lines
Quoted 6 lines
mprd11.prod.outlook.com/
I am not convinced.
I don't like rawdev in general.
Rawdev is good only for hardware support which cannot be generic like SoC, FPGA management or DMA engine.Quoted 9 lines
[Fiona] CRC and BIP are not crypto algorithms, they are error detection processes. So there is no class in DPDK that these readily fit into.
There was resistance to adding another xxxddev, and even if one had been added forerror_detection_dev, there would still have been another layer needed to couple this with cryptodev. Various proposals for this have been discussed on the ML in RFC and recent patches, there doesn't seem to be an appetite for this as a generic API. So it seems that only Intel has software and hardware engines that provide this specialised feature coupling. In that case rawdev seems like the most appropriate vehicle to expose this.Adding some vendor-specific API is not a good answer. It will work in some cases, but it won't make DPDK better. What's the purpose of DPDK if it's not solving a common problem for different hardware?
The current proposal in rawdev could easily be supported by any hardware which supports chaining multiple functions/services into a single operation, in this case symmetric crypto and error detection, but it could conceivably support chaining symmetric/asymmetric crypto operations or chaining symmetric crypto and compression operations.
Quoted 4 lines
Quoted 2 lines
[Fiona] Based on that logic rawdev should be deprecated. But the community has agreed that it has a place.
No, as I said above, rawdev is good for SoC, FPGA management or DMA engine.
I distinctly remember when rawdev was being proposed one of the uses cases proposed was that a new classes of APIs could be prototyped and developed under rawdev and when a solid consensus was reached then migrated to a mainstream DPDK library. I think every effort has been made here to engage the community to develop a generic approach. As Fiona notes there hasn't really been much of an appetite for this.
Therefore I think the option to use rawdev makes sense, it allows an initial proposal to be deployed, without a generic solution agreement, it will also give others in the community to see how this approach can work and hopefully lead to more engagement on a generic solution. Also as APIs in rawdev are essentially treated as private APIs the onus is on Intel to support this going forward.
Quoted 8 lines
Quoted 8 lines
And the common problem here is device exposure.
With a specialised service on top.Quoted 3 lines
Quoted 3 lines
Quoted 2 lines
Here the intent is to use rawdev because we don't find a good API. API defeat is a no-go.
Quoted 9 lines
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
[Fiona] It's not that we haven't found a good API, but that there doesn't seem to be a general requirement for such a specialised API
There is a requirement to combine features of different classes.
[Fiona] Can you point me to that requirement please?
Yes,
rte_securityis trying to address this exact issue.
I don't agree rte_security addresses the problem of different device types supporting the same services. The problem being addressed here is a single device which supports the chaining of multiple services (sym crypto & error detection)
Quoted 10 lines
Quoted 2 lines
We suggested it, but did not get community engagement and have dropped our generic API requirement, instead focussing on this specialised case.
I did not see such generic proposal, sorry.
Quoted 2 lines
Quoted 2 lines
In the past,
rte_securitywas an "answer" to this issue with crypto and ethdev. This is a real topic, please let's find a generic elegant solution.
16/04/2020 00:19, Doherty, Declan:
Quoted 47 lines · Thomas Monjalon
Quoted 28 lines
14/04/2020 16:02, Trahe, Fiona:
Quoted 27 lines
From: Thomas Monjalon <[email protected]>
Quoted 25 lines
14/04/2020 15:04, Trahe, Fiona:
Quoted 2 lines
Quoted 2 lines
14/04/2020 12:21, Ferruh Yigit:
http://inbox.dpdk.org/dev/[email protected]
Quoted 7 lines
Quoted 6 lines
mprd11.prod.outlook.com/
I am not convinced.
I don't like rawdev in general.
Rawdev is good only for hardware support which cannot be generic like SoC, FPGA management or DMA engine.Quoted 9 lines
[Fiona] CRC and BIP are not crypto algorithms, they are error detection processes. So there is no class in DPDK that these readily fit into.
There was resistance to adding another xxxddev, and even if one had been added forerror_detection_dev, there would still have been another layer needed to couple this with cryptodev. Various proposals for this have been discussed on the ML in RFC and recent patches, there doesn't seem to be an appetite for this as a generic API. So it seems that only Intel has software and hardware engines that provide this specialised feature coupling. In that case rawdev seems like the most appropriate vehicle to expose this.Adding some vendor-specific API is not a good answer. It will work in some cases, but it won't make DPDK better. What's the purpose of DPDK if it's not solving a common problem for different hardware?
The current proposal in rawdev could easily be supported by any hardware which supports chaining multiple functions/services into a single operation, in this case symmetric crypto and error detection, but it could conceivably support chaining symmetric/asymmetric crypto operations or chaining symmetric crypto and compression operations.
Quoted 4 lines
Quoted 2 lines
[Fiona] Based on that logic rawdev should be deprecated. But the community has agreed that it has a place.
No, as I said above, rawdev is good for SoC, FPGA management or DMA engine.
I distinctly remember when rawdev was being proposed one of the uses cases proposed was that a new classes of APIs could be prototyped and developed under rawdev and when a solid consensus was reached then migrated to a mainstream DPDK library. I think every effort has been made here to engage the community to develop a generic approach. As Fiona notes there hasn't really been much of an appetite for this.
Quoted 6 lines
Therefore I think the option to use rawdev makes sense, it allows an initial proposal to be deployed, without a generic solution agreement, it will also give others in the community to see how this approach can work and hopefully lead to more engagement on a generic solution. Also as APIs in rawdev are essentially treated as private APIs the onus is on Intel to support this going forward.
Because hardware support is pending,
we should accept an Intel-only "temporary" solution, opening the door to more vendor-specific APIs?
What is the benefit for the DPDK project?
Quoted 14 lines
Quoted 14 lines
Quoted 13 lines
And the common problem here is device exposure.
With a specialised service on top.Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
Here the intent is to use rawdev because we don't find a good API. API defeat is a no-go.
[Fiona] It's not that we haven't found a good API, but that there doesn't seem to be a general requirement for such a specialised API
There is a requirement to combine features of different classes.
[Fiona] Can you point me to that requirement please?
Quoted 7 lines
Quoted 2 lines
Yes,
rte_securityis trying to address this exact issue.I don't agree
rte_securityaddresses the problem of different device types supporting the same services. The problem being addressed here is a single device which supports the chaining of multiple services (sym crypto & error detection)
Doing IPsec processing in Rx or Tx of a NIC is not chaining?
Quoted 7 lines
Quoted 7 lines
Quoted 2 lines
We suggested it, but did not get community engagement and have dropped our generic API requirement, instead focussing on this specialised case.
I did not see such generic proposal, sorry.
Quoted 2 lines
Quoted 2 lines
In the past,
rte_securitywas an "answer" to this issue with crypto and ethdev. This is a real topic, please let's find a generic elegant solution.
Quoted 55 lines · Thomas Monjalon
16/04/2020 00:19, Doherty, Declan:
Quoted 47 lines · Thomas Monjalon
Quoted 28 lines
14/04/2020 16:02, Trahe, Fiona:
Quoted 27 lines
From: Thomas Monjalon <[email protected]>
Quoted 25 lines
14/04/2020 15:04, Trahe, Fiona:
Quoted 2 lines
Quoted 2 lines
14/04/2020 12:21, Ferruh Yigit:
http://inbox.dpdk.org/dev/[email protected]
Quoted 7 lines
Quoted 6 lines
mprd11.prod.outlook.com/
I am not convinced.
I don't like rawdev in general.
Rawdev is good only for hardware support which cannot be generic like SoC, FPGA management or DMA engine.Quoted 9 lines
[Fiona] CRC and BIP are not crypto algorithms, they are error detection processes. So there is no class in DPDK that these readily fit into.
There was resistance to adding another xxxddev, and even if one had been added forerror_detection_dev, there would still have been another layer needed to couple this with cryptodev. Various proposals for this have been discussed on the ML in RFC and recent patches, there doesn't seem to be an appetite for this as a generic API. So it seems that only Intel has software and hardware engines that provide this specialised feature coupling. In that case rawdev seems like the most appropriate vehicle to expose this.Adding some vendor-specific API is not a good answer. It will work in some cases, but it won't make DPDK better. What's the purpose of DPDK if it's not solving a common problem for different hardware?
The current proposal in rawdev could easily be supported by any hardware which supports chaining multiple functions/services into a single operation, in this case symmetric crypto and error detection, but it could conceivably support chaining symmetric/asymmetric crypto operations or chaining symmetric crypto and compression operations.
Quoted 4 lines
Quoted 2 lines
[Fiona] Based on that logic rawdev should be deprecated. But the community has agreed that it has a place.
No, as I said above, rawdev is good for SoC, FPGA management or DMA engine.
I distinctly remember when rawdev was being proposed one of the uses cases proposed was that a new classes of APIs could be prototyped and developed under rawdev and when a solid consensus was reached then migrated to a mainstream DPDK library. I think every effort has been made here to engage the community to develop a generic approach. As Fiona notes there hasn't really been much of an appetite for this.
Quoted 6 lines
Therefore I think the option to use rawdev makes sense, it allows an initial proposal to be deployed, without a generic solution agreement, it will also give others in the community to see how this approach can work and hopefully lead to more engagement on a generic solution. Also as APIs in rawdev are essentially treated as private APIs the onus is on Intel to support this going forward.
Quoted 7 lines
Because hardware support is pending,
we should accept an Intel-only "temporary" solution, opening the door to more vendor-specific APIs?What is the benefit for the DPDK project?
Sorry I don't agree with this sentiment, David has made every attempt to solicit feedback an to engage the community in this.
I also don't agree in classifying this as a "temporary solution" as this is a solid proposal for an approach to chaining multiple operations together, but I guess the fact remains that we only currently have a single use-case, but it is difficult to generate a generic solution in this case.
While there is only a single use case it is targeting two devices so that drove the need for a common interface withing rawdev.
The advantage of using rawdev is that it allows this to be consumed through DPDK, which enables DPDK project consumers, but also leaves the door open to other contributors to have their say on how this should evolve. For example this exact process seems to be occurring with DMA engines in rawdev today, with a critical mass of implementations which now is giving the impetus to create a generic solution, as we would hope can occur here too in the future.
Quoted 17 lines
Quoted 17 lines
Quoted 16 lines
Quoted 7 lines
And the common problem here is device exposure.
With a specialised service on top.Quoted 3 lines
Quoted 3 lines
Quoted 2 lines
Here the intent is to use rawdev because we don't find a good API. API defeat is a no-go.
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
[Fiona] It's not that we haven't found a good API, but that there doesn't seem to be a general requirement for such a specialised API
There is a requirement to combine features of different classes.
[Fiona] Can you point me to that requirement please?
Yes,
rte_securityis trying to address this exact issue.
Quoted 8 lines
Quoted 4 lines
I don't agree
rte_securityaddresses the problem of different device types supporting the same services. The problem being addressed here is a single device which supports the chaining of multiple services (sym crypto & error detection)Doing IPsec processing in Rx or Tx of a NIC is not chaining?
I wouldn't consider an inline crypto offload or full IPsec offload a chained operation in the vein being proposed here where completely independent services (in the view of DPDK which are currently on independent devices and APIs) are linked together.
We did look at using rte_security here but it wasn't considered suitable for a chaining of non-crypto operations such as CRC or possibly compression in the future, as it would still run into the issue of having to use the cryptodev enq/deq API in the lookaside offload case.
Quoted 10 lines
Quoted 7 lines
Quoted 7 lines
Quoted 2 lines
We suggested it, but did not get community engagement and have dropped our generic API requirement, instead focussing on this specialised case.
I did not see such generic proposal, sorry.
Quoted 2 lines
Quoted 2 lines
In the past,
rte_securitywas an "answer" to this issue with crypto and ethdev. This is a real topic, please let's find a generic elegant solution.
Thank you Thomas for your input.
We would like to request that the Tech-Board (CC'ed) also review the proposal to help us reach a consensus.
If the current proposal is not acceptable, we would welcome feedback from the board on how to rework our proposal to something that would be acceptable.
For the benefit of the Tech-Board here is the back-ground to our proposal for Rawdev-based multi-function processing:
- The primary objective is to support the AESNI MB combined Crypto-CRC processing capability in DPDK and in future to add support for combined Crypto-CRC support in QAT.
- The cryptodev API was considered unsuitable because CRC is not a cryptographic operation, and this would also preclude other non-crypto operations in the future such as compression.
- The rte_security API was also not considered suitable for chaining of non-crypto operations such as CRC, as Declan pointed out below.
- A new Accelerator API was proposed as an RFC but was not pursued due to community feedback that a new API would not be welcome for a single use-case.
- Using Rawdev for multi-function processing was then proposed and, initially, as there was no opposition we implemented a patch-set for this approach.
It was considered that a Rawdev-based multi-function approach would be suitable for the following reasons:
1) Multi-function processing for Crypto-CRC cases is not a good fit for any of the existing DPDK classes.
2) Rawdev was intended for such specialized acceleration processing that are not a good fit for existing DPDK classes.
3) Rawdev was also intended as somewhere that new use-cases like this could be prototyped and developed, such as Declan mentions below
4) The Rawdev-based multi-function proposal is extensible and we would hope that it can evolve to support new use-cases and target new devices in the future with the communities involvement.
Quoted 140 lines
-----Original Message-----
From: Doherty, Declan <[email protected]>
Sent: Tuesday, April 21, 2020 5:46 PMQuoted 8 lines · Thomas Monjalon
16/04/2020 00:19, Doherty, Declan:
Quoted 7 lines · Thomas Monjalon
Quoted 6 lines
14/04/2020 16:02, Trahe, Fiona:
Quoted 5 lines
From: Thomas Monjalon <[email protected]>
Quoted 4 lines
14/04/2020 15:04, Trahe, Fiona:
Quoted 2 lines
Quoted 2 lines
14/04/2020 12:21, Ferruh Yigit:
http://inbox.dpdk.org/dev/MN2PR11MB35507D4B96677A41E66440C5E3C30
@MQuoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
N2PR11MB3550.na
Quoted 8 lines
Quoted 6 lines
mprd11.prod.outlook.com/
I am not convinced.
I don't like rawdev in general.
Rawdev is good only for hardware support which cannot be generic like SoC, FPGA management or DMA engine.[Fiona] CRC and BIP are not crypto algorithms, they are error
detection processes.
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
So there is no class in DPDK that these readily fit into. There was resistance to adding another xxxddev, and even if one had been added for
error_detection_dev, there would still have been another layer needed to couple this with cryptodev. Various proposals for this have been discussed on the ML in RFC and recentpatches, there doesn't seem to be an appetite for this as a generic API.
Quoted 15 lines
Quoted 15 lines
Quoted 9 lines
Quoted 9 lines
Quoted 8 lines
Quoted 3 lines
So it seems that only Intel has software and hardware engines that provide this specialised feature coupling. In that case rawdev seems like the most appropriate vehicle to expose this.
Adding some vendor-specific API is not a good answer. It will work in some cases, but it won't make DPDK better. What's the purpose of DPDK if it's not solving a common problem for different hardware?
The current proposal in rawdev could easily be supported by any hardware which supports chaining multiple functions/services into a single operation, in this case symmetric crypto and error detection, but it could conceivably support chaining symmetric/asymmetric crypto operations or chaining symmetric crypto and compression operations.
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 2 lines
[Fiona] Based on that logic rawdev should be deprecated. But the community has agreed that it has a place.
No, as I said above, rawdev is good for SoC, FPGA management or DMA
engine.
Quoted 15 lines
Quoted 8 lines
I distinctly remember when rawdev was being proposed one of the uses cases proposed was that a new classes of APIs could be prototyped and developed under rawdev and when a solid consensus was reached then migrated to a mainstream DPDK library. I think every effort has been made here to engage the community to develop a generic approach. As Fiona notes there hasn't really been much of an appetite for this.
Quoted 6 lines
Therefore I think the option to use rawdev makes sense, it allows an initial proposal to be deployed, without a generic solution agreement, it will also give others in the community to see how this approach can work and hopefully lead to more engagement on a generic solution. Also as APIs in rawdev are essentially treated as private APIs the onus is on Intel to support this going forward.
Quoted 6 lines
Because hardware support is pending,
we should accept an Intel-only "temporary" solution, opening the door to more vendor-specific APIs?What is the benefit for the DPDK project?
Sorry I don't agree with this sentiment, David has made every attempt to solicit feedback and to engage the community in this.
I also don't agree in classifying this as a "temporary solution" as this is a solid proposal for an approach to chaining multiple operations together, but I guess the fact remains that we only currently have a single use-case, but it is difficult to generate a generic solution in this case.
While there is only a single use case it is targeting two devices so that drove the need for a common interface within rawdev.
The advantage of using rawdev is that it allows this to be consumed through DPDK, which enables DPDK project consumers, but also leaves the door open to other contributors to have their say on how this should evolve. For example this exact process seems to be occurring with DMA engines in rawdev today, with a critical mass of implementations which now is giving the impetus to create a generic solution, as we would hope can occur here too in the future.
Quoted 18 lines
Quoted 18 lines
Quoted 17 lines
Quoted 7 lines
And the common problem here is device exposure.
With a specialised service on top.Quoted 3 lines
Quoted 3 lines
Quoted 2 lines
Here the intent is to use rawdev because we don't find a good API. API defeat is a no-go.
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
[Fiona] It's not that we haven't found a good API, but that there doesn't seem to be a general requirement for such a specialised API
There is a requirement to combine features of different classes.
[Fiona] Can you point me to that requirement please?
Yes,
rte_securityis trying to address this exact issue.Quoted 7 lines
Quoted 4 lines
I don't agree
rte_securityaddresses the problem of different device types supporting the same services. The problem being addressed here is a single device which supports the chaining of multiple services (sym crypto & error detection)Doing IPsec processing in Rx or Tx of a NIC is not chaining?
I wouldn't consider an inline crypto offload or full IPsec offload a chained operation in the vein being proposed here where completely independent services (in the view of DPDK which are currently on independent devices and APIs) are linked together.
We did look at using
rte_securityhere but it wasn't considered suitable for a chaining of non-crypto operations such as CRC or possibly compression in the future, as it would still run into the issue of having to use the cryptodev enq/deq API in the lookaside offload case.Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
We suggested it, but did not get community engagement and have dropped our generic API requirement, instead focussing on this
specialised case.
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
I did not see such generic proposal, sorry.
Quoted 1 line
Quoted 1 line
In the past,
rte_securitywas an "answer" to this issue with crypto andethdev.
Quoted 4 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
This is a real topic, please let's find a generic elegant solution.
21/04/2020 18:46, Doherty, Declan:
Quoted 56 lines · Thomas Monjalon
Quoted 55 lines
16/04/2020 00:19, Doherty, Declan:
Quoted 53 lines · Thomas Monjalon
Quoted 28 lines
14/04/2020 16:02, Trahe, Fiona:
Quoted 27 lines
From: Thomas Monjalon <[email protected]>
Quoted 25 lines
14/04/2020 15:04, Trahe, Fiona:
Quoted 2 lines
Quoted 2 lines
14/04/2020 12:21, Ferruh Yigit:
http://inbox.dpdk.org/dev/[email protected]
Quoted 7 lines
Quoted 6 lines
mprd11.prod.outlook.com/
I am not convinced.
I don't like rawdev in general.
Rawdev is good only for hardware support which cannot be generic like SoC, FPGA management or DMA engine.Quoted 9 lines
[Fiona] CRC and BIP are not crypto algorithms, they are error detection processes. So there is no class in DPDK that these readily fit into.
There was resistance to adding another xxxddev, and even if one had been added forerror_detection_dev, there would still have been another layer needed to couple this with cryptodev. Various proposals for this have been discussed on the ML in RFC and recent patches, there doesn't seem to be an appetite for this as a generic API. So it seems that only Intel has software and hardware engines that provide this specialised feature coupling. In that case rawdev seems like the most appropriate vehicle to expose this.Adding some vendor-specific API is not a good answer. It will work in some cases, but it won't make DPDK better. What's the purpose of DPDK if it's not solving a common problem for different hardware?
The current proposal in rawdev could easily be supported by any hardware which supports chaining multiple functions/services into a single operation, in this case symmetric crypto and error detection, but it could conceivably support chaining symmetric/asymmetric crypto operations or chaining symmetric crypto and compression operations.
Quoted 4 lines
Quoted 2 lines
[Fiona] Based on that logic rawdev should be deprecated. But the community has agreed that it has a place.
No, as I said above, rawdev is good for SoC, FPGA management or DMA engine.
I distinctly remember when rawdev was being proposed one of the uses cases proposed was that a new classes of APIs could be prototyped and developed under rawdev and when a solid consensus was reached then migrated to a mainstream DPDK library. I think every effort has been made here to engage the community to develop a generic approach. As Fiona notes there hasn't really been much of an appetite for this.
Therefore I think the option to use rawdev makes sense, it allows an initial proposal to be deployed, without a generic solution agreement, it will also give others in the community to see how this approach can work and hopefully lead to more engagement on a generic solution. Also as APIs in rawdev are essentially treated as private APIs the onus is on Intel to support this going forward.
Quoted 8 lines
Quoted 5 lines
Because hardware support is pending,
we should accept an Intel-only "temporary" solution, opening the door to more vendor-specific APIs?What is the benefit for the DPDK project?
Sorry I don't agree with this sentiment, David has made every attempt to solicit feedback an to engage the community in this.
Really?
These are the recipients of the first patch:
[email protected], [email protected], [email protected]
In next patches, only Intel and NXP are Cc'ed.
Stephen and Jerin, who gave good comments on first patch, were not Cc'ed in next versions.
Was it presented in an event?
Was it brought to the techboard?
Please don't exagerate and admit you are trying to push something which is specific and convenient for Intel QuickAssist.
Quoted 47 lines
I also don't agree in classifying this as a "temporary solution" as this is a solid proposal for an approach to chaining multiple operations together, but I guess the fact remains that we only currently have a single use-case, but it is difficult to generate a generic solution in this case.
While there is only a single use case it is targeting two devices so that drove the need for a common interface withing rawdev.
The advantage of using rawdev is that it allows this to be consumed through DPDK, which enables DPDK project consumers, but also leaves the door open to other contributors to have their say on how this should evolve. For example this exact process seems to be occurring with DMA engines in rawdev today, with a critical mass of implementations which now is giving the impetus to create a generic solution, as we would hope can occur here too in the future.
Quoted 17 lines
Quoted 17 lines
Quoted 16 lines
Quoted 7 lines
And the common problem here is device exposure.
With a specialised service on top.Quoted 3 lines
Quoted 3 lines
Quoted 2 lines
Here the intent is to use rawdev because we don't find a good API. API defeat is a no-go.
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
[Fiona] It's not that we haven't found a good API, but that there doesn't seem to be a general requirement for such a specialised API
There is a requirement to combine features of different classes.
[Fiona] Can you point me to that requirement please?
Yes,
rte_securityis trying to address this exact issue.Quoted 6 lines
Quoted 4 lines
I don't agree
rte_securityaddresses the problem of different device types supporting the same services. The problem being addressed here is a single device which supports the chaining of multiple services (sym crypto & error detection)Doing IPsec processing in Rx or Tx of a NIC is not chaining?
I wouldn't consider an inline crypto offload or full IPsec offload a chained operation in the vein being proposed here where completely independent services (in the view of DPDK which are currently on independent devices and APIs) are linked together.
Quoted 4 lines
We did look at using
rte_securityhere but it wasn't considered suitable for a chaining of non-crypto operations such as CRC or possibly compression in the future, as it would still run into the issue of having to use the cryptodev enq/deq API in the lookaside offload case.
Because rte_security is not a generic solution (that's why I don't like it). I think a good approach would be to check how to offload in HW the chaining done in frameworks like rte_pipeline or rte_graph. Stephen and Jerin already talked about it, but it was rejected by David, because harder to implement I think.
Even worst, the team working on this patch did zero review of rte_graph.
I think the chaining requirement is a real problem to solve, and it deserves a good architecture and API.
Maybe this future API should be based on rte_graph.
Quoted 3 lines
-----Original Message-----
From: Thomas Monjalon <[email protected]>
Sent: Tuesday, April 21, 2020 6:25 PM
[PATCH v3 0/4] add AESNI-MB rawdev for multi-
Quoted 83 lines
function processing
21/04/2020 18:46, Doherty, Declan:
Quoted 9 lines · Thomas Monjalon
Quoted 8 lines
16/04/2020 00:19, Doherty, Declan:
Quoted 7 lines · Thomas Monjalon
Quoted 6 lines
14/04/2020 16:02, Trahe, Fiona:
Quoted 5 lines
From: Thomas Monjalon <[email protected]>
Quoted 4 lines
14/04/2020 15:04, Trahe, Fiona:
Quoted 2 lines
Quoted 2 lines
14/04/2020 12:21, Ferruh Yigit:
http://inbox.dpdk.org/dev/MN2PR11MB35507D4B96677A41E66440C5E3C30
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
@MN2PR11MB3550.na
Quoted 8 lines
Quoted 6 lines
mprd11.prod.outlook.com/
I am not convinced.
I don't like rawdev in general.
Rawdev is good only for hardware support which cannot be generic like SoC, FPGA management or DMA engine.[Fiona] CRC and BIP are not crypto algorithms, they are error
detection processes.
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
So there is no class in DPDK that these readily fit into. There was resistance to adding another xxxddev, and even if one had been added for
error_detection_dev, there would still have been another layer needed to couple this with cryptodev. Various proposals for this have been discussed on the ML in RFCand recent patches, there doesn't seem to be an appetite for this as a generic API.
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 8 lines
Quoted 3 lines
So it seems that only Intel has software and hardware engines that provide this specialised feature coupling. In that case rawdev seems like the most appropriate vehicle to expose this.
Adding some vendor-specific API is not a good answer. It will work in some cases, but it won't make DPDK better. What's the purpose of DPDK if it's not solving a common problem for different hardware?
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
The current proposal in rawdev could easily be supported by any hardware which supports chaining multiple functions/services into a single operation, in this case symmetric crypto and error detection, but it could conceivably support chaining symmetric/asymmetric crypto operations or chaining symmetric crypto
and compression operations.
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 3 lines
[Fiona] Based on that logic rawdev should be deprecated. But the community has agreed that it has a place.
No, as I said above, rawdev is good for SoC, FPGA management or
DMA engine.
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
I distinctly remember when rawdev was being proposed one of the uses cases proposed was that a new classes of APIs could be prototyped and developed under rawdev and when a solid consensus was reached then migrated to a mainstream DPDK library. I think every effort has been made here to engage the community to develop a generic approach. As Fiona notes there hasn't really been much of an
appetite for this.
Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
Therefore I think the option to use rawdev makes sense, it allows an initial proposal to be deployed, without a generic solution agreement, it will also give others in the community to see how this approach can work and hopefully lead to more engagement on a generic solution. Also as APIs in rawdev are essentially treated as private APIs the onus is on Intel to support this going forward.
Quoted 7 lines
Quoted 4 lines
Because hardware support is pending, we should accept an Intel-only "temporary" solution, opening the door to more vendor-specific APIs?
What is the benefit for the DPDK project?
Sorry I don't agree with this sentiment, David has made every attempt to solicit feedback an to engage the community in this.
Really?
These are the recipients of the first patch:
[email protected], [email protected], [email protected] In
next patches, only Intel and NXP are Cc'ed.
Stephen and Jerin, who gave good comments on first patch, were not Cc'ed in next versions.
Quoted 4 lines
Was it presented in an event?
Was it brought to the techboard?
Please don't exagerate and admit you are trying to push something which is specific and convenient for Intel QuickAssist.
[DC] This is being brought to the TechBoard tomorrow (22/04)
Quoted 55 lines
Quoted 11 lines
I also don't agree in classifying this as a "temporary solution" as this is a solid proposal for an approach to chaining multiple operations together, but I guess the fact remains that we only currently have a single use-case, but it is difficult to generate a generic solution in this case.
While there is only a single use case it is targeting two devices so that drove the need for a common interface withing rawdev.
Quoted 14 lines
The advantage of using rawdev is that it allows this to be consumed through DPDK, which enables DPDK project consumers, but also leaves the door open to other contributors to have their say on how this should evolve. For example this exact process seems to be occurring with DMA engines in rawdev today, with a critical mass of implementations which now is giving the impetus to create a generic solution, as we would hope can occur here too in the future.
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
And the common problem here is device exposure.
With a specialised service on top.Quoted 1 line
Quoted 1 line
Quoted 1 line
Here the intent is to use rawdev because we don't find a good
API.
Quoted 25 lines
Quoted 13 lines
Quoted 13 lines
Quoted 12 lines
Quoted 9 lines
Quoted 7 lines
Quoted 5 lines
Quoted 1 line
API defeat is a no-go.
[Fiona] It's not that we haven't found a good API, but that there doesn't seem to be a general requirement for such a specialised API
There is a requirement to combine features of different classes.
[Fiona] Can you point me to that requirement please?
Yes,
rte_securityis trying to address this exact issue.Quoted 6 lines
Quoted 4 lines
I don't agree
rte_securityaddresses the problem of different device types supporting the same services. The problem being addressed here is a single device which supports the chaining of multiple services (sym crypto & error detection)Doing IPsec processing in Rx or Tx of a NIC is not chaining?
I wouldn't consider an inline crypto offload or full IPsec offload a chained operation in the vein being proposed here where completely independent services (in the view of DPDK which are currently on independent devices and APIs) are linked together.
Quoted 4 lines
We did look at using
rte_securityhere but it wasn't considered suitable for a chaining of non-crypto operations such as CRC or possibly compression in the future, as it would still run into the issue of having to use the cryptodev enq/deq API in the lookaside offload
Quoted 8 lines
case.
Because
rte_securityis not a generic solution (that's why I don't like it). I think a good approach would be to check how to offload in HW the chaining done in frameworks likerte_pipelineorrte_graph.
Stephen and Jerin already talked about it, but it was rejected by David, because harder to implement I think.
Even worst, the team working on this patch did zero review ofrte_graph.
[DC] The team working on this patch did review rte_graph and explained our reasoning to Jerin as to why we felt it was not suitable.
While Jerin explained it would be possible to combine 2 nodes as a single optimized node at runtime, he also agreed that it did NOT make sense to abstract what we are trying to do as a graph.
Please see http://mails.dpdk.org/archives/dev/2020-March/159238.html
Quoted 5 lines
I think the chaining requirement is a real problem to solve, and it deserves a good architecture and API.
Maybe this future API should be based onrte_graph.
21/04/2020 20:37, Coyle, David:
Quoted 153 lines
From: Thomas Monjalon <[email protected]>
Quoted 81 lines
21/04/2020 18:46, Doherty, Declan:
Quoted 9 lines · Thomas Monjalon
Quoted 8 lines
16/04/2020 00:19, Doherty, Declan:
Quoted 7 lines · Thomas Monjalon
Quoted 6 lines
14/04/2020 16:02, Trahe, Fiona:
Quoted 5 lines
From: Thomas Monjalon <[email protected]>
Quoted 4 lines
14/04/2020 15:04, Trahe, Fiona:
Quoted 2 lines
Quoted 2 lines
14/04/2020 12:21, Ferruh Yigit:
http://inbox.dpdk.org/dev/MN2PR11MB35507D4B96677A41E66440C5E3C30
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
@MN2PR11MB3550.na
Quoted 8 lines
Quoted 6 lines
mprd11.prod.outlook.com/
I am not convinced.
I don't like rawdev in general.
Rawdev is good only for hardware support which cannot be generic like SoC, FPGA management or DMA engine.[Fiona] CRC and BIP are not crypto algorithms, they are error
detection processes.
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
So there is no class in DPDK that these readily fit into. There was resistance to adding another xxxddev, and even if one had been added for
error_detection_dev, there would still have been another layer needed to couple this with cryptodev. Various proposals for this have been discussed on the ML in RFCand recent patches, there doesn't seem to be an appetite for this as a generic API.
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 8 lines
Quoted 3 lines
So it seems that only Intel has software and hardware engines that provide this specialised feature coupling. In that case rawdev seems like the most appropriate vehicle to expose this.
Adding some vendor-specific API is not a good answer. It will work in some cases, but it won't make DPDK better. What's the purpose of DPDK if it's not solving a common problem for different hardware?
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
The current proposal in rawdev could easily be supported by any hardware which supports chaining multiple functions/services into a single operation, in this case symmetric crypto and error detection, but it could conceivably support chaining symmetric/asymmetric crypto operations or chaining symmetric crypto
and compression operations.
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 3 lines
[Fiona] Based on that logic rawdev should be deprecated. But the community has agreed that it has a place.
No, as I said above, rawdev is good for SoC, FPGA management or
DMA engine.
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
I distinctly remember when rawdev was being proposed one of the uses cases proposed was that a new classes of APIs could be prototyped and developed under rawdev and when a solid consensus was reached then migrated to a mainstream DPDK library. I think every effort has been made here to engage the community to develop a generic approach. As Fiona notes there hasn't really been much of an
appetite for this.
Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
Therefore I think the option to use rawdev makes sense, it allows an initial proposal to be deployed, without a generic solution agreement, it will also give others in the community to see how this approach can work and hopefully lead to more engagement on a generic solution. Also as APIs in rawdev are essentially treated as private APIs the onus is on Intel to support this going forward.
Quoted 7 lines
Quoted 4 lines
Because hardware support is pending, we should accept an Intel-only "temporary" solution, opening the door to more vendor-specific APIs?
What is the benefit for the DPDK project?
Sorry I don't agree with this sentiment, David has made every attempt to solicit feedback an to engage the community in this.
Really?
These are the recipients of the first patch:
[email protected], [email protected], [email protected] In
next patches, only Intel and NXP are Cc'ed.
Stephen and Jerin, who gave good comments on first patch, were not Cc'ed in next versions.Quoted 4 lines
Was it presented in an event?
Was it brought to the techboard?
Please don't exagerate and admit you are trying to push something which is specific and convenient for Intel QuickAssist.[DC] This is being brought to the TechBoard tomorrow (22/04)
Quoted 55 lines
Quoted 11 lines
I also don't agree in classifying this as a "temporary solution" as this is a solid proposal for an approach to chaining multiple operations together, but I guess the fact remains that we only currently have a single use-case, but it is difficult to generate a generic solution in this case.
While there is only a single use case it is targeting two devices so that drove the need for a common interface withing rawdev.
Quoted 14 lines
The advantage of using rawdev is that it allows this to be consumed through DPDK, which enables DPDK project consumers, but also leaves the door open to other contributors to have their say on how this should evolve. For example this exact process seems to be occurring with DMA engines in rawdev today, with a critical mass of implementations which now is giving the impetus to create a generic solution, as we would hope can occur here too in the future.
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
And the common problem here is device exposure.
With a specialised service on top.Quoted 1 line
Quoted 1 line
Quoted 1 line
Here the intent is to use rawdev because we don't find a good
API.
Quoted 25 lines
Quoted 13 lines
Quoted 13 lines
Quoted 12 lines
Quoted 9 lines
Quoted 7 lines
Quoted 5 lines
Quoted 1 line
API defeat is a no-go.
[Fiona] It's not that we haven't found a good API, but that there doesn't seem to be a general requirement for such a specialised API
There is a requirement to combine features of different classes.
[Fiona] Can you point me to that requirement please?
Yes,
rte_securityis trying to address this exact issue.Quoted 6 lines
Quoted 4 lines
I don't agree
rte_securityaddresses the problem of different device types supporting the same services. The problem being addressed here is a single device which supports the chaining of multiple services (sym crypto & error detection)Doing IPsec processing in Rx or Tx of a NIC is not chaining?
I wouldn't consider an inline crypto offload or full IPsec offload a chained operation in the vein being proposed here where completely independent services (in the view of DPDK which are currently on independent devices and APIs) are linked together.
Quoted 4 lines
We did look at using
rte_securityhere but it wasn't considered suitable for a chaining of non-crypto operations such as CRC or possibly compression in the future, as it would still run into the issue of having to use the cryptodev enq/deq API in the lookaside offloadQuoted 8 lines
case.
Because
rte_securityis not a generic solution (that's why I don't like it). I think a good approach would be to check how to offload in HW the chaining done in frameworks likerte_pipelineorrte_graph.
Stephen and Jerin already talked about it, but it was rejected by David, because harder to implement I think.
Even worst, the team working on this patch did zero review ofrte_graph.
Quoted 2 lines
[DC] The team working on this patch did review
rte_graphand explained our reasoning to Jerin as to why we felt it was not suitable.
No, by review, I mean doing some comments in the rte_graph series to help making the code, design or doc better.
You are complaining about the lack of attention to your patch, that's why I point out that you didn't help other patches to progress.
Quoted 2 lines
While Jerin explained it would be possible to combine 2 nodes as a single optimized node at runtime, he also agreed that it did NOT make sense to abstract what we are trying to do as a graph.
I think this exact point requires more discussion.
Quoted 1 line
Please see http://mails.dpdk.org/archives/dev/2020-March/159238.html
He did not say "it does not make sense" but
"In that way, it makes sense to not abstract as a graph." This is slightly different.
Anyway, we should re-consider using a graph abstraction for chaining.
Quoted 3 lines
Quoted 3 lines
I think the chaining requirement is a real problem to solve, and it deserves a good architecture and API.
Maybe this future API should be based onrte_graph.
Hi David,
Quoted 13 lines
Quoted 13 lines
Quoted 8 lines
Quoted 5 lines
I don't agree
rte_securityaddresses the problem of different device types supporting the same services. The problem being addressed here is a single device which supports the chaining of multiple services (sym crypto & error detection)Doing IPsec processing in Rx or Tx of a NIC is not chaining?
I wouldn't consider an inline crypto offload or full IPsec offload a chained operation in the vein being proposed here where completely independent services (in the view of DPDK which are currently on independent devices and APIs) are linked together.
Quoted 6 lines
Quoted 6 lines
We did look at using
rte_securityhere but it wasn't considered suitable for a chaining of non-crypto operations such as CRC or possibly compression in the future, as it would still run into the issue of having to use the cryptodev enq/deq API in the lookaside offload case.
I did not look at your patches completely, but looking at the ops that you have added For rawdev are pretty much same as that of a crypto device.
I see that there are 2 types of ops that you need
- session create/destroy
- enq/deq
On the first impression of your patchset, I see that you want to enq to driver only once for both The operations - CRC and crypto.
So what is the issue in using the cryptodev_enqueue for processing in the existing AESNI-MB driver. For session creation, the cryptodev layer will not give flexibility to add CRC+crypto kind of sessions. But in case of rte_security, you can define your new session xform based on your requirement.
And while doing the cryptodev enq/deq, based on the session type, you can process the packet Specific to your usecase in your aesni-mb PMD
Now if you want to add compression also along with crypto, then you can define another xform which Will be combination of crypto+compression and the aesni-mb PMD can have another mode which Can make sessions based on the new xform and the enq and deq can be done using the cryptodev enq/deq. For all your cases you will be having only one action type - lookaside protocol and can define different Protocols (that may not be standard).
So to conclude, your AESNI-MB will have 3 types of operations
- plain crypto
- crc+crypto
- compression+crypto
I believe this is doable or did I miss something very obvious?
Regards,
Akhil
Hi Akhil,
Quoted 52 lines
-----Original Message-----
From: Akhil Goyal <[email protected]>
Sent: Wednesday, April 22, 2020 11:51 AM
Hi David,Quoted 13 lines
Quoted 13 lines
Quoted 8 lines
Quoted 5 lines
I don't agree
rte_securityaddresses the problem of different device types supporting the same services. The problem being addressed here is a single device which supports the chaining of multiple services (sym crypto & error detection)Doing IPsec processing in Rx or Tx of a NIC is not chaining?
I wouldn't consider an inline crypto offload or full IPsec offload a chained operation in the vein being proposed here where completely independent services (in the view of DPDK which are currently on independent devices and APIs) are linked together.
Quoted 4 lines
Quoted 4 lines
We did look at using
rte_securityhere but it wasn't considered suitable for a chaining of non-crypto operations such as CRC or possibly compression in the future, as it would still run into the issue of having to use the cryptodev enq/deq API in the lookaside offloadcase.
Quoted 2 lines
Quoted 2 lines
I did not look at your patches completely, but looking at the ops that you have added For rawdev are pretty much same as that of a crypto device.
I see that there are 2 types of ops that you need
- session create/destroy
- enq/deqOn the first impression of your patchset, I see that you want to enq to driver only once for both The operations - CRC and crypto.
So what is the issue in using the
cryptodev_enqueuefor processing in the existing AESNI-MB driver.
For session creation, the cryptodev layer will not give flexibility to add CRC+crypto kind of sessions.
But in case ofrte_security, you can define your new session xform based on your requirement.And while doing the cryptodev enq/deq, based on the session type, you can process the packet Specific to your usecase in your aesni-mb PMD
Now if you want to add compression also along with crypto, then you can define another xform which Will be combination of crypto+compression and the aesni-mb PMD can have another mode which Can make sessions based on the new xform and the enq and deq can be done using the cryptodev enq/deq.
For all your cases you will be having only one action type - lookaside protocol and can define different Protocols (that may not be standard).
Quoted 6 lines
So to conclude, your AESNI-MB will have 3 types of operations
- plain crypto
- crc+crypto
- compression+cryptoI believe this is doable or did I miss something very obvious?
[DC] Thank you for this feedback
I have done this exact same analysis on rte_security and how we could use it.
The main issue of this approach (and it may be possible to easily overcome) is that ultimately crypto_op's need to be enqueued into cryptodev. This means we can't easily control the CRC (or compression in the future) at the operation level - application developers using this API would create a Crypto+CRC security xform session for a particular flow but may want to turn off the CRC part for some packets in that flow.
There are a number of ways this issue could possibly be overcome:
1) the auth offset/length fields in a rte_crypto_op could be overloaded to control the CRC part of the combined operation
- this is not the cleanest approach
2) we add a "security" op struct of some type to the union at end of the rte_crypto_op
- to avoid any circular dependencies, this would need to be opaque to rte_cryptodev
- rte_cryptodev should not be aware of rte_security
Number 2 above is probably the cleaner and more preferable approach.
The other approach is that CRC is either on/off at the session level. That limitation would then need to be adhered by application developers, which is something we would ideally like to avoid.
The rawdev multi-function approach did not have these issues which is one of the reasons we have pursued this approach to date.
However, we think the rte_security approach is workable.
It still requires some deeper analysis but with your support, we think we can overcome the challenges.
Quoted 3 lines
Regards,
Akhil
Hi David,
Quoted 84 lines
Hi Akhil,
Quoted 52 lines
-----Original Message-----
From: Akhil Goyal <[email protected]>
Sent: Wednesday, April 22, 2020 11:51 AM
Hi David,Quoted 13 lines
Quoted 13 lines
Quoted 8 lines
Quoted 5 lines
I don't agree
rte_securityaddresses the problem of different device types supporting the same services. The problem being addressed here is a single device which supports the chaining of multiple services (sym crypto & error detection)Doing IPsec processing in Rx or Tx of a NIC is not chaining?
I wouldn't consider an inline crypto offload or full IPsec offload a chained operation in the vein being proposed here where completely independent services (in the view of DPDK which are currently on independent devices and APIs) are linked together.
Quoted 4 lines
Quoted 4 lines
We did look at using
rte_securityhere but it wasn't considered suitable for a chaining of non-crypto operations such as CRC or possibly compression in the future, as it would still run into the issue of having to use the cryptodev enq/deq API in the lookaside offloadcase.
Quoted 2 lines
Quoted 2 lines
I did not look at your patches completely, but looking at the ops that you have added For rawdev are pretty much same as that of a crypto device.
I see that there are 2 types of ops that you need
- session create/destroy
- enq/deqOn the first impression of your patchset, I see that you want to enq to driver only once for both The operations - CRC and crypto.
So what is the issue in using the
cryptodev_enqueuefor processing in the existing AESNI-MB driver.
For session creation, the cryptodev layer will not give flexibility to add CRC+crypto kind of sessions.
But in case ofrte_security, you can define your new session xform based on your requirement.And while doing the cryptodev enq/deq, based on the session type, you can process the packet Specific to your usecase in your aesni-mb PMD
Now if you want to add compression also along with crypto, then you can define another xform which Will be combination of crypto+compression and the aesni-mb PMD can have another mode which Can make sessions based on the new xform and the enq and deq can be done using the cryptodev enq/deq.
For all your cases you will be having only one action type - lookaside protocol and can define different Protocols (that may not be standard).Quoted 6 lines
So to conclude, your AESNI-MB will have 3 types of operations
- plain crypto
- crc+crypto
- compression+cryptoI believe this is doable or did I miss something very obvious?
[DC] Thank you for this feedback
I have done this exact same analysis on
rte_securityand how we could use it.The main issue of this approach (and it may be possible to easily overcome) is that ultimately crypto_op's need
to be enqueued into cryptodev. This means we can't easily control the CRC (or compression in the future) at the
operation level - application developers using this API would create a Crypto+CRC security xform session for a
particular flow but may want to turn off the CRC part for some packets in that flow.There are a number of ways this issue could possibly be overcome:
1) the auth offset/length fields in arte_crypto_opcould be overloaded to control the CRC part of the combined operation
- this is not the cleanest approach
2) we add a "security" op struct of some type to the union at end of therte_crypto_op
- to avoid any circular dependencies, this would need to be opaque torte_cryptodev
-rte_cryptodevshould not be aware ofrte_security
Quoted 1 line
Number 2 above is probably the cleaner and more preferable approach.
Yes, it is preferred, but it should be a union to rte_crypto_sym_op/rte_crypto_asym_op. Crypto_op->type as RTE_CRYPTO_OP_TYPE_SECURITY and sess_type as RTE_CRYPTO_OP_SECURITY_SESSION
The size of rte_crypto_op will remain as is and there will be no ABI breakage I guess.
One more thing that can be looked into is the recently added CPU crypto process API If that could of any use, we may extend that if need be.
Quoted 4 lines
The other approach is that CRC is either on/off at the session level. That limitation would then need to be adhered
by application developers, which is something we would ideally like to avoid.
You mean that CRC can be on/off per session as well as per packet?
I think that can also be handled when you are defining your own security_op for per packet.
Quoted 9 lines
The rawdev multi-function approach did not have these issues which is one of the reasons we have pursued this
approach to date.However, we think the
rte_securityapproach is workable.
It still requires some deeper analysis but with your support, we think we can overcome the challenges.
Yes, please let me know where ever my help is required.
Hi David,
Quoted 4 lines · David
Thank you Thomas for your input.
We would like to request that the Tech-Board (CC'ed) also review the proposal to help us reach a consensus.
The discussion on the mailing list still looks active and I think that's where it should continue until there is no reasonable hope of consensus. I'm not sure discussing over irc at TB will find a better technical solution.
Quoted 16 lines
If the current proposal is not acceptable, we would welcome feedback from the board on how to rework our proposal to something that would be acceptable.
For the benefit of the Tech-Board here is the back-ground to our proposal for Rawdev-based multi-function processing:
- The primary objective is to support the AESNI MB combined Crypto-CRC processing capability in DPDK and in future to add support for combined Crypto-CRC support in QAT.
- The cryptodev API was considered unsuitable because CRC is not a cryptographic operation, and this would also preclude other non-crypto operations in the future such as compression.
- Therte_securityAPI was also not considered suitable for chaining of non-crypto operations such as CRC, as Declan pointed out below.
- A new Accelerator API was proposed as an RFC but was not pursued due to community feedback that a new API would not be welcome for a single use-case.
- Using Rawdev for multi-function processing was then proposed and, initially, as there was no opposition we implemented a patch-set for this approach.
Quoted 9 lines
It was considered that a Rawdev-based multi-function approach would be suitable for the following reasons:
1) Multi-function processing for Crypto-CRC cases is not a good fit for any of the existing DPDK classes.
2) Rawdev was intended for such specialized acceleration processing that are not a good fit for existing DPDK classes.
3) Rawdev was also intended as somewhere that new use-cases like this could be prototyped and developed, such as Declan mentions below
4) The Rawdev-based multi-function proposal is extensible and we would hope that it can evolve to support new use-cases and target new devices in the future with the communities involvement.
This is a useful summary and explaining your approach but it doesn't mention the counter arguments, so it doesn't seem balanced. Of course people can read that in the ML thread.
Kevin.
Quoted 141 lines
Quoted 141 lines
-----Original Message-----
From: Doherty, Declan <[email protected]>
Sent: Tuesday, April 21, 2020 5:46 PMQuoted 8 lines · Thomas Monjalon
16/04/2020 00:19, Doherty, Declan:
Quoted 7 lines · Thomas Monjalon
Quoted 6 lines
14/04/2020 16:02, Trahe, Fiona:
Quoted 5 lines
From: Thomas Monjalon <[email protected]>
Quoted 4 lines
14/04/2020 15:04, Trahe, Fiona:
Quoted 2 lines
Quoted 2 lines
14/04/2020 12:21, Ferruh Yigit:
http://inbox.dpdk.org/dev/MN2PR11MB35507D4B96677A41E66440C5E3C30
@MQuoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
N2PR11MB3550.na
Quoted 8 lines
Quoted 6 lines
mprd11.prod.outlook.com/
I am not convinced.
I don't like rawdev in general.
Rawdev is good only for hardware support which cannot be generic like SoC, FPGA management or DMA engine.[Fiona] CRC and BIP are not crypto algorithms, they are error
detection processes.
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
So there is no class in DPDK that these readily fit into. There was resistance to adding another xxxddev, and even if one had been added for
error_detection_dev, there would still have been another layer needed to couple this with cryptodev. Various proposals for this have been discussed on the ML in RFC and recentpatches, there doesn't seem to be an appetite for this as a generic API.
Quoted 15 lines
Quoted 15 lines
Quoted 9 lines
Quoted 9 lines
Quoted 8 lines
Quoted 3 lines
So it seems that only Intel has software and hardware engines that provide this specialised feature coupling. In that case rawdev seems like the most appropriate vehicle to expose this.
Adding some vendor-specific API is not a good answer. It will work in some cases, but it won't make DPDK better. What's the purpose of DPDK if it's not solving a common problem for different hardware?
The current proposal in rawdev could easily be supported by any hardware which supports chaining multiple functions/services into a single operation, in this case symmetric crypto and error detection, but it could conceivably support chaining symmetric/asymmetric crypto operations or chaining symmetric crypto and compression operations.
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 2 lines
[Fiona] Based on that logic rawdev should be deprecated. But the community has agreed that it has a place.
No, as I said above, rawdev is good for SoC, FPGA management or DMA
engine.
Quoted 15 lines
Quoted 8 lines
I distinctly remember when rawdev was being proposed one of the uses cases proposed was that a new classes of APIs could be prototyped and developed under rawdev and when a solid consensus was reached then migrated to a mainstream DPDK library. I think every effort has been made here to engage the community to develop a generic approach. As Fiona notes there hasn't really been much of an appetite for this.
Quoted 6 lines
Therefore I think the option to use rawdev makes sense, it allows an initial proposal to be deployed, without a generic solution agreement, it will also give others in the community to see how this approach can work and hopefully lead to more engagement on a generic solution. Also as APIs in rawdev are essentially treated as private APIs the onus is on Intel to support this going forward.
Quoted 6 lines
Because hardware support is pending,
we should accept an Intel-only "temporary" solution, opening the door to more vendor-specific APIs?What is the benefit for the DPDK project?
Sorry I don't agree with this sentiment, David has made every attempt to solicit feedback and to engage the community in this.
I also don't agree in classifying this as a "temporary solution" as this is a solid proposal for an approach to chaining multiple operations together, but I guess the fact remains that we only currently have a single use-case, but it is difficult to generate a generic solution in this case.
While there is only a single use case it is targeting two devices so that drove the need for a common interface within rawdev.
The advantage of using rawdev is that it allows this to be consumed through DPDK, which enables DPDK project consumers, but also leaves the door open to other contributors to have their say on how this should evolve. For example this exact process seems to be occurring with DMA engines in rawdev today, with a critical mass of implementations which now is giving the impetus to create a generic solution, as we would hope can occur here too in the future.
Quoted 18 lines
Quoted 18 lines
Quoted 17 lines
Quoted 7 lines
And the common problem here is device exposure.
With a specialised service on top.Quoted 3 lines
Quoted 3 lines
Quoted 2 lines
Here the intent is to use rawdev because we don't find a good API. API defeat is a no-go.
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
[Fiona] It's not that we haven't found a good API, but that there doesn't seem to be a general requirement for such a specialised API
There is a requirement to combine features of different classes.
[Fiona] Can you point me to that requirement please?
Yes,
rte_securityis trying to address this exact issue.Quoted 7 lines
Quoted 4 lines
I don't agree
rte_securityaddresses the problem of different device types supporting the same services. The problem being addressed here is a single device which supports the chaining of multiple services (sym crypto & error detection)Doing IPsec processing in Rx or Tx of a NIC is not chaining?
I wouldn't consider an inline crypto offload or full IPsec offload a chained operation in the vein being proposed here where completely independent services (in the view of DPDK which are currently on independent devices and APIs) are linked together.
We did look at using
rte_securityhere but it wasn't considered suitable for a chaining of non-crypto operations such as CRC or possibly compression in the future, as it would still run into the issue of having to use the cryptodev enq/deq API in the lookaside offload case.Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
We suggested it, but did not get community engagement and have dropped our generic API requirement, instead focussing on this
specialised case.
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
I did not see such generic proposal, sorry.
Quoted 1 line
Quoted 1 line
In the past,
rte_securitywas an "answer" to this issue with crypto andethdev.
Quoted 4 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
This is a real topic, please let's find a generic elegant solution.
Hi Akhil
Quoted 72 lines
-----Original Message-----
From: Akhil Goyal <[email protected]>
Sent: Wednesday, April 22, 2020 2:44 PMHi David,
Quoted 5 lines
Hi Akhil,
Quoted 3 lines
Quoted 1 line
Quoted 1 line
I did not look at your patches completely, but looking at the ops that you have added For rawdev are pretty much same as that of a crypto
device.
Quoted 16 lines
Quoted 16 lines
I see that there are 2 types of ops that you need
- session create/destroy
- enq/deqOn the first impression of your patchset, I see that you want to enq to driver only once for both The operations - CRC and crypto.
So what is the issue in using the
cryptodev_enqueuefor processing in the existing AESNI-MB driver.
For session creation, the cryptodev layer will not give flexibility to add
CRC+crypto kind of sessions.
But in case ofrte_security, you can define your new session xform based on your requirement.Quoted 7 lines
Quoted 7 lines
And while doing the cryptodev enq/deq, based on the session type, you can process the packet Specific to your usecase in your aesni-mb PMD
Now if you want to add compression also along with crypto, then you can define another xform which Will be combination of crypto+compression and the aesni-mb PMD can have another mode
which
Quoted 4 lines
Quoted 4 lines
Can make sessions based on the new xform and the enq and deq can be done using the cryptodev enq/deq.
For all your cases you will be having only one action type - lookaside protocol and can define different Protocols (that may not bestandard).
Quoted 11 lines
Quoted 7 lines
So to conclude, your AESNI-MB will have 3 types of operations
- plain crypto
- crc+crypto
- compression+cryptoI believe this is doable or did I miss something very obvious?
[DC] Thank you for this feedback
I have done this exact same analysis on
rte_securityand how we could useit.
Quoted 20 lines
The main issue of this approach (and it may be possible to easily overcome) is that ultimately crypto_op's need to be enqueued into cryptodev. This means we can't easily control the CRC (or compression in the future) at the operation level - application developers using this API would create a
Crypto+CRC security xform session for a
particular flow but may want to turn off the CRC part for some packets in that flow.There are a number of ways this issue could possibly be overcome:
1) the auth offset/length fields in arte_crypto_opcould be overloaded to control the CRC part of the combined operation
- this is not the cleanest approach
2) we add a "security" op struct of some type to the union at end of therte_crypto_op
- to avoid any circular dependencies, this would need to be opaque
torte_cryptodev
-rte_cryptodevshould not be aware ofrte_security
Quoted 7 lines
Quoted 1 line
Number 2 above is probably the cleaner and more preferable approach.
Yes, it is preferred, but it should be a union to rte_crypto_sym_op/rte_crypto_asym_op.
Crypto_op->typeasRTE_CRYPTO_OP_TYPE_SECURITYandsess_typeasRTE_CRYPTO_OP_SECURITY_SESSIONThe size ofrte_crypto_opwill remain as is and there will be no ABI breakage I guess.
[DC] Yes we would add to this union at the end of rte_crypto_op
__extension__
union {
struct rte_crypto_sym_op sym[0];
/**< Symmetric operation parameters */
struct rte_crypto_asym_op asym[0];
/**< Asymmetric operation parameters */
}; /**< operation specific parameters */I haven't figured out the finer details yet, but it should be straightforward to add some security element here. As these are zero length arrays, we won't be affecting the size of rte_crypto_op if we add another zero length array.
We should not include rte_security.h and add something like struct rte_security_op sec[0] here though, as that would cause a circular dependency between rte_cryptodev and rte_security.
This should be resolvable though
Quoted 3 lines
One more thing that can be looked into is the recently added CPU crypto process API If that could of any use, we may extend that if need be.
[DC] This is also being targeted at QAT and we would like to maintain the same Interface for these use-cases for both AESNI-MB and QAT.
So I think the traditional enqueue/dequeue API is what we would initially use as it means users of this API can easily switch between AESNI-MB and QAT. However, we may look at the CPU crypto API for AESNI-MB in the future.
Quoted 9 lines
Quoted 5 lines
The other approach is that CRC is either on/off at the session level. That limitation would then need to be adhered by application developers, which is something we would ideally like to avoid.
You mean that CRC can be on/off per session as well as per packet? I think that can also be handled when you are defining your own
security_opfor per packet.
[DC] I meant that if we didn't take the approach defining a security_op, then we would have turn on/off CRC at the session level and impose that limit on the app developers. But yes, by defining a security_op, we can probably turn it on/off at both session and op level.
Quoted 10 lines
Quoted 9 lines
The rawdev multi-function approach did not have these issues which is one of the reasons we have pursued this approach to date.
However, we think the
rte_securityapproach is workable.
It still requires some deeper analysis but with your support, we think we can overcome the challenges.Yes, please let me know where ever my help is required.
[DC] Thank you, appreciate that
Hi Kevin,
Quoted 9 lines
-----Original Message-----
From: Kevin Traynor <[email protected]>
Sent: Wednesday, April 22, 2020 3:02 PMHi David,
Quoted 2 lines · David
Thank you Thomas for your input.
Quoted 7 lines
Quoted 1 line
We would like to request that the Tech-Board (CC'ed) also review the
proposal to help us reach a consensus.
Quoted 1 line
The discussion on the mailing list still looks active and I think that's where it should continue until there is no reasonable hope of consensus.
I'm not sure discussing over irc at TB will find a better technical solution.
[DC] Yes, there has been some further proposals and discussions today, mainly around the use of rte_security. Although there are a few challenges to work around here, it is an approach we had already considered and it would seem like a good compromise to the rawdev approach.
With that in mind, we are happy to let this play out further on the mailing list for now.
If we can reach consensus on using rte_security, then we are happy to go with that and investigate and develop it further.
Quoted 36 lines
Quoted 3 lines
If the current proposal is not acceptable, we would welcome feedback from the board on how to rework our proposal to something that would be
acceptable.
Quoted 5 lines
For the benefit of the Tech-Board here is the back-ground to our proposal for Rawdev-based multi-function
processing:
- The primary objective is to support the AESNI MB combined Crypto-CRCprocessing capability in DPDK and
Quoted 2 lines
in future to add support for combined Crypto-CRC support in QAT.
- The cryptodev API was considered unsuitable because CRC is not acryptographic operation, and this would
Quoted 1 line
also preclude other non-crypto operations in the future such as
compression.
Quoted 1 line
- The
rte_securityAPI was also not considered suitable for chaining of non-crypto operations such as CRC,
Quoted 2 lines
as Declan pointed out below.
- A new Accelerator API was proposed as an RFC but was not pursued dueto community feedback that a
Quoted 2 lines
new API would not be welcome for a single use-case.
- Using Rawdev for multi-function processing was then proposed and,initially, as there was no opposition
Quoted 3 lines
we implemented a patch-set for this approach.
It was considered that a Rawdev-based multi-function approach would be
suitable for the following reasons:
Quoted 1 line
1) Multi-function processing for Crypto-CRC cases is not a good fit for any of
the existing DPDK classes.
Quoted 1 line
2) Rawdev was intended for such specialized acceleration processing that
are not a good fit for existing DPDK
Quoted 2 lines
classes.
3) Rawdev was also intended as somewhere that new use-cases like thiscould be prototyped and developed,
Quoted 2 lines
such as Declan mentions below
4) The Rawdev-based multi-function proposal is extensible and we would
Quoted 8 lines
hope that it can evolve to support
Quoted 1 line
new use-cases and target new devices in the future with the
communities involvement.
Quoted 1 line
This is a useful summary and explaining your approach but it doesn't mention the counter arguments, so it doesn't seem balanced. Of course people can read that in the ML thread.
[DC] That is a fair point, and something we will keep in mind for the future if we need to come back to the tech-board.
Quoted 3 lines
Kevin.
Hi Akhil,
Quoted 19 lines
-----Original Message-----
From: dev <[email protected]> On Behalf Of Akhil Goyal
Sent: Wednesday, April 22, 2020 2:44 PM
To: Coyle, David <[email protected]>; Doherty, Declan <[email protected]>; Thomas Monjalon <[email protected]>; Yigit, Ferruh <[email protected]>; Trahe, Fiona <[email protected]>
Cc: [email protected]; [email protected]; De Lara Guarch, Pablo <[email protected]>; Ryan, Brendan <[email protected]>; Hemant Agrawal <[email protected]>; Anoob Joseph <[email protected]>; Ruifeng Wang <[email protected]>; Liron Himi <[email protected]>; Nagadheeraj Rottela <[email protected]>; Srikanth Jampala <[email protected]>; Gagandeep Singh <[email protected]>; Jay Zhou <[email protected]>; Ravi Kumar <[email protected]>; Richardson, Bruce <[email protected]>; [email protected]; [email protected]; Stephen Hemminger <[email protected]>; [email protected]
Subject: Re: [dpdk-dev] [PATCH v3 0/4] add AESNI-MB rawdev for multi- function processing
...
Quoted 7 lines
Yes, it is preferred, but it should be a union to rte_crypto_sym_op/rte_crypto_asym_op.
Crypto_op->typeasRTE_CRYPTO_OP_TYPE_SECURITYandsess_typeasRTE_CRYPTO_OP_SECURITY_SESSION
The size ofrte_crypto_opwill remain as is and there will be no ABI breakage I guess.
[Fan: with this way the PMD will have to do rte_crypto_op.type check, and then look into rte_security_op field, only when it find the security_op type is crypto_crc, it will process the security_op data. Would that being too many reads and checking for a single op? Can we create a new API for rte_security to process rte_security_ops for Crypto_CRC or future needs?]
...
Regards,
Fan
Hi Fan & Akhil,
Quoted 36 lines
-----Original Message-----
From: Zhang, Roy Fan <[email protected]>
Sent: Friday, May 1, 2020 2:18 PMHi Akhil,
Quoted 5 lines
-----Original Message-----
From: dev <[email protected]> On Behalf Of Akhil Goyal
Sent: Wednesday, April 22, 2020 2:44 PM
To: Coyle, David <[email protected]>; Doherty, Declan <[email protected]>; Thomas MonjalonQuoted 5 lines
Yigit, Ferruh <[email protected]>; Trahe, Fiona <[email protected]>
Cc: [email protected]; [email protected]; De Lara Guarch, Pablo <[email protected]>; Ryan, Brendan <[email protected]>; Hemant AgrawalQuoted 4 lines
Anoob Joseph <[email protected]>; Ruifeng Wang <[email protected]>; Liron Himi <[email protected]>; Nagadheeraj Rottela <[email protected]>; Srikanth Jampala <[email protected]>; Gagandeep Singh <[email protected]>; Jay
Zhou
Quoted 6 lines
<[email protected]>; Ravi Kumar <[email protected]>; Richardson, Bruce <[email protected]>; [email protected]; [email protected]; Stephen Hemminger <[email protected]>; [email protected]
Subject: Re: [dpdk-dev] [PATCH v3 0/4] add AESNI-MB rawdev for multi- function processing...
Quoted 6 lines
Yes, it is preferred, but it should be a union to rte_crypto_sym_op/rte_crypto_asym_op.
Crypto_op->typeasRTE_CRYPTO_OP_TYPE_SECURITYandsess_typeasRTE_CRYPTO_OP_SECURITY_SESSIONThe size ofrte_crypto_opwill remain as is and there will be no ABI breakage I guess.
Quoted 5 lines
[Fan: with this way the PMD will have to do rte_crypto_op.type check, and then look into
rte_security_opfield, only when it find thesecurity_optype iscrypto_crc, it will process thesecurity_opdata. Would that being too many reads and checking for a single op? Can we create a new API forrte_securityto processrte_security_opsforCrypto_CRCor future needs?] ...
[DC] If we were to add new enqueue/dequeue APIs to rte_security, then this may cause extra churn and extra paths of code in a customer's application. For the DOCSIS Crypto-CRC use-case which is currently supported by IPSecMB, only the AES-DOCSISBPI cipher algorithm is supported. For these Crypto-CRC ops, they would create rte_security sessions, attach these to rte_security_ops and enqueue/dequeue using the new APIs in rte_security.
However, the customer may also be using the legacy DES-DOCSISBPI cipher algorithm for some subscribers, and this algorithm is not supported in the chained Crypto-CRC functionality in IPSecMB (and most likely never will be). So for these the customer would need to create cryptodev sessions, attach these to rte_crypto_ops and enqueue/ dequeue with the cryptodev enq/deq APIs. That is 2 different paths of code now in the application datapath, where some packets in a batch need to be enqueued through rte_security and some need to be enqueued through cryptodev.
If rte_crypto_ops are always used and enqueued/dequeued through cryptodev, then the only thing that changes is the type of session that is created and either the security session or the cryptodev session gets attached to the crypto_op.
Now, we could add support to rte_security for DES-DOCSISBPI too, but it would not be a combined operation with CRC - it would be a simple cipher operation going through rte_security. But that, to me, does not seem like a good use of rte_security.
For DOCSIS Crypto-CRC, we may also want to take advantage of the rte_cryptodev_sym_cpu_crypto_process() API which was added to cryptodev recently to avoid the enqueue/dequeue overhead. A similar API would also then need to be added to rte_security.
Taking all of the above into account, I feel keeping the normal cryptodev enqueue/dequeue would be best. Having said all that, we do need to consider performance in the PMD of the extra op type checks. Take aesni_mb PMD as an example. It would need to check rte_crypto_op->type and if it's not RTE_CRYPTO_OP_TYPE_SECURITY, then it can assume it's an RTE_CRYPTO_OP_TYPE_SYMMETRIC op and carry on as normal for existing symmetric operations. Security ops will need some extra parsing but this is new functionality. The impact on existing functionality of the extra checks would certainly need to be tested though, but as all the op data will be in the same cache line, I don't see any major impact.
Akhil & Fan (& others), I would be interested to hear your feedback on this.
Regards,
David
Quoted 3 lines
Regards,
Fan
cover add support for DOCSIS protocol to security library
In reply to David CoyleIntroduction
============
This patchset adds support for the DOCSIS protocol to the DPDK Security API (rte_security), to be used by the AESNI-MB and QAT crypto devices to combine and accelerate Crypto and CRC functions of the DOCSIS protocol into a single operation.
Performing these functions in parallel as a single operation can enable a significant performance improvement in a DPDK-based DOCSIS MAC pipeline.
PLEASE NOTE: this patchset only includes the proposed API changes. The implementation will follow in the next version.
Background
==========
A number of approaches to combine DOCSIS Crypto and CRC functions have been discussed in the DPDK community to date, namely:
1) adding a new rte_accelerator API, to provide a generic interface for combining operations of different types
2) using rawdev through a multi-function interface, again to provide a generic interface for combining operations of different types
3) adding support for DOCSIS Crypto-CRC to rte_security
The third option above is the preferred approach for the following reasons:
- it addresses the immediate use case to add DOCSIS Crypto-CRC support to DPDK so that it can be consumed easily by cable equipment vendors
- it uses an already existing framework in DPDK
- it will mean much less code churn in DOCSIS applications, which already use rte_cryptodev for encryption/decryption
Use Cases
=========
The primary use case for this proposal has already been mentioned, namely to add DOCSIS Crypto-CRC support to DPDK:
- DOCSIS MAC: Crypto-CRC
- Order:
- Downstream: CRC, Encrypt
- Upstream: Decrypt, CRC
- Specifications:
- Crypto: 128-bit AES-CFB encryption variant for DOCSIS as described in section 11.1 of DOCSIS 3.1 Security Specification
(https://apps.cablelabs.com/specification/CM-SP-SECv3.1)
- CRC: Ethernet 32-bit CRC as defined in Ethernet/[ISO/IEC 8802-3]
Note that support for this chained operations is already available in the Intel IPSec Multi-Buffer library.
However, other DOCSIS protocol functions could be optimized too in the future using the same rte_security API for DOCSIS (e.g. Header Checksum (HCS) calculation).
v1:
* added proposed API changes
* added security capabilities to aesni_mb crypto PMD
David Coyle (3):
security: add support for DOCSIS protocol
cryptodev: add security operation to crypto operation crypto/aesni_mb: add support for DOCSIS protocol
drivers/crypto/aesni_mb/meson.build | 2 +- .../crypto/aesni_mb/rte_aesni_mb_pmd_ops.c | 63 ++++++++++ lib/librte_cryptodev/rte_crypto.h | 11 +- lib/librte_security/rte_security.h | 114 ++++++++++++++++++ 4 files changed, 188 insertions(+), 2 deletions(-)
Signature · 1 line
2.17.1
PATCH 1/3 security: add support for DOCSIS protocol
Add support for DOCSIS protocol to rte_security library. This support currently comprises the combination of Crypto and CRC operations.
Please note this is API changes only. Implementation will follow in next version.
--- lib/librte_security/rte_security.h | 114 +++++++++++++++++++++++++++++ 1 file changed, 114 insertions(+)
lib/librte_security/rte_security.h +114 -0
@@ -293,6 +293,30 @@ struct rte_security_pdcp_xform {uint32_t hfn_ovrd; }; +/** DOCSIS direction */ +enum rte_security_docsis_direction { +RTE_SECURITY_DOCSIS_UPLINK , +/**< Uplink +* - Decryption, followed by CRC Verification +*/ +RTE_SECURITY_DOCSIS_DOWNLINK , +/**< Downlink +* - CRC Generation, followed by Encryption +*/ +}; + +/** +* DOCSIS security session configuration. +* +* This structure contains data required to create a DOCSIS security session. +*/ +struct rte_security_docsis_xform { +enum rte_security_docsis_direction direction; +/** DOCSIS direction */ +uint16_t crc_size; +/**< CRC size in bytes */ +}; +/** * Security session action type. */
@@ -325,6 +349,8 @@ enum rte_security_session_protocol {/**< MACSec Protocol */ RTE_SECURITY_PROTOCOL_PDCP ,/**< PDCP Protocol */ + RTE_SECURITY_PROTOCOL_DOCSIS, + /**< DOCSIS Protocol */ };/**
@@ -340,6 +366,7 @@ struct rte_security_session_conf {struct rte_security_ipsec_xform ipsec;struct rte_security_macsec_xform macsec;struct rte_security_pdcp_xform pdcp; +struct rte_security_docsis_xform docsis; };/**< Configuration parameters for security session */ struct rte_crypto_sym_xform *crypto_xform;
@@ -355,6 +382,77 @@ struct rte_security_session {/**< Opaque user defined data */ }; +/** +* DOCSIS operation parameters +*/ +struct rte_security_docsis_op { +struct rte_crypto_sym_op crypto_sym; +/**< Symmetric crypto operation parameters */ + +struct { +struct { +uint16_t offset; +/**< +* Starting point for CRC processing, specified +* as the number of bytes from start of the packet in +* the source mbuf in crypto_sym +*/ +uint16_t length; +/**< +* The length, in bytes, of the source mbuf on which the +* CRC will be computed +*/ + } data; +/**< Data offset and length for CRC */ + +struct { +uint8_t *data; +/**< +* This points to the location where the CRC should be +* written (in the case of generation) or where the +* purported result exists (in the case of +* verification). +* +* The caller must ensure the required length of +* physically contiguous memory is available at this +* address. +* +* This may point into the mbuf packet data. For +* generation, the result will overwrite any data at +* this location. +*/ +rte_iova_t phys_addr; +/**< Physical address of output data */ + } output; +/**< Output location */ + } crc; +/**< CRC operation parameters */ + +uint64_t reserved; +/**< Reserved for future use */ +}; + +/** +* Security operation types +*/ +enum rte_security_op_type { +RTE_SECURITY_OP_TYPE_DOCSIS =1 +/**< DOCSIS operation */ +}; + +/** +* Security operation parameters +*/ +struct rte_security_op { +enum rte_security_op_type type; +/**< Type of operation */ + RTE_STD_C11 + union { +struct rte_security_docsis_op docsis; + }; +/**< Parameters for security operation */ +}; +/** * Create security session as specified by the session configuration *
@@ -523,6 +621,10 @@ struct rte_security_pdcp_stats {uint64_t reserved; }; +struct rte_security_docsis_stats { +uint64_t reserved; +}; +struct rte_security_stats {enum rte_security_session_protocol protocol;/**< Security protocol to be configured */
@@ -532,6 +634,7 @@ struct rte_security_stats {struct rte_security_macsec_stats macsec;struct rte_security_ipsec_stats ipsec;struct rte_security_pdcp_stats pdcp; +struct rte_security_docsis_stats docsis; }; };
@@ -591,6 +694,13 @@ struct rte_security_capability {/**< Capability flags, see RTE_SECURITY_PDCP_* */ } pdcp;/**< PDCP capability */ +struct { +enum rte_security_docsis_direction direction; +/**< DOCSIS direction */ +uint16_t crc_size; +/**< CRC size in bytes */ + } docsis; +/**< DOCSIS capability */ };const struct rte_cryptodev_capabilities *crypto_capabilities;
@@ -649,6 +759,10 @@ struct rte_security_capability_idx {enum rte_security_pdcp_domain domain;uint32_t capa_flags; } pdcp; +struct { +enum rte_security_docsis_direction direction; +uint16_t crc_size; + } docsis; }; };
Signature · 1 line
2.17.1
PATCH 2/3 cryptodev: add security operation to crypto operation
In reply to David CoyleAdd a new security operation structure to the crypto operation to allow protocol specific parameters defined in rte_security be defined for a crypto operation.
Please note this is API changes only. Implementation will follow in next version.
--- lib/librte_cryptodev/rte_crypto.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
lib/librte_cryptodev/rte_crypto.h +10 -1
@@ -31,8 +31,10 @@ enum rte_crypto_op_type {/**< Undefined operation type */ RTE_CRYPTO_OP_TYPE_SYMMETRIC ,/**< Symmetric operation */ -RTE_CRYPTO_OP_TYPE_ASYMMETRIC +RTE_CRYPTO_OP_TYPE_ASYMMETRIC ,/**< Asymmetric operation */ +RTE_CRYPTO_OP_TYPE_SECURITY + /**< Security operation */ };/** Status of crypto operation */
@@ -121,6 +123,13 @@ struct rte_crypto_op {struct rte_crypto_asym_op asym[0 ];/**< Asymmetric operation parameters */ +#ifdef RTE_LIBRTE_SECURITY +uint8_t security[0 ]; +/**< Security operation parameters +* - Must be accessed through a rte_security_op pointer +*/ +#endif + };/**< operation specific parameters */ };
Signature · 1 line
2.17.1
PATCH 3/3 crypto/aesni_mb: add support for DOCSIS protocol
In reply to David CoyleAdd support to the AESNI-MB PMD for the DOCSIS protocol, through the rte_security API. This, therefore, includes adding support for the rte_security API to this PMD.
Please note this is only a partial implementation, with just capabilities structures populated. Full implementation will follow in next version.
--- drivers/crypto/aesni_mb/meson.build | 2 +- .../crypto/aesni_mb/rte_aesni_mb_pmd_ops.c | 63 +++++++++++++++++++ 2 files changed, 64 insertions(+), 1 deletion(-)
drivers/crypto/aesni_mb/meson.build +1 -1
@@ -22,4 +22,4 @@ else endif sources = files('rte_aesni_mb_pmd.c', 'rte_aesni_mb_pmd_ops.c') -deps += ['bus_vdev'] +deps += ['bus_vdev', 'security']
drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c +63 -0
81 lines not on this page · raw message
Signature · 1 line
2.17.1
Re: [dpdk-dev] [PATCH 2/3] cryptodev: add security operation to crypto operation
In reply to David CoyleQuoted 34 lines
Add a new security operation structure to the crypto operation to allow protocol specific parameters defined in
rte_securitybe defined for a crypto operation.Please note this is API changes only. Implementation will follow in next version.
Signed-off-by David Coyle <[email protected]>Signed-off-by Mairtin o Loingsigh <[email protected]>--- lib/librte_cryptodev/rte_crypto.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)lib/librte_cryptodev/rte_crypto.h +3
-1@@ -31,8 +31,10 @@ enum rte_crypto_op_type {/**< Undefined operation type */ RTE_CRYPTO_OP_TYPE_SYMMETRIC ,/**< Symmetric operation */ -RTE_CRYPTO_OP_TYPE_ASYMMETRIC +RTE_CRYPTO_OP_TYPE_ASYMMETRIC ,/**< Asymmetric operation */ +RTE_CRYPTO_OP_TYPE_SECURITY + /**< Security operation */ };/** Status of crypto operation */ @@ -121,6 +123,13 @@ struct rte_crypto_op {struct rte_crypto_asym_op asym[0 ];/**< Asymmetric operation parameters */
lib/librte_cryptodev/rte_crypto.h struct rte_crypto_op { · line 134
Quoted 10 lines
lib/librte_cryptodev/rte_crypto.h +7
-0+#ifdef RTE_LIBRTE_SECURITY +uint8_t security[0 ]; +/**< Security operation parameters +* - Must be accessed through a rte_security_op pointer +*/ +#endif + };/**< operation specific parameters */ };
Is there any point to have this extra level of indirection? Might be simply:
enum rte_crypto_op_type {
....
+ RTE_CRYPTO_OP_TYPE_SEC_DOCSIS,
};
...
struct rte_crypto_op {
....
__extension__
union {
struct rte_crypto_sym_op sym[0];
/**< Symmetric operation parameters */
struct rte_crypto_asym_op asym[0];
/**< Asymmetric operation parameters */+ struct rte_security_docsis_op docsis[0];
}; /**< operation specific parameters */
?
Re: [dpdk-dev] [PATCH 2/3] cryptodev: add security operation to crypto operation
Hi Konstantin, see below
Quoted 42 lines
-----Original Message-----
From: Ananyev, Konstantin <[email protected]>
Sent: Tuesday, June 9, 2020 2:23 PMQuoted 4 lines
/** Status of crypto operation */
lib/librte_cryptodev/rte_crypto.h +0
-0@@ -121,6 +123,13 @@ struct rte_crypto_op {struct rte_crypto_asym_op asym[0 ];lib/librte_cryptodev/rte_crypto.h struct rte_crypto_op { · line 133
Quoted 10 lines
lib/librte_cryptodev/rte_crypto.h +7
-0/**< Asymmetric operation parameters */ +#ifdef RTE_LIBRTE_SECURITY +uint8_t security[0 ]; +/**< Security operation parameters +* - Must be accessed through a rte_security_op pointer +*/ +#endif + };/**< operation specific parameters */ };Is there any point to have this extra level of indirection? Might be simply:
enum rte_crypto_op_type { ....(quoted diff) +1
-0+ RTE_CRYPTO_OP_TYPE_SEC_DOCSIS,};
...struct rte_crypto_op { .... __extension__ union { struct rte_crypto_sym_op sym[0]; /**< Symmetric operation parameters */ struct rte_crypto_asym_op asym[0]; /**< Asymmetric operation parameters */lib/librte_cryptodev/rte_crypto.h +1
-0+struct rte_security_docsis_op docsis[0 ]; };/**< operation specific parameters */
Quoted 1 line
?
[DC] This was to allow some form of extensibility and not to limit this to just DOCSIS. If it's felt that having the extra level of indirection is overkill, it can be easily changed.
However, we cannot include a struct of type 'struct rte_security_docsis_op' (or 'struct rte_security_op') directly here, without creating nasty circular dependency of includes between rte_cryptodev and rte_security.
I had tried defining an opaque version 'struct rte_security_op' (i.e. no fields within the struct) here in rte_crypto.h, but the compiler complained that it couldn't determine the size of the struct, even though it's a zero length array.
That is why I had to use the uint8_t in 'uint8_t security[0];' - I don't like this, but I couldn't find another way that kept the compiler happy and didn't create a circular dependency.
Re: [dpdk-dev] [PATCH 2/3] cryptodev: add security operation to crypto operation
Hi David,
Quoted 46 lines
Quoted 38 lines
Quoted 5 lines
/** Status of crypto operation */
lib/librte_cryptodev/rte_crypto.h +0
-0@@ -121,6 +123,13 @@ struct rte_crypto_op {struct rte_crypto_asym_op asym[0 ];lib/librte_cryptodev/rte_crypto.h struct rte_crypto_op { · line 133
Quoted 10 lines
lib/librte_cryptodev/rte_crypto.h +7
-0/**< Asymmetric operation parameters */ +#ifdef RTE_LIBRTE_SECURITY +uint8_t security[0 ]; +/**< Security operation parameters +* - Must be accessed through a rte_security_op pointer +*/ +#endif + };/**< operation specific parameters */ };Is there any point to have this extra level of indirection? Might be simply:
enum rte_crypto_op_type { ....(quoted diff) +1
-0+ RTE_CRYPTO_OP_TYPE_SEC_DOCSIS,};
...struct rte_crypto_op { .... __extension__ union { struct rte_crypto_sym_op sym[0]; /**< Symmetric operation parameters */ struct rte_crypto_asym_op asym[0]; /**< Asymmetric operation parameters */lib/librte_cryptodev/rte_crypto.h +1
-0+struct rte_security_docsis_op docsis[0 ]; };/**< operation specific parameters */ Quoted 1 line
?
[DC] This was to allow some form of extensibility and not to limit this to just DOCSIS. If it's felt that having the extra level of indirection is overkill, it can be easily changed.
However, we cannot include a struct of type 'struct
rte_security_docsis_op' (or 'structrte_security_op') directly here, without creating nasty circular dependency of includes betweenrte_cryptodevandrte_security.
Quoted 6 lines
I had tried defining an opaque version 'struct
rte_security_op' (i.e. no fields within the struct) here inrte_crypto.h, but the compiler complained that it couldn't determine the size of the struct, even though it's a zero length array.That is why I had to use the
uint8_tin 'uint8_tsecurity[0];' - I don't like this, but I couldn't find another way that kept the compiler happy and didn't create a circular dependency.
I see... would it be an option to name this struct 'struct rte_sym_docsis_op and and move actual definition inside lib/librte_cryptodev/rte_crypto_sym.h?
Re: [dpdk-dev] [PATCH 2/3] cryptodev: add security operation to crypto operation
Hi Konstantin,
Quoted 54 lines
Quoted 34 lines
Quoted 34 lines
Quoted 5 lines
/** Status of crypto operation */ @@ -121,6 +123,13 @@ struct
rte_crypto_op{lib/librte_cryptodev/rte_crypto.h +0
-0struct rte_crypto_asym_op asym[0 ];lib/librte_cryptodev/rte_crypto.h struct rte_crypto_op {
Quoted 10 lines
lib/librte_cryptodev/rte_crypto.h +7
-0/**< Asymmetric operation parameters */ +#ifdef RTE_LIBRTE_SECURITY +uint8_t security[0 ]; +/**< Security operation parameters +* - Must be accessed through a rte_security_op pointer +*/ +#endif + };/**< operation specific parameters */ };Is there any point to have this extra level of indirection? Might be simply:
enum rte_crypto_op_type { ....(quoted diff) +1
-0+ RTE_CRYPTO_OP_TYPE_SEC_DOCSIS,};
...struct rte_crypto_op { .... __extension__ union { struct rte_crypto_sym_op sym[0]; /**< Symmetric operation parameters */ struct rte_crypto_asym_op asym[0]; /**< Asymmetric operation parameters */Quoted 6 lines
Quoted 5 lines
lib/librte_cryptodev/rte_crypto.h +1
-0+struct rte_security_docsis_op docsis[0 ]; };/**< operation specific parameters */ ?
[DC] This was to allow some form of extensibility and not to limit this to just
DOCSIS.
Quoted 1 line
If it's felt that having the extra level of indirection is overkill, it can be easily
changed.
Quoted 4 lines
However, we cannot include a struct of type 'struct
rte_security_docsis_op' (or 'structrte_security_op') directly here, without creating nasty circular dependency of includes between
rte_cryptodevandrte_security.Quoted 4 lines
I had tried defining an opaque version 'struct
rte_security_op' (i.e. no fields within the struct) here inrte_crypto.h, but the compiler complained that it couldn't determine the size of the struct, even thoughit's a zero length array.
Quoted 1 line
Quoted 8 lines
Quoted 2 lines
That is why I had to use the
uint8_tin 'uint8_tsecurity[0];' - I don't like this, but I couldn't find another way that kept the compiler happyand didn't create a circular dependency.
I see... would it be an option to name this struct 'struct
rte_sym_docsis_opand and move actual definition insidelib/librte_cryptodev/rte_crypto_sym.h?
[DC] It's certainly an option and would work but I don't think it's a good idea to be putting protocol specific structs like this in rte_cryptodev - that's what rte_security is for. Do you think it would be ok to do this?
I'd be interested to hear what cryptodev/security maintainers and others think too. Akhil/Declan - any thoughts on best approach here?
Quoted 1 line
Re: [dpdk-dev] [PATCH 2/3] cryptodev: add security operation to crypto operation
Hi David,
Quoted 58 lines
Quoted 58 lines
Quoted 34 lines
Quoted 34 lines
Quoted 5 lines
/** Status of crypto operation */ @@ -121,6 +123,13 @@ struct
rte_crypto_op{lib/librte_cryptodev/rte_crypto.h +0
-0struct rte_crypto_asym_op asym[0 ];lib/librte_cryptodev/rte_crypto.h struct rte_crypto_op {
Quoted 10 lines
lib/librte_cryptodev/rte_crypto.h +7
-0/**< Asymmetric operation parameters */ +#ifdef RTE_LIBRTE_SECURITY +uint8_t security[0 ]; +/**< Security operation parameters +* - Must be accessed through a rte_security_op pointer +*/ +#endif + };/**< operation specific parameters */ };Is there any point to have this extra level of indirection? Might be simply:
enum rte_crypto_op_type { ....(quoted diff) +1
-0+ RTE_CRYPTO_OP_TYPE_SEC_DOCSIS,};
...struct rte_crypto_op { .... __extension__ union { struct rte_crypto_sym_op sym[0]; /**< Symmetric operation parameters */ struct rte_crypto_asym_op asym[0]; /**< Asymmetric operation parameters */Quoted 6 lines
Quoted 5 lines
lib/librte_cryptodev/rte_crypto.h +1
-0+struct rte_security_docsis_op docsis[0 ]; };/**< operation specific parameters */ ?
[DC] This was to allow some form of extensibility and not to limit this to just
DOCSIS.
Quoted 1 line
If it's felt that having the extra level of indirection is overkill, it can be easily
changed.
Quoted 4 lines
However, we cannot include a struct of type 'struct
rte_security_docsis_op' (or 'structrte_security_op') directly here, without creating nasty circular dependency of includes between
rte_cryptodevandrte_security.Quoted 4 lines
I had tried defining an opaque version 'struct
rte_security_op' (i.e. no fields within the struct) here inrte_crypto.h, but the compiler complained that it couldn't determine the size of the struct, even thoughit's a zero length array.
Quoted 3 lines
That is why I had to use the
uint8_tin 'uint8_tsecurity[0];' - I don't like this, but I couldn't find another way that kept the compiler happyand didn't create a circular dependency.
Quoted 7 lines
Quoted 4 lines
I see... would it be an option to name this struct 'struct
rte_sym_docsis_opand and move actual definition insidelib/librte_cryptodev/rte_crypto_sym.h?[DC] It's certainly an option and would work but I don't think it's a good idea to be putting protocol specific structs like this in
rte_cryptodev- that's whatrte_securityis for. Do you think it would be ok to do this?
I personally don't see a problem with this.
In fact, as an extra thought - why we can't have docsis xform defined in lib/librte_cryptodev/rte_crypto_sym.h too, and then just have it as a member inside struct rte_crypto_sym_xform union?
Then we can have rte_cryptodev_sym_session that supports docsis stuff.
Quoted 3 lines
I'd be interested to hear what cryptodev/security maintainers and others think too. Akhil/Declan - any thoughts on best approach here?
Re: [dpdk-dev] [PATCH 2/3] cryptodev: add security operation to crypto operation
Hi Konstantin,
Quoted 70 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
lib/librte_cryptodev/rte_crypto.h struct rte_crypto_op {
Quoted 11 lines
/** Status of crypto operation */ @@ -121,6 +123,13 @@ struct
rte_crypto_op{lib/librte_cryptodev/rte_crypto.h +4
-0struct rte_crypto_asym_op asym[0 ];/**< Asymmetric operation parameters */ +#ifdef RTE_LIBRTE_SECURITY +uint8_t security[0 ]; +/**< Security operation parameters +* - Must be accessed through a rte_security_op pointer
Quoted 50 lines
Quoted 50 lines
Quoted 23 lines
Quoted 23 lines
lib/librte_cryptodev/rte_crypto.h struct rte_crypto_op {
Quoted 4 lines
lib/librte_cryptodev/rte_crypto.h +3
-0+*/ +#endif + };/**< operation specific parameters */ };Is there any point to have this extra level of indirection? Might be simply:
enum rte_crypto_op_type { ....(quoted diff) +1
-0+ RTE_CRYPTO_OP_TYPE_SEC_DOCSIS,};
...struct rte_crypto_op { .... __extension__ union { struct rte_crypto_sym_op sym[0]; /**< Symmetric operation parameters */ struct rte_crypto_asym_op asym[0]; /**< Asymmetric operation parameters */Quoted 7 lines
Quoted 5 lines
lib/librte_cryptodev/rte_crypto.h +1
-0+struct rte_security_docsis_op docsis[0 ]; };/**< operation specific parameters */ ?
[DC] This was to allow some form of extensibility and not to limit this to just
DOCSIS.
Quoted 2 lines
If it's felt that having the extra level of indirection is overkill, it can be easily
changed.
Quoted 5 lines
However, we cannot include a struct of type 'struct
rte_security_docsis_op' (or 'structrte_security_op') directly here, without creating nasty circular dependency of includes between
rte_cryptodevandrte_security.Quoted 5 lines
I had tried defining an opaque version 'struct
rte_security_op' (i.e. no fields within the struct) here inrte_crypto.h, but the compiler complained that it couldn't determine the size of the struct, even thoughit's a zero length array.
Quoted 4 lines
That is why I had to use the
uint8_tin 'uint8_tsecurity[0];' - I don't like this, but I couldn't find another way that kept the compiler happyQuoted 8 lines
Quoted 6 lines
and didn't create a circular dependency.
I see... would it be an option to name this struct 'struct
rte_sym_docsis_opand and move actual definition insidelib/librte_cryptodev/rte_crypto_sym.h?[DC] It's certainly an option and would work but I don't think it's a good idea to be putting protocol specific structs like this in
rte_cryptodev-
Quoted 9 lines
that's what
rte_securityis for.Quoted 1 line
Do you think it would be ok to do this?
I personally don't see a problem with this.
In fact, as an extra thought - why we can't have docsis xform defined inlib/librte_cryptodev/rte_crypto_sym.htoo, and then just have it as a member inside structrte_crypto_sym_xformunion?
Then we can haverte_cryptodev_sym_sessionthat supports docsis stuff.
[DC] Because DOCSIS protocol and CRC are not specifically crypto related is why we initially went down the rawdev/multi-fn route and now the rte_security route. I think adding docsis xforms/ops and CRC related data to cryptodev would be adding too much non-crypto algorithm related stuff to this library. There would then be some protocols like IPSec and PDCP with their definitions in rte_security and others like DOCSIS in rte_cryptodev - that doesn't seem good to me.
Yes, from a DOCSIS equipment vendors point-of-view, who already use cryptodev for just encryption/decryption, adding DOCSIS to cryptodev would be best for them in order to get better DOCSIS support in DPDK as it would mean less churn for their applications. However, from a DPDK point-of-view, I don't think it would be correct to do this.
That's just my opinion, and again I'd be interested to hear other people's thoughts.
Quoted 4 lines
Quoted 2 lines
I'd be interested to hear what cryptodev/security maintainers and others
think too.
Quoted 1 line
Akhil/Declan - any thoughts on best approach here?
v2 cover add support for DOCSIS protocol
In reply to David CoyleIntroduction
============
This patchset adds support for the DOCSIS protocol to the DPDK Security API (rte_security), to be used by the AESNI-MB and QAT crypto devices to combine and accelerate Crypto and CRC functions of the DOCSIS protocol into a single operation.
Performing these functions in parallel as a single operation can enable a significant performance improvement in a DPDK-based DOCSIS MAC pipeline.
Background
==========
A number of approaches to combine DOCSIS Crypto and CRC functions have been discussed in the DPDK community to date, namely:
1) adding a new rte_accelerator API, to provide a generic interface for combining operations of different types
2) using rawdev through a multi-function interface, again to provide a generic interface for combining operations of different types
3) adding support for DOCSIS Crypto-CRC to rte_security
The third option above is the preferred approach for the following reasons:
- it addresses the immediate use case to add DOCSIS Crypto-CRC support to DPDK so that it can be consumed easily by cable equipment vendors
- it uses an already existing framework in DPDK
- it will mean much less code churn in DOCSIS applications, which already use rte_cryptodev for encryption/decryption
Use Cases
=========
The primary use case for this proposal has already been mentioned, namely to add DOCSIS Crypto-CRC support to DPDK:
- DOCSIS MAC: Crypto-CRC
- Order:
- Downstream: CRC, Encrypt
- Upstream: Decrypt, CRC
- Specifications:
- Crypto: 128-bit and 256-bit AES-CFB encryption variant for DOCSIS as described in section 11.1 of DOCSIS 3.1 Security Specification
(https://apps.cablelabs.com/specification/CM-SP-SECv3.1)
- CRC: Ethernet 32-bit CRC as defined in Ethernet/[ISO/IEC 8802-3]
Note that support for these chained operations is already available in the Intel IPSec Multi-Buffer library.
However, other DOCSIS protocol functions could be optimized too in the future using the same rte_security API for DOCSIS (e.g. Header Checksum (HCS) calculation).
v1:
* added proposed API changes
* added security capabilities to aesni_mb crypto PMD
v2:
* added rte_security and rte_cryptodev code changes
* added AESNI MB crypto PMD code changes
* added QAT SYM crypto PMD code changes
* added crypto unit tests
* added security unit tests
David Coyle (6):
cryptodev: add security operation to crypto operation
security: add support for DOCSIS protocol crypto/aesni_mb: add support for DOCSIS protocol crypto/qat: add support for DOCSIS protocol test/crypto: add DOCSIS security test cases test/security: add DOCSIS capability check tests
app/test/test_cryptodev.c | 552 ++++++ ...t_cryptodev_security_docsis_test_vectors.h | 1544 +++++++++++++++++ app/test/test_security.c | 139 ++ drivers/common/qat/Makefile | 3 + .../crypto/aesni_mb/aesni_mb_pmd_private.h | 19 +- drivers/crypto/aesni_mb/meson.build | 2 +- drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c | 316 +++- .../crypto/aesni_mb/rte_aesni_mb_pmd_ops.c | 127 ++ drivers/crypto/qat/meson.build | 2 + drivers/crypto/qat/qat_sym.c | 139 +- drivers/crypto/qat/qat_sym.h | 82 +- drivers/crypto/qat/qat_sym_capabilities.h | 44 + drivers/crypto/qat/qat_sym_pmd.c | 53 +- drivers/crypto/qat/qat_sym_pmd.h | 4 + drivers/crypto/qat/qat_sym_session.c | 148 ++ drivers/crypto/qat/qat_sym_session.h | 12 + lib/librte_cryptodev/rte_crypto.h | 19 +- lib/librte_cryptodev/rte_cryptodev.c | 5 +- lib/librte_security/rte_security.c | 7 + lib/librte_security/rte_security.h | 116 +- 20 files changed, 3271 insertions(+), 62 deletions(-) create mode 100644 app/test/test_cryptodev_security_docsis_test_vectors.h
Signature · 1 line
2.17.1
PATCH v2 1/6 cryptodev: add security operation to crypto operation
Add a new security operation field to the crypto operation to allow protocol specific parameters be defined for a crypto operation.
--- lib/librte_cryptodev/rte_crypto.h | 19 +++++++++++++++++-- lib/librte_cryptodev/rte_cryptodev.c | 5 ++++- 2 files changed, 21 insertions(+), 3 deletions(-)
lib/librte_cryptodev/rte_crypto.h +17 -2
@@ -31,8 +31,10 @@ enum rte_crypto_op_type {/**< Undefined operation type */ RTE_CRYPTO_OP_TYPE_SYMMETRIC ,/**< Symmetric operation */ -RTE_CRYPTO_OP_TYPE_ASYMMETRIC +RTE_CRYPTO_OP_TYPE_ASYMMETRIC ,/**< Asymmetric operation */ +RTE_CRYPTO_OP_TYPE_SECURITY + /**< Security operation */ };/** Status of crypto operation */
@@ -121,9 +123,16 @@ struct rte_crypto_op {struct rte_crypto_asym_op asym[0 ];/**< Asymmetric operation parameters */ +uint8_t security[0 ]; +/**< Security operation parameters +* - Must be accessed through a rte_security_op pointer +*/ };/**< operation specific parameters */ }; +/** Maximum size of security crypto op */ +#define RTE_CRYPTO_OP_SECURITY_MAX_SZ (88U) +/** * Reset the fields of a crypto operation to their default values. *
@@ -143,7 +152,10 @@ __rte_crypto_op_reset(struct rte_crypto_op *op, enum rte_crypto_op_type type)break ;case RTE_CRYPTO_OP_TYPE_ASYMMETRIC :memset (op->asym,0 ,sizeof (struct rte_crypto_asym_op )); -break ; +break ; +case RTE_CRYPTO_OP_TYPE_SECURITY : +memset (op->security,0 ,RTE_CRYPTO_OP_SECURITY_MAX_SZ ); +break ;case RTE_CRYPTO_OP_TYPE_UNDEFINED :default :break ;
@@ -317,6 +329,9 @@ __rte_crypto_op_get_priv_data(struct rte_crypto_op *op, uint32_t size)if (op->type ==RTE_CRYPTO_OP_TYPE_ASYMMETRIC )return (void *)((uint8_t *)(op +1 ) +sizeof (struct rte_crypto_asym_op )); +if (op->type ==RTE_CRYPTO_OP_TYPE_SECURITY ) +return (void *)((uint8_t *)(op +1 ) + +RTE_CRYPTO_OP_SECURITY_MAX_SZ ); } }
lib/librte_cryptodev/rte_cryptodev.c +4 -1
@@ -1871,9 +1871,12 @@ rte_crypto_op_pool_create(const char *name, enum rte_crypto_op_type type, elt_size +=sizeof (struct rte_crypto_sym_op ); }else if (type ==RTE_CRYPTO_OP_TYPE_ASYMMETRIC ) { elt_size +=sizeof (struct rte_crypto_asym_op ); + }else if (type ==RTE_CRYPTO_OP_TYPE_SECURITY ) { + elt_size +=RTE_CRYPTO_OP_SECURITY_MAX_SZ ; }else if (type ==RTE_CRYPTO_OP_TYPE_UNDEFINED ) { elt_size +=RTE_MAX (sizeof (struct rte_crypto_sym_op ), -sizeof (struct rte_crypto_asym_op )); +RTE_MAX (sizeof (struct rte_crypto_asym_op ), +RTE_CRYPTO_OP_SECURITY_MAX_SZ )); }else {CDEV_LOG_ERR ("Invalid op_type\n" );return NULL ;
Signature · 1 line
2.17.1
PATCH v2 2/6 security: add support for DOCSIS protocol
In reply to David CoyleAdd support for DOCSIS protocol to rte_security library. This support currently comprises the combination of Crypto and CRC operations.
A security operation definition is also added. This allow security protocol related parameters be specified at the operation level. For DOCSIS, these parameters include CRC length and offset. The security operation is accessed via a crypto operation.
--- lib/librte_security/rte_security.c | 7 ++ lib/librte_security/rte_security.h | 116 ++++++++++++++++++++++++++++- 2 files changed, 120 insertions(+), 3 deletions(-)
lib/librte_security/rte_security.c +7 -0
@@ -173,6 +173,13 @@ rte_security_capability_get(struct rte_security_ctx *instance,if (capability->pdcp.domain == idx->pdcp.domain)return capability; + }else if (idx->protocol == +RTE_SECURITY_PROTOCOL_DOCSIS ) { +if (capability->docsis.direction == + idx->docsis.direction && + capability->docsis.crc_size == + idx->docsis.crc_size) +return capability; } } }
lib/librte_security/rte_security.h +113 -3
173 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH v2 3/6 crypto/aesni_mb: add support for DOCSIS protocol
In reply to David CoyleAdd support to the AESNI-MB PMD for the DOCSIS protocol, through the rte_security API. This, therefore, includes adding support for the rte_security API to this PMD.
--- .../crypto/aesni_mb/aesni_mb_pmd_private.h | 19 +- drivers/crypto/aesni_mb/meson.build | 2 +- drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c | 316 +++++++++++++++++- .../crypto/aesni_mb/rte_aesni_mb_pmd_ops.c | 127 +++++++ 4 files changed, 457 insertions(+), 7 deletions(-)
drivers/crypto/aesni_mb/aesni_mb_pmd_private.h +18 -1
@@ -7,6 +7,12 @@#include <intel-ipsec-mb.h> +#if defined(RTE_LIBRTE_SECURITY ) &&IMB_VERSION_NUM >=IMB_VERSION (0 ,54 ,0 ) +#define AESNI_MB_DOCSIS_SEC_ENABLED 1 +#include <rte_security.h> +#include <rte_security_driver.h> +#endif +enum aesni_mb_vector_mode {RTE_AESNI_MB_NOT_SUPPORTED =0 ,RTE_AESNI_MB_SSE ,
@@ -272,8 +278,19 @@ aesni_mb_set_session_parameters(const MB_MGR *mb_mgr,struct aesni_mb_session *sess, const struct rte_crypto_sym_xform *xform); -/** device specific operations function pointer structure */ +#ifdef AESNI_MB_DOCSIS_SEC_ENABLED +extern int +aesni_mb_set_docsis_sec_session_parameters ( + __rte_unused struct rte_cryptodev *dev, +struct rte_security_session_conf *conf, +void *sess); +#endif + +/** device specific operations function pointer structures */ extern struct rte_cryptodev_ops *rte_aesni_mb_pmd_ops; +#ifdef AESNI_MB_DOCSIS_SEC_ENABLED +extern struct rte_security_ops *rte_aesni_mb_pmd_sec_ops; +#endif extern uint32_t aesni_mb_cpu_crypto_process_bulk(struct rte_cryptodev *dev,
drivers/crypto/aesni_mb/meson.build +1 -1
@@ -22,4 +22,4 @@ else endif sources = files('rte_aesni_mb_pmd.c', 'rte_aesni_mb_pmd_ops.c') -deps += ['bus_vdev'] +deps += ['bus_vdev', 'net', 'security']
drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c +311 -5
364 lines not on this page · raw message
drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c +127 -0
142 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH v2 4/6 crypto/qat: add support for DOCSIS protocol
In reply to David CoyleAdd support to the QAT SYM PMD for the DOCSIS protocol, through the rte_security API. This, therefore, includes adding support for the rte_security API to this PMD.
--- drivers/common/qat/Makefile | 3 + drivers/crypto/qat/meson.build | 2 + drivers/crypto/qat/qat_sym.c | 139 ++++++++++++++------ drivers/crypto/qat/qat_sym.h | 82 ++++++++++-- drivers/crypto/qat/qat_sym_capabilities.h | 44 +++++++ drivers/crypto/qat/qat_sym_pmd.c | 53 +++++++- drivers/crypto/qat/qat_sym_pmd.h | 4 + drivers/crypto/qat/qat_sym_session.c | 148 ++++++++++++++++++++++ drivers/crypto/qat/qat_sym_session.h | 12 ++ 9 files changed, 438 insertions(+), 49 deletions(-)
drivers/common/qat/Makefile +3 -0
@@ -35,6 +35,9 @@ endif ifeq ($(CONFIG_RTE_LIBRTE_PMD_QAT_SYM),y) LDLIBS += -lrte_cryptodev LDLIBS += -lcrypto +ifeq ($(CONFIG_RTE_LIBRTE_SECURITY),y) + LDLIBS += -lrte_net +endif CFLAGS += -DBUILD_QAT_SYM SRCS-y += qat_sym.c SRCS-y += qat_sym_session.c
drivers/crypto/qat/meson.build +2 -0
@@ -8,6 +8,8 @@ reason = '' # sentinal value to suppress printout dep = dependency('libcrypto', required: false) qat_includes += include_directories('.') qat_deps += 'cryptodev' +qat_deps += 'net' +qat_deps += 'security' if dep.found() # Add our sources files to the list qat_sources += files('qat_sym_pmd.c',
drivers/crypto/qat/qat_sym.c +101 -38
251 lines not on this page · raw message
drivers/crypto/qat/qat_sym.h +72 -10
117 lines not on this page · raw message
drivers/crypto/qat/qat_sym_capabilities.h +44 -0
48 lines not on this page · raw message
drivers/crypto/qat/qat_sym_pmd.c +52 -1
83 lines not on this page · raw message
drivers/crypto/qat/qat_sym_pmd.h +4 -0
@@ -7,7 +7,11 @@#ifdef BUILD_QAT_SYM +#include <rte_ether.h> #include <rte_cryptodev.h> +#ifdef RTE_LIBRTE_SECURITY +#include <rte_security.h> +#endif #include "qat_sym_capabilities.h" #include "qat_device.h"
drivers/crypto/qat/qat_sym_session.c +148 -0
157 lines not on this page · raw message
drivers/crypto/qat/qat_sym_session.h +12 -0
@@ -6,6 +6,9 @@#include <rte_crypto.h> #include <rte_cryptodev_pmd.h> +#ifdef RTE_LIBRTE_SECURITY +#include <rte_security.h> +#endif #include "qat_common.h" #include "icp_qat_hw.h"
@@ -156,4 +159,13 @@ qat_cipher_get_block_size(enum icp_qat_hw_cipher_algo qat_cipher_alg);int qat_sym_validate_zuc_key (int key_len,enum icp_qat_hw_cipher_algo *alg); +#ifdef RTE_LIBRTE_SECURITY +int +qat_security_session_create (void *dev,struct rte_security_session_conf *conf, +struct rte_security_session *sess,struct rte_mempool *mempool); +int +qat_security_session_destroy(void *dev __rte_unused, +struct rte_security_session *sess); +#endif +#endif /* _QAT_SYM_SESSION_H_ */
Signature · 1 line
2.17.1
PATCH v2 5/6 test/crypto: add DOCSIS security test cases
In reply to David CoyleAdd uplink and downlink DOCSIS unit test cases and vectors, to test the combined DOCSIS Crypto-CRC support that has been added to the rte_security and rte_cryptodev libraries.
--- app/test/test_cryptodev.c | 552 ++++++ ...t_cryptodev_security_docsis_test_vectors.h | 1544 +++++++++++++++++ 2 files changed, 2096 insertions(+) create mode 100644 app/test/test_cryptodev_security_docsis_test_vectors.h
app/test/test_cryptodev.c +552 -0
@@ -11,6 +11,7 @@#include <rte_memcpy.h> #include <rte_pause.h> #include <rte_bus_vdev.h> +#include <rte_ether.h> #include <rte_crypto.h> #include <rte_cryptodev.h>
@@ -42,6 +43,7 @@#ifdef RTE_LIBRTE_SECURITY #include "test_cryptodev_security_pdcp_test_vectors.h" #include "test_cryptodev_security_pdcp_test_func.h" +#include "test_cryptodev_security_docsis_test_vectors.h" #endif #define VDEV_ARGS_SIZE 100
@@ -59,6 +61,9 @@ struct crypto_testsuite_params {struct rte_mempool *mbuf_pool;struct rte_mempool *large_mbuf_pool;struct rte_mempool *op_mpool; +#ifdef RTE_LIBRTE_SECURITY +struct rte_mempool *security_op_mpool; +#endif struct rte_mempool *session_mpool;struct rte_mempool *session_priv_mpool;struct rte_cryptodev_config conf;
@@ -72,6 +77,9 @@ struct crypto_unittest_params {struct rte_crypto_sym_xform cipher_xform;struct rte_crypto_sym_xform auth_xform;struct rte_crypto_sym_xform aead_xform; +#ifdef RTE_LIBRTE_SECURITY +struct rte_security_docsis_xform docsis_xform; +#endif union {struct rte_cryptodev_sym_session *sess;
@@ -308,6 +316,19 @@ testsuite_setup(void)return TEST_FAILED ; } +#ifdef RTE_LIBRTE_SECURITY + ts_params->security_op_mpool =rte_crypto_op_pool_create ( +"MBUF_SECURITY_OP_POOL" , +RTE_CRYPTO_OP_TYPE_SECURITY , +NUM_MBUFS ,MBUF_CACHE_SIZE , +MAXIMUM_IV_LENGTH , +rte_socket_id ()); +if (ts_params->security_op_mpool ==NULL ) { +RTE_LOG (ERR ,USER1 ,"Can't create SECURITY_OP_POOL\n" ); +return TEST_FAILED ; + } +#endif +/* Create an AESNI MB device if required */ if (gbl_driver_id ==rte_cryptodev_driver_id_get (RTE_STR (CRYPTODEV_NAME_AESNI_MB_PMD ))) {
@@ -7067,6 +7088,34 @@ test_authenticated_encryption(const struct aead_test_data *tdata) }#ifdef RTE_LIBRTE_SECURITY +static int +security_proto_supported (enum rte_security_session_protocol proto) +{ +struct crypto_testsuite_params *ts_params = &testsuite_params; + +const struct rte_security_capability *capabilities; +const struct rte_security_capability *capability; +uint16_t i =0 ; + +struct rte_security_ctx *ctx = (struct rte_security_ctx *) +rte_cryptodev_get_sec_ctx ( + ts_params->valid_devs[0 ]); + + + capabilities =rte_security_capabilities_get (ctx); + +if (capabilities ==NULL ) +return -ENOTSUP ; + +while ((capability = &capabilities[i++])->action != +RTE_SECURITY_ACTION_TYPE_NONE ) { +if (capability->protocol == proto) +return 0 ; + } + +return -ENOTSUP ; +} +/* Basic algorithm run function for async inplace mode. * Creates a session from input parameters and runs one operation * on input_vec. Checks the output of the crypto operation against
@@ -7670,6 +7719,9 @@ test_PDCP_PROTO_all(void)if (!(feat_flags &RTE_CRYPTODEV_FF_SECURITY ))return -ENOTSUP ; +if (security_proto_supported (RTE_SECURITY_PROTOCOL_PDCP ) <0 ) +return -ENOTSUP ; + status =test_PDCP_PROTO_cplane_encap_all (); status +=test_PDCP_PROTO_cplane_decap_all (); status +=test_PDCP_PROTO_uplane_encap_all ();
@@ -7684,6 +7736,504 @@ test_PDCP_PROTO_all(void) else return TEST_SUCCESS; } + +static int +test_docsis_proto_uplink (int i,struct docsis_test_data *d_td) +{ +struct rte_security_op *sec_op; +struct rte_security_docsis_op *doc_op; +struct crypto_testsuite_params *ts_params = &testsuite_params; +struct crypto_unittest_params *ut_params = &unittest_params; +uint8_t *plaintext, *ciphertext; +uint8_t *iv_ptr; +int cipher_len =0 ; +int crc_len =0 , crc_data_len; +int ret =TEST_SUCCESS ; + +struct rte_security_ctx *ctx = (struct rte_security_ctx *) +rte_cryptodev_get_sec_ctx ( + ts_params->valid_devs[0 ]); + +/* Verify the capabilities */ +struct rte_security_capability_idx sec_cap_idx; +const struct rte_security_capability *sec_cap; +const struct rte_cryptodev_capabilities *crypto_cap; +const struct rte_cryptodev_symmetric_capability *sym_cap; +int j =0 ; + + sec_cap_idx.action =RTE_SECURITY_ACTION_TYPE_LOOKASIDE_PROTOCOL ; + sec_cap_idx.protocol =RTE_SECURITY_PROTOCOL_DOCSIS ; + sec_cap_idx.docsis.direction =RTE_SECURITY_DOCSIS_UPLINK ; + sec_cap_idx.docsis.crc_size =RTE_ETHER_CRC_LEN ; + + sec_cap =rte_security_capability_get (ctx, &sec_cap_idx); +if (sec_cap ==NULL ) +return -ENOTSUP ; + +while ((crypto_cap = &sec_cap->crypto_capabilities[j++])->op != +RTE_CRYPTO_OP_TYPE_UNDEFINED ) { +if (crypto_cap->op ==RTE_CRYPTO_OP_TYPE_SYMMETRIC && + crypto_cap->sym.xform_type == +RTE_CRYPTO_SYM_XFORM_CIPHER && + crypto_cap->sym.cipher.algo == +RTE_CRYPTO_CIPHER_AES_DOCSISBPI ) { + sym_cap = &crypto_cap->sym; +if (rte_cryptodev_sym_capability_check_cipher (sym_cap, + d_td->key.len, + d_td->iv.len) ==0 ) +break ; + } + } + +if (crypto_cap->op ==RTE_CRYPTO_OP_TYPE_UNDEFINED ) +return -ENOTSUP ; + +/* Setup source mbuf payload */ + ut_params->ibuf =rte_pktmbuf_alloc (ts_params->mbuf_pool); + memset(rte_pktmbuf_mtod(ut_params->ibuf, uint8_t *), 0, +rte_pktmbuf_tailroom (ut_params->ibuf)); + + ciphertext = (uint8_t *)rte_pktmbuf_append (ut_params->ibuf, + d_td->ciphertext.len); + +memcpy (ciphertext, d_td->ciphertext.data, d_td->ciphertext.len); + +/* Set session action type */ + ut_params->type =RTE_SECURITY_ACTION_TYPE_LOOKASIDE_PROTOCOL ; + +/* Setup cipher session parameters */ + ut_params->cipher_xform.type =RTE_CRYPTO_SYM_XFORM_CIPHER ; + ut_params->cipher_xform.cipher.algo =RTE_CRYPTO_CIPHER_AES_DOCSISBPI ; + ut_params->cipher_xform.cipher.op =RTE_CRYPTO_CIPHER_OP_DECRYPT ; + ut_params->cipher_xform.cipher.key.data = d_td->key.data; + ut_params->cipher_xform.cipher.key.length = d_td->key.len; + ut_params->cipher_xform.cipher.iv.length = d_td->iv.len; + ut_params->cipher_xform.cipher.iv.offset =sizeof (struct rte_crypto_op ) + +sizeof (struct rte_security_op ); + ut_params->cipher_xform.next =NULL ; + +/* Setup DOCSIS session parameters */ + ut_params->docsis_xform.direction =RTE_SECURITY_DOCSIS_UPLINK ; + ut_params->docsis_xform.crc_size =RTE_ETHER_CRC_LEN ; + +struct rte_security_session_conf sess_conf = { + .action_type = ut_params->type, + .protocol =RTE_SECURITY_PROTOCOL_DOCSIS , + .docsis = ut_params->docsis_xform, + .crypto_xform = &ut_params->cipher_xform, + }; + +/* Create security session */ + ut_params->sec_session =rte_security_session_create (ctx, &sess_conf, + ts_params->session_priv_mpool); + +if (!ut_params->sec_session) { +printf ("TestCase %s(%d) line %d: %s\n" , + __func__, i, __LINE__,"failed to allocate session" ); + ret =TEST_FAILED ; + goto on_err; + } + +/* Generate crypto op data structure */ + ut_params->op =rte_crypto_op_alloc (ts_params->security_op_mpool, +RTE_CRYPTO_OP_TYPE_SECURITY ); +if (!ut_params->op) { +printf ("TestCase %s(%d) line %d: %s\n" , + __func__, i, __LINE__, +"failed to allocate security crypto operation" ); + ret =TEST_FAILED ; + goto on_err; + } + +/* Populate DOCSIS security operation */ + sec_op = (struct rte_security_op *)&ut_params->op->security; + sec_op->type =RTE_SECURITY_OP_TYPE_DOCSIS ; + doc_op = &sec_op->docsis; + +/* Setup CRC operation parameters */ + crc_len = d_td->ciphertext.no_crc == false ? + (d_td->ciphertext.len - + d_td->ciphertext.crc_offset - +RTE_ETHER_CRC_LEN ) : +0 ; + crc_len = crc_len >0 ? crc_len :0 ; + crc_data_len = crc_len ==0 ?0 :RTE_ETHER_CRC_LEN ; + doc_op->crc.length = crc_len; + doc_op->crc.offset = d_td->ciphertext.crc_offset; + +/* Setup cipher operation parameters */ + cipher_len = d_td->ciphertext.no_cipher == false ? + (d_td->ciphertext.len - + d_td->ciphertext.cipher_offset) : +0 ; + cipher_len = cipher_len >0 ? cipher_len :0 ; + doc_op->crypto_sym.cipher.data.length = cipher_len; + doc_op->crypto_sym.cipher.data.offset = d_td->ciphertext.cipher_offset; + +/* Setup cipher IV */ + iv_ptr = (uint8_t *)ut_params->op +sizeof (struct rte_crypto_op ) + +sizeof (struct rte_security_op ); +rte_memcpy (iv_ptr, d_td->iv.data, d_td->iv.len); + +/* Attach session to operation */ +rte_security_attach_session (ut_params->op, ut_params->sec_session); + +/* Set crypto operation mbufs */ + sec_op->docsis.crypto_sym.m_src = ut_params->ibuf; + sec_op->docsis.crypto_sym.m_dst =NULL ; + +/* Process crypto operation */ +if (process_crypto_request (ts_params->valid_devs[0 ], ut_params->op) == +NULL ) { +printf ("TestCase %s(%d) line %d: %s\n" , + __func__, i, __LINE__, +"failed to process security crypto op" ); + ret =TEST_FAILED ; + goto on_err; + } + +if (ut_params->op->status !=RTE_CRYPTO_OP_STATUS_SUCCESS ) { +printf ("TestCase %s(%d) line %d: %s\n" , + __func__, i, __LINE__,"crypto op processing failed" ); + ret =TEST_FAILED ; + goto on_err; + } + +/* Validate plaintext */ + plaintext = ciphertext; + +if (memcmp (plaintext, d_td->plaintext.data, + d_td->plaintext.len - crc_data_len)) { +printf ("TestCase %s(%d) line %d: %s\n" , + __func__, i, __LINE__,"plaintext not as expected\n" ); +rte_hexdump (stdout,"expected" , d_td->plaintext.data, + d_td->plaintext.len); +rte_hexdump (stdout,"actual" , plaintext, d_td->plaintext.len); + ret =TEST_FAILED ; + goto on_err; + } + +on_err: +rte_crypto_op_free (ut_params->op); + ut_params->op =NULL ; + +if (ut_params->sec_session) +rte_security_session_destroy (ctx, ut_params->sec_session); + ut_params->sec_session =NULL ; + +rte_pktmbuf_free (ut_params->ibuf); + ut_params->ibuf =NULL ; + +return ret; +} + +static int +test_docsis_proto_downlink (int i,struct docsis_test_data *d_td) +{ +struct rte_security_op *sec_op; +struct rte_security_docsis_op *doc_op; +struct crypto_testsuite_params *ts_params = &testsuite_params; +struct crypto_unittest_params *ut_params = &unittest_params; +uint8_t *plaintext, *ciphertext; +uint8_t *iv_ptr; +int cipher_len =0 ; +int crc_len =0 ; +int ret =TEST_SUCCESS ; + +struct rte_security_ctx *ctx = (struct rte_security_ctx *) +rte_cryptodev_get_sec_ctx ( + ts_params->valid_devs[0 ]); + +/* Verify the capabilities */ +struct rte_security_capability_idx sec_cap_idx; +const struct rte_security_capability *sec_cap; +const struct rte_cryptodev_capabilities *crypto_cap; +const struct rte_cryptodev_symmetric_capability *sym_cap; +int j =0 ; + + sec_cap_idx.action =RTE_SECURITY_ACTION_TYPE_LOOKASIDE_PROTOCOL ; + sec_cap_idx.protocol =RTE_SECURITY_PROTOCOL_DOCSIS ; + sec_cap_idx.docsis.direction =RTE_SECURITY_DOCSIS_DOWNLINK ; + sec_cap_idx.docsis.crc_size =RTE_ETHER_CRC_LEN ; + + sec_cap =rte_security_capability_get (ctx, &sec_cap_idx); +if (sec_cap ==NULL ) +return -ENOTSUP ; + +while ((crypto_cap = &sec_cap->crypto_capabilities[j++])->op != +RTE_CRYPTO_OP_TYPE_UNDEFINED ) { +if (crypto_cap->op ==RTE_CRYPTO_OP_TYPE_SYMMETRIC && + crypto_cap->sym.xform_type == +RTE_CRYPTO_SYM_XFORM_CIPHER && + crypto_cap->sym.cipher.algo == +RTE_CRYPTO_CIPHER_AES_DOCSISBPI ) { + sym_cap = &crypto_cap->sym; +if (rte_cryptodev_sym_capability_check_cipher (sym_cap, + d_td->key.len, + d_td->iv.len) ==0 ) +break ; + } + } + +if (crypto_cap->op ==RTE_CRYPTO_OP_TYPE_UNDEFINED ) +return -ENOTSUP ; + +/* Setup source mbuf payload */ + ut_params->ibuf =rte_pktmbuf_alloc (ts_params->mbuf_pool); + memset(rte_pktmbuf_mtod(ut_params->ibuf, uint8_t *), 0, +rte_pktmbuf_tailroom (ut_params->ibuf)); + + plaintext = (uint8_t *)rte_pktmbuf_append (ut_params->ibuf, + d_td->plaintext.len); + +memcpy (plaintext, d_td->plaintext.data, d_td->plaintext.len); + +/* Set session action type */ + ut_params->type =RTE_SECURITY_ACTION_TYPE_LOOKASIDE_PROTOCOL ; + +/* Setup cipher session parameters */ + ut_params->cipher_xform.type =RTE_CRYPTO_SYM_XFORM_CIPHER ; + ut_params->cipher_xform.cipher.algo =RTE_CRYPTO_CIPHER_AES_DOCSISBPI ; + ut_params->cipher_xform.cipher.op =RTE_CRYPTO_CIPHER_OP_ENCRYPT ; + ut_params->cipher_xform.cipher.key.data = d_td->key.data; + ut_params->cipher_xform.cipher.key.length = d_td->key.len; + ut_params->cipher_xform.cipher.iv.length = d_td->iv.len; + ut_params->cipher_xform.cipher.iv.offset =sizeof (struct rte_crypto_op ) + +sizeof (struct rte_security_op ); + ut_params->cipher_xform.next =NULL ; + +/* Setup DOCSIS session parameters */ + ut_params->docsis_xform.direction =RTE_SECURITY_DOCSIS_DOWNLINK ; + ut_params->docsis_xform.crc_size =RTE_ETHER_CRC_LEN ; + +struct rte_security_session_conf sess_conf = { + .action_type = ut_params->type, + .protocol =RTE_SECURITY_PROTOCOL_DOCSIS , + .docsis = ut_params->docsis_xform, + .crypto_xform = &ut_params->cipher_xform, + }; + +/* Create security session */ + ut_params->sec_session =rte_security_session_create (ctx, &sess_conf, + ts_params->session_priv_mpool); + +if (!ut_params->sec_session) { +printf ("TestCase %s(%d) line %d: %s\n" , + __func__, i, __LINE__,"failed to allocate session" ); + ret =TEST_FAILED ; + goto on_err; + } + +/* Generate crypto op data structure */ + ut_params->op =rte_crypto_op_alloc (ts_params->security_op_mpool, +RTE_CRYPTO_OP_TYPE_SECURITY ); +if (!ut_params->op) { +printf ("TestCase %s(%d) line %d: %s\n" , + __func__, i, __LINE__, +"failed to allocate security crypto operation" ); + ret =TEST_FAILED ; + goto on_err; + } + +/* Populate DOCSIS security operation */ + sec_op = (struct rte_security_op *)&ut_params->op->security; + sec_op->type =RTE_SECURITY_OP_TYPE_DOCSIS ; + doc_op = &sec_op->docsis; + +/* Setup CRC operation parameters */ + crc_len = d_td->plaintext.no_crc == false ? + (d_td->plaintext.len - + d_td->plaintext.crc_offset - +RTE_ETHER_CRC_LEN ) : +0 ; + crc_len = crc_len >0 ? crc_len :0 ; + doc_op->crc.length = crc_len; + doc_op->crc.offset = d_td->plaintext.crc_offset; + +/* Setup cipher operation parameters */ + cipher_len = d_td->plaintext.no_cipher == false ? + (d_td->plaintext.len - + d_td->plaintext.cipher_offset) : +0 ; + cipher_len = cipher_len >0 ? cipher_len :0 ; + doc_op->crypto_sym.cipher.data.length = cipher_len; + doc_op->crypto_sym.cipher.data.offset = d_td->plaintext.cipher_offset; + +/* Setup cipher IV */ + iv_ptr = (uint8_t *)ut_params->op +sizeof (struct rte_crypto_op ) + +sizeof (struct rte_security_op ); +rte_memcpy (iv_ptr, d_td->iv.data, d_td->iv.len); + +/* Attach session to operation */ +rte_security_attach_session (ut_params->op, ut_params->sec_session); + +/* Set crypto operation mbufs */ + sec_op->docsis.crypto_sym.m_src = ut_params->ibuf; + sec_op->docsis.crypto_sym.m_dst =NULL ; + +/* Process crypto operation */ +if (process_crypto_request (ts_params->valid_devs[0 ], ut_params->op) == +NULL ) { +printf ("TestCase %s(%d) line %d: %s\n" , + __func__, i, __LINE__, +"failed to process security crypto op" ); + ret =TEST_FAILED ; + goto on_err; + } + +if (ut_params->op->status !=RTE_CRYPTO_OP_STATUS_SUCCESS ) { +printf ("TestCase %s(%d) line %d: %s\n" , + __func__, i, __LINE__,"crypto op processing failed" ); + ret =TEST_FAILED ; + goto on_err; + } + +/* Validate ciphertext */ + ciphertext = plaintext; + +if (memcmp (ciphertext, d_td->ciphertext.data, d_td->ciphertext.len)) { +printf ("TestCase %s(%d) line %d: %s\n" , + __func__, i, __LINE__,"ciphertext not as expected\n" ); +rte_hexdump (stdout,"expected" , d_td->ciphertext.data, + d_td->ciphertext.len); +rte_hexdump (stdout,"actual" , ciphertext, d_td->ciphertext.len); + ret =TEST_FAILED ; + goto on_err; + } + +on_err: +rte_crypto_op_free (ut_params->op); + ut_params->op =NULL ; + +if (ut_params->sec_session) +rte_security_session_destroy (ctx, ut_params->sec_session); + ut_params->sec_session =NULL ; + +rte_pktmbuf_free (ut_params->ibuf); + ut_params->ibuf =NULL ; + +return ret; +} + +#define TEST_DOCSIS_COUNT (func) do { \ + int ret = func; \ + if (ret == TEST_SUCCESS) { \ + printf("\t%2d)", n++); \ + printf("+++++ PASSED:" #func"\n"); \ + p++; \ + } else if (ret == -ENOTSUP) { \ + printf("\t%2d)", n++); \ + printf("~~~~~ UNSUPP:" #func"\n"); \ + u++; \ + } else { \ + printf("\t%2d)", n++); \ + printf("----- FAILED:" #func"\n"); \ + f++; \ + } \ +} while (0) + +static int +test_DOCSIS_PROTO_uplink_all (void ) +{ +int p =0 , u =0 , f =0 , n =0 ; + +TEST_DOCSIS_COUNT (test_docsis_proto_uplink (1 , &docsis_test_case_1)); +TEST_DOCSIS_COUNT (test_docsis_proto_uplink (2 , &docsis_test_case_2)); +TEST_DOCSIS_COUNT (test_docsis_proto_uplink (3 , &docsis_test_case_3)); +TEST_DOCSIS_COUNT (test_docsis_proto_uplink (4 , &docsis_test_case_4)); +TEST_DOCSIS_COUNT (test_docsis_proto_uplink (5 , &docsis_test_case_5)); +TEST_DOCSIS_COUNT (test_docsis_proto_uplink (6 , &docsis_test_case_6)); +TEST_DOCSIS_COUNT (test_docsis_proto_uplink (7 , &docsis_test_case_7)); +TEST_DOCSIS_COUNT (test_docsis_proto_uplink (8 , &docsis_test_case_8)); +TEST_DOCSIS_COUNT (test_docsis_proto_uplink (9 , &docsis_test_case_9)); +TEST_DOCSIS_COUNT (test_docsis_proto_uplink (10 , &docsis_test_case_10)); +TEST_DOCSIS_COUNT (test_docsis_proto_uplink (11 , &docsis_test_case_11)); +TEST_DOCSIS_COUNT (test_docsis_proto_uplink (12 , &docsis_test_case_12)); +TEST_DOCSIS_COUNT (test_docsis_proto_uplink (13 , &docsis_test_case_13)); +TEST_DOCSIS_COUNT (test_docsis_proto_uplink (14 , &docsis_test_case_14)); +TEST_DOCSIS_COUNT (test_docsis_proto_uplink (15 , &docsis_test_case_15)); +TEST_DOCSIS_COUNT (test_docsis_proto_uplink (16 , &docsis_test_case_16)); +TEST_DOCSIS_COUNT (test_docsis_proto_uplink (17 , &docsis_test_case_17)); +TEST_DOCSIS_COUNT (test_docsis_proto_uplink (18 , &docsis_test_case_18)); +TEST_DOCSIS_COUNT (test_docsis_proto_uplink (19 , &docsis_test_case_19)); +TEST_DOCSIS_COUNT (test_docsis_proto_uplink (20 , &docsis_test_case_20)); +TEST_DOCSIS_COUNT (test_docsis_proto_uplink (21 , &docsis_test_case_21)); +TEST_DOCSIS_COUNT (test_docsis_proto_uplink (22 , &docsis_test_case_22)); +TEST_DOCSIS_COUNT (test_docsis_proto_uplink (23 , &docsis_test_case_23)); +TEST_DOCSIS_COUNT (test_docsis_proto_uplink (24 , &docsis_test_case_24)); +TEST_DOCSIS_COUNT (test_docsis_proto_uplink (25 , &docsis_test_case_25)); +TEST_DOCSIS_COUNT (test_docsis_proto_uplink (26 , &docsis_test_case_26)); + +if (f) +printf ("## %s: %d passed out of %d (%d unsupported)\n" , + __func__, p, n, u); + +return f; +}; + +static int +test_DOCSIS_PROTO_downlink_all (void ) +{ +int p =0 , u =0 , f =0 , n =0 ; + +TEST_DOCSIS_COUNT (test_docsis_proto_downlink (1 , &docsis_test_case_1)); +TEST_DOCSIS_COUNT (test_docsis_proto_downlink (2 , &docsis_test_case_2)); +TEST_DOCSIS_COUNT (test_docsis_proto_downlink (3 , &docsis_test_case_3)); +TEST_DOCSIS_COUNT (test_docsis_proto_downlink (4 , &docsis_test_case_4)); +TEST_DOCSIS_COUNT (test_docsis_proto_downlink (5 , &docsis_test_case_5)); +TEST_DOCSIS_COUNT (test_docsis_proto_downlink (6 , &docsis_test_case_6)); +TEST_DOCSIS_COUNT (test_docsis_proto_downlink (7 , &docsis_test_case_7)); +TEST_DOCSIS_COUNT (test_docsis_proto_downlink (8 , &docsis_test_case_8)); +TEST_DOCSIS_COUNT (test_docsis_proto_downlink (9 , &docsis_test_case_9)); +TEST_DOCSIS_COUNT (test_docsis_proto_downlink (10 , &docsis_test_case_10)); +TEST_DOCSIS_COUNT (test_docsis_proto_downlink (11 , &docsis_test_case_11)); +TEST_DOCSIS_COUNT (test_docsis_proto_downlink (12 , &docsis_test_case_12)); +TEST_DOCSIS_COUNT (test_docsis_proto_downlink (13 , &docsis_test_case_13)); +TEST_DOCSIS_COUNT (test_docsis_proto_downlink (14 , &docsis_test_case_14)); +TEST_DOCSIS_COUNT (test_docsis_proto_downlink (15 , &docsis_test_case_15)); +TEST_DOCSIS_COUNT (test_docsis_proto_downlink (16 , &docsis_test_case_16)); +TEST_DOCSIS_COUNT (test_docsis_proto_downlink (17 , &docsis_test_case_17)); +TEST_DOCSIS_COUNT (test_docsis_proto_downlink (18 , &docsis_test_case_18)); +TEST_DOCSIS_COUNT (test_docsis_proto_downlink (19 , &docsis_test_case_19)); +TEST_DOCSIS_COUNT (test_docsis_proto_downlink (20 , &docsis_test_case_20)); +TEST_DOCSIS_COUNT (test_docsis_proto_downlink (21 , &docsis_test_case_21)); +TEST_DOCSIS_COUNT (test_docsis_proto_downlink (22 , &docsis_test_case_22)); +TEST_DOCSIS_COUNT (test_docsis_proto_downlink (23 , &docsis_test_case_23)); +TEST_DOCSIS_COUNT (test_docsis_proto_downlink (24 , &docsis_test_case_24)); +TEST_DOCSIS_COUNT (test_docsis_proto_downlink (25 , &docsis_test_case_25)); +TEST_DOCSIS_COUNT (test_docsis_proto_downlink (26 , &docsis_test_case_26)); + +if (f) +printf ("## %s: %d passed out of %d (%d unsupported)\n" , + __func__, p, n, u); + +return f; +}; + +static int +test_DOCSIS_PROTO_all (void ) +{ +struct crypto_testsuite_params *ts_params = &testsuite_params; +struct rte_cryptodev_info dev_info; +int status; + +rte_cryptodev_info_get (ts_params->valid_devs[0 ], &dev_info); +uint64_t feat_flags = dev_info.feature_flags; + +if (!(feat_flags &RTE_CRYPTODEV_FF_SECURITY )) +return -ENOTSUP ; + +if (security_proto_supported (RTE_SECURITY_PROTOCOL_DOCSIS ) <0 ) +return -ENOTSUP ; + + status =test_DOCSIS_PROTO_uplink_all (); + status +=test_DOCSIS_PROTO_downlink_all (); + +if (status) +return TEST_FAILED ; +else +return TEST_SUCCESS ; +}#endif static int
@@ -12342,6 +12892,8 @@ static struct unit_test_suite cryptodev_testsuite = {#ifdef RTE_LIBRTE_SECURITY TEST_CASE_ST (ut_setup, ut_teardown, test_PDCP_PROTO_all), +TEST_CASE_ST (ut_setup, ut_teardown, + test_DOCSIS_PROTO_all), #endifTEST_CASES_END ()/**< NULL terminate unit test array */ }
app/test/test_cryptodev_security_docsis_test_vectors.h new file +1544 -0
1,544 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH v2 6/6 test/security: add DOCSIS capability check tests
In reply to David CoyleAdd unit tests for DOCSIS capabilitity checks.
--- app/test/test_security.c | 139 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 139 insertions(+)
app/test/test_security.c +139 -0
@@ -6,6 +6,7 @@#include <rte_log.h> #include <rte_memory.h> #include <rte_mempool.h> +#include <rte_ether.h> #include <rte_security.h> #include <rte_security_driver.h>
@@ -2268,6 +2269,138 @@ test_capability_get_pdcp_match(void)return TEST_SUCCESS ; } +/** +* Test execution of rte_security_capability_get when capabilities table does +* not contain entry with matching DOCSIS direction field +*/ +static int +test_capability_get_docsis_mismatch_direction (void ) +{ +struct security_unittest_params *ut_params = &unittest_params; +struct rte_security_capability_idx idx = { + .action =RTE_SECURITY_ACTION_TYPE_LOOKASIDE_PROTOCOL , + .protocol =RTE_SECURITY_PROTOCOL_DOCSIS , + .docsis = { + .direction =RTE_SECURITY_DOCSIS_DOWNLINK , + .crc_size =RTE_ETHER_CRC_LEN , + }, + }; +struct rte_security_capability capabilities[] = { + { + .action =RTE_SECURITY_ACTION_TYPE_LOOKASIDE_PROTOCOL , + .protocol =RTE_SECURITY_PROTOCOL_DOCSIS , + .docsis = { + .direction = +RTE_SECURITY_DOCSIS_UPLINK , + .crc_size =RTE_ETHER_CRC_LEN , + }, + }, + { + .action =RTE_SECURITY_ACTION_TYPE_NONE , + }, + }; + + mock_capabilities_get_exp.device =NULL ; + mock_capabilities_get_exp.ret = capabilities; + +const struct rte_security_capability *ret; + ret =rte_security_capability_get (&ut_params->ctx, &idx); +TEST_ASSERT_MOCK_FUNCTION_CALL_RET (rte_security_capability_get, + ret,NULL ,"%p" ); +TEST_ASSERT_MOCK_CALLS (mock_capabilities_get_exp,1 ); + +return TEST_SUCCESS ; +} + +/** +* Test execution of rte_security_capability_get when capabilities table does +* not contain entry with matching DOCSIS CRC length +*/ +static int +test_capability_get_docsis_mismatch_crc_len (void ) +{ +struct security_unittest_params *ut_params = &unittest_params; +struct rte_security_capability_idx idx = { + .action =RTE_SECURITY_ACTION_TYPE_LOOKASIDE_PROTOCOL , + .protocol =RTE_SECURITY_PROTOCOL_DOCSIS , + .docsis = { + .direction =RTE_SECURITY_DOCSIS_DOWNLINK , + .crc_size =0 , + }, + }; +struct rte_security_capability capabilities[] = { + { + .action =RTE_SECURITY_ACTION_TYPE_LOOKASIDE_PROTOCOL , + .protocol =RTE_SECURITY_PROTOCOL_DOCSIS , + .docsis = { + .direction = +RTE_SECURITY_DOCSIS_DOWNLINK , + .crc_size =RTE_ETHER_CRC_LEN , + }, + }, + { + .action =RTE_SECURITY_ACTION_TYPE_NONE , + }, + }; + + mock_capabilities_get_exp.device =NULL ; + mock_capabilities_get_exp.ret = capabilities; + +const struct rte_security_capability *ret; + ret =rte_security_capability_get (&ut_params->ctx, &idx); +TEST_ASSERT_MOCK_FUNCTION_CALL_RET (rte_security_capability_get, + ret,NULL ,"%p" ); +TEST_ASSERT_MOCK_CALLS (mock_capabilities_get_exp,1 ); + +return TEST_SUCCESS ; +} + +/** +* Test execution of rte_security_capability_get when capabilities table +* contains matching DOCSIS entry +*/ +static int +test_capability_get_docsis_match (void ) +{ +struct security_unittest_params *ut_params = &unittest_params; +struct rte_security_capability_idx idx = { + .action =RTE_SECURITY_ACTION_TYPE_LOOKASIDE_PROTOCOL , + .protocol =RTE_SECURITY_PROTOCOL_DOCSIS , + .docsis = { + .direction =RTE_SECURITY_DOCSIS_UPLINK , + .crc_size =RTE_ETHER_CRC_LEN , + }, + }; +struct rte_security_capability capabilities[] = { + { + .action =RTE_SECURITY_ACTION_TYPE_INLINE_CRYPTO , + }, + { + .action =RTE_SECURITY_ACTION_TYPE_LOOKASIDE_PROTOCOL , + .protocol =RTE_SECURITY_PROTOCOL_DOCSIS , + .docsis = { + .direction = +RTE_SECURITY_DOCSIS_UPLINK , + .crc_size =RTE_ETHER_CRC_LEN , + }, + }, + { + .action =RTE_SECURITY_ACTION_TYPE_NONE , + }, + }; + + mock_capabilities_get_exp.device =NULL ; + mock_capabilities_get_exp.ret = capabilities; + +const struct rte_security_capability *ret; + ret =rte_security_capability_get (&ut_params->ctx, &idx); +TEST_ASSERT_MOCK_FUNCTION_CALL_RET (rte_security_capability_get, + ret, &capabilities[1 ],"%p" ); +TEST_ASSERT_MOCK_CALLS (mock_capabilities_get_exp,1 ); + +return TEST_SUCCESS ; +} +/** * Declaration of testcases */
@@ -2410,6 +2543,12 @@ static struct unit_test_suite security_testsuite = { test_capability_get_pdcp_mismatch_domain),TEST_CASE_ST (ut_setup_with_session, ut_teardown, test_capability_get_pdcp_match), +TEST_CASE_ST (ut_setup_with_session, ut_teardown, + test_capability_get_docsis_mismatch_direction), +TEST_CASE_ST (ut_setup_with_session, ut_teardown, + test_capability_get_docsis_mismatch_crc_len), +TEST_CASE_ST (ut_setup_with_session, ut_teardown, + test_capability_get_docsis_match), TEST_CASES_END() /**< NULL terminate unit test array */ }
Signature · 1 line
2.17.1
Re: [dpdk-dev] [PATCH v2 0/6] add support for DOCSIS protocol
In reply to David CoyleQuoted 8 lines · David Coyle
A number of approaches to combine DOCSIS Crypto and CRC functions have been discussed in the DPDK community to date, namely:
1) adding a newrte_acceleratorAPI, to provide a generic interface for combining operations of different types
2) using rawdev through a multi-function interface, again to provide a generic interface for combining operations of different types
3) adding support for DOCSIS Crypto-CRC torte_security
Quoted 7 lines
The third option above is the preferred approach for the following reasons:
- it addresses the immediate use case to add DOCSIS Crypto-CRC support to DPDK so that it can be consumed easily by cable equipment vendors
- it uses an already existing framework in DPDK
- it will mean much less code churn in DOCSIS applications, which already userte_cryptodevfor encryption/decryption
I guess https://patchwork.dpdk.org/project/dpdk/list/?series=9304 can be marked Superseded then.
Thanks.
Signature · 1 line
David Marchand
Re: [dpdk-dev] [PATCH v2 0/6] add support for DOCSIS protocol
Quoted 23 lines
-----Original Message-----
From: David Marchand <[email protected]>
Sent: Tuesday, June 23, 2020 3:52 PMQuoted 1 line
A number of approaches to combine DOCSIS Crypto and CRC functions
have
Quoted 7 lines
been discussed in the DPDK community to date, namely:
1) adding a newrte_acceleratorAPI, to provide a generic interface for combining operations of different types
2) using rawdev through a multi-function interface, again to provide a generic interface for combining operations of different types
3) adding support for DOCSIS Crypto-CRC torte_securityQuoted 7 lines
The third option above is the preferred approach for the following reasons:
- it addresses the immediate use case to add DOCSIS Crypto-CRC support to DPDK so that it can be consumed easily by cable equipment vendors
- it uses an already existing framework in DPDK
- it will mean much less code churn in DOCSIS applications, which already userte_cryptodevfor encryption/decryption
Quoted 3 lines
I guess https://patchwork.dpdk.org/project/dpdk/list/?series=9304 can be marked Superseded then.
Thanks.
[DC] Yes it can - I have tried to set it to Superseded but don't have permissions to do that - guess one of the Maintainers needs to do that.
Quoted 3 lines
--
David Marchand
Re: [dpdk-dev] [PATCH v2 0/6] add support for DOCSIS protocol
Quoted 6 lines · David
Quoted 3 lines
I guess https://patchwork.dpdk.org/project/dpdk/list/?series=9304 can be marked Superseded then.
Thanks.[DC] Yes it can - I have tried to set it to Superseded but don't have permissions to do that - guess one of the Maintainers needs to do that.
You need to be logged in patchwork and have the same mail address that sent the series attached to your account.
Signature · 1 line
David Marchand
Re: [dpdk-dev] [PATCH v2 0/6] add support for DOCSIS protocol
Quoted 7 lines
-----Original Message-----
From: David Marchand <[email protected]>
Sent: Tuesday, June 23, 2020 4:39 PMQuoted 4 lines
Quoted 3 lines
I guess https://patchwork.dpdk.org/project/dpdk/list/?series=9304
can be marked Superseded then.
Thanks.
Quoted 6 lines
Quoted 2 lines
[DC] Yes it can - I have tried to set it to Superseded but don't have permissions to do that - guess one of the Maintainers needs to do that.
You need to be logged in patchwork and have the same mail address that sent the series attached to your account.
[DC] I have tried attach my email address to my account but I think Intel has some blocker on emails coming from patchwork, so I'm not receiving the confirmation email. This same problem with emails getting blocked also hit me before when I originally signed up to patchwork.
Thanks for the info on this btw.
Re: [dpdk-dev] [PATCH v2 0/6] add support for DOCSIS protocol
Quoted 11 lines · David
Quoted 11 lines
-----Original Message-----
From: David Marchand <[email protected]>
Sent: Tuesday, June 23, 2020 4:39 PMQuoted 6 lines
Quoted 3 lines
I guess https://patchwork.dpdk.org/project/dpdk/list/?series=9304
can be marked Superseded then.
Thanks.[DC] Yes it can - I have tried to set it to Superseded but don't have permissions to do that - guess one of the Maintainers needs to do that.
Quoted 7 lines
Quoted 3 lines
You need to be logged in patchwork and have the same mail address that sent the series attached to your account.
[DC] I have tried attach my email address to my account but I think Intel has some blocker on emails coming from patchwork, so I'm not receiving the confirmation email. This same problem with emails getting blocked also hit me before when I originally signed up to patchwork.
I saw some offlist exchanges about this.
It might be the right time to push your IT about this issue :-).
I marked the series as superseded.
Signature · 1 line
David Marchand
Re: [dpdk-dev] [PATCH v2 0/6] add support for DOCSIS protocol
Quoted 16 lines
-----Original Message-----
From: David Marchand <[email protected]>
Sent: Tuesday, June 23, 2020 5:22 PM
To: Coyle, David <[email protected]>Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 4 lines
I guess
https://patchwork.dpdk.org/project/dpdk/list/?series=9304
can be marked Superseded then.
Thanks.[DC] Yes it can - I have tried to set it to Superseded but don't have permissions to do that - guess one of the Maintainers needs to do
that.
Quoted 4 lines
Quoted 4 lines
You need to be logged in patchwork and have the same mail address that sent the series attached to your account.
Quoted 8 lines
Quoted 2 lines
[DC] I have tried attach my email address to my account but I think Intel has some blocker on emails coming from patchwork, so I'm not
receiving the confirmation email.
Quoted 2 lines
This same problem with emails getting blocked also hit me before when I originally signed up to patchwork.
I saw some offlist exchanges about this.
It might be the right time to push your IT about this issue :-).
[DC] I think you are right - I will try get this resolved.
Quoted 2 lines
I marked the series as superseded.
[DC] Thank you for doing that and apologies for the inconvenience.
Re: [dpdk-dev] [PATCH v2 2/6] security: add support for DOCSIS protocol
In reply to David CoyleQuoted 30 lines
-----Original Message-----
From: Coyle, David <[email protected]>
Sent: Tuesday, June 23, 2020 11:14 AM
To: [email protected]; Doherty, Declan <[email protected]>; De Lara Guarch, Pablo <[email protected]>; Trahe, Fiona <[email protected]>; Zhang, Roy Fan <[email protected]>; Ananyev, Konstantin <[email protected]>
Cc: [email protected]; [email protected]; Yigit, Ferruh <[email protected]>; Ryan, Brendan <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Richardson, Bruce <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Coyle, David <[email protected]>; O'loingsigh, Mairtin <[email protected]>
Subject: [PATCH v2 2/6] security: add support for DOCSIS protocolAdd support for DOCSIS protocol to
rte_securitylibrary. This support currently comprises the combination of Crypto and CRC operations.A security operation definition is also added. This allow security protocol related parameters be specified at the operation level. For DOCSIS, these parameters include CRC length and offset. The security operation is accessed via a crypto operation.
Signed-off-by David Coyle <[email protected]>Signed-off-by Mairtin o Loingsigh <[email protected]>
...
Quoted 15 lines
+++
b/lib/librte_security/rte_security.hlib/librte_security/rte_security.h +10
-0@@ -293,6 +293,30 @@ struct rte_security_pdcp_xform {uint32_t hfn_ovrd; }; +/** DOCSIS direction */ +enum rte_security_docsis_direction { +RTE_SECURITY_DOCSIS_UPLINK , +/**< Uplink +* - Decryption, followed by CRC Verification +*/ +RTE_SECURITY_DOCSIS_DOWNLINK , +/**< Downlink +* - CRC Generation, followed by Encryption +*/
lib/librte_security/rte_security.h struct rte_security_pdcp_xform { · line 315
Quoted 10 lines
lib/librte_security/rte_security.h +10
-0+}; + +/** +* DOCSIS security session configuration. +* +* This structure contains data required to create a DOCSIS security session. +*/ +struct rte_security_docsis_xform { +enum rte_security_docsis_direction direction; +/** DOCSIS direction */
Missing "<" here.
Re: [dpdk-dev] [PATCH v2 3/6] crypto/aesni_mb: add support for DOCSIS protocol
In reply to David CoyleHi David,
Quoted 24 lines
-----Original Message-----
From: Coyle, David <[email protected]>
Sent: Tuesday, June 23, 2020 11:14 AM
To: [email protected]; Doherty, Declan <[email protected]>; De Lara Guarch, Pablo <[email protected]>; Trahe, Fiona <[email protected]>; Zhang, Roy Fan <[email protected]>; Ananyev, Konstantin <[email protected]>
Cc: [email protected]; [email protected]; Yigit, Ferruh <[email protected]>; Ryan, Brendan <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Richardson, Bruce <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Coyle, David <[email protected]>; O'loingsigh, Mairtin <[email protected]>
Subject: [PATCH v2 3/6]crypto/aesni_mb: add support for DOCSIS protocolAdd support to the AESNI-MB PMD for the DOCSIS protocol, through the
rte_securityAPI. This, therefore, includes adding support for therte_securityAPI to this PMD.Signed-off-by David Coyle <[email protected]>Signed-off-by Mairtin o Loingsigh <[email protected]>
...
Quoted 6 lines
drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c +6
-0+static inline void +verify_docsis_sec_crc (JOB_AES_HMAC *job,uint16_t crc_len,uint8_t +*status) { +uint16_t crc_offset; +uint8_t *crc; +
drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c set_mb_job_params(JOB_AES_HMAC *job, struct aesni_mb_qp *qp, · line 1412
Quoted 10 lines
drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c +10
-0+if (!job->msg_len_to_hash_in_bytes) +return ; + + crc_offset = job->hash_start_src_offset_in_bytes + + job->msg_len_to_hash_in_bytes - + job->cipher_start_src_offset_in_bytes; + crc = job->dst + crc_offset; + +/* Verify CRC (at the end of the message) */ +if (memcmp (job->auth_tag_output, crc, crc_len) !=0 )
I'd say we can use direct RTE_ETHER_CRC_LEN here, as there is no other possible case, right? It should perform better.
Quoted 6 lines
drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c +2
-0+ *status =RTE_CRYPTO_OP_STATUS_AUTH_FAILED ; }#endif +static inline void verify_digest (JOB_AES_HMAC *job,void *digest,uint16_t len,uint8_t *status) {@@ -1196,9 +1452,27 @@ static inline struct rte_crypto_op * post_process_mb_job(struct aesni_mb_qp *qp, JOB_AES_HMAC *job) {
drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c static inline struct rte_crypto_op * · line 1459
Quoted 10 lines
drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c +6
-3struct rte_crypto_op *op = (struct rte_crypto_op *)job->user_data; -struct aesni_mb_session *sess =get_sym_session_private_data ( - op->sym->session, - cryptodev_driver_id); +struct aesni_mb_session *sess =NULL ; + +#ifdef AESNI_MB_DOCSIS_SEC_ENABLED +struct rte_security_op *sec_op =NULL ; + +if (unlikely (op->type ==RTE_CRYPTO_OP_TYPE_SECURITY )) {
Not sure if this unlikely is actually needed. I don't expect to have multiple types enqueued in the same queue, so this or the other branch will always be taken.
Quoted 9 lines
drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c +8
-0+/* +* Assuming at this point that if it's a security type op, that +* this is for DOCSIS +*/ + sec_op = (struct rte_security_op *)&op->security; +struct rte_crypto_sym_op *crypto_sym = + &sec_op->docsis.crypto_sym; + sess =get_sec_session_private_data (crypto_sym- >sec_session);
...
drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c aesni_mb_pmd_dequeue_burst(void *queue_pair, struct rte_crypto_op **ops, · line 1666
Quoted 3 lines
drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c +2
-1- retval =set_mb_job_params (job, qp, op, &digest_idx); +#ifdef AESNI_MB_DOCSIS_SEC_ENABLED +if (unlikely (op->type ==RTE_CRYPTO_OP_TYPE_SECURITY ))
Same comment as above.
Quoted 4 lines
drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c +4
-0+ retval =set_sec_mb_job_params (job, qp, op, + &digest_idx); + else +#endif
Re: [dpdk-dev] [PATCH v2 5/6] test/crypto: add DOCSIS security test cases
In reply to David CoyleHi David,
Quoted 24 lines
-----Original Message-----
From: Coyle, David <[email protected]>
Sent: Tuesday, June 23, 2020 11:14 AM
To: [email protected]; Doherty, Declan <[email protected]>; De Lara Guarch, Pablo <[email protected]>; Trahe, Fiona <[email protected]>; Zhang, Roy Fan <[email protected]>; Ananyev, Konstantin <[email protected]>
Cc: [email protected]; [email protected]; Yigit, Ferruh <[email protected]>; Ryan, Brendan <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Richardson, Bruce <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Coyle, David <[email protected]>; O'loingsigh, Mairtin <[email protected]>
Subject: [PATCH v2 5/6] test/crypto: add DOCSIS security test casesAdd uplink and downlink DOCSIS unit test cases and vectors, to test the combined DOCSIS Crypto-CRC support that has been added to the
rte_securityandrte_cryptodevlibraries.Signed-off-by David Coyle <[email protected]>Signed-off-by Mairtin o Loingsigh <[email protected]>
...
app/test/test_cryptodev.c test_PDCP_PROTO_all(void) · line 7750
Quoted 11 lines
app/test/test_cryptodev.c +11
-0+static int +test_docsis_proto_uplink (int i,struct docsis_test_data *d_td) +{ +struct rte_security_op *sec_op; +struct rte_security_docsis_op *doc_op; +struct crypto_testsuite_params *ts_params = &testsuite_params; +struct crypto_unittest_params *ut_params = &unittest_params; +uint8_t *plaintext, *ciphertext; +uint8_t *iv_ptr; +int cipher_len =0 ; +int crc_len =0 , crc_data_len;
Minor comment. These "int" should be "unsigned int", as they are not going to hold a negative value.
Quoted 1 line
(quoted diff) +1
-0+ int ret = TEST_SUCCESS;
Re: [dpdk-dev] [PATCH v2 2/6] security: add support for DOCSIS protocol
In reply to David CoyleHi David,
Quoted 59 lines
lib/librte_security/rte_security.h +38
-0+/** DOCSIS direction */ +enum rte_security_docsis_direction { +RTE_SECURITY_DOCSIS_UPLINK , +/**< Uplink +* - Decryption, followed by CRC Verification +*/ +RTE_SECURITY_DOCSIS_DOWNLINK , +/**< Downlink +* - CRC Generation, followed by Encryption +*/ +}; + +/** +* DOCSIS security session configuration. +* +* This structure contains data required to create a DOCSIS security session. +*/ +struct rte_security_docsis_xform { +enum rte_security_docsis_direction direction; +/** DOCSIS direction */ +uint16_t crc_size; +/**< CRC size in bytes */ +}; +/** * Security session action type. */ @@ -325,6 +349,8 @@ enum rte_security_session_protocol {/**< MACSec Protocol */ RTE_SECURITY_PROTOCOL_PDCP ,/**< PDCP Protocol */ + RTE_SECURITY_PROTOCOL_DOCSIS, + /**< DOCSIS Protocol */ };/** @@ -340,6 +366,7 @@ struct rte_security_session_conf {struct rte_security_ipsec_xform ipsec;struct rte_security_macsec_xform macsec;struct rte_security_pdcp_xform pdcp; +struct rte_security_docsis_xform docsis; };/**< Configuration parameters for security session */ struct rte_crypto_sym_xform *crypto_xform;@@ -355,6 +382,63 @@ struct rte_security_session {/**< Opaque user defined data */ }; +/** +* DOCSIS operation parameters +*/ +struct rte_security_docsis_op { +struct rte_crypto_sym_op crypto_sym; +/**< Symmetric crypto operation parameters */ + +struct { +uint16_t offset; +/**< +* Starting point for CRC processing, specified
lib/librte_security/rte_security.h struct rte_security_session { · line 405
Quoted 10 lines
lib/librte_security/rte_security.h +10
-0+* as the number of bytes from start of the packet in +* the source mbuf in crypto_sym +*/ +uint16_t length; +/**< +* The length, in bytes, of the source mbuf on which the +* CRC will be computed +*/ + } crc; +/**< CRC operation parameters */
As per my understanding, CRC is a kind of authentication. Can we reuse the fields of rte_crypto_sym_op Auth.data.offset and auth.data.length. This way you can save the unnecessary 4 bytes here. Probably add Comment in the structure definition that it can be used as offset and length for CRC.
And if you feel that reserved field is needed in near future, then you can add a proper name to it or else You can do away with the rte_security_docsis_op itself as there will be no other fields in it.
Quoted 113 lines
lib/librte_security/rte_security.h +36
-0+ +uint64_t reserved; +/**< Reserved for future use */ +}; + +/** +* Security operation types +*/ +enum rte_security_op_type { +RTE_SECURITY_OP_TYPE_DOCSIS =1 +/**< DOCSIS operation */ +}; + +/** +* Security operation parameters +* +* @note If the size of this struct changes, it may be also necessary to update +* the RTE_CRYPTO_OP_SECURITY_MAX_SZ define +*/ +struct rte_security_op { +enum rte_security_op_type type; +/**< Type of operation */ + RTE_STD_C11 + union { +struct rte_security_docsis_op docsis; + }; +/**< Parameters for security operation */ +}; + +/* Macro to check the size of a struct at compile time */ +#define _SECURITY_STRUCT_LEN_CHECK (n,X ) enum security_static_assert_enum_##X \ + { security_static_assert_##X = (n)/((sizeof(struct X) <= (n)) ? 1 : 0) } + +/* Check the size of the rte_security_op struct */ +_SECURITY_STRUCT_LEN_CHECK (RTE_CRYPTO_OP_SECURITY_MAX_SZ , rte_security_op); +/** * Create security session as specified by the session configuration *
lib/librte_security/rte_security.h +29
-4@@ -496,12 +580,22 @@ static inline int rte_security_attach_session(struct rte_crypto_op *op, struct rte_security_session *sess) { - if (unlikely(op->type != RTE_CRYPTO_OP_TYPE_SYMMETRIC)) - return -EINVAL; + struct rte_security_op *s_op; +int ret = -EINVAL ; + +if (likely (op->type ==RTE_CRYPTO_OP_TYPE_SYMMETRIC )) { + ret =__rte_security_attach_session (op->sym, sess); + }else if (op->type ==RTE_CRYPTO_OP_TYPE_SECURITY ) { + s_op = (struct rte_security_op *)&op->security; +if (s_op->type ==RTE_SECURITY_OP_TYPE_DOCSIS ) + ret =__rte_security_attach_session ( + &s_op->docsis.crypto_sym, + sess); + } op->sess_type =RTE_CRYPTO_OP_SECURITY_SESSION ; -return __rte_security_attach_session (op->sym, sess); +return ret; } struct rte_security_macsec_stats {@@ -523,6 +617,10 @@ struct rte_security_pdcp_stats {uint64_t reserved; }; +struct rte_security_docsis_stats { +uint64_t reserved; +}; +struct rte_security_stats {enum rte_security_session_protocol protocol;/**< Security protocol to be configured */ @@ -532,6 +630,7 @@ struct rte_security_stats {struct rte_security_macsec_stats macsec;struct rte_security_ipsec_stats ipsec;struct rte_security_pdcp_stats pdcp; +struct rte_security_docsis_stats docsis; }; };@@ -591,6 +690,13 @@ struct rte_security_capability {/**< Capability flags, see RTE_SECURITY_PDCP_* */ } pdcp;/**< PDCP capability */ +struct { +enum rte_security_docsis_direction direction; +/**< DOCSIS direction */ +uint16_t crc_size; +/**< CRC size in bytes */ + } docsis; +/**< DOCSIS capability */ };const struct rte_cryptodev_capabilities *crypto_capabilities;@@ -649,6 +755,10 @@ struct rte_security_capability_idx {enum rte_security_pdcp_domain domain;uint32_t capa_flags; } pdcp; +struct { +enum rte_security_docsis_direction direction; +uint16_t crc_size; + } docsis; }; }; --2.17.1
Re: [dpdk-dev] [PATCH 2/3] cryptodev: add security operation to crypto operation
In reply to Ananyev, KonstantinHi Konstantin/David,
Quoted 69 lines
Hi David,
Quoted 34 lines
Quoted 34 lines
Quoted 34 lines
Quoted 34 lines
Quoted 5 lines
/** Status of crypto operation */ @@ -121,6 +123,13 @@ struct
rte_crypto_op{lib/librte_cryptodev/rte_crypto.h +0
-0struct rte_crypto_asym_op asym[0 ];lib/librte_cryptodev/rte_crypto.h struct rte_crypto_op {
Quoted 10 lines
lib/librte_cryptodev/rte_crypto.h +7
-0/**< Asymmetric operation parameters */ +#ifdef RTE_LIBRTE_SECURITY +uint8_t security[0 ]; +/**< Security operation parameters +* - Must be accessed through a rte_security_op pointer +*/ +#endif + };/**< operation specific parameters */ };Is there any point to have this extra level of indirection? Might be simply:
enum rte_crypto_op_type { ....(quoted diff) +1
-0+ RTE_CRYPTO_OP_TYPE_SEC_DOCSIS,};
...struct rte_crypto_op { .... __extension__ union { struct rte_crypto_sym_op sym[0]; /**< Symmetric operation parameters */ struct rte_crypto_asym_op asym[0]; /**< Asymmetric operation parameters */Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines
lib/librte_cryptodev/rte_crypto.h +1
-0+struct rte_security_docsis_op docsis[0 ]; };/**< operation specific parameters */ ?
[DC] This was to allow some form of extensibility and not to limit this to
just
Quoted 16 lines
Quoted 16 lines
DOCSIS.
Quoted 1 line
If it's felt that having the extra level of indirection is overkill, it can be easily
changed.
Quoted 4 lines
However, we cannot include a struct of type 'struct
rte_security_docsis_op' (or 'structrte_security_op') directly here, without creating nasty circular dependency of includes between
rte_cryptodevandrte_security.Quoted 4 lines
I had tried defining an opaque version 'struct
rte_security_op' (i.e. no fields within the struct) here inrte_crypto.h, but the compiler complained that it couldn't determine the size of the struct, even thoughit's a zero length array.
Quoted 3 lines
That is why I had to use the
uint8_tin 'uint8_tsecurity[0];' - I don't like this, but I couldn't find another way that kept the compiler happyQuoted 7 lines
Quoted 6 lines
and didn't create a circular dependency.
I see... would it be an option to name this struct 'struct
rte_sym_docsis_opand and move actual definition insidelib/librte_cryptodev/rte_crypto_sym.h?[DC] It's certainly an option and would work but I don't think it's a good idea to
be putting
Quoted 1 line
protocol specific structs like this in
rte_cryptodev- that's whatrte_securityis
Quoted 8 lines
for.
Quoted 1 line
Do you think it would be ok to do this?
I personally don't see a problem with this.
In fact, as an extra thought - why we can't have docsis xform defined inlib/librte_cryptodev/rte_crypto_sym.htoo, and then just have it as a member inside structrte_crypto_sym_xformunion?
Then we can haverte_cryptodev_sym_sessionthat supports docsis stuff.
Adding DOCSIS alone is not an issue in the cryptodev. The intent of this patchset and Previous RFCs was chaining of two - DOCSIS and CRC which are supposed to be separate Blocks and we need a way to combine the two and use it in the application. rte_security provides a way to handle such protocols for algo combinations. However, IMO we do not really need a separate rte_security_docsis_op structure, As it has parameters which are already there in the rte_crypto_sym_op. This new op Struct is just adding extra bytes which can be avoided if we use sym_op->auth.data.offset And sym_op->auth.data.length in place of crc offset and crc length.
We may just need to add comment in the struct definition about its usage for CRC cases.
Quoted 5 lines
Quoted 3 lines
I'd be interested to hear what cryptodev/security maintainers and others think
too.
Quoted 1 line
Akhil/Declan - any thoughts on best approach here?
Re: [dpdk-dev] [PATCH 2/3] cryptodev: add security operation to crypto operation
Hi Akhil
Quoted 27 lines
-----Original Message-----
From: Akhil Goyal <[email protected]>
Sent: Tuesday, June 23, 2020 7:38 PMQuoted 6 lines
Quoted 3 lines
Quoted 1 line
[DC] It's certainly an option and would work but I don't think it's a good idea to
be putting
Quoted 2 lines
protocol specific structs like this in
rte_cryptodev- that's whatrte_securityisQuoted 8 lines
for.
Quoted 1 line
Do you think it would be ok to do this?
I personally don't see a problem with this.
In fact, as an extra thought - why we can't have docsis xform defined inlib/librte_cryptodev/rte_crypto_sym.htoo, and then just have it as a member inside structrte_crypto_sym_xformunion?
Then we can haverte_cryptodev_sym_sessionthat supports docsis stuff.Adding DOCSIS alone is not an issue in the cryptodev. The intent of this patchset and Previous RFCs was chaining of two - DOCSIS and CRC which are supposed to be separate Blocks and we need a way to combine the two and use it in the application.
rte_securityprovides a way to handle such protocols for algo combinations. However, IMO we do not really need a separaterte_security_docsis_opstructure, As it has parameters which are already there in therte_crypto_sym_op. This new op Struct is just adding extra bytes which can be avoided if we usesym_op->auth.data.offsetAnd sym_op-
Quoted 4 lines
Quoted 1 line
auth.data.length in place of crc offset and crc length.
We may just need to add comment in the struct definition about its usage for CRC cases.
[DC] I take your point that introducing the rte_security_docsis_op (and the outer rte_security_op) structure is just adding extra bytes and as Konstantin mentioned, unnecessary levels of indirection. I am happy to go with the approach of using the auth offset and length from the sym_op for the CRC values, if there are no major objections from others on this. This simplifies things and also means we can now remove the 'uint8_t security[0]' field from rte_crypto_op which was never a nice thing.
Konstantin also suggested moving the docsis xform to cryptodev. However, I feel this would be a step too far for cryptodev and propose we keep the docsis xform in rte_security. It is then consistent with the other protocols like IPSec.
Re: [dpdk-dev] [PATCH v2 2/6] security: add support for DOCSIS protocol
In reply to Akhil GoyalHi Akhil,
Quoted 31 lines
-----Original Message-----
From: Akhil Goyal <[email protected]>
Sent: Tuesday, June 23, 2020 7:07 PMQuoted 12 lines
lib/librte_security/rte_security.h +11
-0+/** +* DOCSIS operation parameters +*/ +struct rte_security_docsis_op { +struct rte_crypto_sym_op crypto_sym; +/**< Symmetric crypto operation parameters */ + +struct { +uint16_t offset; +/**< +* Starting point for CRC processing, specified lib/librte_security/rte_security.h struct rte_security_session { · line 405
Quoted 10 lines
lib/librte_security/rte_security.h +10
-0+* as the number of bytes from start of the packet in +* the source mbuf in crypto_sym +*/ +uint16_t length; +/**< +* The length, in bytes, of the source mbuf on which the +* CRC will be computed +*/ + } crc; +/**< CRC operation parameters */ As per my understanding, CRC is a kind of authentication. Can we reuse the fields of
rte_crypto_sym_opAuth.data.offset and auth.data.length. This way you can save the unnecessary 4 bytes here. Probably add Comment in the structure definition that it can be used as offset and length for CRC.
Quoted 3 lines
And if you feel that reserved field is needed in near future, then you can add a proper name to it or else You can do away with the
rte_security_docsis_opitself as there will be no other fields in it.
[DC] As per my reply on the v1 patchset, I am happy to use the auth offset and length fields for CRC if there are no objections from others on this approach.
Strictly speaking, a CRC is not an authentication algorithm like the other auth algos in cryptodev - if it were we would have just added CRC as a new auth algo. However, using the auth offset and length fields of the crypto op does simplify things, removes unnecessary bytes and levels of indirection. It also means the 'uint8_t security[0]' field can be removed from rte_crypto_op.
The 'reserved' field was to accommodate other DOCSIS protocol features which could be offloaded in the future - such as the DOCSIS header checksum. For this feature, we would need to know the DOCSIS header length. The header length though is equal to the CRC offset, so we can get the header length that way. The reserved field and the entire rte_security_docsis_op can therefore be removed
Re: [dpdk-dev] [PATCH v2 3/6] crypto/aesni_mb: add support for DOCSIS protocol
In reply to De Lara Guarch, PabloHi Pablo, thank you for the comments
Quoted 16 lines
-----Original Message-----
From: De Lara Guarch, Pablo <[email protected]>
Sent: Tuesday, June 23, 2020 6:57 PMQuoted 12 lines
drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c +12
-0+static inline void +verify_docsis_sec_crc (JOB_AES_HMAC *job,uint16_t crc_len,uint8_t +*status) { +uint16_t crc_offset; +uint8_t *crc; + +if (!job->msg_len_to_hash_in_bytes) +return ; + + crc_offset = job->hash_start_src_offset_in_bytes + + job->msg_len_to_hash_in_bytes - + job->cipher_start_src_offset_in_bytes;
Quoted 8 lines
drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c set_mb_job_params(JOB_AES_HMAC *job, struct aesni_mb_qp *qp, · line 1412
Quoted 4 lines
drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c +4
-0+ crc = job->dst + crc_offset; + +/* Verify CRC (at the end of the message) */ +if (memcmp (job->auth_tag_output, crc, crc_len) !=0 )I'd say we can use direct
RTE_ETHER_CRC_LENhere, as there is no other possible case, right?
It should perform better.
[DC] You are correct - I have changed this to use RTE_ETHER_CRC_LEN.
I had been thinking about removing the crc_size from the rte_security_docsis_xform and the docsis capabilities completely and your comment here has made me realize I should do this, as there is only 1 CRC length that can be used for DOCSIS. So these have been removed.
These changes will be in v3 early next week
Quoted 13 lines
Quoted 13 lines
drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c +2
-0+ *status =RTE_CRYPTO_OP_STATUS_AUTH_FAILED ; }#endif +static inline void verify_digest(JOB_AES_HMAC *job, void *digest, uint16_t len, uint8_t*status) { @@ -1196,9 +1452,27 @@ static inline struct
rte_crypto_op
*post_process_mb_job(struct aesni_mb_qp *qp, JOB_AES_HMAC *job){drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c +2
-3struct rte_crypto_op *op = (struct rte_crypto_op *)job->user_data; -struct aesni_mb_session *sess =get_sym_session_private_data ( - op->sym->session, - cryptodev_driver_id); +struct aesni_mb_session *sess =NULL ; +
Quoted 8 lines
drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c static inline struct rte_crypto_op * · line 1460
Quoted 4 lines
drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c +4
-0+#ifdef AESNI_MB_DOCSIS_SEC_ENABLED +struct rte_security_op *sec_op =NULL ; + +if (unlikely (op->type ==RTE_CRYPTO_OP_TYPE_SECURITY )) {Not sure if this unlikely is actually needed. I don't expect to have multiple types enqueued in the same queue, so this or the other branch will always be taken.
[DC] That's a fair point - I have removed the unlikely Again, the change will be available in v3
Quoted 12 lines
Quoted 11 lines
drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c +7
-0+/* +* Assuming at this point that if it's a security type op, that +* this is for DOCSIS +*/ + sec_op = (struct rte_security_op *)&op->security; +struct rte_crypto_sym_op *crypto_sym = + &sec_op-docsis.crypto_sym;
(quoted diff) +1
-0+ sess = get_sec_session_private_data(crypto_sym-Quoted 1 line
sec_session);
Quoted 7 lines
...
drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c aesni_mb_pmd_dequeue_burst(void *queue_pair, struct rte_crypto_op **ops, · line 1666
Quoted 3 lines
drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c +2
-1- retval =set_mb_job_params (job, qp, op, &digest_idx); +#ifdef AESNI_MB_DOCSIS_SEC_ENABLED +if (unlikely (op->type ==RTE_CRYPTO_OP_TYPE_SECURITY ))Same comment as above.
[DC] Same reply as above. :)
Quoted 5 lines
Quoted 5 lines
drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c +4
-0+ retval =set_sec_mb_job_params (job, qp, op, + &digest_idx); + else +#endif
Re: [dpdk-dev] [PATCH v2 5/6] test/crypto: add DOCSIS security test cases
In reply to De Lara Guarch, PabloHi Pablo
Quoted 4 lines
-----Original Message-----
From: De Lara Guarch, Pablo <[email protected]>
Sent: Tuesday, June 23, 2020 7:04 PM
Quoted 13 lines
app/test/test_cryptodev.c test_PDCP_PROTO_all(void) · line 7750
Quoted 10 lines
app/test/test_cryptodev.c +10
-0+static int +test_docsis_proto_uplink (int i,struct docsis_test_data *d_td) { +struct rte_security_op *sec_op; +struct rte_security_docsis_op *doc_op; +struct crypto_testsuite_params *ts_params = &testsuite_params; +struct crypto_unittest_params *ut_params = &unittest_params; +uint8_t *plaintext, *ciphertext; +uint8_t *iv_ptr; +int cipher_len =0 ; +int crc_len =0 , crc_data_len;Minor comment. These "int" should be "unsigned int", as they are not going to hold a negative value.
[DC] Kind of correct, but not fully.
There are some calculations further down which subtract cipher_offset, crc_offset and RTE_ETHER_CRC_LEN from the overall buffer size, which could (if test cases aren't setup correctly) make the results negative. These results get put into the cipher_len and crc_len variables. If the result is negative, it just gets reset to 0. This was just handier than having if/else checks below. I don't see any major issue with this.
The crc_data_len variable can only have positive values though, so I have changed that to a uint32_t
Updates will be in v3 early next week
Quoted 2 lines
Quoted 2 lines
(quoted diff) +1
-0+ int ret = TEST_SUCCESS;
Re: [dpdk-dev] [PATCH v2 2/6] security: add support for DOCSIS protocol
In reply to De Lara Guarch, PabloHi Pablo
Quoted 6 lines
-----Original Message-----
From: De Lara Guarch, Pablo <[email protected]>Quoted 4 lines
+/**
+ * DOCSIS security session configuration.
+ *
+ * This structure contains data required to create a DOCSIS security
Quoted 7 lines
session.
lib/librte_security/rte_security.h struct rte_security_pdcp_xform { · line 315
Quoted 4 lines
+ */
lib/librte_security/rte_security.h +3
-0+struct rte_security_docsis_xform { +enum rte_security_docsis_direction direction; +/** DOCSIS direction */ Missing "<" here.
[DC] Very good spot... will be fixed in v3
Quoted 1 line
v3 cover add support for DOCSIS protocol
In reply to David CoyleIntroduction
============
This patchset adds support for the DOCSIS protocol to the DPDK Security API (rte_security), to be used by the AESNI-MB and QAT crypto devices to combine and accelerate Crypto and CRC functions of the DOCSIS protocol into a single operation.
Performing these functions in parallel as a single operation can enable a significant performance improvement in a DPDK-based DOCSIS MAC pipeline.
Background
==========
A number of approaches to combine DOCSIS Crypto and CRC functions have been discussed in the DPDK community to date, namely:
1) adding a new rte_accelerator API, to provide a generic interface for combining operations of different types
2) using rawdev through a multi-function interface, again to provide a generic interface for combining operations of different types
3) adding support for DOCSIS Crypto-CRC to rte_security
The third option above is the preferred approach for the following reasons:
- it addresses the immediate use case to add DOCSIS Crypto-CRC support to DPDK so that it can be consumed easily by cable equipment vendors
- it uses an already existing framework in DPDK
- it will mean much less code churn in DOCSIS applications, which already use rte_cryptodev for encryption/decryption
Use Cases
=========
The primary use case for this proposal has already been mentioned, namely to add DOCSIS Crypto-CRC support to DPDK:
- DOCSIS MAC: Crypto-CRC
- Order:
- Downstream: CRC, Encrypt
- Upstream: Decrypt, CRC
- Specifications:
- Crypto: 128-bit and 256-bit AES-CFB encryption variant for DOCSIS as described in section 11.1 of DOCSIS 3.1 Security Specification
(https://apps.cablelabs.com/specification/CM-SP-SECv3.1)
- CRC: Ethernet 32-bit CRC as defined in Ethernet/[ISO/IEC 8802-3]
Note that support for these chained operations is already available in the Intel IPSec Multi-Buffer library.
However, other DOCSIS protocol functions could be optimized too in the future using the same rte_security API for DOCSIS (e.g. Header Checksum (HCS) calculation).
v3:
* removed rte_security_op definition
* now using rte_crypto_sym_op->auth.data fields for CRC offset and length as suggested by feedback from Akhil and Konstantin
* addressed Pablo's comments
* removed support for out-of-place for DOCSIS protocol from QAT PMD
* updated dpdk-crypto-perf-test tool for DOCSIS
* updated documentation
v2:
* added rte_security and rte_cryptodev code changes
* added AESNI MB crypto PMD code changes
* added QAT SYM crypto PMD code changes
* added crypto unit tests
* added security unit tests
v1:
* added proposed API changes
* added security capabilities to aesni_mb crypto PMD
David Coyle (8):
security: add support for DOCSIS protocol
cryptodev: add a note regarding DOCSIS protocol support crypto/aesni_mb: add support for DOCSIS protocol crypto/qat: add support for DOCSIS protocol test/crypto: add DOCSIS security test cases test/security: add DOCSIS capability check tests app/crypto-perf: add support for DOCSIS protocol
doc: add doc updates for DOCSIS security protocol
app/test-crypto-perf/cperf_ops.c | 82 +- app/test-crypto-perf/cperf_options.h | 5 +- app/test-crypto-perf/cperf_options_parsing.c | 67 +- app/test-crypto-perf/cperf_test_throughput.c | 3 +- app/test-crypto-perf/cperf_test_vectors.c | 3 +- app/test-crypto-perf/main.c | 5 +- app/test-crypto-perf/meson.build | 2 +- app/test/test_cryptodev.c | 513 ++++++ ...t_cryptodev_security_docsis_test_vectors.h | 1544 +++++++++++++++++ app/test/test_security.c | 88 + doc/guides/cryptodevs/aesni_mb.rst | 8 + doc/guides/cryptodevs/features/aesni_mb.ini | 1 + doc/guides/cryptodevs/features/qat.ini | 1 + doc/guides/cryptodevs/qat.rst | 7 + doc/guides/prog_guide/rte_security.rst | 114 +- doc/guides/rel_notes/release_20_08.rst | 16 + doc/guides/tools/cryptoperf.rst | 5 + drivers/common/qat/Makefile | 3 + .../crypto/aesni_mb/aesni_mb_pmd_private.h | 19 +- drivers/crypto/aesni_mb/meson.build | 2 +- drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c | 293 +++- .../crypto/aesni_mb/rte_aesni_mb_pmd_ops.c | 125 ++ drivers/crypto/qat/meson.build | 2 + drivers/crypto/qat/qat_sym.c | 70 +- drivers/crypto/qat/qat_sym.h | 69 +- drivers/crypto/qat/qat_sym_capabilities.h | 42 + drivers/crypto/qat/qat_sym_pmd.c | 53 +- drivers/crypto/qat/qat_sym_pmd.h | 4 + drivers/crypto/qat/qat_sym_session.c | 146 ++ drivers/crypto/qat/qat_sym_session.h | 12 + lib/librte_cryptodev/rte_crypto_sym.h | 14 + lib/librte_security/rte_security.c | 5 + lib/librte_security/rte_security.h | 38 + 33 files changed, 3328 insertions(+), 33 deletions(-) create mode 100644 app/test/test_cryptodev_security_docsis_test_vectors.h
Signature · 1 line
2.17.1
PATCH v3 1/8 security: add support for DOCSIS protocol
Add support for DOCSIS protocol to rte_security library. This support currently comprises the combination of Crypto and CRC operations.
--- lib/librte_security/rte_security.c | 5 ++++ lib/librte_security/rte_security.h | 38 ++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+)
lib/librte_security/rte_security.c +5 -0
@@ -173,6 +173,11 @@ rte_security_capability_get(struct rte_security_ctx *instance,if (capability->pdcp.domain == idx->pdcp.domain)return capability; + }else if (idx->protocol == +RTE_SECURITY_PROTOCOL_DOCSIS ) { +if (capability->docsis.direction == + idx->docsis.direction) +return capability; } } }
lib/librte_security/rte_security.h +38 -0
@@ -293,6 +293,28 @@ struct rte_security_pdcp_xform {uint32_t hfn_ovrd; }; +/** DOCSIS direction */ +enum rte_security_docsis_direction { +RTE_SECURITY_DOCSIS_UPLINK , +/**< Uplink +* - Decryption, followed by CRC Verification +*/ +RTE_SECURITY_DOCSIS_DOWNLINK , +/**< Downlink +* - CRC Generation, followed by Encryption +*/ +}; + +/** +* DOCSIS security session configuration. +* +* This structure contains data required to create a DOCSIS security session. +*/ +struct rte_security_docsis_xform { +enum rte_security_docsis_direction direction; +/**< DOCSIS direction */ +}; +/** * Security session action type. */
@@ -325,6 +347,8 @@ enum rte_security_session_protocol {/**< MACSec Protocol */ RTE_SECURITY_PROTOCOL_PDCP ,/**< PDCP Protocol */ + RTE_SECURITY_PROTOCOL_DOCSIS, + /**< DOCSIS Protocol */ };/**
@@ -340,6 +364,7 @@ struct rte_security_session_conf {struct rte_security_ipsec_xform ipsec;struct rte_security_macsec_xform macsec;struct rte_security_pdcp_xform pdcp; +struct rte_security_docsis_xform docsis; };/**< Configuration parameters for security session */ struct rte_crypto_sym_xform *crypto_xform;
@@ -523,6 +548,10 @@ struct rte_security_pdcp_stats {uint64_t reserved; }; +struct rte_security_docsis_stats { +uint64_t reserved; +}; +struct rte_security_stats {enum rte_security_session_protocol protocol;/**< Security protocol to be configured */
@@ -532,6 +561,7 @@ struct rte_security_stats {struct rte_security_macsec_stats macsec;struct rte_security_ipsec_stats ipsec;struct rte_security_pdcp_stats pdcp; +struct rte_security_docsis_stats docsis; }; };
@@ -591,6 +621,11 @@ struct rte_security_capability {/**< Capability flags, see RTE_SECURITY_PDCP_* */ } pdcp;/**< PDCP capability */ +struct { +enum rte_security_docsis_direction direction; +/**< DOCSIS direction */ + } docsis; +/**< DOCSIS capability */ };const struct rte_cryptodev_capabilities *crypto_capabilities;
@@ -649,6 +684,9 @@ struct rte_security_capability_idx {enum rte_security_pdcp_domain domain;uint32_t capa_flags; } pdcp; +struct { +enum rte_security_docsis_direction direction; + } docsis; }; };
Signature · 1 line
2.17.1
PATCH v3 2/8 cryptodev: add a note regarding DOCSIS protocol support
In reply to David CoyleAdd a note to the rte_crypto_sym_op->auth.data fields to state that for DOCSIS security protocol, these are used to specify the CRC offset and length.
--- lib/librte_cryptodev/rte_crypto_sym.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
lib/librte_cryptodev/rte_crypto_sym.h +14 -0
@@ -705,6 +705,14 @@ struct rte_crypto_sym_op {* For KASUMI @ RTE_CRYPTO_AUTH_KASUMI_F9, * this offset should be such that * data to authenticate starts at COUNT. +* +* @note +* For DOCSIS security protocol, this +* offset is the DOCSIS header length +* and, therefore, also the CRC offset +* i.e. the number of bytes into the +* packet at which CRC calculation +* should begin. */ uint32_t length;/**< The message length, in bytes, of the source
@@ -723,6 +731,12 @@ struct rte_crypto_sym_op {* the length should include the COUNT, * FRESH, message, direction bit and padding * (to be multiple of 8 bits). +* +* @note +* For DOCSIS security protocol, this +* is the CRC length i.e. the number of +* bytes in the packet over which the +* CRC should be calculated */ } data;/**< Data offsets and length for authentication */
Signature · 1 line
2.17.1
PATCH v3 3/8 crypto/aesni_mb: add support for DOCSIS protocol
In reply to David CoyleAdd support to the AESNI-MB PMD for the DOCSIS protocol, through the rte_security API. This, therefore, includes adding support for the rte_security API to this PMD.
--- .../crypto/aesni_mb/aesni_mb_pmd_private.h | 19 +- drivers/crypto/aesni_mb/meson.build | 2 +- drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c | 293 +++++++++++++++++- .../crypto/aesni_mb/rte_aesni_mb_pmd_ops.c | 125 ++++++++ 4 files changed, 432 insertions(+), 7 deletions(-)
drivers/crypto/aesni_mb/aesni_mb_pmd_private.h +18 -1
@@ -7,6 +7,12 @@#include <intel-ipsec-mb.h> +#if defined(RTE_LIBRTE_SECURITY ) && (IMB_VERSION_NUM ) >=IMB_VERSION (0 ,54 ,0 ) +#define AESNI_MB_DOCSIS_SEC_ENABLED 1 +#include <rte_security.h> +#include <rte_security_driver.h> +#endif +enum aesni_mb_vector_mode {RTE_AESNI_MB_NOT_SUPPORTED =0 ,RTE_AESNI_MB_SSE ,
@@ -272,8 +278,19 @@ aesni_mb_set_session_parameters(const MB_MGR *mb_mgr,struct aesni_mb_session *sess, const struct rte_crypto_sym_xform *xform); -/** device specific operations function pointer structure */ +#ifdef AESNI_MB_DOCSIS_SEC_ENABLED +extern int +aesni_mb_set_docsis_sec_session_parameters ( + __rte_unused struct rte_cryptodev *dev, +struct rte_security_session_conf *conf, +void *sess); +#endif + +/** device specific operations function pointer structures */ extern struct rte_cryptodev_ops *rte_aesni_mb_pmd_ops; +#ifdef AESNI_MB_DOCSIS_SEC_ENABLED +extern struct rte_security_ops *rte_aesni_mb_pmd_sec_ops; +#endif extern uint32_t aesni_mb_cpu_crypto_process_bulk(struct rte_cryptodev *dev,
drivers/crypto/aesni_mb/meson.build +1 -1
@@ -22,4 +22,4 @@ else endif sources = files('rte_aesni_mb_pmd.c', 'rte_aesni_mb_pmd_ops.c') -deps += ['bus_vdev'] +deps += ['bus_vdev', 'net', 'security']
drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c +288 -5
347 lines not on this page · raw message
drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c +125 -0
140 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH v3 4/8 crypto/qat: add support for DOCSIS protocol
In reply to David CoyleAdd support to the QAT SYM PMD for the DOCSIS protocol, through the rte_security API. This, therefore, includes adding support for the rte_security API to this PMD.
--- drivers/common/qat/Makefile | 3 + drivers/crypto/qat/meson.build | 2 + drivers/crypto/qat/qat_sym.c | 70 ++++++++++- drivers/crypto/qat/qat_sym.h | 69 ++++++++-- drivers/crypto/qat/qat_sym_capabilities.h | 42 +++++++ drivers/crypto/qat/qat_sym_pmd.c | 53 +++++++- drivers/crypto/qat/qat_sym_pmd.h | 4 + drivers/crypto/qat/qat_sym_session.c | 146 ++++++++++++++++++++++ drivers/crypto/qat/qat_sym_session.h | 12 ++ 9 files changed, 389 insertions(+), 12 deletions(-)
drivers/common/qat/Makefile +3 -0
@@ -35,6 +35,9 @@ endif ifeq ($(CONFIG_RTE_LIBRTE_PMD_QAT_SYM),y) LDLIBS += -lrte_cryptodev LDLIBS += -lcrypto +ifeq ($(CONFIG_RTE_LIBRTE_SECURITY),y) + LDLIBS += -lrte_net +endif CFLAGS += -DBUILD_QAT_SYM SRCS-y += qat_sym.c SRCS-y += qat_sym_session.c
drivers/crypto/qat/meson.build +2 -0
@@ -8,6 +8,8 @@ reason = '' # sentinal value to suppress printout dep = dependency('libcrypto', required: false) qat_includes += include_directories('.') qat_deps += 'cryptodev' +qat_deps += 'net' +qat_deps += 'security' if dep.found() # Add our sources files to the list qat_sources += files('qat_sym_pmd.c',
drivers/crypto/qat/qat_sym.c +66 -4
102 lines not on this page · raw message
drivers/crypto/qat/qat_sym.h +62 -7
97 lines not on this page · raw message
drivers/crypto/qat/qat_sym_capabilities.h +42 -0
46 lines not on this page · raw message
drivers/crypto/qat/qat_sym_pmd.c +52 -1
83 lines not on this page · raw message
drivers/crypto/qat/qat_sym_pmd.h +4 -0
@@ -7,7 +7,11 @@#ifdef BUILD_QAT_SYM +#include <rte_ether.h> #include <rte_cryptodev.h> +#ifdef RTE_LIBRTE_SECURITY +#include <rte_security.h> +#endif #include "qat_sym_capabilities.h" #include "qat_device.h"
drivers/crypto/qat/qat_sym_session.c +146 -0
155 lines not on this page · raw message
drivers/crypto/qat/qat_sym_session.h +12 -0
@@ -6,6 +6,9 @@#include <rte_crypto.h> #include <rte_cryptodev_pmd.h> +#ifdef RTE_LIBRTE_SECURITY +#include <rte_security.h> +#endif #include "qat_common.h" #include "icp_qat_hw.h"
@@ -156,4 +159,13 @@ qat_cipher_get_block_size(enum icp_qat_hw_cipher_algo qat_cipher_alg);int qat_sym_validate_zuc_key (int key_len,enum icp_qat_hw_cipher_algo *alg); +#ifdef RTE_LIBRTE_SECURITY +int +qat_security_session_create (void *dev,struct rte_security_session_conf *conf, +struct rte_security_session *sess,struct rte_mempool *mempool); +int +qat_security_session_destroy(void *dev __rte_unused, +struct rte_security_session *sess); +#endif +#endif /* _QAT_SYM_SESSION_H_ */
Signature · 1 line
2.17.1
PATCH v3 5/8 test/crypto: add DOCSIS security test cases
In reply to David CoyleAdd uplink and downlink DOCSIS unit test cases and vectors, to test the combined DOCSIS Crypto-CRC support that has been added to the rte_security library.
--- app/test/test_cryptodev.c | 513 ++++++ ...t_cryptodev_security_docsis_test_vectors.h | 1544 +++++++++++++++++ 2 files changed, 2057 insertions(+) create mode 100644 app/test/test_cryptodev_security_docsis_test_vectors.h
app/test/test_cryptodev.c +513 -0
@@ -11,6 +11,7 @@#include <rte_memcpy.h> #include <rte_pause.h> #include <rte_bus_vdev.h> +#include <rte_ether.h> #include <rte_crypto.h> #include <rte_cryptodev.h>
@@ -42,6 +43,7 @@#ifdef RTE_LIBRTE_SECURITY #include "test_cryptodev_security_pdcp_test_vectors.h" #include "test_cryptodev_security_pdcp_test_func.h" +#include "test_cryptodev_security_docsis_test_vectors.h" #endif #define VDEV_ARGS_SIZE 100
@@ -72,6 +74,9 @@ struct crypto_unittest_params {struct rte_crypto_sym_xform cipher_xform;struct rte_crypto_sym_xform auth_xform;struct rte_crypto_sym_xform aead_xform; +#ifdef RTE_LIBRTE_SECURITY +struct rte_security_docsis_xform docsis_xform; +#endif union {struct rte_cryptodev_sym_session *sess;
@@ -7067,6 +7072,34 @@ test_authenticated_encryption(const struct aead_test_data *tdata) }#ifdef RTE_LIBRTE_SECURITY +static int +security_proto_supported (enum rte_security_session_protocol proto) +{ +struct crypto_testsuite_params *ts_params = &testsuite_params; + +const struct rte_security_capability *capabilities; +const struct rte_security_capability *capability; +uint16_t i =0 ; + +struct rte_security_ctx *ctx = (struct rte_security_ctx *) +rte_cryptodev_get_sec_ctx ( + ts_params->valid_devs[0 ]); + + + capabilities =rte_security_capabilities_get (ctx); + +if (capabilities ==NULL ) +return -ENOTSUP ; + +while ((capability = &capabilities[i++])->action != +RTE_SECURITY_ACTION_TYPE_NONE ) { +if (capability->protocol == proto) +return 0 ; + } + +return -ENOTSUP ; +} +/* Basic algorithm run function for async inplace mode. * Creates a session from input parameters and runs one operation * on input_vec. Checks the output of the crypto operation against
@@ -7670,6 +7703,9 @@ test_PDCP_PROTO_all(void)if (!(feat_flags &RTE_CRYPTODEV_FF_SECURITY ))return -ENOTSUP ; +if (security_proto_supported (RTE_SECURITY_PROTOCOL_PDCP ) <0 ) +return -ENOTSUP ; + status =test_PDCP_PROTO_cplane_encap_all (); status +=test_PDCP_PROTO_cplane_decap_all (); status +=test_PDCP_PROTO_uplane_encap_all ();
@@ -7684,6 +7720,481 @@ test_PDCP_PROTO_all(void) else return TEST_SUCCESS; } + +static int +test_docsis_proto_uplink (int i,struct docsis_test_data *d_td) +{ +struct crypto_testsuite_params *ts_params = &testsuite_params; +struct crypto_unittest_params *ut_params = &unittest_params; +uint8_t *plaintext, *ciphertext; +uint8_t *iv_ptr; +int32_t cipher_len, crc_len; +uint32_t crc_data_len; +int ret =TEST_SUCCESS ; + +struct rte_security_ctx *ctx = (struct rte_security_ctx *) +rte_cryptodev_get_sec_ctx ( + ts_params->valid_devs[0 ]); + +/* Verify the capabilities */ +struct rte_security_capability_idx sec_cap_idx; +const struct rte_security_capability *sec_cap; +const struct rte_cryptodev_capabilities *crypto_cap; +const struct rte_cryptodev_symmetric_capability *sym_cap; +int j =0 ; + + sec_cap_idx.action =RTE_SECURITY_ACTION_TYPE_LOOKASIDE_PROTOCOL ; + sec_cap_idx.protocol =RTE_SECURITY_PROTOCOL_DOCSIS ; + sec_cap_idx.docsis.direction =RTE_SECURITY_DOCSIS_UPLINK ; + + sec_cap =rte_security_capability_get (ctx, &sec_cap_idx); +if (sec_cap ==NULL ) +return -ENOTSUP ; + +while ((crypto_cap = &sec_cap->crypto_capabilities[j++])->op != +RTE_CRYPTO_OP_TYPE_UNDEFINED ) { +if (crypto_cap->op ==RTE_CRYPTO_OP_TYPE_SYMMETRIC && + crypto_cap->sym.xform_type == +RTE_CRYPTO_SYM_XFORM_CIPHER && + crypto_cap->sym.cipher.algo == +RTE_CRYPTO_CIPHER_AES_DOCSISBPI ) { + sym_cap = &crypto_cap->sym; +if (rte_cryptodev_sym_capability_check_cipher (sym_cap, + d_td->key.len, + d_td->iv.len) ==0 ) +break ; + } + } + +if (crypto_cap->op ==RTE_CRYPTO_OP_TYPE_UNDEFINED ) +return -ENOTSUP ; + +/* Setup source mbuf payload */ + ut_params->ibuf =rte_pktmbuf_alloc (ts_params->mbuf_pool); + memset(rte_pktmbuf_mtod(ut_params->ibuf, uint8_t *), 0, +rte_pktmbuf_tailroom (ut_params->ibuf)); + + ciphertext = (uint8_t *)rte_pktmbuf_append (ut_params->ibuf, + d_td->ciphertext.len); + +memcpy (ciphertext, d_td->ciphertext.data, d_td->ciphertext.len); + +/* Set session action type */ + ut_params->type =RTE_SECURITY_ACTION_TYPE_LOOKASIDE_PROTOCOL ; + +/* Setup cipher session parameters */ + ut_params->cipher_xform.type =RTE_CRYPTO_SYM_XFORM_CIPHER ; + ut_params->cipher_xform.cipher.algo =RTE_CRYPTO_CIPHER_AES_DOCSISBPI ; + ut_params->cipher_xform.cipher.op =RTE_CRYPTO_CIPHER_OP_DECRYPT ; + ut_params->cipher_xform.cipher.key.data = d_td->key.data; + ut_params->cipher_xform.cipher.key.length = d_td->key.len; + ut_params->cipher_xform.cipher.iv.length = d_td->iv.len; + ut_params->cipher_xform.cipher.iv.offset =IV_OFFSET ; + ut_params->cipher_xform.next =NULL ; + +/* Setup DOCSIS session parameters */ + ut_params->docsis_xform.direction =RTE_SECURITY_DOCSIS_UPLINK ; + +struct rte_security_session_conf sess_conf = { + .action_type = ut_params->type, + .protocol =RTE_SECURITY_PROTOCOL_DOCSIS , + .docsis = ut_params->docsis_xform, + .crypto_xform = &ut_params->cipher_xform, + }; + +/* Create security session */ + ut_params->sec_session =rte_security_session_create (ctx, &sess_conf, + ts_params->session_priv_mpool); + +if (!ut_params->sec_session) { +printf ("TestCase %s(%d) line %d: %s\n" , + __func__, i, __LINE__,"failed to allocate session" ); + ret =TEST_FAILED ; + goto on_err; + } + +/* Generate crypto op data structure */ + ut_params->op =rte_crypto_op_alloc (ts_params->op_mpool, +RTE_CRYPTO_OP_TYPE_SYMMETRIC ); +if (!ut_params->op) { +printf ("TestCase %s(%d) line %d: %s\n" , + __func__, i, __LINE__, +"failed to allocate symmetric crypto operation" ); + ret =TEST_FAILED ; + goto on_err; + } + +/* Setup CRC operation parameters */ + crc_len = d_td->ciphertext.no_crc == false ? + (d_td->ciphertext.len - + d_td->ciphertext.crc_offset - +RTE_ETHER_CRC_LEN ) : +0 ; + crc_len = crc_len >0 ? crc_len :0 ; + crc_data_len = crc_len ==0 ?0 :RTE_ETHER_CRC_LEN ; + ut_params->op->sym->auth.data.length = crc_len; + ut_params->op->sym->auth.data.offset = d_td->ciphertext.crc_offset; + +/* Setup cipher operation parameters */ + cipher_len = d_td->ciphertext.no_cipher == false ? + (d_td->ciphertext.len - + d_td->ciphertext.cipher_offset) : +0 ; + cipher_len = cipher_len >0 ? cipher_len :0 ; + ut_params->op->sym->cipher.data.length = cipher_len; + ut_params->op->sym->cipher.data.offset = d_td->ciphertext.cipher_offset; + +/* Setup cipher IV */ + iv_ptr = (uint8_t *)ut_params->op +IV_OFFSET ; +rte_memcpy (iv_ptr, d_td->iv.data, d_td->iv.len); + +/* Attach session to operation */ +rte_security_attach_session (ut_params->op, ut_params->sec_session); + +/* Set crypto operation mbufs */ + ut_params->op->sym->m_src = ut_params->ibuf; + ut_params->op->sym->m_dst =NULL ; + +/* Process crypto operation */ +if (process_crypto_request (ts_params->valid_devs[0 ], ut_params->op) == +NULL ) { +printf ("TestCase %s(%d) line %d: %s\n" , + __func__, i, __LINE__, +"failed to process security crypto op" ); + ret =TEST_FAILED ; + goto on_err; + } + +if (ut_params->op->status !=RTE_CRYPTO_OP_STATUS_SUCCESS ) { +printf ("TestCase %s(%d) line %d: %s\n" , + __func__, i, __LINE__,"crypto op processing failed" ); + ret =TEST_FAILED ; + goto on_err; + } + +/* Validate plaintext */ + plaintext = ciphertext; + +if (memcmp (plaintext, d_td->plaintext.data, + d_td->plaintext.len - crc_data_len)) { +printf ("TestCase %s(%d) line %d: %s\n" , + __func__, i, __LINE__,"plaintext not as expected\n" ); +rte_hexdump (stdout,"expected" , d_td->plaintext.data, + d_td->plaintext.len); +rte_hexdump (stdout,"actual" , plaintext, d_td->plaintext.len); + ret =TEST_FAILED ; + goto on_err; + } + +on_err: +rte_crypto_op_free (ut_params->op); + ut_params->op =NULL ; + +if (ut_params->sec_session) +rte_security_session_destroy (ctx, ut_params->sec_session); + ut_params->sec_session =NULL ; + +rte_pktmbuf_free (ut_params->ibuf); + ut_params->ibuf =NULL ; + +return ret; +} + +static int +test_docsis_proto_downlink (int i,struct docsis_test_data *d_td) +{ +struct crypto_testsuite_params *ts_params = &testsuite_params; +struct crypto_unittest_params *ut_params = &unittest_params; +uint8_t *plaintext, *ciphertext; +uint8_t *iv_ptr; +int32_t cipher_len, crc_len; +int ret =TEST_SUCCESS ; + +struct rte_security_ctx *ctx = (struct rte_security_ctx *) +rte_cryptodev_get_sec_ctx ( + ts_params->valid_devs[0 ]); + +/* Verify the capabilities */ +struct rte_security_capability_idx sec_cap_idx; +const struct rte_security_capability *sec_cap; +const struct rte_cryptodev_capabilities *crypto_cap; +const struct rte_cryptodev_symmetric_capability *sym_cap; +int j =0 ; + + sec_cap_idx.action =RTE_SECURITY_ACTION_TYPE_LOOKASIDE_PROTOCOL ; + sec_cap_idx.protocol =RTE_SECURITY_PROTOCOL_DOCSIS ; + sec_cap_idx.docsis.direction =RTE_SECURITY_DOCSIS_DOWNLINK ; + + sec_cap =rte_security_capability_get (ctx, &sec_cap_idx); +if (sec_cap ==NULL ) +return -ENOTSUP ; + +while ((crypto_cap = &sec_cap->crypto_capabilities[j++])->op != +RTE_CRYPTO_OP_TYPE_UNDEFINED ) { +if (crypto_cap->op ==RTE_CRYPTO_OP_TYPE_SYMMETRIC && + crypto_cap->sym.xform_type == +RTE_CRYPTO_SYM_XFORM_CIPHER && + crypto_cap->sym.cipher.algo == +RTE_CRYPTO_CIPHER_AES_DOCSISBPI ) { + sym_cap = &crypto_cap->sym; +if (rte_cryptodev_sym_capability_check_cipher (sym_cap, + d_td->key.len, + d_td->iv.len) ==0 ) +break ; + } + } + +if (crypto_cap->op ==RTE_CRYPTO_OP_TYPE_UNDEFINED ) +return -ENOTSUP ; + +/* Setup source mbuf payload */ + ut_params->ibuf =rte_pktmbuf_alloc (ts_params->mbuf_pool); + memset(rte_pktmbuf_mtod(ut_params->ibuf, uint8_t *), 0, +rte_pktmbuf_tailroom (ut_params->ibuf)); + + plaintext = (uint8_t *)rte_pktmbuf_append (ut_params->ibuf, + d_td->plaintext.len); + +memcpy (plaintext, d_td->plaintext.data, d_td->plaintext.len); + +/* Set session action type */ + ut_params->type =RTE_SECURITY_ACTION_TYPE_LOOKASIDE_PROTOCOL ; + +/* Setup cipher session parameters */ + ut_params->cipher_xform.type =RTE_CRYPTO_SYM_XFORM_CIPHER ; + ut_params->cipher_xform.cipher.algo =RTE_CRYPTO_CIPHER_AES_DOCSISBPI ; + ut_params->cipher_xform.cipher.op =RTE_CRYPTO_CIPHER_OP_ENCRYPT ; + ut_params->cipher_xform.cipher.key.data = d_td->key.data; + ut_params->cipher_xform.cipher.key.length = d_td->key.len; + ut_params->cipher_xform.cipher.iv.length = d_td->iv.len; + ut_params->cipher_xform.cipher.iv.offset =IV_OFFSET ; + ut_params->cipher_xform.next =NULL ; + +/* Setup DOCSIS session parameters */ + ut_params->docsis_xform.direction =RTE_SECURITY_DOCSIS_DOWNLINK ; + +struct rte_security_session_conf sess_conf = { + .action_type = ut_params->type, + .protocol =RTE_SECURITY_PROTOCOL_DOCSIS , + .docsis = ut_params->docsis_xform, + .crypto_xform = &ut_params->cipher_xform, + }; + +/* Create security session */ + ut_params->sec_session =rte_security_session_create (ctx, &sess_conf, + ts_params->session_priv_mpool); + +if (!ut_params->sec_session) { +printf ("TestCase %s(%d) line %d: %s\n" , + __func__, i, __LINE__,"failed to allocate session" ); + ret =TEST_FAILED ; + goto on_err; + } + +/* Generate crypto op data structure */ + ut_params->op =rte_crypto_op_alloc (ts_params->op_mpool, +RTE_CRYPTO_OP_TYPE_SYMMETRIC ); +if (!ut_params->op) { +printf ("TestCase %s(%d) line %d: %s\n" , + __func__, i, __LINE__, +"failed to allocate security crypto operation" ); + ret =TEST_FAILED ; + goto on_err; + } + +/* Setup CRC operation parameters */ + crc_len = d_td->plaintext.no_crc == false ? + (d_td->plaintext.len - + d_td->plaintext.crc_offset - +RTE_ETHER_CRC_LEN ) : +0 ; + crc_len = crc_len >0 ? crc_len :0 ; + ut_params->op->sym->auth.data.length = crc_len; + ut_params->op->sym->auth.data.offset = d_td->plaintext.crc_offset; + +/* Setup cipher operation parameters */ + cipher_len = d_td->plaintext.no_cipher == false ? + (d_td->plaintext.len - + d_td->plaintext.cipher_offset) : +0 ; + cipher_len = cipher_len >0 ? cipher_len :0 ; + ut_params->op->sym->cipher.data.length = cipher_len; + ut_params->op->sym->cipher.data.offset = d_td->plaintext.cipher_offset; + +/* Setup cipher IV */ + iv_ptr = (uint8_t *)ut_params->op +IV_OFFSET ; +rte_memcpy (iv_ptr, d_td->iv.data, d_td->iv.len); + +/* Attach session to operation */ +rte_security_attach_session (ut_params->op, ut_params->sec_session); + +/* Set crypto operation mbufs */ + ut_params->op->sym->m_src = ut_params->ibuf; + ut_params->op->sym->m_dst =NULL ; + +/* Process crypto operation */ +if (process_crypto_request (ts_params->valid_devs[0 ], ut_params->op) == +NULL ) { +printf ("TestCase %s(%d) line %d: %s\n" , + __func__, i, __LINE__, +"failed to process security crypto op" ); + ret =TEST_FAILED ; + goto on_err; + } + +if (ut_params->op->status !=RTE_CRYPTO_OP_STATUS_SUCCESS ) { +printf ("TestCase %s(%d) line %d: %s\n" , + __func__, i, __LINE__,"crypto op processing failed" ); + ret =TEST_FAILED ; + goto on_err; + } + +/* Validate ciphertext */ + ciphertext = plaintext; + +if (memcmp (ciphertext, d_td->ciphertext.data, d_td->ciphertext.len)) { +printf ("TestCase %s(%d) line %d: %s\n" , + __func__, i, __LINE__,"ciphertext not as expected\n" ); +rte_hexdump (stdout,"expected" , d_td->ciphertext.data, + d_td->ciphertext.len); +rte_hexdump (stdout,"actual" , ciphertext, d_td->ciphertext.len); + ret =TEST_FAILED ; + goto on_err; + } + +on_err: +rte_crypto_op_free (ut_params->op); + ut_params->op =NULL ; + +if (ut_params->sec_session) +rte_security_session_destroy (ctx, ut_params->sec_session); + ut_params->sec_session =NULL ; + +rte_pktmbuf_free (ut_params->ibuf); + ut_params->ibuf =NULL ; + +return ret; +} + +#define TEST_DOCSIS_COUNT (func) do { \ + int ret = func; \ + if (ret == TEST_SUCCESS) { \ + printf("\t%2d)", n++); \ + printf("+++++ PASSED:" #func"\n"); \ + p++; \ + } else if (ret == -ENOTSUP) { \ + printf("\t%2d)", n++); \ + printf("~~~~~ UNSUPP:" #func"\n"); \ + u++; \ + } else { \ + printf("\t%2d)", n++); \ + printf("----- FAILED:" #func"\n"); \ + f++; \ + } \ +} while (0) + +static int +test_DOCSIS_PROTO_uplink_all (void ) +{ +int p =0 , u =0 , f =0 , n =0 ; + +TEST_DOCSIS_COUNT (test_docsis_proto_uplink (1 , &docsis_test_case_1)); +TEST_DOCSIS_COUNT (test_docsis_proto_uplink (2 , &docsis_test_case_2)); +TEST_DOCSIS_COUNT (test_docsis_proto_uplink (3 , &docsis_test_case_3)); +TEST_DOCSIS_COUNT (test_docsis_proto_uplink (4 , &docsis_test_case_4)); +TEST_DOCSIS_COUNT (test_docsis_proto_uplink (5 , &docsis_test_case_5)); +TEST_DOCSIS_COUNT (test_docsis_proto_uplink (6 , &docsis_test_case_6)); +TEST_DOCSIS_COUNT (test_docsis_proto_uplink (7 , &docsis_test_case_7)); +TEST_DOCSIS_COUNT (test_docsis_proto_uplink (8 , &docsis_test_case_8)); +TEST_DOCSIS_COUNT (test_docsis_proto_uplink (9 , &docsis_test_case_9)); +TEST_DOCSIS_COUNT (test_docsis_proto_uplink (10 , &docsis_test_case_10)); +TEST_DOCSIS_COUNT (test_docsis_proto_uplink (11 , &docsis_test_case_11)); +TEST_DOCSIS_COUNT (test_docsis_proto_uplink (12 , &docsis_test_case_12)); +TEST_DOCSIS_COUNT (test_docsis_proto_uplink (13 , &docsis_test_case_13)); +TEST_DOCSIS_COUNT (test_docsis_proto_uplink (14 , &docsis_test_case_14)); +TEST_DOCSIS_COUNT (test_docsis_proto_uplink (15 , &docsis_test_case_15)); +TEST_DOCSIS_COUNT (test_docsis_proto_uplink (16 , &docsis_test_case_16)); +TEST_DOCSIS_COUNT (test_docsis_proto_uplink (17 , &docsis_test_case_17)); +TEST_DOCSIS_COUNT (test_docsis_proto_uplink (18 , &docsis_test_case_18)); +TEST_DOCSIS_COUNT (test_docsis_proto_uplink (19 , &docsis_test_case_19)); +TEST_DOCSIS_COUNT (test_docsis_proto_uplink (20 , &docsis_test_case_20)); +TEST_DOCSIS_COUNT (test_docsis_proto_uplink (21 , &docsis_test_case_21)); +TEST_DOCSIS_COUNT (test_docsis_proto_uplink (22 , &docsis_test_case_22)); +TEST_DOCSIS_COUNT (test_docsis_proto_uplink (23 , &docsis_test_case_23)); +TEST_DOCSIS_COUNT (test_docsis_proto_uplink (24 , &docsis_test_case_24)); +TEST_DOCSIS_COUNT (test_docsis_proto_uplink (25 , &docsis_test_case_25)); +TEST_DOCSIS_COUNT (test_docsis_proto_uplink (26 , &docsis_test_case_26)); + +if (f) +printf ("## %s: %d passed out of %d (%d unsupported)\n" , + __func__, p, n, u); + +return f; +}; + +static int +test_DOCSIS_PROTO_downlink_all (void ) +{ +int p =0 , u =0 , f =0 , n =0 ; + +TEST_DOCSIS_COUNT (test_docsis_proto_downlink (1 , &docsis_test_case_1)); +TEST_DOCSIS_COUNT (test_docsis_proto_downlink (2 , &docsis_test_case_2)); +TEST_DOCSIS_COUNT (test_docsis_proto_downlink (3 , &docsis_test_case_3)); +TEST_DOCSIS_COUNT (test_docsis_proto_downlink (4 , &docsis_test_case_4)); +TEST_DOCSIS_COUNT (test_docsis_proto_downlink (5 , &docsis_test_case_5)); +TEST_DOCSIS_COUNT (test_docsis_proto_downlink (6 , &docsis_test_case_6)); +TEST_DOCSIS_COUNT (test_docsis_proto_downlink (7 , &docsis_test_case_7)); +TEST_DOCSIS_COUNT (test_docsis_proto_downlink (8 , &docsis_test_case_8)); +TEST_DOCSIS_COUNT (test_docsis_proto_downlink (9 , &docsis_test_case_9)); +TEST_DOCSIS_COUNT (test_docsis_proto_downlink (10 , &docsis_test_case_10)); +TEST_DOCSIS_COUNT (test_docsis_proto_downlink (11 , &docsis_test_case_11)); +TEST_DOCSIS_COUNT (test_docsis_proto_downlink (12 , &docsis_test_case_12)); +TEST_DOCSIS_COUNT (test_docsis_proto_downlink (13 , &docsis_test_case_13)); +TEST_DOCSIS_COUNT (test_docsis_proto_downlink (14 , &docsis_test_case_14)); +TEST_DOCSIS_COUNT (test_docsis_proto_downlink (15 , &docsis_test_case_15)); +TEST_DOCSIS_COUNT (test_docsis_proto_downlink (16 , &docsis_test_case_16)); +TEST_DOCSIS_COUNT (test_docsis_proto_downlink (17 , &docsis_test_case_17)); +TEST_DOCSIS_COUNT (test_docsis_proto_downlink (18 , &docsis_test_case_18)); +TEST_DOCSIS_COUNT (test_docsis_proto_downlink (19 , &docsis_test_case_19)); +TEST_DOCSIS_COUNT (test_docsis_proto_downlink (20 , &docsis_test_case_20)); +TEST_DOCSIS_COUNT (test_docsis_proto_downlink (21 , &docsis_test_case_21)); +TEST_DOCSIS_COUNT (test_docsis_proto_downlink (22 , &docsis_test_case_22)); +TEST_DOCSIS_COUNT (test_docsis_proto_downlink (23 , &docsis_test_case_23)); +TEST_DOCSIS_COUNT (test_docsis_proto_downlink (24 , &docsis_test_case_24)); +TEST_DOCSIS_COUNT (test_docsis_proto_downlink (25 , &docsis_test_case_25)); +TEST_DOCSIS_COUNT (test_docsis_proto_downlink (26 , &docsis_test_case_26)); + +if (f) +printf ("## %s: %d passed out of %d (%d unsupported)\n" , + __func__, p, n, u); + +return f; +}; + +static int +test_DOCSIS_PROTO_all (void ) +{ +struct crypto_testsuite_params *ts_params = &testsuite_params; +struct rte_cryptodev_info dev_info; +int status; + +rte_cryptodev_info_get (ts_params->valid_devs[0 ], &dev_info); +uint64_t feat_flags = dev_info.feature_flags; + +if (!(feat_flags &RTE_CRYPTODEV_FF_SECURITY )) +return -ENOTSUP ; + +if (security_proto_supported (RTE_SECURITY_PROTOCOL_DOCSIS ) <0 ) +return -ENOTSUP ; + + status =test_DOCSIS_PROTO_uplink_all (); + status +=test_DOCSIS_PROTO_downlink_all (); + +if (status) +return TEST_FAILED ; +else +return TEST_SUCCESS ; +}#endif static int
@@ -12342,6 +12853,8 @@ static struct unit_test_suite cryptodev_testsuite = {#ifdef RTE_LIBRTE_SECURITY TEST_CASE_ST (ut_setup, ut_teardown, test_PDCP_PROTO_all), +TEST_CASE_ST (ut_setup, ut_teardown, + test_DOCSIS_PROTO_all), #endifTEST_CASES_END ()/**< NULL terminate unit test array */ }
app/test/test_cryptodev_security_docsis_test_vectors.h new file +1544 -0
1,544 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH v3 6/8 test/security: add DOCSIS capability check tests
In reply to David CoyleAdd unit tests for DOCSIS capabilitity checks.
--- app/test/test_security.c | 88 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+)
app/test/test_security.c +88 -0
@@ -6,6 +6,7 @@#include <rte_log.h> #include <rte_memory.h> #include <rte_mempool.h> +#include <rte_ether.h> #include <rte_security.h> #include <rte_security_driver.h>
@@ -2268,6 +2269,89 @@ test_capability_get_pdcp_match(void)return TEST_SUCCESS ; } +/** +* Test execution of rte_security_capability_get when capabilities table +* does not contain entry with matching DOCSIS direction field +*/ +static int +test_capability_get_docsis_mismatch_direction (void ) +{ +struct security_unittest_params *ut_params = &unittest_params; +struct rte_security_capability_idx idx = { + .action =RTE_SECURITY_ACTION_TYPE_LOOKASIDE_PROTOCOL , + .protocol =RTE_SECURITY_PROTOCOL_DOCSIS , + .docsis = { + .direction =RTE_SECURITY_DOCSIS_DOWNLINK + }, + }; +struct rte_security_capability capabilities[] = { + { + .action =RTE_SECURITY_ACTION_TYPE_LOOKASIDE_PROTOCOL , + .protocol =RTE_SECURITY_PROTOCOL_DOCSIS , + .docsis = { + .direction =RTE_SECURITY_DOCSIS_UPLINK + }, + }, + { + .action =RTE_SECURITY_ACTION_TYPE_NONE , + }, + }; + + mock_capabilities_get_exp.device =NULL ; + mock_capabilities_get_exp.ret = capabilities; + +const struct rte_security_capability *ret; + ret =rte_security_capability_get (&ut_params->ctx, &idx); +TEST_ASSERT_MOCK_FUNCTION_CALL_RET (rte_security_capability_get, + ret,NULL ,"%p" ); +TEST_ASSERT_MOCK_CALLS (mock_capabilities_get_exp,1 ); + +return TEST_SUCCESS ; +} + +/** +* Test execution of rte_security_capability_get when capabilities table +* contains matching DOCSIS entry +*/ +static int +test_capability_get_docsis_match (void ) +{ +struct security_unittest_params *ut_params = &unittest_params; +struct rte_security_capability_idx idx = { + .action =RTE_SECURITY_ACTION_TYPE_LOOKASIDE_PROTOCOL , + .protocol =RTE_SECURITY_PROTOCOL_DOCSIS , + .docsis = { + .direction =RTE_SECURITY_DOCSIS_UPLINK + }, + }; +struct rte_security_capability capabilities[] = { + { + .action =RTE_SECURITY_ACTION_TYPE_INLINE_CRYPTO , + }, + { + .action =RTE_SECURITY_ACTION_TYPE_LOOKASIDE_PROTOCOL , + .protocol =RTE_SECURITY_PROTOCOL_DOCSIS , + .docsis = { + .direction =RTE_SECURITY_DOCSIS_UPLINK + }, + }, + { + .action =RTE_SECURITY_ACTION_TYPE_NONE , + }, + }; + + mock_capabilities_get_exp.device =NULL ; + mock_capabilities_get_exp.ret = capabilities; + +const struct rte_security_capability *ret; + ret =rte_security_capability_get (&ut_params->ctx, &idx); +TEST_ASSERT_MOCK_FUNCTION_CALL_RET (rte_security_capability_get, + ret, &capabilities[1 ],"%p" ); +TEST_ASSERT_MOCK_CALLS (mock_capabilities_get_exp,1 ); + +return TEST_SUCCESS ; +} +/** * Declaration of testcases */
@@ -2410,6 +2494,10 @@ static struct unit_test_suite security_testsuite = { test_capability_get_pdcp_mismatch_domain),TEST_CASE_ST (ut_setup_with_session, ut_teardown, test_capability_get_pdcp_match), +TEST_CASE_ST (ut_setup_with_session, ut_teardown, + test_capability_get_docsis_mismatch_direction), +TEST_CASE_ST (ut_setup_with_session, ut_teardown, + test_capability_get_docsis_match), TEST_CASES_END() /**< NULL terminate unit test array */ }
Signature · 1 line
2.17.1
PATCH v3 7/8 app/crypto-perf: add support for DOCSIS protocol
In reply to David CoyleUpdate test-crypto-perf app to calculate DOCSIS throughput numbers.
1 new parameter is added for DOCSIS:
--docsis-hdr-sz <n>
./dpdk-test-crypto-perf -l 3,4 --socket-mem 2048,0
--vdev crypto_aesni_mb_pmd_1 -n 1 -- --devtype crypto_aesni_mb --optype docsis --cipher-algo aes-docsisbpi --cipher-op encrypt --cipher-key-sz 16 --cipher-iv-sz 16 --burst-sz 32 --total-ops 20000000 --buffer-sz 1024 --silent --docsis-hdr-sz 17
--- app/test-crypto-perf/cperf_ops.c | 82 ++++++++++++++++++-- app/test-crypto-perf/cperf_options.h | 5 +- app/test-crypto-perf/cperf_options_parsing.c | 67 +++++++++++++++- app/test-crypto-perf/cperf_test_throughput.c | 3 +- app/test-crypto-perf/cperf_test_vectors.c | 3 +- app/test-crypto-perf/main.c | 5 +- app/test-crypto-perf/meson.build | 2 +- 7 files changed, 155 insertions(+), 12 deletions(-)
app/test-crypto-perf/cperf_ops.c +77 -5
@@ -3,6 +3,7 @@*/ #include <rte_cryptodev.h> +#include <rte_ether.h> #include "cperf_ops.h" #include "cperf_test_vectors.h"
@@ -15,8 +16,7 @@ cperf_set_ops_security(struct rte_crypto_op **ops, uint16_t nb_ops, struct rte_cryptodev_sym_session *sess, const struct cperf_options *options __rte_unused, const struct cperf_test_vector *test_vector __rte_unused, - uint16_t iv_offset __rte_unused, - uint32_t *imix_idx __rte_unused) + uint16_t iv_offset __rte_unused, uint32_t *imix_idx) {uint16_t i;
@@ -24,14 +24,39 @@ cperf_set_ops_security(struct rte_crypto_op **ops,struct rte_crypto_sym_op *sym_op = ops[i]->sym;struct rte_security_session *sec_sess = (struct rte_security_session *)sess; +uint32_t buf_sz; ops[i]->status =RTE_CRYPTO_OP_STATUS_NOT_PROCESSED ;rte_security_attach_session (ops[i], sec_sess); sym_op->m_src = (struct rte_mbuf *)((uint8_t *)ops[i] + src_buf_offset); - sym_op->m_src->buf_len = options->segment_sz; - sym_op->m_src->data_len = options->test_buffer_size; - sym_op->m_src->pkt_len = sym_op->m_src->data_len; + +if (options->op_type ==CPERF_PDCP ) { + sym_op->m_src->buf_len = options->segment_sz; + sym_op->m_src->data_len = options->test_buffer_size; + sym_op->m_src->pkt_len = sym_op->m_src->data_len; + } + +if (options->op_type ==CPERF_DOCSIS ) { +if (options->imix_distribution_count) { + buf_sz = options->imix_buffer_sizes[*imix_idx]; + *imix_idx = (*imix_idx +1 ) % options->pool_sz; + }else + buf_sz = options->test_buffer_size; + +/* DOCSIS header is not CRC'ed */ + sym_op->auth.data.offset = options->docsis_hdr_sz; + sym_op->auth.data.length = buf_sz - + sym_op->auth.data.offset -RTE_ETHER_CRC_LEN ; +/* +* DOCSIS header and SRC and DST MAC addresses are not +* ciphered +*/ + sym_op->cipher.data.offset = sym_op->auth.data.offset + +RTE_ETHER_HDR_LEN -RTE_ETHER_TYPE_LEN ; + sym_op->cipher.data.length = buf_sz - + sym_op->cipher.data.offset; + }/* Set dest mbuf to NULL if out-of-place (dst_buf_offset = 0) */ if (dst_buf_offset ==0 )
@@ -589,6 +614,49 @@ cperf_create_session(struct rte_mempool *sess_mp,return (void *)rte_security_session_create (ctx, &sess_conf, sess_mp); } +if (options->op_type ==CPERF_DOCSIS ) { +enum rte_security_docsis_direction direction; + + cipher_xform.type =RTE_CRYPTO_SYM_XFORM_CIPHER ; + cipher_xform.next =NULL ; + cipher_xform.cipher.algo = options->cipher_algo; + cipher_xform.cipher.op = options->cipher_op; + cipher_xform.cipher.iv.offset = iv_offset; +if (options->cipher_algo !=RTE_CRYPTO_CIPHER_NULL ) { + cipher_xform.cipher.key.data = + test_vector->cipher_key.data; + cipher_xform.cipher.key.length = + test_vector->cipher_key.length; + cipher_xform.cipher.iv.length = + test_vector->cipher_iv.length; + }else { + cipher_xform.cipher.key.data =NULL ; + cipher_xform.cipher.key.length =0 ; + cipher_xform.cipher.iv.length =0 ; + } + cipher_xform.next =NULL ; + +if (options->cipher_op ==RTE_CRYPTO_CIPHER_OP_ENCRYPT ) + direction =RTE_SECURITY_DOCSIS_DOWNLINK ; +else + direction =RTE_SECURITY_DOCSIS_UPLINK ; + +struct rte_security_session_conf sess_conf = { + .action_type = +RTE_SECURITY_ACTION_TYPE_LOOKASIDE_PROTOCOL , + .protocol =RTE_SECURITY_PROTOCOL_DOCSIS , + {.docsis = { + .direction = direction, + } }, + .crypto_xform = &cipher_xform + }; +struct rte_security_ctx *ctx = (struct rte_security_ctx *) +rte_cryptodev_get_sec_ctx (dev_id); + +/* Create security session */ +return (void *)rte_security_session_create (ctx, + &sess_conf, priv_mp); + }#endif sess =rte_cryptodev_sym_session_create (sess_mp);/*
@@ -772,6 +840,10 @@ cperf_get_op_functions(const struct cperf_options *options, op_fns->populate_ops = cperf_set_ops_security; return 0; } +if (options->op_type ==CPERF_DOCSIS ) { + op_fns->populate_ops = cperf_set_ops_security; +return 0 ; + }#endif return -1 ; }
app/test-crypto-perf/cperf_options.h +4 -1
@@ -50,6 +50,7 @@#ifdef RTE_LIBRTE_SECURITY #define CPERF_PDCP_SN_SZ ("pdcp-sn-sz")#define CPERF_PDCP_DOMAIN ("pdcp-domain") +#define CPERF_DOCSIS_HDR_SZ ("docsis-hdr-sz")#endif #define CPERF_CSV ("csv-friendly")
@@ -75,7 +76,8 @@ enum cperf_op_type {CPERF_CIPHER_THEN_AUTH ,CPERF_AUTH_THEN_CIPHER ,CPERF_AEAD , - CPERF_PDCP +CPERF_PDCP , + CPERF_DOCSIS };extern const char *cperf_op_type_strs[];
@@ -122,6 +124,7 @@ struct cperf_options {#ifdef RTE_LIBRTE_SECURITY uint16_t pdcp_sn_sz;enum rte_security_pdcp_domain pdcp_domain; +uint16_t docsis_hdr_sz;#endif char device_type[RTE_CRYPTODEV_NAME_MAX_LEN ];enum cperf_op_type op_type;
app/test-crypto-perf/cperf_options_parsing.c +66 -1
128 lines not on this page · raw message
app/test-crypto-perf/cperf_test_throughput.c +2 -1
@@ -36,7 +36,8 @@ cperf_throughput_test_free(struct cperf_throughput_ctx *ctx)return ;if (ctx->sess) {#ifdef RTE_LIBRTE_SECURITY -if (ctx->options->op_type ==CPERF_PDCP ) { +if (ctx->options->op_type ==CPERF_PDCP || + ctx->options->op_type ==CPERF_DOCSIS ) {struct rte_security_ctx *sec_ctx = (struct rte_security_ctx *)rte_cryptodev_get_sec_ctx (ctx->dev_id);
app/test-crypto-perf/cperf_test_vectors.c +2 -1
@@ -469,7 +469,8 @@ cperf_test_vector_get_dummy(struct cperf_options *options)if (options->op_type ==CPERF_CIPHER_ONLY || options->op_type ==CPERF_CIPHER_THEN_AUTH || - options->op_type ==CPERF_AUTH_THEN_CIPHER ) { + options->op_type ==CPERF_AUTH_THEN_CIPHER || + options->op_type ==CPERF_DOCSIS ) {if (options->cipher_algo ==RTE_CRYPTO_CIPHER_NULL ) { t_vec->cipher_key.length =0 ; t_vec->ciphertext.data = plaintext;
app/test-crypto-perf/main.c +3 -2
@@ -39,7 +39,8 @@ const char *cperf_op_type_strs[] = { [CPERF_CIPHER_THEN_AUTH] = "cipher-then-auth", [CPERF_AUTH_THEN_CIPHER] = "auth-then-cipher", [CPERF_AEAD] = "aead", - [CPERF_PDCP ] ="pdcp" + [CPERF_PDCP] = "pdcp", + [CPERF_DOCSIS ] ="docsis" };const struct cperf_test cperf_testmap[] = {
@@ -244,7 +245,7 @@ cperf_initialize_cryptodev(struct cperf_options *opts, uint8_t *enabled_cdevs)#endif }else sessions_needed = enabled_cdev_count * - opts->nb_qps; + opts->nb_qps *2 ;/* * A single session is required per queue pair
app/test-crypto-perf/meson.build +1 -1
@@ -11,4 +11,4 @@ sources = files('cperf_ops.c', 'cperf_test_vectors.c', 'cperf_test_verify.c', 'main.c') -deps += ['cryptodev', 'security'] +deps += ['cryptodev', 'net', 'security']
Signature · 1 line
2.17.1
PATCH v3 8/8 doc: add doc updates for DOCSIS security protocol
In reply to David CoyleUpdate Security library, AESNI-MB crypto PMD, QAT crypto PMD, dpdk-test-crypto-perf tool and release note documentation for DOCSIS protocol support.
--- doc/guides/cryptodevs/aesni_mb.rst | 8 ++ doc/guides/cryptodevs/features/aesni_mb.ini | 1 + doc/guides/cryptodevs/features/qat.ini | 1 + doc/guides/cryptodevs/qat.rst | 7 ++ doc/guides/prog_guide/rte_security.rst | 114 +++++++++++++++++++- doc/guides/rel_notes/release_20_08.rst | 16 +++ doc/guides/tools/cryptoperf.rst | 5 + 7 files changed, 150 insertions(+), 2 deletions(-)
doc/guides/cryptodevs/aesni_mb.rst +8 -0
@@ -55,10 +55,18 @@ AEAD algorithms: * RTE_CRYPTO_AEAD_AES_CCM * RTE_CRYPTO_AEAD_AES_GCM +Protocol offloads: + +* RTE_SECURITY_PROTOCOL_DOCSIS + Limitations ----------- * Chained mbufs are not supported. +* Out-of-place is not supported for combined Crypto-CRC DOCSIS security + protocol. +* RTE_CRYPTO_CIPHER_DES_DOCSISBPI is not supported for combined Crypto-CRC + DOCSIS security protocol. Installation
doc/guides/cryptodevs/features/aesni_mb.ini +1 -0
@@ -6,6 +6,7 @@ [Features] Symmetric crypto = Y Sym operation chaining = Y +Protocol offload = Y CPU SSE = Y CPU AVX = Y CPU AVX2 = Y
doc/guides/cryptodevs/features/qat.ini +1 -0
@@ -7,6 +7,7 @@ Symmetric crypto = Y Sym operation chaining = Y HW Accelerated = Y +Protocol offload = Y In Place SGL = Y OOP SGL In SGL Out = Y OOP SGL In LB Out = Y
doc/guides/cryptodevs/qat.rst +7 -0
@@ -76,6 +76,9 @@ Supported AEAD algorithms: * ``RTE_CRYPTO_AEAD_AES_GCM`` * ``RTE_CRYPTO_AEAD_AES_CCM`` +Protocol offloads: + +* ``RTE_SECURITY_PROTOCOL_DOCSIS`` Supported Chains ~~~~~~~~~~~~~~~~
@@ -126,6 +129,10 @@ Limitations generations in the same process if planning to use for GCM. * The mixed algo feature on GEN2 is not supported by all kernel drivers. Check the notes under the Available Kernel Drivers table below for specific details. +* Out-of-place is not supported for combined Crypto-CRC DOCSIS security + protocol. +* ``RTE_CRYPTO_CIPHER_DES_DOCSISBPI`` is not supported for combined Crypto-CRC + DOCSIS security protocol. Extra notes on KASUMI F9 ~~~~~~~~~~~~~~~~~~~~~~~~
doc/guides/prog_guide/rte_security.rst +112 -2
150 lines not on this page · raw message
doc/guides/rel_notes/release_20_08.rst +16 -0
@@ -56,6 +56,22 @@ New Features Also, make sure to start the actual text at the margin. ========================================================= +* **Added support for DOCSIS protocol to rte_security.** + + Added support for combined crypto and CRC operations for the DOCSIS protocol + to ``rte_security``. Test and test-crypto-perf applications have been updated + for unit testing. + +* **Updated the AESNI MB crypto PMD.** + + Added support for lookaside protocol offload for DOCSIS through the + ``rte_security`` API. + +* **Updated the QuickAssist Technology (QAT) Crypto PMD.** + + Added support for lookaside protocol offload for DOCSIS through the + ``rte_security`` API. + Removed Items -------------
doc/guides/tools/cryptoperf.rst +5 -0
@@ -193,6 +193,7 @@ The following are the application command-line options: auth-then-cipher aead pdcp + docsis For GCM/CCM algorithms you should use aead flag.
@@ -342,6 +343,10 @@ The following are the application command-line options: Set PDCP domain to specify Control/user plane. +* ``--docsis-hdr-sz <n>`` + + Set DOCSIS header size(n) in bytes. + Test Vector File ~~~~~~~~~~~~~~~~
Signature · 1 line
2.17.1
Re: [dpdk-dev] [PATCH v3 8/8] doc: add doc updates for DOCSIS security protocol
Hi David,
Quoted 8 lines
Subject: [PATCH v3 8/8] doc: add doc updates for DOCSIS security protocol
Update Security library, AESNI-MB crypto PMD, QAT crypto PMD, dpdk-test-crypto-perf tool and release note documentation for DOCSIS protocol support.
Signed-off-by David Coyle <[email protected]>Signed-off-by Mairtin o Loingsigh <[email protected]>
Overall the patches looks good. However, I will do a detailed review soon.
Quoted 9 lines
--- doc/guides/cryptodevs/aesni_mb.rst | 8 ++ doc/guides/cryptodevs/features/aesni_mb.ini | 1 + doc/guides/cryptodevs/features/qat.ini | 1 + doc/guides/cryptodevs/qat.rst | 7 ++ doc/guides/prog_guide/rte_security.rst | 114 +++++++++++++++++++- doc/guides/rel_notes/release_20_08.rst | 16 +++ doc/guides/tools/cryptoperf.rst | 5 + 7 files changed, 150 insertions(+), 2 deletions(-)
This patch should be split and merged to relevant other patches in the series. rte_security related in 1/8
Like aesni-mb related changes should go in 3/8
qat related should be part of 4/8
crypto-perf should be part of 7/8
And release notes should also be split into 3 different entries and squashed into Rte_security, qat and aesni-mb patches.
<snip>
doc/guides/prog_guide/rte_security.rst Just like IPsec, in case of PDCP also header addition/deletion, cipher/ · line 343
Quoted 13 lines
+The encryption/decryption is a combination of CBC and CFB modes using either AES
(quoted diff) +2
-0+or DES algorithms as specified in the DOCSIS Security Specification (from DPDK +lib_rtecryptodev perspective, these are RTE_CRYPTO_CIPHER_AES_DOCSISBPIand
doc/guides/prog_guide/rte_security.rst +8
-0+RTE_CRYPTO_CIPHER_DES_DOCSISBPI). + +The CRC is Ethernet CRC-32 as specified in Ethernet/[ISO/IEC 8802-3]. + +.. note:: + + * The CRC offset and length are specified via the auth offset and + length fields of the rte_crypto_sym_op.
The above note is not correct. It should be
* The offset and length of data for which CRC need to be computed are specified via the auth offset and length fields of the rte_crypto_sym_op.
Quoted 6 lines
doc/guides/prog_guide/rte_security.rst +3
-0+ * Other DOCSIS protocol functionality such as Header Checksum (HCS) + calculation may be added in the future. + Device Features and Capabilities ---------------------------------
<snip>
Quoted 13 lines
doc/guides/rel_notes/release_20_08.rst +3
-0@@ -56,6 +56,22 @@ New Features Also, make sure to start the actual text at the margin. ========================================================= +* **Added support for DOCSIS protocol to rte_security.** + + Added support for combined crypto and CRC operations for the DOCSISprotocol
doc/guides/rel_notes/release_20_08.rst New Features · line 63
Quoted 2 lines
doc/guides/rel_notes/release_20_08.rst +2
-0+ to ``rte_security``. Test and test-crypto-perf applications have been updated + for unit testing.
Split this release note entry into two, 1 for 1/8 and one for 7/8
Quoted 12 lines
doc/guides/rel_notes/release_20_08.rst +11
-0+ +* **Updated the AESNI MB crypto PMD.** + + Added support for lookaside protocol offload for DOCSIS through the + ``rte_security`` API. + +* **Updated the QuickAssist Technology (QAT) Crypto PMD.** + + Added support for lookaside protocol offload for DOCSIS through the + ``rte_security`` API. +
Re: [dpdk-dev] [PATCH v3 8/8] doc: add doc updates for DOCSIS security protocol
Hi Akhil, thank you for these comments
Quoted 7 lines
This patch should be split and merged to relevant other patches in the series.
rte_securityrelated in 1/8
Like aesni-mb related changes should go in 3/8 qat related should be part of 4/8 crypto-perf should be part of 7/8 And release notes should also be split into 3 different entries and squashed intoRte_security, qat and aesni-mb patches.
[DC] I will make this change in v4.
I will wait until there are more comments before submitting v4.
Quoted 4 lines
Quoted 4 lines
doc/guides/prog_guide/rte_security.rst +4
-0+ +The CRC is Ethernet CRC-32 as specified in Ethernet/[ISO/IEC 8802-3]. + +.. note::
Quoted 8 lines
doc/guides/prog_guide/rte_security.rst Just like IPsec, in case of PDCP also header addition/deletion, cipher/ · line 343
Quoted 3 lines
doc/guides/prog_guide/rte_security.rst +3
-0+ + * The CRC offset and length are specified via the auth offset and + length fields of the rte_crypto_sym_op.The above note is not correct. It should be
* The offset and length of data for which CRC need to be computed are specified
via the auth offset and length fields of therte_crypto_sym_op.
[DC] Yes, that is a good clarification - I will make that update
Quoted 9 lines
Quoted 7 lines
doc/guides/rel_notes/release_20_08.rst +3
-0+* **Added support for DOCSIS protocol to rte_security.** + + Added support for combined crypto and CRC operations for the DOCSISprotocol
+ to ``rte_security``. Test and test-crypto-perf applications have
+ been updated for unit testing.Split this release note entry into two, 1 for 1/8 and one for 7/8
[DC] I will make this change
Re: [dpdk-dev] [PATCH v3 3/8] crypto/aesni_mb: add support for DOCSIS protocol
In reply to David CoyleQuoted 6 lines
drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c +0
-0
<snip>
Quoted 9 lines
drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c +4
-1@@ -1647,7 +1914,23 @@ cryptodev_aesni_mb_create(const char *name,RTE_CRYPTODEV_FF_SYM_OPERATION_CHAINING |RTE_CRYPTODEV_FF_OOP_LB_IN_LB_OUT |RTE_CRYPTODEV_FF_SYM_CPU_CRYPTO | -RTE_CRYPTODEV_FF_SYM_SESSIONLESS ; + RTE_CRYPTODEV_FF_SYM_SESSIONLESS +#ifdef AESNI_MB_DOCSIS_SEC_ENABLED + |RTE_CRYPTODEV_FF_SECURITY +#endif
drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c cryptodev_aesni_mb_create(const char *name, · line 1930
Quoted 10 lines
drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c +9
-0+ ; + +#ifdef AESNI_MB_DOCSIS_SEC_ENABLED + security_instance =rte_malloc ("aesni_mb_sec" , +sizeof (struct rte_security_ctx ),0 ); +if (security_instance ==NULL ) +AESNI_MB_LOG (ERR ,"rte_security_ctx memory alloc failed\n"); + + security_instance->device = (void *)dev;
[DC] Possible NULL pointer dereference here... will fix in v4
Quoted 4 lines
drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c +3
-0+ security_instance->ops = rte_aesni_mb_pmd_sec_ops; + security_instance->sess_cnt =0 ; + dev->security_ctx = security_instance;#endif
Re: [dpdk-dev] [PATCH v3 4/8] crypto/qat: add support for DOCSIS protocol
In reply to David CoyleQuoted 6 lines
drivers/crypto/qat/qat_sym_pmd.c +0
-0
<snip>
Quoted 6 lines
drivers/crypto/qat/qat_sym_pmd.c +0
-1@@ -308,7 +346,20 @@ qat_sym_dev_create(struct qat_pci_device *qat_pci_dev,RTE_CRYPTODEV_FF_OOP_SGL_IN_LB_OUT |RTE_CRYPTODEV_FF_OOP_LB_IN_SGL_OUT | RTE_CRYPTODEV_FF_OOP_LB_IN_LB_OUT | -RTE_CRYPTODEV_FF_DIGEST_ENCRYPTED ;
drivers/crypto/qat/qat_sym_pmd.c qat_sym_dev_create(struct qat_pci_device · line 359
Quoted 10 lines
drivers/crypto/qat/qat_sym_pmd.c +10
-0+RTE_CRYPTODEV_FF_DIGEST_ENCRYPTED | +RTE_CRYPTODEV_FF_SECURITY ; + +#ifdef RTE_LIBRTE_SECURITY + security_instance =rte_malloc ("qat_sec" , +sizeof (struct rte_security_ctx ),0 ); +if (security_instance ==NULL ) +QAT_LOG (ERR ,"rte_security_ctx memory alloc failed\n" ); + + security_instance->device = (void *)cryptodev;
[DC] Possible NULL pointer dereference here... will fix in v4
Quoted 6 lines
drivers/crypto/qat/qat_sym_pmd.c +3
-0+ security_instance->ops = &security_qat_ops; + security_instance->sess_cnt =0 ; + cryptodev->security_ctx = security_instance;#endif internals = cryptodev->data->dev_private; internals->qat_dev = qat_pci_dev;
Re: [dpdk-dev] [PATCH v3 1/8] security: add support for DOCSIS protocol
In reply to David CoyleQuoted 8 lines
Add support for DOCSIS protocol to
rte_securitylibrary. This support currently comprises the combination of Crypto and CRC operations.Signed-off-by David Coyle <[email protected]>Signed-off-by Mairtin o Loingsigh <[email protected]>---
With the documentation comments in the last patch.
Re: [dpdk-dev] [PATCH v3 2/8] cryptodev: add a note regarding DOCSIS protocol support
In reply to David CoyleQuoted 8 lines
Add a note to the
rte_crypto_sym_op->auth.datafields to state that for DOCSIS security protocol, these are used to specify the CRC offset and length.Signed-off-by David Coyle <[email protected]>Signed-off-by Mairtin o Loingsigh <[email protected]>---
Re: [dpdk-dev] [PATCH v3 5/8] test/crypto: add DOCSIS security test cases
In reply to David CoyleQuoted 8 lines
Add uplink and downlink DOCSIS unit test cases and vectors, to test the combined DOCSIS Crypto-CRC support that has been added to the
rte_securitylibrary.Signed-off-by David Coyle <[email protected]>Signed-off-by Mairtin o Loingsigh <[email protected]>---
Re: [dpdk-dev] [PATCH v3 7/8] app/crypto-perf: add support for DOCSIS protocol
In reply to David CoyleQuoted 12 lines
Update test-crypto-perf app to calculate DOCSIS throughput numbers.
1 new parameter is added for DOCSIS:
--docsis-hdr-sz <n>./dpdk-test-crypto-perf -l 3,4 --socket-mem 2048,0
--vdevcrypto_aesni_mb_pmd_1-n 1 -- --devtypecrypto_aesni_mb--optype docsis --cipher-algo aes-docsisbpi --cipher-op encrypt --cipher-key-sz 16 --cipher-iv-sz 16 --burst-sz 32 --total-ops 20000000 --buffer-sz 1024 --silent --docsis-hdr-sz 17
Quoted 3 lines
Signed-off-by David Coyle <[email protected]>Signed-off-by Mairtin o Loingsigh <[email protected]>---
Please do the documentation changes as suggested in the last patch.
v4 cover add support for DOCSIS protocol
In reply to David CoyleIntroduction
============
This patchset adds support for the DOCSIS protocol to the DPDK Security API (rte_security), to be used by the AESNI-MB and QAT crypto devices to combine and accelerate Crypto and CRC functions of the DOCSIS protocol into a single operation.
Performing these functions in parallel as a single operation can enable a significant performance improvement in a DPDK-based DOCSIS MAC pipeline.
Background
==========
A number of approaches to combine DOCSIS Crypto and CRC functions have been discussed in the DPDK community to date, namely:
1) adding a new rte_accelerator API, to provide a generic interface for combining operations of different types
2) using rawdev through a multi-function interface, again to provide a generic interface for combining operations of different types
3) adding support for DOCSIS Crypto-CRC to rte_security
The third option above is the preferred approach for the following reasons:
- it addresses the immediate use case to add DOCSIS Crypto-CRC support to DPDK so that it can be consumed easily by cable equipment vendors
- it uses an already existing framework in DPDK
- it will mean much less code churn in DOCSIS applications, which already use rte_cryptodev for encryption/decryption
Use Cases
=========
The primary use case for this proposal has already been mentioned, namely to add DOCSIS Crypto-CRC support to DPDK:
- DOCSIS MAC: Crypto-CRC
- Order:
- Downstream: CRC, Encrypt
- Upstream: Decrypt, CRC
- Specifications:
- Crypto: 128-bit and 256-bit AES-CFB encryption variant for DOCSIS as described in section 11.1 of DOCSIS 3.1 Security Specification
(https://apps.cablelabs.com/specification/CM-SP-SECv3.1)
- CRC: Ethernet 32-bit CRC as defined in Ethernet/[ISO/IEC 8802-3]
Note that support for these chained operations is already available in the Intel IPSec Multi-Buffer library.
However, other DOCSIS protocol functions could be optimized too in the future using the same rte_security API for DOCSIS (e.g. Header Checksum (HCS) calculation).
v4:
* addressed Akhil's comments regarding documentation
* made some code fixes
* fixed possible NULL pointer dereference when allocating security_ctx in AESNI-MB and QAT PMDs
* freed security_ctx memory when exiting AESNI-MB and QAT PMDs
* added session IOVA verification update when creating security sessions in QAT PMD
v3:
* removed rte_security_op definition
* now using rte_crypto_sym_op->auth.data fields for CRC offset and length as suggested by feedback from Akhil and Konstantin
* addressed Pablo's comments
* removed support for out-of-place for DOCSIS protocol from QAT PMD
* updated dpdk-crypto-perf-test tool for DOCSIS
* updated documentation
v2:
* added rte_security and rte_cryptodev code changes
* added AESNI MB crypto PMD code changes
* added QAT SYM crypto PMD code changes
* added crypto unit tests
* added security unit tests
v1:
* added proposed API changes
* added security capabilities to aesni_mb crypto PMD
David Coyle (7):
security: add support for DOCSIS protocol
cryptodev: add a note regarding DOCSIS protocol support crypto/aesni_mb: add support for DOCSIS protocol crypto/qat: add support for DOCSIS protocol test/crypto: add DOCSIS security test cases test/security: add DOCSIS capability check tests app/crypto-perf: add support for DOCSIS protocol
app/test-crypto-perf/cperf_ops.c | 82 +- app/test-crypto-perf/cperf_options.h | 5 +- app/test-crypto-perf/cperf_options_parsing.c | 67 +- app/test-crypto-perf/cperf_test_throughput.c | 3 +- app/test-crypto-perf/cperf_test_vectors.c | 3 +- app/test-crypto-perf/main.c | 5 +- app/test-crypto-perf/meson.build | 2 +- app/test/test_cryptodev.c | 513 ++++++ ...t_cryptodev_security_docsis_test_vectors.h | 1544 +++++++++++++++++ app/test/test_security.c | 88 + doc/guides/cryptodevs/aesni_mb.rst | 8 + doc/guides/cryptodevs/features/aesni_mb.ini | 1 + doc/guides/cryptodevs/features/qat.ini | 1 + doc/guides/cryptodevs/qat.rst | 7 + doc/guides/prog_guide/rte_security.rst | 114 +- doc/guides/rel_notes/release_20_08.rst | 21 + doc/guides/tools/cryptoperf.rst | 5 + drivers/common/qat/Makefile | 3 + .../crypto/aesni_mb/aesni_mb_pmd_private.h | 19 +- drivers/crypto/aesni_mb/meson.build | 2 +- drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c | 301 +++- .../crypto/aesni_mb/rte_aesni_mb_pmd_ops.c | 125 ++ drivers/crypto/qat/meson.build | 2 + drivers/crypto/qat/qat_sym.c | 71 +- drivers/crypto/qat/qat_sym.h | 62 +- drivers/crypto/qat/qat_sym_capabilities.h | 42 + drivers/crypto/qat/qat_sym_pmd.c | 61 +- drivers/crypto/qat/qat_sym_pmd.h | 4 + drivers/crypto/qat/qat_sym_session.c | 153 ++ drivers/crypto/qat/qat_sym_session.h | 11 + lib/librte_cryptodev/rte_crypto_sym.h | 14 + lib/librte_security/rte_security.c | 5 + lib/librte_security/rte_security.h | 38 + 33 files changed, 3348 insertions(+), 34 deletions(-) create mode 100644 app/test/test_cryptodev_security_docsis_test_vectors.h
Signature · 1 line
2.17.1
PATCH v4 1/7 security: add support for DOCSIS protocol
Add support for DOCSIS protocol to rte_security library. This support currently comprises the combination of Crypto and CRC operations.
--- doc/guides/prog_guide/rte_security.rst | 114 ++++++++++++++++++++++++- doc/guides/rel_notes/release_20_08.rst | 5 ++ lib/librte_security/rte_security.c | 5 ++ lib/librte_security/rte_security.h | 38 +++++++++ 4 files changed, 160 insertions(+), 2 deletions(-)
doc/guides/prog_guide/rte_security.rst +112 -2
@@ -10,8 +10,9 @@ The security library provides a framework for management and provisioning of security protocol operations offloaded to hardware based devices. The library defines generic APIs to create and free security sessions which can support full protocol offload as well as inline crypto operation with -NIC or crypto devices. The framework currently only supports the IPsec and PDCP -protocol and associated operations, other protocols will be added in future. +NIC or crypto devices. The framework currently only supports the IPsec, PDCP +and DOCSIS protocols and associated operations, other protocols will be added +in the future. Design Principles -----------------
@@ -296,6 +297,53 @@ Just like IPsec, in case of PDCP also header addition/deletion, cipher/ de-cipher, integrity protection/verification is done based on the action type chosen. +DOCSIS Protocol +~~~~~~~~~~~~~~~ + +The Data Over Cable Service Interface Specification (DOCSIS) support comprises +the combination of encryption/decryption and CRC generation/verification, for +use in a DOCSIS-MAC pipeline. + +.. code-block:: c + + + Downlink Uplink + -------- ------ + + Ethernet frame Ethernet frame + from core network to core network + | ^ + ~ | + | ~ ----+ + V | | + +---------|----------+ +----------|---------+ | + | CRC generation | | CRC verification | | + +---------|----------+ +----------|---------+ | combined + | | > Crypto + CRC + +---------|----------+ +----------|---------+ | + | Encryption | | Decryption | | + +---------|----------+ +----------|---------+ | + | ^ | + ~ | ----+ + | ~ + V | + DOCSIS frame DOCSIS frame + to Cable Modem from Cable Modem + +The encryption/decryption is a combination of CBC and CFB modes using either AES +or DES algorithms as specified in the DOCSIS Security Specification (from DPDK +lib_rtecryptodev perspective, these are RTE_CRYPTO_CIPHER_AES_DOCSISBPI and +RTE_CRYPTO_CIPHER_DES_DOCSISBPI). + +The CRC is Ethernet CRC-32 as specified in Ethernet/[ISO/IEC 8802-3]. + +.. note:: + + * The offset and length of data for which CRC needs to be computed are + specified via the auth offset and length fields of the rte_crypto_sym_op. + * Other DOCSIS protocol functionality such as Header Checksum (HCS) + calculation may be added in the future. + Device Features and Capabilities ---------------------------------
@@ -408,6 +456,56 @@ PMD which supports the IPsec and PDCP protocol. } } +Below is an example of the capabilities for a PMD which supports the DOCSIS +protocol. + +.. code-block:: c + + static const struct rte_security_capability pmd_security_capabilities[] = { + { /* DOCSIS Uplink */ + .action = RTE_SECURITY_ACTION_TYPE_LOOKASIDE_PROTOCOL, + .protocol = RTE_SECURITY_PROTOCOL_DOCSIS, + .docsis = { + .direction = RTE_SECURITY_DOCSIS_UPLINK + }, + .crypto_capabilities = pmd_capabilities + }, + { /* DOCSIS Downlink */ + .action = RTE_SECURITY_ACTION_TYPE_LOOKASIDE_PROTOCOL, + .protocol = RTE_SECURITY_PROTOCOL_DOCSIS, + .docsis = { + .direction = RTE_SECURITY_DOCSIS_DOWNLINK + }, + .crypto_capabilities = pmd_capabilities + }, + { + .action = RTE_SECURITY_ACTION_TYPE_NONE + } + }; + static const struct rte_cryptodev_capabilities pmd_capabilities[] = { + { /* AES DOCSIS BPI */ + .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC, + .sym = { + .xform_type = RTE_CRYPTO_SYM_XFORM_CIPHER, + .cipher = { + .algo = RTE_CRYPTO_CIPHER_AES_DOCSISBPI, + .block_size = 16, + .key_size = { + .min = 16, + .max = 32, + .increment = 16 + }, + .iv_size = { + .min = 16, + .max = 16, + .increment = 0 + } + } + } + }, + + RTE_CRYPTODEV_END_OF_CAPABILITIES_LIST() + }; Capabilities Discovery ~~~~~~~~~~~~~~~~~~~~~~
@@ -491,6 +589,7 @@ Security Session configuration structure is defined as ``rte_security_session_co struct rte_security_ipsec_xform ipsec; struct rte_security_macsec_xform macsec; struct rte_security_pdcp_xform pdcp; + struct rte_security_docsis_xform docsis; }; /**< Configuration parameters for security session */ struct rte_crypto_sym_xform *crypto_xform;
@@ -538,6 +637,8 @@ The ``rte_security_session_protocol`` is defined as /**< MACSec Protocol */ RTE_SECURITY_PROTOCOL_PDCP, /**< PDCP Protocol */ + RTE_SECURITY_PROTOCOL_DOCSIS, + /**< DOCSIS Protocol */ }; Currently the library defines configuration parameters for IPsec and PDCP only.
@@ -594,6 +695,15 @@ PDCP related configuration parameters are defined in ``rte_security_pdcp_xform`` uint32_t hfn_threshold; }; +DOCSIS related configuration parameters are defined in ``rte_security_docsis_xform`` + +.. code-block:: c + + struct rte_security_docsis_xform { + enum rte_security_docsis_direction direction; + /**< DOCSIS direction */ + }; + Security API ~~~~~~~~~~~~
doc/guides/rel_notes/release_20_08.rst +5 -0
@@ -56,6 +56,11 @@ New Features Also, make sure to start the actual text at the margin. ========================================================= +* **Added support for DOCSIS protocol to rte_security.** + + Added support for combined crypto and CRC operations for the DOCSIS protocol + to ``rte_security``. + * **Updated PCAP driver.** Updated PCAP driver with new features and improvements, including:
lib/librte_security/rte_security.c +5 -0
@@ -173,6 +173,11 @@ rte_security_capability_get(struct rte_security_ctx *instance,if (capability->pdcp.domain == idx->pdcp.domain)return capability; + }else if (idx->protocol == +RTE_SECURITY_PROTOCOL_DOCSIS ) { +if (capability->docsis.direction == + idx->docsis.direction) +return capability; } } }
lib/librte_security/rte_security.h +38 -0
@@ -293,6 +293,28 @@ struct rte_security_pdcp_xform {uint32_t hfn_ovrd; }; +/** DOCSIS direction */ +enum rte_security_docsis_direction { +RTE_SECURITY_DOCSIS_UPLINK , +/**< Uplink +* - Decryption, followed by CRC Verification +*/ +RTE_SECURITY_DOCSIS_DOWNLINK , +/**< Downlink +* - CRC Generation, followed by Encryption +*/ +}; + +/** +* DOCSIS security session configuration. +* +* This structure contains data required to create a DOCSIS security session. +*/ +struct rte_security_docsis_xform { +enum rte_security_docsis_direction direction; +/**< DOCSIS direction */ +}; +/** * Security session action type. */
@@ -325,6 +347,8 @@ enum rte_security_session_protocol {/**< MACSec Protocol */ RTE_SECURITY_PROTOCOL_PDCP ,/**< PDCP Protocol */ + RTE_SECURITY_PROTOCOL_DOCSIS, + /**< DOCSIS Protocol */ };/**
@@ -340,6 +364,7 @@ struct rte_security_session_conf {struct rte_security_ipsec_xform ipsec;struct rte_security_macsec_xform macsec;struct rte_security_pdcp_xform pdcp; +struct rte_security_docsis_xform docsis; };/**< Configuration parameters for security session */ struct rte_crypto_sym_xform *crypto_xform;
@@ -523,6 +548,10 @@ struct rte_security_pdcp_stats {uint64_t reserved; }; +struct rte_security_docsis_stats { +uint64_t reserved; +}; +struct rte_security_stats {enum rte_security_session_protocol protocol;/**< Security protocol to be configured */
@@ -532,6 +561,7 @@ struct rte_security_stats {struct rte_security_macsec_stats macsec;struct rte_security_ipsec_stats ipsec;struct rte_security_pdcp_stats pdcp; +struct rte_security_docsis_stats docsis; }; };
@@ -591,6 +621,11 @@ struct rte_security_capability {/**< Capability flags, see RTE_SECURITY_PDCP_* */ } pdcp;/**< PDCP capability */ +struct { +enum rte_security_docsis_direction direction; +/**< DOCSIS direction */ + } docsis; +/**< DOCSIS capability */ };const struct rte_cryptodev_capabilities *crypto_capabilities;
@@ -649,6 +684,9 @@ struct rte_security_capability_idx {enum rte_security_pdcp_domain domain;uint32_t capa_flags; } pdcp; +struct { +enum rte_security_docsis_direction direction; + } docsis; }; };
Signature · 1 line
2.17.1
PATCH v4 2/7 cryptodev: add a note regarding DOCSIS protocol support
In reply to David CoyleAdd a note to the rte_crypto_sym_op->auth.data fields to state that for DOCSIS security protocol, these are used to specify the offset and length of data over which the CRC is calculated.
--- lib/librte_cryptodev/rte_crypto_sym.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
lib/librte_cryptodev/rte_crypto_sym.h +14 -0
@@ -705,6 +705,14 @@ struct rte_crypto_sym_op {* For KASUMI @ RTE_CRYPTO_AUTH_KASUMI_F9, * this offset should be such that * data to authenticate starts at COUNT. +* +* @note +* For DOCSIS security protocol, this +* offset is the DOCSIS header length +* and, therefore, also the CRC offset +* i.e. the number of bytes into the +* packet at which CRC calculation +* should begin. */ uint32_t length;/**< The message length, in bytes, of the source
@@ -723,6 +731,12 @@ struct rte_crypto_sym_op {* the length should include the COUNT, * FRESH, message, direction bit and padding * (to be multiple of 8 bits). +* +* @note +* For DOCSIS security protocol, this +* is the CRC length i.e. the number of +* bytes in the packet over which the +* CRC should be calculated */ } data;/**< Data offsets and length for authentication */
Signature · 1 line
2.17.1
PATCH v4 5/7 test/crypto: add DOCSIS security test cases
In reply to David CoyleAdd uplink and downlink DOCSIS unit test cases and vectors, to test the combined DOCSIS Crypto-CRC support that has been added to the rte_security library.
--- app/test/test_cryptodev.c | 513 ++++++ ...t_cryptodev_security_docsis_test_vectors.h | 1544 +++++++++++++++++ 2 files changed, 2057 insertions(+) create mode 100644 app/test/test_cryptodev_security_docsis_test_vectors.h
app/test/test_cryptodev.c +513 -0
@@ -11,6 +11,7 @@#include <rte_memcpy.h> #include <rte_pause.h> #include <rte_bus_vdev.h> +#include <rte_ether.h> #include <rte_crypto.h> #include <rte_cryptodev.h>
@@ -42,6 +43,7 @@#ifdef RTE_LIBRTE_SECURITY #include "test_cryptodev_security_pdcp_test_vectors.h" #include "test_cryptodev_security_pdcp_test_func.h" +#include "test_cryptodev_security_docsis_test_vectors.h" #endif #define VDEV_ARGS_SIZE 100
@@ -72,6 +74,9 @@ struct crypto_unittest_params {struct rte_crypto_sym_xform cipher_xform;struct rte_crypto_sym_xform auth_xform;struct rte_crypto_sym_xform aead_xform; +#ifdef RTE_LIBRTE_SECURITY +struct rte_security_docsis_xform docsis_xform; +#endif union {struct rte_cryptodev_sym_session *sess;
@@ -7067,6 +7072,34 @@ test_authenticated_encryption(const struct aead_test_data *tdata) }#ifdef RTE_LIBRTE_SECURITY +static int +security_proto_supported (enum rte_security_session_protocol proto) +{ +struct crypto_testsuite_params *ts_params = &testsuite_params; + +const struct rte_security_capability *capabilities; +const struct rte_security_capability *capability; +uint16_t i =0 ; + +struct rte_security_ctx *ctx = (struct rte_security_ctx *) +rte_cryptodev_get_sec_ctx ( + ts_params->valid_devs[0 ]); + + + capabilities =rte_security_capabilities_get (ctx); + +if (capabilities ==NULL ) +return -ENOTSUP ; + +while ((capability = &capabilities[i++])->action != +RTE_SECURITY_ACTION_TYPE_NONE ) { +if (capability->protocol == proto) +return 0 ; + } + +return -ENOTSUP ; +} +/* Basic algorithm run function for async inplace mode. * Creates a session from input parameters and runs one operation * on input_vec. Checks the output of the crypto operation against
@@ -7670,6 +7703,9 @@ test_PDCP_PROTO_all(void)if (!(feat_flags &RTE_CRYPTODEV_FF_SECURITY ))return -ENOTSUP ; +if (security_proto_supported (RTE_SECURITY_PROTOCOL_PDCP ) <0 ) +return -ENOTSUP ; + status =test_PDCP_PROTO_cplane_encap_all (); status +=test_PDCP_PROTO_cplane_decap_all (); status +=test_PDCP_PROTO_uplane_encap_all ();
@@ -7684,6 +7720,481 @@ test_PDCP_PROTO_all(void) else return TEST_SUCCESS; } + +static int +test_docsis_proto_uplink (int i,struct docsis_test_data *d_td) +{ +struct crypto_testsuite_params *ts_params = &testsuite_params; +struct crypto_unittest_params *ut_params = &unittest_params; +uint8_t *plaintext, *ciphertext; +uint8_t *iv_ptr; +int32_t cipher_len, crc_len; +uint32_t crc_data_len; +int ret =TEST_SUCCESS ; + +struct rte_security_ctx *ctx = (struct rte_security_ctx *) +rte_cryptodev_get_sec_ctx ( + ts_params->valid_devs[0 ]); + +/* Verify the capabilities */ +struct rte_security_capability_idx sec_cap_idx; +const struct rte_security_capability *sec_cap; +const struct rte_cryptodev_capabilities *crypto_cap; +const struct rte_cryptodev_symmetric_capability *sym_cap; +int j =0 ; + + sec_cap_idx.action =RTE_SECURITY_ACTION_TYPE_LOOKASIDE_PROTOCOL ; + sec_cap_idx.protocol =RTE_SECURITY_PROTOCOL_DOCSIS ; + sec_cap_idx.docsis.direction =RTE_SECURITY_DOCSIS_UPLINK ; + + sec_cap =rte_security_capability_get (ctx, &sec_cap_idx); +if (sec_cap ==NULL ) +return -ENOTSUP ; + +while ((crypto_cap = &sec_cap->crypto_capabilities[j++])->op != +RTE_CRYPTO_OP_TYPE_UNDEFINED ) { +if (crypto_cap->op ==RTE_CRYPTO_OP_TYPE_SYMMETRIC && + crypto_cap->sym.xform_type == +RTE_CRYPTO_SYM_XFORM_CIPHER && + crypto_cap->sym.cipher.algo == +RTE_CRYPTO_CIPHER_AES_DOCSISBPI ) { + sym_cap = &crypto_cap->sym; +if (rte_cryptodev_sym_capability_check_cipher (sym_cap, + d_td->key.len, + d_td->iv.len) ==0 ) +break ; + } + } + +if (crypto_cap->op ==RTE_CRYPTO_OP_TYPE_UNDEFINED ) +return -ENOTSUP ; + +/* Setup source mbuf payload */ + ut_params->ibuf =rte_pktmbuf_alloc (ts_params->mbuf_pool); + memset(rte_pktmbuf_mtod(ut_params->ibuf, uint8_t *), 0, +rte_pktmbuf_tailroom (ut_params->ibuf)); + + ciphertext = (uint8_t *)rte_pktmbuf_append (ut_params->ibuf, + d_td->ciphertext.len); + +memcpy (ciphertext, d_td->ciphertext.data, d_td->ciphertext.len); + +/* Set session action type */ + ut_params->type =RTE_SECURITY_ACTION_TYPE_LOOKASIDE_PROTOCOL ; + +/* Setup cipher session parameters */ + ut_params->cipher_xform.type =RTE_CRYPTO_SYM_XFORM_CIPHER ; + ut_params->cipher_xform.cipher.algo =RTE_CRYPTO_CIPHER_AES_DOCSISBPI ; + ut_params->cipher_xform.cipher.op =RTE_CRYPTO_CIPHER_OP_DECRYPT ; + ut_params->cipher_xform.cipher.key.data = d_td->key.data; + ut_params->cipher_xform.cipher.key.length = d_td->key.len; + ut_params->cipher_xform.cipher.iv.length = d_td->iv.len; + ut_params->cipher_xform.cipher.iv.offset =IV_OFFSET ; + ut_params->cipher_xform.next =NULL ; + +/* Setup DOCSIS session parameters */ + ut_params->docsis_xform.direction =RTE_SECURITY_DOCSIS_UPLINK ; + +struct rte_security_session_conf sess_conf = { + .action_type = ut_params->type, + .protocol =RTE_SECURITY_PROTOCOL_DOCSIS , + .docsis = ut_params->docsis_xform, + .crypto_xform = &ut_params->cipher_xform, + }; + +/* Create security session */ + ut_params->sec_session =rte_security_session_create (ctx, &sess_conf, + ts_params->session_priv_mpool); + +if (!ut_params->sec_session) { +printf ("TestCase %s(%d) line %d: %s\n" , + __func__, i, __LINE__,"failed to allocate session" ); + ret =TEST_FAILED ; + goto on_err; + } + +/* Generate crypto op data structure */ + ut_params->op =rte_crypto_op_alloc (ts_params->op_mpool, +RTE_CRYPTO_OP_TYPE_SYMMETRIC ); +if (!ut_params->op) { +printf ("TestCase %s(%d) line %d: %s\n" , + __func__, i, __LINE__, +"failed to allocate symmetric crypto operation" ); + ret =TEST_FAILED ; + goto on_err; + } + +/* Setup CRC operation parameters */ + crc_len = d_td->ciphertext.no_crc == false ? + (d_td->ciphertext.len - + d_td->ciphertext.crc_offset - +RTE_ETHER_CRC_LEN ) : +0 ; + crc_len = crc_len >0 ? crc_len :0 ; + crc_data_len = crc_len ==0 ?0 :RTE_ETHER_CRC_LEN ; + ut_params->op->sym->auth.data.length = crc_len; + ut_params->op->sym->auth.data.offset = d_td->ciphertext.crc_offset; + +/* Setup cipher operation parameters */ + cipher_len = d_td->ciphertext.no_cipher == false ? + (d_td->ciphertext.len - + d_td->ciphertext.cipher_offset) : +0 ; + cipher_len = cipher_len >0 ? cipher_len :0 ; + ut_params->op->sym->cipher.data.length = cipher_len; + ut_params->op->sym->cipher.data.offset = d_td->ciphertext.cipher_offset; + +/* Setup cipher IV */ + iv_ptr = (uint8_t *)ut_params->op +IV_OFFSET ; +rte_memcpy (iv_ptr, d_td->iv.data, d_td->iv.len); + +/* Attach session to operation */ +rte_security_attach_session (ut_params->op, ut_params->sec_session); + +/* Set crypto operation mbufs */ + ut_params->op->sym->m_src = ut_params->ibuf; + ut_params->op->sym->m_dst =NULL ; + +/* Process crypto operation */ +if (process_crypto_request (ts_params->valid_devs[0 ], ut_params->op) == +NULL ) { +printf ("TestCase %s(%d) line %d: %s\n" , + __func__, i, __LINE__, +"failed to process security crypto op" ); + ret =TEST_FAILED ; + goto on_err; + } + +if (ut_params->op->status !=RTE_CRYPTO_OP_STATUS_SUCCESS ) { +printf ("TestCase %s(%d) line %d: %s\n" , + __func__, i, __LINE__,"crypto op processing failed" ); + ret =TEST_FAILED ; + goto on_err; + } + +/* Validate plaintext */ + plaintext = ciphertext; + +if (memcmp (plaintext, d_td->plaintext.data, + d_td->plaintext.len - crc_data_len)) { +printf ("TestCase %s(%d) line %d: %s\n" , + __func__, i, __LINE__,"plaintext not as expected\n" ); +rte_hexdump (stdout,"expected" , d_td->plaintext.data, + d_td->plaintext.len); +rte_hexdump (stdout,"actual" , plaintext, d_td->plaintext.len); + ret =TEST_FAILED ; + goto on_err; + } + +on_err: +rte_crypto_op_free (ut_params->op); + ut_params->op =NULL ; + +if (ut_params->sec_session) +rte_security_session_destroy (ctx, ut_params->sec_session); + ut_params->sec_session =NULL ; + +rte_pktmbuf_free (ut_params->ibuf); + ut_params->ibuf =NULL ; + +return ret; +} + +static int +test_docsis_proto_downlink (int i,struct docsis_test_data *d_td) +{ +struct crypto_testsuite_params *ts_params = &testsuite_params; +struct crypto_unittest_params *ut_params = &unittest_params; +uint8_t *plaintext, *ciphertext; +uint8_t *iv_ptr; +int32_t cipher_len, crc_len; +int ret =TEST_SUCCESS ; + +struct rte_security_ctx *ctx = (struct rte_security_ctx *) +rte_cryptodev_get_sec_ctx ( + ts_params->valid_devs[0 ]); + +/* Verify the capabilities */ +struct rte_security_capability_idx sec_cap_idx; +const struct rte_security_capability *sec_cap; +const struct rte_cryptodev_capabilities *crypto_cap; +const struct rte_cryptodev_symmetric_capability *sym_cap; +int j =0 ; + + sec_cap_idx.action =RTE_SECURITY_ACTION_TYPE_LOOKASIDE_PROTOCOL ; + sec_cap_idx.protocol =RTE_SECURITY_PROTOCOL_DOCSIS ; + sec_cap_idx.docsis.direction =RTE_SECURITY_DOCSIS_DOWNLINK ; + + sec_cap =rte_security_capability_get (ctx, &sec_cap_idx); +if (sec_cap ==NULL ) +return -ENOTSUP ; + +while ((crypto_cap = &sec_cap->crypto_capabilities[j++])->op != +RTE_CRYPTO_OP_TYPE_UNDEFINED ) { +if (crypto_cap->op ==RTE_CRYPTO_OP_TYPE_SYMMETRIC && + crypto_cap->sym.xform_type == +RTE_CRYPTO_SYM_XFORM_CIPHER && + crypto_cap->sym.cipher.algo == +RTE_CRYPTO_CIPHER_AES_DOCSISBPI ) { + sym_cap = &crypto_cap->sym; +if (rte_cryptodev_sym_capability_check_cipher (sym_cap, + d_td->key.len, + d_td->iv.len) ==0 ) +break ; + } + } + +if (crypto_cap->op ==RTE_CRYPTO_OP_TYPE_UNDEFINED ) +return -ENOTSUP ; + +/* Setup source mbuf payload */ + ut_params->ibuf =rte_pktmbuf_alloc (ts_params->mbuf_pool); + memset(rte_pktmbuf_mtod(ut_params->ibuf, uint8_t *), 0, +rte_pktmbuf_tailroom (ut_params->ibuf)); + + plaintext = (uint8_t *)rte_pktmbuf_append (ut_params->ibuf, + d_td->plaintext.len); + +memcpy (plaintext, d_td->plaintext.data, d_td->plaintext.len); + +/* Set session action type */ + ut_params->type =RTE_SECURITY_ACTION_TYPE_LOOKASIDE_PROTOCOL ; + +/* Setup cipher session parameters */ + ut_params->cipher_xform.type =RTE_CRYPTO_SYM_XFORM_CIPHER ; + ut_params->cipher_xform.cipher.algo =RTE_CRYPTO_CIPHER_AES_DOCSISBPI ; + ut_params->cipher_xform.cipher.op =RTE_CRYPTO_CIPHER_OP_ENCRYPT ; + ut_params->cipher_xform.cipher.key.data = d_td->key.data; + ut_params->cipher_xform.cipher.key.length = d_td->key.len; + ut_params->cipher_xform.cipher.iv.length = d_td->iv.len; + ut_params->cipher_xform.cipher.iv.offset =IV_OFFSET ; + ut_params->cipher_xform.next =NULL ; + +/* Setup DOCSIS session parameters */ + ut_params->docsis_xform.direction =RTE_SECURITY_DOCSIS_DOWNLINK ; + +struct rte_security_session_conf sess_conf = { + .action_type = ut_params->type, + .protocol =RTE_SECURITY_PROTOCOL_DOCSIS , + .docsis = ut_params->docsis_xform, + .crypto_xform = &ut_params->cipher_xform, + }; + +/* Create security session */ + ut_params->sec_session =rte_security_session_create (ctx, &sess_conf, + ts_params->session_priv_mpool); + +if (!ut_params->sec_session) { +printf ("TestCase %s(%d) line %d: %s\n" , + __func__, i, __LINE__,"failed to allocate session" ); + ret =TEST_FAILED ; + goto on_err; + } + +/* Generate crypto op data structure */ + ut_params->op =rte_crypto_op_alloc (ts_params->op_mpool, +RTE_CRYPTO_OP_TYPE_SYMMETRIC ); +if (!ut_params->op) { +printf ("TestCase %s(%d) line %d: %s\n" , + __func__, i, __LINE__, +"failed to allocate security crypto operation" ); + ret =TEST_FAILED ; + goto on_err; + } + +/* Setup CRC operation parameters */ + crc_len = d_td->plaintext.no_crc == false ? + (d_td->plaintext.len - + d_td->plaintext.crc_offset - +RTE_ETHER_CRC_LEN ) : +0 ; + crc_len = crc_len >0 ? crc_len :0 ; + ut_params->op->sym->auth.data.length = crc_len; + ut_params->op->sym->auth.data.offset = d_td->plaintext.crc_offset; + +/* Setup cipher operation parameters */ + cipher_len = d_td->plaintext.no_cipher == false ? + (d_td->plaintext.len - + d_td->plaintext.cipher_offset) : +0 ; + cipher_len = cipher_len >0 ? cipher_len :0 ; + ut_params->op->sym->cipher.data.length = cipher_len; + ut_params->op->sym->cipher.data.offset = d_td->plaintext.cipher_offset; + +/* Setup cipher IV */ + iv_ptr = (uint8_t *)ut_params->op +IV_OFFSET ; +rte_memcpy (iv_ptr, d_td->iv.data, d_td->iv.len); + +/* Attach session to operation */ +rte_security_attach_session (ut_params->op, ut_params->sec_session); + +/* Set crypto operation mbufs */ + ut_params->op->sym->m_src = ut_params->ibuf; + ut_params->op->sym->m_dst =NULL ; + +/* Process crypto operation */ +if (process_crypto_request (ts_params->valid_devs[0 ], ut_params->op) == +NULL ) { +printf ("TestCase %s(%d) line %d: %s\n" , + __func__, i, __LINE__, +"failed to process security crypto op" ); + ret =TEST_FAILED ; + goto on_err; + } + +if (ut_params->op->status !=RTE_CRYPTO_OP_STATUS_SUCCESS ) { +printf ("TestCase %s(%d) line %d: %s\n" , + __func__, i, __LINE__,"crypto op processing failed" ); + ret =TEST_FAILED ; + goto on_err; + } + +/* Validate ciphertext */ + ciphertext = plaintext; + +if (memcmp (ciphertext, d_td->ciphertext.data, d_td->ciphertext.len)) { +printf ("TestCase %s(%d) line %d: %s\n" , + __func__, i, __LINE__,"ciphertext not as expected\n" ); +rte_hexdump (stdout,"expected" , d_td->ciphertext.data, + d_td->ciphertext.len); +rte_hexdump (stdout,"actual" , ciphertext, d_td->ciphertext.len); + ret =TEST_FAILED ; + goto on_err; + } + +on_err: +rte_crypto_op_free (ut_params->op); + ut_params->op =NULL ; + +if (ut_params->sec_session) +rte_security_session_destroy (ctx, ut_params->sec_session); + ut_params->sec_session =NULL ; + +rte_pktmbuf_free (ut_params->ibuf); + ut_params->ibuf =NULL ; + +return ret; +} + +#define TEST_DOCSIS_COUNT (func) do { \ + int ret = func; \ + if (ret == TEST_SUCCESS) { \ + printf("\t%2d)", n++); \ + printf("+++++ PASSED:" #func"\n"); \ + p++; \ + } else if (ret == -ENOTSUP) { \ + printf("\t%2d)", n++); \ + printf("~~~~~ UNSUPP:" #func"\n"); \ + u++; \ + } else { \ + printf("\t%2d)", n++); \ + printf("----- FAILED:" #func"\n"); \ + f++; \ + } \ +} while (0) + +static int +test_DOCSIS_PROTO_uplink_all (void ) +{ +int p =0 , u =0 , f =0 , n =0 ; + +TEST_DOCSIS_COUNT (test_docsis_proto_uplink (1 , &docsis_test_case_1)); +TEST_DOCSIS_COUNT (test_docsis_proto_uplink (2 , &docsis_test_case_2)); +TEST_DOCSIS_COUNT (test_docsis_proto_uplink (3 , &docsis_test_case_3)); +TEST_DOCSIS_COUNT (test_docsis_proto_uplink (4 , &docsis_test_case_4)); +TEST_DOCSIS_COUNT (test_docsis_proto_uplink (5 , &docsis_test_case_5)); +TEST_DOCSIS_COUNT (test_docsis_proto_uplink (6 , &docsis_test_case_6)); +TEST_DOCSIS_COUNT (test_docsis_proto_uplink (7 , &docsis_test_case_7)); +TEST_DOCSIS_COUNT (test_docsis_proto_uplink (8 , &docsis_test_case_8)); +TEST_DOCSIS_COUNT (test_docsis_proto_uplink (9 , &docsis_test_case_9)); +TEST_DOCSIS_COUNT (test_docsis_proto_uplink (10 , &docsis_test_case_10)); +TEST_DOCSIS_COUNT (test_docsis_proto_uplink (11 , &docsis_test_case_11)); +TEST_DOCSIS_COUNT (test_docsis_proto_uplink (12 , &docsis_test_case_12)); +TEST_DOCSIS_COUNT (test_docsis_proto_uplink (13 , &docsis_test_case_13)); +TEST_DOCSIS_COUNT (test_docsis_proto_uplink (14 , &docsis_test_case_14)); +TEST_DOCSIS_COUNT (test_docsis_proto_uplink (15 , &docsis_test_case_15)); +TEST_DOCSIS_COUNT (test_docsis_proto_uplink (16 , &docsis_test_case_16)); +TEST_DOCSIS_COUNT (test_docsis_proto_uplink (17 , &docsis_test_case_17)); +TEST_DOCSIS_COUNT (test_docsis_proto_uplink (18 , &docsis_test_case_18)); +TEST_DOCSIS_COUNT (test_docsis_proto_uplink (19 , &docsis_test_case_19)); +TEST_DOCSIS_COUNT (test_docsis_proto_uplink (20 , &docsis_test_case_20)); +TEST_DOCSIS_COUNT (test_docsis_proto_uplink (21 , &docsis_test_case_21)); +TEST_DOCSIS_COUNT (test_docsis_proto_uplink (22 , &docsis_test_case_22)); +TEST_DOCSIS_COUNT (test_docsis_proto_uplink (23 , &docsis_test_case_23)); +TEST_DOCSIS_COUNT (test_docsis_proto_uplink (24 , &docsis_test_case_24)); +TEST_DOCSIS_COUNT (test_docsis_proto_uplink (25 , &docsis_test_case_25)); +TEST_DOCSIS_COUNT (test_docsis_proto_uplink (26 , &docsis_test_case_26)); + +if (f) +printf ("## %s: %d passed out of %d (%d unsupported)\n" , + __func__, p, n, u); + +return f; +}; + +static int +test_DOCSIS_PROTO_downlink_all (void ) +{ +int p =0 , u =0 , f =0 , n =0 ; + +TEST_DOCSIS_COUNT (test_docsis_proto_downlink (1 , &docsis_test_case_1)); +TEST_DOCSIS_COUNT (test_docsis_proto_downlink (2 , &docsis_test_case_2)); +TEST_DOCSIS_COUNT (test_docsis_proto_downlink (3 , &docsis_test_case_3)); +TEST_DOCSIS_COUNT (test_docsis_proto_downlink (4 , &docsis_test_case_4)); +TEST_DOCSIS_COUNT (test_docsis_proto_downlink (5 , &docsis_test_case_5)); +TEST_DOCSIS_COUNT (test_docsis_proto_downlink (6 , &docsis_test_case_6)); +TEST_DOCSIS_COUNT (test_docsis_proto_downlink (7 , &docsis_test_case_7)); +TEST_DOCSIS_COUNT (test_docsis_proto_downlink (8 , &docsis_test_case_8)); +TEST_DOCSIS_COUNT (test_docsis_proto_downlink (9 , &docsis_test_case_9)); +TEST_DOCSIS_COUNT (test_docsis_proto_downlink (10 , &docsis_test_case_10)); +TEST_DOCSIS_COUNT (test_docsis_proto_downlink (11 , &docsis_test_case_11)); +TEST_DOCSIS_COUNT (test_docsis_proto_downlink (12 , &docsis_test_case_12)); +TEST_DOCSIS_COUNT (test_docsis_proto_downlink (13 , &docsis_test_case_13)); +TEST_DOCSIS_COUNT (test_docsis_proto_downlink (14 , &docsis_test_case_14)); +TEST_DOCSIS_COUNT (test_docsis_proto_downlink (15 , &docsis_test_case_15)); +TEST_DOCSIS_COUNT (test_docsis_proto_downlink (16 , &docsis_test_case_16)); +TEST_DOCSIS_COUNT (test_docsis_proto_downlink (17 , &docsis_test_case_17)); +TEST_DOCSIS_COUNT (test_docsis_proto_downlink (18 , &docsis_test_case_18)); +TEST_DOCSIS_COUNT (test_docsis_proto_downlink (19 , &docsis_test_case_19)); +TEST_DOCSIS_COUNT (test_docsis_proto_downlink (20 , &docsis_test_case_20)); +TEST_DOCSIS_COUNT (test_docsis_proto_downlink (21 , &docsis_test_case_21)); +TEST_DOCSIS_COUNT (test_docsis_proto_downlink (22 , &docsis_test_case_22)); +TEST_DOCSIS_COUNT (test_docsis_proto_downlink (23 , &docsis_test_case_23)); +TEST_DOCSIS_COUNT (test_docsis_proto_downlink (24 , &docsis_test_case_24)); +TEST_DOCSIS_COUNT (test_docsis_proto_downlink (25 , &docsis_test_case_25)); +TEST_DOCSIS_COUNT (test_docsis_proto_downlink (26 , &docsis_test_case_26)); + +if (f) +printf ("## %s: %d passed out of %d (%d unsupported)\n" , + __func__, p, n, u); + +return f; +}; + +static int +test_DOCSIS_PROTO_all (void ) +{ +struct crypto_testsuite_params *ts_params = &testsuite_params; +struct rte_cryptodev_info dev_info; +int status; + +rte_cryptodev_info_get (ts_params->valid_devs[0 ], &dev_info); +uint64_t feat_flags = dev_info.feature_flags; + +if (!(feat_flags &RTE_CRYPTODEV_FF_SECURITY )) +return -ENOTSUP ; + +if (security_proto_supported (RTE_SECURITY_PROTOCOL_DOCSIS ) <0 ) +return -ENOTSUP ; + + status =test_DOCSIS_PROTO_uplink_all (); + status +=test_DOCSIS_PROTO_downlink_all (); + +if (status) +return TEST_FAILED ; +else +return TEST_SUCCESS ; +}#endif static int
@@ -12342,6 +12853,8 @@ static struct unit_test_suite cryptodev_testsuite = {#ifdef RTE_LIBRTE_SECURITY TEST_CASE_ST (ut_setup, ut_teardown, test_PDCP_PROTO_all), +TEST_CASE_ST (ut_setup, ut_teardown, + test_DOCSIS_PROTO_all), #endifTEST_CASES_END ()/**< NULL terminate unit test array */ }
app/test/test_cryptodev_security_docsis_test_vectors.h new file +1544 -0
1,544 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH v4 3/7 crypto/aesni_mb: add support for DOCSIS protocol
In reply to David CoyleAdd support to the AESNI-MB PMD for the DOCSIS protocol, through the rte_security API. This, therefore, includes adding support for the rte_security API to this PMD.
--- doc/guides/cryptodevs/aesni_mb.rst | 8 + doc/guides/cryptodevs/features/aesni_mb.ini | 1 + doc/guides/rel_notes/release_20_08.rst | 5 + .../crypto/aesni_mb/aesni_mb_pmd_private.h | 19 +- drivers/crypto/aesni_mb/meson.build | 2 +- drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c | 301 +++++++++++++++++- .../crypto/aesni_mb/rte_aesni_mb_pmd_ops.c | 125 ++++++++ 7 files changed, 454 insertions(+), 7 deletions(-)
doc/guides/cryptodevs/aesni_mb.rst +8 -0
@@ -55,10 +55,18 @@ AEAD algorithms: * RTE_CRYPTO_AEAD_AES_CCM * RTE_CRYPTO_AEAD_AES_GCM +Protocol offloads: + +* RTE_SECURITY_PROTOCOL_DOCSIS + Limitations ----------- * Chained mbufs are not supported. +* Out-of-place is not supported for combined Crypto-CRC DOCSIS security + protocol. +* RTE_CRYPTO_CIPHER_DES_DOCSISBPI is not supported for combined Crypto-CRC + DOCSIS security protocol. Installation
doc/guides/cryptodevs/features/aesni_mb.ini +1 -0
@@ -6,6 +6,7 @@ [Features] Symmetric crypto = Y Sym operation chaining = Y +Protocol offload = Y CPU SSE = Y CPU AVX = Y CPU AVX2 = Y
doc/guides/rel_notes/release_20_08.rst +5 -0
@@ -96,6 +96,11 @@ New Features * Added support for DCF datapath configuration. +* **Updated the AESNI MB crypto PMD.** + + Added support for lookaside protocol offload for DOCSIS through the + ``rte_security`` API. + * **Added support for BPF_ABS/BPF_IND load instructions.** Added support for two BPF non-generic instructions:
drivers/crypto/aesni_mb/aesni_mb_pmd_private.h +18 -1
@@ -7,6 +7,12 @@#include <intel-ipsec-mb.h> +#if defined(RTE_LIBRTE_SECURITY ) && (IMB_VERSION_NUM ) >=IMB_VERSION (0 ,54 ,0 ) +#define AESNI_MB_DOCSIS_SEC_ENABLED 1 +#include <rte_security.h> +#include <rte_security_driver.h> +#endif +enum aesni_mb_vector_mode {RTE_AESNI_MB_NOT_SUPPORTED =0 ,RTE_AESNI_MB_SSE ,
@@ -272,8 +278,19 @@ aesni_mb_set_session_parameters(const MB_MGR *mb_mgr,struct aesni_mb_session *sess, const struct rte_crypto_sym_xform *xform); -/** device specific operations function pointer structure */ +#ifdef AESNI_MB_DOCSIS_SEC_ENABLED +extern int +aesni_mb_set_docsis_sec_session_parameters ( + __rte_unused struct rte_cryptodev *dev, +struct rte_security_session_conf *conf, +void *sess); +#endif + +/** device specific operations function pointer structures */ extern struct rte_cryptodev_ops *rte_aesni_mb_pmd_ops; +#ifdef AESNI_MB_DOCSIS_SEC_ENABLED +extern struct rte_security_ops *rte_aesni_mb_pmd_sec_ops; +#endif extern uint32_t aesni_mb_cpu_crypto_process_bulk(struct rte_cryptodev *dev,
drivers/crypto/aesni_mb/meson.build +1 -1
@@ -22,4 +22,4 @@ else endif sources = files('rte_aesni_mb_pmd.c', 'rte_aesni_mb_pmd_ops.c') -deps += ['bus_vdev'] +deps += ['bus_vdev', 'net', 'security']
drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c +296 -5
361 lines not on this page · raw message
drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c +125 -0
140 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH v4 6/7 test/security: add DOCSIS capability check tests
In reply to David CoyleAdd unit tests for DOCSIS capabilitity checks.
--- app/test/test_security.c | 88 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+)
app/test/test_security.c +88 -0
@@ -6,6 +6,7 @@#include <rte_log.h> #include <rte_memory.h> #include <rte_mempool.h> +#include <rte_ether.h> #include <rte_security.h> #include <rte_security_driver.h>
@@ -2268,6 +2269,89 @@ test_capability_get_pdcp_match(void)return TEST_SUCCESS ; } +/** +* Test execution of rte_security_capability_get when capabilities table +* does not contain entry with matching DOCSIS direction field +*/ +static int +test_capability_get_docsis_mismatch_direction (void ) +{ +struct security_unittest_params *ut_params = &unittest_params; +struct rte_security_capability_idx idx = { + .action =RTE_SECURITY_ACTION_TYPE_LOOKASIDE_PROTOCOL , + .protocol =RTE_SECURITY_PROTOCOL_DOCSIS , + .docsis = { + .direction =RTE_SECURITY_DOCSIS_DOWNLINK + }, + }; +struct rte_security_capability capabilities[] = { + { + .action =RTE_SECURITY_ACTION_TYPE_LOOKASIDE_PROTOCOL , + .protocol =RTE_SECURITY_PROTOCOL_DOCSIS , + .docsis = { + .direction =RTE_SECURITY_DOCSIS_UPLINK + }, + }, + { + .action =RTE_SECURITY_ACTION_TYPE_NONE , + }, + }; + + mock_capabilities_get_exp.device =NULL ; + mock_capabilities_get_exp.ret = capabilities; + +const struct rte_security_capability *ret; + ret =rte_security_capability_get (&ut_params->ctx, &idx); +TEST_ASSERT_MOCK_FUNCTION_CALL_RET (rte_security_capability_get, + ret,NULL ,"%p" ); +TEST_ASSERT_MOCK_CALLS (mock_capabilities_get_exp,1 ); + +return TEST_SUCCESS ; +} + +/** +* Test execution of rte_security_capability_get when capabilities table +* contains matching DOCSIS entry +*/ +static int +test_capability_get_docsis_match (void ) +{ +struct security_unittest_params *ut_params = &unittest_params; +struct rte_security_capability_idx idx = { + .action =RTE_SECURITY_ACTION_TYPE_LOOKASIDE_PROTOCOL , + .protocol =RTE_SECURITY_PROTOCOL_DOCSIS , + .docsis = { + .direction =RTE_SECURITY_DOCSIS_UPLINK + }, + }; +struct rte_security_capability capabilities[] = { + { + .action =RTE_SECURITY_ACTION_TYPE_INLINE_CRYPTO , + }, + { + .action =RTE_SECURITY_ACTION_TYPE_LOOKASIDE_PROTOCOL , + .protocol =RTE_SECURITY_PROTOCOL_DOCSIS , + .docsis = { + .direction =RTE_SECURITY_DOCSIS_UPLINK + }, + }, + { + .action =RTE_SECURITY_ACTION_TYPE_NONE , + }, + }; + + mock_capabilities_get_exp.device =NULL ; + mock_capabilities_get_exp.ret = capabilities; + +const struct rte_security_capability *ret; + ret =rte_security_capability_get (&ut_params->ctx, &idx); +TEST_ASSERT_MOCK_FUNCTION_CALL_RET (rte_security_capability_get, + ret, &capabilities[1 ],"%p" ); +TEST_ASSERT_MOCK_CALLS (mock_capabilities_get_exp,1 ); + +return TEST_SUCCESS ; +} +/** * Declaration of testcases */
@@ -2410,6 +2494,10 @@ static struct unit_test_suite security_testsuite = { test_capability_get_pdcp_mismatch_domain),TEST_CASE_ST (ut_setup_with_session, ut_teardown, test_capability_get_pdcp_match), +TEST_CASE_ST (ut_setup_with_session, ut_teardown, + test_capability_get_docsis_mismatch_direction), +TEST_CASE_ST (ut_setup_with_session, ut_teardown, + test_capability_get_docsis_match), TEST_CASES_END() /**< NULL terminate unit test array */ }
Signature · 1 line
2.17.1
PATCH v4 4/7 crypto/qat: add support for DOCSIS protocol
In reply to David CoyleAdd support to the QAT SYM PMD for the DOCSIS protocol, through the rte_security API. This, therefore, includes adding support for the rte_security API to this PMD.
--- doc/guides/cryptodevs/features/qat.ini | 1 + doc/guides/cryptodevs/qat.rst | 7 + doc/guides/rel_notes/release_20_08.rst | 5 + drivers/common/qat/Makefile | 3 + drivers/crypto/qat/meson.build | 2 + drivers/crypto/qat/qat_sym.c | 71 +++++++++- drivers/crypto/qat/qat_sym.h | 62 ++++++++- drivers/crypto/qat/qat_sym_capabilities.h | 42 ++++++ drivers/crypto/qat/qat_sym_pmd.c | 61 ++++++++- drivers/crypto/qat/qat_sym_pmd.h | 4 + drivers/crypto/qat/qat_sym_session.c | 153 ++++++++++++++++++++++ drivers/crypto/qat/qat_sym_session.h | 11 ++ 12 files changed, 409 insertions(+), 13 deletions(-)
doc/guides/cryptodevs/features/qat.ini +1 -0
@@ -7,6 +7,7 @@ Symmetric crypto = Y Sym operation chaining = Y HW Accelerated = Y +Protocol offload = Y In Place SGL = Y OOP SGL In SGL Out = Y OOP SGL In LB Out = Y
doc/guides/cryptodevs/qat.rst +7 -0
@@ -76,6 +76,9 @@ Supported AEAD algorithms: * ``RTE_CRYPTO_AEAD_AES_GCM`` * ``RTE_CRYPTO_AEAD_AES_CCM`` +Protocol offloads: + +* ``RTE_SECURITY_PROTOCOL_DOCSIS`` Supported Chains ~~~~~~~~~~~~~~~~
@@ -126,6 +129,10 @@ Limitations generations in the same process if planning to use for GCM. * The mixed algo feature on GEN2 is not supported by all kernel drivers. Check the notes under the Available Kernel Drivers table below for specific details. +* Out-of-place is not supported for combined Crypto-CRC DOCSIS security + protocol. +* ``RTE_CRYPTO_CIPHER_DES_DOCSISBPI`` is not supported for combined Crypto-CRC + DOCSIS security protocol. Extra notes on KASUMI F9 ~~~~~~~~~~~~~~~~~~~~~~~~
doc/guides/rel_notes/release_20_08.rst +5 -0
@@ -101,6 +101,11 @@ New Features Added support for lookaside protocol offload for DOCSIS through the ``rte_security`` API. +* **Updated the QuickAssist Technology (QAT) Crypto PMD.** + + Added support for lookaside protocol offload for DOCSIS through the + ``rte_security`` API. + * **Added support for BPF_ABS/BPF_IND load instructions.** Added support for two BPF non-generic instructions:
drivers/common/qat/Makefile +3 -0
@@ -35,6 +35,9 @@ endif ifeq ($(CONFIG_RTE_LIBRTE_PMD_QAT_SYM),y) LDLIBS += -lrte_cryptodev LDLIBS += -lcrypto +ifeq ($(CONFIG_RTE_LIBRTE_SECURITY),y) + LDLIBS += -lrte_net +endif CFLAGS += -DBUILD_QAT_SYM SRCS-y += qat_sym.c SRCS-y += qat_sym_session.c
drivers/crypto/qat/meson.build +2 -0
@@ -8,6 +8,8 @@ reason = '' # sentinal value to suppress printout dep = dependency('libcrypto', required: false) qat_includes += include_directories('.') qat_deps += 'cryptodev' +qat_deps += 'net' +qat_deps += 'security' if dep.found() # Add our sources files to the list qat_sources += files('qat_sym_pmd.c',
drivers/crypto/qat/qat_sym.c +66 -5
109 lines not on this page · raw message
drivers/crypto/qat/qat_sym.h +55 -7
90 lines not on this page · raw message
drivers/crypto/qat/qat_sym_capabilities.h +42 -0
46 lines not on this page · raw message
drivers/crypto/qat/qat_sym_pmd.c +60 -1
97 lines not on this page · raw message
drivers/crypto/qat/qat_sym_pmd.h +4 -0
@@ -7,7 +7,11 @@#ifdef BUILD_QAT_SYM +#include <rte_ether.h> #include <rte_cryptodev.h> +#ifdef RTE_LIBRTE_SECURITY +#include <rte_security.h> +#endif #include "qat_sym_capabilities.h" #include "qat_device.h"
drivers/crypto/qat/qat_sym_session.c +153 -0
162 lines not on this page · raw message
drivers/crypto/qat/qat_sym_session.h +11 -0
@@ -6,6 +6,9 @@#include <rte_crypto.h> #include <rte_cryptodev_pmd.h> +#ifdef RTE_LIBRTE_SECURITY +#include <rte_security.h> +#endif #include "qat_common.h" #include "icp_qat_hw.h"
@@ -156,4 +159,12 @@ qat_cipher_get_block_size(enum icp_qat_hw_cipher_algo qat_cipher_alg);int qat_sym_validate_zuc_key (int key_len,enum icp_qat_hw_cipher_algo *alg); +#ifdef RTE_LIBRTE_SECURITY +int +qat_security_session_create (void *dev,struct rte_security_session_conf *conf, +struct rte_security_session *sess,struct rte_mempool *mempool); +int +qat_security_session_destroy (void *dev,struct rte_security_session *sess); +#endif +#endif /* _QAT_SYM_SESSION_H_ */
Signature · 1 line
2.17.1
PATCH v4 7/7 app/crypto-perf: add support for DOCSIS protocol
In reply to David CoyleUpdate test-crypto-perf app to calculate DOCSIS throughput numbers.
1 new parameter is added for DOCSIS:
--docsis-hdr-sz <n>
./dpdk-test-crypto-perf -l 3,4 --socket-mem 2048,0
--vdev crypto_aesni_mb_pmd_1 -n 1 -- --devtype crypto_aesni_mb --optype docsis --cipher-algo aes-docsisbpi --cipher-op encrypt --cipher-key-sz 16 --cipher-iv-sz 16 --burst-sz 32 --total-ops 20000000 --buffer-sz 1024 --silent --docsis-hdr-sz 17
--- app/test-crypto-perf/cperf_ops.c | 82 ++++++++++++++++++-- app/test-crypto-perf/cperf_options.h | 5 +- app/test-crypto-perf/cperf_options_parsing.c | 67 +++++++++++++++- app/test-crypto-perf/cperf_test_throughput.c | 3 +- app/test-crypto-perf/cperf_test_vectors.c | 3 +- app/test-crypto-perf/main.c | 5 +- app/test-crypto-perf/meson.build | 2 +- doc/guides/rel_notes/release_20_08.rst | 6 ++ doc/guides/tools/cryptoperf.rst | 5 ++ 9 files changed, 166 insertions(+), 12 deletions(-)
app/test-crypto-perf/cperf_ops.c +77 -5
@@ -3,6 +3,7 @@*/ #include <rte_cryptodev.h> +#include <rte_ether.h> #include "cperf_ops.h" #include "cperf_test_vectors.h"
@@ -15,8 +16,7 @@ cperf_set_ops_security(struct rte_crypto_op **ops, uint16_t nb_ops, struct rte_cryptodev_sym_session *sess, const struct cperf_options *options __rte_unused, const struct cperf_test_vector *test_vector __rte_unused, - uint16_t iv_offset __rte_unused, - uint32_t *imix_idx __rte_unused) + uint16_t iv_offset __rte_unused, uint32_t *imix_idx) {uint16_t i;
@@ -24,14 +24,39 @@ cperf_set_ops_security(struct rte_crypto_op **ops,struct rte_crypto_sym_op *sym_op = ops[i]->sym;struct rte_security_session *sec_sess = (struct rte_security_session *)sess; +uint32_t buf_sz; ops[i]->status =RTE_CRYPTO_OP_STATUS_NOT_PROCESSED ;rte_security_attach_session (ops[i], sec_sess); sym_op->m_src = (struct rte_mbuf *)((uint8_t *)ops[i] + src_buf_offset); - sym_op->m_src->buf_len = options->segment_sz; - sym_op->m_src->data_len = options->test_buffer_size; - sym_op->m_src->pkt_len = sym_op->m_src->data_len; + +if (options->op_type ==CPERF_PDCP ) { + sym_op->m_src->buf_len = options->segment_sz; + sym_op->m_src->data_len = options->test_buffer_size; + sym_op->m_src->pkt_len = sym_op->m_src->data_len; + } + +if (options->op_type ==CPERF_DOCSIS ) { +if (options->imix_distribution_count) { + buf_sz = options->imix_buffer_sizes[*imix_idx]; + *imix_idx = (*imix_idx +1 ) % options->pool_sz; + }else + buf_sz = options->test_buffer_size; + +/* DOCSIS header is not CRC'ed */ + sym_op->auth.data.offset = options->docsis_hdr_sz; + sym_op->auth.data.length = buf_sz - + sym_op->auth.data.offset -RTE_ETHER_CRC_LEN ; +/* +* DOCSIS header and SRC and DST MAC addresses are not +* ciphered +*/ + sym_op->cipher.data.offset = sym_op->auth.data.offset + +RTE_ETHER_HDR_LEN -RTE_ETHER_TYPE_LEN ; + sym_op->cipher.data.length = buf_sz - + sym_op->cipher.data.offset; + }/* Set dest mbuf to NULL if out-of-place (dst_buf_offset = 0) */ if (dst_buf_offset ==0 )
@@ -589,6 +614,49 @@ cperf_create_session(struct rte_mempool *sess_mp,return (void *)rte_security_session_create (ctx, &sess_conf, sess_mp); } +if (options->op_type ==CPERF_DOCSIS ) { +enum rte_security_docsis_direction direction; + + cipher_xform.type =RTE_CRYPTO_SYM_XFORM_CIPHER ; + cipher_xform.next =NULL ; + cipher_xform.cipher.algo = options->cipher_algo; + cipher_xform.cipher.op = options->cipher_op; + cipher_xform.cipher.iv.offset = iv_offset; +if (options->cipher_algo !=RTE_CRYPTO_CIPHER_NULL ) { + cipher_xform.cipher.key.data = + test_vector->cipher_key.data; + cipher_xform.cipher.key.length = + test_vector->cipher_key.length; + cipher_xform.cipher.iv.length = + test_vector->cipher_iv.length; + }else { + cipher_xform.cipher.key.data =NULL ; + cipher_xform.cipher.key.length =0 ; + cipher_xform.cipher.iv.length =0 ; + } + cipher_xform.next =NULL ; + +if (options->cipher_op ==RTE_CRYPTO_CIPHER_OP_ENCRYPT ) + direction =RTE_SECURITY_DOCSIS_DOWNLINK ; +else + direction =RTE_SECURITY_DOCSIS_UPLINK ; + +struct rte_security_session_conf sess_conf = { + .action_type = +RTE_SECURITY_ACTION_TYPE_LOOKASIDE_PROTOCOL , + .protocol =RTE_SECURITY_PROTOCOL_DOCSIS , + {.docsis = { + .direction = direction, + } }, + .crypto_xform = &cipher_xform + }; +struct rte_security_ctx *ctx = (struct rte_security_ctx *) +rte_cryptodev_get_sec_ctx (dev_id); + +/* Create security session */ +return (void *)rte_security_session_create (ctx, + &sess_conf, priv_mp); + }#endif sess =rte_cryptodev_sym_session_create (sess_mp);/*
@@ -772,6 +840,10 @@ cperf_get_op_functions(const struct cperf_options *options, op_fns->populate_ops = cperf_set_ops_security; return 0; } +if (options->op_type ==CPERF_DOCSIS ) { + op_fns->populate_ops = cperf_set_ops_security; +return 0 ; + }#endif return -1 ; }
app/test-crypto-perf/cperf_options.h +4 -1
@@ -50,6 +50,7 @@#ifdef RTE_LIBRTE_SECURITY #define CPERF_PDCP_SN_SZ ("pdcp-sn-sz")#define CPERF_PDCP_DOMAIN ("pdcp-domain") +#define CPERF_DOCSIS_HDR_SZ ("docsis-hdr-sz")#endif #define CPERF_CSV ("csv-friendly")
@@ -75,7 +76,8 @@ enum cperf_op_type {CPERF_CIPHER_THEN_AUTH ,CPERF_AUTH_THEN_CIPHER ,CPERF_AEAD , - CPERF_PDCP +CPERF_PDCP , + CPERF_DOCSIS };extern const char *cperf_op_type_strs[];
@@ -122,6 +124,7 @@ struct cperf_options {#ifdef RTE_LIBRTE_SECURITY uint16_t pdcp_sn_sz;enum rte_security_pdcp_domain pdcp_domain; +uint16_t docsis_hdr_sz;#endif char device_type[RTE_CRYPTODEV_NAME_MAX_LEN ];enum cperf_op_type op_type;
app/test-crypto-perf/cperf_options_parsing.c +66 -1
128 lines not on this page · raw message
app/test-crypto-perf/cperf_test_throughput.c +2 -1
@@ -36,7 +36,8 @@ cperf_throughput_test_free(struct cperf_throughput_ctx *ctx)return ;if (ctx->sess) {#ifdef RTE_LIBRTE_SECURITY -if (ctx->options->op_type ==CPERF_PDCP ) { +if (ctx->options->op_type ==CPERF_PDCP || + ctx->options->op_type ==CPERF_DOCSIS ) {struct rte_security_ctx *sec_ctx = (struct rte_security_ctx *)rte_cryptodev_get_sec_ctx (ctx->dev_id);
app/test-crypto-perf/cperf_test_vectors.c +2 -1
@@ -469,7 +469,8 @@ cperf_test_vector_get_dummy(struct cperf_options *options)if (options->op_type ==CPERF_CIPHER_ONLY || options->op_type ==CPERF_CIPHER_THEN_AUTH || - options->op_type ==CPERF_AUTH_THEN_CIPHER ) { + options->op_type ==CPERF_AUTH_THEN_CIPHER || + options->op_type ==CPERF_DOCSIS ) {if (options->cipher_algo ==RTE_CRYPTO_CIPHER_NULL ) { t_vec->cipher_key.length =0 ; t_vec->ciphertext.data = plaintext;
app/test-crypto-perf/main.c +3 -2
@@ -39,7 +39,8 @@ const char *cperf_op_type_strs[] = { [CPERF_CIPHER_THEN_AUTH] = "cipher-then-auth", [CPERF_AUTH_THEN_CIPHER] = "auth-then-cipher", [CPERF_AEAD] = "aead", - [CPERF_PDCP ] ="pdcp" + [CPERF_PDCP] = "pdcp", + [CPERF_DOCSIS ] ="docsis" };const struct cperf_test cperf_testmap[] = {
@@ -244,7 +245,7 @@ cperf_initialize_cryptodev(struct cperf_options *opts, uint8_t *enabled_cdevs)#endif }else sessions_needed = enabled_cdev_count * - opts->nb_qps; + opts->nb_qps *2 ;/* * A single session is required per queue pair
app/test-crypto-perf/meson.build +1 -1
@@ -11,4 +11,4 @@ sources = files('cperf_ops.c', 'cperf_test_vectors.c', 'cperf_test_verify.c', 'main.c') -deps += ['cryptodev', 'security'] +deps += ['cryptodev', 'net', 'security']
doc/guides/rel_notes/release_20_08.rst +6 -0
@@ -122,6 +122,12 @@ New Features * Dump ``rte_flow`` memory consumption. * Measure packet per second forwarding. +* **Added support for DOCSIS protocol to dpdk-test-crypto-perf application.** + + Updated the ``dpdk-test-crypto-perf`` application to support the DOCSIS + protocol in order to measure the throughput of combined crypto and CRC + operations. + Removed Items -------------
doc/guides/tools/cryptoperf.rst +5 -0
@@ -193,6 +193,7 @@ The following are the application command-line options: auth-then-cipher aead pdcp + docsis For GCM/CCM algorithms you should use aead flag.
@@ -342,6 +343,10 @@ The following are the application command-line options: Set PDCP domain to specify Control/user plane. +* ``--docsis-hdr-sz <n>`` + + Set DOCSIS header size(n) in bytes. + Test Vector File ~~~~~~~~~~~~~~~~
Signature · 1 line
2.17.1
Re: [dpdk-dev] [PATCH v4 1/7] security: add support for DOCSIS protocol
In reply to David CoyleQuoted 19 lines
-----Original Message-----
From: Coyle, David <[email protected]>
Sent: Friday, July 3, 2020 1:39 PM
To: [email protected]; Doherty, Declan <[email protected]>; De Lara Guarch, Pablo <[email protected]>; Trahe, Fiona <[email protected]>; Zhang, Roy Fan <[email protected]>; Ananyev, Konstantin <[email protected]>
Cc: [email protected]; [email protected]; Yigit, Ferruh <[email protected]>; Ryan, Brendan <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Richardson, Bruce <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Coyle, David <[email protected]>; O'loingsigh, Mairtin <[email protected]>
Subject: [PATCH v4 1/7] security: add support for DOCSIS protocol
Quoted 6 lines
Add support for DOCSIS protocol to
rte_securitylibrary. This support currently comprises the combination of Crypto and CRC operations.Signed-off-by David Coyle <[email protected]>Signed-off-by Mairtin o Loingsigh <[email protected]>Acked-by Akhil Goyal <[email protected]>
Re: [dpdk-dev] [PATCH v4 5/7] test/crypto: add DOCSIS security test cases
In reply to David CoyleQuoted 20 lines
-----Original Message-----
From: Coyle, David <[email protected]>
Sent: Friday, July 3, 2020 1:40 PM
To: [email protected]; Doherty, Declan <[email protected]>; De Lara Guarch, Pablo <[email protected]>; Trahe, Fiona <[email protected]>; Zhang, Roy Fan <[email protected]>; Ananyev, Konstantin <[email protected]>
Cc: [email protected]; [email protected]; Yigit, Ferruh <[email protected]>; Ryan, Brendan <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Richardson, Bruce <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Coyle, David <[email protected]>; O'loingsigh, Mairtin <[email protected]>
Subject: [PATCH v4 5/7] test/crypto: add DOCSIS security test cases
Quoted 7 lines
Add uplink and downlink DOCSIS unit test cases and vectors, to test the combined DOCSIS Crypto-CRC support that has been added to the
rte_securitylibrary.Signed-off-by David Coyle <[email protected]>Signed-off-by Mairtin o Loingsigh <[email protected]>Acked-by Akhil Goyal <[email protected]>
Re: [dpdk-dev] [PATCH v4 7/7] app/crypto-perf: add support for DOCSIS protocol
In reply to David CoyleQuoted 25 lines
-----Original Message-----
From: Coyle, David <[email protected]>
Sent: Friday, July 3, 2020 1:40 PM
To: [email protected]; Doherty, Declan <[email protected]>; De Lara Guarch, Pablo <[email protected]>; Trahe, Fiona <[email protected]>; Zhang, Roy Fan <[email protected]>; Ananyev, Konstantin <[email protected]>
Cc: [email protected]; [email protected]; Yigit, Ferruh <[email protected]>; Ryan, Brendan <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Richardson, Bruce <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Coyle, David <[email protected]>; O'loingsigh, Mairtin <[email protected]>
Subject: [PATCH v4 7/7] app/crypto-perf: add support for DOCSIS protocolUpdate test-crypto-perf app to calculate DOCSIS throughput numbers.
1 new parameter is added for DOCSIS:
--docsis-hdr-sz <n>
Quoted 8 lines
./dpdk-test-crypto-perf -l 3,4 --socket-mem 2048,0 --vdev
crypto_aesni_mb_pmd_1-n 1 -- --devtypecrypto_aesni_mb--optype docsis -- cipher-algo aes-docsisbpi --cipher-op encrypt --cipher-key-sz 16 --cipher-iv-sz 16 --burst-sz 32 --total-ops 20000000 --buffer-sz 1024 --silent --docsis-hdr-sz 17Signed-off-by David Coyle <[email protected]>Signed-off-by Mairtin o Loingsigh <[email protected]>Acked-by Akhil Goyal <[email protected]>
Re: [dpdk-dev] [PATCH v4 2/7] cryptodev: add a note regarding DOCSIS protocol support
In reply to David CoyleQuoted 21 lines
-----Original Message-----
From: Coyle, David <[email protected]>
Sent: Friday, July 3, 2020 1:39 PM
To: [email protected]; Doherty, Declan <[email protected]>; De Lara Guarch, Pablo <[email protected]>; Trahe, Fiona <[email protected]>; Zhang, Roy Fan <[email protected]>; Ananyev, Konstantin <[email protected]>
Cc: [email protected]; [email protected]; Yigit, Ferruh <[email protected]>; Ryan, Brendan <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Richardson, Bruce <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Coyle, David <[email protected]>; O'loingsigh, Mairtin <[email protected]>
Subject: [PATCH v4 2/7] cryptodev: add a note regarding DOCSIS protocol support
Quoted 7 lines
Add a note to the
rte_crypto_sym_op->auth.datafields to state that for DOCSIS security protocol, these are used to specify the offset and length of data over which the CRC is calculated.Signed-off-by David Coyle <[email protected]>Signed-off-by Mairtin o Loingsigh <[email protected]>Acked-by Akhil Goyal <[email protected]>
Re: [dpdk-dev] [PATCH v4 3/7] crypto/aesni_mb: add support for DOCSIS protocol
In reply to David CoyleQuoted 20 lines
-----Original Message-----
From: Coyle, David <[email protected]>
Sent: Friday, July 3, 2020 1:39 PM
To: [email protected]; Doherty, Declan <[email protected]>; De Lara Guarch, Pablo <[email protected]>; Trahe, Fiona <[email protected]>; Zhang, Roy Fan <[email protected]>; Ananyev, Konstantin <[email protected]>
Cc: [email protected]; [email protected]; Yigit, Ferruh <[email protected]>; Ryan, Brendan <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Richardson, Bruce <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Coyle, David <[email protected]>; O'loingsigh, Mairtin <[email protected]>
Subject: [PATCH v4 3/7]crypto/aesni_mb: add support for DOCSIS protocol
Quoted 6 lines
Add support to the AESNI-MB PMD for the DOCSIS protocol, through the
rte_securityAPI. This, therefore, includes adding support for therte_securityAPI to this PMD.Signed-off-by David Coyle <[email protected]>Signed-off-by Mairtin o Loingsigh <[email protected]>
Re: [dpdk-dev] [PATCH v4 0/7] add support for DOCSIS protocol
In reply to David CoyleQuoted 128 lines
Introduction
============This patchset adds support for the DOCSIS protocol to the DPDK Security API (
rte_security), to be used by the AESNI-MB and QAT crypto devices to combine and accelerate Crypto and CRC functions of the DOCSIS protocol into a single operation.Performing these functions in parallel as a single operation can enable a significant performance improvement in a DPDK-based DOCSIS MAC pipeline.
Background
==========A number of approaches to combine DOCSIS Crypto and CRC functions have been discussed in the DPDK community to date, namely:
1) adding a newrte_acceleratorAPI, to provide a generic interface for combining operations of different types
2) using rawdev through a multi-function interface, again to provide a generic interface for combining operations of different types
3) adding support for DOCSIS Crypto-CRC torte_securityThe third option above is the preferred approach for the following reasons:
- it addresses the immediate use case to add DOCSIS Crypto-CRC support to DPDK so that it can be consumed easily by cable equipment vendors
- it uses an already existing framework in DPDK
- it will mean much less code churn in DOCSIS applications, which already userte_cryptodevfor encryption/decryptionUse Cases
=========The primary use case for this proposal has already been mentioned, namely to add DOCSIS Crypto-CRC support to DPDK:
- DOCSIS MAC: Crypto-CRC
- Order:
- Downstream: CRC, Encrypt
- Upstream: Decrypt, CRC
- Specifications:
- Crypto: 128-bit and 256-bit AES-CFB encryption variant for DOCSIS as described in section 11.1 of DOCSIS 3.1 Security Specification(https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fapps.ca
blelabs.com%2Fspecification%2FCM-SP- SECv3.1&data=02%7C01%7Cakhil.goyal%40nxp.com%7C39c59476749d4f5 ec88a08d81f5153d0%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C6 37293781444756595&sdata=W4YJl2bu8jsADjsLVDG2vXhYkOmbBhFY%2B4A a47onVak%3D&reserved=0)- CRC: Ethernet 32-bit CRC as defined in Ethernet/[ISO/IEC 8802-3]Note that support for these chained operations is already available in the Intel IPSec Multi-Buffer library.
However, other DOCSIS protocol functions could be optimized too in the future using the same
rte_securityAPI for DOCSIS (e.g. Header Checksum (HCS) calculation).v4:
* addressed Akhil's comments regarding documentation
* made some code fixes
* fixed possible NULL pointer dereference when allocatingsecurity_ctxin AESNI-MB and QAT PMDs
* freedsecurity_ctxmemory when exiting AESNI-MB and QAT PMDs
* added session IOVA verification update when creating security sessions in QAT PMDv3:
* removedrte_security_opdefinition
* now usingrte_crypto_sym_op->auth.datafields for CRC offset and length as suggested by feedback from Akhil and Konstantin
* addressed Pablo's comments
* removed support for out-of-place for DOCSIS protocol from QAT PMD
* updated dpdk-crypto-perf-test tool for DOCSIS
* updated documentationv2:
* addedrte_securityandrte_cryptodevcode changes
* added AESNI MB crypto PMD code changes
* added QAT SYM crypto PMD code changes
* added crypto unit tests
* added security unit testsv1:
* added proposed API changes
* added security capabilities toaesni_mbcrypto PMDDavid Coyle (7):
security: add support for DOCSIS protocol
cryptodev: add a note regarding DOCSIS protocol supportcrypto/aesni_mb: add support for DOCSIS protocolcrypto/qat: add support for DOCSIS protocol test/crypto: add DOCSIS security test cases test/security: add DOCSIS capability check tests app/crypto-perf: add support for DOCSIS protocolapp/test-crypto-perf/cperf_ops.c | 82 +- app/test-crypto-perf/cperf_options.h | 5 +- app/test-crypto-perf/cperf_options_parsing.c | 67 +- app/test-crypto-perf/cperf_test_throughput.c | 3 +- app/test-crypto-perf/cperf_test_vectors.c | 3 +- app/test-crypto-perf/main.c | 5 +- app/test-crypto-perf/meson.build | 2 +- app/test/test_cryptodev.c | 513 ++++++ ...t_cryptodev_security_docsis_test_vectors.h | 1544 +++++++++++++++++ app/test/test_security.c | 88 + doc/guides/cryptodevs/aesni_mb.rst | 8 + doc/guides/cryptodevs/features/aesni_mb.ini | 1 + doc/guides/cryptodevs/features/qat.ini | 1 + doc/guides/cryptodevs/qat.rst | 7 + doc/guides/prog_guide/rte_security.rst | 114 +- doc/guides/rel_notes/release_20_08.rst | 21 + doc/guides/tools/cryptoperf.rst | 5 + drivers/common/qat/Makefile | 3 + .../crypto/aesni_mb/aesni_mb_pmd_private.h | 19 +- drivers/crypto/aesni_mb/meson.build | 2 +- drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c | 301 +++- .../crypto/aesni_mb/rte_aesni_mb_pmd_ops.c | 125 ++ drivers/crypto/qat/meson.build | 2 + drivers/crypto/qat/qat_sym.c | 71 +- drivers/crypto/qat/qat_sym.h | 62 +- drivers/crypto/qat/qat_sym_capabilities.h | 42 + drivers/crypto/qat/qat_sym_pmd.c | 61 +-
Quoted 9 lines
drivers/crypto/qat/qat_sym_pmd.h | 4 + drivers/crypto/qat/qat_sym_session.c | 153 ++ drivers/crypto/qat/qat_sym_session.h | 11 + lib/librte_cryptodev/rte_crypto_sym.h | 14 + lib/librte_security/rte_security.c | 5 + lib/librte_security/rte_security.h | 38 + 33 files changed, 3348 insertions(+), 34 deletions(-) create mode 100644 app/test/test_cryptodev_security_docsis_test_vectors.h
Some modifications are done in the release notes while merging. Please check. Applied to dpdk-next-crypto
Thanks.
Re: [dpdk-dev] [PATCH v4 3/7] crypto/aesni_mb: add support for DOCSIS protocol
In reply to David Coyledrivers/crypto/aesni_mb/rte_aesni_mb_pmd.c cryptodev_aesni_mb_remove(struct rte_vdev_device *vdev) · line 2019
Quoted 4 lines
drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c +4
-0+#ifdef RTE_LIBRTE_SECURITYY +rte_free (cryptodev->security_ctx); +#endif +
Fixed typo while merging.