drivers/net/wireless/microchip/wilc1000/netdev.c
Source file repositories/reference/linux-study-clean/drivers/net/wireless/microchip/wilc1000/netdev.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wireless/microchip/wilc1000/netdev.c- Extension
.c- Size
- 23153 bytes
- Lines
- 1026
- 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.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- 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/irq.hlinux/kthread.hlinux/firmware.hlinux/netdevice.hlinux/inetdevice.hcfg80211.hwlan_cfg.h
Detected Declarations
function Copyrightfunction isr_bh_routinefunction init_irqfunction deinit_irqfunction wilc_mac_indicatefunction wilc_for_each_viffunction wilc_wlan_set_bssidfunction wilc_wlan_get_num_conn_ifcsfunction wilc_wake_tx_queuesfunction wilc_txq_taskfunction wilc_wlan_get_firmwarefunction wilc_start_firmwarefunction wilc_firmware_downloadfunction wilc_init_fw_configfunction wlan_deinitialize_threadsfunction wilc_wlan_deinitializefunction wlan_initialize_threadsfunction wilc_wlan_initializefunction mac_init_fnfunction wilc_mac_openfunction wilc_set_mac_addrfunction wilc_set_multicast_listfunction wilc_tx_completefunction wilc_mac_xmitfunction wilc_for_each_viffunction wilc_mac_closefunction wilc_frmw_to_hostfunction wilc_wfi_mgmt_rxfunction wilc_netdev_cleanupfunction list_for_each_entry_safefunction wilc_get_available_idxexport wilc_netdev_cleanupexport wilc_netdev_ifc_init
Annotated Snippet
static const struct net_device_ops wilc_netdev_ops = {
.ndo_init = mac_init_fn,
.ndo_open = wilc_mac_open,
.ndo_stop = wilc_mac_close,
.ndo_set_mac_address = wilc_set_mac_addr,
.ndo_start_xmit = wilc_mac_xmit,
.ndo_get_stats = mac_stats,
.ndo_set_rx_mode = wilc_set_multicast_list,
};
void wilc_netdev_cleanup(struct wilc *wilc)
{
struct wilc_vif *vif, *vif_tmp;
if (!wilc)
return;
if (wilc->firmware) {
release_firmware(wilc->firmware);
wilc->firmware = NULL;
}
list_for_each_entry_safe(vif, vif_tmp, &wilc->vif_list, list) {
mutex_lock(&wilc->vif_mutex);
list_del_rcu(&vif->list);
wilc->vif_num--;
mutex_unlock(&wilc->vif_mutex);
synchronize_srcu(&wilc->srcu);
if (vif->ndev)
unregister_netdev(vif->ndev);
}
wilc_wfi_deinit_mon_interface(wilc, false);
destroy_workqueue(wilc->hif_workqueue);
wilc_wlan_cfg_deinit(wilc);
wlan_deinit_locks(wilc);
}
EXPORT_SYMBOL_GPL(wilc_netdev_cleanup);
static u8 wilc_get_available_idx(struct wilc *wl)
{
int idx = 0;
struct wilc_vif *vif;
int srcu_idx;
srcu_idx = srcu_read_lock(&wl->srcu);
wilc_for_each_vif(wl, vif) {
if (vif->idx == 0)
idx = 1;
else
idx = 0;
}
srcu_read_unlock(&wl->srcu, srcu_idx);
return idx;
}
struct wilc_vif *wilc_netdev_ifc_init(struct wilc *wl, const char *name,
int vif_type, enum nl80211_iftype type,
bool rtnl_locked)
{
u8 mac_address[ETH_ALEN];
struct net_device *ndev;
struct wilc_vif *vif;
int ret;
ndev = alloc_etherdev(sizeof(*vif));
if (!ndev)
return ERR_PTR(-ENOMEM);
vif = netdev_priv(ndev);
ndev->ieee80211_ptr = &vif->priv.wdev;
strcpy(ndev->name, name);
vif->wilc = wl;
vif->ndev = ndev;
ndev->ml_priv = vif;
ndev->netdev_ops = &wilc_netdev_ops;
SET_NETDEV_DEV(ndev, wiphy_dev(wl->wiphy));
vif->priv.wdev.wiphy = wl->wiphy;
vif->priv.wdev.netdev = ndev;
vif->priv.wdev.iftype = type;
vif->priv.dev = ndev;
ndev->needs_free_netdev = true;
vif->iftype = vif_type;
vif->idx = wilc_get_available_idx(wl);
vif->mac_opened = 0;
Annotation
- Immediate include surface: `linux/irq.h`, `linux/kthread.h`, `linux/firmware.h`, `linux/netdevice.h`, `linux/inetdevice.h`, `cfg80211.h`, `wlan_cfg.h`.
- Detected declarations: `function Copyright`, `function isr_bh_routine`, `function init_irq`, `function deinit_irq`, `function wilc_mac_indicate`, `function wilc_for_each_vif`, `function wilc_wlan_set_bssid`, `function wilc_wlan_get_num_conn_ifcs`, `function wilc_wake_tx_queues`, `function wilc_txq_task`.
- 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.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.