Commit 61fbb000 authored by Alexey Marchuk's avatar Alexey Marchuk Committed by Tomasz Zawadzki
Browse files

module/accel: Add accel_dpdk_cryptodev



The new module replaces functionality in vbdev_crypto.
This module is bdev agnostic, so some inernal parts
were reworked.

io_channel: contains a qp of every configured DPDK PMD
crypto key: for mlx5_pci we register a key on each available
device since keys are bound to Protection Domain.

Signed-off-by: default avatarAlexey Marchuk <alexeymar@nvidia.com>
Change-Id: If1845cb87eadacbb921c593ba82207a97f2209a3
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/14859


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarPaul Luse <paul.e.luse@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <smatsumoto@nvidia.com>
parent f5d1a924
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -8,6 +8,9 @@ New library isa-l-crypto has been added, it is used by accel library in crypto o

New functions `spdk_accel_submit_encrypt` and `spdk_accel_submit_decrypt` were added.

New accel module `dpdk_cryptodev` has been added. It uses DPDK crypto PMD and support encrypt and
decrypt operations. New RPC `dpdk_cryptodev_scan_accel_module` has been added to enable this accel module.

### bdev

Both of interleaved and separated metadata are now supported by the malloc bdev module.
+17 −1
Original line number Diff line number Diff line
@@ -86,7 +86,7 @@ The DSA hardware supports a limited queue depth and channels. This means that
only a limited number of `spdk_thread`s will be able to acquire a channel.
Design software to deal with the inability to get a channel.

### How to use kernel idxd driver {#accel_idxd_kernel}
#### How to use kernel idxd driver {#accel_idxd_kernel}

There are several dependencies to leverage the Linux idxd driver for driving DSA devices.

@@ -139,6 +139,22 @@ enabled via startup RPC as discussed earlier, the software module will use ISA-L
if available for functions such as CRC32C. Otherwise, standard glibc calls are
used to back the framework API.

### dpdk_cryptodev {#accel_dpdk_cryptodev}

The dpdk_cryptodev module uses DPDK CryptoDev API to implement crypto operations.
The following ciphers and PMDs are supported:

- AESN-NI Multi Buffer Crypto Poll Mode Driver: RTE_CRYPTO_CIPHER_AES128_CBC
- Intel(R) QuickAssist (QAT) Crypto Poll Mode Driver: RTE_CRYPTO_CIPHER_AES128_CBC,
  RTE_CRYPTO_CIPHER_AES128_XTS
  (Note: QAT is functional however is marked as experimental until the hardware has
  been fully integrated with the SPDK CI system.)
- MLX5 Crypto Poll Mode Driver: RTE_CRYPTO_CIPHER_AES256_XTS, RTE_CRYPTO_CIPHER_AES512_XTS

To enable this module, use [`dpdk_cryptodev_scan_accel_module`](https://spdk.io/doc/jsonrpc.html),
this RPC is available in STARTUP state and the SPDK application needs to be run with `--wait-for-rpc`
CLI parameter. To select a specific PMD, use [`dpdk_cryptodev_set_driver`](https://spdk.io/doc/jsonrpc.html)

### Module to Operation Code Assignment {#accel_assignments}

When multiple modules are initialized, the accel framework will assign op codes to
+98 −0
Original line number Diff line number Diff line
@@ -446,6 +446,9 @@ Example response:
    "accel_crypto_keys_get",
    "ioat_scan_accel_module",
    "dsa_scan_accel_module",
    "dpdk_cryptodev_scan_accel_module",
    "dpdk_cryptodev_set_driver",
    "dpdk_cryptodev_get_driver",
    "bdev_virtio_attach_controller",
    "bdev_virtio_scsi_get_devices",
    "bdev_virtio_detach_controller",
@@ -1961,6 +1964,101 @@ Example response:
}
~~~

### dpdk_cryptodev_scan_accel_module {#rpc_dpdk_cryptodev_scan_accel_module}

Enable dpdk_cryptodev accel offload

#### Parameters

None

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "method": "dpdk_cryptodev_scan_accel_module",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### dpdk_cryptodev_set_driver {#rpc_dpdk_cryptodev_set_driver}

Set the DPDK cryptodev driver

#### Parameters

Name                    | Optional | Type   | Description
----------------------- |----------|--------| -----------
driver_name             | Required | string | The driver, can be one of crypto_aesni_mb, crypto_qat or mlx5_pci

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "method": "dpdk_cryptodev_set_driver",
  "id": 1,
  "params": {
    "driver_name": "crypto_aesni_mb"
  }
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### dpdk_cryptodev_get_driver {#rpc_dpdk_cryptodev_get_driver}

Get the DPDK cryptodev driver

#### Parameters

None

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "method": "dpdk_cryptodev_get_driver",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "crypto_aesni_mb"
}
~~~

## Block Device Abstraction Layer {#jsonrpc_components_bdev}

### bdev_set_options {#rpc_bdev_set_options}
+2 −0
Original line number Diff line number Diff line
#  SPDX-License-Identifier: BSD-3-Clause
#  Copyright (C) 2015 Intel Corporation.
#  Copyright (c) 2022 NVIDIA CORPORATION & AFFILIATES
#  All rights reserved.
#

@@ -96,6 +97,7 @@ endif
DEPDIRS-accel_ioat := log ioat thread jsonrpc rpc accel
DEPDIRS-accel_dsa := log idxd thread $(JSON_LIBS) accel trace
DEPDIRS-accel_iaa := log idxd thread $(JSON_LIBS) accel trace
DEPDIRS-accel_dpdk_cryptodev := log thread $(JSON_LIBS) accel

# module/env_dpdk
DEPDIRS-env_dpdk_rpc := log $(JSON_LIBS)
+4 −1
Original line number Diff line number Diff line
#  SPDX-License-Identifier: BSD-3-Clause
#  Copyright (C) 2016 Intel Corporation.
#  Copyright (c) 2021, 2022 NVIDIA CORPORATION & AFFILIATES.
#  All rights reserved.
#  Copyright (c) 2021 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#

BLOCKDEV_MODULES_LIST = bdev_malloc bdev_null bdev_nvme bdev_passthru bdev_lvol
@@ -101,6 +101,9 @@ ACCEL_MODULES_LIST = accel_ioat ioat
ifeq ($(CONFIG_IDXD),y)
ACCEL_MODULES_LIST += accel_dsa accel_iaa idxd
endif
ifeq ($(CONFIG_CRYPTO),y)
ACCEL_MODULES_LIST += accel_dpdk_cryptodev
endif

SCHEDULER_MODULES_LIST = scheduler_dynamic
ifeq (y,$(DPDK_POWER))
Loading