drivers/net/ethernet/huawei/hinic3/hinic3_queue_common.h
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/huawei/hinic3/hinic3_queue_common.h
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/huawei/hinic3/hinic3_queue_common.h- Extension
.h- Size
- 1819 bytes
- Lines
- 55
- 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
linux/types.hhinic3_common.h
Detected Declarations
struct hinic3_hwdevstruct hinic3_queue_pagesfunction page
Annotated Snippet
struct hinic3_queue_pages {
/* Array of DMA-able pages that actually holds the queue entries. */
struct hinic3_dma_addr_align *pages;
/* Page size in bytes. */
u32 page_size;
/* Number of pages, must be power of 2. */
u16 num_pages;
u8 elem_size_shift;
u8 elem_per_pg_shift;
};
void hinic3_queue_pages_init(struct hinic3_queue_pages *qpages, u32 q_depth,
u32 page_size, u32 elem_size);
int hinic3_queue_pages_alloc(struct hinic3_hwdev *hwdev,
struct hinic3_queue_pages *qpages, u32 align);
void hinic3_queue_pages_free(struct hinic3_hwdev *hwdev,
struct hinic3_queue_pages *qpages);
/* Get pointer to queue entry at the specified index. Index does not have to be
* masked to queue depth, only least significant bits will be used. Also
* provides remaining elements in same page (including the first one) in case
* caller needs multiple entries.
*/
static inline void *get_q_element(const struct hinic3_queue_pages *qpages,
u32 idx, u32 *remaining_in_page)
{
const struct hinic3_dma_addr_align *page;
u32 page_idx, elem_idx, elem_per_pg, ofs;
u8 shift;
shift = qpages->elem_per_pg_shift;
page_idx = (idx >> shift) & (qpages->num_pages - 1);
elem_per_pg = 1 << shift;
elem_idx = idx & (elem_per_pg - 1);
if (remaining_in_page)
*remaining_in_page = elem_per_pg - elem_idx;
ofs = elem_idx << qpages->elem_size_shift;
page = qpages->pages + page_idx;
return (char *)page->align_vaddr + ofs;
}
#endif
Annotation
- Immediate include surface: `linux/types.h`, `hinic3_common.h`.
- Detected declarations: `struct hinic3_hwdev`, `struct hinic3_queue_pages`, `function page`.
- 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.