MCPcopy Create free account
hub / github.com/F-Stack/f-stack / _iflib_irq_alloc

Function _iflib_irq_alloc

freebsd/net/iflib.c:1597–1632  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1595}
1596
1597static int
1598_iflib_irq_alloc(if_ctx_t ctx, if_irq_t irq, int rid,
1599 driver_filter_t filter, driver_intr_t handler, void *arg,
1600 const char *name)
1601{
1602 struct resource *res;
1603 void *tag = NULL;
1604 device_t dev = ctx->ifc_dev;
1605 int flags, i, rc;
1606
1607 flags = RF_ACTIVE;
1608 if (ctx->ifc_flags & IFC_LEGACY)
1609 flags |= RF_SHAREABLE;
1610 MPASS(rid < 512);
1611 i = rid;
1612 res = bus_alloc_resource_any(dev, SYS_RES_IRQ, &i, flags);
1613 if (res == NULL) {
1614 device_printf(dev,
1615 "failed to allocate IRQ for rid %d, name %s.\n", rid, name);
1616 return (ENOMEM);
1617 }
1618 irq->ii_res = res;
1619 KASSERT(filter == NULL || handler == NULL, ("filter and handler can't both be non-NULL"));
1620 rc = bus_setup_intr(dev, res, INTR_MPSAFE | INTR_TYPE_NET,
1621 filter, handler, arg, &tag);
1622 if (rc != 0) {
1623 device_printf(dev,
1624 "failed to setup interrupt for rid %d, name %s: %d\n",
1625 rid, name ? name : "unknown", rc);
1626 return (rc);
1627 } else if (name)
1628 bus_describe_intr(dev, res, tag, "%s", name);
1629
1630 irq->ii_tag = tag;
1631 return (0);
1632}
1633
1634/*********************************************************************
1635 *

Callers 3

iflib_irq_allocFunction · 0.85
iflib_irq_alloc_genericFunction · 0.85
iflib_legacy_setupFunction · 0.85

Calls 4

bus_alloc_resource_anyFunction · 0.85
device_printfFunction · 0.85
bus_setup_intrFunction · 0.85
bus_describe_intrFunction · 0.85

Tested by

no test coverage detected