drivers/net/ethernet/hisilicon/hns/hns_dsaf_rcb.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/hisilicon/hns/hns_dsaf_rcb.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/hisilicon/hns/hns_dsaf_rcb.c- Extension
.c- Size
- 31983 bytes
- Lines
- 1082
- 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.
- 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/cdev.hlinux/module.hlinux/kernel.hlinux/init.hlinux/netdevice.hlinux/etherdevice.hasm/cacheflush.hlinux/platform_device.hlinux/spinlock.hhns_dsaf_main.hhns_dsaf_ppe.hhns_dsaf_rcb.h
Detected Declarations
function Copyrightfunction hns_rcb_wait_tx_ring_cleanfunction hns_rcb_reset_ring_hwfunction hns_rcb_int_ctrl_hwfunction hns_rcb_int_clr_hwfunction hns_rcbv2_int_ctrl_hwfunction hns_rcbv2_int_clr_hwfunction hns_rcb_ring_enable_hwfunction hns_rcb_common_init_commit_hwfunction hns_rcb_set_tx_ring_bsfunction hns_rcb_set_rx_ring_bsfunction hns_rcb_ring_initfunction hns_rcb_init_hwfunction hns_rcb_set_port_desc_cntfunction hns_rcb_set_port_timeoutfunction hns_rcb_common_get_port_numfunction hns_rcb_comm_exc_irq_enfunction hns_rcb_common_init_hwfunction hns_rcb_buf_size2typefunction hns_rcb_ring_get_cfgfunction hns_rcb_ring_pair_get_cfgfunction hns_rcb_get_port_in_commfunction hns_rcb_get_base_irq_idxfunction hns_rcb_get_cfgfunction hns_rcb_get_rx_coalesced_framesfunction hns_rcb_get_tx_coalesced_framesfunction hns_rcb_get_coalesce_usecsfunction hns_rcb_set_coalesce_usecsfunction hns_rcb_set_tx_coalesced_framesfunction hns_rcb_set_rx_coalesced_framesfunction hns_rcb_get_queue_modefunction hns_rcb_get_ring_numfunction hns_rcb_common_get_paddrfunction hns_rcb_common_get_cfgfunction hns_rcb_common_free_cfgfunction hns_rcb_update_statsfunction hns_rcb_get_statsfunction hns_rcb_get_ring_sset_countfunction hns_rcb_get_common_regs_countfunction hns_rcb_get_ring_regs_countfunction hns_rcb_get_stringsfunction hns_rcb_get_common_regsfunction hns_rcb_get_ring_regs
Annotated Snippet
while (!could_ret && (wait_cnt < RCB_RESET_WAIT_TIMES)) {
dsaf_write_dev(q, RCB_RING_T0_BE_RST, 0);
dsaf_write_dev(q, RCB_RING_T0_BE_RST, 1);
msleep(20);
could_ret = dsaf_read_dev(q, RCB_RING_COULD_BE_RST);
wait_cnt++;
}
dsaf_write_dev(q, RCB_RING_T0_BE_RST, 0);
if (could_ret)
break;
}
if (try_cnt >= RCB_RESET_TRY_TIMES)
dev_err(q->dev->dev, "port%d reset ring fail\n",
hns_ae_get_vf_cb(q->handle)->port_index);
}
/**
*hns_rcb_int_ctrl_hw - rcb irq enable control
*@q: hnae queue struct pointer
*@flag:ring flag tx or rx
*@mask:mask
*/
void hns_rcb_int_ctrl_hw(struct hnae_queue *q, u32 flag, u32 mask)
{
u32 int_mask_en = !!mask;
if (flag & RCB_INT_FLAG_TX) {
dsaf_write_dev(q, RCB_RING_INTMSK_TXWL_REG, int_mask_en);
dsaf_write_dev(q, RCB_RING_INTMSK_TX_OVERTIME_REG,
int_mask_en);
}
if (flag & RCB_INT_FLAG_RX) {
dsaf_write_dev(q, RCB_RING_INTMSK_RXWL_REG, int_mask_en);
dsaf_write_dev(q, RCB_RING_INTMSK_RX_OVERTIME_REG,
int_mask_en);
}
}
void hns_rcb_int_clr_hw(struct hnae_queue *q, u32 flag)
{
if (flag & RCB_INT_FLAG_TX) {
dsaf_write_dev(q, RCB_RING_INTSTS_TX_RING_REG, 1);
dsaf_write_dev(q, RCB_RING_INTSTS_TX_OVERTIME_REG, 1);
}
if (flag & RCB_INT_FLAG_RX) {
dsaf_write_dev(q, RCB_RING_INTSTS_RX_RING_REG, 1);
dsaf_write_dev(q, RCB_RING_INTSTS_RX_OVERTIME_REG, 1);
}
}
void hns_rcbv2_int_ctrl_hw(struct hnae_queue *q, u32 flag, u32 mask)
{
u32 int_mask_en = !!mask;
if (flag & RCB_INT_FLAG_TX)
dsaf_write_dev(q, RCB_RING_INTMSK_TXWL_REG, int_mask_en);
if (flag & RCB_INT_FLAG_RX)
dsaf_write_dev(q, RCB_RING_INTMSK_RXWL_REG, int_mask_en);
}
void hns_rcbv2_int_clr_hw(struct hnae_queue *q, u32 flag)
{
if (flag & RCB_INT_FLAG_TX)
dsaf_write_dev(q, RCBV2_TX_RING_INT_STS_REG, 1);
if (flag & RCB_INT_FLAG_RX)
dsaf_write_dev(q, RCBV2_RX_RING_INT_STS_REG, 1);
}
/**
*hns_rcb_ring_enable_hw - enable ring
*@q: rcb ring
*@val: value to write
*/
void hns_rcb_ring_enable_hw(struct hnae_queue *q, u32 val)
{
dsaf_write_dev(q, RCB_RING_PREFETCH_EN_REG, !!val);
}
/**
*hns_rcb_common_init_commit_hw - make rcb common init completed
Annotation
- Immediate include surface: `linux/cdev.h`, `linux/module.h`, `linux/kernel.h`, `linux/init.h`, `linux/netdevice.h`, `linux/etherdevice.h`, `asm/cacheflush.h`, `linux/platform_device.h`.
- Detected declarations: `function Copyright`, `function hns_rcb_wait_tx_ring_clean`, `function hns_rcb_reset_ring_hw`, `function hns_rcb_int_ctrl_hw`, `function hns_rcb_int_clr_hw`, `function hns_rcbv2_int_ctrl_hw`, `function hns_rcbv2_int_clr_hw`, `function hns_rcb_ring_enable_hw`, `function hns_rcb_common_init_commit_hw`, `function hns_rcb_set_tx_ring_bs`.
- 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.