drivers/net/wireless/ath/ath9k/channel.c
Source file repositories/reference/linux-study-clean/drivers/net/wireless/ath/ath9k/channel.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wireless/ath/ath9k/channel.c- Extension
.c- Size
- 42985 bytes
- Lines
- 1645
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
ath9k.h
Detected Declarations
function Copyrightfunction ath_chanctx_initfunction ath_chanctx_set_channelfunction ath_is_go_chanctx_presentfunction ath_for_each_chanctxfunction list_for_each_entryfunction chanctx_event_deltafunction ath_chanctx_check_activefunction list_for_each_entryfunction ath_for_each_chanctxfunction ath_chanctx_get_nextfunction ath_chanctx_adjust_tbtt_deltafunction ath_chanctx_setup_timerfunction ath_chanctx_handle_bmissfunction ath_chanctx_offchannel_noafunction ath_chanctx_set_periodic_noafunction ath_chanctx_set_oneshot_noafunction ath_chanctx_eventfunction mgd_prepare_txfunction ath_chanctx_beacon_sent_evfunction ath_chanctx_beacon_recv_evfunction ath_scan_channel_durationfunction ath_chanctx_switchfunction ath_chanctx_offchan_switchfunction ath_for_each_chanctxfunction ath_scan_next_channelfunction ath_offchannel_nextfunction ath_roc_completefunction ath_scan_completefunction ath_scan_send_probefunction ath_scan_channel_startfunction ath_chanctx_timerfunction ath_offchannel_timerfunction ath_chanctx_send_vif_ps_framefunction ath_chanctx_send_ps_framefunction ath_chanctx_defer_switchfunction ath_offchannel_channel_changefunction ath_chanctx_set_nextfunction ath_chanctx_workfunction ath9k_offchannel_initfunction ath9k_init_channel_contextfunction ath9k_deinit_channel_contextfunction ath9k_is_chanctx_enabledfunction ath9k_chanctx_stop_queuesfunction ath9k_chanctx_wake_queuesfunction ath9k_update_p2p_ps_timerfunction ath9k_update_p2p_psfunction ath9k_get_ctwin
Annotated Snippet
list_for_each_entry(avp, &ctx->vifs, list) {
vif = avp->vif;
if (ieee80211_vif_type_p2p(vif) == NL80211_IFTYPE_P2P_GO) {
spin_unlock_bh(&sc->chan_lock);
return ctx;
}
}
}
spin_unlock_bh(&sc->chan_lock);
return NULL;
}
/**********************************************************/
/* Functions to handle the channel context state machine. */
/**********************************************************/
static const char *offchannel_state_string(enum ath_offchannel_state state)
{
switch (state) {
case_rtn_string(ATH_OFFCHANNEL_IDLE);
case_rtn_string(ATH_OFFCHANNEL_PROBE_SEND);
case_rtn_string(ATH_OFFCHANNEL_PROBE_WAIT);
case_rtn_string(ATH_OFFCHANNEL_SUSPEND);
case_rtn_string(ATH_OFFCHANNEL_ROC_START);
case_rtn_string(ATH_OFFCHANNEL_ROC_WAIT);
case_rtn_string(ATH_OFFCHANNEL_ROC_DONE);
default:
return "unknown";
}
}
static const char *chanctx_event_string(enum ath_chanctx_event ev)
{
switch (ev) {
case_rtn_string(ATH_CHANCTX_EVENT_BEACON_PREPARE);
case_rtn_string(ATH_CHANCTX_EVENT_BEACON_SENT);
case_rtn_string(ATH_CHANCTX_EVENT_TSF_TIMER);
case_rtn_string(ATH_CHANCTX_EVENT_BEACON_RECEIVED);
case_rtn_string(ATH_CHANCTX_EVENT_AUTHORIZED);
case_rtn_string(ATH_CHANCTX_EVENT_SWITCH);
case_rtn_string(ATH_CHANCTX_EVENT_ASSIGN);
case_rtn_string(ATH_CHANCTX_EVENT_UNASSIGN);
case_rtn_string(ATH_CHANCTX_EVENT_CHANGE);
case_rtn_string(ATH_CHANCTX_EVENT_ENABLE_MULTICHANNEL);
default:
return "unknown";
}
}
static const char *chanctx_state_string(enum ath_chanctx_state state)
{
switch (state) {
case_rtn_string(ATH_CHANCTX_STATE_IDLE);
case_rtn_string(ATH_CHANCTX_STATE_WAIT_FOR_BEACON);
case_rtn_string(ATH_CHANCTX_STATE_WAIT_FOR_TIMER);
case_rtn_string(ATH_CHANCTX_STATE_SWITCH);
case_rtn_string(ATH_CHANCTX_STATE_FORCE_ACTIVE);
default:
return "unknown";
}
}
static u32 chanctx_event_delta(struct ath_softc *sc)
{
ktime_t ts = ktime_get_raw();
s64 ms = ktime_ms_delta(ts, sc->last_event_time);
sc->last_event_time = ts;
return ms;
}
void ath_chanctx_check_active(struct ath_softc *sc, struct ath_chanctx *ctx)
{
struct ath_common *common = ath9k_hw_common(sc->sc_ah);
struct ath_chanctx *ictx;
struct ath_vif *avp;
bool active = false;
u8 n_active = 0;
if (!ctx)
return;
if (ctx == &sc->offchannel.chan) {
spin_lock_bh(&sc->chan_lock);
if (likely(sc->sched.channel_switch_time))
ctx->flush_timeout =
usecs_to_jiffies(sc->sched.channel_switch_time);
Annotation
- Immediate include surface: `ath9k.h`.
- Detected declarations: `function Copyright`, `function ath_chanctx_init`, `function ath_chanctx_set_channel`, `function ath_is_go_chanctx_present`, `function ath_for_each_chanctx`, `function list_for_each_entry`, `function chanctx_event_delta`, `function ath_chanctx_check_active`, `function list_for_each_entry`, `function ath_for_each_chanctx`.
- 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.