drivers/net/ethernet/huawei/hinic3/hinic3_nic_io.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/huawei/hinic3/hinic3_nic_io.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/huawei/hinic3/hinic3_nic_io.c- Extension
.c- Size
- 24324 bytes
- Lines
- 890
- 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.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- 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
hinic3_cmdq.hhinic3_hw_comm.hhinic3_hw_intf.hhinic3_hwdev.hhinic3_hwif.hhinic3_nic_cfg.hhinic3_nic_dev.hhinic3_nic_io.h
Detected Declarations
struct hinic3_qp_ctxt_hdrstruct hinic3_sq_ctxtstruct hinic3_rq_ctxtstruct hinic3_sq_ctxt_blockstruct hinic3_rq_ctxt_blockstruct hinic3_clean_queue_ctxtenum hinic3_qp_ctxt_typefunction hinic3_init_nic_iofunction hinic3_free_nic_iofunction hinic3_init_nicio_resfunction hinic3_free_nicio_resfunction hinic3_create_sqfunction hinic3_create_rqfunction hinic3_create_qpfunction hinic3_destroy_qpfunction hinic3_alloc_qpsfunction hinic3_free_qpsfunction hinic3_init_qpsfunction hinic3_uninit_qpsfunction hinic3_qp_prepare_cmdq_headerfunction hinic3_sq_prepare_ctxtfunction hinic3_rq_prepare_ctxt_get_wq_infofunction hinic3_rq_prepare_ctxtfunction init_sq_ctxtsfunction init_rq_ctxtsfunction init_qp_ctxtsfunction clean_queue_offload_ctxtfunction clean_qp_offload_ctxtfunction hinic3_init_qp_ctxtsfunction hinic3_free_qp_ctxts
Annotated Snippet
struct hinic3_qp_ctxt_hdr {
__le16 num_queues;
__le16 queue_type;
__le16 start_qid;
__le16 rsvd;
};
struct hinic3_sq_ctxt {
__le32 ci_pi;
__le32 drop_mode_sp;
__le32 wq_pfn_hi_owner;
__le32 wq_pfn_lo;
__le32 rsvd0;
__le32 pkt_drop_thd;
__le32 global_sq_id;
__le32 vlan_ceq_attr;
__le32 pref_cache;
__le32 pref_ci_owner;
__le32 pref_wq_pfn_hi_ci;
__le32 pref_wq_pfn_lo;
__le32 rsvd8;
__le32 rsvd9;
__le32 wq_block_pfn_hi;
__le32 wq_block_pfn_lo;
};
struct hinic3_rq_ctxt {
__le32 ci_pi;
__le32 ceq_attr;
__le32 wq_pfn_hi_type_owner;
__le32 wq_pfn_lo;
__le32 rsvd[3];
__le32 cqe_sge_len;
__le32 pref_cache;
__le32 pref_ci_owner;
__le32 pref_wq_pfn_hi_ci;
__le32 pref_wq_pfn_lo;
__le32 pi_paddr_hi;
__le32 pi_paddr_lo;
__le32 wq_block_pfn_hi;
__le32 wq_block_pfn_lo;
};
struct hinic3_sq_ctxt_block {
struct hinic3_qp_ctxt_hdr cmdq_hdr;
struct hinic3_sq_ctxt sq_ctxt[HINIC3_Q_CTXT_MAX];
};
struct hinic3_rq_ctxt_block {
struct hinic3_qp_ctxt_hdr cmdq_hdr;
struct hinic3_rq_ctxt rq_ctxt[HINIC3_Q_CTXT_MAX];
};
struct hinic3_clean_queue_ctxt {
struct hinic3_qp_ctxt_hdr cmdq_hdr;
__le32 rsvd;
};
#define SQ_CTXT_SIZE(num_sqs) \
(sizeof(struct hinic3_qp_ctxt_hdr) + \
(num_sqs) * sizeof(struct hinic3_sq_ctxt))
#define RQ_CTXT_SIZE(num_rqs) \
(sizeof(struct hinic3_qp_ctxt_hdr) + \
(num_rqs) * sizeof(struct hinic3_rq_ctxt))
#define SQ_CTXT_PREF_CI_HI_SHIFT 12
#define SQ_CTXT_PREF_CI_HI(val) ((val) >> SQ_CTXT_PREF_CI_HI_SHIFT)
#define SQ_CTXT_PI_IDX_MASK GENMASK(15, 0)
#define SQ_CTXT_CI_IDX_MASK GENMASK(31, 16)
#define SQ_CTXT_CI_PI_SET(val, member) \
FIELD_PREP(SQ_CTXT_##member##_MASK, val)
#define SQ_CTXT_MODE_SP_FLAG_MASK BIT(0)
#define SQ_CTXT_MODE_PKT_DROP_MASK BIT(1)
#define SQ_CTXT_MODE_SET(val, member) \
FIELD_PREP(SQ_CTXT_MODE_##member##_MASK, val)
#define SQ_CTXT_WQ_PAGE_HI_PFN_MASK GENMASK(19, 0)
#define SQ_CTXT_WQ_PAGE_OWNER_MASK BIT(23)
#define SQ_CTXT_WQ_PAGE_SET(val, member) \
FIELD_PREP(SQ_CTXT_WQ_PAGE_##member##_MASK, val)
Annotation
- Immediate include surface: `hinic3_cmdq.h`, `hinic3_hw_comm.h`, `hinic3_hw_intf.h`, `hinic3_hwdev.h`, `hinic3_hwif.h`, `hinic3_nic_cfg.h`, `hinic3_nic_dev.h`, `hinic3_nic_io.h`.
- Detected declarations: `struct hinic3_qp_ctxt_hdr`, `struct hinic3_sq_ctxt`, `struct hinic3_rq_ctxt`, `struct hinic3_sq_ctxt_block`, `struct hinic3_rq_ctxt_block`, `struct hinic3_clean_queue_ctxt`, `enum hinic3_qp_ctxt_type`, `function hinic3_init_nic_io`, `function hinic3_free_nic_io`, `function hinic3_init_nicio_res`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: source implementation candidate.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.