LCOV - code coverage report
Current view: top level - module/accel/dpdk_compressdev - accel_dpdk_compressdev_rpc.c (source / functions) Hit Total Coverage
Test: ut_cov_unit.info Lines: 0 19 0.0 %
Date: 2024-12-16 09:12:13 Functions: 0 2 0.0 %

          Line data    Source code
       1             : /*   SPDX-License-Identifier: BSD-3-Clause
       2             :  *   Copyright (C) 2022 Intel Corporation.
       3             :  *   All rights reserved.
       4             :  */
       5             : 
       6             : #include "accel_dpdk_compressdev.h"
       7             : #include "spdk/rpc.h"
       8             : #include "spdk/util.h"
       9             : #include "spdk/string.h"
      10             : #include "spdk/log.h"
      11             : 
      12             : struct rpc_compressdev_scan_accel_module {
      13             :         uint32_t pmd;
      14             : };
      15             : 
      16             : static const struct spdk_json_object_decoder rpc_compressdev_scan_accel_module_decoder[] = {
      17             :         {"pmd", offsetof(struct rpc_compressdev_scan_accel_module, pmd), spdk_json_decode_uint32},
      18             : };
      19             : 
      20             : static void
      21           0 : rpc_compressdev_scan_accel_module(struct spdk_jsonrpc_request *request,
      22             :                                   const struct spdk_json_val *params)
      23             : {
      24           0 :         struct rpc_compressdev_scan_accel_module req;
      25           0 :         int rc = 0;
      26             : 
      27           0 :         if (spdk_json_decode_object(params, rpc_compressdev_scan_accel_module_decoder,
      28             :                                     SPDK_COUNTOF(rpc_compressdev_scan_accel_module_decoder),
      29             :                                     &req)) {
      30           0 :                 SPDK_ERRLOG("spdk_json_decode_object failed\n");
      31           0 :                 spdk_jsonrpc_send_error_response(request, SPDK_JSONRPC_ERROR_PARSE_ERROR,
      32             :                                                  "spdk_json_decode_object failed");
      33           0 :                 return;
      34             :         }
      35             : 
      36           0 :         if (req.pmd >= COMPRESS_PMD_MAX) {
      37           0 :                 spdk_jsonrpc_send_error_response_fmt(request, -EINVAL,
      38           0 :                                                      "PMD value %d should be less than %d", req.pmd, COMPRESS_PMD_MAX);
      39           0 :                 return;
      40             :         }
      41             : 
      42           0 :         rc = accel_compressdev_enable_probe(&req.pmd);
      43           0 :         if (rc) {
      44           0 :                 spdk_jsonrpc_send_error_response(request, rc, spdk_strerror(-rc));
      45           0 :                 return;
      46             :         }
      47             : 
      48           0 :         accel_dpdk_compressdev_enable();
      49           0 :         spdk_jsonrpc_send_bool_response(request, true);
      50           0 : }
      51           0 : SPDK_RPC_REGISTER("compressdev_scan_accel_module", rpc_compressdev_scan_accel_module,
      52             :                   SPDK_RPC_STARTUP)

Generated by: LCOV version 1.15