drivers/target/iscsi/cxgbit/cxgbit_cm.c
Source file repositories/reference/linux-study-clean/drivers/target/iscsi/cxgbit/cxgbit_cm.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/target/iscsi/cxgbit/cxgbit_cm.c- Extension
.c- Size
- 48372 bytes
- Lines
- 2019
- Domain
- Driver Families
- Bucket
- drivers/target
- 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.hlibcxgb_cm.hcxgbit.hclip_tbl.h
Detected Declarations
function Copyrightfunction cxgbit_wake_upfunction cxgbit_wait_for_replyfunction cxgbit_np_hashfnfunction cxgbit_np_hash_addfunction cxgbit_np_hash_findfunction cxgbit_np_hash_delfunction _cxgbit_free_cnpfunction cxgbit_create_server6function cxgbit_create_server4function list_for_each_entryfunction cxgbit_inaddr_anyfunction __cxgbit_setup_cdev_npfunction cxgbit_setup_cdev_npfunction cxgbit_setup_all_npfunction list_for_each_entryfunction cxgbit_setup_npfunction cxgbit_set_conn_infofunction cxgbit_accept_npfunction __cxgbit_free_cdev_npfunction cxgbit_free_all_npfunction cxgbit_free_cdev_npfunction cxgbit_free_npfunction cxgbit_send_halfclosefunction cxgbit_arp_failure_discardfunction cxgbit_abort_arp_failurefunction cxgbit_send_abort_reqfunction __cxgbit_abort_connfunction cxgbit_abort_connfunction __cxgbit_free_connfunction cxgbit_free_connfunction cxgbit_set_emssfunction cxgbit_free_skbfunction _cxgbit_free_cskfunction cxgbit_set_tcp_windowfunction cxgbit_get_iscsi_dcb_statefunction cxgbit_select_priorityfunction cxgbit_get_iscsi_dcb_priorityfunction cxgbit_offload_initfunction cxgbit_ofld_sendfunction cxgbit_release_tidfunction cxgbit_l2t_sendfunction cxgbit_send_rx_creditsfunction cxgbit_rx_data_ackfunction cxgbit_alloc_csk_skbfunction cxgbit_pass_accept_rplfunction cxgbit_pass_accept_reqfunction cxgbit_tx_flowc_wr_credits
Annotated Snippet
if (p->cnp == cnp) {
stid = p->stid;
break;
}
}
spin_unlock(&cdev->np_lock);
return stid;
}
static int cxgbit_np_hash_del(struct cxgbit_device *cdev, struct cxgbit_np *cnp)
{
int stid = -1, bucket = cxgbit_np_hashfn(cnp);
struct np_info *p, **prev = &cdev->np_hash_tab[bucket];
spin_lock(&cdev->np_lock);
for (p = *prev; p; prev = &p->next, p = p->next) {
if (p->cnp == cnp) {
stid = p->stid;
*prev = p->next;
kfree(p);
break;
}
}
spin_unlock(&cdev->np_lock);
return stid;
}
void _cxgbit_free_cnp(struct kref *kref)
{
struct cxgbit_np *cnp;
cnp = container_of(kref, struct cxgbit_np, kref);
kfree(cnp);
}
static int
cxgbit_create_server6(struct cxgbit_device *cdev, unsigned int stid,
struct cxgbit_np *cnp)
{
struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)
&cnp->com.local_addr;
int addr_type;
int ret;
pr_debug("%s: dev = %s; stid = %u; sin6_port = %u\n",
__func__, cdev->lldi.ports[0]->name, stid, sin6->sin6_port);
addr_type = ipv6_addr_type((const struct in6_addr *)
&sin6->sin6_addr);
if (addr_type != IPV6_ADDR_ANY) {
ret = cxgb4_clip_get(cdev->lldi.ports[0],
(const u32 *)&sin6->sin6_addr.s6_addr, 1);
if (ret) {
pr_err("Unable to find clip table entry. laddr %pI6. Error:%d.\n",
sin6->sin6_addr.s6_addr, ret);
return -ENOMEM;
}
}
cxgbit_get_cnp(cnp);
cxgbit_init_wr_wait(&cnp->com.wr_wait);
ret = cxgb4_create_server6(cdev->lldi.ports[0],
stid, &sin6->sin6_addr,
sin6->sin6_port,
cdev->lldi.rxq_ids[0]);
if (!ret)
ret = cxgbit_wait_for_reply(cdev, &cnp->com.wr_wait,
0, 10, __func__);
else if (ret > 0)
ret = net_xmit_errno(ret);
else
cxgbit_put_cnp(cnp);
if (ret) {
if (ret != -ETIMEDOUT)
cxgb4_clip_release(cdev->lldi.ports[0],
(const u32 *)&sin6->sin6_addr.s6_addr, 1);
pr_err("create server6 err %d stid %d laddr %pI6 lport %d\n",
ret, stid, sin6->sin6_addr.s6_addr,
ntohs(sin6->sin6_port));
}
return ret;
}
static int
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 Copyright`, `function cxgbit_wake_up`, `function cxgbit_wait_for_reply`, `function cxgbit_np_hashfn`, `function cxgbit_np_hash_add`, `function cxgbit_np_hash_find`, `function cxgbit_np_hash_del`, `function _cxgbit_free_cnp`, `function cxgbit_create_server6`, `function cxgbit_create_server4`.
- Atlas domain: Driver Families / drivers/target.
- 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.