drivers/net/ethernet/hisilicon/hibmcge/hbg_irq.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/hisilicon/hibmcge/hbg_irq.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/hisilicon/hibmcge/hbg_irq.c- Extension
.c- Size
- 4192 bytes
- Lines
- 146
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/interrupt.hhbg_irq.hhbg_hw.h
Detected Declarations
function hbg_irq_handle_errfunction hbg_irq_handle_txfunction hbg_irq_handle_rxfunction hbg_irq_handle_rx_buf_valfunction hbg_irq_handlefunction hbg_irq_init
Annotated Snippet
if (status & info->mask) {
if (!hbg_hw_irq_is_enabled(priv, info->mask))
continue;
hbg_hw_irq_enable(priv, info->mask, false);
hbg_hw_irq_clear(priv, info->mask);
priv->vectors.stats_array[i]++;
if (info->irq_handle)
info->irq_handle(priv, info);
if (info->re_enable)
hbg_hw_irq_enable(priv, info->mask, true);
}
}
return IRQ_HANDLED;
}
static const char *irq_names_map[HBG_VECTOR_NUM] = { "tx", "rx",
"err", "mdio" };
int hbg_irq_init(struct hbg_priv *priv)
{
struct hbg_vector *vectors = &priv->vectors;
struct device *dev = &priv->pdev->dev;
int ret, id;
u32 i;
/* used pcim_enable_device(), so the vectors become device managed */
ret = pci_alloc_irq_vectors(priv->pdev, HBG_VECTOR_NUM, HBG_VECTOR_NUM,
PCI_IRQ_MSI | PCI_IRQ_MSIX);
if (ret < 0)
return dev_err_probe(dev, ret, "failed to allocate vectors\n");
if (ret != HBG_VECTOR_NUM)
return dev_err_probe(dev, -EINVAL,
"requested %u MSI, but allocated %d MSI\n",
HBG_VECTOR_NUM, ret);
/* mdio irq not requested, so the number of requested interrupts
* is HBG_VECTOR_NUM - 1.
*/
for (i = 0; i < HBG_VECTOR_NUM - 1; i++) {
id = pci_irq_vector(priv->pdev, i);
if (id < 0)
return dev_err_probe(dev, id, "failed to get irq id\n");
snprintf(vectors->name[i], sizeof(vectors->name[i]), "%s-%s-%s",
dev_driver_string(dev), pci_name(priv->pdev),
irq_names_map[i]);
ret = devm_request_irq(dev, id, hbg_irq_handle, 0,
vectors->name[i], priv);
if (ret)
return dev_err_probe(dev, ret,
"failed to request irq: %s\n",
irq_names_map[i]);
}
vectors->stats_array = devm_kcalloc(&priv->pdev->dev,
ARRAY_SIZE(hbg_irqs),
sizeof(u64), GFP_KERNEL);
if (!vectors->stats_array)
return -ENOMEM;
vectors->info_array = hbg_irqs;
vectors->info_array_len = ARRAY_SIZE(hbg_irqs);
return 0;
}
Annotation
- Immediate include surface: `linux/interrupt.h`, `hbg_irq.h`, `hbg_hw.h`.
- Detected declarations: `function hbg_irq_handle_err`, `function hbg_irq_handle_tx`, `function hbg_irq_handle_rx`, `function hbg_irq_handle_rx_buf_val`, `function hbg_irq_handle`, `function hbg_irq_init`.
- 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.