mirror of
https://github.com/torvalds/linux.git
synced 2026-04-26 02:22:28 -04:00
The service parsing logic is used to parse the configuration string provided by the user using the attribute qat/cfg_services in sysfs. The logic relies on hard-coded strings. For example, the service "sym;asym" is also replicated as "asym;sym". This makes the addition of new services or service combinations complex as it requires the addition of new hard-coded strings for all possible combinations. This commit addresses this issue by: * reducing the number of internal service strings to only the basic service representations. * modifying the service parsing logic to analyze the service string token by token instead of comparing a whole string with patterns. * introducing the concept of a service mask where each service is represented by a single bit. * dividing the parsing logic into several functions to allow for code reuse (e.g. by sysfs-related functions). * introducing a new, device generation-specific function to verify whether the requested service combination is supported by the currently used device. Signed-off-by: Małgorzata Mielnik <malgorzata.mielnik@intel.com> Co-developed-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com> Signed-off-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
37 lines
694 B
C
37 lines
694 B
C
/* SPDX-License-Identifier: GPL-2.0-only */
|
|
/* Copyright(c) 2023 Intel Corporation */
|
|
#ifndef _ADF_CFG_SERVICES_H_
|
|
#define _ADF_CFG_SERVICES_H_
|
|
|
|
#include "adf_cfg_strings.h"
|
|
|
|
struct adf_accel_dev;
|
|
|
|
enum adf_services {
|
|
SVC_ASYM = 0,
|
|
SVC_SYM,
|
|
SVC_DC,
|
|
SVC_DCC,
|
|
SVC_BASE_COUNT
|
|
};
|
|
|
|
enum adf_composed_services {
|
|
SVC_SYM_ASYM = SVC_BASE_COUNT,
|
|
SVC_SYM_DC,
|
|
SVC_ASYM_DC,
|
|
};
|
|
|
|
enum {
|
|
ADF_ONE_SERVICE = 1,
|
|
ADF_TWO_SERVICES,
|
|
ADF_THREE_SERVICES,
|
|
};
|
|
|
|
#define MAX_NUM_CONCURR_SVC ADF_THREE_SERVICES
|
|
|
|
int adf_parse_service_string(struct adf_accel_dev *accel_dev, const char *in,
|
|
size_t in_len, char *out, size_t out_len);
|
|
int adf_get_service_enabled(struct adf_accel_dev *accel_dev);
|
|
|
|
#endif
|