drivers/net/ethernet/chelsio/cxgb4/cudbg_common.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/chelsio/cxgb4/cudbg_common.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/chelsio/cxgb4/cudbg_common.c- Extension
.c- Size
- 1389 bytes
- Lines
- 57
- Domain
- Driver Families
- Bucket
- drivers/net
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
cxgb4.hcudbg_if.hcudbg_lib_common.h
Detected Declarations
function Copyrightfunction cudbg_put_bufffunction cudbg_update_buff
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (C) 2017 Chelsio Communications. All rights reserved.
*/
#include "cxgb4.h"
#include "cudbg_if.h"
#include "cudbg_lib_common.h"
int cudbg_get_buff(struct cudbg_init *pdbg_init,
struct cudbg_buffer *pdbg_buff, u32 size,
struct cudbg_buffer *pin_buff)
{
u32 offset;
offset = pdbg_buff->offset;
if (offset + size > pdbg_buff->size)
return CUDBG_STATUS_NO_MEM;
if (pdbg_init->compress_type != CUDBG_COMPRESSION_NONE) {
if (size > pdbg_init->compress_buff_size)
return CUDBG_STATUS_NO_MEM;
pin_buff->data = (char *)pdbg_init->compress_buff;
pin_buff->offset = 0;
pin_buff->size = size;
return 0;
}
pin_buff->data = (char *)pdbg_buff->data + offset;
pin_buff->offset = offset;
pin_buff->size = size;
return 0;
}
void cudbg_put_buff(struct cudbg_init *pdbg_init,
struct cudbg_buffer *pin_buff)
{
/* Clear compression buffer for re-use */
if (pdbg_init->compress_type != CUDBG_COMPRESSION_NONE)
memset(pdbg_init->compress_buff, 0,
pdbg_init->compress_buff_size);
pin_buff->data = NULL;
pin_buff->offset = 0;
pin_buff->size = 0;
}
void cudbg_update_buff(struct cudbg_buffer *pin_buff,
struct cudbg_buffer *pout_buff)
{
/* We already write to buffer provided by ethool, so just
* increment offset to next free space.
*/
pout_buff->offset += pin_buff->size;
}
Annotation
- Immediate include surface: `cxgb4.h`, `cudbg_if.h`, `cudbg_lib_common.h`.
- Detected declarations: `function Copyright`, `function cudbg_put_buff`, `function cudbg_update_buff`.
- Atlas domain: Driver Families / drivers/net.
- 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.