drivers/crypto/intel/qat/qat_common/adf_tl_debugfs.c
Source file repositories/reference/linux-study-clean/drivers/crypto/intel/qat/qat_common/adf_tl_debugfs.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/crypto/intel/qat/qat_common/adf_tl_debugfs.c- Extension
.c- Size
- 19249 bytes
- Lines
- 738
- Domain
- Driver Families
- Bucket
- drivers/crypto
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/atomic.hlinux/debugfs.hlinux/dev_printk.hlinux/dcache.hlinux/file.hlinux/kernel.hlinux/math64.hlinux/mutex.hlinux/seq_file.hlinux/slab.hlinux/units.hadf_accel_devices.hadf_cfg_strings.hadf_telemetry.hadf_tl_debugfs.h
Detected Declarations
function tl_collect_values_u32function tl_collect_values_u64function tl_calc_countfunction tl_cycles_to_nsfunction tl_lat_acc_avgfunction tl_bw_hw_units_to_mbpsfunction tl_seq_printf_counterfunction tl_calc_and_print_counterfunction tl_print_sl_counterfunction tl_calc_and_print_sl_countersfunction tl_print_cmdq_counterfunction tl_calc_and_print_cmdq_countersfunction tl_print_msg_cntfunction tl_print_dev_datafunction tl_dev_data_showfunction tl_control_showfunction tl_control_writefunction adf_tl_dbg_change_rp_indexfunction tl_print_rp_srvfunction tl_print_rp_datafunction tl_rp_data_showfunction tl_rp_data_writefunction adf_tl_dbgfs_addfunction adf_tl_dbgfs_rm
Annotated Snippet
if (_y >= _len - _b) { \
_x++; \
_y -= _len - _b; \
} else { \
_y += _b; \
} \
} \
do_div(_y, _len); \
(_x + _y); \
})
/* Calculation function for simple counter. */
static int tl_calc_count(struct adf_telemetry *telemetry,
const struct adf_tl_dbg_counter *ctr,
struct adf_tl_dbg_aggr_values *vals)
{
struct adf_tl_hw_data *tl_data = &GET_TL_DATA(telemetry->accel_dev);
u64 *hist_vals;
int sample_cnt;
int ret = 0;
hist_vals = kmalloc_array(tl_data->num_hbuff, sizeof(*hist_vals),
GFP_KERNEL);
if (!hist_vals)
return -ENOMEM;
memset(vals, 0, sizeof(*vals));
sample_cnt = tl_collect_values_u32(telemetry, ctr->offset1, hist_vals);
if (!sample_cnt)
goto out_free_hist_vals;
vals->curr = hist_vals[sample_cnt - 1];
vals->min = min_array(hist_vals, sample_cnt);
vals->max = max_array(hist_vals, sample_cnt);
vals->avg = avg_array(hist_vals, sample_cnt);
out_free_hist_vals:
kfree(hist_vals);
return ret;
}
/* Convert CPP bus cycles to ns. */
static int tl_cycles_to_ns(struct adf_telemetry *telemetry,
const struct adf_tl_dbg_counter *ctr,
struct adf_tl_dbg_aggr_values *vals)
{
struct adf_tl_hw_data *tl_data = &GET_TL_DATA(telemetry->accel_dev);
u8 cpp_ns_per_cycle = tl_data->cpp_ns_per_cycle;
int ret;
ret = tl_calc_count(telemetry, ctr, vals);
if (ret)
return ret;
vals->curr *= cpp_ns_per_cycle;
vals->min *= cpp_ns_per_cycle;
vals->max *= cpp_ns_per_cycle;
vals->avg *= cpp_ns_per_cycle;
return 0;
}
/*
* Compute latency cumulative average with division of accumulated value
* by sample count. Returned value is in ns.
*/
static int tl_lat_acc_avg(struct adf_telemetry *telemetry,
const struct adf_tl_dbg_counter *ctr,
struct adf_tl_dbg_aggr_values *vals)
{
struct adf_tl_hw_data *tl_data = &GET_TL_DATA(telemetry->accel_dev);
u8 cpp_ns_per_cycle = tl_data->cpp_ns_per_cycle;
u8 num_hbuff = tl_data->num_hbuff;
int sample_cnt, i;
u64 *hist_vals;
u64 *hist_cnt;
int ret = 0;
hist_vals = kmalloc_array(num_hbuff, sizeof(*hist_vals), GFP_KERNEL);
if (!hist_vals)
return -ENOMEM;
hist_cnt = kmalloc_array(num_hbuff, sizeof(*hist_cnt), GFP_KERNEL);
if (!hist_cnt) {
ret = -ENOMEM;
goto out_free_hist_vals;
}
memset(vals, 0, sizeof(*vals));
sample_cnt = tl_collect_values_u64(telemetry, ctr->offset1, hist_vals);
Annotation
- Immediate include surface: `linux/atomic.h`, `linux/debugfs.h`, `linux/dev_printk.h`, `linux/dcache.h`, `linux/file.h`, `linux/kernel.h`, `linux/math64.h`, `linux/mutex.h`.
- Detected declarations: `function tl_collect_values_u32`, `function tl_collect_values_u64`, `function tl_calc_count`, `function tl_cycles_to_ns`, `function tl_lat_acc_avg`, `function tl_bw_hw_units_to_mbps`, `function tl_seq_printf_counter`, `function tl_calc_and_print_counter`, `function tl_print_sl_counter`, `function tl_calc_and_print_sl_counters`.
- Atlas domain: Driver Families / drivers/crypto.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.