Skip to contentSkip to conversation

introduce multi-function processing support

PATCH Superseded David Coyle 4 participants 22 messages Apr 3, 2020 – Apr 10, 2020 Arm/Amlogic Meson SoC support

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

v2 cover introduce multi-function processing support

PLEASE NOTE: This patchset supercedes the following v1 patches which were mistakenly added as stand-alone patches (apologies for any confusion this may cause)

https://patchwork.dpdk.org/patch/66733/
https://patchwork.dpdk.org/patch/66735/
https://patchwork.dpdk.org/patch/66736/

PLEASE NOTE ALSO: Support for QAT, which the following patch addressed, has been dropped from this patchset and is now targetted at the next release (v20.08)

https://patchwork.dpdk.org/patch/66819/

Introduction
============

This patchset adds a new multi-function interface and a aesni_mb raw device PMD which uses this interface.

This patchset has already been discussed as part of the following RFC:

http://mails.dpdk.org/archives/dev/2020-February/157045.html
http://mails.dpdk.org/archives/dev/2020-March/159189.html

The main aim of this interface and raw PMDs is to provide a flexible and extensible way of combining one or more packet-processing functions into a single operation, thereby allowing these to be performed in parallel in optimized software libraries or in a hardware accelerator. These functions can include cryptography, compression and CRC/checksum calculation, while others can potentially be added in the future. 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 present and common across many access network data-plane pipelines, such as Cipher, Authentication, CRC, Bit-Interleaved-Parity (BIP), other checksums etc. Some prototyping has been done at Intel in relation to 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 XGS-PON MAC data-plane and DOCSIS MAC data-plane pipelines.

The prototypes used some protocol-specific modifications to the DPDK cryptodev library. In order to make this performance improvement consumable by network access equipment vendors, a more extensible and correct solution was required.

Hence, the introduction of a multi-function interface, initially for use by raw devices. In this patchset, a new aesni_mb raw device has been created which uses this interface.

NOTE: In a future DPDK release (currently targetting DPDK v20.08), a qat 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 an application access multiple devices using the same interface.

Use Cases
=========

The primary use cases for the multi-function interface and raw PMDs 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]

- XGS-PON 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.

However, it is not limited to these. The following are some of the other possible use-cases, which multi-function will allow for:

- Storage:
- Compression followed by Encryption
- IPSec over UDP:
- UDP Checksum calculation followed by Encryption

While DPDK's rte_cryptodev and rte_compressdev allow many cryptographic and compression algorithms to be chained together in one operation, there is no way to chain these with any error detection or checksum algorithms. And there is no way to chain crypto and compression algorithms together. The multi-function interface will allow these chains to be created, and also allow any future type of operation to be easily added.

Architecture
============

The following diagram shows where the multi-function interface and raw devices fit in an overall application architecture.

  +------------------------------------------------+
  |                                                |
  |                  Application                   |
  |   (e.g. vCMTS (DOCSIS), vOLT (XGS-PON), etc.)  |
  |                                                |
  +------------------------------------------------+
                          |
  +-----------------------|------------------------+
  |                       |                  DPDK  |
  |                       |                        |
  |             +---------------------+            |
  |             |                     |            |
  |             |     rte_rawdev      |            |
  |             |                     |            |            NOTE:
  |             +---------------------+        ____|______ 'MULTI-FUNCTION
  |                    /      \              /     |          INTERFACE'
  |                   /        \            /      |         is opaque to
  |                  /          \          /       |          rte_rawdev
  |       +--------------------------------+       |
  |       |    MULTI-FUNCTION INTERFACE    |       |
  |       +--------------------------------+       |
  |       +------------+      +------------+       |
  |       |   RAWDEV   |      |   RAWDEV   |       |
  |       |  AESNI-MB  |      |    QAT     |       |
  |       |    PMD     |      |    PMD     |       |
  |       +------------+      +------------+       |              NOTE:
  |              |                  |     \________|_____  'RAWDEV QAT PMD'
  +--------------|------------------|--------------+       will be added in
                 |                  |                         next release
          +------------+      +------------+
          |  AESNI-MB  |      |   QAT HW   |
          |   SW LIB   |      |            |
          +------------+      +------------+

David Coyle (4):
raw/common: add multi-function interface raw/aesni_mb: add aesni_mb raw device test/rawdev: add aesni_mb raw device tests app/crypto-perf: add support for multi-function processing

 app/test-crypto-perf/Makefile                 |    5 +
 app/test-crypto-perf/cperf_ops.c              |  265 +++
 app/test-crypto-perf/cperf_options.h          |   37 +-
 app/test-crypto-perf/cperf_options_parsing.c  |  396 ++++-
 app/test-crypto-perf/cperf_test_common.c      |   88 +-
 app/test-crypto-perf/cperf_test_latency.c     |  176 +-
 .../cperf_test_pmd_cyclecount.c               |   96 +-
 app/test-crypto-perf/cperf_test_throughput.c  |  164 +-
 .../cperf_test_vector_parsing.c               |   35 +-
 app/test-crypto-perf/cperf_test_vectors.c     |   53 +
 app/test-crypto-perf/cperf_test_vectors.h     |    9 +
 app/test-crypto-perf/cperf_test_verify.c      |  205 ++-
 app/test-crypto-perf/main.c                   |  255 ++-
 app/test-crypto-perf/meson.build              |    6 +
 app/test/test_rawdev.c                        |   16 +
 config/common_base                            |   11 +
 drivers/meson.build                           |    5 +
 drivers/raw/Makefile                          |    3 +
 drivers/raw/aesni_mb/Makefile                 |   47 +
 drivers/raw/aesni_mb/aesni_mb_rawdev.c        | 1536 +++++++++++++++++
 drivers/raw/aesni_mb/aesni_mb_rawdev.h        |  112 ++
 drivers/raw/aesni_mb/aesni_mb_rawdev_test.c   | 1102 ++++++++++++
 .../aesni_mb/aesni_mb_rawdev_test_vectors.h   | 1183 +++++++++++++
 drivers/raw/aesni_mb/meson.build              |   26 +
 .../aesni_mb/rte_rawdev_aesni_mb_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  |   11 +
 drivers/raw/common/multi_fn/rte_multi_fn.c    |  166 ++
 drivers/raw/common/multi_fn/rte_multi_fn.h    |  350 ++++
 .../raw/common/multi_fn/rte_multi_fn_driver.h |   55 +
 drivers/raw/meson.build                       |    3 +-
 meson.build                                   |    4 +
 mk/rte.app.mk                                 |    3 +
 36 files changed, 6270 insertions(+), 207 deletions(-)
 create mode 100644 drivers/raw/aesni_mb/Makefile
 create mode 100644 drivers/raw/aesni_mb/aesni_mb_rawdev.c
 create mode 100644 drivers/raw/aesni_mb/aesni_mb_rawdev.h
 create mode 100644 drivers/raw/aesni_mb/aesni_mb_rawdev_test.c
 create mode 100644 drivers/raw/aesni_mb/aesni_mb_rawdev_test_vectors.h
 create mode 100644 drivers/raw/aesni_mb/meson.build
 create mode 100644 drivers/raw/aesni_mb/rte_rawdev_aesni_mb_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
#1 lore raw

PATCH v2 1/4 raw/common: add multi-function interface

The multi-function interface provides a flexible and extensible way of combining one or more 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.

---

In particular, looking for feedback on the meson script changes that were required to build the drivers/raw/common/multi_fn directory. Thank you.

 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  |  11 +
 drivers/raw/common/multi_fn/rte_multi_fn.c    | 166 +++++++++
 drivers/raw/common/multi_fn/rte_multi_fn.h    | 350 ++++++++++++++++++
 .../raw/common/multi_fn/rte_multi_fn_driver.h |  55 +++
 meson.build                                   |   4 +
 mk/rte.app.mk                                 |   1 +
 13 files changed, 649 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
index c31175f9d..4f004968b 100644
@@ -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=n
+
 #
 # Compile librte_ring
 #
drivers/meson.build +5 -0
index 5502bf992..4e0caeff3 100644
@@ -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
index 80b043eb1..e16da8d95 100644
@@ -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
new file mode 100644
index 000000000..5c9ad399f
@@ -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
new file mode 100644
index 000000000..1a8334348
@@ -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
new file mode 100644
index 000000000..7ffbc6bb6
@@ -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
new file mode 100644
index 000000000..ec331362c
@@ -0,0 +1,9 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2020 Intel Corporation.
+
+sources = files('rte_multi_fn.c')
+
+deps = ['rawdev', 'cryptodev', 'compressdev']
+allow_experimental_apis = true
+
+install_headers('rte_multi_fn.h')
drivers/raw/common/multi_fn/rte_common_multi_fn_version.map new file +11 -0
new file mode 100644
index 000000000..ff04827da
@@ -0,0 +1,11 @@
+EXPERIMENTAL {
+	global:
+
+	rte_multi_fn_session_create;
+	rte_multi_fn_session_destroy;
+	rte_multi_fn_op_pool_create;
+	rte_multi_fn_op_bulk_alloc;
+	rte_multi_fn_op_free;
+
+	local: *;
+};
drivers/raw/common/multi_fn/rte_multi_fn.c new file +166 -0

166 lines not on this page · raw message

drivers/raw/common/multi_fn/rte_multi_fn.h new file +350 -0

350 lines not on this page · raw message

drivers/raw/common/multi_fn/rte_multi_fn_driver.h new file +55 -0

55 lines not on this page · raw message

meson.build +4 -0
index d36580438..de952fa98 100644
@@ -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
index d295ca0a5..b836d220d 100644
@@ -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
#2 lore raw

Re: [dpdk-dev] [PATCH v2 1/4] raw/common: add multi-function interface

Hi David,

Quoted 56 lines

-----Original Message-----
From: Coyle, David <[email protected]>
Sent: Friday, April 3, 2020 5:37 PM
To: [email protected]
Cc: Doherty, Declan <[email protected]>; Trahe, Fiona <[email protected]>; De Lara Guarch, Pablo <[email protected]>; Ryan, Brendan <[email protected]>; [email protected]; [email protected]; Coyle, David <[email protected]>; O'loingsigh, Mairtin <[email protected]>
Subject: [PATCH v2 1/4] raw/common: add multi-function interface

The multi-function interface provides a flexible and extensible way of combining one or more 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.

---

In particular, looking for feedback on the meson script changes that were required to build the drivers/raw/common/multi_fn directory. Thank you.

 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  |  11 +
 drivers/raw/common/multi_fn/rte_multi_fn.c    | 166 +++++++++
 drivers/raw/common/multi_fn/rte_multi_fn.h    | 350 ++++++++++++++++++
 .../raw/common/multi_fn/rte_multi_fn_driver.h |  55 +++
 meson.build                                   |   4 +
 mk/rte.app.mk                                 |   1 +
 13 files changed, 649 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 index renamed from config/common_base +0 -0

c31175f9d..4f004968b 100644

config/common_base +0 -0
@@ -818,6 +818,11 @@

CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_EP_RAWDEV=y
#
CONFIG_RTE_LIBRTE_PMD_NTB_RAWDEV=y

config/common_base CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_EP_RAWDEV=y · line 824

Quoted 3 lines
config/common_base +3 -0
+#
+# Compile multi-fn raw device interface #
+CONFIG_RTE_LIBRTE_MULTI_FN_COMMON=n

This can be enabled by default, right? It doesn't have any external dependency.

...

config/common_base line 8

Quoted 10 lines

+++ b/drivers/raw/common/multi_fn/rte_common_multi_fn_version.map

config/common_base +8 -0
@@ -0,0 +1,11 @@
+EXPERIMENTAL {
+	global:
+
+	rte_multi_fn_session_create;
+	rte_multi_fn_session_destroy;
+	rte_multi_fn_op_pool_create;
+	rte_multi_fn_op_bulk_alloc;
+	rte_multi_fn_op_free;

This list should be sorted alphabetically.

Quoted 16 lines
config/common_base +3 -0
+
+	local: *;
+};
drivers/raw/common/multi_fn/rte_multi_fn.c new file +6 -0
new file mode 100644
index 000000000..4f8e7fd94
@@ -0,0 +1,166 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2020 Intel Corporation.
+ */
+
+#include <ctype.h>
+#include <stdio.h>

...

Quoted 1 line

+#include <rte_rawdev.h>

A bunch of these includes are not needed.
From what I could see, only <inttypes.h>, <rte_log.h>, <rte_common.h>, <rte_rawdev.h> and <rte_mempool.h> are needed, apart from the two below.

Quoted 3 lines
drivers/raw/common/multi_fn/rte_multi_fn.c new file +3 -0
+
+#include "rte_multi_fn_driver.h"
+#include "rte_multi_fn.h"

...

Quoted 11 lines

+++ b/drivers/raw/common/multi_fn/rte_multi_fn.h

