net/wireless/sme.c
Source file repositories/reference/linux-study-clean/net/wireless/sme.c
File Facts
- System
- Linux kernel
- Corpus path
net/wireless/sme.c- Extension
.c- Size
- 43913 bytes
- Lines
- 1624
- 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/etherdevice.hlinux/if_arp.hlinux/slab.hlinux/workqueue.hlinux/wireless.hlinux/export.hnet/iw_handler.hnet/cfg80211.hnet/rtnetlink.hnl80211.hreg.hrdev-ops.h
Detected Declarations
struct cfg80211_connfunction cfg80211_sme_freefunction cfg80211_conn_scanfunction cfg80211_conn_do_workfunction cfg80211_conn_workfunction list_for_each_entryfunction cfg80211_step_auth_nextfunction cfg80211_sme_scan_donefunction cfg80211_sme_rx_authfunction cfg80211_sme_rx_assoc_respfunction cfg80211_sme_deauthfunction cfg80211_sme_auth_timeoutfunction cfg80211_sme_disassocfunction cfg80211_sme_assoc_timeoutfunction cfg80211_sme_abandon_assocfunction cfg80211_wdev_release_bssesfunction for_each_valid_linkfunction cfg80211_wdev_release_link_bssesfunction for_each_valid_linkfunction cfg80211_sme_get_conn_iesfunction cfg80211_sme_connectfunction changedfunction cfg80211_sme_disconnectfunction cfg80211_is_all_idlefunction list_for_each_entryfunction disconnect_workfunction cfg80211_connect_result_release_bssesfunction for_each_valid_linkfunction __cfg80211_connect_resultfunction for_each_valid_linkfunction for_each_valid_linkfunction for_each_valid_linkfunction cfg80211_update_link_bssfunction cfg80211_connect_donefunction for_each_valid_linkfunction __cfg80211_roamedfunction for_each_valid_linkfunction for_each_valid_linkfunction cfg80211_roamedfunction for_each_valid_linkfunction __cfg80211_port_authorizedfunction cfg80211_port_authorizedfunction __cfg80211_disconnectedfunction cfg80211_disconnectedfunction cfg80211_connectfunction cfg80211_disconnectfunction cfg80211_autodisconnect_wkexport cfg80211_connect_done
Annotated Snippet
struct cfg80211_conn {
struct cfg80211_connect_params params;
/* these are sub-states of the _CONNECTING sme_state */
enum {
CFG80211_CONN_SCANNING,
CFG80211_CONN_SCAN_AGAIN,
CFG80211_CONN_AUTHENTICATE_NEXT,
CFG80211_CONN_AUTHENTICATING,
CFG80211_CONN_AUTH_FAILED_TIMEOUT,
CFG80211_CONN_ASSOCIATE_NEXT,
CFG80211_CONN_ASSOCIATING,
CFG80211_CONN_ASSOC_FAILED,
CFG80211_CONN_ASSOC_FAILED_TIMEOUT,
CFG80211_CONN_DEAUTH,
CFG80211_CONN_ABANDON,
CFG80211_CONN_CONNECTED,
} state;
u8 bssid[ETH_ALEN], prev_bssid[ETH_ALEN];
const u8 *ie;
size_t ie_len;
bool auto_auth, prev_bssid_valid;
};
static void cfg80211_sme_free(struct wireless_dev *wdev)
{
if (!wdev->conn)
return;
kfree(wdev->conn->ie);
kfree(wdev->conn);
wdev->conn = NULL;
}
static int cfg80211_conn_scan(struct wireless_dev *wdev)
{
struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy);
struct cfg80211_scan_request_int *request;
int n_channels, err;
lockdep_assert_wiphy(wdev->wiphy);
if (rdev->scan_req || rdev->scan_msg)
return -EBUSY;
if (wdev->conn->params.channel)
n_channels = 1;
else
n_channels = ieee80211_get_num_supported_channels(wdev->wiphy);
request = kzalloc(sizeof(*request) + sizeof(request->req.ssids[0]) +
sizeof(request->req.channels[0]) * n_channels,
GFP_KERNEL);
if (!request)
return -ENOMEM;
if (wdev->conn->params.channel) {
enum nl80211_band band = wdev->conn->params.channel->band;
struct ieee80211_supported_band *sband =
wdev->wiphy->bands[band];
if (!sband) {
kfree(request);
return -EINVAL;
}
request->req.channels[0] = wdev->conn->params.channel;
request->req.rates[band] = (1 << sband->n_bitrates) - 1;
} else {
int i = 0, j;
enum nl80211_band band;
struct ieee80211_supported_band *bands;
struct ieee80211_channel *channel;
for (band = 0; band < NUM_NL80211_BANDS; band++) {
bands = wdev->wiphy->bands[band];
if (!bands)
continue;
for (j = 0; j < bands->n_channels; j++) {
channel = &bands->channels[j];
if (channel->flags & IEEE80211_CHAN_DISABLED)
continue;
request->req.channels[i++] = channel;
}
request->req.rates[band] = (1 << bands->n_bitrates) - 1;
}
n_channels = i;
}
request->req.n_channels = n_channels;
request->req.ssids = (void *)request +
struct_size(request, req.channels, n_channels);
request->req.n_ssids = 1;
Annotation
- Immediate include surface: `linux/etherdevice.h`, `linux/if_arp.h`, `linux/slab.h`, `linux/workqueue.h`, `linux/wireless.h`, `linux/export.h`, `net/iw_handler.h`, `net/cfg80211.h`.
- Detected declarations: `struct cfg80211_conn`, `function cfg80211_sme_free`, `function cfg80211_conn_scan`, `function cfg80211_conn_do_work`, `function cfg80211_conn_work`, `function list_for_each_entry`, `function cfg80211_step_auth_next`, `function cfg80211_sme_scan_done`, `function cfg80211_sme_rx_auth`, `function cfg80211_sme_rx_assoc_resp`.
- 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.