drivers/net/wireless/ath/ath10k/htc.c
Source file repositories/reference/linux-study-clean/drivers/net/wireless/ath/ath10k/htc.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wireless/ath/ath10k/htc.c- Extension
.c- Size
- 34518 bytes
- Lines
- 1324
- 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.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/export.hcore.hhif.hdebug.h
Detected Declarations
function Copyrightfunction ath10k_htc_restore_tx_skbfunction ath10k_htc_notify_tx_completionfunction ath10k_htc_prepare_tx_skbfunction ath10k_htc_consume_creditfunction ath10k_htc_release_creditfunction ath10k_htc_sendfunction ath10k_htc_tx_completion_handlerfunction ath10k_htc_process_credit_reportfunction ath10k_htc_process_lookaheadfunction ath10k_htc_process_lookahead_bundlefunction ath10k_htc_process_trailerfunction ath10k_htc_rx_completion_handlerfunction ath10k_htc_control_rx_completefunction ath10k_htc_reset_endpoint_statesfunction ath10k_htc_get_credit_allocationfunction ath10k_htc_send_bundlefunction ath10k_htc_send_one_skbfunction ath10k_htc_send_bundle_skbsfunction ath10k_htc_bundle_tx_workfunction ath10k_htc_tx_complete_workfunction ath10k_htc_send_hlfunction ath10k_htc_setup_tx_reqfunction ath10k_htc_stop_hlfunction ath10k_htc_wait_targetfunction ath10k_htc_change_tx_credit_flowfunction ath10k_htc_connect_servicefunction ath10k_htc_pktlog_process_rxfunction ath10k_htc_pktlog_connectfunction ath10k_htc_pktlog_svc_supportedfunction ath10k_htc_startfunction ath10k_htc_initexport ath10k_htc_notify_tx_completionexport ath10k_htc_tx_completion_handlerexport ath10k_htc_process_trailerexport ath10k_htc_rx_completion_handler
Annotated Snippet
if (ret) {
ret = -EIO;
goto err_credits;
}
}
sg_item.transfer_id = ep->eid;
sg_item.transfer_context = skb;
sg_item.vaddr = skb->data;
sg_item.paddr = skb_cb->paddr;
sg_item.len = skb->len;
ret = ath10k_hif_tx_sg(htc->ar, ep->ul_pipe_id, &sg_item, 1);
if (ret)
goto err_unmap;
return 0;
err_unmap:
if (ar->bus_param.dev_type != ATH10K_DEV_TYPE_HL)
dma_unmap_single(dev, skb_cb->paddr, skb->len, DMA_TO_DEVICE);
err_credits:
ath10k_htc_release_credit(ep, skb_len);
err_pull:
skb_pull(skb, sizeof(struct ath10k_htc_hdr));
return ret;
}
void ath10k_htc_tx_completion_handler(struct ath10k *ar, struct sk_buff *skb)
{
struct ath10k_htc *htc = &ar->htc;
struct ath10k_skb_cb *skb_cb;
struct ath10k_htc_ep *ep;
if (WARN_ON_ONCE(!skb))
return;
skb_cb = ATH10K_SKB_CB(skb);
ep = &htc->endpoint[skb_cb->eid];
ath10k_htc_notify_tx_completion(ep, skb);
/* the skb now belongs to the completion handler */
}
EXPORT_SYMBOL(ath10k_htc_tx_completion_handler);
/***********/
/* Receive */
/***********/
static void
ath10k_htc_process_credit_report(struct ath10k_htc *htc,
const struct ath10k_htc_credit_report *report,
int len,
enum ath10k_htc_ep_id eid)
{
struct ath10k *ar = htc->ar;
struct ath10k_htc_ep *ep;
int i, n_reports;
if (len % sizeof(*report))
ath10k_warn(ar, "Uneven credit report len %d", len);
n_reports = len / sizeof(*report);
spin_lock_bh(&htc->tx_lock);
for (i = 0; i < n_reports; i++, report++) {
if (report->eid >= ATH10K_HTC_EP_COUNT)
break;
ep = &htc->endpoint[report->eid];
ep->tx_credits += report->credits;
ath10k_dbg(ar, ATH10K_DBG_HTC, "htc ep %d got %d credits (total %d)\n",
report->eid, report->credits, ep->tx_credits);
if (ep->ep_ops.ep_tx_credits) {
spin_unlock_bh(&htc->tx_lock);
ep->ep_ops.ep_tx_credits(htc->ar);
spin_lock_bh(&htc->tx_lock);
}
}
spin_unlock_bh(&htc->tx_lock);
}
static int
ath10k_htc_process_lookahead(struct ath10k_htc *htc,
const struct ath10k_htc_lookahead_report *report,
int len,
enum ath10k_htc_ep_id eid,
void *next_lookaheads,
Annotation
- Immediate include surface: `linux/export.h`, `core.h`, `hif.h`, `debug.h`.
- Detected declarations: `function Copyright`, `function ath10k_htc_restore_tx_skb`, `function ath10k_htc_notify_tx_completion`, `function ath10k_htc_prepare_tx_skb`, `function ath10k_htc_consume_credit`, `function ath10k_htc_release_credit`, `function ath10k_htc_send`, `function ath10k_htc_tx_completion_handler`, `function ath10k_htc_process_credit_report`, `function ath10k_htc_process_lookahead`.
- 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.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.