Commit 865b50fe authored by Lucas Segarra Fernandez's avatar Lucas Segarra Fernandez Committed by Herbert Xu
Browse files

crypto: qat - add fw_counters debugfs file



Expose FW counters statistics by providing the "fw_counters" file
under debugfs. Currently the statistics include the number of
requests sent to the FW and the number of responses received
from the FW for each Acceleration Engine, for all the QAT product
line.

This patch is based on earlier work done by Marco Chiappero.

Co-developed-by: default avatarAdam Guerin <adam.guerin@intel.com>
Signed-off-by: default avatarAdam Guerin <adam.guerin@intel.com>
Signed-off-by: default avatarLucas Segarra Fernandez <lucas.segarra.fernandez@intel.com>
Reviewed-by: default avatarGiovanni Cabiddu <giovanni.cabiddu@intel.com>
Reviewed-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent 20508b75
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
What:		/sys/kernel/debug/qat_<device>_<BDF>/qat/fw_counters
Date:		November 2023
KernelVersion:	6.6
Contact:	qat-linux@intel.com
Description:	(RO) Read returns the number of requests sent to the FW and the number of responses
		received from the FW for each Acceleration Engine
		Reported firmware counters::

			<N>: Number of requests sent from Acceleration Engine N to FW and responses
			     Acceleration Engine N received from FW
+1 −0
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@ intel_qat-objs := adf_cfg.o \
	qat_bl.o

intel_qat-$(CONFIG_DEBUG_FS) += adf_transport_debug.o \
				adf_fw_counters.o \
				adf_dbgfs.o

intel_qat-$(CONFIG_PCI_IOV) += adf_sriov.o adf_vf_isr.o adf_pfvf_utils.o \
+1 −0
Original line number Diff line number Diff line
@@ -292,6 +292,7 @@ struct adf_accel_dev {
	unsigned long status;
	atomic_t ref_count;
	struct dentry *debugfs_dir;
	struct dentry *fw_cntr_dbgfile;
	struct list_head list;
	struct module *owner;
	struct adf_accel_pci accel_pci_dev;
+18 −0
Original line number Diff line number Diff line
@@ -223,6 +223,24 @@ static int adf_get_dc_capabilities(struct adf_accel_dev *accel_dev,
	return 0;
}

int adf_get_ae_fw_counters(struct adf_accel_dev *accel_dev, u16 ae, u64 *reqs, u64 *resps)
{
	struct icp_qat_fw_init_admin_resp resp = { };
	struct icp_qat_fw_init_admin_req req = { };
	int ret;

	req.cmd_id = ICP_QAT_FW_COUNTERS_GET;

	ret = adf_put_admin_msg_sync(accel_dev, ae, &req, &resp);
	if (ret || resp.status)
		return -EFAULT;

	*reqs = resp.req_rec_count;
	*resps = resp.resp_sent_count;

	return 0;
}

/**
 * adf_send_admin_init() - Function sends init message to FW
 * @accel_dev: Pointer to acceleration device.
+1 −0
Original line number Diff line number Diff line
@@ -94,6 +94,7 @@ void adf_exit_aer(void);
int adf_init_admin_comms(struct adf_accel_dev *accel_dev);
void adf_exit_admin_comms(struct adf_accel_dev *accel_dev);
int adf_send_admin_init(struct adf_accel_dev *accel_dev);
int adf_get_ae_fw_counters(struct adf_accel_dev *accel_dev, u16 ae, u64 *reqs, u64 *resps);
int adf_init_admin_pm(struct adf_accel_dev *accel_dev, u32 idle_delay);
int adf_init_arb(struct adf_accel_dev *accel_dev);
void adf_exit_arb(struct adf_accel_dev *accel_dev);
Loading