drivers/crypto/intel/qat/qat_common/qat_comp_zstd_utils.c
Source file repositories/reference/linux-study-clean/drivers/crypto/intel/qat/qat_common/qat_comp_zstd_utils.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/crypto/intel/qat/qat_common/qat_comp_zstd_utils.c- Extension
.c- Size
- 4051 bytes
- Lines
- 166
- 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.
Dependency Surface
linux/errno.hlinux/printk.hlinux/string.hlinux/unaligned.hlinux/zstd.hqat_comp_zstd_utils.h
Detected Declarations
function minfunction qat_alg_dec_lz4s
Annotated Snippet
if (length == RUN_MASK) {
unsigned int s;
do {
s = *ip++;
length += s;
} while (s == 255);
}
literal_len = length;
start = ip;
dest = literals;
dest_end = literals + length;
do {
memcpy(dest, start, QAT_ZSTD_LIT_COPY_LEN);
dest += QAT_ZSTD_LIT_COPY_LEN;
start += QAT_ZSTD_LIT_COPY_LEN;
} while (dest < dest_end);
literals += length;
*lit_len += length;
ip += length;
if (ip == end_ip) {
literal_len += hist_literal_len;
/*
* If adding trailing literals would overflow the
* current block, close it first.
*/
if (block_decomp_size + literal_len > QAT_ZSTD_BLOCK_MAX) {
ret = emit_delimiter(out_seqs, &seqs_idx,
out_seqs_capacity,
lz4s_buff_size);
if (ret)
return ret;
}
out_seqs[seqs_idx].litLength = literal_len;
out_seqs[seqs_idx].offset = offset;
out_seqs[seqs_idx].matchLength = match_len;
break;
}
offset = get_unaligned_le16(ip);
ip += 2;
length = token & ML_MASK;
if (length == ML_MASK) {
unsigned int s;
do {
s = *ip++;
length += s;
} while (s == 255);
}
if (length != 0) {
length += LZ4S_MINMATCH;
match_len = (unsigned short)length;
literal_len += hist_literal_len;
/*
* If this sequence would push the current block past
* the ZSTD maximum, close the block first.
*/
if (block_decomp_size + literal_len + match_len > QAT_ZSTD_BLOCK_MAX) {
ret = emit_delimiter(out_seqs, &seqs_idx,
out_seqs_capacity,
lz4s_buff_size);
if (ret)
return ret;
block_decomp_size = 0;
}
out_seqs[seqs_idx].offset = offset;
out_seqs[seqs_idx].litLength = literal_len;
out_seqs[seqs_idx].matchLength = match_len;
hist_literal_len = 0;
seqs_idx++;
if (seqs_idx >= out_seqs_capacity - 1) {
pr_debug("QAT ZSTD: sequence overflow (seqs_idx:%zu, capacity:%zu, lz4s_size:%u)\n",
seqs_idx, out_seqs_capacity, lz4s_buff_size);
return -EOVERFLOW;
}
block_decomp_size += literal_len + match_len;
} else {
if (literal_len > 0) {
/*
Annotation
- Immediate include surface: `linux/errno.h`, `linux/printk.h`, `linux/string.h`, `linux/unaligned.h`, `linux/zstd.h`, `qat_comp_zstd_utils.h`.
- Detected declarations: `function min`, `function qat_alg_dec_lz4s`.
- Atlas domain: Driver Families / drivers/crypto.
- Implementation status: source implementation candidate.
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.