drivers/raw/common/multi_fn/rte_multi_fn.c new file +9 -0
@@ -0,0 +1,350 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2020 Intel Corporation.
+ */
+
+#ifndef _RTE_MULTI_FN_H_
+#define _RTE_MULTI_FN_H_
+
+#ifdef __cplusplus
+extern "C" {

drivers/raw/common/multi_fn/rte_multi_fn.c line 19

Quoted 10 lines
drivers/raw/common/multi_fn/rte_multi_fn.c new file +10 -0
+#endif
+
+#include <rte_compat.h>
+#include <rte_common.h>
+#include <rte_mbuf.h>
+#include <rte_memory.h>
+#include <rte_mempool.h>
+#include <rte_comp.h>
+#include <rte_crypto.h>
+#include <rte_rawdev.h>

Only <rte_comp.h> and <rte_crypto.h> are needed.

Quoted 1 line
drivers/raw/common/multi_fn/rte_multi_fn.c new file +1 -0
+

...

drivers/raw/common/multi_fn/rte_multi_fn.c

Quoted 2 lines
drivers/raw/common/multi_fn/rte_multi_fn.c new file +2 -0
+__rte_experimental
+static inline void

This is a public API, so I'd say this shouldn't be inline, right?

Quoted 23 lines
drivers/raw/common/multi_fn/rte_multi_fn.c new file +10 -0
+rte_multi_fn_op_free(struct rte_multi_fn_op *op) {
+	if (op != NULL && op->mempool != NULL)
+		rte_mempool_put(op->mempool, op);
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _RTE_MULTI_FN_H_ */
drivers/raw/common/multi_fn/rte_multi_fn_driver.h new file +6 -0
new file mode 100644
index 000000000..7e1e57fa3
@@ -0,0 +1,55 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2020 Intel Corporation.
+ */
+
+#ifndef _RTE_MULTI_FN_DRIVER_H_
+#define _RTE_MULTI_FN_DRIVER_H_

drivers/raw/common/multi_fn/rte_multi_fn_driver.h line 16

Quoted 10 lines
drivers/raw/common/multi_fn/rte_multi_fn_driver.h new file +10 -0
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rte_compat.h>
+#include <rte_common.h>
+#include <rte_rawdev.h>
+#include <rte_multi_fn.h>
+

Only <rte_rawdev.h> and <rte_multi_fn.h> are needed.
Actually, since rte_multi_fn.h is in the same folder, you can use double quotes.

#3 lore raw

Re: [dpdk-dev] [PATCH v2 1/4] raw/common: add multi-function interface

Hi Pablo
Thank you for reviewing and the comments - see below for resolutions. The changes will be available in v3 shortly

David

Quoted 58 lines

-----Original Message-----
From: De Lara Guarch, Pablo <[email protected]>
Sent: Monday, April 6, 2020 5:09 PM

Hi David,

Quoted 8 lines

-----Original Message-----
From: Coyle, David <[email protected]>
Sent: Friday, April 3, 2020 5:37 PM

The multi-function interface provides a flexible and extensible way of combining one or more 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.

Quoted 7 lines

---

In particular, looking for feedback on the meson script changes that were required to build the drivers/raw/common/multi_fn directory. Thank

you.

Quoted 11 lines
 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  |  11 +
 drivers/raw/common/multi_fn/rte_multi_fn.c    | 166 +++++++++
 drivers/raw/common/multi_fn/rte_multi_fn.h    | 350

++++++++++++++++++

Quoted 23 lines
 .../raw/common/multi_fn/rte_multi_fn_driver.h |  55 +++
 meson.build                                   |   4 +
 mk/rte.app.mk                                 |   1 +
 13 files changed, 649 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 index renamed from config/common_base +0 -0

c31175f9d..4f004968b 100644

config/common_base +0 -0
@@ -818,6 +818,11 @@

CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_EP_RAWDEV=y
#
CONFIG_RTE_LIBRTE_PMD_NTB_RAWDEV=y

Quoted 6 lines

config/common_base CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_EP_RAWDEV=y · line 824

Quoted 3 lines
config/common_base +3 -0
+#
+# Compile multi-fn raw device interface #
+CONFIG_RTE_LIBRTE_MULTI_FN_COMMON=n

This can be enabled by default, right? It doesn't have any external dependency.

[DC] That is true, so yes this is now enabled by default

Quoted 5 lines

...

Quoted 1 line

+++

b/drivers/raw/common/multi_fn/rte_common_multi_fn_version.map

Quoted 11 lines

config/common_base line 8

Quoted 9 lines
config/common_base +8 -0
@@ -0,0 +1,11 @@
+EXPERIMENTAL {
+	global:
+
+	rte_multi_fn_session_create;
+	rte_multi_fn_session_destroy;
+	rte_multi_fn_op_pool_create;
+	rte_multi_fn_op_bulk_alloc;
+	rte_multi_fn_op_free;

This list should be sorted alphabetically.

[DC] Fixed

Quoted 20 lines
Quoted 17 lines
config/common_base +3 -0
+
+	local: *;
+};
drivers/raw/common/multi_fn/rte_multi_fn.c new file +6 -0
new file mode 100644
index 000000000..4f8e7fd94
@@ -0,0 +1,166 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2020 Intel Corporation.
+ */
+
+#include <ctype.h>
+#include <stdio.h>

...

Quoted 6 lines
Quoted 1 line

+#include <rte_rawdev.h>

A bunch of these includes are not needed.
From what I could see, only <inttypes.h>, <rte_log.h>, <rte_common.h>, <rte_rawdev.h> and <rte_mempool.h> are needed, apart from the two below.

[DC] Most of the includes weren't needed... these have been tidied up now

Quoted 23 lines
Quoted 5 lines
drivers/raw/common/multi_fn/rte_multi_fn.c new file +3 -0
+
+#include "rte_multi_fn_driver.h"
+#include "rte_multi_fn.h"

...

Quoted 15 lines

+++ b/drivers/raw/common/multi_fn/rte_multi_fn.h

drivers/raw/common/multi_fn/rte_multi_fn.c new file +13 -0
@@ -0,0 +1,350 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2020 Intel Corporation.
+ */
+
+#ifndef _RTE_MULTI_FN_H_
+#define _RTE_MULTI_FN_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rte_compat.h>
+#include <rte_common.h>
Quoted 8 lines

drivers/raw/common/multi_fn/rte_multi_fn.c line 19

Quoted 6 lines
drivers/raw/common/multi_fn/rte_multi_fn.c new file +6 -0
+#include <rte_mbuf.h>
+#include <rte_memory.h>
+#include <rte_mempool.h>
+#include <rte_comp.h>
+#include <rte_crypto.h>
+#include <rte_rawdev.h>

Only <rte_comp.h> and <rte_crypto.h> are needed.

[DC] Again includes have been tidied up... left common, mbuf, mempool and crypto as these are referenced directly in this file rte_comp.h has been removed as he have removed compression completely from this patchset

Quoted 9 lines
Quoted 2 lines
drivers/raw/common/multi_fn/rte_multi_fn.c new file +1 -0
+

...

drivers/raw/common/multi_fn/rte_multi_fn.c

Quoted 2 lines
drivers/raw/common/multi_fn/rte_multi_fn.c new file +2 -0
+__rte_experimental
+static inline void

This is a public API, so I'd say this shouldn't be inline, right?

[DC] Lots of example of public APIs being inline, so no issue here

Quoted 30 lines
Quoted 30 lines
drivers/raw/common/multi_fn/rte_multi_fn.c new file +10 -0
+rte_multi_fn_op_free(struct rte_multi_fn_op *op) {
+	if (op != NULL && op->mempool != NULL)
+		rte_mempool_put(op->mempool, op);
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _RTE_MULTI_FN_H_ */
drivers/raw/common/multi_fn/rte_multi_fn_driver.h new file +12 -0
new file mode 100644
index 000000000..7e1e57fa3
@@ -0,0 +1,55 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2020 Intel Corporation.
+ */
+
+#ifndef _RTE_MULTI_FN_DRIVER_H_
+#define _RTE_MULTI_FN_DRIVER_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rte_compat.h>
Quoted 8 lines

drivers/raw/common/multi_fn/rte_multi_fn_driver.h line 16

Quoted 4 lines
drivers/raw/common/multi_fn/rte_multi_fn_driver.h new file +4 -0
+#include <rte_common.h>
+#include <rte_rawdev.h>
+#include <rte_multi_fn.h>
+

Only <rte_rawdev.h> and <rte_multi_fn.h> are needed. Actually, since rte_multi_fn.h is in the same folder, you can use double quotes.

[DC] Includes tidied up, only rawdev and multi_fn (in quotes) left now

#4 lore raw

Re: [dpdk-dev] [PATCH v2 1/4] raw/common: add multi-function interface

In reply to David Coyle

Hi David,

Quoted 11 lines

-----Original Message-----
From: Coyle, David <[email protected]>
Sent: Friday, April 3, 2020 5:37 PM
To: [email protected]
Cc: Doherty, Declan <[email protected]>; Trahe, Fiona <[email protected]>; De Lara Guarch, Pablo <[email protected]>; Ryan, Brendan <[email protected]>; [email protected]; [email protected]; Coyle, David <[email protected]>; O'loingsigh, Mairtin <[email protected]>
Subject: [PATCH v2 1/4] raw/common: add multi-function interface

Quoted 9 lines

The multi-function interface provides a flexible and extensible way of combining one or more 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.

---

Forgot to say to update Release Notes document, which these changes.

Thanks!
Pablo

#5 lore raw

Re: [dpdk-dev] [PATCH v2 1/4] raw/common: add multi-function interface

Hi Pablo
Thank you for reviewing and the comments - see below for resolutions. The changes will be available in v3 shortly

David

Quoted 14 lines

-----Original Message-----
From: De Lara Guarch, Pablo <[email protected]>
Sent: Tuesday, April 7, 2020 7:56 PM

Hi David,

Quoted 8 lines

-----Original Message-----
From: Coyle, David <[email protected]>
Sent: Friday, April 3, 2020 5:37 PM

The multi-function interface provides a flexible and extensible way of combining one or more 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

Quoted 8 lines

raw device.

Quoted 5 lines

---

Forgot to say to update Release Notes document, which these changes.

[DC] Release notes have been updated

Quoted 4 lines

Thanks!
Pablo

#6 lore raw

PATCH v2 2/4 raw/aesni_mb: add aesni_mb raw device

In reply to David Coyle

Adding an AESNI-MB raw device, thereby exposing AESNI-MB to the rawdev API. The AESNI-MB raw device will use the multi-function interface to allow combined operations be sent to the AESNI-MB software library.

---
 config/common_base                            |    6 +
 drivers/raw/Makefile                          |    2 +
 drivers/raw/aesni_mb/Makefile                 |   47 +
 drivers/raw/aesni_mb/aesni_mb_rawdev.c        | 1536 +++++++++++++++++
 drivers/raw/aesni_mb/aesni_mb_rawdev.h        |  112 ++
 drivers/raw/aesni_mb/aesni_mb_rawdev_test.c   | 1102 ++++++++++++
 .../aesni_mb/aesni_mb_rawdev_test_vectors.h   | 1183 +++++++++++++
 drivers/raw/aesni_mb/meson.build              |   26 +
 .../aesni_mb/rte_rawdev_aesni_mb_version.map  |    3 +
 drivers/raw/meson.build                       |    3 +-
 mk/rte.app.mk                                 |    2 +
 11 files changed, 4021 insertions(+), 1 deletion(-)
 create mode 100644 drivers/raw/aesni_mb/Makefile
 create mode 100644 drivers/raw/aesni_mb/aesni_mb_rawdev.c
 create mode 100644 drivers/raw/aesni_mb/aesni_mb_rawdev.h
 create mode 100644 drivers/raw/aesni_mb/aesni_mb_rawdev_test.c
 create mode 100644 drivers/raw/aesni_mb/aesni_mb_rawdev_test_vectors.h
 create mode 100644 drivers/raw/aesni_mb/meson.build
 create mode 100644 drivers/raw/aesni_mb/rte_rawdev_aesni_mb_version.map
config/common_base +6 -0
index 4f004968b..7ac6a3428 100644
@@ -818,6 +818,12 @@ CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_EP_RAWDEV=y
 #
 CONFIG_RTE_LIBRTE_PMD_NTB_RAWDEV=y
 
+#
+# Compile PMD for AESNI raw device
+#
+CONFIG_RTE_LIBRTE_PMD_AESNI_MB_RAWDEV=n
+CONFIG_RTE_LIBRTE_PMD_AESNI_MB_RAWDEV_DEBUG=n
+
 #
 # Compile multi-fn raw device interface
 #
drivers/raw/Makefile +2 -0
index e16da8d95..5aa608e1e 100644
@@ -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_RAWDEV) += aesni_mb
+DEPDIRS-aesni_mb := common
 
 include $(RTE_SDK)/mk/rte.subdir.mk
drivers/raw/aesni_mb/Makefile new file +47 -0

47 lines not on this page · raw message

drivers/raw/aesni_mb/aesni_mb_rawdev.c new file +1536 -0

1,536 lines not on this page · raw message

drivers/raw/aesni_mb/aesni_mb_rawdev.h new file +112 -0

112 lines not on this page · raw message

drivers/raw/aesni_mb/aesni_mb_rawdev_test.c new file +1102 -0

1,102 lines not on this page · raw message

drivers/raw/aesni_mb/aesni_mb_rawdev_test_vectors.h new file +1183 -0

184 lines not on this page · raw message

drivers/raw/aesni_mb/meson.build new file +26 -0
new file mode 100644
index 000000000..085f629be

Lines of this file are not shown. View the raw message.

drivers/raw/aesni_mb/rte_rawdev_aesni_mb_version.map new file +3 -0
new file mode 100644
index 000000000..fa9e17c29

Lines of this file are not shown. View the raw message.

drivers/raw/meson.build +2 -1
index bb5797760..c0bbc84a6 100644

Lines of this file are not shown. View the raw message.

mk/rte.app.mk +2 -0
index b836d220d..a6e1e925f 100644

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.

#7 lore raw

Re: [dpdk-dev] [PATCH v2 2/4] raw/aesni_mb: add aesni_mb raw device

Hi David,

Quoted 18 lines

-----Original Message-----
From: Coyle, David <[email protected]>
Sent: Friday, April 3, 2020 5:37 PM
To: [email protected]
Cc: Doherty, Declan <[email protected]>; Trahe, Fiona <[email protected]>; De Lara Guarch, Pablo <[email protected]>; Ryan, Brendan <[email protected]>; [email protected]; [email protected]; Coyle, David <[email protected]>; O'loingsigh, Mairtin <[email protected]>
Subject: [PATCH v2 2/4] raw/aesni_mb: add aesni_mb raw device

Adding an AESNI-MB raw device, thereby exposing AESNI-MB to the rawdev API. The AESNI-MB raw device will use the multi-function interface to allow combined operations be sent to the AESNI-MB software library.

Quoted 12 lines
---
 config/common_base                            |    6 +
 drivers/raw/Makefile                          |    2 +
 drivers/raw/aesni_mb/Makefile                 |   47 +
 drivers/raw/aesni_mb/aesni_mb_rawdev.c        | 1536 +++++++++++++++++
 drivers/raw/aesni_mb/aesni_mb_rawdev.h        |  112 ++
 drivers/raw/aesni_mb/aesni_mb_rawdev_test.c   | 1102 ++++++++++++
 .../aesni_mb/aesni_mb_rawdev_test_vectors.h   | 1183 +++++++++++++
 drivers/raw/aesni_mb/meson.build              |   26 +
 .../aesni_mb/rte_rawdev_aesni_mb_version.map  |    3 +
 drivers/raw/meson.build                       |    3 +-
 mk/rte.app.mk                                 |    2 +

You missed adding the PMD to the MAINTAINERS file.

Quoted 118 lines
 11 files changed, 4021 insertions(+), 1 deletion(-)
 create mode 100644 drivers/raw/aesni_mb/Makefile
 create mode 100644 drivers/raw/aesni_mb/aesni_mb_rawdev.c
 create mode 100644 drivers/raw/aesni_mb/aesni_mb_rawdev.h
 create mode 100644 drivers/raw/aesni_mb/aesni_mb_rawdev_test.c
 create mode 100644 drivers/raw/aesni_mb/aesni_mb_rawdev_test_vectors.h
 create mode 100644 drivers/raw/aesni_mb/meson.build
 create mode 100644

drivers/raw/aesni_mb/rte_rawdev_aesni_mb_version.map

config/common_base +0 -0
index 4f004968b..7ac6a3428 100644
@@ -818,6 +818,12 @@

CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_EP_RAWDEV=y
#
CONFIG_RTE_LIBRTE_PMD_NTB_RAWDEV=y

config/common_base +6 -0
+#
+# Compile PMD for AESNI raw device
+#
+CONFIG_RTE_LIBRTE_PMD_AESNI_MB_RAWDEV=n
+CONFIG_RTE_LIBRTE_PMD_AESNI_MB_RAWDEV_DEBUG=n
+
 #
 # Compile multi-fn raw device interface
 #
drivers/raw/Makefile +0 -0
index e16da8d95..5aa608e1e 100644
@@ -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

drivers/raw/Makefile +2 -0
+DIRS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_MB_RAWDEV) += aesni_mb
+DEPDIRS-aesni_mb := common
 
 include $(RTE_SDK)/mk/rte.subdir.mk
drivers/raw/aesni_mb/Makefile new file +25 -0
new file mode 100644
index 000000000..0a40b75b4
@@ -0,0 +1,47 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2020 Intel Corporation.
+
+include $(RTE_SDK)/mk/rte.vars.mk
+
+# library name
+LIB = librte_pmd_aesni_mb_rawdev.a
+
+# build flags
+CFLAGS += -O3
+CFLAGS += $(WERROR_FLAGS)
+CFLAGS += -DALLOW_EXPERIMENTAL_API
+
+# versioning export map
+EXPORT_MAP := rte_rawdev_aesni_mb_version.map
+
+# external library dependencies
+LDLIBS += -lIPSec_MB
+LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
+LDLIBS += -lrte_rawdev
+LDLIBS += -lrte_bus_vdev
+LDLIBS += -lrte_multi_fn
+
+ifneq ($(CONFIG_RTE_LIBRTE_MULTI_FN_COMMON),y)
+$(error "RTE_LIBRTE_MULTI_FN_COMMON is required to build aesni_mb raw

device")

drivers/raw/aesni_mb/Makefile new file +8 -0
+endif
+
+IMB_HDR = $(shell echo '\#include <intel-ipsec-mb.h>' | \
+	$(CC) -E $(EXTRA_CFLAGS) - | grep 'intel-ipsec-mb.h' | \
+	head -n1 | cut -d'"' -f2)
+
+# Detect library version
+IMB_VERSION = $(shell grep -e "IMB_VERSION_STR" $(IMB_HDR) | cut -d'"' -

f2)

drivers/raw/aesni_mb/Makefile new file +11 -1
+IMB_VERSION_NUM = $(shell grep -e "IMB_VERSION_NUM" $(IMB_HDR) | cut
-d' ' -f3)
+
+ifeq ($(IMB_VERSION),)
+$(error "IPSec_MB version >= 0.53.3 is required to build aesni_mb raw device")
+endif
+
+ifeq ($(shell expr $(IMB_VERSION_NUM) \< 0x3503), 1)
+$(error "IPSec_MB version >= 0.53.3 is required to build aesni_mb raw device")
+endif
+
+SRCS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_MB_RAWDEV) +=

aesni_mb_rawdev.c
+SRCS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_MB_RAWDEV) +=
aesni_mb_rawdev_test.c

