drivers/infiniband/hw/usnic/usnic_ib_main.c
Source file repositories/reference/linux-study-clean/drivers/infiniband/hw/usnic/usnic_ib_main.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/infiniband/hw/usnic/usnic_ib_main.c- Extension
.c- Size
- 20076 bytes
- Lines
- 726
- Domain
- Driver Families
- Bucket
- drivers/infiniband
- Inferred role
- Driver Families: operation-table or driver-model contract
- Status
- pattern 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 an operation table; this is where Linux turns generic core objects into subsystem-specific behavior.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- 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/module.hlinux/inetdevice.hlinux/init.hlinux/slab.hlinux/errno.hlinux/pci.hlinux/netdevice.hrdma/ib_user_verbs.hrdma/ib_addr.husnic_abi.husnic_common_util.husnic_ib.husnic_ib_qp_grp.husnic_log.husnic_fwd.husnic_debugfs.husnic_ib_verbs.husnic_transport.husnic_uiom.husnic_ib_sysfs.h
Detected Declarations
function usnic_ib_dump_vf_hdrfunction usnic_ib_dump_vffunction usnic_ib_log_vffunction usnic_ib_qp_grp_modify_active_to_errfunction list_for_each_entryfunction usnic_ib_handle_usdev_eventfunction usnic_ib_handle_port_eventfunction usnic_ib_netdevice_eventfunction usnic_ib_handle_inet_eventfunction usnic_ib_inetaddr_eventfunction usnic_port_immutablefunction usnic_get_dev_fw_strfunction usnic_ib_device_removefunction usnic_ib_undiscover_pffunction usnic_ib_pci_probefunction settingsfunction usnic_ib_pci_removefunction usnic_ib_initfunction usnic_ib_destroymodule init usnic_ib_init
Annotated Snippet
static struct pci_driver usnic_ib_pci_driver = {
.name = DRV_NAME,
.id_table = usnic_ib_pci_ids,
.probe = usnic_ib_pci_probe,
.remove = usnic_ib_pci_remove,
};
/* End of PCI section */
/* Start of module section */
static int __init usnic_ib_init(void)
{
int err;
printk_once(KERN_INFO "%s", usnic_version);
err = pci_register_driver(&usnic_ib_pci_driver);
if (err) {
usnic_err("Unable to register with PCI\n");
goto out_umem_fini;
}
err = register_netdevice_notifier(&usnic_ib_netdevice_notifier);
if (err) {
usnic_err("Failed to register netdev notifier\n");
goto out_pci_unreg;
}
err = register_inetaddr_notifier(&usnic_ib_inetaddr_notifier);
if (err) {
usnic_err("Failed to register inet addr notifier\n");
goto out_unreg_netdev_notifier;
}
err = usnic_transport_init();
if (err) {
usnic_err("Failed to initialize transport\n");
goto out_unreg_inetaddr_notifier;
}
usnic_debugfs_init();
return 0;
out_unreg_inetaddr_notifier:
unregister_inetaddr_notifier(&usnic_ib_inetaddr_notifier);
out_unreg_netdev_notifier:
unregister_netdevice_notifier(&usnic_ib_netdevice_notifier);
out_pci_unreg:
pci_unregister_driver(&usnic_ib_pci_driver);
out_umem_fini:
return err;
}
static void __exit usnic_ib_destroy(void)
{
usnic_dbg("\n");
usnic_debugfs_exit();
usnic_transport_fini();
unregister_inetaddr_notifier(&usnic_ib_inetaddr_notifier);
unregister_netdevice_notifier(&usnic_ib_netdevice_notifier);
pci_unregister_driver(&usnic_ib_pci_driver);
}
MODULE_DESCRIPTION("Cisco VIC (usNIC) Verbs Driver");
MODULE_AUTHOR("Upinder Malhi <umalhi@cisco.com>");
MODULE_LICENSE("Dual BSD/GPL");
module_param(usnic_log_lvl, uint, S_IRUGO | S_IWUSR);
module_param(usnic_ib_share_vf, uint, S_IRUGO | S_IWUSR);
MODULE_PARM_DESC(usnic_log_lvl, " Off=0, Err=1, Info=2, Debug=3");
MODULE_PARM_DESC(usnic_ib_share_vf, "Off=0, On=1 VF sharing amongst QPs");
MODULE_DEVICE_TABLE(pci, usnic_ib_pci_ids);
module_init(usnic_ib_init);
module_exit(usnic_ib_destroy);
/* End of module section */
Annotation
- Immediate include surface: `linux/module.h`, `linux/inetdevice.h`, `linux/init.h`, `linux/slab.h`, `linux/errno.h`, `linux/pci.h`, `linux/netdevice.h`, `rdma/ib_user_verbs.h`.
- Detected declarations: `function usnic_ib_dump_vf_hdr`, `function usnic_ib_dump_vf`, `function usnic_ib_log_vf`, `function usnic_ib_qp_grp_modify_active_to_err`, `function list_for_each_entry`, `function usnic_ib_handle_usdev_event`, `function usnic_ib_handle_port_event`, `function usnic_ib_netdevice_event`, `function usnic_ib_handle_inet_event`, `function usnic_ib_inetaddr_event`.
- Atlas domain: Driver Families / drivers/infiniband.
- Implementation status: pattern implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.