drivers/net/wireless/quantenna/qtnfmac/trans.c
Source file repositories/reference/linux-study-clean/drivers/net/wireless/quantenna/qtnfmac/trans.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wireless/quantenna/qtnfmac/trans.c- Extension
.c- Size
- 5083 bytes
- Lines
- 214
- Domain
- Driver Families
- Bucket
- drivers/net
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/types.hlinux/export.hlinux/slab.hcore.hcommands.hevent.hbus.h
Detected Declarations
function qtnf_trans_send_cmd_with_respfunction qtnf_trans_signal_cmdrespfunction qtnf_trans_event_enqueuefunction qtnf_trans_initfunction qtnf_trans_free_eventsfunction qtnf_trans_freefunction qtnf_trans_handle_rx_ctl_packetexport qtnf_trans_handle_rx_ctl_packet
Annotated Snippet
if (status == 0) {
ret = -ETIMEDOUT;
pr_err("response timeout\n");
} else {
ret = -EINTR;
pr_debug("interrupted\n");
}
}
if (unlikely(!resp_skb || resp_not_handled)) {
if (!ret)
ret = -EFAULT;
goto out;
}
ret = 0;
*response_skb = resp_skb;
out:
if (unlikely(resp_skb && resp_not_handled))
dev_kfree_skb(resp_skb);
return ret;
}
static void qtnf_trans_signal_cmdresp(struct qtnf_bus *bus, struct sk_buff *skb)
{
struct qtnf_cmd_ctl_node *ctl_node = &bus->trans.curr_cmd;
const struct qlink_resp *resp = (const struct qlink_resp *)skb->data;
const u16 recvd_seq_num = le16_to_cpu(resp->seq_num);
spin_lock(&ctl_node->resp_lock);
if (unlikely(!ctl_node->waiting_for_resp)) {
pr_err("unexpected response\n");
goto out_err;
}
if (unlikely(recvd_seq_num != ctl_node->seq_num)) {
pr_err("seq num mismatch\n");
goto out_err;
}
ctl_node->resp_skb = skb;
ctl_node->waiting_for_resp = false;
spin_unlock(&ctl_node->resp_lock);
complete(&ctl_node->cmd_resp_completion);
return;
out_err:
spin_unlock(&ctl_node->resp_lock);
dev_kfree_skb(skb);
}
static int qtnf_trans_event_enqueue(struct qtnf_bus *bus, struct sk_buff *skb)
{
struct qtnf_qlink_transport *trans = &bus->trans;
if (likely(skb_queue_len(&trans->event_queue) <
trans->event_queue_max_len)) {
skb_queue_tail(&trans->event_queue, skb);
queue_work(bus->workqueue, &bus->event_work);
} else {
pr_warn("event dropped due to queue overflow\n");
dev_kfree_skb(skb);
return -1;
}
return 0;
}
void qtnf_trans_init(struct qtnf_bus *bus)
{
struct qtnf_qlink_transport *trans = &bus->trans;
init_completion(&trans->curr_cmd.cmd_resp_completion);
spin_lock_init(&trans->curr_cmd.resp_lock);
spin_lock(&trans->curr_cmd.resp_lock);
trans->curr_cmd.seq_num = 0;
trans->curr_cmd.waiting_for_resp = false;
trans->curr_cmd.resp_skb = NULL;
spin_unlock(&trans->curr_cmd.resp_lock);
/* Init event handling related fields */
skb_queue_head_init(&trans->event_queue);
trans->event_queue_max_len = QTNF_MAX_EVENT_QUEUE_LEN;
Annotation
- Immediate include surface: `linux/types.h`, `linux/export.h`, `linux/slab.h`, `core.h`, `commands.h`, `event.h`, `bus.h`.
- Detected declarations: `function qtnf_trans_send_cmd_with_resp`, `function qtnf_trans_signal_cmdresp`, `function qtnf_trans_event_enqueue`, `function qtnf_trans_init`, `function qtnf_trans_free_events`, `function qtnf_trans_free`, `function qtnf_trans_handle_rx_ctl_packet`, `export qtnf_trans_handle_rx_ctl_packet`.
- Atlas domain: Driver Families / drivers/net.
- 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.