summaryrefslogtreecommitdiff
path: root/drivers/crypto/intel/qat/qat_common/adf_rl.c
diff options
context:
space:
mode:
authorCiunas Bennett <ciunas.bennett@intel.com>2023-10-20 15:49:29 +0200
committerHerbert Xu <herbert@gondor.apana.org.au>2023-10-27 18:04:28 +0800
commitdb74e16258198094701f18ab4da3410c44ffdb2e (patch)
treead003570a6d14145768f5e0ed95a755df6d25ff1 /drivers/crypto/intel/qat/qat_common/adf_rl.c
parentd9fb8408376e70a903d06ac86e42e0d0f44a5785 (diff)
downloadlinux-db74e16258198094701f18ab4da3410c44ffdb2e.tar.gz
linux-db74e16258198094701f18ab4da3410c44ffdb2e.tar.bz2
linux-db74e16258198094701f18ab4da3410c44ffdb2e.zip
crypto: qat - add rate limiting sysfs interface
Add an interface for the rate limiting feature which allows to add, remove and modify a QAT SLA (Service Level Agreement). This adds a new sysfs attribute group, `qat_rl`, which can be accessed from /sys/bus/pci/devices/<BUS:DEV:FUNCTION> with the following hierarchy: |-+ qat_rl |---- id (RW) # SLA identifier |---- cir (RW) # Committed Information Rate |---- pir (RW) # Peak Information Rate |---- srv (RW) # Service to be rate limited |---- rp (RW) (HEX) # Ring pairs to be rate limited |---- cap_rem (RW) # Remaining capability for a service |---- sla_op (WO) # Allows to perform an operation on an SLA The API works by setting the appropriate RW attributes and then issuing a command through the `sla_op`. For example, to create an SLA, a user needs to input the necessary data into the attributes cir, pir, srv and rp and then write into `sla_op` the command `add` to execute the operation. The API also provides `cap_rem` attribute to get information about the remaining device capability within a certain service which is required when setting an SLA. Signed-off-by: Ciunas Bennett <ciunas.bennett@intel.com> Reviewed-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com> Reviewed-by: Damian Muszynski <damian.muszynski@intel.com> Reviewed-by: Tero Kristo <tero.kristo@linux.intel.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'drivers/crypto/intel/qat/qat_common/adf_rl.c')
-rw-r--r--drivers/crypto/intel/qat/qat_common/adf_rl.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/crypto/intel/qat/qat_common/adf_rl.c b/drivers/crypto/intel/qat/qat_common/adf_rl.c
index 88a03105b52a..86e3e2152b1b 100644
--- a/drivers/crypto/intel/qat/qat_common/adf_rl.c
+++ b/drivers/crypto/intel/qat/qat_common/adf_rl.c
@@ -16,6 +16,7 @@
#include "adf_common_drv.h"
#include "adf_rl_admin.h"
#include "adf_rl.h"
+#include "adf_sysfs_rl.h"
#define RL_TOKEN_GRANULARITY_PCIEIN_BUCKET 0U
#define RL_TOKEN_GRANULARITY_PCIEOUT_BUCKET 0U
@@ -1130,8 +1131,16 @@ int adf_rl_start(struct adf_accel_dev *accel_dev)
goto ret_sla_rm;
}
+ ret = adf_sysfs_rl_add(accel_dev);
+ if (ret) {
+ dev_err(&GET_DEV(accel_dev), "failed to add sysfs interface\n");
+ goto ret_sysfs_rm;
+ }
+
return 0;
+ret_sysfs_rm:
+ adf_sysfs_rl_rm(accel_dev);
ret_sla_rm:
adf_rl_remove_sla_all(accel_dev, true);
ret_free:
@@ -1146,6 +1155,7 @@ void adf_rl_stop(struct adf_accel_dev *accel_dev)
if (!accel_dev->rate_limiting)
return;
+ adf_sysfs_rl_rm(accel_dev);
adf_rl_remove_sla_all(accel_dev, true);
}