/** * adf_cfg_dev_add() - Create an acceleration device configuration table. * @accel_dev: Pointer to acceleration device. * * Function creates a configuration table for the given acceleration device. * The table stores device specific config values. * To be used by QAT device specific drivers. * * Return: 0 on success, error code otherwise.
*/ int adf_cfg_dev_add(struct adf_accel_dev *accel_dev)
{ struct adf_cfg_device_data *dev_cfg_data;
/** * adf_cfg_dev_remove() - Clears acceleration device configuration table. * @accel_dev: Pointer to acceleration device. * * Function removes configuration table from the given acceleration device * and frees all allocated memory. * To be used by QAT device specific drivers. * * Return: void
*/ void adf_cfg_dev_remove(struct adf_accel_dev *accel_dev)
{ struct adf_cfg_device_data *dev_cfg_data = accel_dev->cfg;
if (sec)
keyval = adf_cfg_key_value_find(sec, key_name); if (keyval) {
memcpy(val, keyval->val, ADF_CFG_MAX_VAL_LEN_IN_BYTES); return 0;
} return -ENODATA;
}
/** * adf_cfg_add_key_value_param() - Add key-value config entry to config table. * @accel_dev: Pointer to acceleration device. * @section_name: Name of the section where the param will be added * @key: The key string * @val: Value pain for the given @key * @type: Type - string, int or address * * Function adds configuration key - value entry in the appropriate section * in the given acceleration device. If the key exists already, the value * is updated. * To be used by QAT device specific drivers. * * Return: 0 on success, error code otherwise.
*/ int adf_cfg_add_key_value_param(struct adf_accel_dev *accel_dev, constchar *section_name, constchar *key, constvoid *val, enum adf_cfg_val_type type)
{ struct adf_cfg_device_data *cfg = accel_dev->cfg; struct adf_cfg_key_val *key_val; struct adf_cfg_section *section = adf_cfg_sec_find(accel_dev,
section_name); char temp_val[ADF_CFG_MAX_VAL_LEN_IN_BYTES];
if (!section) return -EFAULT;
key_val = kzalloc(sizeof(*key_val), GFP_KERNEL); if (!key_val) return -ENOMEM;
/* Add the key-value pair as below policy: * 1. if the key doesn't exist, add it; * 2. if the key already exists with a different value then update it * to the new value (the key is deleted and the newly created * key_val containing the new value is added to the database); * 3. if the key exists with the same value, then return without doing * anything (the newly created key_val is freed).
*/
down_write(&cfg->lock); if (!adf_cfg_key_val_get(accel_dev, section_name, key, temp_val)) { if (strncmp(temp_val, key_val->val, sizeof(temp_val))) {
adf_cfg_keyval_remove(key, section);
} else {
kfree(key_val); goto out;
}
}
/** * adf_cfg_section_add() - Add config section entry to config table. * @accel_dev: Pointer to acceleration device. * @name: Name of the section * * Function adds configuration section where key - value entries * will be stored. * To be used by QAT device specific drivers. * * Return: 0 on success, error code otherwise.
*/ int adf_cfg_section_add(struct adf_accel_dev *accel_dev, constchar *name)
{ struct adf_cfg_device_data *cfg = accel_dev->cfg; struct adf_cfg_section *sec = adf_cfg_sec_find(accel_dev, name);
if (sec) return 0;
sec = kzalloc(sizeof(*sec), GFP_KERNEL); if (!sec) return -ENOMEM;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.