drivers/raw/aesni_mb/Makefile new file +2 -0
+
+include $(RTE_SDK)/mk/rte.lib.mk
drivers/raw/aesni_mb/aesni_mb_rawdev.c new file +11 -0
new file mode 100644
index 000000000..946bdd871
@@ -0,0 +1,1536 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2020 Intel Corporation.
+ */
+
+#include <stdbool.h>
+
+#include <intel-ipsec-mb.h>
+
+#include <rte_common.h>
+#include <rte_hexdump.h>
+#include <rte_cryptodev.h>

drivers/raw/aesni_mb/aesni_mb_rawdev.c line 21

Quoted 10 lines
drivers/raw/aesni_mb/aesni_mb_rawdev.c new file +10 -0
+#include <rte_dev.h>
+#include <rte_eal.h>
+#include <rte_bus_vdev.h>
+#include <rte_malloc.h>
+#include <rte_cpuflags.h>
+#include <rte_rawdev.h>
+#include <rte_rawdev_pmd.h>
+#include <rte_string_fns.h>
+#include <rte_multi_fn.h>
+#include <rte_ether.h>

No need for <rte_hexdump.h>, <rte_cryptodev.h>, <rte_dev.h>, <rte_cpuflags.h> and <rte_multi_fn.h>. I think <rte_crypto.h> is missing, though, for "rte_crypto_sym_xform".

...

