drivers/net/wireless/marvell/mwifiex/main.c
Source file repositories/reference/linux-study-clean/drivers/net/wireless/marvell/mwifiex/main.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wireless/marvell/mwifiex/main.c- Extension
.c- Size
- 52014 bytes
- Lines
- 1878
- 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/suspend.hnet/sock.hmain.hwmm.hcfg80211.h11n.h
Detected Declarations
function mwifiex_registerfunction mwifiex_unregisterfunction mwifiex_queue_main_workfunction mwifiex_queue_rx_workfunction mwifiex_process_rxfunction maybe_quirk_fw_disable_dsfunction mwifiex_main_processfunction mwifiex_free_adapterfunction mwifiex_terminate_workqueuefunction _mwifiex_fw_dpcfunction mwifiex_fw_dpcfunction andfunction mwifiex_openfunction mwifiex_closefunction mwifiex_bypass_tx_queuefunction mwifiex_queue_tx_pktfunction mwifiex_clone_skb_for_tx_statusfunction mwifiex_hard_start_xmitfunction mwifiex_set_mac_addressfunction mwifiex_ndo_set_mac_addressfunction mwifiex_set_multicast_listfunction netdev_mc_countfunction mwifiex_tx_timeoutfunction mwifiex_multi_chan_resyncfunction mwifiex_upload_device_dumpfunction mwifiex_drv_info_dumpfunction mwifiex_prepare_fw_dump_infofunction mwifiex_netdev_select_wmm_queuefunction mwifiex_init_priv_paramsfunction is_command_pendingfunction mwifiex_host_mlme_work_queuefunction mwifiex_rx_work_queuefunction mwifiex_main_work_queuefunction mwifiex_uninit_swfunction mwifiex_shutdown_swfunction mwifiex_add_cardfunction mwifiex_irq_wakeup_handlerfunction mwifiex_probe_offunction mwifiex_add_cardfunction mwifiex_remove_cardfunction _mwifiex_dbgfunction mwifiex_init_modulefunction mwifiex_cleanup_modulemodule init mwifiex_init_moduleexport mwifiex_queue_main_workexport mwifiex_main_processexport mwifiex_multi_chan_resyncexport mwifiex_upload_device_dump
Annotated Snippet
static const struct net_device_ops mwifiex_netdev_ops = {
.ndo_open = mwifiex_open,
.ndo_stop = mwifiex_close,
.ndo_start_xmit = mwifiex_hard_start_xmit,
.ndo_set_mac_address = mwifiex_ndo_set_mac_address,
.ndo_validate_addr = eth_validate_addr,
.ndo_tx_timeout = mwifiex_tx_timeout,
.ndo_get_stats = mwifiex_get_stats,
.ndo_set_rx_mode = mwifiex_set_multicast_list,
.ndo_select_queue = mwifiex_netdev_select_wmm_queue,
};
/*
* This function initializes the private structure parameters.
*
* The following wait queues are initialized -
* - IOCTL wait queue
* - Command wait queue
* - Statistics wait queue
*
* ...and the following default parameters are set -
* - Current key index : Set to 0
* - Rate index : Set to auto
* - Media connected : Set to disconnected
* - Adhoc link sensed : Set to false
* - Nick name : Set to null
* - Number of Tx timeout : Set to 0
* - Device address : Set to current address
* - Rx histogram statistc : Set to 0
*
* In addition, the CFG80211 work queue is also created.
*/
void mwifiex_init_priv_params(struct mwifiex_private *priv,
struct net_device *dev)
{
dev->netdev_ops = &mwifiex_netdev_ops;
dev->needs_free_netdev = true;
/* Initialize private structure */
priv->current_key_index = 0;
priv->media_connected = false;
memset(priv->mgmt_ie, 0,
sizeof(struct mwifiex_ie) * MAX_MGMT_IE_INDEX);
priv->beacon_idx = MWIFIEX_AUTO_IDX_MASK;
priv->proberesp_idx = MWIFIEX_AUTO_IDX_MASK;
priv->assocresp_idx = MWIFIEX_AUTO_IDX_MASK;
priv->gen_idx = MWIFIEX_AUTO_IDX_MASK;
priv->num_tx_timeout = 0;
if (is_valid_ether_addr(dev->dev_addr))
ether_addr_copy(priv->curr_addr, dev->dev_addr);
else
ether_addr_copy(priv->curr_addr, priv->adapter->perm_addr);
if (GET_BSS_ROLE(priv) == MWIFIEX_BSS_ROLE_STA ||
GET_BSS_ROLE(priv) == MWIFIEX_BSS_ROLE_UAP) {
priv->hist_data = kmalloc_obj(*priv->hist_data);
if (priv->hist_data)
mwifiex_hist_data_reset(priv);
}
}
/*
* This function check if command is pending.
*/
int is_command_pending(struct mwifiex_adapter *adapter)
{
int is_cmd_pend_q_empty;
spin_lock_bh(&adapter->cmd_pending_q_lock);
is_cmd_pend_q_empty = list_empty(&adapter->cmd_pending_q);
spin_unlock_bh(&adapter->cmd_pending_q_lock);
return !is_cmd_pend_q_empty;
}
/* This is the host mlme work queue function.
* It handles the host mlme operations.
*/
static void mwifiex_host_mlme_work_queue(struct work_struct *work)
{
struct mwifiex_adapter *adapter =
container_of(work, struct mwifiex_adapter, host_mlme_work);
if (test_bit(MWIFIEX_SURPRISE_REMOVED, &adapter->work_flags))
return;
/* Check for host mlme disconnection */
if (adapter->host_mlme_link_lost) {
if (adapter->priv_link_lost) {
mwifiex_reset_connect_state(adapter->priv_link_lost,
WLAN_REASON_DEAUTH_LEAVING,
Annotation
- Immediate include surface: `linux/suspend.h`, `net/sock.h`, `main.h`, `wmm.h`, `cfg80211.h`, `11n.h`.
- Detected declarations: `function mwifiex_register`, `function mwifiex_unregister`, `function mwifiex_queue_main_work`, `function mwifiex_queue_rx_work`, `function mwifiex_process_rx`, `function maybe_quirk_fw_disable_ds`, `function mwifiex_main_process`, `function mwifiex_free_adapter`, `function mwifiex_terminate_workqueue`, `function _mwifiex_fw_dpc`.
- 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.