drivers/net/wireless/ath/ath6kl/htc_pipe.c
Source file repositories/reference/linux-study-clean/drivers/net/wireless/ath/ath6kl/htc_pipe.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wireless/ath/ath6kl/htc_pipe.c- Extension
.c- Size
- 43954 bytes
- Lines
- 1725
- Domain
- Driver Families
- Bucket
- drivers/net
- 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
core.hdebug.hhif-ops.h
Detected Declarations
function restore_tx_packetfunction do_send_completionfunction send_packet_completionfunction get_htc_packet_credit_basedfunction get_htc_packetfunction htc_issue_packetsfunction htc_try_sendfunction list_for_each_entry_safefunction destroy_htc_txctrl_packetfunction htc_free_txctrl_packetfunction htc_txctrl_completefunction htc_setup_target_buffer_assignmentsfunction htc_process_credit_reportfunction htc_flush_tx_endpointfunction ath6kl_htc_pipe_tx_completefunction htc_send_packets_multiplefunction list_for_each_entry_safefunction free_htc_packet_containerfunction htc_process_trailerfunction do_recv_completionfunction recv_packet_completionfunction ath6kl_htc_pipe_rx_completefunction initializationfunction htc_flush_rx_queuefunction htc_wait_recv_ctrl_messagefunction htc_rxctrl_completefunction reset_endpoint_statesfunction htc_config_target_hif_pipefunction htc_get_credit_allocfunction ath6kl_htc_pipe_conn_servicefunction ath6kl_htc_pipe_cleanupfunction ath6kl_htc_pipe_startfunction ath6kl_htc_pipe_stopfunction ath6kl_htc_pipe_get_rxbuf_numfunction ath6kl_htc_pipe_txfunction ath6kl_htc_pipe_wait_targetfunction ath6kl_htc_pipe_flush_txepfunction ath6kl_htc_pipe_add_rxbuf_multiplefunction ath6kl_htc_pipe_activity_changedfunction list_for_each_entry_safefunction ath6kl_htc_pipe_credit_setupfunction ath6kl_htc_pipe_attach
Annotated Snippet
if (transfer_len <= target->tgt_cred_sz) {
credits_required = 1;
} else {
/* figure out how many credits this message requires */
credits_required = transfer_len / target->tgt_cred_sz;
remainder = transfer_len % target->tgt_cred_sz;
if (remainder)
credits_required++;
}
ath6kl_dbg(ATH6KL_DBG_HTC, "%s: creds required:%d got:%d\n",
__func__, credits_required, ep->cred_dist.credits);
if (ep->eid == ENDPOINT_0) {
/*
* endpoint 0 is special, it always has a credit and
* does not require credit based flow control
*/
credits_required = 0;
} else {
if (ep->cred_dist.credits < credits_required)
break;
ep->cred_dist.credits -= credits_required;
ep->ep_st.cred_cosumd += credits_required;
/* check if we need credits back from the target */
if (ep->cred_dist.credits <
ep->cred_dist.cred_per_msg) {
/* tell the target we need credits ASAP! */
send_flags |= HTC_FLAGS_NEED_CREDIT_UPDATE;
ep->ep_st.cred_low_indicate += 1;
ath6kl_dbg(ATH6KL_DBG_HTC,
"%s: host needs credits\n",
__func__);
}
}
/* now we can fully dequeue */
packet = list_first_entry(&ep->txq, struct htc_packet, list);
list_del(&packet->list);
/* save the number of credits this packet consumed */
packet->info.tx.cred_used = credits_required;
/* save send flags */
packet->info.tx.flags = send_flags;
packet->info.tx.seqno = ep->seqno;
ep->seqno++;
/* queue this packet into the caller's queue */
list_add_tail(&packet->list, queue);
}
}
static void get_htc_packet(struct htc_target *target,
struct htc_endpoint *ep,
struct list_head *queue, int resources)
{
struct htc_packet *packet;
/* NOTE : the TX lock is held when this function is called */
/* loop until we can grab as many packets out of the queue as we can */
while (resources) {
if (list_empty(&ep->txq))
break;
packet = list_first_entry(&ep->txq, struct htc_packet, list);
list_del(&packet->list);
ath6kl_dbg(ATH6KL_DBG_HTC,
"%s: got packet:0x%p , new queue depth: %d\n",
__func__, packet, get_queue_depth(&ep->txq));
packet->info.tx.seqno = ep->seqno;
packet->info.tx.flags = 0;
packet->info.tx.cred_used = 0;
ep->seqno++;
/* queue this packet into the caller's queue */
list_add_tail(&packet->list, queue);
resources--;
}
}
static int htc_issue_packets(struct htc_target *target,
struct htc_endpoint *ep,
struct list_head *pkt_queue)
{
int status = 0;
Annotation
- Immediate include surface: `core.h`, `debug.h`, `hif-ops.h`.
- Detected declarations: `function restore_tx_packet`, `function do_send_completion`, `function send_packet_completion`, `function get_htc_packet_credit_based`, `function get_htc_packet`, `function htc_issue_packets`, `function htc_try_send`, `function list_for_each_entry_safe`, `function destroy_htc_txctrl_packet`, `function htc_free_txctrl_packet`.
- Atlas domain: Driver Families / drivers/net.
- 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.