drivers/infiniband/core/multicast.c
Source file repositories/reference/linux-study-clean/drivers/infiniband/core/multicast.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/infiniband/core/multicast.c- Extension
.c- Size
- 24022 bytes
- Lines
- 906
- Domain
- Driver Families
- Bucket
- drivers/infiniband
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- 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/completion.hlinux/dma-mapping.hlinux/err.hlinux/interrupt.hlinux/export.hlinux/slab.hlinux/bitops.hlinux/random.hrdma/ib_cache.hsa.h
Detected Declarations
struct mcast_devicestruct mcast_portstruct mcast_devicestruct mcast_memberstruct mcast_groupstruct mcast_memberenum mcast_stateenum mcast_group_statefunction deref_portfunction release_groupfunction deref_memberfunction queue_joinfunction adjust_membershipfunction get_leave_statefunction check_selectorfunction cmp_recfunction send_joinfunction send_leavefunction join_groupfunction fail_joinfunction process_group_errorfunction mcast_work_handlerfunction process_join_errorfunction join_handlerfunction leave_handlerfunction ib_sa_join_multicastfunction ib_sa_free_multicastfunction ib_sa_get_mcmember_recfunction ib_init_ah_from_mcmemberfunction mcast_groups_eventfunction mcast_event_handlerfunction mcast_add_onefunction mcast_remove_onefunction mcast_initfunction mcast_cleanupexport ib_sa_join_multicastexport ib_sa_free_multicastexport ib_sa_get_mcmember_recexport ib_init_ah_from_mcmember
Annotated Snippet
struct mcast_port {
struct mcast_device *dev;
spinlock_t lock;
struct rb_root table;
refcount_t refcount;
struct completion comp;
u32 port_num;
};
struct mcast_device {
struct ib_device *device;
struct ib_event_handler event_handler;
int start_port;
int end_port;
struct mcast_port port[];
};
enum mcast_state {
MCAST_JOINING,
MCAST_MEMBER,
MCAST_ERROR,
};
enum mcast_group_state {
MCAST_IDLE,
MCAST_BUSY,
MCAST_GROUP_ERROR,
MCAST_PKEY_EVENT
};
enum {
MCAST_INVALID_PKEY_INDEX = 0xFFFF
};
struct mcast_member;
struct mcast_group {
struct ib_sa_mcmember_rec rec;
struct rb_node node;
struct mcast_port *port;
spinlock_t lock;
struct work_struct work;
struct list_head pending_list;
struct list_head active_list;
struct mcast_member *last_join;
int members[NUM_JOIN_MEMBERSHIP_TYPES];
atomic_t refcount;
enum mcast_group_state state;
struct ib_sa_query *query;
u16 pkey_index;
u8 leave_state;
int retries;
};
struct mcast_member {
struct ib_sa_multicast multicast;
struct ib_sa_client *client;
struct mcast_group *group;
struct list_head list;
enum mcast_state state;
refcount_t refcount;
struct completion comp;
};
static void join_handler(int status, struct ib_sa_mcmember_rec *rec,
void *context);
static void leave_handler(int status, struct ib_sa_mcmember_rec *rec,
void *context);
static struct mcast_group *mcast_find(struct mcast_port *port,
union ib_gid *mgid)
{
struct rb_node *node = port->table.rb_node;
struct mcast_group *group;
int ret;
while (node) {
group = rb_entry(node, struct mcast_group, node);
ret = memcmp(mgid->raw, group->rec.mgid.raw, sizeof *mgid);
if (!ret)
return group;
if (ret < 0)
node = node->rb_left;
else
node = node->rb_right;
}
return NULL;
}
Annotation
- Immediate include surface: `linux/completion.h`, `linux/dma-mapping.h`, `linux/err.h`, `linux/interrupt.h`, `linux/export.h`, `linux/slab.h`, `linux/bitops.h`, `linux/random.h`.
- Detected declarations: `struct mcast_device`, `struct mcast_port`, `struct mcast_device`, `struct mcast_member`, `struct mcast_group`, `struct mcast_member`, `enum mcast_state`, `enum mcast_group_state`, `function deref_port`, `function release_group`.
- Atlas domain: Driver Families / drivers/infiniband.
- Implementation status: integration 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.