drivers/block/aoe/aoecmd.c
Source file repositories/reference/linux-study-clean/drivers/block/aoe/aoecmd.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/block/aoe/aoecmd.c- Extension
.c- Size
- 36167 bytes
- Lines
- 1767
- Domain
- Driver Families
- Bucket
- drivers/block
- 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/ata.hlinux/slab.hlinux/hdreg.hlinux/blk-mq.hlinux/skbuff.hlinux/netdevice.hlinux/moduleparam.hlinux/workqueue.hlinux/kthread.hnet/net_namespace.hlinux/unaligned.hlinux/uio.haoe.h
Detected Declarations
struct iocq_ktiofunction new_skbfunction getframe_deferredfunction getframefunction newtagfunction aoehdr_atainitfunction put_lbafunction ifrotatefunction skb_pool_putfunction skb_pool_getfunction aoe_freetframefunction newtframefunction newframefunction skb_fillupfunction fhashfunction ata_rw_frameinitfunction aoecmd_ata_rwfunction aoecmd_cfg_pktsfunction resendfunction tsince_hrfunction tsincefunction getiffunction ejectiffunction reassign_framefunction probefunction rtofunction rexmit_deferredfunction scornfunction count_targetsfunction rexmit_timerfunction list_for_each_safefunction bufinitfunction nextbuffunction aoecmd_workfunction aoecmd_sleepworkfunction ata_ident_fixstringfunction ataid_completefunction calc_rttavgfunction gettgtfunction bvcpyfunction __bio_for_each_segmentfunction aoe_end_requestfunction aoe_end_buffunction ktiocompletefunction ktiofunction kthreadfunction aoe_ktstopfunction aoe_ktstart
Annotated Snippet
struct iocq_ktio {
struct list_head head;
spinlock_t lock;
};
static struct iocq_ktio *iocq;
static struct page *empty_page;
static struct sk_buff *
new_skb(ulong len)
{
struct sk_buff *skb;
skb = alloc_skb(len + MAX_HEADER, GFP_ATOMIC);
if (skb) {
skb_reserve(skb, MAX_HEADER);
skb_reset_mac_header(skb);
skb_reset_network_header(skb);
skb->protocol = __constant_htons(ETH_P_AOE);
skb_checksum_none_assert(skb);
}
return skb;
}
static struct frame *
getframe_deferred(struct aoedev *d, u32 tag)
{
struct list_head *head, *pos, *nx;
struct frame *f;
head = &d->rexmitq;
list_for_each_safe(pos, nx, head) {
f = list_entry(pos, struct frame, head);
if (f->tag == tag) {
list_del(pos);
return f;
}
}
return NULL;
}
static struct frame *
getframe(struct aoedev *d, u32 tag)
{
struct frame *f;
struct list_head *head, *pos, *nx;
u32 n;
n = tag % NFACTIVE;
head = &d->factive[n];
list_for_each_safe(pos, nx, head) {
f = list_entry(pos, struct frame, head);
if (f->tag == tag) {
list_del(pos);
return f;
}
}
return NULL;
}
/*
* Leave the top bit clear so we have tagspace for userland.
* The bottom 16 bits are the xmit tick for rexmit/rttavg processing.
* This driver reserves tag -1 to mean "unused frame."
*/
static int
newtag(struct aoedev *d)
{
register ulong n;
n = jiffies & 0xffff;
return n | (++d->lasttag & 0x7fff) << 16;
}
static u32
aoehdr_atainit(struct aoedev *d, struct aoetgt *t, struct aoe_hdr *h)
{
u32 host_tag = newtag(d);
memcpy(h->src, t->ifp->nd->dev_addr, sizeof h->src);
memcpy(h->dst, t->addr, sizeof h->dst);
h->type = __constant_cpu_to_be16(ETH_P_AOE);
h->verfl = AOE_HVER;
h->major = cpu_to_be16(d->aoemajor);
h->minor = d->aoeminor;
h->cmd = AOECMD_ATA;
h->tag = cpu_to_be32(host_tag);
return host_tag;
}
Annotation
- Immediate include surface: `linux/ata.h`, `linux/slab.h`, `linux/hdreg.h`, `linux/blk-mq.h`, `linux/skbuff.h`, `linux/netdevice.h`, `linux/moduleparam.h`, `linux/workqueue.h`.
- Detected declarations: `struct iocq_ktio`, `function new_skb`, `function getframe_deferred`, `function getframe`, `function newtag`, `function aoehdr_atainit`, `function put_lba`, `function ifrotate`, `function skb_pool_put`, `function skb_pool_get`.
- Atlas domain: Driver Families / drivers/block.
- 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.