drivers/infiniband/hw/cxgb4/device.c
Source file repositories/reference/linux-study-clean/drivers/infiniband/hw/cxgb4/device.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/infiniband/hw/cxgb4/device.c- Extension
.c- Size
- 43539 bytes
- Lines
- 1572
- 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/moduleparam.hlinux/debugfs.hlinux/vmalloc.hlinux/math64.hrdma/ib_verbs.hiw_cxgb4.h
Detected Declarations
struct c4iw_debugfs_datastruct qp_listfunction debugfs_readfunction c4iw_log_wr_statsfunction wr_log_showfunction wr_log_openfunction wr_log_clearfunction set_ep_sin_addrsfunction set_ep_sin6_addrsfunction dump_qpfunction qp_releasefunction qp_openfunction dump_stagfunction stag_releasefunction stag_openfunction stats_showfunction stats_openfunction stats_clearfunction dump_epfunction dump_listen_epfunction ep_releasefunction ep_openfunction setup_debugfsfunction c4iw_release_dev_ucontextfunction list_for_each_safefunction c4iw_init_dev_ucontextfunction c4iw_rdev_openfunction c4iw_rdev_closefunction c4iw_deallocfunction c4iw_removefunction rdma_supportedfunction recv_rx_pktfunction c4iw_uld_rx_handlerfunction c4iw_uld_state_changefunction stop_queuesfunction resume_rc_qpfunction resume_a_chunkfunction resume_queuesfunction deref_qpsfunction recover_lost_dbsfunction recover_queuesfunction c4iw_uld_controlfunction _c4iw_free_wr_waitfunction c4iw_init_modulefunction c4iw_exit_modulemodule init c4iw_init_module
Annotated Snippet
static const struct file_operations wr_log_debugfs_fops = {
.owner = THIS_MODULE,
.open = wr_log_open,
.release = single_release,
.read = seq_read,
.llseek = seq_lseek,
.write = wr_log_clear,
};
static struct sockaddr_in zero_sin = {
.sin_family = AF_INET,
};
static struct sockaddr_in6 zero_sin6 = {
.sin6_family = AF_INET6,
};
static void set_ep_sin_addrs(struct c4iw_ep *ep,
struct sockaddr_in **lsin,
struct sockaddr_in **rsin,
struct sockaddr_in **m_lsin,
struct sockaddr_in **m_rsin)
{
struct iw_cm_id *id = ep->com.cm_id;
*m_lsin = (struct sockaddr_in *)&ep->com.local_addr;
*m_rsin = (struct sockaddr_in *)&ep->com.remote_addr;
if (id) {
*lsin = (struct sockaddr_in *)&id->local_addr;
*rsin = (struct sockaddr_in *)&id->remote_addr;
} else {
*lsin = &zero_sin;
*rsin = &zero_sin;
}
}
static void set_ep_sin6_addrs(struct c4iw_ep *ep,
struct sockaddr_in6 **lsin6,
struct sockaddr_in6 **rsin6,
struct sockaddr_in6 **m_lsin6,
struct sockaddr_in6 **m_rsin6)
{
struct iw_cm_id *id = ep->com.cm_id;
*m_lsin6 = (struct sockaddr_in6 *)&ep->com.local_addr;
*m_rsin6 = (struct sockaddr_in6 *)&ep->com.remote_addr;
if (id) {
*lsin6 = (struct sockaddr_in6 *)&id->local_addr;
*rsin6 = (struct sockaddr_in6 *)&id->remote_addr;
} else {
*lsin6 = &zero_sin6;
*rsin6 = &zero_sin6;
}
}
static int dump_qp(unsigned long id, struct c4iw_qp *qp,
struct c4iw_debugfs_data *qpd)
{
int space;
int cc;
if (id != qp->wq.sq.qid)
return 0;
space = qpd->bufsize - qpd->pos - 1;
if (space == 0)
return 1;
if (qp->ep) {
struct c4iw_ep *ep = qp->ep;
if (ep->com.local_addr.ss_family == AF_INET) {
struct sockaddr_in *lsin;
struct sockaddr_in *rsin;
struct sockaddr_in *m_lsin;
struct sockaddr_in *m_rsin;
set_ep_sin_addrs(ep, &lsin, &rsin, &m_lsin, &m_rsin);
cc = snprintf(qpd->buf + qpd->pos, space,
"rc qp sq id %u %s id %u state %u "
"onchip %u ep tid %u state %u "
"%pI4:%u/%u->%pI4:%u/%u\n",
qp->wq.sq.qid, qp->srq ? "srq" : "rq",
qp->srq ? qp->srq->idx : qp->wq.rq.qid,
(int)qp->attr.state,
qp->wq.sq.flags & T4_SQ_ONCHIP,
ep->hwtid, (int)ep->com.state,
&lsin->sin_addr, ntohs(lsin->sin_port),
ntohs(m_lsin->sin_port),
&rsin->sin_addr, ntohs(rsin->sin_port),
ntohs(m_rsin->sin_port));
Annotation
- Immediate include surface: `linux/module.h`, `linux/moduleparam.h`, `linux/debugfs.h`, `linux/vmalloc.h`, `linux/math64.h`, `rdma/ib_verbs.h`, `iw_cxgb4.h`.
- Detected declarations: `struct c4iw_debugfs_data`, `struct qp_list`, `function debugfs_read`, `function c4iw_log_wr_stats`, `function wr_log_show`, `function wr_log_open`, `function wr_log_clear`, `function set_ep_sin_addrs`, `function set_ep_sin6_addrs`, `function dump_qp`.
- 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.