net/mac802154/scan.c
Source file repositories/reference/linux-study-clean/net/mac802154/scan.c
File Facts
- System
- Linux kernel
- Corpus path
net/mac802154/scan.c- Extension
.c- Size
- 27729 bytes
- Lines
- 918
- Domain
- Networking Core
- Bucket
- Sockets, Protocols, Packet Path, And Network Policy
- Inferred role
- Networking Core: implementation source
- Status
- source 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.
- 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/module.hlinux/rtnetlink.hnet/mac802154.hieee802154_i.hdriver-ops.h../ieee802154/nl802154.h
Detected Declarations
function Copyrightfunction mac802154_abort_scan_lockedfunction mac802154_scan_get_channel_timefunction mac802154_flush_queued_beaconsfunction list_for_each_entry_safefunction mac802154_scan_get_next_channelfunction mac802154_scan_find_next_chanfunction mac802154_scan_prepare_beacon_reqfunction mac802154_transmit_beacon_reqfunction mac802154_scan_workerfunction mac802154_trigger_scan_lockedfunction mac802154_process_beaconfunction mac802154_transmit_beaconfunction mac802154_beacon_workerfunction mac802154_stop_beacons_lockedfunction mac802154_send_beacons_lockedfunction mac802154_perform_associationfunction mac802154_process_association_respfunction mac802154_send_disassociation_notiffunction mac802154_send_association_resp_lockedfunction mac802154_process_association_reqfunction mac802154_process_disassociation_notif
Annotated Snippet
if (ret) {
rcu_read_unlock();
goto end_scan;
}
} while (!ieee802154_chan_is_valid(scan_req->wpan_phy, page, channel));
rcu_read_unlock();
/* Bypass the stack on purpose when changing the channel */
rtnl_lock();
ret = drv_set_channel(local, page, channel);
rtnl_unlock();
if (ret) {
dev_err(&sdata->dev->dev,
"Channel change failure during scan, aborting (%d)\n", ret);
goto end_scan;
}
local->scan_page = page;
local->scan_channel = channel;
rtnl_lock();
ret = drv_start(local, IEEE802154_FILTERING_3_SCAN, &local->addr_filt);
rtnl_unlock();
if (ret) {
dev_err(&sdata->dev->dev,
"Restarting failure after channel change, aborting (%d)\n", ret);
goto end_scan;
}
if (scan_req_type == NL802154_SCAN_ACTIVE) {
ret = mac802154_transmit_beacon_req(local, sdata);
if (ret)
dev_err(&sdata->dev->dev,
"Error when transmitting beacon request (%d)\n", ret);
}
ieee802154_configure_durations(wpan_phy, page, channel);
scan_duration = mac802154_scan_get_channel_time(scan_req_duration,
wpan_phy->symbol_duration);
dev_dbg(&sdata->dev->dev,
"Scan page %u channel %u for %ums\n",
page, channel, jiffies_to_msecs(scan_duration));
queue_delayed_work(local->mac_wq, &local->scan_work, scan_duration);
return;
end_scan:
rtnl_lock();
mac802154_scan_cleanup_locked(local, sdata, false);
rtnl_unlock();
}
int mac802154_trigger_scan_locked(struct ieee802154_sub_if_data *sdata,
struct cfg802154_scan_request *request)
{
struct ieee802154_local *local = sdata->local;
ASSERT_RTNL();
if (mac802154_is_scanning(local))
return -EBUSY;
if (request->type != NL802154_SCAN_PASSIVE &&
request->type != NL802154_SCAN_ACTIVE)
return -EOPNOTSUPP;
/* Store scanning parameters */
rcu_assign_pointer(local->scan_req, request);
/* Software scanning requires to set promiscuous mode, so we need to
* pause the Tx queue during the entire operation.
*/
ieee802154_mlme_op_pre(local);
sdata->required_filtering = IEEE802154_FILTERING_3_SCAN;
local->scan_page = request->page;
local->scan_channel = -1;
set_bit(IEEE802154_IS_SCANNING, &local->ongoing);
if (request->type == NL802154_SCAN_ACTIVE)
mac802154_scan_prepare_beacon_req(local);
nl802154_scan_started(request->wpan_phy, request->wpan_dev);
queue_delayed_work(local->mac_wq, &local->scan_work, 0);
return 0;
}
int mac802154_process_beacon(struct ieee802154_local *local,
struct sk_buff *skb,
Annotation
- Immediate include surface: `linux/module.h`, `linux/rtnetlink.h`, `net/mac802154.h`, `ieee802154_i.h`, `driver-ops.h`, `../ieee802154/nl802154.h`.
- Detected declarations: `function Copyright`, `function mac802154_abort_scan_locked`, `function mac802154_scan_get_channel_time`, `function mac802154_flush_queued_beacons`, `function list_for_each_entry_safe`, `function mac802154_scan_get_next_channel`, `function mac802154_scan_find_next_chan`, `function mac802154_scan_prepare_beacon_req`, `function mac802154_transmit_beacon_req`, `function mac802154_scan_worker`.
- Atlas domain: Networking Core / Sockets, Protocols, Packet Path, And Network Policy.
- 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.