Commit bb5083a8 authored by paul luse's avatar paul luse Committed by Tomasz Zawadzki
Browse files

bdev/compress: Port to use accel_fw instead of compressdev


directly

This patch removes hardcoded compressdev code from the
vbdev module and instead uses the accel_fw. The port required
a few changes based on how things are plumbed and accessed,
nothing that isn't be too obscure.  CI tests were updated to
run ISAL accel_fw module as well as DPDK compressdev with QAT.

Unit tests for the new module will follow in a separate patch.

Signed-off-by: default avatarpaul luse <paul.e.luse@intel.com>
Change-Id: I769cbc888658fb846d89f6f0bfeeb1a2a820767e
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/13610


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarTomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: default avatarKonrad Sztyber <konrad.sztyber@intel.com>
parent 90a6407d
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -325,7 +325,7 @@ if [ $SPDK_RUN_FUNCTIONAL_TEST -eq 1 ]; then
	fi

	if [ $SPDK_TEST_VBDEV_COMPRESS -eq 1 ]; then
		run_test "compress_qat" ./test/compress/compress.sh "qat"
		run_test "compress_compdev" ./test/compress/compress.sh "compdev"
		run_test "compress_isal" ./test/compress/compress.sh "isal"
	fi

+4 −21
Original line number Diff line number Diff line
@@ -104,15 +104,10 @@ unless the data stored on disk is placed appropriately. The compression vbdev mo
relies on an internal SPDK library called `reduce` to accomplish this, see @ref reduce
for detailed information.

The vbdev module relies on the DPDK CompressDev Framework to provide all compression
functionality. The framework provides support for many different software only
compression modules as well as hardware assisted support for Intel QAT. At this
time the vbdev module supports the DPDK drivers for ISAL, QAT and mlx5_pci.

mlx5_pci driver works with BlueField 2 SmartNIC and requires additional configuration of DPDK
environment to enable compression function. It can be done via SPDK event library by configuring
`env_context` member of `spdk_app_opts` structure or by passing corresponding CLI arguments in the
following form: `--allow=BDF,class=compress`, e.g. `--allow=0000:01:00.0,class=compress`.
The compression bdev module leverages the [Acceleration Framework](https://spdk.io/doc/accel_fw.html) to
carry out the actual compression and decompression. The acceleration framework can be configured to use
ISA-L software optimized compression or the DPDK Compressdev module for hardware acceleration. To configure
the Compressdev module please see the `compressdev_scan_accel_module` documentation [here](https://spdk.io/doc/jsonrpc.html)

Persistent memory is used to store metadata associated with the layout of the data on the
backing device. SPDK relies on [PMDK](http://pmem.io/pmdk/) to interface persistent memory so any hardware
@@ -135,18 +130,6 @@ created it cannot be separated from the persistent memory file that will be crea
the specified directory.  If the persistent memory file is not available, the compression
vbdev will also not be available.

By default the vbdev module will choose the QAT driver if the hardware and drivers are
available and loaded.  If not, it will revert to the software-only ISAL driver. By using
the following command, the driver may be specified however this is not persistent so it
must be done either upon creation or before the underlying logical volume is loaded to
be honored. In the example below, `0` is telling the vbdev module to use QAT if available
otherwise use ISAL, this is the default and if sufficient the command is not required. Passing
a value of 1 tells the driver to use QAT and if not available then the creation or loading
the vbdev should fail to create or load.  A value of '2' as shown below tells the module
to use ISAL and if for some reason it is not available, the vbdev should fail to create or load.

`rpc.py bdev_compress_set_pmd -p 2`

To remove a compression vbdev, use the following command which will also delete the PMEM
file.  If the logical volume is deleted the PMEM file will not be removed and the
compression vbdev will not be available.
+0 −36
Original line number Diff line number Diff line
@@ -2724,42 +2724,6 @@ Example response:
}
~~~

### bdev_compress_set_pmd {#rpc_bdev_compress_set_pmd}

Select the DPDK polled mode driver (pmd) for a compressed bdev,
0 = auto-select, 1= QAT only, 2 = ISAL only, 3 = mlx5_pci only.

#### Parameters

Name                    | Optional | Type        | Description
----------------------- | -------- | ----------- | -----------
pmd                     | Required | int         | pmd selection

#### Example

Example request:

~~~json
{
  "params": {
    "pmd": 1
  },
  "jsonrpc": "2.0",
  "method": "bdev_compress_set_pmd",
  "id": 1
}
~~~

Example response:

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

### bdev_crypto_create {#rpc_bdev_crypto_create}

Create a new crypto bdev on a given base bdev.
+1 −0
Original line number Diff line number Diff line
@@ -78,6 +78,7 @@ typedef void (*spdk_reduce_vol_op_with_handle_complete)(void *ctx,
typedef void (*spdk_reduce_dev_cpl)(void *cb_arg, int reduce_errno);

struct spdk_reduce_vol_cb_args {
	uint32_t		output_size;
	spdk_reduce_dev_cpl	cb_fn;
	void			*cb_arg;
};
+8 −11
Original line number Diff line number Diff line
@@ -1179,11 +1179,10 @@ _write_compress_done(void *_req, int reduce_errno)
	 * the uncompressed buffer to disk.
	 */
	if (reduce_errno < 0) {
		reduce_errno = req->vol->params.chunk_size;
		req->backing_cb_args.output_size = req->vol->params.chunk_size;
	}

	/* Positive reduce_errno indicates number of bytes in compressed buffer. */
	_reduce_vol_write_chunk(req, _write_write_done, (uint32_t)reduce_errno);
	_reduce_vol_write_chunk(req, _write_write_done, req->backing_cb_args.output_size);
}

static void
@@ -1392,11 +1391,10 @@ _write_decompress_done(void *_req, int reduce_errno)
		return;
	}

	/* Positive reduce_errno indicates number of bytes in decompressed
	 *  buffer.  This should equal the chunk size - otherwise that's another
	 *  type of failure.
	/* Positive reduce_errno indicates that the output size field in the backing_cb_args
	 * represents the output_size.
	 */
	if ((uint32_t)reduce_errno != req->vol->params.chunk_size) {
	if (req->backing_cb_args.output_size != req->vol->params.chunk_size) {
		_reduce_vol_complete_req(req, -EIO);
		return;
	}
@@ -1443,11 +1441,10 @@ _read_decompress_done(void *_req, int reduce_errno)
		return;
	}

	/* Positive reduce_errno indicates number of bytes in decompressed
	 *  buffer.  This should equal the chunk size - otherwise that's another
	 *  type of failure.
	/* Positive reduce_errno indicates that the output size field in the backing_cb_args
	 * represents the output_size.
	 */
	if ((uint32_t)reduce_errno != vol->params.chunk_size) {
	if (req->backing_cb_args.output_size != vol->params.chunk_size) {
		_reduce_vol_complete_req(req, -EIO);
		return;
	}
Loading