drivers/net/wireless/ath/ath6kl/htc_mbox.c
Source file repositories/reference/linux-study-clean/drivers/net/wireless/ath/ath6kl/htc_mbox.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wireless/ath/ath6kl/htc_mbox.c- Extension
.c- Size
- 76246 bytes
- Lines
- 2931
- 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.hhif.hdebug.hhif-ops.htrace.hlinux/unaligned.h
Detected Declarations
function ath6kl_credit_depositfunction ath6kl_credit_initfunction list_for_each_entryfunction list_for_each_entryfunction ath6kl_htc_mbox_credit_setupfunction ath6kl_credit_reducefunction ath6kl_credit_updatefunction list_for_each_entryfunction ath6kl_credit_seekfunction list_for_each_entry_reversefunction ath6kl_credit_redistributefunction list_for_each_entryfunction htc_set_credit_distfunction ath6kl_htc_tx_buf_alignfunction ath6kl_htc_tx_prep_pktfunction htc_reclaim_txctrl_buffunction htc_tx_comp_updatefunction htc_tx_completefunction htc_tx_comp_handlerfunction htc_async_tx_scat_completefunction ath6kl_htc_tx_issuefunction htc_check_creditsfunction ath6kl_htc_tx_pkts_getfunction htc_get_credit_paddingfunction ath6kl_htc_tx_setup_scat_listfunction ath6kl_htc_tx_bundlefunction ath6kl_htc_tx_from_queuefunction ath6kl_htc_tx_tryfunction htc_chk_ep_txqfunction dynamicfunction htc_setup_tx_completefunction ath6kl_htc_set_credit_distfunction ath6kl_htc_mbox_txfunction ath6kl_htc_mbox_flush_txepfunction list_for_each_entry_safefunction list_for_each_entry_safefunction ath6kl_htc_flush_txep_allfunction ath6kl_htc_mbox_activity_changedfunction ath6kl_htc_rx_update_statsfunction htc_valid_rx_frame_lenfunction htc_add_rxbuffunction htc_reclaim_rxbuffunction reclaim_rx_ctrl_buffunction ath6kl_htc_rx_packetfunction ath6kl_htc_rx_set_indicatefunction ath6kl_htc_rx_chk_water_markfunction ath6kl_htc_rx_setupfunction ath6kl_htc_rx_alloc
Annotated Snippet
if (tot_credits > 4) {
if ((cur_ep_dist->svc_id == WMI_DATA_BK_SVC) ||
(cur_ep_dist->svc_id == WMI_DATA_BE_SVC)) {
ath6kl_credit_deposit(cred_info,
cur_ep_dist,
cur_ep_dist->cred_min);
cur_ep_dist->dist_flags |= HTC_EP_ACTIVE;
}
}
if (cur_ep_dist->svc_id == WMI_CONTROL_SVC) {
ath6kl_credit_deposit(cred_info, cur_ep_dist,
cur_ep_dist->cred_min);
/*
* Control service is always marked active, it
* never goes inactive EVER.
*/
cur_ep_dist->dist_flags |= HTC_EP_ACTIVE;
}
/*
* Streams have to be created (explicit | implicit) for all
* kinds of traffic. BE endpoints are also inactive in the
* beginning. When BE traffic starts it creates implicit
* streams that redistributes credits.
*
* Note: all other endpoints have minimums set but are
* initially given NO credits. credits will be distributed
* as traffic activity demands
*/
}
/*
* For ath6kl_credit_seek function,
* it use list_for_each_entry_reverse to walk around the whole ep list.
* Therefore assign this lowestpri_ep_dist after walk around the ep_list
*/
cred_info->lowestpri_ep_dist = cur_ep_dist->list;
WARN_ON(cred_info->cur_free_credits <= 0);
list_for_each_entry(cur_ep_dist, ep_list, list) {
if (cur_ep_dist->endpoint == ENDPOINT_0)
continue;
if (cur_ep_dist->svc_id == WMI_CONTROL_SVC) {
cur_ep_dist->cred_norm = cur_ep_dist->cred_per_msg;
} else {
/*
* For the remaining data endpoints, we assume that
* each cred_per_msg are the same. We use a simple
* calculation here, we take the remaining credits
* and determine how many max messages this can
* cover and then set each endpoint's normal value
* equal to 3/4 this amount.
*/
count = (cred_info->cur_free_credits /
cur_ep_dist->cred_per_msg)
* cur_ep_dist->cred_per_msg;
count = (count * 3) >> 2;
count = max(count, cur_ep_dist->cred_per_msg);
cur_ep_dist->cred_norm = count;
}
ath6kl_dbg(ATH6KL_DBG_CREDIT,
"credit ep %d svc_id %d credits %d per_msg %d norm %d min %d\n",
cur_ep_dist->endpoint,
cur_ep_dist->svc_id,
cur_ep_dist->credits,
cur_ep_dist->cred_per_msg,
cur_ep_dist->cred_norm,
cur_ep_dist->cred_min);
}
}
/* initialize and setup credit distribution */
static int ath6kl_htc_mbox_credit_setup(struct htc_target *htc_target,
struct ath6kl_htc_credit_info *cred_info)
{
u16 servicepriority[5];
memset(cred_info, 0, sizeof(struct ath6kl_htc_credit_info));
servicepriority[0] = WMI_CONTROL_SVC; /* highest */
servicepriority[1] = WMI_DATA_VO_SVC;
servicepriority[2] = WMI_DATA_VI_SVC;
servicepriority[3] = WMI_DATA_BE_SVC;
servicepriority[4] = WMI_DATA_BK_SVC; /* lowest */
/* set priority list */
Annotation
- Immediate include surface: `core.h`, `hif.h`, `debug.h`, `hif-ops.h`, `trace.h`, `linux/unaligned.h`.
- Detected declarations: `function ath6kl_credit_deposit`, `function ath6kl_credit_init`, `function list_for_each_entry`, `function list_for_each_entry`, `function ath6kl_htc_mbox_credit_setup`, `function ath6kl_credit_reduce`, `function ath6kl_credit_update`, `function list_for_each_entry`, `function ath6kl_credit_seek`, `function list_for_each_entry_reverse`.
- 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.