net/wireless/scan.c
Source file repositories/reference/linux-study-clean/net/wireless/scan.c
File Facts
- System
- Linux kernel
- Corpus path
net/wireless/scan.c- Extension
.c- Size
- 107571 bytes
- Lines
- 4024
- Domain
- Networking Core
- Bucket
- Sockets, Protocols, Packet Path, And Network Policy
- Inferred role
- Networking Core: exported/initcall integration point
- Status
- integration implementation candidate
Why This File Exists
Networking stack implementation surface: socket APIs, protocol dispatch, packet flow, routing, filtering, and network namespaces.
- Networking stack implementation surface: socket APIs, protocol dispatch, packet flow, routing, filtering, and network namespaces.
- 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.
- 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
linux/kernel.hlinux/slab.hlinux/module.hlinux/netdevice.hlinux/wireless.hlinux/nl80211.hlinux/etherdevice.hlinux/crc32.hlinux/bitfield.hnet/arp.hnet/cfg80211.hnet/cfg80211-wext.hnet/iw_handler.hkunit/visibility.hcore.hnl80211.hwext-compat.hrdev-ops.h
Detected Declarations
struct colocated_ap_datastruct cfg80211_inform_single_bss_datastruct cfg80211_mlestruct tbtt_info_iter_dataenum bss_compare_modefunction bss_freefunction bss_ref_getfunction bss_ref_putfunction __cfg80211_unlink_bssfunction cfg80211_is_element_inheritedfunction cfg80211_copy_elem_with_fragsfunction for_each_elementfunction cfg80211_gen_new_iefunction inheritedfunction is_bssfunction cfg80211_add_nontrans_listfunction __cfg80211_bss_expirefunction list_for_each_entry_safefunction cfg80211_bss_expire_oldestfunction list_for_each_entryfunction cfg80211_parse_bss_paramfunction cfg80211_calc_short_ssidfunction cfg80211_free_coloc_ap_listfunction list_for_each_entry_safefunction cfg80211_parse_ap_infofunction cfg80211_iter_rnrfunction for_each_element_idfunction cfg80211_parse_colocated_ap_iterfunction list_for_each_entryfunction cfg80211_parse_colocated_apfunction cfg80211_scan_req_add_chanfunction cfg80211_find_ssid_matchfunction cfg80211_scan_6ghzfunction list_for_each_entryfunction list_for_each_entryfunction list_for_each_entryfunction cfg80211_scanfunction ___cfg80211_scan_donefunction __cfg80211_scan_donefunction cfg80211_scan_donefunction cfg80211_add_sched_scan_reqfunction cfg80211_del_sched_scan_reqfunction cfg80211_find_sched_scan_reqfunction list_for_each_entry_rcufunction cfg80211_sched_scan_req_possiblefunction list_for_each_entryfunction cfg80211_sched_scan_results_wkfunction list_for_each_entry_safe
Annotated Snippet
struct colocated_ap_data {
const struct element *ssid_elem;
struct list_head ap_list;
u32 s_ssid_tmp;
int n_coloc;
};
static enum cfg80211_rnr_iter_ret
cfg80211_parse_colocated_ap_iter(void *_data, u8 type,
const struct ieee80211_neighbor_ap_info *info,
const u8 *tbtt_info, u8 tbtt_info_len)
{
struct colocated_ap_data *data = _data;
struct cfg80211_colocated_ap *entry;
enum nl80211_band band;
if (type != IEEE80211_TBTT_INFO_TYPE_TBTT)
return RNR_ITER_CONTINUE;
if (!ieee80211_operating_class_to_band(info->op_class, &band))
return RNR_ITER_CONTINUE;
/* TBTT info must include bss param + BSSID + (short SSID or
* same_ssid bit to be set). Ignore other options, and move to
* the next AP info
*/
if (band != NL80211_BAND_6GHZ ||
!(tbtt_info_len == offsetofend(struct ieee80211_tbtt_info_7_8_9,
bss_params) ||
tbtt_info_len == sizeof(struct ieee80211_tbtt_info_7_8_9) ||
tbtt_info_len >= offsetofend(struct ieee80211_tbtt_info_ge_11,
bss_params)))
return RNR_ITER_CONTINUE;
entry = kzalloc_obj(*entry, GFP_ATOMIC);
if (!entry)
return RNR_ITER_ERROR;
entry->center_freq =
ieee80211_channel_to_frequency(info->channel, band);
if (!cfg80211_parse_ap_info(entry, tbtt_info, tbtt_info_len,
data->ssid_elem, data->s_ssid_tmp)) {
struct cfg80211_colocated_ap *tmp;
/* Don't add duplicate BSSIDs on the same channel. */
list_for_each_entry(tmp, &data->ap_list, list) {
if (ether_addr_equal(tmp->bssid, entry->bssid) &&
tmp->center_freq == entry->center_freq) {
kfree(entry);
return RNR_ITER_CONTINUE;
}
}
data->n_coloc++;
list_add_tail(&entry->list, &data->ap_list);
} else {
kfree(entry);
}
return RNR_ITER_CONTINUE;
}
VISIBLE_IF_CFG80211_KUNIT int
cfg80211_parse_colocated_ap(const struct cfg80211_bss_ies *ies,
struct list_head *list)
{
struct colocated_ap_data data = {};
int ret;
INIT_LIST_HEAD(&data.ap_list);
ret = cfg80211_calc_short_ssid(ies, &data.ssid_elem, &data.s_ssid_tmp);
if (ret)
return 0;
if (!cfg80211_iter_rnr(ies->data, ies->len,
cfg80211_parse_colocated_ap_iter, &data)) {
cfg80211_free_coloc_ap_list(&data.ap_list);
return 0;
}
list_splice_tail(&data.ap_list, list);
return data.n_coloc;
}
EXPORT_SYMBOL_IF_CFG80211_KUNIT(cfg80211_parse_colocated_ap);
static void cfg80211_scan_req_add_chan(struct cfg80211_scan_request *request,
struct ieee80211_channel *chan,
bool add_to_6ghz)
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/slab.h`, `linux/module.h`, `linux/netdevice.h`, `linux/wireless.h`, `linux/nl80211.h`, `linux/etherdevice.h`, `linux/crc32.h`.
- Detected declarations: `struct colocated_ap_data`, `struct cfg80211_inform_single_bss_data`, `struct cfg80211_mle`, `struct tbtt_info_iter_data`, `enum bss_compare_mode`, `function bss_free`, `function bss_ref_get`, `function bss_ref_put`, `function __cfg80211_unlink_bss`, `function cfg80211_is_element_inherited`.
- Atlas domain: Networking Core / Sockets, Protocols, Packet Path, And Network Policy.
- 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.