Spdk/module/accel/dpdk_compressdev/accel_dpdk_compressdev_rpc.c
paul luse 976f8b0992 module/accel: Add compressDev accel_module
This is the port of the vbdev compress logic into the accel
framework.  It includes just one enhancement, to only fill each
mbuf in either src or dst array with max "window size" param to
avoid QAT errors. Note that DPDK ISAL PMD was not ported as we
have native ISAL compression in accel now.

Note: ISAL w/DPDK is still built w/this patch, that can't be
removed until the vbdev module moves to accel fw as it still
depends on DPDK ISAL PMD.

Follow-on patches will include addition C API for PMD selection,
this patch just gets equivalent functionality going.  Upcoming
patches will also convert the vbdev compress module to use the
accel framework instead of talking directly to compressdev.

More patches will also address comments on vbdev common code
that addressed here would make the review challenging.

This patch also fixes a bug in the ported code that needs to
be fixed here to pass CI.  Capability discovery was incorrect
causing all devices to appear to not support chained mbufs,
with the mbuf splitting code this is important to get right.

Signed-off-by: paul luse <paul.e.luse@intel.com>
Change-Id: I7f526404819b145ef26e40877122ba80a02fcf51
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/15178
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com>
2023-01-19 11:16:01 +00:00

53 lines
1.5 KiB
C

/* SPDX-License-Identifier: BSD-3-Clause
* Copyright (C) 2022 Intel Corporation.
* All rights reserved.
*/
#include "accel_dpdk_compressdev.h"
#include "spdk/rpc.h"
#include "spdk/util.h"
#include "spdk/string.h"
#include "spdk/log.h"
struct rpc_compressdev_scan_accel_module {
uint32_t pmd;
};
static const struct spdk_json_object_decoder rpc_compressdev_scan_accel_module_decoder[] = {
{"pmd", offsetof(struct rpc_compressdev_scan_accel_module, pmd), spdk_json_decode_uint32},
};
static void
rpc_compressdev_scan_accel_module(struct spdk_jsonrpc_request *request,
const struct spdk_json_val *params)
{
struct rpc_compressdev_scan_accel_module req;
int rc = 0;
if (spdk_json_decode_object(params, rpc_compressdev_scan_accel_module_decoder,
SPDK_COUNTOF(rpc_compressdev_scan_accel_module_decoder),
&req)) {
SPDK_ERRLOG("spdk_json_decode_object failed\n");
spdk_jsonrpc_send_error_response(request, SPDK_JSONRPC_ERROR_PARSE_ERROR,
"spdk_json_decode_object failed");
return;
}
if (req.pmd >= COMPRESS_PMD_MAX) {
spdk_jsonrpc_send_error_response_fmt(request, -EINVAL,
"PMD value %d should be less than %d", req.pmd, COMPRESS_PMD_MAX);
return;
}
rc = accel_compressdev_enable_probe(&req.pmd);
if (rc) {
spdk_jsonrpc_send_error_response(request, rc, spdk_strerror(-rc));
return;
}
accel_dpdk_compressdev_enable();
spdk_jsonrpc_send_bool_response(request, true);
}
SPDK_RPC_REGISTER("compressdev_scan_accel_module", rpc_compressdev_scan_accel_module,
SPDK_RPC_STARTUP)