net/ieee802154/core.c
Source file repositories/reference/linux-study-clean/net/ieee802154/core.c
File Facts
- System
- Linux kernel
- Corpus path
net/ieee802154/core.c- Extension
.c- Size
- 9131 bytes
- Lines
- 416
- 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/slab.hlinux/kernel.hlinux/module.hlinux/device.hnet/cfg802154.hnet/rtnetlink.hieee802154.hnl802154.hsysfs.hcore.h
Detected Declarations
struct wpan_phy_iter_datafunction wpan_phy_iterfunction wpan_phy_for_eachfunction cfg802154_rdev_by_wpan_phy_idxfunction list_for_each_entryfunction wpan_phy_newfunction wpan_phy_registerfunction wpan_phy_unregisterfunction wpan_phy_freefunction cfg802154_free_peer_structuresfunction list_for_each_entry_safefunction cfg802154_switch_netnsfunction list_for_each_entryfunction list_for_each_entry_continue_reversefunction cfg802154_dev_freefunction cfg802154_update_iface_numfunction cfg802154_netdev_notifier_callfunction cfg802154_pernet_exitfunction wpan_phy_class_initfunction wpan_phy_class_exitmodule init wpan_phy_class_initexport wpan_phy_findexport wpan_phy_for_eachexport wpan_phy_newexport wpan_phy_registerexport wpan_phy_unregisterexport wpan_phy_free
Annotated Snippet
ret = device_add(&phy->dev);
if (ret) {
rtnl_unlock();
return ret;
}
list_add_rcu(&rdev->list, &cfg802154_rdev_list);
cfg802154_rdev_list_generation++;
/* TODO phy registered lock */
rtnl_unlock();
/* TODO nl802154 phy notify */
return 0;
}
EXPORT_SYMBOL(wpan_phy_register);
void wpan_phy_unregister(struct wpan_phy *phy)
{
struct cfg802154_registered_device *rdev = wpan_phy_to_rdev(phy);
wait_event(rdev->dev_wait, ({
int __count;
rtnl_lock();
__count = rdev->opencount;
rtnl_unlock();
__count == 0; }));
rtnl_lock();
/* TODO nl802154 phy notify */
/* TODO phy registered lock */
WARN_ON(!list_empty(&rdev->wpan_dev_list));
/* First remove the hardware from everywhere, this makes
* it impossible to find from userspace.
*/
list_del_rcu(&rdev->list);
synchronize_rcu();
cfg802154_rdev_list_generation++;
device_del(&phy->dev);
rtnl_unlock();
}
EXPORT_SYMBOL(wpan_phy_unregister);
void wpan_phy_free(struct wpan_phy *phy)
{
put_device(&phy->dev);
}
EXPORT_SYMBOL(wpan_phy_free);
static void cfg802154_free_peer_structures(struct wpan_dev *wpan_dev)
{
struct ieee802154_pan_device *child, *tmp;
mutex_lock(&wpan_dev->association_lock);
kfree(wpan_dev->parent);
wpan_dev->parent = NULL;
list_for_each_entry_safe(child, tmp, &wpan_dev->children, node) {
list_del(&child->node);
kfree(child);
}
wpan_dev->nchildren = 0;
mutex_unlock(&wpan_dev->association_lock);
}
int cfg802154_switch_netns(struct cfg802154_registered_device *rdev,
struct net *net)
{
struct wpan_dev *wpan_dev;
int err = 0;
list_for_each_entry(wpan_dev, &rdev->wpan_dev_list, list) {
if (!wpan_dev->netdev)
continue;
wpan_dev->netdev->netns_immutable = false;
err = dev_change_net_namespace(wpan_dev->netdev, net, "wpan%d");
if (err)
break;
wpan_dev->netdev->netns_immutable = true;
}
Annotation
- Immediate include surface: `linux/slab.h`, `linux/kernel.h`, `linux/module.h`, `linux/device.h`, `net/cfg802154.h`, `net/rtnetlink.h`, `ieee802154.h`, `nl802154.h`.
- Detected declarations: `struct wpan_phy_iter_data`, `function wpan_phy_iter`, `function wpan_phy_for_each`, `function cfg802154_rdev_by_wpan_phy_idx`, `function list_for_each_entry`, `function wpan_phy_new`, `function wpan_phy_register`, `function wpan_phy_unregister`, `function wpan_phy_free`, `function cfg802154_free_peer_structures`.
- 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.