drivers/infiniband/hw/cxgb4/cm.c
Source file repositories/reference/linux-study-clean/drivers/infiniband/hw/cxgb4/cm.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/infiniband/hw/cxgb4/cm.c- Extension
.c- Size
- 121192 bytes
- Lines
- 4477
- Domain
- Driver Families
- Bucket
- drivers/infiniband
- Inferred role
- Driver Families: implementation source
- Status
- source 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.
- 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/list.hlinux/workqueue.hlinux/skbuff.hlinux/timer.hlinux/notifier.hlinux/inetdevice.hlinux/ip.hlinux/tcp.hlinux/if_vlan.hnet/neighbour.hnet/netevent.hnet/route.hnet/tcp.hnet/ip6_route.hnet/addrconf.hrdma/ib_addr.hlibcxgb_cm.hiw_cxgb4.hclip_tbl.h
Detected Declarations
function deref_cm_idfunction ref_cm_idfunction deref_qpfunction ref_qpfunction start_ep_timerfunction stop_ep_timerfunction c4iw_l2t_sendfunction c4iw_ofld_sendfunction release_tidfunction set_emssfunction state_readfunction __state_setfunction state_setfunction alloc_ep_skb_listfunction remove_ep_tidfunction insert_ep_tidfunction _c4iw_free_epfunction release_ep_resourcesfunction status2errnofunction arp_failure_discardfunction mpa_start_arp_failurefunction _put_ep_safefunction _put_pass_ep_safefunction schedfunction pass_accept_rpl_arp_failurefunction act_open_req_arp_failurefunction abort_arp_failurefunction send_flowcfunction send_halfclosefunction read_tcbfunction send_abort_reqfunction send_abortfunction send_connectfunction send_mpa_reqfunction send_mpa_rejectfunction send_mpa_replyfunction act_establishfunction close_complete_upcallfunction peer_close_upcallfunction peer_abort_upcallfunction connect_reply_upcallfunction connect_request_upcallfunction established_upcallfunction update_rx_creditsfunction process_mpa_replyfunction process_mpa_requestfunction rx_datafunction complete_cached_srq_buffers
Annotated Snippet
if (!epc->wr_waitp) {
kfree(epc);
epc = NULL;
goto out;
}
kref_init(&epc->kref);
mutex_init(&epc->mutex);
c4iw_init_wr_wait(epc->wr_waitp);
}
pr_debug("alloc ep %p\n", epc);
out:
return epc;
}
static void remove_ep_tid(struct c4iw_ep *ep)
{
unsigned long flags;
xa_lock_irqsave(&ep->com.dev->hwtids, flags);
__xa_erase(&ep->com.dev->hwtids, ep->hwtid);
if (xa_empty(&ep->com.dev->hwtids))
wake_up(&ep->com.dev->wait);
xa_unlock_irqrestore(&ep->com.dev->hwtids, flags);
}
static int insert_ep_tid(struct c4iw_ep *ep)
{
unsigned long flags;
int err;
xa_lock_irqsave(&ep->com.dev->hwtids, flags);
err = __xa_insert(&ep->com.dev->hwtids, ep->hwtid, ep, GFP_KERNEL);
xa_unlock_irqrestore(&ep->com.dev->hwtids, flags);
return err;
}
/*
* Atomically lookup the ep ptr given the tid and grab a reference on the ep.
*/
static struct c4iw_ep *get_ep_from_tid(struct c4iw_dev *dev, unsigned int tid)
{
struct c4iw_ep *ep;
unsigned long flags;
xa_lock_irqsave(&dev->hwtids, flags);
ep = xa_load(&dev->hwtids, tid);
if (ep)
c4iw_get_ep(&ep->com);
xa_unlock_irqrestore(&dev->hwtids, flags);
return ep;
}
/*
* Atomically lookup the ep ptr given the stid and grab a reference on the ep.
*/
static struct c4iw_listen_ep *get_ep_from_stid(struct c4iw_dev *dev,
unsigned int stid)
{
struct c4iw_listen_ep *ep;
unsigned long flags;
xa_lock_irqsave(&dev->stids, flags);
ep = xa_load(&dev->stids, stid);
if (ep)
c4iw_get_ep(&ep->com);
xa_unlock_irqrestore(&dev->stids, flags);
return ep;
}
void _c4iw_free_ep(struct kref *kref)
{
struct c4iw_ep *ep;
ep = container_of(kref, struct c4iw_ep, com.kref);
pr_debug("ep %p state %s\n", ep, states[ep->com.state]);
if (test_bit(QP_REFERENCED, &ep->com.flags))
deref_qp(ep);
if (test_bit(RELEASE_RESOURCES, &ep->com.flags)) {
if (ep->com.remote_addr.ss_family == AF_INET6) {
struct sockaddr_in6 *sin6 =
(struct sockaddr_in6 *)
&ep->com.local_addr;
cxgb4_clip_release(
ep->com.dev->rdev.lldi.ports[0],
(const u32 *)&sin6->sin6_addr.s6_addr,
1);
}
cxgb4_remove_tid(ep->com.dev->rdev.lldi.tids, 0, ep->hwtid,
Annotation
- Immediate include surface: `linux/module.h`, `linux/list.h`, `linux/workqueue.h`, `linux/skbuff.h`, `linux/timer.h`, `linux/notifier.h`, `linux/inetdevice.h`, `linux/ip.h`.
- Detected declarations: `function deref_cm_id`, `function ref_cm_id`, `function deref_qp`, `function ref_qp`, `function start_ep_timer`, `function stop_ep_timer`, `function c4iw_l2t_send`, `function c4iw_ofld_send`, `function release_tid`, `function set_emss`.
- Atlas domain: Driver Families / drivers/infiniband.
- Implementation status: source 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.