Quoted 16 lines
drivers/raw/aesni_mb/aesni_mb_rawdev.c new file +16 -0
+static bool
+docsis_crc_crypto_encrypt_check(struct rte_multi_fn_xform *xform)
+{
+	struct rte_crypto_sym_xform *crypto_sym;
+	struct rte_multi_fn_err_detect_xform *err_detect;
+	struct rte_multi_fn_xform *next;
+
+	if (xform->type == RTE_MULTI_FN_XFORM_TYPE_ERR_DETECT) {
+
+		err_detect = &xform->err_detect;
+		next = xform->next;
+
+		if (err_detect->algo ==
+				RTE_MULTI_FN_ERR_DETECT_CRC32_ETH &&
+		    err_detect->op ==
+				RTE_MULTI_FN_ERR_DETECT_OP_GENERATE
Quoted 1 line

&&

I don't think leading spaces are allowed. Generally, double tab is used in multi-line if's. Same applies in other parts of the code.

Quoted 3 lines
drivers/raw/aesni_mb/aesni_mb_rawdev.c new file +3 -0
+		    next != NULL &&
+		    next->type == RTE_MULTI_FN_XFORM_TYPE_CRYPTO_SYM) {
+

...

drivers/raw/aesni_mb/aesni_mb_rawdev.c line 145

Quoted 8 lines
drivers/raw/aesni_mb/aesni_mb_rawdev.c new file +8 -0
+static bool
+docsis_crypto_decrypt_crc_check(struct rte_multi_fn_xform *xform)
+{
+	struct rte_crypto_sym_xform *crypto_sym;
+	struct rte_multi_fn_err_detect_xform *err_detect;
+	struct rte_multi_fn_xform *next;
+
+	if (xform->type == RTE_MULTI_FN_XFORM_TYPE_CRYPTO_SYM) {

I think in order to reduce this many indentation levels, you can check for the opposite here and return false.

If (xform->type != RTE...)
return false
...

drivers/raw/aesni_mb/aesni_mb_rawdev.c line 188

Quoted 12 lines
drivers/raw/aesni_mb/aesni_mb_rawdev.c new file +12 -0
+
+static bool
+pon_crc_crypto_encrypt_bip_check(struct rte_multi_fn_xform *xform)
+{
+	struct rte_crypto_sym_xform *crypto_sym;
+	struct rte_multi_fn_err_detect_xform *err_detect;
+	struct rte_multi_fn_xform *next;
+
+	if (xform->type == RTE_MULTI_FN_XFORM_TYPE_ERR_DETECT) {
+
+		err_detect = &xform->err_detect;
+		next = xform->next;

Same as above here.

Quoted 6 lines
drivers/raw/aesni_mb/aesni_mb_rawdev.c new file +5 -0
+
+		if (err_detect->algo ==
+				RTE_MULTI_FN_ERR_DETECT_CRC32_ETH &&
+		    err_detect->op ==
 
+static bool

drivers/raw/aesni_mb/aesni_mb_rawdev.c line 240

Quoted 10 lines
drivers/raw/aesni_mb/aesni_mb_rawdev.c new file +10 -0
+pon_bip_crypto_decrypt_crc_check(struct rte_multi_fn_xform *xform)
+{
+	struct rte_crypto_sym_xform *crypto_sym;
+	struct rte_multi_fn_err_detect_xform *err_detect;
+	struct rte_multi_fn_xform *next;
+
+	if (xform->type == RTE_MULTI_FN_XFORM_TYPE_ERR_DETECT) {
+
+		err_detect = &xform->err_detect;
+		next = xform->next;

Same as above.

Quoted 8 lines
drivers/raw/aesni_mb/aesni_mb_rawdev.c new file +6 -0
+}
+
+static enum aesni_mb_rawdev_op
+session_support_check(struct rte_multi_fn_xform *xform)
+{
+	enum aesni_mb_rawdev_op op =

AESNI_MB_RAWDEV_OP_NOT_SUPPORTED;
+

...

Quoted 17 lines
drivers/raw/aesni_mb/aesni_mb_rawdev.c new file +16 -0
+static inline int
+docsis_crypto_crc_check(struct rte_multi_fn_op *first_op,
+			struct rte_multi_fn_op *cipher_op,
+			struct rte_multi_fn_op *crc_op)
+{
+	struct rte_multi_fn_op *err_op = NULL;
+	uint8_t err_op_status;
+	const uint32_t offset_diff = DOCSIS_CIPHER_CRC_OFFSET_DIFF;
+
+	if (cipher_op->crypto_sym.cipher.data.length &&
+	    crc_op->err_detect.data.length) {
+		/* Cipher offset must be at least 12 greater than CRC offset */
+		if (cipher_op->crypto_sym.cipher.data.offset <
+		    ((uint32_t)crc_op->err_detect.data.offset + offset_diff)) {
+			err_op = crc_op;
+			err_op_status =

RTE_MULTI_FN_ERR_DETECT_OP_STATUS_ERROR;

drivers/raw/aesni_mb/aesni_mb_rawdev.c line 507

Quoted 7 lines
drivers/raw/aesni_mb/aesni_mb_rawdev.c new file +7 -0
+		/*
+		 * Cipher length must be at least 8 less than CRC length, taking
+		 * known differences of what is ciphered and what is crc'ed into
+		 * account
+		 */
+		} else if ((cipher_op->crypto_sym.cipher.data.length +
+				DOCSIS_CIPHER_CRC_LENGTH_DIFF) >

For consistency, you can use offset_diff here too, instead of the macro.

Quoted 6 lines
drivers/raw/aesni_mb/aesni_mb_rawdev.c new file +3 -0
+			    crc_op->err_detect.data.length) {
+			err_op = crc_op;
+			err_op_status =

RTE_MULTI_FN_ERR_DETECT_OP_STATUS_ERROR;

drivers/raw/aesni_mb/aesni_mb_rawdev.c new file +2 -0
+		}
+	}

...

Quoted 13 lines
drivers/raw/aesni_mb/aesni_mb_rawdev.c new file +13 -0
+static inline int
+mb_job_params_set(JOB_AES_HMAC *job,
+		  struct aesni_mb_rawdev_qp *qp,
+		  struct rte_multi_fn_op *op,
+		  uint8_t *output_idx)
+{
+	struct rte_mbuf *m_src, *m_dst;
+	struct rte_multi_fn_op *cipher_op;
+	struct rte_multi_fn_op *crc_op;
+	struct rte_multi_fn_op *bip_op;
+	uint32_t cipher_offset;
+	struct aesni_mb_rawdev_session *session;
+

...

drivers/raw/aesni_mb/aesni_mb_rawdev.c line 672

Quoted 1 line
drivers/raw/aesni_mb/aesni_mb_rawdev.c new file +1 -0
+				cipher_op->crypto_sym.cipher.data.length;

I would declare a variable like sym_op to reduce the length of these. Maybe also for err_dectect.

Quoted 6 lines
drivers/raw/aesni_mb/aesni_mb_rawdev.c new file +6 -0
+
+	switch (session->op) {
+	case AESNI_MB_RAWDEV_OP_DOCSIS_CRC_CRYPTO:
+	case AESNI_MB_RAWDEV_OP_DOCSIS_CRYPTO_CRC:
+		job->hash_start_src_offset_in_bytes =
+						crc_op-

...

drivers/raw/aesni_mb/aesni_mb_rawdev.c line 2

Quoted 4 lines

+++ b/drivers/raw/aesni_mb/aesni_mb_rawdev_test.c

drivers/raw/aesni_mb/aesni_mb_rawdev.c new file +2 -0
@@ -0,0 +1,1102 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2020 Intel Corporation.

Could this be moved under the test app? Looks odd here.

Thanks,
Pablo

#8 lore raw

Re: [dpdk-dev] [PATCH v2 2/4] raw/aesni_mb: add aesni_mb raw device

Hi David,

Quoted 331 lines

-----Original Message-----
From: dev <[email protected]> On Behalf Of De Lara Guarch, Pablo
Sent: Tuesday, April 7, 2020 7:51 PM
To: Coyle, David <[email protected]>; [email protected]
Cc: Doherty, Declan <[email protected]>; Trahe, Fiona <[email protected]>; Ryan, Brendan <[email protected]>; [email protected]; [email protected]; O'loingsigh, Mairtin <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v2 2/4] raw/aesni_mb: add aesni_mb raw device

Hi David,

Quoted 18 lines

-----Original Message-----
From: Coyle, David <[email protected]>
Sent: Friday, April 3, 2020 5:37 PM
To: [email protected]
Cc: Doherty, Declan <[email protected]>; Trahe, Fiona <[email protected]>; De Lara Guarch, Pablo <[email protected]>; Ryan, Brendan <[email protected]>; [email protected]; [email protected]; Coyle, David <[email protected]>; O'loingsigh, Mairtin <[email protected]>
Subject: [PATCH v2 2/4] raw/aesni_mb: add aesni_mb raw device

Adding an AESNI-MB raw device, thereby exposing AESNI-MB to the rawdev API. The AESNI-MB raw device will use the multi-function interface to allow combined operations be sent to the AESNI-MB software library.

Quoted 12 lines
---
 config/common_base                            |    6 +
 drivers/raw/Makefile                          |    2 +
 drivers/raw/aesni_mb/Makefile                 |   47 +
 drivers/raw/aesni_mb/aesni_mb_rawdev.c        | 1536 +++++++++++++++++
 drivers/raw/aesni_mb/aesni_mb_rawdev.h        |  112 ++
 drivers/raw/aesni_mb/aesni_mb_rawdev_test.c   | 1102 ++++++++++++
 .../aesni_mb/aesni_mb_rawdev_test_vectors.h   | 1183 +++++++++++++
 drivers/raw/aesni_mb/meson.build              |   26 +
 .../aesni_mb/rte_rawdev_aesni_mb_version.map  |    3 +
 drivers/raw/meson.build                       |    3 +-
 mk/rte.app.mk                                 |    2 +

You missed adding the PMD to the MAINTAINERS file.

drivers/raw/Makefile DIRS-$(CONFIG_RTE_LIBRTE_PMD_NTB_RAWDEV) +=

Quoted 32 lines
 11 files changed, 4021 insertions(+), 1 deletion(-)  create mode
100644 drivers/raw/aesni_mb/Makefile  create mode 100644
drivers/raw/aesni_mb/aesni_mb_rawdev.c
 create mode 100644 drivers/raw/aesni_mb/aesni_mb_rawdev.h
 create mode 100644 drivers/raw/aesni_mb/aesni_mb_rawdev_test.c
 create mode 100644
drivers/raw/aesni_mb/aesni_mb_rawdev_test_vectors.h
 create mode 100644 drivers/raw/aesni_mb/meson.build  create mode

100644 drivers/raw/aesni_mb/rte_rawdev_aesni_mb_version.map

config/common_base index renamed from config/common_base +0 -0

4f004968b..7ac6a3428 100644

config/common_base +0 -0
@@ -818,6 +818,12 @@

CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_EP_RAWDEV=y
#
CONFIG_RTE_LIBRTE_PMD_NTB_RAWDEV=y

config/common_base +6 -0
+#
+# Compile PMD for AESNI raw device
+#
+CONFIG_RTE_LIBRTE_PMD_AESNI_MB_RAWDEV=n
+CONFIG_RTE_LIBRTE_PMD_AESNI_MB_RAWDEV_DEBUG=n
+
 #
 # Compile multi-fn raw device interface  # diff --git

a/drivers/raw/Makefile b/drivers/raw/Makefile index e16da8d95..5aa608e1e 100644

drivers/raw/Makefile +0 -0
@@ -15,5 +15,7 @@ DIRS-$(CONFIG_RTE_LIBRTE_PMD_NTB_RAWDEV) +=

ntb

drivers/raw/Makefile DIRS-$(CONFIG_RTE_LIBRTE_PMD_NTB_RAWDEV) += · line 15

Quoted 1 line
drivers/raw/Makefile +0 -0
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_DMA_RAWDEV) +=

octeontx2_dma

drivers/raw/Makefile DIRS-$(CONFIG_RTE_LIBRTE_PMD_NTB_RAWDEV) += · line 16

Quoted 1 line
drivers/raw/Makefile +0 -0
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_EP_RAWDEV) +=

octeontx2_ep

Quoted 24 lines

DIRS-y += common

drivers/raw/Makefile +2 -0
+DIRS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_MB_RAWDEV) += aesni_mb
+DEPDIRS-aesni_mb := common
 
 include $(RTE_SDK)/mk/rte.subdir.mk
(quoted diff) +0 -0

b/drivers/raw/aesni_mb/Makefile new file mode 100644 index 000000000..0a40b75b4

drivers/raw/aesni_mb/Makefile new file +13 -0
@@ -0,0 +1,47 @@
+# SPDX-License-Identifier: BSD-3-Clause # Copyright(c) 2020 Intel
+Corporation.
+
+include $(RTE_SDK)/mk/rte.vars.mk
+
+# library name
+LIB = librte_pmd_aesni_mb_rawdev.a
+
+# build flags
+CFLAGS += -O3
+CFLAGS += $(WERROR_FLAGS)
+CFLAGS += -DALLOW_EXPERIMENTAL_API
+

drivers/raw/aesni_mb/Makefile line 23

Quoted 10 lines
drivers/raw/aesni_mb/Makefile new file +10 -0
+# versioning export map
+EXPORT_MAP := rte_rawdev_aesni_mb_version.map
+
+# external library dependencies
+LDLIBS += -lIPSec_MB
+LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring LDLIBS +=
+-lrte_rawdev LDLIBS += -lrte_bus_vdev LDLIBS += -lrte_multi_fn
+
+ifneq ($(CONFIG_RTE_LIBRTE_MULTI_FN_COMMON),y)
+$(error "RTE_LIBRTE_MULTI_FN_COMMON is required to build aesni_mb

raw

Quoted 12 lines

device")

drivers/raw/aesni_mb/Makefile new file +9 -0
+endif
+
+IMB_HDR = $(shell echo '\#include <intel-ipsec-mb.h>' | \
+	$(CC) -E $(EXTRA_CFLAGS) - | grep 'intel-ipsec-mb.h' | \
+	head -n1 | cut -d'"' -f2)
+
+# Detect library version
+IMB_VERSION = $(shell grep -e "IMB_VERSION_STR" $(IMB_HDR) | cut
+-d'"' -

f2)
+IMB_VERSION_NUM = $(shell grep -e "IMB_VERSION_NUM" $(IMB_HDR) |

cut

Quoted 34 lines
drivers/raw/aesni_mb/Makefile new file +10 -1
-d' ' -f3)
+
+ifeq ($(IMB_VERSION),)
+$(error "IPSec_MB version >= 0.53.3 is required to build aesni_mb raw
+device") endif
+
+ifeq ($(shell expr $(IMB_VERSION_NUM) \< 0x3503), 1) $(error
+"IPSec_MB version >= 0.53.3 is required to build aesni_mb raw
+device") endif
+
+SRCS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_MB_RAWDEV) +=

aesni_mb_rawdev.c
+SRCS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_MB_RAWDEV) +=
aesni_mb_rawdev_test.c

drivers/raw/aesni_mb/Makefile new file +2 -0
+
+include $(RTE_SDK)/mk/rte.lib.mk
drivers/raw/aesni_mb/aesni_mb_rawdev.c new file +11 -0
new file mode 100644
index 000000000..946bdd871
@@ -0,0 +1,1536 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2020 Intel Corporation.
+ */
+
+#include <stdbool.h>
+
+#include <intel-ipsec-mb.h>
+
+#include <rte_common.h>
+#include <rte_hexdump.h>
+#include <rte_cryptodev.h>

drivers/raw/aesni_mb/aesni_mb_rawdev.c line 21

Quoted 10 lines
drivers/raw/aesni_mb/aesni_mb_rawdev.c new file +10 -0
+#include <rte_dev.h>
+#include <rte_eal.h>
+#include <rte_bus_vdev.h>
+#include <rte_malloc.h>
+#include <rte_cpuflags.h>
+#include <rte_rawdev.h>
+#include <rte_rawdev_pmd.h>
+#include <rte_string_fns.h>
+#include <rte_multi_fn.h>
+#include <rte_ether.h>

No need for <rte_hexdump.h>, <rte_cryptodev.h>, <rte_dev.h>, <rte_cpuflags.h> and <rte_multi_fn.h>.
I think <rte_crypto.h> is missing, though, for "rte_crypto_sym_xform".

...

Quoted 15 lines
drivers/raw/aesni_mb/aesni_mb_rawdev.c new file +15 -0
+static bool
+docsis_crc_crypto_encrypt_check(struct rte_multi_fn_xform *xform) {
+	struct rte_crypto_sym_xform *crypto_sym;
+	struct rte_multi_fn_err_detect_xform *err_detect;
+	struct rte_multi_fn_xform *next;
+
+	if (xform->type == RTE_MULTI_FN_XFORM_TYPE_ERR_DETECT) {
+
+		err_detect = &xform->err_detect;
+		next = xform->next;
+
+		if (err_detect->algo ==
+				RTE_MULTI_FN_ERR_DETECT_CRC32_ETH &&
+		    err_detect->op ==
+				RTE_MULTI_FN_ERR_DETECT_OP_GENERATE
Quoted 1 line

&&

I don't think leading spaces are allowed. Generally, double tab is used in multi- line if's. Same applies in other parts of the code.

Quoted 3 lines
drivers/raw/aesni_mb/aesni_mb_rawdev.c new file +3 -0
+		    next != NULL &&
+		    next->type == RTE_MULTI_FN_XFORM_TYPE_CRYPTO_SYM) {
+

...

drivers/raw/aesni_mb/aesni_mb_rawdev.c line 145

Quoted 7 lines
drivers/raw/aesni_mb/aesni_mb_rawdev.c new file +7 -0
+static bool
+docsis_crypto_decrypt_crc_check(struct rte_multi_fn_xform *xform) {
+	struct rte_crypto_sym_xform *crypto_sym;
+	struct rte_multi_fn_err_detect_xform *err_detect;
+	struct rte_multi_fn_xform *next;
+
+	if (xform->type == RTE_MULTI_FN_XFORM_TYPE_CRYPTO_SYM) {

I think in order to reduce this many indentation levels, you can check for the opposite here and return false.

If (xform->type != RTE...)
return false
...

drivers/raw/aesni_mb/aesni_mb_rawdev.c line 108

Quoted 11 lines
drivers/raw/aesni_mb/aesni_mb_rawdev.c new file +11 -0
+
+static bool
+pon_crc_crypto_encrypt_bip_check(struct rte_multi_fn_xform *xform) {
+	struct rte_crypto_sym_xform *crypto_sym;
+	struct rte_multi_fn_err_detect_xform *err_detect;
+	struct rte_multi_fn_xform *next;
+
+	if (xform->type == RTE_MULTI_FN_XFORM_TYPE_ERR_DETECT) {
+
+		err_detect = &xform->err_detect;
+		next = xform->next;

Same as above here.

Quoted 5 lines
drivers/raw/aesni_mb/aesni_mb_rawdev.c new file +4 -0
+
+		if (err_detect->algo ==
+				RTE_MULTI_FN_ERR_DETECT_CRC32_ETH &&
+		    err_detect->op ==
 

drivers/raw/aesni_mb/aesni_mb_rawdev.c line 188

Quoted 10 lines
drivers/raw/aesni_mb/aesni_mb_rawdev.c new file +10 -0
+static bool
+pon_bip_crypto_decrypt_crc_check(struct rte_multi_fn_xform *xform) {
+	struct rte_crypto_sym_xform *crypto_sym;
+	struct rte_multi_fn_err_detect_xform *err_detect;
+	struct rte_multi_fn_xform *next;
+
+	if (xform->type == RTE_MULTI_FN_XFORM_TYPE_ERR_DETECT) {
+
+		err_detect = &xform->err_detect;
+		next = xform->next;

Same as above.

Quoted 7 lines
drivers/raw/aesni_mb/aesni_mb_rawdev.c new file +5 -0
+}
+
+static enum aesni_mb_rawdev_op
+session_support_check(struct rte_multi_fn_xform *xform) {
+	enum aesni_mb_rawdev_op op =

AESNI_MB_RAWDEV_OP_NOT_SUPPORTED;
+

...

Quoted 17 lines
drivers/raw/aesni_mb/aesni_mb_rawdev.c new file +16 -0
+static inline int
+docsis_crypto_crc_check(struct rte_multi_fn_op *first_op,
+			struct rte_multi_fn_op *cipher_op,
+			struct rte_multi_fn_op *crc_op)
+{
+	struct rte_multi_fn_op *err_op = NULL;
+	uint8_t err_op_status;
+	const uint32_t offset_diff = DOCSIS_CIPHER_CRC_OFFSET_DIFF;
+
+	if (cipher_op->crypto_sym.cipher.data.length &&
+	    crc_op->err_detect.data.length) {
+		/* Cipher offset must be at least 12 greater than CRC offset */
+		if (cipher_op->crypto_sym.cipher.data.offset <
+		    ((uint32_t)crc_op->err_detect.data.offset + offset_diff)) {
+			err_op = crc_op;
+			err_op_status =

RTE_MULTI_FN_ERR_DETECT_OP_STATUS_ERROR;

drivers/raw/aesni_mb/aesni_mb_rawdev.c line 507

Quoted 7 lines
drivers/raw/aesni_mb/aesni_mb_rawdev.c new file +7 -0
+		/*
+		 * Cipher length must be at least 8 less than CRC length, taking
+		 * known differences of what is ciphered and what is crc'ed into
+		 * account
+		 */
+		} else if ((cipher_op->crypto_sym.cipher.data.length +
+				DOCSIS_CIPHER_CRC_LENGTH_DIFF) >

For consistency, you can use offset_diff here too, instead of the macro.

Quoted 6 lines
drivers/raw/aesni_mb/aesni_mb_rawdev.c new file +3 -0
+			    crc_op->err_detect.data.length) {
+			err_op = crc_op;
+			err_op_status =

RTE_MULTI_FN_ERR_DETECT_OP_STATUS_ERROR;

drivers/raw/aesni_mb/aesni_mb_rawdev.c new file +2 -0
+		}
+	}

...

Quoted 13 lines
drivers/raw/aesni_mb/aesni_mb_rawdev.c new file +13 -0
+static inline int
+mb_job_params_set(JOB_AES_HMAC *job,
+		  struct aesni_mb_rawdev_qp *qp,
+		  struct rte_multi_fn_op *op,
+		  uint8_t *output_idx)
+{
+	struct rte_mbuf *m_src, *m_dst;
+	struct rte_multi_fn_op *cipher_op;
+	struct rte_multi_fn_op *crc_op;
+	struct rte_multi_fn_op *bip_op;
+	uint32_t cipher_offset;
+	struct aesni_mb_rawdev_session *session;
+

...

drivers/raw/aesni_mb/aesni_mb_rawdev.c line 672

Quoted 1 line
drivers/raw/aesni_mb/aesni_mb_rawdev.c new file +1 -0
+				cipher_op->crypto_sym.cipher.data.length;

I would declare a variable like sym_op to reduce the length of these. Maybe also for err_dectect.

Quoted 6 lines
drivers/raw/aesni_mb/aesni_mb_rawdev.c new file +6 -0
+
+	switch (session->op) {
+	case AESNI_MB_RAWDEV_OP_DOCSIS_CRC_CRYPTO:
+	case AESNI_MB_RAWDEV_OP_DOCSIS_CRYPTO_CRC:
+		job->hash_start_src_offset_in_bytes =
+						crc_op-

...

Quoted 6 lines

drivers/raw/aesni_mb/aesni_mb_rawdev.c line 2

Quoted 4 lines

+++ b/drivers/raw/aesni_mb/aesni_mb_rawdev_test.c

drivers/raw/aesni_mb/aesni_mb_rawdev.c new file +2 -0
@@ -0,0 +1,1102 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2020 Intel Corporation.

Could this be moved under the test app? Looks odd here.

Just realized that other drivers are also including tests in their folders, so I guess this is consistent too (sorry, I wasn't used to this new method).

Thanks,
Pablo

Quoted 3 lines

Thanks,
Pablo

#9 lore raw

Re: [dpdk-dev] [PATCH v2 2/4] raw/aesni_mb: add aesni_mb raw device

In reply to De Lara Guarch, Pablo

Hi Pablo
Thank you for reviewing and the comments - see below for resolutions. The changes will be available in v3 shortly

David

Quoted 31 lines

-----Original Message-----
From: De Lara Guarch, Pablo <[email protected]>
Sent: Tuesday, April 7, 2020 7:51 PM

Hi David,

Quoted 5 lines

-----Original Message-----
From: Coyle, David <[email protected]>
Sent: Friday, April 3, 2020 5:37 PM

Adding an AESNI-MB raw device, thereby exposing AESNI-MB to the

rawdev

Quoted 10 lines

API. The AESNI-MB raw device will use the multi-function interface to allow combined operations be sent to the AESNI-MB software library.

---
 config/common_base                            |    6 +
 drivers/raw/Makefile                          |    2 +
 drivers/raw/aesni_mb/Makefile                 |   47 +
 drivers/raw/aesni_mb/aesni_mb_rawdev.c        | 1536

+++++++++++++++++

Quoted 7 lines
 drivers/raw/aesni_mb/aesni_mb_rawdev.h        |  112 ++
 drivers/raw/aesni_mb/aesni_mb_rawdev_test.c   | 1102 ++++++++++++
 .../aesni_mb/aesni_mb_rawdev_test_vectors.h   | 1183 +++++++++++++
 drivers/raw/aesni_mb/meson.build              |   26 +
 .../aesni_mb/rte_rawdev_aesni_mb_version.map  |    3 +
 drivers/raw/meson.build                       |    3 +-
 mk/rte.app.mk                                 |    2 +
Quoted 1 line

You missed adding the PMD to the MAINTAINERS file.

[DC] Added the new directories to MAINTAINERS file

Quoted 11 lines
Quoted 11 lines
 11 files changed, 4021 insertions(+), 1 deletion(-)  create mode
100644 drivers/raw/aesni_mb/Makefile  create mode 100644
drivers/raw/aesni_mb/aesni_mb_rawdev.c
 create mode 100644 drivers/raw/aesni_mb/aesni_mb_rawdev.h
 create mode 100644 drivers/raw/aesni_mb/aesni_mb_rawdev_test.c
 create mode 100644
drivers/raw/aesni_mb/aesni_mb_rawdev_test_vectors.h
 create mode 100644 drivers/raw/aesni_mb/meson.build  create mode

100644 drivers/raw/aesni_mb/rte_rawdev_aesni_mb_version.map

...

Quoted 24 lines
Quoted 24 lines
drivers/raw/aesni_mb/aesni_mb_rawdev.c new file +17 -0
new file mode 100644
index 000000000..946bdd871
@@ -0,0 +1,1536 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2020 Intel Corporation.
+ */
+
+#include <stdbool.h>
+
+#include <intel-ipsec-mb.h>
+
+#include <rte_common.h>
+#include <rte_hexdump.h>
+#include <rte_cryptodev.h>
+#include <rte_dev.h>
+#include <rte_eal.h>
+#include <rte_bus_vdev.h>
+#include <rte_malloc.h>
+#include <rte_cpuflags.h>
+#include <rte_rawdev.h>
Quoted 8 lines

drivers/raw/aesni_mb/aesni_mb_rawdev.c line 21

Quoted 4 lines
drivers/raw/aesni_mb/aesni_mb_rawdev.c new file +4 -0
+#include <rte_rawdev_pmd.h>
+#include <rte_string_fns.h>
+#include <rte_multi_fn.h>
+#include <rte_ether.h>

No need for <rte_hexdump.h>, <rte_cryptodev.h>, <rte_dev.h>, <rte_cpuflags.h> and <rte_multi_fn.h>.
I think <rte_crypto.h> is missing, though, for "rte_crypto_sym_xform".

[DC] Removed only hexdump and dev. All the others would seem to be needed. rte_cpu_get_flag_enabled() is called from cpuflags
And lots of stuff from multi_fn is used throughout this file

Quoted 17 lines

...

drivers/raw/aesni_mb/aesni_mb_rawdev.c

Quoted 13 lines
drivers/raw/aesni_mb/aesni_mb_rawdev.c new file +13 -0
+static bool
+docsis_crc_crypto_encrypt_check(struct rte_multi_fn_xform *xform) {
+	struct rte_crypto_sym_xform *crypto_sym;
+	struct rte_multi_fn_err_detect_xform *err_detect;
+	struct rte_multi_fn_xform *next;
+
+	if (xform->type == RTE_MULTI_FN_XFORM_TYPE_ERR_DETECT) {
+
+		err_detect = &xform->err_detect;
+		next = xform->next;
+
+		if (err_detect->algo ==
+				RTE_MULTI_FN_ERR_DETECT_CRC32_ETH

&&

Quoted 6 lines
Quoted 3 lines
drivers/raw/aesni_mb/aesni_mb_rawdev.c new file +2 -0
+		    err_detect->op ==
+				RTE_MULTI_FN_ERR_DETECT_OP_GENERATE

&&

I don't think leading spaces are allowed. Generally, double tab is used in multi-line if's. Same applies in other parts of the code.

[DC] Indentation of multi-line if statements have been fixed here and in other patches

Quoted 8 lines

drivers/raw/aesni_mb/aesni_mb_rawdev.c

Quoted 3 lines
drivers/raw/aesni_mb/aesni_mb_rawdev.c new file +2 -0
+		    next != NULL &&
+		    next->type ==

RTE_MULTI_FN_XFORM_TYPE_CRYPTO_SYM) {

Quoted 1 line

+

...

Quoted 10 lines

drivers/raw/aesni_mb/aesni_mb_rawdev.c line 145

Quoted 7 lines
drivers/raw/aesni_mb/aesni_mb_rawdev.c new file +7 -0
+static bool
+docsis_crypto_decrypt_crc_check(struct rte_multi_fn_xform *xform) {
+	struct rte_crypto_sym_xform *crypto_sym;
+	struct rte_multi_fn_err_detect_xform *err_detect;
+	struct rte_multi_fn_xform *next;
+
+	if (xform->type == RTE_MULTI_FN_XFORM_TYPE_CRYPTO_SYM) {

I think in order to reduce this many indentation levels, you can check for the opposite here and return false.

[DC] This was a good suggestion. Have use opposite logic throughout all these "check" functions which greatly reduces indentation

Quoted 5 lines

If (xform->type != RTE...)
return false
...

Quoted 13 lines

drivers/raw/aesni_mb/aesni_mb_rawdev.c line 108

Quoted 11 lines
drivers/raw/aesni_mb/aesni_mb_rawdev.c new file +11 -0
+
+static bool
+pon_crc_crypto_encrypt_bip_check(struct rte_multi_fn_xform *xform) {
+	struct rte_crypto_sym_xform *crypto_sym;
+	struct rte_multi_fn_err_detect_xform *err_detect;
+	struct rte_multi_fn_xform *next;
+
+	if (xform->type == RTE_MULTI_FN_XFORM_TYPE_ERR_DETECT) {
+
+		err_detect = &xform->err_detect;
+		next = xform->next;

Same as above here.

[DC] Same fix as above

Quoted 7 lines

drivers/raw/aesni_mb/aesni_mb_rawdev.c

Quoted 4 lines
drivers/raw/aesni_mb/aesni_mb_rawdev.c new file +3 -0
+
+		if (err_detect->algo ==
+				RTE_MULTI_FN_ERR_DETECT_CRC32_ETH

&&

Quoted 1 line
drivers/raw/aesni_mb/aesni_mb_rawdev.c new file +1 -0
+		    err_detect->op ==
Quoted 12 lines

drivers/raw/aesni_mb/aesni_mb_rawdev.c line 108

Quoted 10 lines
drivers/raw/aesni_mb/aesni_mb_rawdev.c new file +10 -0
+static bool
+pon_bip_crypto_decrypt_crc_check(struct rte_multi_fn_xform *xform) {
+	struct rte_crypto_sym_xform *crypto_sym;
+	struct rte_multi_fn_err_detect_xform *err_detect;
+	struct rte_multi_fn_xform *next;
+
+	if (xform->type == RTE_MULTI_FN_XFORM_TYPE_ERR_DETECT) {
+
+		err_detect = &xform->err_detect;
+		next = xform->next;

Same as above.

[DC] And same here too

Quoted 32 lines
Quoted 8 lines
drivers/raw/aesni_mb/aesni_mb_rawdev.c new file +5 -0
+}
+
+static enum aesni_mb_rawdev_op
+session_support_check(struct rte_multi_fn_xform *xform) {
+	enum aesni_mb_rawdev_op op =

AESNI_MB_RAWDEV_OP_NOT_SUPPORTED;
+

...

drivers/raw/aesni_mb/aesni_mb_rawdev.c

Quoted 12 lines
drivers/raw/aesni_mb/aesni_mb_rawdev.c new file +12 -0
+static inline int
+docsis_crypto_crc_check(struct rte_multi_fn_op *first_op,
+			struct rte_multi_fn_op *cipher_op,
+			struct rte_multi_fn_op *crc_op)
+{
+	struct rte_multi_fn_op *err_op = NULL;
+	uint8_t err_op_status;
+	const uint32_t offset_diff = DOCSIS_CIPHER_CRC_OFFSET_DIFF;
+
+	if (cipher_op->crypto_sym.cipher.data.length &&
+	    crc_op->err_detect.data.length) {
+		/* Cipher offset must be at least 12 greater than CRC offset

*/

drivers/raw/aesni_mb/aesni_mb_rawdev.c

Quoted 7 lines
drivers/raw/aesni_mb/aesni_mb_rawdev.c new file +4 -0
+		if (cipher_op->crypto_sym.cipher.data.offset <
+		    ((uint32_t)crc_op->err_detect.data.offset + offset_diff)) {
+			err_op = crc_op;
+			err_op_status =

RTE_MULTI_FN_ERR_DETECT_OP_STATUS_ERROR;

drivers/raw/aesni_mb/aesni_mb_rawdev.c new file +2 -0
+		/*
+		 * Cipher length must be at least 8 less than CRC length,

taking

Quoted 8 lines

drivers/raw/aesni_mb/aesni_mb_rawdev.c

Quoted 1 line
drivers/raw/aesni_mb/aesni_mb_rawdev.c new file +1 -0
+		 * known differences of what is ciphered and what is crc'ed

into

drivers/raw/aesni_mb/aesni_mb_rawdev.c line 507

Quoted 4 lines
drivers/raw/aesni_mb/aesni_mb_rawdev.c new file +4 -0
+		 * account
+		 */
+		} else if ((cipher_op->crypto_sym.cipher.data.length +
+				DOCSIS_CIPHER_CRC_LENGTH_DIFF) >

For consistency, you can use offset_diff here too, instead of the macro.

[DC] This check here is a LENGTH_DIFF so re-using offset_diff would work so well
I only added the offset_diff variable to get around a compiler error, so I would have used the macro there too if I could have. Decided not to make any change here

Quoted 26 lines
Quoted 7 lines
drivers/raw/aesni_mb/aesni_mb_rawdev.c new file +3 -0
+			    crc_op->err_detect.data.length) {
+			err_op = crc_op;
+			err_op_status =

RTE_MULTI_FN_ERR_DETECT_OP_STATUS_ERROR;

drivers/raw/aesni_mb/aesni_mb_rawdev.c new file +2 -0
+		}
+	}

...

Quoted 13 lines
drivers/raw/aesni_mb/aesni_mb_rawdev.c new file +13 -0
+static inline int
+mb_job_params_set(JOB_AES_HMAC *job,
+		  struct aesni_mb_rawdev_qp *qp,
+		  struct rte_multi_fn_op *op,
+		  uint8_t *output_idx)
+{
+	struct rte_mbuf *m_src, *m_dst;
+	struct rte_multi_fn_op *cipher_op;
+	struct rte_multi_fn_op *crc_op;
+	struct rte_multi_fn_op *bip_op;
+	uint32_t cipher_offset;
+	struct aesni_mb_rawdev_session *session;
+

...

Quoted 4 lines

drivers/raw/aesni_mb/aesni_mb_rawdev.c line 672

Quoted 1 line
drivers/raw/aesni_mb/aesni_mb_rawdev.c new file +1 -0
+				cipher_op->crypto_sym.cipher.data.length;

I would declare a variable like sym_op to reduce the length of these. Maybe also for err_dectect.

[DC] Have added variables like you suggested which does improve things alright in terms of line length

Quoted 11 lines
Quoted 7 lines
drivers/raw/aesni_mb/aesni_mb_rawdev.c new file +6 -0
+
+	switch (session->op) {
+	case AESNI_MB_RAWDEV_OP_DOCSIS_CRC_CRYPTO:
+	case AESNI_MB_RAWDEV_OP_DOCSIS_CRYPTO_CRC:
+		job->hash_start_src_offset_in_bytes =
+						crc_op-

...

Quoted 6 lines

drivers/raw/aesni_mb/aesni_mb_rawdev.c line 2

Quoted 4 lines

+++ b/drivers/raw/aesni_mb/aesni_mb_rawdev_test.c

drivers/raw/aesni_mb/aesni_mb_rawdev.c new file +2 -0
@@ -0,0 +1,1102 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2020 Intel Corporation.

Could this be moved under the test app? Looks odd here.

[DC] As you already spotted yourself, this is how rawdev define there tests.
When we add the QAT multi-function PMD, we will have to look at this though as both will need the same set of tests. May have to add the tests directly under the test app then

Quoted 3 lines

Thanks,
Pablo

#10 lore raw

PATCH v2 3/4 test/rawdev: add aesni_mb raw device tests

In reply to David Coyle

Adding unit tests for the AESNI-MB raw device.

---
 app/test/test_rawdev.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
app/test/test_rawdev.c +16 -0
index 524a9d5f3..badb6a756 100644
@@ -45,3 +45,19 @@ test_rawdev_selftest_ioat(void)
 }
 
 REGISTER_TEST_COMMAND(ioat_rawdev_autotest, test_rawdev_selftest_ioat);
+
+static int
+test_rawdev_selftest_aesni_mb(void)
+{
+	int ret;
+
+	ret = rte_vdev_init("rawdev_aesni_mb", NULL);
+	if (ret) {
+		printf("Failed to create AESNI-MB rawdev\n");
+		return ret;
+	}
+
+	return rte_rawdev_selftest(rte_rawdev_get_dev_id("rawdev_aesni_mb"));
+}
+
+REGISTER_TEST_COMMAND(rawdev_aesni_mb_autotest, test_rawdev_selftest_aesni_mb);
Signature · 1 line
2.17.1
#11 lore raw

PATCH v2 4/4 app/crypto-perf: add support for multi-function processing

In reply to David Coyle

Support for multi-function operations, via a raw device, has been added to the test-crypto-perf app.

A new optype has been added: multi-fn
A new parameter has been added for multi-fn mode:
--multi-fn-params <params>

The <params> field specify what type of multi-function processing is required and the options associated with that. Currently the following are supported:

docsis-cipher-crc,<cipher_offset>,<crc_offset>
pon-cipher-crc-bip,<buffer_padding_sz>

---
 app/test-crypto-perf/Makefile                 |   5 +
 app/test-crypto-perf/cperf_ops.c              | 265 ++++++++++++
 app/test-crypto-perf/cperf_options.h          |  37 +-
 app/test-crypto-perf/cperf_options_parsing.c  | 396 ++++++++++++++++--
 app/test-crypto-perf/cperf_test_common.c      |  88 +++-
 app/test-crypto-perf/cperf_test_latency.c     | 176 ++++++--
 .../cperf_test_pmd_cyclecount.c               |  96 ++++-
 app/test-crypto-perf/cperf_test_throughput.c  | 164 ++++++--
 .../cperf_test_vector_parsing.c               |  35 +-
 app/test-crypto-perf/cperf_test_vectors.c     |  53 +++
 app/test-crypto-perf/cperf_test_vectors.h     |   9 +
 app/test-crypto-perf/cperf_test_verify.c      | 205 +++++++--
 app/test-crypto-perf/main.c                   | 255 +++++++++--
 app/test-crypto-perf/meson.build              |   6 +
 14 files changed, 1584 insertions(+), 206 deletions(-)
app/test-crypto-perf/Makefile +5 -0
index 78135f38c..baf706e4a 100644
@@ -26,4 +26,9 @@ ifeq ($(CONFIG_RTE_LIBRTE_PMD_CRYPTO_SCHEDULER),y)
 LDLIBS += -lrte_pmd_crypto_scheduler
 endif
 
+ifeq ($(CONFIG_RTE_LIBRTE_MULTI_FN_COMMON)$(CONFIG_RTE_LIBRTE_RAWDEV),yy)
+CFLAGS += -DMULTI_FN_SUPPORTED
+LDLIBS += -lrte_multi_fn
+endif
+
 include $(RTE_SDK)/mk/rte.app.mk
app/test-crypto-perf/cperf_ops.c +265 -0

288 lines not on this page · raw message

app/test-crypto-perf/cperf_options.h +36 -1
index 1ed0a77e5..0ca542224 100644
@@ -10,6 +10,9 @@
 #ifdef RTE_LIBRTE_SECURITY
 #include <rte_security.h>
 #endif
+#ifdef MULTI_FN_SUPPORTED
+#include <rte_multi_fn.h>
+#endif /* MULTI_FN_SUPPORTED */
 
 #define CPERF_PTEST_TYPE	("ptest")
 #define CPERF_SILENT		("silent")
@@ -52,6 +55,10 @@
 #define CPERF_PDCP_DOMAIN	("pdcp-domain")
 #endif
 
+#ifdef MULTI_FN_SUPPORTED
+#define CPERF_MULTI_FN_PARAMS	("multi-fn-params")
+#endif /* MULTI_FN_SUPPORTED */
+
 #define CPERF_CSV		("csv-friendly")
 
 /* benchmark-specific options */
@@ -75,11 +82,34 @@ enum cperf_op_type {
 	CPERF_CIPHER_THEN_AUTH,
 	CPERF_AUTH_THEN_CIPHER,
 	CPERF_AEAD,
-	CPERF_PDCP
+	CPERF_PDCP,
+#ifdef MULTI_FN_SUPPORTED
+	CPERF_MULTI_FN
+#endif /* MULTI_FN_SUPPORTED */
 };
 
 extern const char *cperf_op_type_strs[];
 
+#ifdef MULTI_FN_SUPPORTED
+enum cperf_multi_fn_ops {
+	CPERF_MULTI_FN_OPS_DOCSIS_CIPHER_CRC,
+	CPERF_MULTI_FN_OPS_PON_CIPHER_CRC_BIP
+};
+
+extern const char *cperf_multi_fn_ops_strs[];
+
+struct cperf_multi_fn_options {
+	enum cperf_multi_fn_ops ops;
+
+	/* DOCSIS_CIPHER_CRC */
+	uint32_t cipher_offset;
+	uint32_t crc_offset;
+
+	/* PON_CIPHER_CRC_BIP */
+	uint32_t buffer_padding;
+};
+#endif /* MULTI_FN_SUPPORTED */
+
 struct cperf_options {
 	enum cperf_perf_test_type test;
 
@@ -123,6 +153,11 @@ struct cperf_options {
 	uint16_t pdcp_sn_sz;
 	enum rte_security_pdcp_domain pdcp_domain;
 #endif
+
+#ifdef MULTI_FN_SUPPORTED
+	struct cperf_multi_fn_options multi_fn_opts;
+#endif /* MULTI_FN_SUPPORTED */
+
 	char device_type[RTE_CRYPTODEV_NAME_MAX_LEN];
 	enum cperf_op_type op_type;
 
app/test-crypto-perf/cperf_options_parsing.c +361 -35

467 lines not on this page · raw message

app/test-crypto-perf/cperf_test_common.c +74 -14

130 lines not on this page · raw message

app/test-crypto-perf/cperf_test_latency.c +142 -34

243 lines not on this page · raw message

app/test-crypto-perf/cperf_test_pmd_cyclecount.c +73 -23

157 lines not on this page · raw message

app/test-crypto-perf/cperf_test_throughput.c +132 -32

232 lines not on this page · raw message

app/test-crypto-perf/cperf_test_vector_parsing.c +31 -4
index 1e9dfcfff..1395d86f2 100644
@@ -581,11 +581,38 @@ cperf_test_vector_get_from_file(struct cperf_options *opts)
 	}
 
 	/* other values not included in the file */
-	test_vector->data.cipher_offset = 0;
-	test_vector->data.cipher_length = opts->max_buffer_size;
+#ifdef MULTI_FN_SUPPORTED
+	if (opts->op_type == CPERF_MULTI_FN) {
+		if (opts->multi_fn_opts.ops ==
+				CPERF_MULTI_FN_OPS_DOCSIS_CIPHER_CRC ||
+			opts->multi_fn_opts.ops ==
+				CPERF_MULTI_FN_OPS_PON_CIPHER_CRC_BIP) {
+			test_vector->data.cipher_offset =
+					opts->multi_fn_opts.cipher_offset;
+			test_vector->data.cipher_length =
+					opts->max_buffer_size;
+
+			test_vector->multi_fn_data.crc_offset =
+					opts->multi_fn_opts.crc_offset;
+			test_vector->multi_fn_data.crc_length =
+					opts->max_buffer_size;
+		}
 
-	test_vector->data.auth_offset = 0;
-	test_vector->data.auth_length = opts->max_buffer_size;
+		if (opts->multi_fn_opts.ops ==
+				CPERF_MULTI_FN_OPS_PON_CIPHER_CRC_BIP) {
+			test_vector->multi_fn_data.bip_offset = 0;
+			test_vector->multi_fn_data.bip_length =
+					opts->max_buffer_size;
+		}
+	} else
+#endif /* MULTI_FN_SUPPORTED */
+	{
+		test_vector->data.cipher_offset = 0;
+		test_vector->data.cipher_length = opts->max_buffer_size;
+
+		test_vector->data.auth_offset = 0;
+		test_vector->data.auth_length = opts->max_buffer_size;
+	}
 
 	return test_vector;
 }
app/test-crypto-perf/cperf_test_vectors.c +53 -0

58 lines not on this page · raw message

app/test-crypto-perf/cperf_test_vectors.h +9 -0
index 6f10823ef..ad9ea89e6 100644
@@ -68,6 +68,15 @@ struct cperf_test_vector {
 		uint32_t aead_offset;
 		uint32_t aead_length;
 	} data;
+
+#ifdef MULTI_FN_SUPPORTED
+	struct {
+		uint32_t crc_offset;
+		uint32_t crc_length;
+		uint32_t bip_offset;
+		uint32_t bip_length;
+	} multi_fn_data;
+#endif /* MULTI_FN_SUPPORTED */
 };
 
 struct cperf_test_vector*
app/test-crypto-perf/cperf_test_verify.c +174 -31

286 lines not on this page · raw message

app/test-crypto-perf/main.c +223 -32

335 lines not on this page · raw message

app/test-crypto-perf/meson.build +6 -0
index 0674396da..28b54611f 100644
@@ -13,3 +13,9 @@ sources = files('cperf_ops.c',
 		'cperf_test_verify.c',
 		'main.c')
 deps += ['cryptodev', 'security']
+#deps += ['cryptodev', 'security', 'rawdev', 'common_multi_fn']
+
+if dpdk_conf.has('RTE_LIBRTE_MULTI_FN_COMMON') and dpdk_conf.has('RTE_LIBRTE_PMD_AESNI_MB_RAWDEV')
+	deps += ['rawdev', 'common_multi_fn']
+	cflags += ['-DMULTI_FN_SUPPORTED']
+endif
Signature · 1 line
2.17.1
#12 lore raw

Re: [dpdk-dev] [PATCH v2 4/4] app/crypto-perf: add support for multi-function processing

Quoted 25 lines

-----Original Message-----
From: Coyle, David <[email protected]>
Sent: Friday, April 3, 2020 5:37 PM
To: [email protected]
Cc: Doherty, Declan <[email protected]>; Trahe, Fiona <[email protected]>; De Lara Guarch, Pablo <[email protected]>; Ryan, Brendan <[email protected]>; [email protected]; [email protected]; Coyle, David <[email protected]>; O'loingsigh, Mairtin <[email protected]>
Subject: [PATCH v2 4/4] app/crypto-perf: add support for multi-function processing

Support for multi-function operations, via a raw device, has been added to the test-crypto-perf app.

A new optype has been added: multi-fn
A new parameter has been added for multi-fn mode:
--multi-fn-params <params>

The <params> field specify what type of multi-function processing is required and the options associated with that. Currently the following are supported:

Quoted 6 lines

docsis-cipher-crc,<cipher_offset>,<crc_offset>
pon-cipher-crc-bip,<buffer_padding_sz>

---

Could you update the document to reflect the new changes in the command line?

Thanks,
Pablo

#13 lore raw

Re: [dpdk-dev] [PATCH v2 4/4] app/crypto-perf: add support for multi-function processing

Hi Pablo,
Thank you for reviewing and the comments - see below for resolutions. The changes will be available in v3 shortly

David

Quoted 22 lines

-----Original Message-----
From: De Lara Guarch, Pablo <[email protected]>
Sent: Tuesday, April 7, 2020 7:55 PM

Quoted 18 lines

-----Original Message-----
From: Coyle, David <[email protected]>
Sent: Friday, April 3, 2020 5:37 PM

Support for multi-function operations, via a raw device, has been added to the test-crypto-perf app.

A new optype has been added: multi-fn
A new parameter has been added for multi-fn mode:
--multi-fn-params <params>

The <params> field specify what type of multi-function processing is required and the options associated with that. Currently the following are supported:

docsis-cipher-crc,<cipher_offset>,<crc_offset>
pon-cipher-crc-bip,<buffer_padding_sz>

Quoted 6 lines
Quoted 3 lines

---

Could you update the document to reflect the new changes in the command line?

[DC] We have removed support from the crypto-perf tool in v3 due to the amount of code churn was required to the tool to add multi-function support. I have, however, add documentation for the AESNI-MB Multi-Function Rawdev PMD in v3

Quoted 3 lines

Thanks,
Pablo

#14 lore raw
In reply to David Coyle
Quoted 110 lines · David Coyle

PLEASE NOTE: This patchset supercedes the following v1 patches which were mistakenly added as stand-alone patches (apologies for any confusion this may cause)

https://patchwork.dpdk.org/patch/66733/
https://patchwork.dpdk.org/patch/66735/
https://patchwork.dpdk.org/patch/66736/

PLEASE NOTE ALSO: Support for QAT, which the following patch addressed, has been dropped from this patchset and is now targetted at the next release (v20.08)

https://patchwork.dpdk.org/patch/66819/

Introduction
============

This patchset adds a new multi-function interface and a aesni_mb raw device PMD which uses this interface.

This patchset has already been discussed as part of the following RFC:

http://mails.dpdk.org/archives/dev/2020-February/157045.html
http://mails.dpdk.org/archives/dev/2020-March/159189.html

The main aim of this interface and raw PMDs is to provide a flexible and extensible way of combining one or more packet-processing functions into a single operation, thereby allowing these to be performed in parallel in optimized software libraries or in a hardware accelerator. These functions can include cryptography, compression and CRC/checksum calculation, while others can potentially be added in the future. 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 present and common across many access network data-plane pipelines, such as Cipher, Authentication, CRC, Bit-Interleaved-Parity (BIP), other checksums etc. Some prototyping has been done at Intel in relation to 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 XGS-PON MAC data-plane and DOCSIS MAC data-plane pipelines.

The prototypes used some protocol-specific modifications to the DPDK cryptodev library. In order to make this performance improvement consumable by network access equipment vendors, a more extensible and correct solution was required.

Hence, the introduction of a multi-function interface, initially for use by raw devices. In this patchset, a new aesni_mb raw device has been created which uses this interface.

NOTE: In a future DPDK release (currently targetting DPDK v20.08), a qat 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 an application access multiple devices using the same interface.

Use Cases
=========

The primary use cases for the multi-function interface and raw PMDs 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]

- XGS-PON 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.

However, it is not limited to these. The following are some of the other possible use-cases, which multi-function will allow for:

- Storage:
- Compression followed by Encryption
- IPSec over UDP:
- UDP Checksum calculation followed by Encryption

Quoted 6 lines

While DPDK's rte_cryptodev and rte_compressdev allow many cryptographic and compression algorithms to be chained together in one operation, there is no way to chain these with any error detection or checksum algorithms. And there is no way to chain crypto and compression algorithms together. The multi-function interface will allow these chains to be created, and also allow any future type of operation to be easily added.

I was thinking if the cryptodev can be used instead but this paragraph already seems explained it. But again can you please elaborate why rawdev is used?

Quoted 48 lines

Architecture
============

The following diagram shows where the multi-function interface and raw devices fit in an overall application architecture.

  +------------------------------------------------+
  |                                                |
  |                  Application                   |
  |   (e.g. vCMTS (DOCSIS), vOLT (XGS-PON), etc.)  |
  |                                                |
  +------------------------------------------------+
                          |
  +-----------------------|------------------------+
  |                       |                  DPDK  |
  |                       |                        |
  |             +---------------------+            |
  |             |                     |            |
  |             |     rte_rawdev      |            |
  |             |                     |            |            NOTE:
  |             +---------------------+        ____|______ 'MULTI-FUNCTION
  |                    /      \              /     |          INTERFACE'
  |                   /        \            /      |         is opaque to
  |                  /          \          /       |          rte_rawdev
  |       +--------------------------------+       |
  |       |    MULTI-FUNCTION INTERFACE    |       |
  |       +--------------------------------+       |
  |       +------------+      +------------+       |
  |       |   RAWDEV   |      |   RAWDEV   |       |
  |       |  AESNI-MB  |      |    QAT     |       |
  |       |    PMD     |      |    PMD     |       |
  |       +------------+      +------------+       |              NOTE:
  |              |                  |     \________|_____  'RAWDEV QAT PMD'
  +--------------|------------------|--------------+       will be added in
                 |                  |                         next release
          +------------+      +------------+
          |  AESNI-MB  |      |   QAT HW   |
          |   SW LIB   |      |            |
          +------------+      +------------+

David Coyle (4):
raw/common: add multi-function interface raw/aesni_mb: add aesni_mb raw device test/rawdev: add aesni_mb raw device tests app/crypto-perf: add support for multi-function processing

<...>

#15 lore raw

Hi Ferruh, see below

Quoted 11 lines
Quoted 7 lines

While DPDK's rte_cryptodev and rte_compressdev allow many cryptographic and compression algorithms to be chained together in one operation, there is no way to chain these with any error detection or checksum algorithms. And there is no way to chain crypto and compression algorithms together. The multi-function interface will allow these chains to be created, and also allow any future type of

operation to be easily added.

I was thinking if the cryptodev can be used instead but this paragraph already seems explained it. But again can you please elaborate why rawdev is used?

[DC] There are a number of reasons the rawdev approach was ultimately chosen:

1) As the paragraph above explains, our primary use-case was to chain a crypto operation with error detection algorithms such as CRC or BIP as this could leverage optimized multi-function implementations such as in the IPSec Multi-Buffer library and have a significant impact on performance of network access dataplane processing such as for vCMTS (DOCSIS MAC). However such error detection algorithms are not Crypto functions so some early advice we took was that it would not be suitable to add these to cryptodev.
Also, with a view to the future, the multi-function rawdev approach allows crypto operations to be chained with compression operations.
Again, neither cryptodev or compressdev allows this type chaining.

2) An earlier version of multi-function suggested adding a new library called rte_accelerator, as described here http://mails.dpdk.org/archives/dev/2020-February/157045.html
We received some comments on the dev mailing list that we should not add yet another acceleration library to DPDK.
And we also subsequently felt that the rawdev approach is better - that rationale is described below.

rte_accelerator was also built on top of crypto and compress devices which already existed e.g. drivers/crypto/aesni_mb, drivers/crypto/qat and drivers/compress/qat .
We subsequently realized that this was somewhat confusing when performing multi-function type operations. For example, for combined Crypto-Compression operations in the future, it would use either an existing crypto or compress device, but neither really made sense when the operations are combined. What was needed was a raw device which allowed an application to configure any type of device and it's queue pairs and send any type of operation to that device.

For both of these reasons, we decided to go down the rawdev route, with a multi-function interface which can be used by several raw device drivers.

3) rawdev is the ideal place to try out a new approach like this to accessing devices.
Adding it here allows potential consumers of this such as VNF solution providers to study and try out this approach, and take advantage of the multi-function operations already supported in the IPSec Multi-Buffer library such as Crypto-CRC and Crypto-CRC-BIP, all without DPDK committing to a new library upfront. We would hope that the multi-function rawdev approach will mature over time (through feedback from customers, new use-cases arising etc.), at which point it could be potentially be moved into the main DPDK library set.

Quoted 6 lines
Quoted 4 lines

<...>

#16 lore raw

Hi David, Ferruh,

Quoted 53 lines

-----Original Message-----
From: Coyle, David <[email protected]>
Sent: Tuesday, April 7, 2020 12:28 PM
To: Yigit, Ferruh <[email protected]>; [email protected]
Cc: Doherty, Declan <[email protected]>; Trahe, Fiona <[email protected]>; De Lara Guarch, Pablo <[email protected]>; Ryan, Brendan <[email protected]>; [email protected]; [email protected]; Akhil Goyal <[email protected]>
Subject: RE: [dpdk-dev] [PATCH v2 0/4] introduce multi-function processing support

Hi Ferruh, see below

Quoted 11 lines
Quoted 7 lines

While DPDK's rte_cryptodev and rte_compressdev allow many cryptographic and compression algorithms to be chained together in one operation, there is no way to chain these with any error detection or checksum algorithms. And there is no way to chain crypto and compression algorithms together. The multi-function interface will allow these chains to be created, and also allow any future type of

operation to be easily added.

I was thinking if the cryptodev can be used instead but this paragraph already seems explained it. But again can you please elaborate why rawdev is used?

[DC] There are a number of reasons the rawdev approach was ultimately chosen:

1) As the paragraph above explains, our primary use-case was to chain a crypto operation with error detection algorithms such as CRC or BIP as this could leverage optimized multi-function implementations such as in the IPSec Multi-Buffer library and have a significant impact on performance of network access dataplane processing such as for vCMTS (DOCSIS MAC). However such error detection algorithms are not Crypto functions so some early advice we took was that it would not be suitable to add these to cryptodev.
Also, with a view to the future, the multi-function rawdev approach allows crypto operations to be chained with compression operations.
Again, neither cryptodev or compressdev allows this type chaining.

2) An earlier version of multi-function suggested adding a new library called rte_accelerator, as described here http://mails.dpdk.org/archives/dev/2020-February/157045.html
We received some comments on the dev mailing list that we should not add yet another acceleration library to DPDK.
And we also subsequently felt that the rawdev approach is better - that rationale is described below.

rte_accelerator was also built on top of crypto and compress devices which already existed e.g. drivers/crypto/aesni_mb, drivers/crypto/qat and drivers/compress/qat .
We subsequently realized that this was somewhat confusing when performing multi-function type operations. For example, for combined Crypto-Compression operations in the future, it would use either an existing crypto or compress device, but neither really made sense when the operations are combined.
What was needed was a raw device which allowed an application to configure any type of device and it's queue pairs and send any type of operation to that device.

For both of these reasons, we decided to go down the rawdev route, with a multi-function interface which can be used by several raw device drivers.

Quoted 9 lines

3) rawdev is the ideal place to try out a new approach like this to accessing devices. Adding it here allows potential consumers of this such as VNF solution providers to study and try out this approach, and take advantage of the multi-function operations already supported in the IPSec Multi-Buffer library such as Crypto-CRC and Crypto-CRC-BIP, all without DPDK committing to a new library upfront.
We would hope that the multi-function rawdev approach will mature over time (through feedback from customers, new use-cases arising etc.), at which point it could be potentially be moved into the main DPDK library set.

[Fiona] agree with above, in particular item (2). Just to expand a bit more on this: To do a crypto+compression op one would only send one op to one device. That device could have been either a crypto device which also
implemented multi-fn, by adding compression, crc, etc to its capabilities OR a compression device which added crypto, crc, bip capabilities. Both were confusing and both raised questions about whether one could still do "normal" ops on the device, e.g. whether a normal crypto op could be interleaved on same qp as a multi-fn op. And how the capabilities would reflect what the device could do. It seems better to me to have a multifn device, which does explicitly just multifn ops.

Building this on top of rawdev is a good fit in my opinion, for the following reasons:
* avoids duplication of device APIs, as rawdev configure, start, stop, qp_setup, etc are all there already, also a nice set of stats APIs
* no impact or dependency added to rawdev lib
* avoids breakages on cryptodev or compressdev APIs
* avoids code duplication where functionality is already in a lib, e.g. re-uses cryptodev and compressdev headers. This adds a dependency, but I think that's ok as multi-function inherently depends on these functions.
* allows easy extension to add new functionality not currently available in any lib (CRC and BIP)
* allows evolution - range of useful chains which may emerge is not yet clear.

I do have some concerns, but these are resolvable in my opinion.

    (A)    as there's no rawdev capability APIs and capabilities are essentially opaque to the rawdev API, the application uses explicit device naming to create or find a device that it knows will fulfil the multifunction APIs. I can see how this works for rawdevs which expect to have only one PMD that will fulfil the service, however I'd expect multi-fn to have at least 2 driver types, probably more eventually. To be extensible I'd suggest a naming convention for a class of devices. E.g. all devices and drivers that implement multi-fn should create a rawdev named mfn_xxx, e.g. mfn_aesni_mb, mfn_qat. The "mfn_" string should be defined in the mfn hdr. This would allow creation of apis like rte_multi_fn_count() which could find rawdevs which implement mfn_ without hardcoding specific driver names.
    (B)    version control of the multi-function APIs. Putting the multifn API into the drivers/raw/common directory gives a lot of freedom while it's experimental. But can it benefit from API/ABI breakage infrastructure once the experimental tag is removed? Is there any reason not to move the common files to a lib/librte_multi_fn API?
    (C)    xstat name strings should be moved from aesni_mb PMD to common and maybe use same naming convention, so appl can query same stats from any device, e.g. "mfn_successful_enqueues" could be implemented by all PMDs. If PMDs want to add driver-specific stats they can add their own without the mfn_, instead create their own unique stat name.
    (D)    The unit test code is not extensible - again probably as based on previous rawdevs where there's only 1 implementation. For mfn I'd suggest replacing test_rawdev_selftest_aesni_mb() with a test_rawdev_selftest_multi_function(), which finds and/or creates all the raw PMDs implementing the mfn API and runs a test on each. And move the test files from the drivers/raw/aesni_mb dir to app/test and make generic so can run against any device named mfn_xxx
    (E)    the main reason to piggyback onto crypto_perf_tool is to get the benefit of parsing and of all the crypto setup.  However this code has been inflated a lot, in part due to name diffs like rte_cryptodev_enqueue_burst() vs rte_multi_fn_enqueue_burst(). Maybe could be a lot slimmer with macros like ENQUEUE_BURST(dev, qp, void *op, burst_size) ? would mean a compile time decision to do either multifn OR cryptodev API calls, but I think that may work and simplify it.
    (F)    ok, this is a bit pedantic, (sorry David!) but should the aesni_mb rawdev be renamed aesni_mb_mfn throughout (files, fns, dev and driver name). I mean it's implementing the mfn type of rawdev. I'm thinking ahead to QAT - it can implement a sym device, an asym device, a compression device and in future a multi-fn device. I'd propose to name it qat_multifn in case there'll be some other kind of rawdev device it could also implement in future. So the name qat_raw wouldn't be so helpful. (we made that mistake with qat_crypto, which should probably have been qat_sym_crypto - in my opinion more specific names are better)

I have a few minor comment- I'll reply on specific patches.

#17 lore raw

Thanks for the detailed review Fiona.

Based on your feedback, we will reduce the scope of our plans for multi-function processing support in DPDK.

We will focus on implementing a rawdev-based AESNI-MB PMD for Crypto-CRC and Crypto-CRC-BIP processing and we will add QAT Crypto-CRC support in a later release. This functionality is specific to accelerated dataplane processing for DOCSIS and PON MAC workloads.

We also note that there hasn't been much community engagement in the broader scope, so these simpler rawdev PMDs should be sufficient. If the DPDK community is interested in expanding this concept later, then this can be explored, but it would not seem necessary for now.

We will also remove crypto-perf-tester updates to test rawdev multi-function processing as this would seem like too much code churn on that test tool.

Quoted 151 lines

-----Original Message-----
From: Trahe, Fiona <[email protected]>
Sent: Tuesday, April 7, 2020 7:06 PM

Hi David, Ferruh,

Quoted 5 lines

-----Original Message-----
From: Coyle, David <[email protected]>
Sent: Tuesday, April 7, 2020 12:28 PM
To: Yigit, Ferruh <[email protected]>; [email protected]

Quoted 14 lines

Hi Ferruh, see below

Quoted 12 lines
Quoted 8 lines

While DPDK's rte_cryptodev and rte_compressdev allow many cryptographic and compression algorithms to be chained together in one operation, there is no way to chain these with any error detection or checksum algorithms. And there is no way to chain crypto and compression algorithms together. The multi-function interface will allow these chains to be created, and also allow any future type of

operation to be easily added.

I was thinking if the cryptodev can be used instead but this paragraph already seems explained it. But again can you please elaborate

why rawdev is used?

Quoted 2 lines

[DC] There are a number of reasons the rawdev approach was ultimately

chosen:

Quoted 5 lines

1) As the paragraph above explains, our primary use-case was to chain a crypto operation with error detection algorithms such as CRC or BIP as this could leverage optimized multi-function implementations such as in the IPSec Multi-Buffer library and have a significant impact on

performance of network access dataplane processing such as for vCMTS (DOCSIS MAC).

Quoted 2 lines

However such error detection algorithms are not Crypto functions so some early advice we took was that it would not be suitable to add these to

cryptodev.

Quoted 10 lines

Also, with a view to the future, the multi-function rawdev approach allows crypto operations to be chained with compression operations. Again, neither cryptodev or compressdev allows this type chaining.

2) An earlier version of multi-function suggested adding a new library called rte_accelerator, as described here
http://mails.dpdk.org/archives/dev/2020-February/157045.html
We received some comments on the dev mailing list that we should not add yet another acceleration library to DPDK.
And we also subsequently felt that the rawdev approach is better - that

rationale is described below.

Quoted 2 lines

rte_accelerator was also built on top of crypto and compress devices which

already existed e.g.

Quoted 5 lines

drivers/crypto/aesni_mb, drivers/crypto/qat and drivers/compress/qat . We subsequently realized that this was somewhat confusing when performing multi-function type operations. For example, for combined Crypto-Compression operations in the future, it would use either an existing crypto or compress device, but neither really made sense when

the operations are combined.

Quoted 2 lines

What was needed was a raw device which allowed an application to configure any type of device and it's queue pairs and send any type of

operation to that device.

Quoted 3 lines

For both of these reasons, we decided to go down the rawdev route, with a multi-function interface which can be used by several raw device

drivers.

Quoted 2 lines

3) rawdev is the ideal place to try out a new approach like this to accessing

devices.

Quoted 4 lines

Adding it here allows potential consumers of this such as VNF solution providers to study and try out this approach, and take advantage of the multi-function operations already supported in the IPSec Multi-Buffer library such as Crypto-CRC and Crypto-CRC-BIP, all without

DPDK committing to a new library upfront.

Quoted 4 lines

We would hope that the multi-function rawdev approach will mature over time (through feedback from customers, new use-cases arising etc.), at which point it could be potentially be moved into the main DPDK library set.

[Fiona] agree with above, in particular item (2). Just to expand a bit more on
this: To do a crypto+compression op one would only send one op to one device. That device could have been either a crypto device which also implemented multi-fn, by adding compression, crc, etc to its capabilities OR a compression device which added crypto, crc, bip capabilities. Both were confusing and both raised questions about whether one could still do "normal" ops on the device, e.g. whether a normal crypto op could be interleaved on same qp as a multi-fn op. And how the capabilities would reflect what the device could do.
It seems better to me to have a multifn device, which does explicitly just multifn ops.

Building this on top of rawdev is a good fit in my opinion, for the following reasons:
* avoids duplication of device APIs, as rawdev configure, start, stop,
qp_setup, etc are all there already, also a nice set of stats APIs
* no impact or dependency added to rawdev lib
* avoids breakages on cryptodev or compressdev APIs
* avoids code duplication where functionality is already in a lib, e.g. re-uses
cryptodev and compressdev headers. This adds a dependency, but I think that's ok as multi-function inherently depends on these functions.
* allows easy extension to add new functionality not currently available in
any lib (CRC and BIP)
* allows evolution - range of useful chains which may emerge is not yet
clear.

I do have some concerns, but these are resolvable in my opinion.
(A) as there's no rawdev capability APIs and capabilities are essentially
opaque to the rawdev API, the application uses explicit device naming to create or find a device that it knows will fulfil the multifunction APIs. I can see how this works for rawdevs which expect to have only one PMD that will fulfil the service, however I'd expect multi-fn to have at least 2 driver types, probably more eventually. To be extensible I'd suggest a naming convention for a class of devices. E.g. all devices and drivers that implement multi-fn should create a rawdev named mfn_xxx, e.g. mfn_aesni_mb, mfn_qat. The "mfn_" string should be defined in the mfn hdr. This would allow creation of apis like rte_multi_fn_count() which could find rawdevs which implement mfn_ without hardcoding specific driver names.
(B) version control of the multi-function APIs. Putting the multifn API into
the drivers/raw/common directory gives a lot of freedom while it's experimental. But can it benefit from API/ABI breakage infrastructure once the experimental tag is removed? Is there any reason not to move the common files to a lib/librte_multi_fn API?
(C) xstat name strings should be moved from aesni_mb PMD to common
and maybe use same naming convention, so appl can query same stats from any device, e.g. "mfn_successful_enqueues" could be implemented by all PMDs. If PMDs want to add driver-specific stats they can add their own without the mfn_, instead create their own unique stat name.
(D) The unit test code is not extensible - again probably as based on
previous rawdevs where there's only 1 implementation. For mfn I'd suggest replacing test_rawdev_selftest_aesni_mb() with a test_rawdev_selftest_multi_function(), which finds and/or creates all the raw PMDs implementing the mfn API and runs a test on each. And move the test files from the drivers/raw/aesni_mb dir to app/test and make generic so can run against any device named mfn_xxx
(E) the main reason to piggyback onto crypto_perf_tool is to get the
benefit of parsing and of all the crypto setup. However this code has been inflated a lot, in part due to name diffs like rte_cryptodev_enqueue_burst() vs rte_multi_fn_enqueue_burst(). Maybe could be a lot slimmer with macros like ENQUEUE_BURST(dev, qp, void *op, burst_size) ? would mean a compile time decision to do either multifn OR cryptodev API calls, but I think that may work and simplify it.
(F) ok, this is a bit pedantic, (sorry David!) but should the aesni_mb
rawdev be renamed aesni_mb_mfn throughout (files, fns, dev and driver name). I mean it's implementing the mfn type of rawdev. I'm thinking ahead to QAT - it can implement a sym device, an asym device, a compression device and in future a multi-fn device. I'd propose to name it qat_multifn in case there'll be some other kind of rawdev device it could also implement in future. So the name qat_raw wouldn't be so helpful. (we made that mistake with qat_crypto, which should probably have been qat_sym_crypto - in my opinion more specific names are better)

I have a few minor comment- I'll reply on specific patches.

#18 lore raw

Hi David,

Answer inline below

Quoted 19 lines

-----Original Message-----
From: Coyle, David <[email protected]>
Sent: Thursday, April 9, 2020 10:26 AM
To: Trahe, Fiona <[email protected]>; Yigit, Ferruh <[email protected]>; [email protected]
Cc: Doherty, Declan <[email protected]>; De Lara Guarch, Pablo <[email protected]>; Ryan, Brendan <[email protected]>; [email protected]; [email protected]; Akhil Goyal <[email protected]>; O'loingsigh, Mairtin <[email protected]>
Subject: RE: [dpdk-dev] [PATCH v2 0/4] introduce multi-function processing support

Thanks for the detailed review Fiona.

Based on your feedback, we will reduce the scope of our plans for multi-function processing support in DPDK.

We will focus on implementing a rawdev-based AESNI-MB PMD for Crypto-CRC and Crypto-CRC-BIP processing and we will add QAT Crypto-CRC support in a later release.
This functionality is specific to accelerated dataplane processing for DOCSIS and PON MAC workloads.

Quoted 7 lines

We also note that there hasn't been much community engagement in the broader scope, so these simpler rawdev PMDs should be sufficient.
If the DPDK community is interested in expanding this concept later, then this can be explored, but it would not seem necessary for now.

We will also remove crypto-perf-tester updates to test rawdev multi-function processing as this would seem like too much code churn on that test tool.

[Fiona] That sounds like a good idea. In that case my comments B, D and E are not relevant as assuming a broader scope. Comments A, C and F can still be considered, but are just suggestions, not blockers to this being applied in 20.05, they could easily be done in a later release.

///snip///

Quoted 47 lines
Quoted 47 lines

I do have some concerns, but these are resolvable in my opinion.
(A) as there's no rawdev capability APIs and capabilities are essentially
opaque to the rawdev API, the application uses explicit device naming to create or find a device that it knows will fulfil the multifunction APIs. I can see how this works for rawdevs which expect to have only one PMD that will fulfil the service, however I'd expect multi-fn to have at least 2 driver types, probably more eventually. To be extensible I'd suggest a naming convention for a class of devices. E.g. all devices and drivers that implement multi-fn should create a rawdev named mfn_xxx, e.g. mfn_aesni_mb, mfn_qat. The "mfn_" string should be defined in the mfn hdr. This would allow creation of apis like rte_multi_fn_count() which could find rawdevs which implement mfn_ without hardcoding specific driver names.
(B) version control of the multi-function APIs. Putting the multifn API into
the drivers/raw/common directory gives a lot of freedom while it's experimental. But can it benefit from API/ABI breakage infrastructure once the experimental tag is removed? Is there any reason not to move the common files to a lib/librte_multi_fn API?
(C) xstat name strings should be moved from aesni_mb PMD to common
and maybe use same naming convention, so appl can query same stats from any device, e.g. "mfn_successful_enqueues" could be implemented by all PMDs. If PMDs want to add driver-specific stats they can add their own without the mfn_, instead create their own unique stat name.
(D) The unit test code is not extensible - again probably as based on
previous rawdevs where there's only 1 implementation. For mfn I'd suggest replacing test_rawdev_selftest_aesni_mb() with a test_rawdev_selftest_multi_function(), which finds and/or creates all the raw PMDs implementing the mfn API and runs a test on each. And move the test files from the drivers/raw/aesni_mb dir to app/test and make generic so can run against any device named mfn_xxx
(E) the main reason to piggyback onto crypto_perf_tool is to get the
benefit of parsing and of all the crypto setup. However this code has been inflated a lot, in part due to name diffs like rte_cryptodev_enqueue_burst() vs rte_multi_fn_enqueue_burst(). Maybe could be a lot slimmer with macros like ENQUEUE_BURST(dev, qp, void *op, burst_size) ? would mean a compile time decision to do either multifn OR cryptodev API calls, but I think that may work and simplify it.
(F) ok, this is a bit pedantic, (sorry David!) but should the aesni_mb
rawdev be renamed aesni_mb_mfn throughout (files, fns, dev and driver name). I mean it's implementing the mfn type of rawdev. I'm thinking ahead to QAT - it can implement a sym device, an asym device, a compression device and in future a multi-fn device. I'd propose to name it qat_multifn in case there'll be some other kind of rawdev device it could also implement in future. So the name qat_raw wouldn't be so helpful. (we made that mistake with qat_crypto, which should probably have been qat_sym_crypto - in my opinion more specific names are better)

I have a few minor comment- I'll reply on specific patches.

#19 lore raw

Hi Fiona, see below

Quoted 30 lines

-----Original Message-----
From: Trahe, Fiona <[email protected]>
Sent: Thursday, April 9, 2020 10:37 AM

Hi David,

Answer inline below

Quoted 11 lines

-----Original Message-----
From: Coyle, David <[email protected]>
Sent: Thursday, April 9, 2020 10:26 AM

Thanks for the detailed review Fiona.

Based on your feedback, we will reduce the scope of our plans for multi-function processing support in DPDK.

We will focus on implementing a rawdev-based AESNI-MB PMD for Crypto-CRC and Crypto-CRC-BIP processing and we will add QAT Crypto-

CRC support in a later release.

Quoted 1 line

This functionality is specific to accelerated dataplane processing for DOCSIS

and PON MAC workloads.

Quoted 8 lines

We also note that there hasn't been much community engagement in the broader scope, so these simpler rawdev PMDs should be sufficient. If the DPDK community is interested in expanding this concept later, then this can be explored, but it would not seem necessary for now.

We will also remove crypto-perf-tester updates to test rawdev multi-function processing as this would seem like too much code churn on

Quoted 7 lines

that test tool.

[Fiona] That sounds like a good idea. In that case my comments B, D and E are not relevant as assuming a broader scope.
Comments A, C and F can still be considered, but are just suggestions, not blockers to this being applied in 20.05, they could easily be done in a later release.

[DC] For 20.05, I plan to address A, C and F from below.
We will look to address D in a later release when we add QAT multi-function PMD to see if unit test extensibility can be improved. And B and E are now no longer applicable due to reduced scope.

Quoted 15 lines

///snip///

Quoted 4 lines
Quoted 4 lines

I do have some concerns, but these are resolvable in my opinion.
(A) as there's no rawdev capability APIs and capabilities are essentially
opaque to the rawdev API, the application uses explicit device naming to create or find a device that it knows will fulfil the

Quoted 8 lines
Quoted 8 lines

multifunction APIs. I can see how this works for rawdevs which expect to have only one PMD that will fulfil the service, however I'd expect multi-fn to have at least 2 driver types, probably more eventually. To be extensible I'd suggest a naming convention for a class of devices. E.g. all devices and drivers that implement multi-fn should create a rawdev named mfn_xxx, e.g. mfn_aesni_mb, mfn_qat. The "mfn_" string should be defined in the mfn hdr. This would allow creation of apis like rte_multi_fn_count() which could find

Quoted 1 line

rawdevs which implement mfn_ without hardcoding specific driver names.

[DC] The AESNI-MB rawdev will be renamed to rawdev_mfn_aesni_mb. Keeping "rawdev_" as first prefix keeps this consistent with other rawdevs Adding "mfn_" allows rawdevs implementing multi-function be found as you suggested

Quoted 6 lines
Quoted 1 line
Quoted 1 line

(B) version control of the multi-function APIs. Putting the multifn API

into

Quoted 4 lines
Quoted 4 lines

the drivers/raw/common directory gives a lot of freedom while it's experimental. But can it benefit from API/ABI breakage infrastructure once the experimental tag is removed? Is there any reason not to move the common files to a lib/librte_multi_fn API?

[DC] As stated above, this is no longer applicable due to reduced scope

Quoted 7 lines
Quoted 1 line
Quoted 1 line

(C) xstat name strings should be moved from aesni_mb PMD to

common

Quoted 2 lines
Quoted 2 lines

and maybe use same naming convention, so appl can query same stats from any device, e.g. "mfn_successful_enqueues" could be

implemented

Quoted 2 lines
Quoted 2 lines

by all PMDs. If PMDs want to add driver-specific stats they can add their own without the mfn_, instead create their own unique stat name.

[DC] This is a good suggestion as these same stats will also be needed by the QAT PMD. I will make this change.

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

(D) The unit test code is not extensible - again probably as based on
previous rawdevs where there's only 1 implementation. For mfn I'd suggest replacing test_rawdev_selftest_aesni_mb() with a test_rawdev_selftest_multi_function(), which finds and/or creates all the raw PMDs implementing the mfn API and runs a test on each. And move the test files from the drivers/raw/aesni_mb dir to app/test and make generic so can run against any device named mfn_xxx

[DC] As stated above we will look at making the unit tests more extensible when we add the QAT PMD For now, keeping the tests in the drivers/raw/aesni_mb_mfn directory is consistent with existing rawdevs

Quoted 8 lines
Quoted 4 lines
Quoted 4 lines

(E) the main reason to piggyback onto crypto_perf_tool is to get the
benefit of parsing and of all the crypto setup. However this code has been inflated a lot, in part due to name diffs like rte_cryptodev_enqueue_burst() vs rte_multi_fn_enqueue_burst().

Maybe

Quoted 3 lines
Quoted 3 lines

could be a lot slimmer with macros like ENQUEUE_BURST(dev, qp, void *op, burst_size) ? would mean a compile time decision to do either multifn OR cryptodev API calls, but I think that may work and simplify it.

[DC] We will remove support for multi-function from the crypto-perf too due to amount of code churn it required

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines

(F) ok, this is a bit pedantic, (sorry David!) but should the aesni_mb
rawdev be renamed aesni_mb_mfn throughout (files, fns, dev and driver name). I mean it's implementing the mfn type of rawdev. I'm thinking ahead to QAT - it can implement a sym device, an asym device, a compression device and in future a multi-fn device. I'd propose to name it qat_multifn in case there'll be some other kind of rawdev device it could also implement in future. So the name qat_raw wouldn't be so helpful. (we made that mistake with qat_crypto, which should probably have been qat_sym_crypto - in my opinion more specific names are better)

[DC] To keep naming of files, directories, functions etc. consistent with the driver name which now includes the mfn tag, the files, directories, functions etc. will be renamed to also include 'mfn' e.g. aesni_mb_mfn_rawdev.c/h, aesni_mb_mfn_probe() A similar naming convention will be used for the QAT driver when we add that.

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

I have a few minor comment- I'll reply on specific patches.

#20 lore raw

Thanks David,
Sounds good.
I look forward to the v3.
Fiona

Quoted 139 lines

-----Original Message-----
From: Coyle, David <[email protected]>
Sent: Thursday, April 9, 2020 12:56 PM
To: Trahe, Fiona <[email protected]>; Yigit, Ferruh <[email protected]>; [email protected]
Cc: Doherty, Declan <[email protected]>; De Lara Guarch, Pablo <[email protected]>; Ryan, Brendan <[email protected]>; [email protected]; [email protected]; Akhil Goyal <[email protected]>; O'loingsigh, Mairtin <[email protected]>
Subject: RE: [dpdk-dev] [PATCH v2 0/4] introduce multi-function processing support

Hi Fiona, see below

Quoted 30 lines

-----Original Message-----
From: Trahe, Fiona <[email protected]>
Sent: Thursday, April 9, 2020 10:37 AM

Hi David,

Answer inline below

Quoted 11 lines

-----Original Message-----
From: Coyle, David <[email protected]>
Sent: Thursday, April 9, 2020 10:26 AM

Thanks for the detailed review Fiona.

Based on your feedback, we will reduce the scope of our plans for multi-function processing support in DPDK.

We will focus on implementing a rawdev-based AESNI-MB PMD for Crypto-CRC and Crypto-CRC-BIP processing and we will add QAT Crypto-

CRC support in a later release.

Quoted 1 line

This functionality is specific to accelerated dataplane processing for DOCSIS

and PON MAC workloads.

Quoted 8 lines

We also note that there hasn't been much community engagement in the broader scope, so these simpler rawdev PMDs should be sufficient. If the DPDK community is interested in expanding this concept later, then this can be explored, but it would not seem necessary for now.

We will also remove crypto-perf-tester updates to test rawdev multi-function processing as this would seem like too much code churn on

Quoted 7 lines

that test tool.

[Fiona] That sounds like a good idea. In that case my comments B, D and E are not relevant as assuming a broader scope.
Comments A, C and F can still be considered, but are just suggestions, not blockers to this being applied in 20.05, they could easily be done in a later release.

[DC] For 20.05, I plan to address A, C and F from below.
We will look to address D in a later release when we add QAT multi-function PMD to see if unit test extensibility can be improved.
And B and E are now no longer applicable due to reduced scope.

Quoted 15 lines

///snip///

Quoted 4 lines
Quoted 4 lines

I do have some concerns, but these are resolvable in my opinion.
(A) as there's no rawdev capability APIs and capabilities are essentially
opaque to the rawdev API, the application uses explicit device naming to create or find a device that it knows will fulfil the

Quoted 8 lines
Quoted 8 lines

multifunction APIs. I can see how this works for rawdevs which expect to have only one PMD that will fulfil the service, however I'd expect multi-fn to have at least 2 driver types, probably more eventually. To be extensible I'd suggest a naming convention for a class of devices. E.g. all devices and drivers that implement multi-fn should create a rawdev named mfn_xxx, e.g. mfn_aesni_mb, mfn_qat. The "mfn_" string should be defined in the mfn hdr. This would allow creation of apis like rte_multi_fn_count() which could find

Quoted 1 line

rawdevs which implement mfn_ without hardcoding specific driver names.

[DC] The AESNI-MB rawdev will be renamed to rawdev_mfn_aesni_mb. Keeping "rawdev_" as first prefix keeps this consistent with other rawdevs Adding "mfn_" allows rawdevs implementing multi-function be found as you suggested

Quoted 6 lines
Quoted 1 line
Quoted 1 line

(B) version control of the multi-function APIs. Putting the multifn API

into

Quoted 4 lines
Quoted 4 lines

the drivers/raw/common directory gives a lot of freedom while it's experimental. But can it benefit from API/ABI breakage infrastructure once the experimental tag is removed? Is there any reason not to move the common files to a lib/librte_multi_fn API?

[DC] As stated above, this is no longer applicable due to reduced scope

Quoted 7 lines
Quoted 1 line
Quoted 1 line

(C) xstat name strings should be moved from aesni_mb PMD to

common

Quoted 2 lines
Quoted 2 lines

and maybe use same naming convention, so appl can query same stats from any device, e.g. "mfn_successful_enqueues" could be

implemented

Quoted 2 lines
Quoted 2 lines

by all PMDs. If PMDs want to add driver-specific stats they can add their own without the mfn_, instead create their own unique stat name.

[DC] This is a good suggestion as these same stats will also be needed by the QAT PMD. I will make this change.

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

(D) The unit test code is not extensible - again probably as based on
previous rawdevs where there's only 1 implementation. For mfn I'd suggest replacing test_rawdev_selftest_aesni_mb() with a test_rawdev_selftest_multi_function(), which finds and/or creates all the raw PMDs implementing the mfn API and runs a test on each. And move the test files from the drivers/raw/aesni_mb dir to app/test and make generic so can run against any device named mfn_xxx

[DC] As stated above we will look at making the unit tests more extensible when we add the QAT PMD For now, keeping the tests in the drivers/raw/aesni_mb_mfn directory is consistent with existing rawdevs

Quoted 8 lines
Quoted 4 lines
Quoted 4 lines

(E) the main reason to piggyback onto crypto_perf_tool is to get the
benefit of parsing and of all the crypto setup. However this code has been inflated a lot, in part due to name diffs like rte_cryptodev_enqueue_burst() vs rte_multi_fn_enqueue_burst().

Maybe

Quoted 3 lines
Quoted 3 lines

could be a lot slimmer with macros like ENQUEUE_BURST(dev, qp, void *op, burst_size) ? would mean a compile time decision to do either multifn OR cryptodev API calls, but I think that may work and simplify it.

[DC] We will remove support for multi-function from the crypto-perf too due to amount of code churn it required

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines

(F) ok, this is a bit pedantic, (sorry David!) but should the aesni_mb
rawdev be renamed aesni_mb_mfn throughout (files, fns, dev and driver name). I mean it's implementing the mfn type of rawdev. I'm thinking ahead to QAT - it can implement a sym device, an asym device, a compression device and in future a multi-fn device. I'd propose to name it qat_multifn in case there'll be some other kind of rawdev device it could also implement in future. So the name qat_raw wouldn't be so helpful. (we made that mistake with qat_crypto, which should probably have been qat_sym_crypto - in my opinion more specific names are better)

[DC] To keep naming of files, directories, functions etc. consistent with the driver name which now includes the mfn tag,
the files, directories, functions etc. will be renamed to also include 'mfn' e.g. aesni_mb_mfn_rawdev.c/h, aesni_mb_mfn_probe()
A similar naming convention will be used for the QAT driver when we add that.

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

I have a few minor comment- I'll reply on specific patches.

#21 lore raw
In reply to Coyle, David
Quoted 29 lines · David

Hi Ferruh, see below

Quoted 11 lines
Quoted 7 lines

While DPDK's rte_cryptodev and rte_compressdev allow many cryptographic and compression algorithms to be chained together in one operation, there is no way to chain these with any error detection or checksum algorithms. And there is no way to chain crypto and compression algorithms together. The multi-function interface will allow these chains to be created, and also allow any future type of

operation to be easily added.

I was thinking if the cryptodev can be used instead but this paragraph already seems explained it. But again can you please elaborate why rawdev is used?

[DC] There are a number of reasons the rawdev approach was ultimately chosen:

1) As the paragraph above explains, our primary use-case was to chain a crypto operation with error detection algorithms such as CRC or BIP as this could leverage optimized multi-function implementations such as in the IPSec Multi-Buffer library and have a significant impact on performance of network access dataplane processing such as for vCMTS (DOCSIS MAC). However such error detection algorithms are not Crypto functions so some early advice we took was that it would not be suitable to add these to cryptodev.
Also, with a view to the future, the multi-function rawdev approach allows crypto operations to be chained with compression operations.
Again, neither cryptodev or compressdev allows this type chaining.

2) An earlier version of multi-function suggested adding a new library called rte_accelerator, as described here http://mails.dpdk.org/archives/dev/2020-February/157045.html
We received some comments on the dev mailing list that we should not add yet another acceleration library to DPDK.
And we also subsequently felt that the rawdev approach is better - that rationale is described below.

rte_accelerator was also built on top of crypto and compress devices which already existed e.g. drivers/crypto/aesni_mb, drivers/crypto/qat and drivers/compress/qat .
We subsequently realized that this was somewhat confusing when performing multi-function type operations. For example, for combined Crypto-Compression operations in the future, it would use either an existing crypto or compress device, but neither really made sense when the operations are combined. What was needed was a raw device which allowed an application to configure any type of device and it's queue pairs and send any type of operation to that device.

Quoted 6 lines

For both of these reasons, we decided to go down the rawdev route, with a multi-function interface which can be used by several raw device drivers.

3) rawdev is the ideal place to try out a new approach like this to accessing devices.
Adding it here allows potential consumers of this such as VNF solution providers to study and try out this approach, and take advantage of the multi-function operations already supported in the IPSec Multi-Buffer library such as Crypto-CRC and Crypto-CRC-BIP, all without DPDK committing to a new library upfront. We would hope that the multi-function rawdev approach will mature over time (through feedback from customers, new use-cases arising etc.), at which point it could be potentially be moved into the main DPDK library set.

Sounds good to me, thank you for detailed explanation.