drivers/net/wireless/marvell/libertas/mesh.c
Source file repositories/reference/linux-study-clean/drivers/net/wireless/marvell/libertas/mesh.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wireless/marvell/libertas/mesh.c- Extension
.c- Size
- 29451 bytes
- Lines
- 1162
- Domain
- Driver Families
- Bucket
- drivers/net
- Inferred role
- Driver Families: operation-table or driver-model contract
- Status
- pattern 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.
- Defines an operation table; this is where Linux turns generic core objects into subsystem-specific behavior.
- 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/delay.hlinux/etherdevice.hlinux/hardirq.hlinux/netdevice.hlinux/if_ether.hlinux/if_arp.hlinux/kthread.hlinux/kfifo.hnet/cfg80211.hmesh.hdecl.hcmd.h
Detected Declarations
function lbs_mesh_accessfunction __lbs_mesh_config_sendfunction lbs_mesh_config_sendfunction lbs_mesh_configfunction lbs_mesh_set_channelfunction lbs_mesh_get_channelfunction anycast_mask_showfunction anycast_mask_storefunction prb_rsp_limit_showfunction prb_rsp_limit_storefunction lbs_mesh_showfunction lbs_mesh_storefunction mesh_get_default_parametersfunction bootflag_showfunction bootflag_storefunction boottime_showfunction boottime_storefunction channel_showfunction channel_storefunction mesh_id_showfunction mesh_id_storefunction protocol_id_showfunction protocol_id_storefunction metric_id_showfunction metric_id_storefunction capability_showfunction capability_storefunction lbs_init_meshfunction lbs_start_meshfunction lbs_deinit_meshfunction lbs_mesh_stopfunction lbs_mesh_dev_openfunction lbs_add_meshfunction lbs_remove_meshfunction lbs_mesh_set_txpdfunction lbs_mesh_ethtool_get_statsfunction lbs_mesh_ethtool_get_sset_countfunction lbs_mesh_ethtool_get_strings
Annotated Snippet
static const struct net_device_ops mesh_netdev_ops = {
.ndo_open = lbs_mesh_dev_open,
.ndo_stop = lbs_mesh_stop,
.ndo_start_xmit = lbs_hard_start_xmit,
.ndo_set_mac_address = lbs_set_mac_address,
.ndo_set_rx_mode = lbs_set_multicast_list,
};
/**
* lbs_add_mesh - add mshX interface
*
* @priv: A pointer to the &struct lbs_private structure
* returns: 0 if successful, -X otherwise
*/
static int lbs_add_mesh(struct lbs_private *priv)
{
struct net_device *mesh_dev = NULL;
struct wireless_dev *mesh_wdev;
int ret = 0;
/* Allocate a virtual mesh device */
mesh_wdev = kzalloc_obj(struct wireless_dev);
if (!mesh_wdev) {
lbs_deb_mesh("init mshX wireless device failed\n");
ret = -ENOMEM;
goto done;
}
mesh_dev = alloc_netdev(0, "msh%d", NET_NAME_UNKNOWN, ether_setup);
if (!mesh_dev) {
lbs_deb_mesh("init mshX device failed\n");
ret = -ENOMEM;
goto err_free_wdev;
}
mesh_wdev->iftype = NL80211_IFTYPE_MESH_POINT;
mesh_wdev->wiphy = priv->wdev->wiphy;
if (priv->mesh_tlv) {
sprintf(mesh_wdev->u.mesh.id, "mesh");
mesh_wdev->u.mesh.id_up_len = 4;
}
mesh_wdev->netdev = mesh_dev;
mesh_dev->ml_priv = priv;
mesh_dev->ieee80211_ptr = mesh_wdev;
priv->mesh_dev = mesh_dev;
mesh_dev->netdev_ops = &mesh_netdev_ops;
mesh_dev->ethtool_ops = &lbs_ethtool_ops;
eth_hw_addr_inherit(mesh_dev, priv->dev);
SET_NETDEV_DEV(priv->mesh_dev, priv->dev->dev.parent);
mesh_dev->flags |= IFF_BROADCAST | IFF_MULTICAST;
mesh_dev->sysfs_groups[0] = &lbs_mesh_attr_group;
mesh_dev->sysfs_groups[1] = &boot_opts_group;
mesh_dev->sysfs_groups[2] = &mesh_ie_group;
/* Register virtual mesh interface */
ret = register_netdev(mesh_dev);
if (ret) {
pr_err("cannot register mshX virtual interface\n");
goto err_free_netdev;
}
/* Everything successful */
ret = 0;
goto done;
err_free_netdev:
free_netdev(mesh_dev);
err_free_wdev:
kfree(mesh_wdev);
done:
return ret;
}
void lbs_remove_mesh(struct lbs_private *priv)
{
struct net_device *mesh_dev;
mesh_dev = priv->mesh_dev;
if (!mesh_dev)
return;
netif_stop_queue(mesh_dev);
Annotation
- Immediate include surface: `linux/delay.h`, `linux/etherdevice.h`, `linux/hardirq.h`, `linux/netdevice.h`, `linux/if_ether.h`, `linux/if_arp.h`, `linux/kthread.h`, `linux/kfifo.h`.
- Detected declarations: `function lbs_mesh_access`, `function __lbs_mesh_config_send`, `function lbs_mesh_config_send`, `function lbs_mesh_config`, `function lbs_mesh_set_channel`, `function lbs_mesh_get_channel`, `function anycast_mask_show`, `function anycast_mask_store`, `function prb_rsp_limit_show`, `function prb_rsp_limit_store`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: pattern 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.