include/linux/ntb.h
Source file repositories/reference/linux-study-clean/include/linux/ntb.h
File Facts
- System
- Linux kernel
- Corpus path
include/linux/ntb.h- Extension
.h- Size
- 53965 bytes
- Lines
- 1714
- Domain
- Core OS
- Bucket
- Core Kernel Interface
- Inferred role
- Core OS: operation-table or driver-model contract
- Status
- pattern implementation candidate
Why This File Exists
Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Defines an operation table; this is where Linux turns generic core objects into subsystem-specific behavior.
- 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/completion.hlinux/device.hlinux/interrupt.h
Detected Declarations
struct ntb_clientstruct ntb_devstruct ntb_msistruct pci_devstruct ntb_client_opsstruct ntb_ctx_opsstruct ntb_dev_opsstruct ntb_clientstruct ntb_devstruct ntb_msi_descenum ntb_topoenum ntb_speedenum ntb_widthenum ntb_default_portfunction ntb_topo_is_b2bfunction ntb_client_ops_is_validfunction ntb_ctx_ops_is_validfunction ntb_dev_ops_is_validfunction ntb_port_numberfunction ntb_peer_port_countfunction ntb_peer_port_numberfunction ntb_logical_port_numberfunction ntb_peer_logical_port_numberfunction ntb_peer_port_idxfunction ntb_link_is_upfunction ntb_link_enablefunction ntb_link_disablefunction ntb_mw_countfunction ntb_mw_get_alignfunction ntb_mw_set_transfunction ntb_mw_clear_transfunction ntb_peer_mw_countfunction ntb_peer_mw_get_addrfunction ntb_peer_mw_set_transfunction ntb_peer_mw_clear_transfunction ntb_db_is_unsafefunction ntb_db_valid_maskfunction ntb_db_vector_countfunction ntb_db_vector_maskfunction ntb_db_readfunction ntb_db_setfunction ntb_db_clearfunction ntb_db_read_maskfunction ntb_db_set_maskfunction ntb_db_clear_maskfunction ntb_peer_db_addrfunction ntb_peer_db_readfunction ntb_peer_db_set
Annotated Snippet
struct device_driver drv;
const struct ntb_client_ops ops;
};
#define drv_ntb_client(__drv) container_of((__drv), struct ntb_client, drv)
/**
* struct ntb_dev - ntb device
* @dev: Linux device object.
* @pdev: PCI device entry of the ntb.
* @topo: Detected topology of the ntb.
* @ops: See &ntb_dev_ops.
* @ctx: See &ntb_ctx_ops.
* @ctx_ops: See &ntb_ctx_ops.
*/
struct ntb_dev {
struct device dev;
struct pci_dev *pdev;
enum ntb_topo topo;
const struct ntb_dev_ops *ops;
void *ctx;
const struct ntb_ctx_ops *ctx_ops;
/* private: */
/* synchronize setting, clearing, and calling ctx_ops */
spinlock_t ctx_lock;
/* block unregister until device is fully released */
struct completion released;
#ifdef CONFIG_NTB_MSI
struct ntb_msi *msi;
#endif
};
#define dev_ntb(__dev) container_of((__dev), struct ntb_dev, dev)
/**
* ntb_register_client() - register a client for interest in ntb devices
* @client: Client context.
*
* The client will be added to the list of clients interested in ntb devices.
* The client will be notified of any ntb devices that are not already
* associated with a client, or if ntb devices are registered later.
*
* Return: Zero if the client is registered, otherwise an error number.
*/
#define ntb_register_client(client) \
__ntb_register_client((client), THIS_MODULE, KBUILD_MODNAME)
int __ntb_register_client(struct ntb_client *client, struct module *mod,
const char *mod_name);
/**
* ntb_unregister_client() - unregister a client for interest in ntb devices
* @client: Client context.
*
* The client will be removed from the list of clients interested in ntb
* devices. If any ntb devices are associated with the client, the client will
* be notified to remove those devices.
*/
void ntb_unregister_client(struct ntb_client *client);
#define module_ntb_client(__ntb_client) \
module_driver(__ntb_client, ntb_register_client, \
ntb_unregister_client)
/**
* ntb_register_device() - register a ntb device
* @ntb: NTB device context.
*
* The device will be added to the list of ntb devices. If any clients are
* interested in ntb devices, each client will be notified of the ntb device,
* until at most one client accepts the device.
*
* Return: Zero if the device is registered, otherwise an error number.
*/
int ntb_register_device(struct ntb_dev *ntb);
/**
* ntb_unregister_device() - unregister a ntb device
* @ntb: NTB device context.
*
* The device will be removed from the list of ntb devices. If the ntb device
* is associated with a client, the client will be notified to remove the
* device.
*/
void ntb_unregister_device(struct ntb_dev *ntb);
/**
* ntb_set_ctx() - associate a driver context with an ntb device
* @ntb: NTB device context.
Annotation
- Immediate include surface: `linux/completion.h`, `linux/device.h`, `linux/interrupt.h`.
- Detected declarations: `struct ntb_client`, `struct ntb_dev`, `struct ntb_msi`, `struct pci_dev`, `struct ntb_client_ops`, `struct ntb_ctx_ops`, `struct ntb_dev_ops`, `struct ntb_client`, `struct ntb_dev`, `struct ntb_msi_desc`.
- Atlas domain: Core OS / Core Kernel Interface.
- Implementation status: pattern 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.